initial
This commit is contained in:
commit
9883323161
17470 files changed
+4470592
No files matched your search
@@ -0,0 +1,430 @@
|
||||
/**
|
||||
* @output wp-includes/js/admin-bar.js
|
||||
*/
|
||||
/**
|
||||
* Admin bar with Vanilla JS, no external dependencies.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {Object} document The document object.
|
||||
* @param {Object} window The window object.
|
||||
* @param {Object} navigator The navigator object.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
( function( document, window, navigator ) {
|
||||
document.addEventListener( 'DOMContentLoaded', function() {
|
||||
var adminBar = document.getElementById( 'wpadminbar' ),
|
||||
topMenuItems,
|
||||
allMenuItems,
|
||||
adminBarLogout,
|
||||
adminBarSearchForm,
|
||||
shortlink,
|
||||
skipLink,
|
||||
mobileEvent,
|
||||
adminBarSearchInput,
|
||||
i;
|
||||
|
||||
if ( ! adminBar || ! ( 'querySelectorAll' in adminBar ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
topMenuItems = adminBar.querySelectorAll( 'li.menupop' );
|
||||
allMenuItems = adminBar.querySelectorAll( '.ab-item' );
|
||||
adminBarLogout = document.querySelector( '#wp-admin-bar-logout a' );
|
||||
adminBarSearchForm = document.getElementById( 'adminbarsearch' );
|
||||
shortlink = document.getElementById( 'wp-admin-bar-get-shortlink' );
|
||||
skipLink = adminBar.querySelector( '.screen-reader-shortcut' );
|
||||
mobileEvent = /Mobile\/.+Safari/.test( navigator.userAgent ) ? 'touchstart' : 'click';
|
||||
|
||||
// Remove nojs class after the DOM is loaded.
|
||||
removeClass( adminBar, 'nojs' );
|
||||
|
||||
if ( 'ontouchstart' in window ) {
|
||||
// Remove hover class when the user touches outside the menu items.
|
||||
document.body.addEventListener( mobileEvent, function( e ) {
|
||||
if ( ! getClosest( e.target, 'li.menupop' ) ) {
|
||||
removeAllHoverClass( topMenuItems );
|
||||
}
|
||||
} );
|
||||
|
||||
// Add listener for menu items to toggle hover class by touches.
|
||||
// Remove the callback later for better performance.
|
||||
adminBar.addEventListener( 'touchstart', function bindMobileEvents() {
|
||||
for ( var i = 0; i < topMenuItems.length; i++ ) {
|
||||
topMenuItems[i].addEventListener( 'click', mobileHover.bind( null, topMenuItems ) );
|
||||
}
|
||||
|
||||
adminBar.removeEventListener( 'touchstart', bindMobileEvents );
|
||||
} );
|
||||
}
|
||||
|
||||
// Scroll page to top when clicking on the admin bar.
|
||||
adminBar.addEventListener( 'click', scrollToTop );
|
||||
|
||||
for ( i = 0; i < topMenuItems.length; i++ ) {
|
||||
// Adds or removes the hover class based on the hover intent.
|
||||
window.hoverintent(
|
||||
topMenuItems[i],
|
||||
addClass.bind( null, topMenuItems[i], 'hover' ),
|
||||
removeClass.bind( null, topMenuItems[i], 'hover' )
|
||||
).options( {
|
||||
timeout: 180
|
||||
} );
|
||||
|
||||
// Toggle hover class if the enter key is pressed.
|
||||
topMenuItems[i].addEventListener( 'keydown', toggleHoverIfEnter );
|
||||
}
|
||||
|
||||
// Remove hover class if the escape key is pressed.
|
||||
for ( i = 0; i < allMenuItems.length; i++ ) {
|
||||
allMenuItems[i].addEventListener( 'keydown', removeHoverIfEscape );
|
||||
}
|
||||
|
||||
if ( adminBarSearchForm ) {
|
||||
adminBarSearchInput = document.getElementById( 'adminbar-search' );
|
||||
|
||||
// Adds the adminbar-focused class on focus.
|
||||
adminBarSearchInput.addEventListener( 'focus', function() {
|
||||
addClass( adminBarSearchForm, 'adminbar-focused' );
|
||||
} );
|
||||
|
||||
// Removes the adminbar-focused class on blur.
|
||||
adminBarSearchInput.addEventListener( 'blur', function() {
|
||||
removeClass( adminBarSearchForm, 'adminbar-focused' );
|
||||
} );
|
||||
}
|
||||
|
||||
if ( shortlink ) {
|
||||
shortlink.addEventListener( 'click', clickShortlink );
|
||||
}
|
||||
|
||||
// Prevents the toolbar from covering up content when a hash is present in the URL.
|
||||
if ( window.location.hash ) {
|
||||
window.scrollBy( 0, -32 );
|
||||
}
|
||||
|
||||
// Clear sessionStorage on logging out.
|
||||
if ( adminBarLogout ) {
|
||||
adminBarLogout.addEventListener( 'click', emptySessionStorage );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Remove hover class for top level menu item when escape is pressed.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {Event} event The keydown event.
|
||||
*/
|
||||
function removeHoverIfEscape( event ) {
|
||||
var wrapper;
|
||||
|
||||
if ( event.which !== 27 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper = getClosest( event.target, '.menupop' );
|
||||
|
||||
if ( ! wrapper ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper.querySelector( '.menupop > .ab-item' ).focus();
|
||||
removeClass( wrapper, 'hover' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle hover class for top level menu item when enter is pressed.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {Event} event The keydown event.
|
||||
*/
|
||||
function toggleHoverIfEnter( event ) {
|
||||
var wrapper;
|
||||
|
||||
// Follow link if pressing Ctrl and/or Shift with Enter (opening in a new tab or window).
|
||||
if ( event.which !== 13 || event.ctrlKey || event.shiftKey ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !! getClosest( event.target, '.ab-sub-wrapper' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wrapper = getClosest( event.target, '.menupop' );
|
||||
|
||||
if ( ! wrapper ) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if ( hasClass( wrapper, 'hover' ) ) {
|
||||
removeClass( wrapper, 'hover' );
|
||||
} else {
|
||||
addClass( wrapper, 'hover' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle hover class for mobile devices.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {NodeList} topMenuItems All menu items.
|
||||
* @param {Event} event The click event.
|
||||
*/
|
||||
function mobileHover( topMenuItems, event ) {
|
||||
var wrapper;
|
||||
|
||||
if ( !! getClosest( event.target, '.ab-sub-wrapper' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
wrapper = getClosest( event.target, '.menupop' );
|
||||
|
||||
if ( ! wrapper ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( hasClass( wrapper, 'hover' ) ) {
|
||||
removeClass( wrapper, 'hover' );
|
||||
} else {
|
||||
removeAllHoverClass( topMenuItems );
|
||||
addClass( wrapper, 'hover' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the click on the Shortlink link in the adminbar.
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @since 5.3.1 Use querySelector to clean up the function.
|
||||
*
|
||||
* @param {Event} event The click event.
|
||||
* @return {boolean} Returns false to prevent default click behavior.
|
||||
*/
|
||||
function clickShortlink( event ) {
|
||||
var wrapper = event.target.parentNode,
|
||||
input;
|
||||
|
||||
if ( wrapper ) {
|
||||
input = wrapper.querySelector( '.shortlink-input' );
|
||||
}
|
||||
|
||||
if ( ! input ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// (Old) IE doesn't support preventDefault, and does support returnValue.
|
||||
if ( event.preventDefault ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
event.returnValue = false;
|
||||
|
||||
addClass( wrapper, 'selected' );
|
||||
|
||||
input.focus();
|
||||
input.select();
|
||||
input.onblur = function() {
|
||||
removeClass( wrapper, 'selected' );
|
||||
};
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear sessionStorage on logging out.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*/
|
||||
function emptySessionStorage() {
|
||||
if ( 'sessionStorage' in window ) {
|
||||
try {
|
||||
for ( var key in sessionStorage ) {
|
||||
if ( key.indexOf( 'wp-autosave-' ) > -1 ) {
|
||||
sessionStorage.removeItem( key );
|
||||
}
|
||||
}
|
||||
} catch ( er ) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if element has class.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {HTMLElement} element The HTML element.
|
||||
* @param {string} className The class name.
|
||||
* @return {boolean} Whether the element has the className.
|
||||
*/
|
||||
function hasClass( element, className ) {
|
||||
var classNames;
|
||||
|
||||
if ( ! element ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( element.classList && element.classList.contains ) {
|
||||
return element.classList.contains( className );
|
||||
} else if ( element.className ) {
|
||||
classNames = element.className.split( ' ' );
|
||||
return classNames.indexOf( className ) > -1;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class to an element.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {HTMLElement} element The HTML element.
|
||||
* @param {string} className The class name.
|
||||
*/
|
||||
function addClass( element, className ) {
|
||||
if ( ! element ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( element.classList && element.classList.add ) {
|
||||
element.classList.add( className );
|
||||
} else if ( ! hasClass( element, className ) ) {
|
||||
if ( element.className ) {
|
||||
element.className += ' ';
|
||||
}
|
||||
|
||||
element.className += className;
|
||||
}
|
||||
|
||||
var menuItemToggle = element.querySelector( 'a' );
|
||||
if ( className === 'hover' && menuItemToggle && menuItemToggle.hasAttribute( 'aria-expanded' ) ) {
|
||||
menuItemToggle.setAttribute( 'aria-expanded', 'true' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove class from an element.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {HTMLElement} element The HTML element.
|
||||
* @param {string} className The class name.
|
||||
*/
|
||||
function removeClass( element, className ) {
|
||||
var testName,
|
||||
classes;
|
||||
|
||||
if ( ! element || ! hasClass( element, className ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( element.classList && element.classList.remove ) {
|
||||
element.classList.remove( className );
|
||||
} else {
|
||||
testName = ' ' + className + ' ';
|
||||
classes = ' ' + element.className + ' ';
|
||||
|
||||
while ( classes.indexOf( testName ) > -1 ) {
|
||||
classes = classes.replace( testName, '' );
|
||||
}
|
||||
|
||||
element.className = classes.replace( /^[\s]+|[\s]+$/g, '' );
|
||||
}
|
||||
|
||||
var menuItemToggle = element.querySelector( 'a' );
|
||||
if ( className === 'hover' && menuItemToggle && menuItemToggle.hasAttribute( 'aria-expanded' ) ) {
|
||||
menuItemToggle.setAttribute( 'aria-expanded', 'false' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove hover class for all menu items.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {NodeList} topMenuItems All menu items.
|
||||
*/
|
||||
function removeAllHoverClass( topMenuItems ) {
|
||||
if ( topMenuItems && topMenuItems.length ) {
|
||||
for ( var i = 0; i < topMenuItems.length; i++ ) {
|
||||
removeClass( topMenuItems[i], 'hover' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scrolls to the top of the page.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @param {Event} event The Click event.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function scrollToTop( event ) {
|
||||
// Only scroll when clicking on the wpadminbar, not on menus or submenus.
|
||||
if (
|
||||
event.target &&
|
||||
event.target.id !== 'wpadminbar' &&
|
||||
event.target.id !== 'wp-admin-bar-top-secondary'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
window.scrollTo( {
|
||||
top: -32,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
} );
|
||||
} catch ( er ) {
|
||||
window.scrollTo( 0, -32 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get closest Element.
|
||||
*
|
||||
* @since 5.3.1
|
||||
*
|
||||
* @param {HTMLElement} el Element to get parent.
|
||||
* @param {string} selector CSS selector to match.
|
||||
*/
|
||||
function getClosest( el, selector ) {
|
||||
if ( ! window.Element.prototype.matches ) {
|
||||
// Polyfill from https://developer.mozilla.org/en-US/docs/Web/API/Element/matches.
|
||||
window.Element.prototype.matches =
|
||||
window.Element.prototype.matchesSelector ||
|
||||
window.Element.prototype.mozMatchesSelector ||
|
||||
window.Element.prototype.msMatchesSelector ||
|
||||
window.Element.prototype.oMatchesSelector ||
|
||||
window.Element.prototype.webkitMatchesSelector ||
|
||||
function( s ) {
|
||||
var matches = ( this.document || this.ownerDocument ).querySelectorAll( s ),
|
||||
i = matches.length;
|
||||
|
||||
while ( --i >= 0 && matches.item( i ) !== this ) { }
|
||||
|
||||
return i > -1;
|
||||
};
|
||||
}
|
||||
|
||||
// Get the closest matching elent.
|
||||
for ( ; el && el !== document; el = el.parentNode ) {
|
||||
if ( el.matches( selector ) ) {
|
||||
return el;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
} )( document, window, navigator );
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(c,l,u){function d(e){27===e.which&&(e=E(e.target,".menupop"))&&(e.querySelector(".menupop > .ab-item").focus(),y(e,"hover"))}function p(e){var t;13!==e.which||e.ctrlKey||e.shiftKey||E(e.target,".ab-sub-wrapper")||(t=E(e.target,".menupop"))&&(e.preventDefault(),(a(t,"hover")?y:v)(t,"hover"))}function m(e,t){!E(t.target,".ab-sub-wrapper")&&(t.preventDefault(),t=E(t.target,".menupop"))&&(a(t,"hover")?y:(b(e),v))(t,"hover")}function f(e){var t,r=e.target.parentNode;if(t=r?r.querySelector(".shortlink-input"):t)return e.preventDefault&&e.preventDefault(),e.returnValue=!1,v(r,"selected"),t.focus(),t.select(),!(t.onblur=function(){y(r,"selected")})}function h(){if("sessionStorage"in l)try{for(var e in sessionStorage)-1<e.indexOf("wp-autosave-")&&sessionStorage.removeItem(e)}catch(e){}}function a(e,t){return e&&(e.classList&&e.classList.contains?e.classList.contains(t):e.className&&-1<e.className.split(" ").indexOf(t))}function v(e,t){e&&(e.classList&&e.classList.add?e.classList.add(t):a(e,t)||(e.className&&(e.className+=" "),e.className+=t),e=e.querySelector("a"),"hover"===t)&&e&&e.hasAttribute("aria-expanded")&&e.setAttribute("aria-expanded","true")}function y(e,t){var r,n;if(e&&a(e,t)){if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(r=" "+t+" ",n=" "+e.className+" ";-1<n.indexOf(r);)n=n.replace(r,"");e.className=n.replace(/^[\s]+|[\s]+$/g,"")}e=e.querySelector("a");"hover"===t&&e&&e.hasAttribute("aria-expanded")&&e.setAttribute("aria-expanded","false")}}function b(e){if(e&&e.length)for(var t=0;t<e.length;t++)y(e[t],"hover")}function g(e){if(!e.target||"wpadminbar"===e.target.id||"wp-admin-bar-top-secondary"===e.target.id)try{l.scrollTo({top:-32,left:0,behavior:"smooth"})}catch(e){l.scrollTo(0,-32)}}function E(e,t){for(l.Element.prototype.matches||(l.Element.prototype.matches=l.Element.prototype.matchesSelector||l.Element.prototype.mozMatchesSelector||l.Element.prototype.msMatchesSelector||l.Element.prototype.oMatchesSelector||l.Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),r=t.length;0<=--r&&t.item(r)!==this;);return-1<r});e&&e!==c;e=e.parentNode)if(e.matches(t))return e;return null}c.addEventListener("DOMContentLoaded",function(){var r,e,t,n,a,o,s,i=c.getElementById("wpadminbar");if(i&&"querySelectorAll"in i){r=i.querySelectorAll("li.menupop"),e=i.querySelectorAll(".ab-item"),t=c.querySelector("#wp-admin-bar-logout a"),n=c.getElementById("adminbarsearch"),a=c.getElementById("wp-admin-bar-get-shortlink"),i.querySelector(".screen-reader-shortcut"),o=/Mobile\/.+Safari/.test(u.userAgent)?"touchstart":"click",y(i,"nojs"),"ontouchstart"in l&&(c.body.addEventListener(o,function(e){E(e.target,"li.menupop")||b(r)}),i.addEventListener("touchstart",function e(){for(var t=0;t<r.length;t++)r[t].addEventListener("click",m.bind(null,r));i.removeEventListener("touchstart",e)})),i.addEventListener("click",g);for(s=0;s<r.length;s++)l.hoverintent(r[s],v.bind(null,r[s],"hover"),y.bind(null,r[s],"hover")).options({timeout:180}),r[s].addEventListener("keydown",p);for(s=0;s<e.length;s++)e[s].addEventListener("keydown",d);n&&((o=c.getElementById("adminbar-search")).addEventListener("focus",function(){v(n,"adminbar-focused")}),o.addEventListener("blur",function(){y(n,"adminbar-focused")})),a&&a.addEventListener("click",f),l.location.hash&&l.scrollBy(0,-32),t&&t.addEventListener("click",h)}})}(document,window,navigator);
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Thin jQuery.ajax wrapper for WP REST API requests.
|
||||
*
|
||||
* Currently only applies to requests that do not use the `wp-api.js` Backbone
|
||||
* client library, though this may change. Serves several purposes:
|
||||
*
|
||||
* - Allows overriding these requests as needed by customized WP installations.
|
||||
* - Sends the REST API nonce as a request header.
|
||||
* - Allows specifying only an endpoint namespace/path instead of a full URL.
|
||||
*
|
||||
* @since 4.9.0
|
||||
* @since 5.6.0 Added overriding of the "PUT" and "DELETE" methods with "POST".
|
||||
* Added an "application/json" Accept header to all requests.
|
||||
* @output wp-includes/js/api-request.js
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
var wpApiSettings = window.wpApiSettings;
|
||||
|
||||
function apiRequest( options ) {
|
||||
options = apiRequest.buildAjaxOptions( options );
|
||||
return apiRequest.transport( options );
|
||||
}
|
||||
|
||||
apiRequest.buildAjaxOptions = function( options ) {
|
||||
var url = options.url;
|
||||
var path = options.path;
|
||||
var method = options.method;
|
||||
var namespaceTrimmed, endpointTrimmed, apiRoot;
|
||||
var headers, addNonceHeader, addAcceptHeader, headerName;
|
||||
|
||||
if (
|
||||
typeof options.namespace === 'string' &&
|
||||
typeof options.endpoint === 'string'
|
||||
) {
|
||||
namespaceTrimmed = options.namespace.replace( /^\/|\/$/g, '' );
|
||||
endpointTrimmed = options.endpoint.replace( /^\//, '' );
|
||||
if ( endpointTrimmed ) {
|
||||
path = namespaceTrimmed + '/' + endpointTrimmed;
|
||||
} else {
|
||||
path = namespaceTrimmed;
|
||||
}
|
||||
}
|
||||
if ( typeof path === 'string' ) {
|
||||
apiRoot = wpApiSettings.root;
|
||||
path = path.replace( /^\//, '' );
|
||||
|
||||
// API root may already include query parameter prefix
|
||||
// if site is configured to use plain permalinks.
|
||||
if ( 'string' === typeof apiRoot && -1 !== apiRoot.indexOf( '?' ) ) {
|
||||
path = path.replace( '?', '&' );
|
||||
}
|
||||
|
||||
url = apiRoot + path;
|
||||
}
|
||||
|
||||
// If ?_wpnonce=... is present, no need to add a nonce header.
|
||||
addNonceHeader = ! ( options.data && options.data._wpnonce );
|
||||
addAcceptHeader = true;
|
||||
|
||||
headers = options.headers || {};
|
||||
|
||||
for ( headerName in headers ) {
|
||||
if ( ! headers.hasOwnProperty( headerName ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If an 'X-WP-Nonce' or 'Accept' header (or any case-insensitive variation
|
||||
// thereof) was specified, no need to add the header again.
|
||||
switch ( headerName.toLowerCase() ) {
|
||||
case 'x-wp-nonce':
|
||||
addNonceHeader = false;
|
||||
break;
|
||||
case 'accept':
|
||||
addAcceptHeader = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( addNonceHeader ) {
|
||||
// Do not mutate the original headers object, if any.
|
||||
headers = $.extend( {
|
||||
'X-WP-Nonce': wpApiSettings.nonce
|
||||
}, headers );
|
||||
}
|
||||
|
||||
if ( addAcceptHeader ) {
|
||||
headers = $.extend( {
|
||||
'Accept': 'application/json, */*;q=0.1'
|
||||
}, headers );
|
||||
}
|
||||
|
||||
if ( typeof method === 'string' ) {
|
||||
method = method.toUpperCase();
|
||||
|
||||
if ( 'PUT' === method || 'DELETE' === method ) {
|
||||
headers = $.extend( {
|
||||
'X-HTTP-Method-Override': method
|
||||
}, headers );
|
||||
|
||||
method = 'POST';
|
||||
}
|
||||
}
|
||||
|
||||
// Do not mutate the original options object.
|
||||
options = $.extend( {}, options, {
|
||||
headers: headers,
|
||||
url: url,
|
||||
method: method
|
||||
} );
|
||||
|
||||
delete options.path;
|
||||
delete options.namespace;
|
||||
delete options.endpoint;
|
||||
|
||||
return options;
|
||||
};
|
||||
|
||||
apiRequest.transport = $.ajax;
|
||||
|
||||
/** @namespace wp */
|
||||
window.wp = window.wp || {};
|
||||
window.wp.apiRequest = apiRequest;
|
||||
} )( jQuery );
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(c){var w=window.wpApiSettings;function t(e){return e=t.buildAjaxOptions(e),t.transport(e)}t.buildAjaxOptions=function(e){var t,n,a,p,o,r,i=e.url,d=e.path,s=e.method;for(r in"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(t=e.namespace.replace(/^\/|\/$/g,""),d=(n=e.endpoint.replace(/^\//,""))?t+"/"+n:t),"string"==typeof d&&(n=w.root,d=d.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(d=d.replace("?","&")),i=n+d),p=!(e.data&&e.data._wpnonce),o=!0,a=e.headers||{})if(a.hasOwnProperty(r))switch(r.toLowerCase()){case"x-wp-nonce":p=!1;break;case"accept":o=!1}return p&&(a=c.extend({"X-WP-Nonce":w.nonce},a)),o&&(a=c.extend({Accept:"application/json, */*;q=0.1"},a)),"string"!=typeof s||"PUT"!==(s=s.toUpperCase())&&"DELETE"!==s||(a=c.extend({"X-HTTP-Method-Override":s},a),s="POST"),delete(e=c.extend({},e,{headers:a,url:i,method:s})).path,delete e.namespace,delete e.endpoint,e},t.transport=c.ajax,window.wp=window.wp||{},window.wp.apiRequest=t}(jQuery);
|
||||
@@ -0,0 +1,903 @@
|
||||
/**
|
||||
* @output wp-includes/js/autosave.js
|
||||
*/
|
||||
|
||||
/* global tinymce, wpCookies, autosaveL10n, switchEditors */
|
||||
// Back-compat.
|
||||
window.autosave = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds autosave to the window object on dom ready.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {jQuery} $ jQuery object.
|
||||
* @param {window} The window object.
|
||||
*
|
||||
*/
|
||||
( function( $, window ) {
|
||||
/**
|
||||
* Auto saves the post.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {Object}
|
||||
* {{
|
||||
* getPostData: getPostData,
|
||||
* getCompareString: getCompareString,
|
||||
* disableButtons: disableButtons,
|
||||
* enableButtons: enableButtons,
|
||||
* local: ({hasStorage, getSavedPostData, save, suspend, resume}|*),
|
||||
* server: ({tempBlockSave, triggerSave, postChanged, suspend, resume}|*)
|
||||
* }}
|
||||
* The object with all functions for autosave.
|
||||
*/
|
||||
function autosave() {
|
||||
var initialCompareString,
|
||||
initialCompareData = {},
|
||||
lastTriggerSave = 0,
|
||||
$document = $( document );
|
||||
|
||||
/**
|
||||
* Sets the initial compare data.
|
||||
*
|
||||
* @since 5.6.1
|
||||
*/
|
||||
function setInitialCompare() {
|
||||
initialCompareData = {
|
||||
post_title: $( '#title' ).val() || '',
|
||||
content: $( '#content' ).val() || '',
|
||||
excerpt: $( '#excerpt' ).val() || ''
|
||||
};
|
||||
|
||||
initialCompareString = getCompareString( initialCompareData );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data saved in both local and remote autosave.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {string} type The type of autosave either local or remote.
|
||||
*
|
||||
* @return {Object} Object containing the post data.
|
||||
*/
|
||||
function getPostData( type ) {
|
||||
var post_name, parent_id, data,
|
||||
time = ( new Date() ).getTime(),
|
||||
cats = [],
|
||||
editor = getEditor();
|
||||
|
||||
// Don't run editor.save() more often than every 3 seconds.
|
||||
// It is resource intensive and might slow down typing in long posts on slow devices.
|
||||
if ( editor && editor.isDirty() && ! editor.isHidden() && time - 3000 > lastTriggerSave ) {
|
||||
editor.save();
|
||||
lastTriggerSave = time;
|
||||
}
|
||||
|
||||
data = {
|
||||
post_id: $( '#post_ID' ).val() || 0,
|
||||
post_type: $( '#post_type' ).val() || '',
|
||||
post_author: $( '#post_author' ).val() || '',
|
||||
post_title: $( '#title' ).val() || '',
|
||||
content: $( '#content' ).val() || '',
|
||||
excerpt: $( '#excerpt' ).val() || ''
|
||||
};
|
||||
|
||||
if ( type === 'local' ) {
|
||||
return data;
|
||||
}
|
||||
|
||||
$( 'input[id^="in-category-"]:checked' ).each( function() {
|
||||
cats.push( this.value );
|
||||
});
|
||||
data.catslist = cats.join(',');
|
||||
|
||||
if ( post_name = $( '#post_name' ).val() ) {
|
||||
data.post_name = post_name;
|
||||
}
|
||||
|
||||
if ( parent_id = $( '#parent_id' ).val() ) {
|
||||
data.parent_id = parent_id;
|
||||
}
|
||||
|
||||
if ( $( '#comment_status' ).prop( 'checked' ) ) {
|
||||
data.comment_status = 'open';
|
||||
}
|
||||
|
||||
if ( $( '#ping_status' ).prop( 'checked' ) ) {
|
||||
data.ping_status = 'open';
|
||||
}
|
||||
|
||||
if ( $( '#auto_draft' ).val() === '1' ) {
|
||||
data.auto_draft = '1';
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenates the title, content and excerpt. This is used to track changes
|
||||
* when auto-saving.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {Object} postData The object containing the post data.
|
||||
*
|
||||
* @return {string} A concatenated string with title, content and excerpt.
|
||||
*/
|
||||
function getCompareString( postData ) {
|
||||
if ( typeof postData === 'object' ) {
|
||||
return ( postData.post_title || '' ) + '::' + ( postData.content || '' ) + '::' + ( postData.excerpt || '' );
|
||||
}
|
||||
|
||||
return ( $('#title').val() || '' ) + '::' + ( $('#content').val() || '' ) + '::' + ( $('#excerpt').val() || '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables save buttons.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function disableButtons() {
|
||||
$document.trigger('autosave-disable-buttons');
|
||||
|
||||
// Re-enable 5 sec later. Just gives autosave a head start to avoid collisions.
|
||||
setTimeout( enableButtons, 5000 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables save buttons.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function enableButtons() {
|
||||
$document.trigger( 'autosave-enable-buttons' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the content editor.
|
||||
*
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @return {boolean|*} Returns either false if the editor is undefined,
|
||||
* or the instance of the content editor.
|
||||
*/
|
||||
function getEditor() {
|
||||
return typeof tinymce !== 'undefined' && tinymce.get('content');
|
||||
}
|
||||
|
||||
/**
|
||||
* Autosave in localStorage.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {
|
||||
* {
|
||||
* hasStorage: *,
|
||||
* getSavedPostData: getSavedPostData,
|
||||
* save: save,
|
||||
* suspend: suspend,
|
||||
* resume: resume
|
||||
* }
|
||||
* }
|
||||
* The object with all functions for local storage autosave.
|
||||
*/
|
||||
function autosaveLocal() {
|
||||
var blog_id, post_id, hasStorage, intervalTimer,
|
||||
lastCompareString,
|
||||
isSuspended = false;
|
||||
|
||||
/**
|
||||
* Checks if the browser supports sessionStorage and it's not disabled.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {boolean} True if the sessionStorage is supported and enabled.
|
||||
*/
|
||||
function checkStorage() {
|
||||
var test = Math.random().toString(),
|
||||
result = false;
|
||||
|
||||
try {
|
||||
window.sessionStorage.setItem( 'wp-test', test );
|
||||
result = window.sessionStorage.getItem( 'wp-test' ) === test;
|
||||
window.sessionStorage.removeItem( 'wp-test' );
|
||||
} catch(e) {}
|
||||
|
||||
hasStorage = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the local storage.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {boolean|Object} False if no sessionStorage in the browser or an Object
|
||||
* containing all postData for this blog.
|
||||
*/
|
||||
function getStorage() {
|
||||
var stored_obj = false;
|
||||
// Separate local storage containers for each blog_id.
|
||||
if ( hasStorage && blog_id ) {
|
||||
stored_obj = sessionStorage.getItem( 'wp-autosave-' + blog_id );
|
||||
|
||||
if ( stored_obj ) {
|
||||
stored_obj = JSON.parse( stored_obj );
|
||||
} else {
|
||||
stored_obj = {};
|
||||
}
|
||||
}
|
||||
|
||||
return stored_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the storage for this blog. Confirms that the data was saved
|
||||
* successfully.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {boolean} True if the data was saved successfully, false if it wasn't saved.
|
||||
*/
|
||||
function setStorage( stored_obj ) {
|
||||
var key;
|
||||
|
||||
if ( hasStorage && blog_id ) {
|
||||
key = 'wp-autosave-' + blog_id;
|
||||
sessionStorage.setItem( key, JSON.stringify( stored_obj ) );
|
||||
return sessionStorage.getItem( key ) !== null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the saved post data for the current post.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {boolean|Object} False if no storage or no data or the postData as an Object.
|
||||
*/
|
||||
function getSavedPostData() {
|
||||
var stored = getStorage();
|
||||
|
||||
if ( ! stored || ! post_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return stored[ 'post_' + post_id ] || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets (save or delete) post data in the storage.
|
||||
*
|
||||
* If stored_data evaluates to 'false' the storage key for the current post will be removed.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {Object|boolean|null} stored_data The post data to store or null/false/empty to delete the key.
|
||||
*
|
||||
* @return {boolean} True if data is stored, false if data was removed.
|
||||
*/
|
||||
function setData( stored_data ) {
|
||||
var stored = getStorage();
|
||||
|
||||
if ( ! stored || ! post_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( stored_data ) {
|
||||
stored[ 'post_' + post_id ] = stored_data;
|
||||
} else if ( stored.hasOwnProperty( 'post_' + post_id ) ) {
|
||||
delete stored[ 'post_' + post_id ];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return setStorage( stored );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets isSuspended to true.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function suspend() {
|
||||
isSuspended = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets isSuspended to false.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function resume() {
|
||||
isSuspended = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves post data for the current post.
|
||||
*
|
||||
* Runs on a 15 seconds interval, saves when there are differences in the post title or content.
|
||||
* When the optional data is provided, updates the last saved post data.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {Object} data The post data for saving, minimum 'post_title' and 'content'.
|
||||
*
|
||||
* @return {boolean} Returns true when data has been saved, otherwise it returns false.
|
||||
*/
|
||||
function save( data ) {
|
||||
var postData, compareString,
|
||||
result = false;
|
||||
|
||||
if ( isSuspended || ! hasStorage ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( data ) {
|
||||
postData = getSavedPostData() || {};
|
||||
$.extend( postData, data );
|
||||
} else {
|
||||
postData = getPostData('local');
|
||||
}
|
||||
|
||||
compareString = getCompareString( postData );
|
||||
|
||||
if ( typeof lastCompareString === 'undefined' ) {
|
||||
lastCompareString = initialCompareString;
|
||||
}
|
||||
|
||||
// If the content, title and excerpt did not change since the last save, don't save again.
|
||||
if ( compareString === lastCompareString ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
postData.save_time = ( new Date() ).getTime();
|
||||
postData.status = $( '#post_status' ).val() || '';
|
||||
result = setData( postData );
|
||||
|
||||
if ( result ) {
|
||||
lastCompareString = compareString;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the auto save function.
|
||||
*
|
||||
* Checks whether the editor is active or not to use the editor events
|
||||
* to autosave, or uses the values from the elements to autosave.
|
||||
*
|
||||
* Runs on DOM ready.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function run() {
|
||||
post_id = $('#post_ID').val() || 0;
|
||||
|
||||
// Check if the local post data is different than the loaded post data.
|
||||
if ( $( '#wp-content-wrap' ).hasClass( 'tmce-active' ) ) {
|
||||
|
||||
/*
|
||||
* If TinyMCE loads first, check the post 1.5 seconds after it is ready.
|
||||
* By this time the content has been loaded in the editor and 'saved' to the textarea.
|
||||
* This prevents false positives.
|
||||
*/
|
||||
$document.on( 'tinymce-editor-init.autosave', function() {
|
||||
window.setTimeout( function() {
|
||||
checkPost();
|
||||
}, 1500 );
|
||||
});
|
||||
} else {
|
||||
checkPost();
|
||||
}
|
||||
|
||||
// Save every 15 seconds.
|
||||
intervalTimer = window.setInterval( save, 15000 );
|
||||
|
||||
$( 'form#post' ).on( 'submit.autosave-local', function() {
|
||||
var editor = getEditor(),
|
||||
post_id = $('#post_ID').val() || 0;
|
||||
|
||||
if ( editor && ! editor.isHidden() ) {
|
||||
|
||||
// Last onSubmit event in the editor, needs to run after the content has been moved to the textarea.
|
||||
editor.on( 'submit', function() {
|
||||
save({
|
||||
post_title: $( '#title' ).val() || '',
|
||||
content: $( '#content' ).val() || '',
|
||||
excerpt: $( '#excerpt' ).val() || ''
|
||||
});
|
||||
});
|
||||
} else {
|
||||
save({
|
||||
post_title: $( '#title' ).val() || '',
|
||||
content: $( '#content' ).val() || '',
|
||||
excerpt: $( '#excerpt' ).val() || ''
|
||||
});
|
||||
}
|
||||
|
||||
var secure = ( 'https:' === window.location.protocol );
|
||||
wpCookies.set( 'wp-saving-post', post_id + '-check', 24 * 60 * 60, false, false, secure );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares 2 strings. Removes whitespaces in the strings before comparing them.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {string} str1 The first string.
|
||||
* @param {string} str2 The second string.
|
||||
* @return {boolean} True if the strings are the same.
|
||||
*/
|
||||
function compare( str1, str2 ) {
|
||||
function removeSpaces( string ) {
|
||||
return string.toString().replace(/[\x20\t\r\n\f]+/g, '');
|
||||
}
|
||||
|
||||
return ( removeSpaces( str1 || '' ) === removeSpaces( str2 || '' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the saved data for the current post (if any) is different than the
|
||||
* loaded post data on the screen.
|
||||
*
|
||||
* Shows a standard message letting the user restore the post data if different.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function checkPost() {
|
||||
var content, post_title, excerpt, $notice,
|
||||
postData = getSavedPostData(),
|
||||
cookie = wpCookies.get( 'wp-saving-post' ),
|
||||
$newerAutosaveNotice = $( '#has-newer-autosave' ).parent( '.notice' ),
|
||||
$headerEnd = $( '.wp-header-end' );
|
||||
|
||||
if ( cookie === post_id + '-saved' ) {
|
||||
wpCookies.remove( 'wp-saving-post' );
|
||||
// The post was saved properly, remove old data and bail.
|
||||
setData( false );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! postData ) {
|
||||
return;
|
||||
}
|
||||
|
||||
content = $( '#content' ).val() || '';
|
||||
post_title = $( '#title' ).val() || '';
|
||||
excerpt = $( '#excerpt' ).val() || '';
|
||||
|
||||
if ( compare( content, postData.content ) && compare( post_title, postData.post_title ) &&
|
||||
compare( excerpt, postData.excerpt ) ) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If '.wp-header-end' is found, append the notices after it otherwise
|
||||
* after the first h1 or h2 heading found within the main content.
|
||||
*/
|
||||
if ( ! $headerEnd.length ) {
|
||||
$headerEnd = $( '.wrap h1, .wrap h2' ).first();
|
||||
}
|
||||
|
||||
$notice = $( '#local-storage-notice' )
|
||||
.insertAfter( $headerEnd )
|
||||
.addClass( 'notice-warning' );
|
||||
|
||||
if ( $newerAutosaveNotice.length ) {
|
||||
|
||||
// If there is a "server" autosave notice, hide it.
|
||||
// The data in the session storage is either the same or newer.
|
||||
$newerAutosaveNotice.slideUp( 150, function() {
|
||||
$notice.slideDown( 150 );
|
||||
});
|
||||
} else {
|
||||
$notice.slideDown( 200 );
|
||||
}
|
||||
|
||||
$notice.find( '.restore-backup' ).on( 'click.autosave-local', function() {
|
||||
restorePost( postData );
|
||||
$notice.fadeTo( 250, 0, function() {
|
||||
$notice.slideUp( 150 );
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the current title, content and excerpt from postData.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {Object} postData The object containing all post data.
|
||||
*
|
||||
* @return {boolean} True if the post is restored.
|
||||
*/
|
||||
function restorePost( postData ) {
|
||||
var editor;
|
||||
|
||||
if ( postData ) {
|
||||
// Set the last saved data.
|
||||
lastCompareString = getCompareString( postData );
|
||||
|
||||
if ( $( '#title' ).val() !== postData.post_title ) {
|
||||
$( '#title' ).trigger( 'focus' ).val( postData.post_title || '' );
|
||||
}
|
||||
|
||||
$( '#excerpt' ).val( postData.excerpt || '' );
|
||||
editor = getEditor();
|
||||
|
||||
if ( editor && ! editor.isHidden() && typeof switchEditors !== 'undefined' ) {
|
||||
if ( editor.settings.wpautop && postData.content ) {
|
||||
postData.content = switchEditors.wpautop( postData.content );
|
||||
}
|
||||
|
||||
// Make sure there's an undo level in the editor.
|
||||
editor.undoManager.transact( function() {
|
||||
editor.setContent( postData.content || '' );
|
||||
editor.nodeChanged();
|
||||
});
|
||||
} else {
|
||||
|
||||
// Make sure the Code editor is selected.
|
||||
$( '#content-html' ).trigger( 'click' );
|
||||
$( '#content' ).trigger( 'focus' );
|
||||
|
||||
// Using document.execCommand() will let the user undo.
|
||||
document.execCommand( 'selectAll' );
|
||||
document.execCommand( 'insertText', false, postData.content || '' );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id;
|
||||
|
||||
/*
|
||||
* Check if the browser supports sessionStorage and it's not disabled,
|
||||
* then initialize and run checkPost().
|
||||
* Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'.
|
||||
*/
|
||||
if ( checkStorage() && blog_id && ( $('#content').length || $('#excerpt').length ) ) {
|
||||
$( run );
|
||||
}
|
||||
|
||||
return {
|
||||
hasStorage: hasStorage,
|
||||
getSavedPostData: getSavedPostData,
|
||||
save: save,
|
||||
suspend: suspend,
|
||||
resume: resume
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto saves the post on the server.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {Object} {
|
||||
* {
|
||||
* tempBlockSave: tempBlockSave,
|
||||
* triggerSave: triggerSave,
|
||||
* postChanged: postChanged,
|
||||
* suspend: suspend,
|
||||
* resume: resume
|
||||
* }
|
||||
* } The object all functions for autosave.
|
||||
*/
|
||||
function autosaveServer() {
|
||||
var _blockSave, _blockSaveTimer, previousCompareString, lastCompareString,
|
||||
nextRun = 0,
|
||||
isSuspended = false;
|
||||
|
||||
|
||||
/**
|
||||
* Blocks saving for the next 10 seconds.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function tempBlockSave() {
|
||||
_blockSave = true;
|
||||
window.clearTimeout( _blockSaveTimer );
|
||||
|
||||
_blockSaveTimer = window.setTimeout( function() {
|
||||
_blockSave = false;
|
||||
}, 10000 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets isSuspended to true.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function suspend() {
|
||||
isSuspended = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets isSuspended to false.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function resume() {
|
||||
isSuspended = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers the autosave with the post data.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param {Object} data The post data.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function response( data ) {
|
||||
_schedule();
|
||||
_blockSave = false;
|
||||
lastCompareString = previousCompareString;
|
||||
previousCompareString = '';
|
||||
|
||||
$document.trigger( 'after-autosave', [data] );
|
||||
enableButtons();
|
||||
|
||||
if ( data.success ) {
|
||||
// No longer an auto-draft.
|
||||
$( '#auto_draft' ).val('');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves immediately.
|
||||
*
|
||||
* Resets the timing and tells heartbeat to connect now.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function triggerSave() {
|
||||
nextRun = 0;
|
||||
wp.heartbeat.connectNow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post content in the textarea has changed since page load.
|
||||
*
|
||||
* This also happens when TinyMCE is active and editor.save() is triggered by
|
||||
* wp.autosave.getPostData().
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {boolean} True if the post has been changed.
|
||||
*/
|
||||
function postChanged() {
|
||||
var changed = false;
|
||||
|
||||
// If there are TinyMCE instances, loop through them.
|
||||
if ( window.tinymce ) {
|
||||
window.tinymce.each( [ 'content', 'excerpt' ], function( field ) {
|
||||
var editor = window.tinymce.get( field );
|
||||
|
||||
if ( ! editor || editor.isHidden() ) {
|
||||
if ( ( $( '#' + field ).val() || '' ) !== initialCompareData[ field ] ) {
|
||||
changed = true;
|
||||
// Break.
|
||||
return false;
|
||||
}
|
||||
} else if ( editor.isDirty() ) {
|
||||
changed = true;
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
|
||||
if ( ( $( '#title' ).val() || '' ) !== initialCompareData.post_title ) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
return getCompareString() !== initialCompareString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the post can be saved or not.
|
||||
*
|
||||
* If the post hasn't changed or it cannot be updated,
|
||||
* because the autosave is blocked or suspended, the function returns false.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {Object} Returns the post data.
|
||||
*/
|
||||
function save() {
|
||||
var postData, compareString;
|
||||
|
||||
// window.autosave() used for back-compat.
|
||||
if ( isSuspended || _blockSave || ! window.autosave() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ( new Date() ).getTime() < nextRun ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
postData = getPostData();
|
||||
compareString = getCompareString( postData );
|
||||
|
||||
// First check.
|
||||
if ( typeof lastCompareString === 'undefined' ) {
|
||||
lastCompareString = initialCompareString;
|
||||
}
|
||||
|
||||
// No change.
|
||||
if ( compareString === lastCompareString ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
previousCompareString = compareString;
|
||||
tempBlockSave();
|
||||
disableButtons();
|
||||
|
||||
$document.trigger( 'wpcountwords', [ postData.content ] )
|
||||
.trigger( 'before-autosave', [ postData ] );
|
||||
|
||||
postData._wpnonce = $( '#_wpnonce' ).val() || '';
|
||||
|
||||
return postData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the next run, based on the autosave interval.
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
function _schedule() {
|
||||
nextRun = ( new Date() ).getTime() + ( autosaveL10n.autosaveInterval * 1000 ) || 60000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the autosaveData on the autosave heartbeat.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
$( function() {
|
||||
_schedule();
|
||||
}).on( 'heartbeat-send.autosave', function( event, data ) {
|
||||
var autosaveData = save();
|
||||
|
||||
if ( autosaveData ) {
|
||||
data.wp_autosave = autosaveData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers the autosave of the post with the autosave data on the autosave
|
||||
* heartbeat.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
}).on( 'heartbeat-tick.autosave', function( event, data ) {
|
||||
if ( data.wp_autosave ) {
|
||||
response( data.wp_autosave );
|
||||
}
|
||||
/**
|
||||
* Disables buttons and throws a notice when the connection is lost.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
}).on( 'heartbeat-connection-lost.autosave', function( event, error, status ) {
|
||||
|
||||
// When connection is lost, keep user from submitting changes.
|
||||
if ( 'timeout' === error || 603 === status ) {
|
||||
var $notice = $('#lost-connection-notice');
|
||||
|
||||
if ( ! wp.autosave.local.hasStorage ) {
|
||||
$notice.find('.hide-if-no-sessionstorage').hide();
|
||||
}
|
||||
|
||||
$notice.show();
|
||||
disableButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables buttons when the connection is restored.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
}).on( 'heartbeat-connection-restored.autosave', function() {
|
||||
$('#lost-connection-notice').hide();
|
||||
enableButtons();
|
||||
});
|
||||
|
||||
return {
|
||||
tempBlockSave: tempBlockSave,
|
||||
triggerSave: triggerSave,
|
||||
postChanged: postChanged,
|
||||
suspend: suspend,
|
||||
resume: resume
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the autosave time out.
|
||||
*
|
||||
* Wait for TinyMCE to initialize plus 1 second. for any external css to finish loading,
|
||||
* then save to the textarea before setting initialCompareString.
|
||||
* This avoids any insignificant differences between the initial textarea content and the content
|
||||
* extracted from the editor.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
$( function() {
|
||||
// Set the initial compare string in case TinyMCE is not used or not loaded first.
|
||||
setInitialCompare();
|
||||
}).on( 'tinymce-editor-init.autosave', function( event, editor ) {
|
||||
// Reset the initialCompare data after the TinyMCE instances have been initialized.
|
||||
if ( 'content' === editor.id || 'excerpt' === editor.id ) {
|
||||
window.setTimeout( function() {
|
||||
editor.save();
|
||||
setInitialCompare();
|
||||
}, 1000 );
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
getPostData: getPostData,
|
||||
getCompareString: getCompareString,
|
||||
disableButtons: disableButtons,
|
||||
enableButtons: enableButtons,
|
||||
local: autosaveLocal(),
|
||||
server: autosaveServer()
|
||||
};
|
||||
}
|
||||
|
||||
/** @namespace wp */
|
||||
window.wp = window.wp || {};
|
||||
window.wp.autosave = autosave();
|
||||
|
||||
}( jQuery, window ));
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
window.autosave=function(){return!0},function(c,a){function n(){T={post_title:c("#title").val()||"",content:c("#content").val()||"",excerpt:c("#excerpt").val()||""},w=r(T)}function i(t){var e=(new Date).getTime(),n=[],o=u();return o&&o.isDirty()&&!o.isHidden()&&H<e-3e3&&(o.save(),H=e),o={post_id:c("#post_ID").val()||0,post_type:c("#post_type").val()||"",post_author:c("#post_author").val()||"",post_title:c("#title").val()||"",content:c("#content").val()||"",excerpt:c("#excerpt").val()||""},"local"!==t&&(c('input[id^="in-category-"]:checked').each(function(){n.push(this.value)}),o.catslist=n.join(","),(e=c("#post_name").val())&&(o.post_name=e),(t=c("#parent_id").val())&&(o.parent_id=t),c("#comment_status").prop("checked")&&(o.comment_status="open"),c("#ping_status").prop("checked")&&(o.ping_status="open"),"1"===c("#auto_draft").val())&&(o.auto_draft="1"),o}function r(t){return"object"==typeof t?(t.post_title||"")+"::"+(t.content||"")+"::"+(t.excerpt||""):(c("#title").val()||"")+"::"+(c("#content").val()||"")+"::"+(c("#excerpt").val()||"")}function s(){j.trigger("autosave-disable-buttons"),setTimeout(o,5e3)}function o(){j.trigger("autosave-enable-buttons")}function u(){return"undefined"!=typeof tinymce&&tinymce.get("content")}function p(){_=!0,a.clearTimeout(e),e=a.setTimeout(function(){_=!1},1e4)}function l(){y=(new Date).getTime()+1e3*autosaveL10n.autosaveInterval||6e4}function v(){var t=!1;return t=k&&S?(t=sessionStorage.getItem("wp-autosave-"+S))?JSON.parse(t):{}:t}function f(){var t=v();return t&&D&&t["post_"+D]||!1}function d(t){var e=v();if(!e||!D)return!1;if(t)e["post_"+D]=t;else{if(!e.hasOwnProperty("post_"+D))return!1;delete e["post_"+D]}return t=e,!(!k||!S)&&(e="wp-autosave-"+S,sessionStorage.setItem(e,JSON.stringify(t)),null!==sessionStorage.getItem(e))}function g(t){var e;return!(I||!k)&&(t?(e=f()||{},c.extend(e,t)):e=i("local"),(t=r(e))!==(C=void 0===C?w:C))&&(e.save_time=(new Date).getTime(),e.status=c("#post_status").val()||"",(e=d(e))&&(C=t),e)}function m(t,e){function n(t){return t.toString().replace(/[\x20\t\r\n\f]+/g,"")}return n(t||"")===n(e||"")}function t(){var t,e,n,o=f(),a=wpCookies.get("wp-saving-post"),i=c("#has-newer-autosave").parent(".notice"),s=c(".wp-header-end");a===D+"-saved"?(wpCookies.remove("wp-saving-post"),d(!1)):o&&(a=c("#content").val()||"",t=c("#title").val()||"",e=c("#excerpt").val()||"",m(a,o.content)&&m(t,o.post_title)&&m(e,o.excerpt)||(s.length||(s=c(".wrap h1, .wrap h2").first()),n=c("#local-storage-notice").insertAfter(s).addClass("notice-warning"),i.length?i.slideUp(150,function(){n.slideDown(150)}):n.slideDown(200),n.find(".restore-backup").on("click.autosave-local",function(){!function(t){var e;if(t)return C=r(t),c("#title").val()!==t.post_title&&c("#title").trigger("focus").val(t.post_title||""),c("#excerpt").val(t.excerpt||""),(e=u())&&!e.isHidden()&&"undefined"!=typeof switchEditors?(e.settings.wpautop&&t.content&&(t.content=switchEditors.wpautop(t.content)),e.undoManager.transact(function(){e.setContent(t.content||""),e.nodeChanged()})):(c("#content-html").trigger("click"),c("#content").trigger("focus"),document.execCommand("selectAll"),document.execCommand("insertText",!1,t.content||""))}(o),n.fadeTo(250,0,function(){n.slideUp(150)})})))}var w,_,e,h,x,y,b,S,D,k,C,I,T,H,j;a.wp=a.wp||{},a.wp.autosave=(T={},H=0,j=c(document),c(function(){n()}).on("tinymce-editor-init.autosave",function(t,e){"content"!==e.id&&"excerpt"!==e.id||a.setTimeout(function(){e.save(),n()},1e3)}),{getPostData:i,getCompareString:r,disableButtons:s,enableButtons:o,local:(I=!1,S=void 0!==a.autosaveL10n&&a.autosaveL10n.blog_id,function(){var t=Math.random().toString(),e=!1;try{a.sessionStorage.setItem("wp-test",t),e=a.sessionStorage.getItem("wp-test")===t,a.sessionStorage.removeItem("wp-test")}catch(t){}return k=e}()&&S&&(c("#content").length||c("#excerpt").length)&&c(function(){D=c("#post_ID").val()||0,c("#wp-content-wrap").hasClass("tmce-active")?j.on("tinymce-editor-init.autosave",function(){a.setTimeout(function(){t()},1500)}):t(),a.setInterval(g,15e3),c("form#post").on("submit.autosave-local",function(){var t=u(),e=c("#post_ID").val()||0,t=(t&&!t.isHidden()?t.on("submit",function(){g({post_title:c("#title").val()||"",content:c("#content").val()||"",excerpt:c("#excerpt").val()||""})}):g({post_title:c("#title").val()||"",content:c("#content").val()||"",excerpt:c("#excerpt").val()||""}),"https:"===a.location.protocol);wpCookies.set("wp-saving-post",e+"-check",86400,!1,!1,t)})}),{hasStorage:k,getSavedPostData:f,save:g,suspend:function(){I=!0},resume:function(){I=!1}}),server:(y=0,b=!1,c(function(){l()}).on("heartbeat-send.autosave",function(t,e){var n,o=!(b||_||!a.autosave()||(new Date).getTime()<y||(o=r(n=i()))===(x=void 0===x?w:x))&&(h=o,p(),s(),j.trigger("wpcountwords",[n.content]).trigger("before-autosave",[n]),n._wpnonce=c("#_wpnonce").val()||"",n);o&&(e.wp_autosave=o)}).on("heartbeat-tick.autosave",function(t,e){e.wp_autosave&&(e=e.wp_autosave,l(),_=!1,x=h,h="",j.trigger("after-auLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(n){var s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if("function"==typeof define&&define.amd)define(["underscore","jquery","exports"],function(t,e,i){s.Backbone=n(s,i,t,e)});else if("undefined"!=typeof exports){var t,e=require("underscore");try{t=require("jquery")}catch(t){}n(s,exports,e,t)}else s.Backbone=n(s,{},s._,s.jQuery||s.Zepto||s.ender||s.$)}(function(t,h,b,e){function a(t,e,i,n,s){var r,o=0;if(i&&"object"==typeof i){void 0!==n&&"context"in s&&void 0===s.context&&(s.context=n);for(r=b.keys(i);o<r.length;o++)e=a(t,e,r[o],i[r[o]],s)}else if(i&&l.test(i))for(r=i.split(l);o<r.length;o++)e=t(e,r[o],n,s);else e=t(e,i,n,s);return e}function x(t,e,i){i=Math.min(Math.max(i,0),t.length);for(var n=Array(t.length-i),s=e.length,r=0;r<n.length;r++)n[r]=t[r+i];for(r=0;r<s;r++)t[r+i]=e[r];for(r=0;r<n.length;r++)t[r+s+i]=n[r]}function s(i,n,t,s){b.each(t,function(t,e){n[e]&&(i.prototype[e]=function(n,t,s,r){switch(t){case 1:return function(){return n[s](this[r])};case 2:return function(t){return n[s](this[r],t)};case 3:return function(t,e){return n[s](this[r],T(t,this),e)};case 4:return function(t,e,i){return n[s](this[r],T(t,this),e,i)};default:return function(){var t=u.call(arguments);return t.unshift(this[r]),n[s].apply(n,t)}}}(n,t,e,s))})}var o,i=t.Backbone,u=Array.prototype.slice,e=(h.VERSION="1.6.1",h.$=e,h.noConflict=function(){return t.Backbone=i,this},h.emulateHTTP=!1,h.emulateJSON=!1,h.Events={}),l=/\s+/,n=(e.on=function(t,e,i){return this._events=a(n,this._events||{},t,e,{context:i,ctx:this,listening:o}),o&&(((this._listeners||(this._listeners={}))[o.id]=o).interop=!1),this},e.listenTo=function(t,e,i){if(t){var n=t._listenId||(t._listenId=b.uniqueId("l")),s=this._listeningTo||(this._listeningTo={}),r=o=s[n],s=(r||(this._listenId||(this._listenId=b.uniqueId("l")),r=o=s[n]=new g(this,t)),c(t,e,i,this));if(o=void 0,s)throw s;r.interop&&r.on(e,i)}return this},function(t,e,i,n){var s,r;return i&&(e=t[e]||(t[e]=[]),s=n.context,r=n.ctx,(n=n.listening)&&n.count++,e.push({callback:i,context:s,ctx:s||r,listening:n})),t}),c=function(t,e,i,n){try{t.on(e,i,n)}catch(t){return t}},r=(e.off=function(t,e,i){return this._events&&(this._events=a(r,this._events,t,e,{context:i,listeners:this._listeners})),this},e.stopListening=function(t,e,i){var n=this._listeningTo;if(n){for(var s=t?[t._listenId]:b.keys(n),r=0;r<s.length;r++){var o=n[s[r]];if(!o)break;o.obj.off(e,i,this),o.interop&&o.off(e,i)}b.isEmpty(n)&&(this._listeningTo=void 0)}return this},function(t,e,i,n){if(t){var s,r=n.context,o=n.listeners,h=0;if(e||r||i){for(s=e?[e]:b.keys(t);h<s.length;h++){var a=t[e=s[h]];if(!a)break;for(var u=[],l=0;l<a.length;l++){var c=a[l];i&&i!==c.callback&&i!==c.callback._callback||r&&r!==c.context?u.push(c):(c=c.listening)&&c.off(e,i)}u.length?t[e]=u:delete t[e]}return t}for(s=b.keys(o);h<s.length;h++)o[s[h]].cleanup()}}),d=(e.once=function(t,e,i){var n=a(d,{},t,e,this.off.bind(this));return this.on(n,e="string"==typeof t&&null==i?void 0:e,i)},e.listenToOnce=function(t,e,i){e=a(d,{},e,i,this.stopListening.bind(this,t));return this.listenTo(t,e)},function(t,e,i,n){var s;return i&&((s=t[e]=b.once(function(){n(e,s),i.apply(this,arguments)}))._callback=i),t}),f=(e.trigger=function(t){if(this._events){for(var e=Math.max(0,arguments.length-1),i=Array(e),n=0;n<e;n++)i[n]=arguments[n+1];a(f,this._events,t,void 0,i)}return this},function(t,e,i,n){var s,r;return t&&(s=t[e],r=t.all,s&&(r=r&&r.slice()),s&&p(s,n),r)&&p(r,[e].concat(n)),t}),p=function(t,e){var i,n=-1,s=t.length,r=e[0],o=e[1],h=e[2];switch(e.length){case 0:for(;++n<s;)(i=t[n]).callback.call(i.ctx);return;case 1:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r);return;case 2:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r,o);return;case 3:for(;++n<s;)(i=t[n]).callback.call(i.ctx,r,o,h);return;default:for(;++n<s;)(i=t[n]).callback.apply(i.ctx,e);return}},g=function(t,e){this.id=t._listenId,this.listener=t,this.obj=e,this.interop=!0,this.count=0,this._events=void 0},v=(g.prototype.on=e.on,g.prototype.off=function(t,e){t=this.interop?(this._events=a(r,this._events,t,e,{context:void 0,listeners:void 0}),!this._events):(this.count--,0===this.count);t&&this.cleanup()},g.prototype.cleanup=function(){delete this.listener._listeningTo[this.obj._listenId],this.interop||delete this.obj._listeners[this.id]},e.bind=e.on,e.unbind=e.off,b.extend(h,e),h.Model=function(t,e){var i=t||{},n=(e=e||{},this.preinitialize.apply(this,arguments),this.cid=b.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(i=this.parse(i,e)||{}),b.result(this,"defaults")),i=b.defaults(b.extend({},n,i),n);this.set(i,e),this.changed={},this.initialize.apply(this,arguments)}),m=(b.extend(v.prototype,e,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",preinitialize:function(){},initialize:function(){},toJSON:function(t){return b.clone(this.attributes)},sync:function(){return h.sync.apply(this,arguments)},get:fuLine truncated
|
||||
@@ -0,0 +1,890 @@
|
||||
/*!
|
||||
* clipboard.js v2.0.11
|
||||
* https://clipboardjs.com/
|
||||
*
|
||||
* Licensed MIT © Zeno Rocha
|
||||
*/
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["ClipboardJS"] = factory();
|
||||
else
|
||||
root["ClipboardJS"] = factory();
|
||||
})(this, function() {
|
||||
return /******/ (function() { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ 686:
|
||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"default": function() { return /* binding */ clipboard; }
|
||||
});
|
||||
|
||||
// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
|
||||
var tiny_emitter = __webpack_require__(279);
|
||||
var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
|
||||
// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
|
||||
var listen = __webpack_require__(370);
|
||||
var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
|
||||
// EXTERNAL MODULE: ./node_modules/select/src/select.js
|
||||
var src_select = __webpack_require__(817);
|
||||
var select_default = /*#__PURE__*/__webpack_require__.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, __webpack_require__) {
|
||||
|
||||
var closest = __webpack_require__(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, __webpack_require__) {
|
||||
|
||||
var is = __webpack_require__(879);
|
||||
var delegate = __webpack_require__(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 __webpack_require__(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, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/compat get default export */
|
||||
/******/ !function() {
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function() { return module['default']; } :
|
||||
/******/ function() { return module; };
|
||||
/******/ __webpack_require__.d(getter, { a: getter });
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/ }();
|
||||
/******/
|
||||
/******/ /* webpack/runtime/define property getters */
|
||||
/******/ !function() {
|
||||
/******/ // define getter functions for harmony exports
|
||||
/******/ __webpack_require__.d = function(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 */
|
||||
/******/ !function() {
|
||||
/******/ __webpack_require__.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 __webpack_require__(686);
|
||||
/******/ })()
|
||||
.default;
|
||||
});
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),e=n.n(e),o=n(370),i=n.n(o),o=n(817),r=n.n(o);function u(t){try{document.execCommand(t)}catch(t){}}var c=function(t){t=r()(t);return u("cut"),t};function a(t,e){t=t,o="rtl"===document.documentElement.getAttribute("dir"),(n=document.createElement("textarea")).style.fontSize="12pt",n.style.border="0",n.style.padding="0",n.style.margin="0",n.style.position="absolute",n.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,n.style.top="".concat(o,"px"),n.setAttribute("readonly",""),n.value=t;var n,o=n,t=(e.container.appendChild(o),r()(o));return u("copy"),o.remove(),t}var l=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body},n="";return"string"==typeof t?n=a(t,e):t instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null==t?void 0:t.type)?n=a(t.value,e):(n=r()(t),u("copy")),n};function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=t.action,e=void 0===e?"copy":e,n=t.container,o=t.target,t=t.text;if("copy"!==e&&"cut"!==e)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==o){if(!o||"object"!==f(o)||1!==o.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===e&&o.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===e&&(o.hasAttribute("readonly")||o.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return t?l(t,{container:n}):o?"cut"===e?c(o):l(o,{container:n}):void 0};function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function h(n){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=v(n),e=(t=o?(t=v(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(!t||"object"!==p(t)&&"function"!=typeof t){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){t="data-clipboard-".concat(t);if(e.hasAttribute(t))return e.getAttribute(t)}var b=function(t){var e=r;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t);var n,o=h(r);function r(t,e){var n;if(this instanceof r)return(n=o.call(this)).resolveOptions(e),n.listenClick(t),n;throw new TypeError("Cannot call a class as a function")}return e=r,t=[{key:"copy",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{container:document.body};return l(t,e)}},{key:"cut",value:function(t){return c(t)}},{key:"isSupported",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:["copy","cut"],t="string"==typeof t?[t]:t,e=!!document.queryCommandSupported;return t.forEach(function(t){e=e&&!!document.queryCommandSupported(t)}),e}}],(n=[{key:"resolveOptions",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===p(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=i()(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget,t=this.action(e)||"copy",n=s({action:t,container:this.container,target:this.target(e),text:this.text(e)});this.emit(n?Line truncated
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/*! This file is auto-generated from CodeMirror - v5.65.20
|
||||
|
||||
CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
This is CodeMirror (http://codemirror.net), a code editor
|
||||
implemented in JavaScript on top of the browser's DOM.
|
||||
|
||||
You can find some technical background for some of the code below
|
||||
at http://marijnhaverbeke.nl/blog/#cm-internals .
|
||||
*/.CodeMirror{font-family:monospace;height:300px;color:#000;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid #000;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0!important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor .CodeMirror-line::selection,.cm-fat-cursor .CodeMirror-line>span::selection,.cm-fat-cursor .CodeMirror-line>span>span::selection{background:0 0}.cm-fat-cursor .CodeMirror-line::-moz-selection,.cm-fat-cursor .CodeMirror-line>span::-moz-selection,.cm-fat-cursor .CodeMirror-line>span>span::-moz-selection{background:0 0}.cm-fat-cursor{caret-color:transparent}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-type,.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:red}.cm-invalidchar{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:#fff}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:0;position:relative;z-index:0}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none;outline:0}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:0 0!important;border:none!important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:conteLine truncated
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/*! This file is auto-generated from CodeMirror - v5.65.20
|
||||
|
||||
CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
This is CodeMirror (http://codemirror.net), a code editor
|
||||
implemented in JavaScript on top of the browser's DOM.
|
||||
|
||||
You can find some technical background for some of the code below
|
||||
at http://marijnhaverbeke.nl/blog/#cm-internals .
|
||||
*/(()=>{var e={7829(e,t,n){!function(e){"use strict";var t={},n=/[^\s\u00a0]/,r=e.Pos,i=e.cmpPos;function o(e){var t=e.search(n);return-1==t?0:t}function a(e,t,n){return/\bstring\b/.test(e.getTokenTypeAt(r(t.line,0)))&&!/^[\'\"\`]/.test(n)}function s(e,t){var n=e.getMode();return!1!==n.useInnerComments&&n.innerMode?e.getModeAt(t):n}e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",(function(e){e||(e=t);for(var n=this,i=1/0,o=this.listSelections(),a=null,s=o.length-1;s>=0;s--){var l=o[s].from(),c=o[s].to();l.line>=i||(c.line>=i&&(c=r(i,0)),i=l.line,null==a?n.uncomment(l,c,e)?a="un":(n.lineComment(l,c,e),a="line"):"un"==a?n.uncomment(l,c,e):n.lineComment(l,c,e))}})),e.defineExtension("lineComment",(function(e,i,l){l||(l=t);var c=this,u=s(c,e),d=c.getLine(e.line);if(null!=d&&!a(c,e,d)){var f=l.lineComment||u.lineComment;if(f){var p=Math.min(0!=i.ch||i.line==e.line?i.line+1:i.line,c.lastLine()+1),h=null==l.padding?" ":l.padding,m=l.commentBlankLines||e.line==i.line;c.operation((function(){if(l.indent){for(var t=null,i=e.line;i<p;++i){var a=-1===(s=c.getLine(i)).search(n)?s:s.slice(0,o(s));(null==t||t.length>a.length)&&(t=a)}for(i=e.line;i<p;++i){var s=c.getLine(i),u=t.length;(m||n.test(s))&&(s.slice(0,u)!=t&&(u=o(s)),c.replaceRange(t+f+h,r(i,0),r(i,u)))}}else for(i=e.line;i<p;++i)(m||n.test(c.getLine(i)))&&c.replaceRange(f+h,r(i,0))}))}else(l.blockCommentStart||u.blockCommentStart)&&(l.fullLines=!0,c.blockComment(e,i,l))}})),e.defineExtension("blockComment",(function(e,o,a){a||(a=t);var l=this,c=s(l,e),u=a.blockCommentStart||c.blockCommentStart,d=a.blockCommentEnd||c.blockCommentEnd;if(u&&d){if(!/\bcomment\b/.test(l.getTokenTypeAt(r(e.line,0)))){var f=Math.min(o.line,l.lastLine());f!=e.line&&0==o.ch&&n.test(l.getLine(f))&&--f;var p=null==a.padding?" ":a.padding;e.line>f||l.operation((function(){if(0!=a.fullLines){var t=n.test(l.getLine(f));l.replaceRange(p+d,r(f)),l.replaceRange(u+p,r(e.line,0));var s=a.blockCommentLead||c.blockCommentLead;if(null!=s)for(var h=e.line+1;h<=f;++h)(h!=f||t)&&l.replaceRange(s+p,r(h,0))}else{var m=0==i(l.getCursor("to"),o),g=!l.somethingSelected();l.replaceRange(d,o),m&&l.setSelection(g?o:l.getCursor("from"),o),l.replaceRange(u,e)}}))}}else(a.lineComment||c.lineComment)&&0!=a.fullLines&&l.lineComment(e,o,a)})),e.defineExtension("uncomment",(function(e,i,o){o||(o=t);var a,l=this,c=s(l,e),u=Math.min(0!=i.ch||i.line==e.line?i.line:i.line-1,l.lastLine()),d=Math.min(e.line,u),f=o.lineComment||c.lineComment,p=[],h=null==o.padding?" ":o.padding;e:if(f){for(var m=d;m<=u;++m){var g=l.getLine(m),v=g.indexOf(f);if(v>-1&&!/comment/.test(l.getTokenTypeAt(r(m,v+1)))&&(v=-1),-1==v&&n.test(g))break e;if(v>-1&&n.test(g.slice(0,v)))break e;p.push(g)}if(l.operation((function(){for(var e=d;e<=u;++e){var t=p[e-d],n=t.indexOf(f),i=n+f.length;n<0||(t.slice(i,i+h.length)==h&&(i+=h.length),a=!0,l.replaceRange("",r(e,n),r(e,i)))}})),a)return!0}var y=o.blockCommentStart||c.blockCommentStart,b=o.blockCommentEnd||c.blockCommentEnd;if(!y||!b)return!1;var x=o.blockCommentLead||c.blockCommentLead,k=l.getLine(d),w=k.indexOf(y);if(-1==w)return!1;var _=u==d?k:l.getLine(u),C=_.indexOf(b,u==d?w+y.length:0),S=r(d,w+1),M=r(u,C+1);if(-1==C||!/comment/.test(l.getTokenTypeAt(S))||!/comment/.test(l.getTokenTypeAt(M))||l.getRange(S,M,"\n").indexOf(b)>-1)return!1;var L=k.lastIndexOf(y,e.ch),T=-1==L?-1:k.slice(0,e.ch).indexOf(b,L+y.length);if(-1!=L&&-1!=T&&T+b.length!=e.ch)return!1;T=_.indexOf(b,i.ch);var A=_.slice(i.ch).lastIndexOf(y,T-i.ch);return L=-1==T||-1==A?-1:i.ch+A,(-1==T||-1==L||L==i.ch)&&(l.operation((function(){l.replaceRange("",r(u,C-(h&&_.slice(C-h.length,C)==h?h.length:0)),r(u,C+b.length));var e=w+y.length;if(h&&k.slice(e,e+h.length)==h&&(e+=h.length),l.replaceRange("",r(d,w),r(d,e)),x)for(var t=d+1;t<=u;++t){var i=l.getLine(t),o=i.indexOf(x);if(-1!=o&&!n.test(i.slice(0,o))){var a=o+x.length;h&&i.slice(a,a+h.length)==h&&(a+=h.length),l.replaceRange("",r(t,o),r(t,a))}}})),!0)}))}(n(5237))},998(e,t,n){!function(e){var t=/\S/g,n=String.prototype.repeat||function(e){return Array(e+1).join(this)};function r(t){if(t.getOption("disableInput"))return e.Pass;for(var r,a=t.listSelections(),s=[],l=0;l<a.length;l++){var c=a[l].head;if(!/\bcomment\b/.test(t.getTokenTypeAt(c)))return e.Pass;var u=t.getModeAt(c);if(r){if(r!=u)return e.Pass}else r=u;var d,f,p=null,h=r.blockCommentStart,m=r.lineComment;if(h&&r.blockCommentContinue){var g=(d=t.getLine(c.line)).lastIndexOf(r.blockCommentEnd,c.ch-r.blockCommentEnd.length);if(-1!=g&&g==c.ch-r.blockCommentEnd.length||m&&(f=d.lastIndexOf(m,c.ch-1))>-1&&/\bcomment\b/.test(t.getTokenTypeAt({line:c.line,ch:f+1})));else if(c.ch>=h.length&&(f=d.lastIndexOf(h,c.ch-h.length))>-1&&f>g)if(i(0,d)>=f)p=d.slice(0,f);else{var v,y=t.options.tabSize;f=e.countColumn(d,f,y),p=t.options.indentWithTabs?n.call("\t",v=Math.floor(f/y))+n.call(" ",f-y*v):n.call(" ",f)}else(f=d.indexOf(r.blockCommentContinue))>-1&&f<=c.ch&&f<=i(0,d)&&(p=d.slice(0,f));null!=p&&(p+=r.bloLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
+1
@@ -0,0 +1 @@
|
||||
var t={214(t,e,i){const s=i(591),r=/^[\da-fA-F]+$/,a=/^\d+$/,n=new WeakMap;function o(t){t=t.Parser.acorn||t;let e=n.get(t);if(!e){const i=t.tokTypes,s=t.TokContext,r=t.TokenType,a=new s("<tag",!1),o=new s("</tag",!1),h=new s("<tag>...</tag>",!0,!0),p={tc_oTag:a,tc_cTag:o,tc_expr:h},c={jsxName:new r("jsxName"),jsxText:new r("jsxText",{beforeExpr:!0}),jsxTagStart:new r("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new r("jsxTagEnd")};c.jsxTagStart.updateContext=function(){this.context.push(h),this.context.push(a),this.exprAllowed=!1},c.jsxTagEnd.updateContext=function(t){let e=this.context.pop();e===a&&t===i.slash||e===o?(this.context.pop(),this.exprAllowed=this.curContext()===h):this.exprAllowed=!0},e={tokContexts:p,tokTypes:c},n.set(t,e)}return e}function h(t){return t?"JSXIdentifier"===t.type?t.name:"JSXNamespacedName"===t.type?t.namespace.name+":"+t.name.name:"JSXMemberExpression"===t.type?h(t.object)+"."+h(t.property):void 0:t}t.exports=function(t){return t=t||{},function(e){return function(t,e){const n=e.acorn||i(630),p=o(n),c=n.tokTypes,l=p.tokTypes,u=n.tokContexts,d=p.tokContexts.tc_oTag,f=p.tokContexts.tc_cTag,m=p.tokContexts.tc_expr,g=n.isNewLine,x=n.isIdentifierStart,v=n.isIdentifierChar;return class extends e{static get acornJsx(){return p}jsx_readToken(){let t="",e=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let i=this.input.charCodeAt(this.pos);switch(i){case 60:case 123:return this.pos===this.start?60===i&&this.exprAllowed?(++this.pos,this.finishToken(l.jsxTagStart)):this.getTokenFromCode(i):(t+=this.input.slice(e,this.pos),this.finishToken(l.jsxText,t));case 38:t+=this.input.slice(e,this.pos),t+=this.jsx_readEntity(),e=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(62===i?">":"}")+'` or `{"'+this.input[this.pos]+'"}`?');default:g(i)?(t+=this.input.slice(e,this.pos),t+=this.jsx_readNewLine(!0),e=this.pos):++this.pos}}}jsx_readNewLine(t){let e,i=this.input.charCodeAt(this.pos);return++this.pos,13===i&&10===this.input.charCodeAt(this.pos)?(++this.pos,e=t?"\n":"\r\n"):e=String.fromCharCode(i),this.options.locations&&(++this.curLine,this.lineStart=this.pos),e}jsx_readString(t){let e="",i=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let s=this.input.charCodeAt(this.pos);if(s===t)break;38===s?(e+=this.input.slice(i,this.pos),e+=this.jsx_readEntity(),i=this.pos):g(s)?(e+=this.input.slice(i,this.pos),e+=this.jsx_readNewLine(!1),i=this.pos):++this.pos}return e+=this.input.slice(i,this.pos++),this.finishToken(c.string,e)}jsx_readEntity(){let t,e="",i=0,n=this.input[this.pos];"&"!==n&&this.raise(this.pos,"Entity must start with an ampersand");let o=++this.pos;for(;this.pos<this.input.length&&i++<10;){if(n=this.input[this.pos++],";"===n){"#"===e[0]?"x"===e[1]?(e=e.substr(2),r.test(e)&&(t=String.fromCharCode(parseInt(e,16)))):(e=e.substr(1),a.test(e)&&(t=String.fromCharCode(parseInt(e,10)))):t=s[e];break}e+=n}return t||(this.pos=o,"&")}jsx_readWord(){let t,e=this.pos;do{t=this.input.charCodeAt(++this.pos)}while(v(t)||45===t);return this.finishToken(l.jsxName,this.input.slice(e,this.pos))}jsx_parseIdentifier(){let t=this.startNode();return this.type===l.jsxName?t.name=this.value:this.type.keyword?t.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")}jsx_parseNamespacedName(){let e=this.start,i=this.startLoc,s=this.jsx_parseIdentifier();if(!t.allowNamespaces||!this.eat(c.colon))return s;var r=this.startNodeAt(e,i);return r.namespace=s,r.name=this.jsx_parseIdentifier(),this.finishNode(r,"JSXNamespacedName")}jsx_parseElementName(){if(this.type===l.jsxTagEnd)return"";let e=this.start,i=this.startLoc,s=this.jsx_parseNamespacedName();for(this.type!==c.dot||"JSXNamespacedName"!==s.type||t.allowNamespacedObjects||this.unexpected();this.eat(c.dot);){let t=this.startNodeAt(e,i);t.object=s,t.property=this.jsx_parseIdentifier(),s=this.finishNode(t,"JSXMemberExpression")}return s}jsx_parseAttributeValue(){switch(this.type){case c.braceL:let t=this.jsx_parseExpressionContainer();return"JSXEmptyExpression"===t.expression.type&&this.raise(t.start,"JSX attributes must only be assigned a non-empty expression"),t;case l.jsxTagStart:case c.string:return this.parseExprAtom();default:this.raise(this.start,"JSX value should be either an expression or a quoted JSX text")}}jsx_parseEmptyExpression(){let t=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.start,this.startLoc)}jsx_parseExpressionContainer(){let t=this.startNode();return this.next(),t.expression=this.type===c.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(c.braceR),this.finishNode(t,"JSXExpressionContainer")}jsx_parseAttribute(){let t=this.startNode();return this.eat(c.braceL)?(this.expect(c.ellipsis),t.argument=this.parseMaybeAssign(),this.expect(c.braceR),this.finishNoLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* JSHINT has some GPL Compatability issues, so we are faking it out and using esprima for validation
|
||||
* Based on https://github.com/jquery/esprima/blob/gh-pages/demo/validate.js which is MIT licensed.
|
||||
* This is now deprecated in favor of Espree.
|
||||
*
|
||||
* @since 4.9.3
|
||||
* @deprecated 7.0.0
|
||||
* @output wp-includes/js/codemirror/fakejshint.js
|
||||
* @see https://core.trac.wordpress.org/ticket/42850
|
||||
* @see https://core.trac.wordpress.org/ticket/64558
|
||||
*/
|
||||
|
||||
/* jshint -W057, -W058 */
|
||||
var fakeJSHINT = new function() {
|
||||
var syntax, errors;
|
||||
var that = this;
|
||||
this.data = [];
|
||||
this.convertError = function( error ){
|
||||
return {
|
||||
line: error.lineNumber,
|
||||
character: error.column,
|
||||
reason: error.description,
|
||||
code: 'E'
|
||||
};
|
||||
};
|
||||
this.parse = function( code ){
|
||||
try {
|
||||
syntax = window.esprima.parse(code, { tolerant: true, loc: true });
|
||||
errors = syntax.errors;
|
||||
if ( errors.length > 0 ) {
|
||||
for ( var i = 0; i < errors.length; i++) {
|
||||
var error = errors[i];
|
||||
that.data.push( that.convertError( error ) );
|
||||
}
|
||||
} else {
|
||||
that.data = [];
|
||||
}
|
||||
} catch (e) {
|
||||
that.data.push( that.convertError( e ) );
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
window.JSHINT = function( text ){
|
||||
fakeJSHINT.parse( text );
|
||||
};
|
||||
window.JSHINT.data = function(){
|
||||
return {
|
||||
errors: fakeJSHINT.data
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/* global HTMLHint */
|
||||
/* eslint no-magic-numbers: ["error", { "ignore": [1] }] */
|
||||
HTMLHint.addRule( {
|
||||
id: 'kses',
|
||||
description: 'Element or attribute cannot be used.',
|
||||
|
||||
/**
|
||||
* Initialize.
|
||||
*
|
||||
* @this {import('htmlhint/types').Rule}
|
||||
* @param {import('htmlhint').HTMLParser} parser - Parser.
|
||||
* @param {import('htmlhint').Reporter} reporter - Reporter.
|
||||
* @param {Record<string, Record<string, boolean>>} options - KSES options.
|
||||
* @return {void}
|
||||
*/
|
||||
init: function ( parser, reporter, options ) {
|
||||
'use strict';
|
||||
|
||||
parser.addListener( 'tagstart', ( event ) => {
|
||||
const tagName = event.tagName.toLowerCase();
|
||||
if ( ! options[ tagName ] ) {
|
||||
reporter.error(
|
||||
`Tag <${ event.tagName }> is not allowed.`,
|
||||
event.line,
|
||||
event.col,
|
||||
this,
|
||||
event.raw
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const allowedAttributes = options[ tagName ];
|
||||
const column = event.col + event.tagName.length + 1;
|
||||
for ( const attribute of event.attrs ) {
|
||||
if ( ! allowedAttributes[ attribute.name.toLowerCase() ] ) {
|
||||
reporter.error(
|
||||
`Tag attribute [${ attribute.raw }] is not allowed.`,
|
||||
event.line,
|
||||
column + attribute.index,
|
||||
this,
|
||||
attribute.raw
|
||||
);
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
} );
|
||||
@@ -0,0 +1,10 @@
|
||||
/*!
|
||||
* HTMLHint v1.8.0
|
||||
* https://htmlhint.com
|
||||
* Built on: 2025-11-25
|
||||
* Copyright (c) 2025 HTMLHint
|
||||
* Licensed under MIT License
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLHint=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,a={},r={};var n,i={};var s,l={},o={};var u,d={};var c,f={};var m,h={};var p,g={};var b,v={};var y,w={};var L,O={};var P,_={};var j,x={};var M,T={};var C,A={};var $,N={};var k,q={};var R,E={};var D,S={};var z,U={};var H,Z={};var I,V={};var F,W={};var B,Y={};var J,Q={};var X,G={};var K,ee={};var te,ae={};var re,ne={};var ie,se={};function le(){return ie||(ie=1,Object.defineProperty(se,"__esModule",{value:!0}),se.default={id:"input-requires-label",description:"All [ input ] tags must have a corresponding [ label ] tag. ",init(e,t){const a=[],r=[];e.addListener("tagstart",(t=>{const n=t.tagName.toLowerCase(),i=e.getMapAttrs(t.attrs),s=t.col+n.length+1;"input"===n&&"hidden"!==i.type&&r.push({event:t,col:s,id:i.id}),"label"===n&&"for"in i&&""!==i.for&&a.push({event:t,col:s,forValue:i.for})})),e.addListener("end",(()=>{r.forEach((e=>{(function(e){let t=!1;return a.forEach((a=>{e.id&&e.id===a.forValue&&(t=!0)})),t})(e)||t.warn("No matching [ label ] tag found.",e.event.line,e.col,this,e.event.raw)}))}))}}),se}var oe,ue={};var de,ce={};var fe,me={};var he,pe={};var ge,be={};var ve,ye={};var we,Le={};var Oe,Pe={};var _e,je={};var xe,Me={};var Te,Ce={};var Ae,$e={};var Ne,ke={};var qe,Re={};var Ee,De={};var Se,ze={};var Ue,He,Ze,Ie={};function Ve(){return He||(He=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.titleRequire=e.tagSelfClose=e.tagsCheck=e.tagPair=e.tagnameSpecialChars=e.tagnameLowercase=e.tagNoObsolete=e.styleDisabled=e.srcNotEmpty=e.specCharEscape=e.spaceTabMixedDisabled=e.scriptDisabled=e.metaViewportRequire=e.metaDescriptionRequire=e.metaCharsetRequire=e.mainRequire=e.linkRelCanonicalRequire=e.inputRequiresLabel=e.inlineStyleDisabled=e.inlineScriptDisabled=e.idUnique=e.idClassValue=e.idClassAdDisabled=e.htmlLangRequire=e.hrefAbsOrRel=e.headScriptDisabled=e.h1Require=e.frameTitleRequire=e.formMethodRequire=e.emptyTagNotSelfClosed=e.doctypeHTML5=e.doctypeFirst=e.buttonTypeRequire=e.attrWhitespace=e.attrValueSingleQuotes=e.attrValueNotEmpty=e.attrValueDoubleQuotes=e.attrUnsafeChars=e.attrSort=e.attrValueNoDuplication=e.attrNoUnnecessaryWhitespace=e.attrNoDuplication=e.attrLowercase=e.altRequire=void 0;var t=(s||(s=1,Object.defineProperty(o,"__esModule",{value:!0}),o.default={id:"alt-require",description:"The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",init(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),i=a.col+r.length+1;let s;"img"!==r||"alt"in n?("area"===r&&"href"in n||"input"===r&&"image"===n.type)&&("alt"in n&&""!==n.alt||(s="area"===r?"area[href]":"input[type=image]",t.warn(`The alt attribute of ${s} must have a value.`,a.line,i,this,a.raw))):t.warn("An alt attribute must be present on <img> elements.",a.line,i,this,a.raw)}))}}),o);Object.defineProperty(e,"altRequire",{enumerable:!0,get:function(){return t.default}});var a=function(){if(u)return d;u=1,Object.defineProperty(d,"__esModule",{value:!0});const e=["allowReorder","attributeName","attributeType","autoReverse","baseFrequency","baseProfile","calcMode","clipPath","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","onBlur","onChange","onClick","onFocus","onKeyUp","onLoad","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"];function t(e,t){if(t instanceof RegExp)return!!t.test(e)&&{match:e,pattern:t};const a=t[0],r=t[t.length-1],n=t[t.length-2],i="/"===a&&("/"===r||"/"===n&&"i"===r);return i?i&&"i"===r?new RegExp(t.slice(1,-2),"i").test(e):new RegExp(t.slice(1,-1)).test(e):e===t}return d.default={id:"attr-lowercase",description:"All attribute names must be in lowercase.",init(a,r,n){const i=(Array.isArray(n)?n:[]).concat(e);a.addListener("tagstart",(e=>{const a=e.attrs;let n;const s=e.col+e.tagName.length+1;for(let l=0,o=a.length;l<o;l++){n=a[l];const o=n.name;i.find((e=>t(o,e)))||o===o.toLowerCase()||r.error(`The attribute
Line truncated
|
||||
|
||||
if ( window.HTMLHint && window.HTMLHint.HTMLHint ) { window.HTMLHint = window.HTMLHint.HTMLHint; }
|
||||
@@ -0,0 +1 @@
|
||||
var jsonlint=function(){var a=!0,b=!1,c={},d=function(){var a={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(b,c,d,e,f,g,h){var i=g.length-1;switch(f){case 1:this.$=b.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(b);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=g[i-1];case 13:this.$={};break;case 14:this.$=g[i-1];break;case 15:this.$=[g[i-2],g[i]];break;case 16:this.$={},this.$[g[i][0]]=g[i][1];break;case 17:this.$=g[i-2],g[i-2][g[i][0]]=g[i][1];break;case 18:this.$=[];break;case 19:this.$=g[i-1];break;case 20:this.$=[g[i]];break;case 21:this.$=g[i-2],g[i-2].push(g[i])}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(b,c){throw new Error(b)},parse:function(b){function o(a){d.length=d.length-2*a,e.length=e.length-a,f.length=f.length-a}function p(){var a;return a=c.lexer.lex()||1,typeof a!="number"&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0,l=2,m=1;this.lexer.setInput(b),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var n=this.lexer.yylloc;f.push(n),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var q,r,s,t,u,v,w={},x,y,z,A;for(;;){s=d[d.length-1],this.defaultActions[s]?t=this.defaultActions[s]:(q==null&&(q=p()),t=g[s]&&g[s][q]);if(typeof t=="undefined"||!t.length||!t[0]){if(!k){A=[];for(x in g[s])this.terminals_[x]&&x>2&&A.push("'"+this.terminals_[x]+"'");var B="";this.lexer.showPosition?B="Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+this.terminals_[q]+"'":B="Parse error on line "+(i+1)+": Unexpected "+(q==1?"end of input":"'"+(this.terminals_[q]||q)+"'"),this.parseError(B,{text:this.lexer.match,token:this.terminals_[q]||q,line:this.lexer.yylineno,loc:n,expected:A})}if(k==3){if(q==m)throw new Error(B||"Parsing halted.");j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,q=p()}for(;;){if(l.toString()in g[s])break;if(s==0)throw new Error(B||"Parsing halted.");o(1),s=d[d.length-1]}r=q,q=l,s=d[d.length-1],t=g[s]&&g[s][l],k=3}if(t[0]instanceof Array&&t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+s+", token: "+q);switch(t[0]){case 1:d.push(q),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(t[1]),q=null,r?(q=r,r=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:y=this.productions_[t[1]][1],w.$=e[e.length-y],w._$={first_line:f[f.length-(y||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(y||1)].first_column,last_column:f[f.length-1].last_column},v=this.performAction.call(w,h,j,i,this.yy,t[1],e,f);if(typeof v!="undefined")return v;y&&(d=d.slice(0,-1*y*2),e=e.slice(0,-1*y),f=f.slice(0,-1*y)),d.push(this.productions_[t[1]][0]),e.push(w.$),f.push(w._$),z=g[d[d.length-2]][d[d.length-1]],d.push(z);break;case 3:return!0}}return!0}},b=function(){var a={EOF:1,parseELine truncated
|
||||
@@ -0,0 +1,707 @@
|
||||
// ===================================================================
|
||||
// Author: Matt Kruse <matt@mattkruse.com>
|
||||
// WWW: http://www.mattkruse.com/
|
||||
//
|
||||
// NOTICE: You may use this code for any purpose, commercial or
|
||||
// private, without any further permission from the author. You may
|
||||
// remove this notice from your final code if you wish, however it is
|
||||
// appreciated by the author if at least my web site address is kept.
|
||||
//
|
||||
// You may *NOT* re-distribute this code in any way except through its
|
||||
// use. That means, you can include it in your product, or your web
|
||||
// site, or any other form where the code is actually being used. You
|
||||
// may not put the plain javascript up on your site for download or
|
||||
// include it in your javascript libraries for download.
|
||||
// If you wish to share this code with others, please just point them
|
||||
// to the URL instead.
|
||||
// Please DO NOT link directly to my .js files from your site. Copy
|
||||
// the files to your server and use them there. Thank you.
|
||||
// ===================================================================
|
||||
|
||||
|
||||
/* SOURCE FILE: AnchorPosition.js */
|
||||
|
||||
/*
|
||||
AnchorPosition.js
|
||||
Author: Matt Kruse
|
||||
Last modified: 10/11/02
|
||||
|
||||
DESCRIPTION: These functions find the position of an <A> tag in a document,
|
||||
so other elements can be positioned relative to it.
|
||||
|
||||
COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
|
||||
positioning errors - usually with Window positioning - occur on the
|
||||
Macintosh platform.
|
||||
|
||||
FUNCTIONS:
|
||||
getAnchorPosition(anchorname)
|
||||
Returns an Object() having .x and .y properties of the pixel coordinates
|
||||
of the upper-left corner of the anchor. Position is relative to the PAGE.
|
||||
|
||||
getAnchorWindowPosition(anchorname)
|
||||
Returns an Object() having .x and .y properties of the pixel coordinates
|
||||
of the upper-left corner of the anchor, relative to the WHOLE SCREEN.
|
||||
|
||||
NOTES:
|
||||
|
||||
1) For popping up separate browser windows, use getAnchorWindowPosition.
|
||||
Otherwise, use getAnchorPosition
|
||||
|
||||
2) Your anchor tag MUST contain both NAME and ID attributes which are the
|
||||
same. For example:
|
||||
<A NAME="test" ID="test"> </A>
|
||||
|
||||
3) There must be at least a space between <A> </A> for IE5.5 to see the
|
||||
anchor tag correctly. Do not do <A></A> with no space.
|
||||
*/
|
||||
|
||||
// getAnchorPosition(anchorname)
|
||||
// This function returns an object having .x and .y properties which are the coordinates
|
||||
// of the named anchor, relative to the page.
|
||||
function getAnchorPosition(anchorname) {
|
||||
// This function will return an Object with x and y properties
|
||||
var useWindow=false;
|
||||
var coordinates=new Object();
|
||||
var x=0,y=0;
|
||||
// Browser capability sniffing
|
||||
var use_gebi=false, use_css=false, use_layers=false;
|
||||
if (document.getElementById) { use_gebi=true; }
|
||||
else if (document.all) { use_css=true; }
|
||||
else if (document.layers) { use_layers=true; }
|
||||
// Logic to find position
|
||||
if (use_gebi && document.all) {
|
||||
x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
|
||||
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
|
||||
}
|
||||
else if (use_gebi) {
|
||||
var o=document.getElementById(anchorname);
|
||||
x=AnchorPosition_getPageOffsetLeft(o);
|
||||
y=AnchorPosition_getPageOffsetTop(o);
|
||||
}
|
||||
else if (use_css) {
|
||||
x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
|
||||
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
|
||||
}
|
||||
else if (use_layers) {
|
||||
var found=0;
|
||||
for (var i=0; i<document.anchors.length; i++) {
|
||||
if (document.anchors[i].name==anchorname) { found=1; break; }
|
||||
}
|
||||
if (found==0) {
|
||||
coordinates.x=0; coordinates.y=0; return coordinates;
|
||||
}
|
||||
x=document.anchors[i].x;
|
||||
y=document.anchors[i].y;
|
||||
}
|
||||
else {
|
||||
coordinates.x=0; coordinates.y=0; return coordinates;
|
||||
}
|
||||
coordinates.x=x;
|
||||
coordinates.y=y;
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
// getAnchorWindowPosition(anchorname)
|
||||
// This function returns an object having .x and .y properties which are the coordinates
|
||||
// of the named anchor, relative to the window
|
||||
function getAnchorWindowPosition(anchorname) {
|
||||
var coordinates=getAnchorPosition(anchorname);
|
||||
var x=0;
|
||||
var y=0;
|
||||
if (document.getElementById) {
|
||||
if (isNaN(window.screenX)) {
|
||||
x=coordinates.x-document.body.scrollLeft+window.screenLeft;
|
||||
y=coordinates.y-document.body.scrollTop+window.screenTop;
|
||||
}
|
||||
else {
|
||||
x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
|
||||
y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
|
||||
}
|
||||
}
|
||||
else if (document.all) {
|
||||
x=coordinates.x-document.body.scrollLeft+window.screenLeft;
|
||||
y=coordinates.y-document.body.scrollTop+window.screenTop;
|
||||
}
|
||||
else if (document.layers) {
|
||||
x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
|
||||
y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
|
||||
}
|
||||
coordinates.x=x;
|
||||
coordinates.y=y;
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
// Functions for IE to get position of an object
|
||||
function AnchorPosition_getPageOffsetLeft (el) {
|
||||
var ol=el.offsetLeft;
|
||||
while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
|
||||
return ol;
|
||||
}
|
||||
function AnchorPosition_getWindowOffsetLeft (el) {
|
||||
return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
|
||||
}
|
||||
function AnchorPosition_getPageOffsetTop (el) {
|
||||
var ot=el.offsetTop;
|
||||
while((el=el.offsetParent) != null) { ot += el.offsetTop; }
|
||||
return ot;
|
||||
}
|
||||
function AnchorPosition_getWindowOffsetTop (el) {
|
||||
return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
|
||||
}
|
||||
|
||||
/* SOURCE FILE: PopupWindow.js */
|
||||
|
||||
/*
|
||||
PopupWindow.js
|
||||
Author: Matt Kruse
|
||||
Last modified: 02/16/04
|
||||
|
||||
DESCRIPTION: This object allows you to easily and quickly popup a window
|
||||
in a certain place. The window can either be a DIV or a separate browser
|
||||
window.
|
||||
|
||||
COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
|
||||
positioning errors - usually with Window positioning - occur on the
|
||||
Macintosh platform. Due to bugs in Netscape 4.x, populating the popup
|
||||
window with <STYLE> tags may cause errors.
|
||||
|
||||
USAGE:
|
||||
// Create an object for a WINDOW popup
|
||||
var win = new PopupWindow();
|
||||
|
||||
// Create an object for a DIV window using the DIV named 'mydiv'
|
||||
var win = new PopupWindow('mydiv');
|
||||
|
||||
// Set the window to automatically hide itself when the user clicks
|
||||
// anywhere else on the page except the popup
|
||||
win.autoHide();
|
||||
|
||||
// Show the window relative to the anchor name passed in
|
||||
win.showPopup(anchorname);
|
||||
|
||||
// Hide the popup
|
||||
win.hidePopup();
|
||||
|
||||
// Set the size of the popup window (only applies to WINDOW popups
|
||||
win.setSize(width,height);
|
||||
|
||||
// Populate the contents of the popup window that will be shown. If you
|
||||
// change the contents while it is displayed, you will need to refresh()
|
||||
win.populate(string);
|
||||
|
||||
// set the URL of the window, rather than populating its contents
|
||||
// manually
|
||||
win.setUrl("http://www.site.com/");
|
||||
|
||||
// Refresh the contents of the popup
|
||||
win.refresh();
|
||||
|
||||
// Specify how many pixels to the right of the anchor the popup will appear
|
||||
win.offsetX = 50;
|
||||
|
||||
// Specify how many pixels below the anchor the popup will appear
|
||||
win.offsetY = 100;
|
||||
|
||||
NOTES:
|
||||
1) Requires the functions in AnchorPosition.js
|
||||
|
||||
2) Your anchor tag MUST contain both NAME and ID attributes which are the
|
||||
same. For example:
|
||||
<A NAME="test" ID="test"> </A>
|
||||
|
||||
3) There must be at least a space between <A> </A> for IE5.5 to see the
|
||||
anchor tag correctly. Do not do <A></A> with no space.
|
||||
|
||||
4) When a PopupWindow object is created, a handler for 'onmouseup' is
|
||||
attached to any event handler you may have already defined. Do NOT define
|
||||
an event handler for 'onmouseup' after you define a PopupWindow object or
|
||||
the autoHide() will not work correctly.
|
||||
*/
|
||||
|
||||
// Set the position of the popup window based on the anchor
|
||||
function PopupWindow_getXYPosition(anchorname) {
|
||||
var coordinates;
|
||||
if (this.type == "WINDOW") {
|
||||
coordinates = getAnchorWindowPosition(anchorname);
|
||||
}
|
||||
else {
|
||||
coordinates = getAnchorPosition(anchorname);
|
||||
}
|
||||
this.x = coordinates.x;
|
||||
this.y = coordinates.y;
|
||||
}
|
||||
// Set width/height of DIV/popup window
|
||||
function PopupWindow_setSize(width,height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
// Fill the window with contents
|
||||
function PopupWindow_populate(contents) {
|
||||
this.contents = contents;
|
||||
this.populated = false;
|
||||
}
|
||||
// Set the URL to go to
|
||||
function PopupWindow_setUrl(url) {
|
||||
this.url = url;
|
||||
}
|
||||
// Set the window popup properties
|
||||
function PopupWindow_setWindowProperties(props) {
|
||||
this.windowProperties = props;
|
||||
}
|
||||
// Refresh the displayed contents of the popup
|
||||
function PopupWindow_refresh() {
|
||||
if (this.divName != null) {
|
||||
// refresh the DIV object
|
||||
if (this.use_gebi) {
|
||||
document.getElementById(this.divName).innerHTML = this.contents;
|
||||
}
|
||||
else if (this.use_css) {
|
||||
document.all[this.divName].innerHTML = this.contents;
|
||||
}
|
||||
else if (this.use_layers) {
|
||||
var d = document.layers[this.divName];
|
||||
d.document.open();
|
||||
d.document.writeln(this.contents);
|
||||
d.document.close();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.popupWindow != null && !this.popupWindow.closed) {
|
||||
if (this.url!="") {
|
||||
this.popupWindow.location.href=this.url;
|
||||
}
|
||||
else {
|
||||
this.popupWindow.document.open();
|
||||
this.popupWindow.document.writeln(this.contents);
|
||||
this.popupWindow.document.close();
|
||||
}
|
||||
this.popupWindow.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Position and show the popup, relative to an anchor object
|
||||
function PopupWindow_showPopup(anchorname) {
|
||||
this.getXYPosition(anchorname);
|
||||
this.x += this.offsetX;
|
||||
this.y += this.offsetY;
|
||||
if (!this.populated && (this.contents != "")) {
|
||||
this.populated = true;
|
||||
this.refresh();
|
||||
}
|
||||
if (this.divName != null) {
|
||||
// Show the DIV object
|
||||
if (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";
|
||||
}
|
||||
else if (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";
|
||||
}
|
||||
else if (this.use_layers) {
|
||||
document.layers[this.divName].left = this.x;
|
||||
document.layers[this.divName].top = this.y;
|
||||
document.layers[this.divName].visibility = "visible";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.popupWindow == null || this.popupWindow.closed) {
|
||||
// If the popup window will go off-screen, move it so it doesn't
|
||||
if (this.x<0) { this.x=0; }
|
||||
if (this.y<0) { this.y=0; }
|
||||
if (screen && screen.availHeight) {
|
||||
if ((this.y + this.height) > screen.availHeight) {
|
||||
this.y = screen.availHeight - this.height;
|
||||
}
|
||||
}
|
||||
if (screen && screen.availWidth) {
|
||||
if ((this.x + this.width) > screen.availWidth) {
|
||||
this.x = screen.availWidth - this.width;
|
||||
}
|
||||
}
|
||||
var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
|
||||
this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
// Hide the popup
|
||||
function PopupWindow_hidePopup() {
|
||||
if (this.divName != null) {
|
||||
if (this.use_gebi) {
|
||||
document.getElementById(this.divName).style.visibility = "hidden";
|
||||
}
|
||||
else if (this.use_css) {
|
||||
document.all[this.divName].style.visibility = "hidden";
|
||||
}
|
||||
else if (this.use_layers) {
|
||||
document.layers[this.divName].visibility = "hidden";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.popupWindow && !this.popupWindow.closed) {
|
||||
this.popupWindow.close();
|
||||
this.popupWindow = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Pass an event and return whether or not it was the popup DIV that was clicked
|
||||
function PopupWindow_isClicked(e) {
|
||||
if (this.divName != null) {
|
||||
if (this.use_layers) {
|
||||
var clickX = e.pageX;
|
||||
var clickY = e.pageY;
|
||||
var t = document.layers[this.divName];
|
||||
if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
}
|
||||
else if (document.all) { // Need to hard-code this to trap IE for error-handling
|
||||
var t = window.event.srcElement;
|
||||
while (t.parentElement != null) {
|
||||
if (t.id==this.divName) {
|
||||
return true;
|
||||
}
|
||||
t = t.parentElement;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (this.use_gebi && e) {
|
||||
var t = e.originalTarget;
|
||||
while (t.parentNode != null) {
|
||||
if (t.id==this.divName) {
|
||||
return true;
|
||||
}
|
||||
t = t.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check an onMouseDown event to see if we should hide
|
||||
function PopupWindow_hideIfNotClicked(e) {
|
||||
if (this.autoHideEnabled && !this.isClicked(e)) {
|
||||
this.hidePopup();
|
||||
}
|
||||
}
|
||||
// Call this to make the DIV disable automatically when mouse is clicked outside it
|
||||
function PopupWindow_autoHide() {
|
||||
this.autoHideEnabled = true;
|
||||
}
|
||||
// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
|
||||
function PopupWindow_hidePopupWindows(e) {
|
||||
for (var i=0; i<popupWindowObjects.length; i++) {
|
||||
if (popupWindowObjects[i] != null) {
|
||||
var p = popupWindowObjects[i];
|
||||
p.hideIfNotClicked(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Run this immediately to attach the event listener
|
||||
function PopupWindow_attachListener() {
|
||||
if (document.layers) {
|
||||
document.captureEvents(Event.MOUSEUP);
|
||||
}
|
||||
window.popupWindowOldEventListener = document.onmouseup;
|
||||
if (window.popupWindowOldEventListener != null) {
|
||||
document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
|
||||
}
|
||||
else {
|
||||
document.onmouseup = PopupWindow_hidePopupWindows;
|
||||
}
|
||||
}
|
||||
// CONSTRUCTOR for the PopupWindow object
|
||||
// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
|
||||
function PopupWindow() {
|
||||
if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
|
||||
if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
|
||||
if (!window.listenerAttached) {
|
||||
window.listenerAttached = true;
|
||||
PopupWindow_attachListener();
|
||||
}
|
||||
this.index = popupWindowIndex++;
|
||||
popupWindowObjects[this.index] = this;
|
||||
this.divName = null;
|
||||
this.popupWindow = null;
|
||||
this.width=0;
|
||||
this.height=0;
|
||||
this.populated = false;
|
||||
this.visible = false;
|
||||
this.autoHideEnabled = false;
|
||||
|
||||
this.contents = "";
|
||||
this.url="";
|
||||
this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
|
||||
if (arguments.length>0) {
|
||||
this.type="DIV";
|
||||
this.divName = arguments[0];
|
||||
}
|
||||
else {
|
||||
this.type="WINDOW";
|
||||
}
|
||||
this.use_gebi = false;
|
||||
this.use_css = false;
|
||||
this.use_layers = false;
|
||||
if (document.getElementById) { this.use_gebi = true; }
|
||||
else if (document.all) { this.use_css = true; }
|
||||
else if (document.layers) { this.use_layers = true; }
|
||||
else { this.type = "WINDOW"; }
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
// Method mappings
|
||||
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;
|
||||
}
|
||||
|
||||
/* SOURCE FILE: ColorPicker2.js */
|
||||
|
||||
/*
|
||||
Last modified: 02/24/2003
|
||||
|
||||
DESCRIPTION: This widget is used to select a color, in hexadecimal #RRGGBB
|
||||
form. It uses a color "swatch" to display the standard 216-color web-safe
|
||||
palette. The user can then click on a color to select it.
|
||||
|
||||
COMPATABILITY: See notes in AnchorPosition.js and PopupWindow.js.
|
||||
Only the latest DHTML-capable browsers will show the color and hex values
|
||||
at the bottom as your mouse goes over them.
|
||||
|
||||
USAGE:
|
||||
// Create a new ColorPicker object using DHTML popup
|
||||
var cp = new ColorPicker();
|
||||
|
||||
// Create a new ColorPicker object using Window Popup
|
||||
var cp = new ColorPicker('window');
|
||||
|
||||
// Add a link in your page to trigger the popup. For example:
|
||||
<A HREF="#" onClick="cp.show('pick');return false;" NAME="pick" ID="pick">Pick</A>
|
||||
|
||||
// Or use the built-in "select" function to do the dirty work for you:
|
||||
<A HREF="#" onClick="cp.select(document.forms[0].color,'pick');return false;" NAME="pick" ID="pick">Pick</A>
|
||||
|
||||
// If using DHTML popup, write out the required DIV tag near the bottom
|
||||
// of your page.
|
||||
<SCRIPT LANGUAGE="JavaScript">cp.writeDiv()</SCRIPT>
|
||||
|
||||
// Write the 'pickColor' function that will be called when the user clicks
|
||||
// a color and do something with the value. This is only required if you
|
||||
// want to do something other than simply populate a form field, which is
|
||||
// what the 'select' function will give you.
|
||||
function pickColor(color) {
|
||||
field.value = color;
|
||||
}
|
||||
|
||||
NOTES:
|
||||
1) Requires the functions in AnchorPosition.js and PopupWindow.js
|
||||
|
||||
2) Your anchor tag MUST contain both NAME and ID attributes which are the
|
||||
same. For example:
|
||||
<A NAME="test" ID="test"> </A>
|
||||
|
||||
3) There must be at least a space between <A> </A> for IE5.5 to see the
|
||||
anchor tag correctly. Do not do <A></A> with no space.
|
||||
|
||||
4) When a ColorPicker object is created, a handler for 'onmouseup' is
|
||||
attached to any event handler you may have already defined. Do NOT define
|
||||
an event handler for 'onmouseup' after you define a ColorPicker object or
|
||||
the color picker will not hide itself correctly.
|
||||
*/
|
||||
ColorPicker_targetInput = null;
|
||||
function ColorPicker_writeDiv() {
|
||||
document.writeln("<DIV ID=\"colorPickerDiv\" STYLE=\"position:absolute;visibility:hidden;\"> </DIV>");
|
||||
}
|
||||
|
||||
function ColorPicker_show(anchorname) {
|
||||
this.showPopup(anchorname);
|
||||
}
|
||||
|
||||
function ColorPicker_pickColor(color,obj) {
|
||||
obj.hidePopup();
|
||||
pickColor(color);
|
||||
}
|
||||
|
||||
// A Default "pickColor" function to accept the color passed back from popup.
|
||||
// User can over-ride this with their own function.
|
||||
function pickColor(color) {
|
||||
if (ColorPicker_targetInput==null) {
|
||||
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!");
|
||||
return;
|
||||
}
|
||||
ColorPicker_targetInput.value = color;
|
||||
}
|
||||
|
||||
// This function is the easiest way to popup the window, select a color, and
|
||||
// have the value populate a form field, which is what most people want to do.
|
||||
function ColorPicker_select(inputobj,linkname) {
|
||||
if (inputobj.type!="text" && inputobj.type!="hidden" && inputobj.type!="textarea") {
|
||||
alert("colorpicker.select: Input object passed is not a valid form input object");
|
||||
window.ColorPicker_targetInput=null;
|
||||
return;
|
||||
}
|
||||
window.ColorPicker_targetInput = inputobj;
|
||||
this.show(linkname);
|
||||
}
|
||||
|
||||
// This function runs when you move your mouse over a color block, if you have a newer browser
|
||||
function ColorPicker_highlightColor(c) {
|
||||
var thedoc = (arguments.length>1)?arguments[1]:window.document;
|
||||
var d = thedoc.getElementById("colorPickerSelectedColor");
|
||||
d.style.backgroundColor = c;
|
||||
d = thedoc.getElementById("colorPickerSelectedColorValue");
|
||||
d.innerHTML = c;
|
||||
}
|
||||
|
||||
function ColorPicker() {
|
||||
var windowMode = false;
|
||||
// Create a new PopupWindow object
|
||||
if (arguments.length==0) {
|
||||
var divname = "colorPickerDiv";
|
||||
}
|
||||
else if (arguments[0] == "window") {
|
||||
var divname = '';
|
||||
windowMode = true;
|
||||
}
|
||||
else {
|
||||
var divname = arguments[0];
|
||||
}
|
||||
|
||||
if (divname != "") {
|
||||
var cp = new PopupWindow(divname);
|
||||
}
|
||||
else {
|
||||
var cp = new PopupWindow();
|
||||
cp.setSize(225,250);
|
||||
}
|
||||
|
||||
// Object variables
|
||||
cp.currentValue = "#FFFFFF";
|
||||
|
||||
// Method Mappings
|
||||
cp.writeDiv = ColorPicker_writeDiv;
|
||||
cp.highlightColor = ColorPicker_highlightColor;
|
||||
cp.show = ColorPicker_show;
|
||||
cp.select = ColorPicker_select;
|
||||
|
||||
// Code to populate color picker window
|
||||
var colors = 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");
|
||||
var total = colors.length;
|
||||
var width = 72;
|
||||
var cp_contents = "";
|
||||
var windowRef = (windowMode)?"window.opener.":"";
|
||||
if (windowMode) {
|
||||
cp_contents += "<html><head><title>Select Color</title></head>";
|
||||
cp_contents += "<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>";
|
||||
}
|
||||
cp_contents += "<table style='border: none;' cellspacing=0 cellpadding=0>";
|
||||
var use_highlight = (document.getElementById || document.all)?true:false;
|
||||
for (var i=0; i<total; i++) {
|
||||
if ((i % width) == 0) { cp_contents += "<tr>"; }
|
||||
if (use_highlight) { var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"'; }
|
||||
else { mo = ""; }
|
||||
cp_contents += '<td style="background-color: '+colors[i]+';"><a href="javascript:void()" onclick="'+windowRef+'ColorPicker_pickColor(\''+colors[i]+'\','+windowRef+'window.popupWindowObjects['+cp.index+']);return false;" '+mo+'> </a></td>';
|
||||
if ( ((i+1)>=total) || (((i+1) % width) == 0)) {
|
||||
cp_contents += "</tr>";
|
||||
}
|
||||
}
|
||||
// If the browser supports dynamically changing TD cells, add the fancy stuff
|
||||
if (document.getElementById) {
|
||||
var width1 = Math.floor(width/2);
|
||||
var width2 = width = width1;
|
||||
cp_contents += "<tr><td colspan='"+width1+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'> </td><td colspan='"+width2+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>";
|
||||
}
|
||||
cp_contents += "</table>";
|
||||
if (windowMode) {
|
||||
cp_contents += "</span></body></html>";
|
||||
}
|
||||
// end populate code
|
||||
|
||||
// Write the contents to the popup object
|
||||
cp.populate(cp_contents+"\n");
|
||||
// Move the table down a bit so you can see it
|
||||
cp.offsetY = 25;
|
||||
cp.autoHide();
|
||||
return cp;
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! 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_hideIfNotClicLine truncated
|
||||
@@ -0,0 +1,444 @@
|
||||
/**
|
||||
* Handles the addition of the comment form.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @output wp-includes/js/comment-reply.js
|
||||
*
|
||||
* @namespace addComment
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
window.addComment = ( function( window ) {
|
||||
// Avoid scope lookups on commonly used variables.
|
||||
var document = window.document;
|
||||
|
||||
// Settings.
|
||||
var config = {
|
||||
commentReplyClass : 'comment-reply-link',
|
||||
commentReplyTitleId : 'reply-title',
|
||||
cancelReplyId : 'cancel-comment-reply-link',
|
||||
commentFormId : 'commentform',
|
||||
temporaryFormId : 'wp-temp-form-div',
|
||||
parentIdFieldId : 'comment_parent',
|
||||
postIdFieldId : 'comment_post_ID'
|
||||
};
|
||||
|
||||
// Cross browser MutationObserver.
|
||||
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
||||
|
||||
// Check browser cuts the mustard.
|
||||
var cutsTheMustard = 'querySelector' in document && 'addEventListener' in window;
|
||||
|
||||
/*
|
||||
* Check browser supports dataset.
|
||||
* !! sets the variable to true if the property exists.
|
||||
*/
|
||||
var supportsDataset = !! document.documentElement.dataset;
|
||||
|
||||
// For holding the cancel element.
|
||||
var cancelElement;
|
||||
|
||||
// For holding the comment form element.
|
||||
var commentFormElement;
|
||||
|
||||
// The respond element.
|
||||
var respondElement;
|
||||
|
||||
// The mutation observer.
|
||||
var observer;
|
||||
|
||||
if ( cutsTheMustard && document.readyState !== 'loading' ) {
|
||||
ready();
|
||||
} else if ( cutsTheMustard ) {
|
||||
window.addEventListener( 'DOMContentLoaded', ready, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up object variables after the DOM is ready.
|
||||
*
|
||||
* @since 5.1.1
|
||||
*/
|
||||
function ready() {
|
||||
// Initialize the events.
|
||||
init();
|
||||
|
||||
// Set up a MutationObserver to check for comments loaded late.
|
||||
observeChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add events to links classed .comment-reply-link.
|
||||
*
|
||||
* Searches the context for reply links and adds the JavaScript events
|
||||
* required to move the comment form. To allow for lazy loading of
|
||||
* comments this method is exposed as window.commentReply.init().
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @memberOf addComment
|
||||
*
|
||||
* @param {HTMLElement} context The parent DOM element to search for links.
|
||||
*/
|
||||
function init( context ) {
|
||||
if ( ! cutsTheMustard ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get required elements.
|
||||
cancelElement = getElementById( config.cancelReplyId );
|
||||
commentFormElement = getElementById( config.commentFormId );
|
||||
|
||||
// No cancel element, no replies.
|
||||
if ( ! cancelElement ) {
|
||||
return;
|
||||
}
|
||||
|
||||
cancelElement.addEventListener( 'touchstart', cancelEvent );
|
||||
cancelElement.addEventListener( 'click', cancelEvent );
|
||||
|
||||
// Submit the comment form when the user types [Ctrl] or [Cmd] + [Enter].
|
||||
var submitFormHandler = function( e ) {
|
||||
if ( ( e.metaKey || e.ctrlKey ) && e.keyCode === 13 && document.activeElement.tagName.toLowerCase() !== 'a' ) {
|
||||
commentFormElement.removeEventListener( 'keydown', submitFormHandler );
|
||||
e.preventDefault();
|
||||
// The submit button ID is 'submit' so we can't call commentFormElement.submit(). Click it instead.
|
||||
commentFormElement.submit.click();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
if ( commentFormElement ) {
|
||||
commentFormElement.addEventListener( 'keydown', submitFormHandler );
|
||||
}
|
||||
|
||||
var links = replyLinks( context );
|
||||
var element;
|
||||
|
||||
for ( var i = 0, l = links.length; i < l; i++ ) {
|
||||
element = links[i];
|
||||
|
||||
element.addEventListener( 'touchstart', clickEvent );
|
||||
element.addEventListener( 'click', clickEvent );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all links classed .comment-reply-link.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @param {HTMLElement} context The parent DOM element to search for links.
|
||||
*
|
||||
* @return {HTMLCollection|NodeList|Array}
|
||||
*/
|
||||
function replyLinks( context ) {
|
||||
var selectorClass = config.commentReplyClass;
|
||||
var allReplyLinks;
|
||||
|
||||
// childNodes is a handy check to ensure the context is a HTMLElement.
|
||||
if ( ! context || ! context.childNodes ) {
|
||||
context = document;
|
||||
}
|
||||
|
||||
if ( document.getElementsByClassName ) {
|
||||
// Fastest.
|
||||
allReplyLinks = context.getElementsByClassName( selectorClass );
|
||||
}
|
||||
else {
|
||||
// Fast.
|
||||
allReplyLinks = context.querySelectorAll( '.' + selectorClass );
|
||||
}
|
||||
|
||||
return allReplyLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel event handler.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @param {Event} event The calling event.
|
||||
*/
|
||||
function cancelEvent( event ) {
|
||||
var cancelLink = this;
|
||||
var temporaryFormId = config.temporaryFormId;
|
||||
var temporaryElement = getElementById( temporaryFormId );
|
||||
|
||||
if ( ! temporaryElement || ! respondElement ) {
|
||||
// Conditions for cancel link fail.
|
||||
return;
|
||||
}
|
||||
|
||||
getElementById( config.parentIdFieldId ).value = '0';
|
||||
|
||||
// Move the respond form back in place of the temporary element.
|
||||
var headingText = temporaryElement.textContent;
|
||||
temporaryElement.parentNode.replaceChild( respondElement, temporaryElement );
|
||||
cancelLink.style.display = 'none';
|
||||
|
||||
var replyHeadingElement = getElementById( config.commentReplyTitleId );
|
||||
var replyHeadingTextNode = replyHeadingElement && replyHeadingElement.firstChild;
|
||||
var replyLinkToParent = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
|
||||
|
||||
if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE && headingText ) {
|
||||
if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
|
||||
replyLinkToParent.style.display = '';
|
||||
}
|
||||
|
||||
replyHeadingTextNode.textContent = headingText;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Click event handler.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @param {Event} event The calling event.
|
||||
*/
|
||||
function clickEvent( event ) {
|
||||
var replyNode = getElementById( config.commentReplyTitleId );
|
||||
var defaultReplyHeading = replyNode && replyNode.firstChild.textContent;
|
||||
var replyLink = this,
|
||||
commId = getDataAttribute( replyLink, 'belowelement' ),
|
||||
parentId = getDataAttribute( replyLink, 'commentid' ),
|
||||
respondId = getDataAttribute( replyLink, 'respondelement' ),
|
||||
postId = getDataAttribute( replyLink, 'postid' ),
|
||||
replyTo = getDataAttribute( replyLink, 'replyto' ) || defaultReplyHeading,
|
||||
follow;
|
||||
|
||||
if ( ! commId || ! parentId || ! respondId || ! postId ) {
|
||||
/*
|
||||
* Theme or plugin defines own link via custom `wp_list_comments()` callback
|
||||
* and calls `moveForm()` either directly or via a custom event hook.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Third party comments systems can hook into this function via the global scope,
|
||||
* therefore the click event needs to reference the global scope.
|
||||
*/
|
||||
follow = window.addComment.moveForm( commId, parentId, respondId, postId, replyTo );
|
||||
if ( false === follow ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a mutation observer to check for newly inserted comments.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*/
|
||||
function observeChanges() {
|
||||
if ( ! MutationObserver ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var observerOptions = {
|
||||
childList: true,
|
||||
subtree: true
|
||||
};
|
||||
|
||||
observer = new MutationObserver( handleChanges );
|
||||
observer.observe( document.body, observerOptions );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles DOM changes, calling init() if any new nodes are added.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @param {Array} mutationRecords Array of MutationRecord objects.
|
||||
*/
|
||||
function handleChanges( mutationRecords ) {
|
||||
var i = mutationRecords.length;
|
||||
|
||||
while ( i-- ) {
|
||||
// Call init() once if any record in this set adds nodes.
|
||||
if ( mutationRecords[ i ].addedNodes.length ) {
|
||||
init();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Backward compatible getter of data-* attribute.
|
||||
*
|
||||
* Uses element.dataset if it exists, otherwise uses getAttribute.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @param {HTMLElement} Element DOM element with the attribute.
|
||||
* @param {string} Attribute the attribute to get.
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
function getDataAttribute( element, attribute ) {
|
||||
if ( supportsDataset ) {
|
||||
return element.dataset[attribute];
|
||||
}
|
||||
else {
|
||||
return element.getAttribute( 'data-' + attribute );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element by ID.
|
||||
*
|
||||
* Local alias for document.getElementById.
|
||||
*
|
||||
* @since 5.1.0
|
||||
*
|
||||
* @param {HTMLElement} The requested element.
|
||||
*/
|
||||
function getElementById( elementId ) {
|
||||
return document.getElementById( elementId );
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the reply form from its current position to the reply location.
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @memberOf addComment
|
||||
*
|
||||
* @param {string} addBelowId HTML ID of element the form follows.
|
||||
* @param {string} commentId Database ID of comment being replied to.
|
||||
* @param {string} respondId HTML ID of 'respond' element.
|
||||
* @param {string} postId Database ID of the post.
|
||||
* @param {string} replyTo Form heading content.
|
||||
*/
|
||||
function moveForm( addBelowId, commentId, respondId, postId, replyTo ) {
|
||||
// Get elements based on their IDs.
|
||||
var addBelowElement = getElementById( addBelowId );
|
||||
respondElement = getElementById( respondId );
|
||||
|
||||
// Get the hidden fields.
|
||||
var parentIdField = getElementById( config.parentIdFieldId );
|
||||
var postIdField = getElementById( config.postIdFieldId );
|
||||
var element, cssHidden, style;
|
||||
|
||||
var replyHeading = getElementById( config.commentReplyTitleId );
|
||||
var replyHeadingTextNode = replyHeading && replyHeading.firstChild;
|
||||
var replyLinkToParent = replyHeadingTextNode && replyHeadingTextNode.nextSibling;
|
||||
|
||||
if ( ! addBelowElement || ! respondElement || ! parentIdField ) {
|
||||
// Missing key elements, fail.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'undefined' === typeof replyTo ) {
|
||||
replyTo = replyHeadingTextNode && replyHeadingTextNode.textContent;
|
||||
}
|
||||
|
||||
addPlaceHolder( respondElement );
|
||||
|
||||
// Set the value of the post.
|
||||
if ( postId && postIdField ) {
|
||||
postIdField.value = postId;
|
||||
}
|
||||
|
||||
parentIdField.value = commentId;
|
||||
|
||||
cancelElement.style.display = '';
|
||||
addBelowElement.parentNode.insertBefore( respondElement, addBelowElement.nextSibling );
|
||||
|
||||
if ( replyHeadingTextNode && replyHeadingTextNode.nodeType === Node.TEXT_NODE ) {
|
||||
if ( replyLinkToParent && 'A' === replyLinkToParent.nodeName && replyLinkToParent.id !== config.cancelReplyId ) {
|
||||
replyLinkToParent.style.display = 'none';
|
||||
}
|
||||
|
||||
replyHeadingTextNode.textContent = replyTo;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is for backward compatibility with third party commenting systems
|
||||
* hooking into the event using older techniques.
|
||||
*/
|
||||
cancelElement.onclick = function() {
|
||||
return false;
|
||||
};
|
||||
|
||||
// Focus on the first field in the comment form.
|
||||
try {
|
||||
for ( var i = 0; i < commentFormElement.elements.length; i++ ) {
|
||||
element = commentFormElement.elements[i];
|
||||
cssHidden = false;
|
||||
|
||||
// Get elements computed style.
|
||||
if ( 'getComputedStyle' in window ) {
|
||||
// Modern browsers.
|
||||
style = window.getComputedStyle( element );
|
||||
} else if ( document.documentElement.currentStyle ) {
|
||||
// IE 8.
|
||||
style = element.currentStyle;
|
||||
}
|
||||
|
||||
/*
|
||||
* For display none, do the same thing jQuery does. For visibility,
|
||||
* check the element computed style since browsers are already doing
|
||||
* the job for us. In fact, the visibility computed style is the actual
|
||||
* computed value and already takes into account the element ancestors.
|
||||
*/
|
||||
if ( ( element.offsetWidth <= 0 && element.offsetHeight <= 0 ) || style.visibility === 'hidden' ) {
|
||||
cssHidden = true;
|
||||
}
|
||||
|
||||
// Skip form elements that are hidden or disabled.
|
||||
if ( 'hidden' === element.type || element.disabled || cssHidden ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
element.focus();
|
||||
// Stop after the first focusable element.
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* false is returned for backward compatibility with third party commenting systems
|
||||
* hooking into this function.
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add placeholder element.
|
||||
*
|
||||
* Places a place holder element above the #respond element for
|
||||
* the form to be returned to if needs be.
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @param {HTMLelement} respondElement the #respond element holding comment form.
|
||||
*/
|
||||
function addPlaceHolder( respondElement ) {
|
||||
var temporaryFormId = config.temporaryFormId;
|
||||
var temporaryElement = getElementById( temporaryFormId );
|
||||
var replyElement = getElementById( config.commentReplyTitleId );
|
||||
var initialHeadingText = replyElement ? replyElement.firstChild.textContent : '';
|
||||
|
||||
if ( temporaryElement ) {
|
||||
// The element already exists, no need to recreate.
|
||||
return;
|
||||
}
|
||||
|
||||
temporaryElement = document.createElement( 'div' );
|
||||
temporaryElement.id = temporaryFormId;
|
||||
temporaryElement.style.display = 'none';
|
||||
temporaryElement.textContent = initialHeadingText;
|
||||
respondElement.parentNode.insertBefore( temporaryElement, respondElement );
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
moveForm: moveForm
|
||||
};
|
||||
})( window );
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o<i;o++)(n=d[o]).addEventListener("touchstart",a),n.addEventListener("click",a)}}function l(e){var t,n,d=g(b.temporaryFormId);d&&h&&(g(b.parentIdFieldId).value="0",t=d.textContent,d.parentNode.replaceChild(h,d),this.style.display="none",n=(d=(d=g(b.commentReplyTitleId))&&d.firstChild)&&d.nextSibling,d&&d.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),d.textContent=t),e.preventDefault())}function a(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,d=m(n,"belowelement"),o=m(n,"commentid"),i=m(n,"respondelement"),r=m(n,"postid"),n=m(n,"replyto")||t;d&&o&&i&&r&&!1===v.addComment.moveForm(d,o,i,r,n)&&e.preventDefault()}function o(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void d()}function m(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return r&&"loading"!==E.readyState?t():r&&v.addEventListener("DOMContentLoaded",t,!1),{init:d,moveForm:function(e,t,n,d,o){var i,r,l,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===o&&(o=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),d&&y&&(y.value=d),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=o),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],r=!1,"getComputedStyle"in v?l=v.getComputedStyle(i):E.documentElement.currentStyle&&(l=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===l.visibility)&&(r=!0),"hidden"!==i.type&&!i.disabled&&!r){i.focus();break}}catch(e){}return!1}}}}(window);
|
||||
@@ -0,0 +1,165 @@
|
||||
.imgCrop_wrap {
|
||||
/* width: 500px; @done_in_js */
|
||||
/* height: 375px; @done_in_js */
|
||||
position: relative;
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
/* an extra classname is applied for Opera < 9.0 to fix its lack of opacity support */
|
||||
.imgCrop_wrap.opera8 .imgCrop_overlay,
|
||||
.imgCrop_wrap.opera8 .imgCrop_clickArea {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/* fix for IE displaying all boxes at line-height by default, although they are still 1 pixel high until we combine them with the pointless span */
|
||||
.imgCrop_wrap,
|
||||
.imgCrop_wrap * {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.imgCrop_overlay {
|
||||
background-color: #000;
|
||||
opacity: 0.5;
|
||||
filter:alpha(opacity=50);
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.imgCrop_selArea {
|
||||
position: absolute;
|
||||
/* @done_in_js
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: transparent url(castle.jpg) no-repeat -210px -110px;
|
||||
*/
|
||||
cursor: move;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/* clickArea is all a fix for IE 5.5 & 6 to allow the user to click on the given area */
|
||||
.imgCrop_clickArea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #FFF;
|
||||
opacity: 0.01;
|
||||
filter:alpha(opacity=01);
|
||||
}
|
||||
|
||||
.imgCrop_marqueeHoriz {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: transparent url(marqueeHoriz.gif) repeat-x 0 0;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.imgCrop_marqueeVert {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 1px;
|
||||
background: transparent url(marqueeVert.gif) repeat-y 0 0;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.imgCrop_marqueeNorth { top: 0; left: 0; }
|
||||
.imgCrop_marqueeEast { top: 0; right: 0; }
|
||||
.imgCrop_marqueeSouth { bottom: 0px; left: 0; }
|
||||
.imgCrop_marqueeWest { top: 0; left: 0; }
|
||||
|
||||
|
||||
.imgCrop_handle {
|
||||
position: absolute;
|
||||
border: 1px solid #333;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background: #FFF;
|
||||
opacity: 0.5;
|
||||
filter:alpha(opacity=50);
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
/* fix IE 5 box model */
|
||||
* html .imgCrop_handle {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
wid\th: 6px;
|
||||
hei\ght: 6px;
|
||||
}
|
||||
|
||||
.imgCrop_handleN {
|
||||
top: -3px;
|
||||
left: 0;
|
||||
/* margin-left: 49%; @done_in_js */
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleNE {
|
||||
top: -3px;
|
||||
right: -3px;
|
||||
cursor: ne-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleE {
|
||||
top: 0;
|
||||
right: -3px;
|
||||
/* margin-top: 49%; @done_in_js */
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleSE {
|
||||
right: -3px;
|
||||
bottom: -3px;
|
||||
cursor: se-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleS {
|
||||
right: 0;
|
||||
bottom: -3px;
|
||||
/* margin-right: 49%; @done_in_js */
|
||||
cursor: s-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleSW {
|
||||
left: -3px;
|
||||
bottom: -3px;
|
||||
cursor: sw-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleW {
|
||||
top: 0;
|
||||
left: -3px;
|
||||
/* margin-top: 49%; @done_in_js */
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.imgCrop_handleNW {
|
||||
top: -3px;
|
||||
left: -3px;
|
||||
cursor: nw-resize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an area to click & drag around on as the default browser behaviour is to let you drag the image
|
||||
*/
|
||||
.imgCrop_dragArea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 200;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.imgCrop_previewWrap {
|
||||
/* width: 200px; @done_in_js */
|
||||
/* height: 200px; @done_in_js */
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.imgCrop_previewWrap img {
|
||||
position: absolute;
|
||||
}
|
||||
@@ -0,0 +1,516 @@
|
||||
/**
|
||||
* Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://www.opensource.org/licenses/bsd-license.php
|
||||
*
|
||||
* See scriptaculous.js for full scriptaculous licence
|
||||
*/
|
||||
|
||||
var CropDraggable=Class.create();
|
||||
Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(_1){
|
||||
this.options=Object.extend({drawMethod:function(){
|
||||
}},arguments[1]||{});
|
||||
this.element=$(_1);
|
||||
this.handle=this.element;
|
||||
this.delta=this.currentDelta();
|
||||
this.dragging=false;
|
||||
this.eventMouseDown=this.initDrag.bindAsEventListener(this);
|
||||
Event.observe(this.handle,"mousedown",this.eventMouseDown);
|
||||
Draggables.register(this);
|
||||
},draw:function(_2){
|
||||
var _3=Position.cumulativeOffset(this.element);
|
||||
var d=this.currentDelta();
|
||||
_3[0]-=d[0];
|
||||
_3[1]-=d[1];
|
||||
var p=[0,1].map(function(i){
|
||||
return (_2[i]-_3[i]-this.offset[i]);
|
||||
}.bind(this));
|
||||
this.options.drawMethod(p);
|
||||
}});
|
||||
var Cropper={};
|
||||
Cropper.Img=Class.create();
|
||||
Cropper.Img.prototype={initialize:function(_7,_8){
|
||||
this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true},_8||{});
|
||||
if(this.options.minWidth>0&&this.options.minHeight>0){
|
||||
this.options.ratioDim.x=this.options.minWidth;
|
||||
this.options.ratioDim.y=this.options.minHeight;
|
||||
}
|
||||
this.img=$(_7);
|
||||
this.clickCoords={x:0,y:0};
|
||||
this.dragging=false;
|
||||
this.resizing=false;
|
||||
this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);
|
||||
this.isIE=/MSIE/.test(navigator.userAgent);
|
||||
this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);
|
||||
this.ratioX=0;
|
||||
this.ratioY=0;
|
||||
this.attached=false;
|
||||
$A(document.getElementsByTagName("script")).each(function(s){
|
||||
if(s.src.match(/cropper\.js/)){
|
||||
var _a=s.src.replace(/cropper\.js(.*)?/,"");
|
||||
var _b=document.createElement("link");
|
||||
_b.rel="stylesheet";
|
||||
_b.type="text/css";
|
||||
_b.href=_a+"cropper.css";
|
||||
_b.media="screen";
|
||||
document.getElementsByTagName("head")[0].appendChild(_b);
|
||||
}
|
||||
});
|
||||
if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){
|
||||
var _c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);
|
||||
this.ratioX=this.options.ratioDim.x/_c;
|
||||
this.ratioY=this.options.ratioDim.y/_c;
|
||||
}
|
||||
this.subInitialize();
|
||||
if(this.img.complete||this.isWebKit){
|
||||
this.onLoad();
|
||||
}else{
|
||||
Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this));
|
||||
}
|
||||
},getGCD:function(a,b){return 1;
|
||||
if(b==0){
|
||||
return a;
|
||||
}
|
||||
return this.getGCD(b,a%b);
|
||||
},onLoad:function(){
|
||||
var _f="imgCrop_";
|
||||
var _10=this.img.parentNode;
|
||||
var _11="";
|
||||
if(this.isOpera8){
|
||||
_11=" opera8";
|
||||
}
|
||||
this.imgWrap=Builder.node("div",{"class":_f+"wrap"+_11});
|
||||
if(this.isIE){
|
||||
this.north=Builder.node("div",{"class":_f+"overlay "+_f+"north"},[Builder.node("span")]);
|
||||
this.east=Builder.node("div",{"class":_f+"overlay "+_f+"east"},[Builder.node("span")]);
|
||||
this.south=Builder.node("div",{"class":_f+"overlay "+_f+"south"},[Builder.node("span")]);
|
||||
this.west=Builder.node("div",{"class":_f+"overlay "+_f+"west"},[Builder.node("span")]);
|
||||
var _12=[this.north,this.east,this.south,this.west];
|
||||
}else{
|
||||
this.overlay=Builder.node("div",{"class":_f+"overlay"});
|
||||
var _12=[this.overlay];
|
||||
}
|
||||
this.dragArea=Builder.node("div",{"class":_f+"dragArea"},_12);
|
||||
this.handleN=Builder.node("div",{"class":_f+"handle "+_f+"handleN"});
|
||||
this.handleNE=Builder.node("div",{"class":_f+"handle "+_f+"handleNE"});
|
||||
this.handleE=Builder.node("div",{"class":_f+"handle "+_f+"handleE"});
|
||||
this.handleSE=Builder.node("div",{"class":_f+"handle "+_f+"handleSE"});
|
||||
this.handleS=Builder.node("div",{"class":_f+"handle "+_f+"handleS"});
|
||||
this.handleSW=Builder.node("div",{"class":_f+"handle "+_f+"handleSW"});
|
||||
this.handleW=Builder.node("div",{"class":_f+"handle "+_f+"handleW"});
|
||||
this.handleNW=Builder.node("div",{"class":_f+"handle "+_f+"handleNW"});
|
||||
this.selArea=Builder.node("div",{"class":_f+"selArea"},[Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeNorth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeEast"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeSouth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeWest"},[Builder.node("span")]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node("div",{"class":_f+"clickArea"})]);
|
||||
Element.setStyle($(this.selArea),{backgroundColor:"transparent",backgroundRepeat:"no-repeat",backgroundPosition:"0 0"});
|
||||
this.imgWrap.appendChild(this.img);
|
||||
this.imgWrap.appendChild(this.dragArea);
|
||||
this.dragArea.appendChild(this.selArea);
|
||||
this.dragArea.appendChild(Builder.node("div",{"class":_f+"clickArea"}));
|
||||
_10.appendChild(this.imgWrap);
|
||||
Event.observe(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this));
|
||||
Event.observe(document,"mousemove",this.onDrag.bindAsEventListener(this));
|
||||
Event.observe(document,"mouseup",this.endCrop.bindAsEventListener(this));
|
||||
var _13=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];
|
||||
for(var i=0;i<_13.length;i++){
|
||||
Event.observe(_13[i],"mousedown",this.startResize.bindAsEventListener(this));
|
||||
}
|
||||
if(this.options.captureKeys){
|
||||
Event.observe(document,"keydown",this.handleKeys.bindAsEventListener(this));
|
||||
}
|
||||
new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});
|
||||
this.setParams();
|
||||
},setParams:function(){
|
||||
this.imgW=this.img.width;
|
||||
this.imgH=this.img.height;
|
||||
if(!this.isIE){
|
||||
Element.setStyle($(this.overlay),{width:this.imgW+"px",height:this.imgH+"px"});
|
||||
Element.hide($(this.overlay));
|
||||
Element.setStyle($(this.selArea),{backgroundImage:"url("+this.img.src+")"});
|
||||
}else{
|
||||
Element.setStyle($(this.north),{height:0});
|
||||
Element.setStyle($(this.east),{width:0,height:0});
|
||||
Element.setStyle($(this.south),{height:0});
|
||||
Element.setStyle($(this.west),{width:0,height:0});
|
||||
}
|
||||
Element.setStyle($(this.imgWrap),{"width":this.imgW+"px","height":this.imgH+"px"});
|
||||
Element.hide($(this.selArea));
|
||||
var _15=Position.positionedOffset(this.imgWrap);
|
||||
this.wrapOffsets={"top":_15[1],"left":_15[0]};
|
||||
var _16={x1:0,y1:0,x2:0,y2:0};
|
||||
this.setAreaCoords(_16);
|
||||
if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0&&this.options.displayOnInit){
|
||||
_16.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2);
|
||||
_16.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2);
|
||||
_16.x2=_16.x1+this.options.ratioDim.x;
|
||||
_16.y2=_16.y1+this.options.ratioDim.y;
|
||||
Element.show(this.selArea);
|
||||
this.drawArea();
|
||||
this.endCrop();
|
||||
}
|
||||
this.attached=true;
|
||||
},remove:function(){
|
||||
this.attached=false;
|
||||
this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap);
|
||||
this.imgWrap.parentNode.removeChild(this.imgWrap);
|
||||
Event.stopObserving(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this));
|
||||
Event.stopObserving(document,"mousemove",this.onDrag.bindAsEventListener(this));
|
||||
Event.stopObserving(document,"mouseup",this.endCrop.bindAsEventListener(this));
|
||||
var _17=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];
|
||||
for(var i=0;i<_17.length;i++){
|
||||
Event.stopObserving(_17[i],"mousedown",this.startResize.bindAsEventListener(this));
|
||||
}
|
||||
if(this.options.captureKeys){
|
||||
Event.stopObserving(document,"keydown",this.handleKeys.bindAsEventListener(this));
|
||||
}
|
||||
},reset:function(){
|
||||
if(!this.attached){
|
||||
this.onLoad();
|
||||
}else{
|
||||
this.setParams();
|
||||
}
|
||||
this.endCrop();
|
||||
},handleKeys:function(e){
|
||||
var dir={x:0,y:0};
|
||||
if(!this.dragging){
|
||||
switch(e.keyCode){
|
||||
case (37):
|
||||
dir.x=-1;
|
||||
break;
|
||||
case (38):
|
||||
dir.y=-1;
|
||||
break;
|
||||
case (39):
|
||||
dir.x=1;
|
||||
break;
|
||||
case (40):
|
||||
dir.y=1;
|
||||
break;
|
||||
}
|
||||
if(dir.x!=0||dir.y!=0){
|
||||
if(e.shiftKey){
|
||||
dir.x*=10;
|
||||
dir.y*=10;
|
||||
}
|
||||
this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]);
|
||||
Event.stop(e);
|
||||
}
|
||||
}
|
||||
},calcW:function(){
|
||||
return (this.areaCoords.x2-this.areaCoords.x1);
|
||||
},calcH:function(){
|
||||
return (this.areaCoords.y2-this.areaCoords.y1);
|
||||
},moveArea:function(_1b){
|
||||
this.setAreaCoords({x1:_1b[0],y1:_1b[1],x2:_1b[0]+this.calcW(),y2:_1b[1]+this.calcH()},true);
|
||||
this.drawArea();
|
||||
},cloneCoords:function(_1c){
|
||||
return {x1:_1c.x1,y1:_1c.y1,x2:_1c.x2,y2:_1c.y2};
|
||||
},setAreaCoords:function(_1d,_1e,_1f,_20,_21){
|
||||
var _22=typeof _1e!="undefined"?_1e:false;
|
||||
var _23=typeof _1f!="undefined"?_1f:false;
|
||||
if(_1e){
|
||||
var _24=_1d.x2-_1d.x1;
|
||||
var _25=_1d.y2-_1d.y1;
|
||||
if(_1d.x1<0){
|
||||
_1d.x1=0;
|
||||
_1d.x2=_24;
|
||||
}
|
||||
if(_1d.y1<0){
|
||||
_1d.y1=0;
|
||||
_1d.y2=_25;
|
||||
}
|
||||
if(_1d.x2>this.imgW){
|
||||
_1d.x2=this.imgW;
|
||||
_1d.x1=this.imgW-_24;
|
||||
}
|
||||
if(_1d.y2>this.imgH){
|
||||
_1d.y2=this.imgH;
|
||||
_1d.y1=this.imgH-_25;
|
||||
}
|
||||
}else{
|
||||
if(_1d.x1<0){
|
||||
_1d.x1=0;
|
||||
}
|
||||
if(_1d.y1<0){
|
||||
_1d.y1=0;
|
||||
}
|
||||
if(_1d.x2>this.imgW){
|
||||
_1d.x2=this.imgW;
|
||||
}
|
||||
if(_1d.y2>this.imgH){
|
||||
_1d.y2=this.imgH;
|
||||
}
|
||||
if(typeof (_20)!="undefined"){
|
||||
if(this.ratioX>0){
|
||||
this.applyRatio(_1d,{x:this.ratioX,y:this.ratioY},_20,_21);
|
||||
}else{
|
||||
if(_23){
|
||||
this.applyRatio(_1d,{x:1,y:1},_20,_21);
|
||||
}
|
||||
}
|
||||
var _26={a1:_1d.x1,a2:_1d.x2};
|
||||
var _27={a1:_1d.y1,a2:_1d.y2};
|
||||
var _28=this.options.minWidth;
|
||||
var _29=this.options.minHeight;
|
||||
if((_28==0||_29==0)&&_23){
|
||||
if(_28>0){
|
||||
_29=_28;
|
||||
}else{
|
||||
if(_29>0){
|
||||
_28=_29;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.applyMinDimension(_26,_28,_20.x,{min:0,max:this.imgW});
|
||||
this.applyMinDimension(_27,_29,_20.y,{min:0,max:this.imgH});
|
||||
_1d={x1:_26.a1,y1:_27.a1,x2:_26.a2,y2:_27.a2};
|
||||
}
|
||||
}
|
||||
this.areaCoords=_1d;
|
||||
},applyMinDimension:function(_2a,_2b,_2c,_2d){
|
||||
if((_2a.a2-_2a.a1)<_2b){
|
||||
if(_2c==1){
|
||||
_2a.a2=_2a.a1+_2b;
|
||||
}else{
|
||||
_2a.a1=_2a.a2-_2b;
|
||||
}
|
||||
if(_2a.a1<_2d.min){
|
||||
_2a.a1=_2d.min;
|
||||
_2a.a2=_2b;
|
||||
}else{
|
||||
if(_2a.a2>_2d.max){
|
||||
_2a.a1=_2d.max-_2b;
|
||||
_2a.a2=_2d.max;
|
||||
}
|
||||
}
|
||||
}
|
||||
},applyRatio:function(_2e,_2f,_30,_31){
|
||||
var _32;
|
||||
if(_31=="N"||_31=="S"){
|
||||
_32=this.applyRatioToAxis({a1:_2e.y1,b1:_2e.x1,a2:_2e.y2,b2:_2e.x2},{a:_2f.y,b:_2f.x},{a:_30.y,b:_30.x},{min:0,max:this.imgW});
|
||||
_2e.x1=_32.b1;
|
||||
_2e.y1=_32.a1;
|
||||
_2e.x2=_32.b2;
|
||||
_2e.y2=_32.a2;
|
||||
}else{
|
||||
_32=this.applyRatioToAxis({a1:_2e.x1,b1:_2e.y1,a2:_2e.x2,b2:_2e.y2},{a:_2f.x,b:_2f.y},{a:_30.x,b:_30.y},{min:0,max:this.imgH});
|
||||
_2e.x1=_32.a1;
|
||||
_2e.y1=_32.b1;
|
||||
_2e.x2=_32.a2;
|
||||
_2e.y2=_32.b2;
|
||||
}
|
||||
},applyRatioToAxis:function(_33,_34,_35,_36){
|
||||
var _37=Object.extend(_33,{});
|
||||
var _38=_37.a2-_37.a1;
|
||||
var _3a=Math.floor(_38*_34.b/_34.a);
|
||||
var _3b;
|
||||
var _3c;
|
||||
var _3d=null;
|
||||
if(_35.b==1){
|
||||
_3b=_37.b1+_3a;
|
||||
if(_3b>_36.max){
|
||||
_3b=_36.max;
|
||||
_3d=_3b-_37.b1;
|
||||
}
|
||||
_37.b2=_3b;
|
||||
}else{
|
||||
_3b=_37.b2-_3a;
|
||||
if(_3b<_36.min){
|
||||
_3b=_36.min;
|
||||
_3d=_3b+_37.b2;
|
||||
}
|
||||
_37.b1=_3b;
|
||||
}
|
||||
if(_3d!=null){
|
||||
_3c=Math.floor(_3d*_34.a/_34.b);
|
||||
if(_35.a==1){
|
||||
_37.a2=_37.a1+_3c;
|
||||
}else{
|
||||
_37.a1=_37.a1=_37.a2-_3c;
|
||||
}
|
||||
}
|
||||
return _37;
|
||||
},drawArea:function(){
|
||||
if(!this.isIE){
|
||||
Element.show($(this.overlay));
|
||||
}
|
||||
var _3e=this.calcW();
|
||||
var _3f=this.calcH();
|
||||
var _40=this.areaCoords.x2;
|
||||
var _41=this.areaCoords.y2;
|
||||
var _42=this.selArea.style;
|
||||
_42.left=this.areaCoords.x1+"px";
|
||||
_42.top=this.areaCoords.y1+"px";
|
||||
_42.width=_3e+"px";
|
||||
_42.height=_3f+"px";
|
||||
var _43=Math.ceil((_3e-6)/2)+"px";
|
||||
var _44=Math.ceil((_3f-6)/2)+"px";
|
||||
this.handleN.style.left=_43;
|
||||
this.handleE.style.top=_44;
|
||||
this.handleS.style.left=_43;
|
||||
this.handleW.style.top=_44;
|
||||
if(this.isIE){
|
||||
this.north.style.height=this.areaCoords.y1+"px";
|
||||
var _45=this.east.style;
|
||||
_45.top=this.areaCoords.y1+"px";
|
||||
_45.height=_3f+"px";
|
||||
_45.left=_40+"px";
|
||||
_45.width=(this.img.width-_40)+"px";
|
||||
var _46=this.south.style;
|
||||
_46.top=_41+"px";
|
||||
_46.height=(this.img.height-_41)+"px";
|
||||
var _47=this.west.style;
|
||||
_47.top=this.areaCoords.y1+"px";
|
||||
_47.height=_3f+"px";
|
||||
_47.width=this.areaCoords.x1+"px";
|
||||
}else{
|
||||
_42.backgroundPosition="-"+this.areaCoords.x1+"px "+"-"+this.areaCoords.y1+"px";
|
||||
}
|
||||
this.subDrawArea();
|
||||
this.forceReRender();
|
||||
},forceReRender:function(){
|
||||
if(this.isIE||this.isWebKit){
|
||||
var n=document.createTextNode(" ");
|
||||
var d,el,fixEL,i;
|
||||
if(this.isIE){
|
||||
fixEl=this.selArea;
|
||||
}else{
|
||||
if(this.isWebKit){
|
||||
fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0];
|
||||
d=Builder.node("div","");
|
||||
d.style.visibility="hidden";
|
||||
var _4a=["SE","S","SW"];
|
||||
for(i=0;i<_4a.length;i++){
|
||||
el=document.getElementsByClassName("imgCrop_handle"+_4a[i],this.selArea)[0];
|
||||
if(el.childNodes.length){
|
||||
el.removeChild(el.childNodes[0]);
|
||||
}
|
||||
el.appendChild(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
fixEl.appendChild(n);
|
||||
fixEl.removeChild(n);
|
||||
}
|
||||
},startResize:function(e){
|
||||
this.startCoords=this.cloneCoords(this.areaCoords);
|
||||
this.resizing=true;
|
||||
this.resizeHandle=Element.classNames(Event.element(e)).toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,"");
|
||||
Event.stop(e);
|
||||
},startDrag:function(e){
|
||||
Element.show(this.selArea);
|
||||
this.clickCoords=this.getCurPos(e);
|
||||
this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y});
|
||||
this.dragging=true;
|
||||
this.onDrag(e);
|
||||
Event.stop(e);
|
||||
},getCurPos:function(e){
|
||||
return curPos={x:Event.pointerX(e)-this.wrapOffsets.left,y:Event.pointerY(e)-this.wrapOffsets.top};
|
||||
},onDrag:function(e){
|
||||
var _4f=null;
|
||||
if(this.dragging||this.resizing){
|
||||
var _50=this.getCurPos(e);
|
||||
var _51=this.cloneCoords(this.areaCoords);
|
||||
var _52={x:1,y:1};
|
||||
}
|
||||
if(this.dragging){
|
||||
if(_50.x<this.clickCoords.x){
|
||||
_52.x=-1;
|
||||
}
|
||||
if(_50.y<this.clickCoords.y){
|
||||
_52.y=-1;
|
||||
}
|
||||
this.transformCoords(_50.x,this.clickCoords.x,_51,"x");
|
||||
this.transformCoords(_50.y,this.clickCoords.y,_51,"y");
|
||||
}else{
|
||||
if(this.resizing){
|
||||
_4f=this.resizeHandle;
|
||||
if(_4f.match(/E/)){
|
||||
this.transformCoords(_50.x,this.startCoords.x1,_51,"x");
|
||||
if(_50.x<this.startCoords.x1){
|
||||
_52.x=-1;
|
||||
}
|
||||
}else{
|
||||
if(_4f.match(/W/)){
|
||||
this.transformCoords(_50.x,this.startCoords.x2,_51,"x");
|
||||
if(_50.x<this.startCoords.x2){
|
||||
_52.x=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_4f.match(/N/)){
|
||||
this.transformCoords(_50.y,this.startCoords.y2,_51,"y");
|
||||
if(_50.y<this.startCoords.y2){
|
||||
_52.y=-1;
|
||||
}
|
||||
}else{
|
||||
if(_4f.match(/S/)){
|
||||
this.transformCoords(_50.y,this.startCoords.y1,_51,"y");
|
||||
if(_50.y<this.startCoords.y1){
|
||||
_52.y=-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.dragging||this.resizing){
|
||||
this.setAreaCoords(_51,false,e.shiftKey,_52,_4f);
|
||||
this.drawArea();
|
||||
Event.stop(e);
|
||||
}
|
||||
},transformCoords:function(_53,_54,_55,_56){
|
||||
var _57=new Array();
|
||||
if(_53<_54){
|
||||
_57[0]=_53;
|
||||
_57[1]=_54;
|
||||
}else{
|
||||
_57[0]=_54;
|
||||
_57[1]=_53;
|
||||
}
|
||||
if(_56=="x"){
|
||||
_55.x1=_57[0];
|
||||
_55.x2=_57[1];
|
||||
}else{
|
||||
_55.y1=_57[0];
|
||||
_55.y2=_57[1];
|
||||
}
|
||||
},endCrop:function(){
|
||||
this.dragging=false;
|
||||
this.resizing=false;
|
||||
this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});
|
||||
},subInitialize:function(){
|
||||
},subDrawArea:function(){
|
||||
}};
|
||||
Cropper.ImgWithPreview=Class.create();
|
||||
Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){
|
||||
this.hasPreviewImg=false;
|
||||
if(typeof (this.options.previewWrap)!="undefined"&&this.options.minWidth>0&&this.options.minHeight>0){
|
||||
this.previewWrap=$(this.options.previewWrap);
|
||||
this.previewImg=this.img.cloneNode(false);
|
||||
this.options.displayOnInit=true;
|
||||
this.hasPreviewImg=true;
|
||||
Element.addClassName(this.previewWrap,"imgCrop_previewWrap");
|
||||
Element.setStyle(this.previewWrap,{width:this.options.minWidth+"px",height:this.options.minHeight+"px"});
|
||||
this.previewWrap.appendChild(this.previewImg);
|
||||
}
|
||||
},subDrawArea:function(){
|
||||
if(this.hasPreviewImg){
|
||||
var _58=this.calcW();
|
||||
var _59=this.calcH();
|
||||
var _5a={x:this.imgW/_58,y:this.imgH/_59};
|
||||
var _5b={x:_58/this.options.minWidth,y:_59/this.options.minHeight};
|
||||
var _5c={w:Math.ceil(this.options.minWidth*_5a.x)+"px",h:Math.ceil(this.options.minHeight*_5a.y)+"px",x:"-"+Math.ceil(this.areaCoords.x1/_5b.x)+"px",y:"-"+Math.ceil(this.areaCoords.y1/_5b.y)+"px"};
|
||||
var _5d=this.previewImg.style;
|
||||
_5d.width=_5c.w;
|
||||
_5d.height=_5c.h;
|
||||
_5d.left=_5c.x;
|
||||
_5d.top=_5c.y;
|
||||
}
|
||||
}});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 277 B |
Binary file not shown.
|
After Width: | Height: | Size: 293 B |
@@ -0,0 +1,994 @@
|
||||
/**
|
||||
* @output wp-includes/js/customize-base.js
|
||||
*/
|
||||
|
||||
/** @namespace wp */
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function( exports, $ ){
|
||||
var api = {}, ctor, inherits,
|
||||
slice = Array.prototype.slice;
|
||||
|
||||
// Shared empty constructor function to aid in prototype-chain creation.
|
||||
ctor = function() {};
|
||||
|
||||
/**
|
||||
* Helper function to correctly set up the prototype chain, for subclasses.
|
||||
* Similar to `goog.inherits`, but uses a hash of prototype properties and
|
||||
* class properties to be extended.
|
||||
*
|
||||
* @param object parent Parent class constructor to inherit from.
|
||||
* @param object protoProps Properties to apply to the prototype for use as class instance properties.
|
||||
* @param object staticProps Properties to apply directly to the class constructor.
|
||||
* @return child The subclassed constructor.
|
||||
*/
|
||||
inherits = function( parent, protoProps, staticProps ) {
|
||||
var child;
|
||||
|
||||
/*
|
||||
* The constructor function for the new subclass is either defined by you
|
||||
* (the "constructor" property in your `extend` definition), or defaulted
|
||||
* by us to simply call `super()`.
|
||||
*/
|
||||
if ( protoProps && protoProps.hasOwnProperty( 'constructor' ) ) {
|
||||
child = protoProps.constructor;
|
||||
} else {
|
||||
child = function() {
|
||||
/*
|
||||
* Storing the result `super()` before returning the value
|
||||
* prevents a bug in Opera where, if the constructor returns
|
||||
* a function, Opera will reject the return value in favor of
|
||||
* the original object. This causes all sorts of trouble.
|
||||
*/
|
||||
var result = parent.apply( this, arguments );
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
// Inherit class (static) properties from parent.
|
||||
$.extend( child, parent );
|
||||
|
||||
// Set the prototype chain to inherit from `parent`,
|
||||
// without calling `parent`'s constructor function.
|
||||
ctor.prototype = parent.prototype;
|
||||
child.prototype = new ctor();
|
||||
|
||||
// Add prototype properties (instance properties) to the subclass,
|
||||
// if supplied.
|
||||
if ( protoProps ) {
|
||||
$.extend( child.prototype, protoProps );
|
||||
}
|
||||
|
||||
// Add static properties to the constructor function, if supplied.
|
||||
if ( staticProps ) {
|
||||
$.extend( child, staticProps );
|
||||
}
|
||||
|
||||
// Correctly set child's `prototype.constructor`.
|
||||
child.prototype.constructor = child;
|
||||
|
||||
// Set a convenience property in case the parent's prototype is needed later.
|
||||
child.__super__ = parent.prototype;
|
||||
|
||||
return child;
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for object inheritance.
|
||||
*/
|
||||
api.Class = function( applicator, argsArray, options ) {
|
||||
var magic, args = arguments;
|
||||
|
||||
if ( applicator && argsArray && api.Class.applicator === applicator ) {
|
||||
args = argsArray;
|
||||
$.extend( this, options || {} );
|
||||
}
|
||||
|
||||
magic = this;
|
||||
|
||||
/*
|
||||
* If the class has a method called "instance",
|
||||
* the return value from the class' constructor will be a function that
|
||||
* calls the "instance" method.
|
||||
*
|
||||
* It is also an object that has properties and methods inside it.
|
||||
*/
|
||||
if ( this.instance ) {
|
||||
magic = function() {
|
||||
return magic.instance.apply( magic, arguments );
|
||||
};
|
||||
|
||||
$.extend( magic, this );
|
||||
}
|
||||
|
||||
magic.initialize.apply( magic, args );
|
||||
return magic;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a subclass of the class.
|
||||
*
|
||||
* @param object protoProps Properties to apply to the prototype.
|
||||
* @param object staticProps Properties to apply directly to the class.
|
||||
* @return child The subclass.
|
||||
*/
|
||||
api.Class.extend = function( protoProps, staticProps ) {
|
||||
var child = inherits( this, protoProps, staticProps );
|
||||
child.extend = this.extend;
|
||||
return child;
|
||||
};
|
||||
|
||||
api.Class.applicator = {};
|
||||
|
||||
/**
|
||||
* Initialize a class instance.
|
||||
*
|
||||
* Override this function in a subclass as needed.
|
||||
*/
|
||||
api.Class.prototype.initialize = function() {};
|
||||
|
||||
/*
|
||||
* Checks whether a given instance extended a constructor.
|
||||
*
|
||||
* The magic surrounding the instance parameter causes the instanceof
|
||||
* keyword to return inaccurate results; it defaults to the function's
|
||||
* prototype instead of the constructor chain. Hence this function.
|
||||
*/
|
||||
api.Class.prototype.extended = function( constructor ) {
|
||||
var proto = this;
|
||||
|
||||
while ( typeof proto.constructor !== 'undefined' ) {
|
||||
if ( proto.constructor === constructor ) {
|
||||
return true;
|
||||
}
|
||||
if ( typeof proto.constructor.__super__ === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
proto = proto.constructor.__super__;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* An events manager object, offering the ability to bind to and trigger events.
|
||||
*
|
||||
* Used as a mixin.
|
||||
*/
|
||||
api.Events = {
|
||||
trigger: function( id ) {
|
||||
if ( this.topics && this.topics[ id ] ) {
|
||||
this.topics[ id ].fireWith( this, slice.call( arguments, 1 ) );
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
bind: function( id ) {
|
||||
this.topics = this.topics || {};
|
||||
this.topics[ id ] = this.topics[ id ] || $.Callbacks();
|
||||
this.topics[ id ].add.apply( this.topics[ id ], slice.call( arguments, 1 ) );
|
||||
return this;
|
||||
},
|
||||
|
||||
unbind: function( id ) {
|
||||
if ( this.topics && this.topics[ id ] ) {
|
||||
this.topics[ id ].remove.apply( this.topics[ id ], slice.call( arguments, 1 ) );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Observable values that support two-way binding.
|
||||
*
|
||||
* @memberOf wp.customize
|
||||
* @alias wp.customize.Value
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
api.Value = api.Class.extend(/** @lends wp.customize.Value.prototype */{
|
||||
/**
|
||||
* @param {mixed} initial The initial value.
|
||||
* @param {Object} options
|
||||
*/
|
||||
initialize: function( initial, options ) {
|
||||
this._value = initial; // @todo Potentially change this to a this.set() call.
|
||||
this.callbacks = $.Callbacks();
|
||||
this._dirty = false;
|
||||
|
||||
$.extend( this, options || {} );
|
||||
|
||||
this.set = this.set.bind( this );
|
||||
},
|
||||
|
||||
/*
|
||||
* Magic. Returns a function that will become the instance.
|
||||
* Set to null to prevent the instance from extending a function.
|
||||
*/
|
||||
instance: function() {
|
||||
return arguments.length ? this.set.apply( this, arguments ) : this.get();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the value.
|
||||
*
|
||||
* @return {mixed}
|
||||
*/
|
||||
get: function() {
|
||||
return this._value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the value and trigger all bound callbacks.
|
||||
*
|
||||
* @param {Object} to New value.
|
||||
*/
|
||||
set: function( to ) {
|
||||
var from = this._value;
|
||||
|
||||
to = this._setter.apply( this, arguments );
|
||||
to = this.validate( to );
|
||||
|
||||
// Bail if the sanitized value is null or unchanged.
|
||||
if ( null === to || _.isEqual( from, to ) ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this._value = to;
|
||||
this._dirty = true;
|
||||
|
||||
this.callbacks.fireWith( this, [ to, from ] );
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
_setter: function( to ) {
|
||||
return to;
|
||||
},
|
||||
|
||||
setter: function( callback ) {
|
||||
var from = this.get();
|
||||
this._setter = callback;
|
||||
// Temporarily clear value so setter can decide if it's valid.
|
||||
this._value = null;
|
||||
this.set( from );
|
||||
return this;
|
||||
},
|
||||
|
||||
resetSetter: function() {
|
||||
this._setter = this.constructor.prototype._setter;
|
||||
this.set( this.get() );
|
||||
return this;
|
||||
},
|
||||
|
||||
validate: function( value ) {
|
||||
return value;
|
||||
},
|
||||
|
||||
/**
|
||||
* Bind a function to be invoked whenever the value changes.
|
||||
*
|
||||
* @param {...Function} A function, or multiple functions, to add to the callback stack.
|
||||
*/
|
||||
bind: function() {
|
||||
this.callbacks.add.apply( this.callbacks, arguments );
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Unbind a previously bound function.
|
||||
*
|
||||
* @param {...Function} A function, or multiple functions, to remove from the callback stack.
|
||||
*/
|
||||
unbind: function() {
|
||||
this.callbacks.remove.apply( this.callbacks, arguments );
|
||||
return this;
|
||||
},
|
||||
|
||||
link: function() { // values*
|
||||
var set = this.set;
|
||||
$.each( arguments, function() {
|
||||
this.bind( set );
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
unlink: function() { // values*
|
||||
var set = this.set;
|
||||
$.each( arguments, function() {
|
||||
this.unbind( set );
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
sync: function() { // values*
|
||||
var that = this;
|
||||
$.each( arguments, function() {
|
||||
that.link( this );
|
||||
this.link( that );
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
unsync: function() { // values*
|
||||
var that = this;
|
||||
$.each( arguments, function() {
|
||||
that.unlink( this );
|
||||
this.unlink( that );
|
||||
});
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* A collection of observable values.
|
||||
*
|
||||
* @memberOf wp.customize
|
||||
* @alias wp.customize.Values
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.customize.Class
|
||||
* @mixes wp.customize.Events
|
||||
*/
|
||||
api.Values = api.Class.extend(/** @lends wp.customize.Values.prototype */{
|
||||
|
||||
/**
|
||||
* The default constructor for items of the collection.
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
defaultConstructor: api.Value,
|
||||
|
||||
initialize: function( options ) {
|
||||
$.extend( this, options || {} );
|
||||
|
||||
this._value = {};
|
||||
this._deferreds = {};
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the instance of an item from the collection if only ID is specified.
|
||||
*
|
||||
* If more than one argument is supplied, all are expected to be IDs and
|
||||
* the last to be a function callback that will be invoked when the requested
|
||||
* items are available.
|
||||
*
|
||||
* @see {api.Values.when}
|
||||
*
|
||||
* @param {string} id ID of the item.
|
||||
* @param {...} Zero or more IDs of items to wait for and a callback
|
||||
* function to invoke when they're available. Optional.
|
||||
* @return {mixed} The item instance if only one ID was supplied.
|
||||
* A Deferred Promise object if a callback function is supplied.
|
||||
*/
|
||||
instance: function( id ) {
|
||||
if ( arguments.length === 1 ) {
|
||||
return this.value( id );
|
||||
}
|
||||
|
||||
return this.when.apply( this, arguments );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the instance of an item.
|
||||
*
|
||||
* @param {string} id The ID of the item.
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
value: function( id ) {
|
||||
return this._value[ id ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Whether the collection has an item with the given ID.
|
||||
*
|
||||
* @param {string} id The ID of the item to look for.
|
||||
* @return {boolean}
|
||||
*/
|
||||
has: function( id ) {
|
||||
return typeof this._value[ id ] !== 'undefined';
|
||||
},
|
||||
|
||||
/**
|
||||
* Add an item to the collection.
|
||||
*
|
||||
* @param {string|wp.customize.Class} item - The item instance to add, or the ID for the instance to add.
|
||||
* When an ID string is supplied, then itemObject must be provided.
|
||||
* @param {wp.customize.Class} [itemObject] - The item instance when the first argument is an ID string.
|
||||
* @return {wp.customize.Class} The new item's instance, or an existing instance if already added.
|
||||
*/
|
||||
add: function( item, itemObject ) {
|
||||
var collection = this, id, instance;
|
||||
if ( 'string' === typeof item ) {
|
||||
id = item;
|
||||
instance = itemObject;
|
||||
} else {
|
||||
if ( 'string' !== typeof item.id ) {
|
||||
throw new Error( 'Unknown key' );
|
||||
}
|
||||
id = item.id;
|
||||
instance = item;
|
||||
}
|
||||
|
||||
if ( collection.has( id ) ) {
|
||||
return collection.value( id );
|
||||
}
|
||||
|
||||
collection._value[ id ] = instance;
|
||||
instance.parent = collection;
|
||||
|
||||
// Propagate a 'change' event on an item up to the collection.
|
||||
if ( instance.extended( api.Value ) ) {
|
||||
instance.bind( collection._change );
|
||||
}
|
||||
|
||||
collection.trigger( 'add', instance );
|
||||
|
||||
// If a deferred object exists for this item,
|
||||
// resolve it.
|
||||
if ( collection._deferreds[ id ] ) {
|
||||
collection._deferreds[ id ].resolve();
|
||||
}
|
||||
|
||||
return collection._value[ id ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new item of the collection using the collection's default constructor
|
||||
* and store it in the collection.
|
||||
*
|
||||
* @param {string} id The ID of the item.
|
||||
* @param {mixed} value Any extra arguments are passed into the item's initialize method.
|
||||
* @return {mixed} The new item's instance.
|
||||
*/
|
||||
create: function( id ) {
|
||||
return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Iterate over all items in the collection invoking the provided callback.
|
||||
*
|
||||
* @param {Function} callback Function to invoke.
|
||||
* @param {Object} context Object context to invoke the function with. Optional.
|
||||
*/
|
||||
each: function( callback, context ) {
|
||||
context = typeof context === 'undefined' ? this : context;
|
||||
|
||||
$.each( this._value, function( key, obj ) {
|
||||
callback.call( context, obj, key );
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove an item from the collection.
|
||||
*
|
||||
* @param {string} id The ID of the item to remove.
|
||||
*/
|
||||
remove: function( id ) {
|
||||
var value = this.value( id );
|
||||
|
||||
if ( value ) {
|
||||
|
||||
// Trigger event right before the element is removed from the collection.
|
||||
this.trigger( 'remove', value );
|
||||
|
||||
if ( value.extended( api.Value ) ) {
|
||||
value.unbind( this._change );
|
||||
}
|
||||
delete value.parent;
|
||||
}
|
||||
|
||||
delete this._value[ id ];
|
||||
delete this._deferreds[ id ];
|
||||
|
||||
// Trigger removed event after the item has been eliminated from the collection.
|
||||
if ( value ) {
|
||||
this.trigger( 'removed', value );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Runs a callback once all requested values exist.
|
||||
*
|
||||
* when( ids*, [callback] );
|
||||
*
|
||||
* For example:
|
||||
* when( id1, id2, id3, function( value1, value2, value3 ) {} );
|
||||
*
|
||||
* @return $.Deferred.promise();
|
||||
*/
|
||||
when: function() {
|
||||
var self = this,
|
||||
ids = slice.call( arguments ),
|
||||
dfd = $.Deferred();
|
||||
|
||||
// If the last argument is a callback, bind it to .done().
|
||||
if ( typeof ids[ ids.length - 1 ] === 'function' ) {
|
||||
dfd.done( ids.pop() );
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a stack of deferred objects for each item that is not
|
||||
* yet available, and invoke the supplied callback when they are.
|
||||
*/
|
||||
$.when.apply( $, $.map( ids, function( id ) {
|
||||
if ( self.has( id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The requested item is not available yet, create a deferred
|
||||
* object to resolve when it becomes available.
|
||||
*/
|
||||
return self._deferreds[ id ] = self._deferreds[ id ] || $.Deferred();
|
||||
})).done( function() {
|
||||
var values = $.map( ids, function( id ) {
|
||||
return self( id );
|
||||
});
|
||||
|
||||
// If a value is missing, we've used at least one expired deferred.
|
||||
// Call Values.when again to generate a new deferred.
|
||||
if ( values.length !== ids.length ) {
|
||||
// ids.push( callback );
|
||||
self.when.apply( self, ids ).done( function() {
|
||||
dfd.resolveWith( self, values );
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
dfd.resolveWith( self, values );
|
||||
});
|
||||
|
||||
return dfd.promise();
|
||||
},
|
||||
|
||||
/**
|
||||
* A helper function to propagate a 'change' event from an item
|
||||
* to the collection itself.
|
||||
*/
|
||||
_change: function() {
|
||||
this.parent.trigger( 'change', this );
|
||||
}
|
||||
});
|
||||
|
||||
// Create a global events bus on the Customizer.
|
||||
$.extend( api.Values.prototype, api.Events );
|
||||
|
||||
|
||||
/**
|
||||
* Cast a string to a jQuery collection if it isn't already.
|
||||
*
|
||||
* @param {string|jQuery collection} element
|
||||
*/
|
||||
api.ensure = function( element ) {
|
||||
return typeof element === 'string' ? $( element ) : element;
|
||||
};
|
||||
|
||||
/**
|
||||
* An observable value that syncs with an element.
|
||||
*
|
||||
* Handles inputs, selects, and textareas by default.
|
||||
*
|
||||
* @memberOf wp.customize
|
||||
* @alias wp.customize.Element
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.customize.Value
|
||||
* @augments wp.customize.Class
|
||||
*/
|
||||
api.Element = api.Value.extend(/** @lends wp.customize.Element */{
|
||||
initialize: function( element, options ) {
|
||||
var self = this,
|
||||
synchronizer = api.Element.synchronizer.html,
|
||||
type, update, refresh;
|
||||
|
||||
this.element = api.ensure( element );
|
||||
this.events = '';
|
||||
|
||||
if ( this.element.is( 'input, select, textarea' ) ) {
|
||||
type = this.element.prop( 'type' );
|
||||
this.events += ' change input';
|
||||
synchronizer = api.Element.synchronizer.val;
|
||||
|
||||
if ( this.element.is( 'input' ) && api.Element.synchronizer[ type ] ) {
|
||||
synchronizer = api.Element.synchronizer[ type ];
|
||||
}
|
||||
}
|
||||
|
||||
api.Value.prototype.initialize.call( this, null, $.extend( options || {}, synchronizer ) );
|
||||
this._value = this.get();
|
||||
|
||||
update = this.update;
|
||||
refresh = this.refresh;
|
||||
|
||||
this.update = function( to ) {
|
||||
if ( to !== refresh.call( self ) ) {
|
||||
update.apply( this, arguments );
|
||||
}
|
||||
};
|
||||
this.refresh = function() {
|
||||
self.set( refresh.call( self ) );
|
||||
};
|
||||
|
||||
this.bind( this.update );
|
||||
this.element.on( this.events, this.refresh );
|
||||
},
|
||||
|
||||
find: function( selector ) {
|
||||
return $( selector, this.element );
|
||||
},
|
||||
|
||||
refresh: function() {},
|
||||
|
||||
update: function() {}
|
||||
});
|
||||
|
||||
api.Element.synchronizer = {};
|
||||
|
||||
$.each( [ 'html', 'val' ], function( index, method ) {
|
||||
api.Element.synchronizer[ method ] = {
|
||||
update: function( to ) {
|
||||
this.element[ method ]( to );
|
||||
},
|
||||
refresh: function() {
|
||||
return this.element[ method ]();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
api.Element.synchronizer.checkbox = {
|
||||
update: function( to ) {
|
||||
this.element.prop( 'checked', to );
|
||||
},
|
||||
refresh: function() {
|
||||
return this.element.prop( 'checked' );
|
||||
}
|
||||
};
|
||||
|
||||
api.Element.synchronizer.radio = {
|
||||
update: function( to ) {
|
||||
this.element.filter( function() {
|
||||
return this.value === to;
|
||||
}).prop( 'checked', true );
|
||||
},
|
||||
refresh: function() {
|
||||
return this.element.filter( ':checked' ).val();
|
||||
}
|
||||
};
|
||||
|
||||
$.support.postMessage = !! window.postMessage;
|
||||
|
||||
/**
|
||||
* A communicator for sending data from one window to another over postMessage.
|
||||
*
|
||||
* @memberOf wp.customize
|
||||
* @alias wp.customize.Messenger
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.customize.Class
|
||||
* @mixes wp.customize.Events
|
||||
*/
|
||||
api.Messenger = api.Class.extend(/** @lends wp.customize.Messenger.prototype */{
|
||||
/**
|
||||
* Create a new Value.
|
||||
*
|
||||
* @param {string} key Unique identifier.
|
||||
* @param {mixed} initial Initial value.
|
||||
* @param {mixed} options Options hash. Optional.
|
||||
* @return {Value} Class instance of the Value.
|
||||
*/
|
||||
add: function( key, initial, options ) {
|
||||
return this[ key ] = new api.Value( initial, options );
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize Messenger.
|
||||
*
|
||||
* @param {Object} params - Parameters to configure the messenger.
|
||||
* {string} params.url - The URL to communicate with.
|
||||
* {window} params.targetWindow - The window instance to communicate with. Default window.parent.
|
||||
* {string} params.channel - If provided, will send the channel with each message and only accept messages a matching channel.
|
||||
* @param {Object} options - Extend any instance parameter or method with this object.
|
||||
*/
|
||||
initialize: function( params, options ) {
|
||||
// Target the parent frame by default, but only if a parent frame exists.
|
||||
var defaultTarget = window.parent === window ? null : window.parent;
|
||||
|
||||
$.extend( this, options || {} );
|
||||
|
||||
this.add( 'channel', params.channel );
|
||||
this.add( 'url', params.url || '' );
|
||||
this.add( 'origin', this.url() ).link( this.url ).setter( function( to ) {
|
||||
var urlParser = document.createElement( 'a' );
|
||||
urlParser.href = to;
|
||||
// Port stripping needed by IE since it adds to host but not to event.origin.
|
||||
return urlParser.protocol + '//' + urlParser.host.replace( /:(80|443)$/, '' );
|
||||
});
|
||||
|
||||
// First add with no value.
|
||||
this.add( 'targetWindow', null );
|
||||
// This avoids SecurityErrors when setting a window object in x-origin iframe'd scenarios.
|
||||
this.targetWindow.set = function( to ) {
|
||||
var from = this._value;
|
||||
|
||||
to = this._setter.apply( this, arguments );
|
||||
to = this.validate( to );
|
||||
|
||||
if ( null === to || from === to ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this._value = to;
|
||||
this._dirty = true;
|
||||
|
||||
this.callbacks.fireWith( this, [ to, from ] );
|
||||
|
||||
return this;
|
||||
};
|
||||
// Now set it.
|
||||
this.targetWindow( params.targetWindow || defaultTarget );
|
||||
|
||||
|
||||
/*
|
||||
* Since we want jQuery to treat the receive function as unique
|
||||
* to this instance, we give the function a new guid.
|
||||
*
|
||||
* This will prevent every Messenger's receive function from being
|
||||
* unbound when calling $.off( 'message', this.receive );
|
||||
*/
|
||||
this.receive = this.receive.bind( this );
|
||||
this.receive.guid = $.guid++;
|
||||
|
||||
$( window ).on( 'message', this.receive );
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
$( window ).off( 'message', this.receive );
|
||||
},
|
||||
|
||||
/**
|
||||
* Receive data from the other window.
|
||||
*
|
||||
* @param {jQuery.Event} event Event with embedded data.
|
||||
*/
|
||||
receive: function( event ) {
|
||||
var message;
|
||||
|
||||
event = event.originalEvent;
|
||||
|
||||
if ( ! this.targetWindow || ! this.targetWindow() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check to make sure the origin is valid.
|
||||
if ( this.origin() && event.origin !== this.origin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure we have a string that's JSON.parse-able.
|
||||
if ( typeof event.data !== 'string' || event.data[0] !== '{' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
message = JSON.parse( event.data );
|
||||
|
||||
// Check required message properties.
|
||||
if ( ! message || ! message.id || typeof message.data === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if channel names match.
|
||||
if ( ( message.channel || this.channel() ) && this.channel() !== message.channel ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.trigger( message.id, message.data );
|
||||
},
|
||||
|
||||
/**
|
||||
* Send data to the other window.
|
||||
*
|
||||
* @param {string} id The event name.
|
||||
* @param {Object} data Data.
|
||||
*/
|
||||
send: function( id, data ) {
|
||||
var message;
|
||||
|
||||
data = typeof data === 'undefined' ? null : data;
|
||||
|
||||
if ( ! this.url() || ! this.targetWindow() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
message = { id: id, data: data };
|
||||
if ( this.channel() ) {
|
||||
message.channel = this.channel();
|
||||
}
|
||||
|
||||
this.targetWindow().postMessage( JSON.stringify( message ), this.origin() );
|
||||
}
|
||||
});
|
||||
|
||||
// Add the Events mixin to api.Messenger.
|
||||
$.extend( api.Messenger.prototype, api.Events );
|
||||
|
||||
/**
|
||||
* Notification.
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.Class
|
||||
* @since 4.6.0
|
||||
*
|
||||
* @memberOf wp.customize
|
||||
* @alias wp.customize.Notification
|
||||
*
|
||||
* @param {string} code - The error code.
|
||||
* @param {object} params - Params.
|
||||
* @param {string} params.message=null - The error message.
|
||||
* @param {string} [params.type=error] - The notification type.
|
||||
* @param {boolean} [params.fromServer=false] - Whether the notification was server-sent.
|
||||
* @param {string} [params.setting=null] - The setting ID that the notification is related to.
|
||||
* @param {*} [params.data=null] - Any additional data.
|
||||
*/
|
||||
api.Notification = api.Class.extend(/** @lends wp.customize.Notification.prototype */{
|
||||
|
||||
/**
|
||||
* Template function for rendering the notification.
|
||||
*
|
||||
* This will be populated with template option or else it will be populated with template from the ID.
|
||||
*
|
||||
* @since 4.9.0
|
||||
* @var {Function}
|
||||
*/
|
||||
template: null,
|
||||
|
||||
/**
|
||||
* ID for the template to render the notification.
|
||||
*
|
||||
* @since 4.9.0
|
||||
* @var {string}
|
||||
*/
|
||||
templateId: 'customize-notification',
|
||||
|
||||
/**
|
||||
* Additional class names to add to the notification container.
|
||||
*
|
||||
* @since 4.9.0
|
||||
* @var {string}
|
||||
*/
|
||||
containerClasses: '',
|
||||
|
||||
/**
|
||||
* Initialize notification.
|
||||
*
|
||||
* @since 4.9.0
|
||||
*
|
||||
* @param {string} code - Notification code.
|
||||
* @param {Object} params - Notification parameters.
|
||||
* @param {string} params.message - Message.
|
||||
* @param {string} [params.type=error] - Type.
|
||||
* @param {string} [params.setting] - Related setting ID.
|
||||
* @param {Function} [params.template] - Function for rendering template. If not provided, this will come from templateId.
|
||||
* @param {string} [params.templateId] - ID for template to render the notification.
|
||||
* @param {string} [params.containerClasses] - Additional class names to add to the notification container.
|
||||
* @param {boolean} [params.dismissible] - Whether the notification can be dismissed.
|
||||
*/
|
||||
initialize: function( code, params ) {
|
||||
var _params;
|
||||
this.code = code;
|
||||
_params = _.extend(
|
||||
{
|
||||
message: null,
|
||||
type: 'error',
|
||||
fromServer: false,
|
||||
data: null,
|
||||
setting: null,
|
||||
template: null,
|
||||
dismissible: false,
|
||||
containerClasses: ''
|
||||
},
|
||||
params
|
||||
);
|
||||
delete _params.code;
|
||||
_.extend( this, _params );
|
||||
},
|
||||
|
||||
/**
|
||||
* Render the notification.
|
||||
*
|
||||
* @since 4.9.0
|
||||
*
|
||||
* @return {jQuery} Notification container element.
|
||||
*/
|
||||
render: function() {
|
||||
var notification = this, container, data;
|
||||
if ( ! notification.template ) {
|
||||
notification.template = wp.template( notification.templateId );
|
||||
}
|
||||
data = _.extend( {}, notification, {
|
||||
alt: notification.parent && notification.parent.alt
|
||||
} );
|
||||
container = $( notification.template( data ) );
|
||||
|
||||
if ( notification.dismissible ) {
|
||||
container.find( '.notice-dismiss' ).on( 'click keydown', function( event ) {
|
||||
if ( 'keydown' === event.type && 13 !== event.which ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( notification.parent ) {
|
||||
notification.parent.remove( notification.code );
|
||||
} else {
|
||||
container.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
});
|
||||
|
||||
// The main API object is also a collection of all customizer settings.
|
||||
api = $.extend( new api.Values(), api );
|
||||
|
||||
/**
|
||||
* Get all customize settings.
|
||||
*
|
||||
* @alias wp.customize.get
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
api.get = function() {
|
||||
var result = {};
|
||||
|
||||
this.each( function( obj, key ) {
|
||||
result[ key ] = obj.get();
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Utility function namespace
|
||||
*
|
||||
* @namespace wp.customize.utils
|
||||
*/
|
||||
api.utils = {};
|
||||
|
||||
/**
|
||||
* Parse query string.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access public
|
||||
*
|
||||
* @alias wp.customize.utils.parseQueryString
|
||||
*
|
||||
* @param {string} queryString Query string.
|
||||
* @return {Object} Parsed query string.
|
||||
*/
|
||||
api.utils.parseQueryString = function parseQueryString( queryString ) {
|
||||
var queryParams = {};
|
||||
_.each( queryString.split( '&' ), function( pair ) {
|
||||
var parts, key, value;
|
||||
parts = pair.split( '=', 2 );
|
||||
if ( ! parts[0] ) {
|
||||
return;
|
||||
}
|
||||
key = decodeURIComponent( parts[0].replace( /\+/g, ' ' ) );
|
||||
key = key.replace( / /g, '_' ); // What PHP does.
|
||||
if ( _.isUndefined( parts[1] ) ) {
|
||||
value = null;
|
||||
} else {
|
||||
value = decodeURIComponent( parts[1].replace( /\+/g, ' ' ) );
|
||||
}
|
||||
queryParams[ key ] = value;
|
||||
} );
|
||||
return queryParams;
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose the API publicly on window.wp.customize
|
||||
*
|
||||
* @namespace wp.customize
|
||||
*/
|
||||
exports.customize = api;
|
||||
})( wp, jQuery );
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
window.wp=window.wp||{},function(t,a){var o={},s=Array.prototype.slice,r=function(){},n=function(t,e,n){var i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return t.apply(this,arguments)};return a.extend(i,t),r.prototype=t.prototype,i.prototype=new r,e&&a.extend(i.prototype,e),n&&a.extend(i,n),(i.prototype.constructor=i).__super__=t.prototype,i};o.Class=function(t,e,n){var i,s=arguments;return t&&e&&o.Class.applicator===t&&(s=e,a.extend(this,n||{})),(i=this).instance&&(i=function(){return i.instance.apply(i,arguments)},a.extend(i,this)),i.initialize.apply(i,s),i},o.Class.extend=function(t,e){t=n(this,t,e);return t.extend=this.extend,t},o.Class.applicator={},o.Class.prototype.initialize=function(){},o.Class.prototype.extended=function(t){for(var e=this;void 0!==e.constructor;){if(e.constructor===t)return!0;if(void 0===e.constructor.__super__)return!1;e=e.constructor.__super__}return!1},o.Events={trigger:function(t){return this.topics&&this.topics[t]&&this.topics[t].fireWith(this,s.call(arguments,1)),this},bind:function(t){return this.topics=this.topics||{},this.topics[t]=this.topics[t]||a.Callbacks(),this.topics[t].add.apply(this.topics[t],s.call(arguments,1)),this},unbind:function(t){return this.topics&&this.topics[t]&&this.topics[t].remove.apply(this.topics[t],s.call(arguments,1)),this}},o.Value=o.Class.extend({initialize:function(t,e){this._value=t,this.callbacks=a.Callbacks(),this._dirty=!1,a.extend(this,e||{}),this.set=this.set.bind(this)},instance:function(){return arguments.length?this.set.apply(this,arguments):this.get()},get:function(){return this._value},set:function(t){var e=this._value;return t=this._setter.apply(this,arguments),null===(t=this.validate(t))||_.isEqual(e,t)||(this._value=t,this._dirty=!0,this.callbacks.fireWith(this,[t,e])),this},_setter:function(t){return t},setter:function(t){var e=this.get();return this._setter=t,this._value=null,this.set(e),this},resetSetter:function(){return this._setter=this.constructor.prototype._setter,this.set(this.get()),this},validate:function(t){return t},bind:function(){return this.callbacks.add.apply(this.callbacks,arguments),this},unbind:function(){return this.callbacks.remove.apply(this.callbacks,arguments),this},link:function(){var t=this.set;return a.each(arguments,function(){this.bind(t)}),this},unlink:function(){var t=this.set;return a.each(arguments,function(){this.unbind(t)}),this},sync:function(){var t=this;return a.each(arguments,function(){t.link(this),this.link(t)}),this},unsync:function(){var t=this;return a.each(arguments,function(){t.unlink(this),this.unlink(t)}),this}}),o.Values=o.Class.extend({defaultConstructor:o.Value,initialize:function(t){a.extend(this,t||{}),this._value={},this._deferreds={}},instance:function(t){return 1===arguments.length?this.value(t):this.when.apply(this,arguments)},value:function(t){return this._value[t]},has:function(t){return void 0!==this._value[t]},add:function(t,e){var n,i,s=this;if("string"==typeof t)n=t,i=e;else{if("string"!=typeof t.id)throw new Error("Unknown key");n=t.id,i=t}return s.has(n)?s.value(n):((s._value[n]=i).parent=s,i.extended(o.Value)&&i.bind(s._change),s.trigger("add",i),s._deferreds[n]&&s._deferreds[n].resolve(),s._value[n])},create:function(t){return this.add(t,new this.defaultConstructor(o.Class.applicator,s.call(arguments,1)))},each:function(n,i){i=void 0===i?this:i,a.each(this._value,function(t,e){n.call(i,e,t)})},remove:function(t){var e=this.value(t);e&&(this.trigger("remove",e),e.extended(o.Value)&&e.unbind(this._change),delete e.parent),delete this._value[t],delete this._deferreds[t],e&&this.trigger("removed",e)},when:function(){var e=this,n=s.call(arguments),i=a.Deferred();return"function"==typeof n[n.length-1]&&i.done(n.pop()),a.when.apply(a,a.map(n,function(t){if(!e.has(t))return e._deferreds[t]=e._deferreds[t]||a.Deferred()})).done(function(){var t=a.map(n,function(t){return e(t)});t.length!==n.length?e.when.apply(e,n).done(function(){i.resolveWith(e,t)}):i.resolveWith(e,t)}),i.promise()},_change:function(){this.parent.trigger("change",this)}}),a.extend(o.Values.prototype,o.Events),o.ensure=function(t){return"string"==typeof t?a(t):t},o.Element=o.Value.extend({initialize:function(t,e){var n,i,s=this,r=o.Element.synchronizer.html;this.element=o.ensure(t),this.events="",this.element.is("input, select, textarea")&&(t=this.element.prop("type"),this.events+=" change input",r=o.Element.synchronizer.val,this.element.is("input"))&&o.Element.synchronizer[t]&&(r=o.Element.synchronizer[t]),o.Value.prototype.initialize.call(this,null,a.extend(e||{},r)),this._value=this.get(),n=this.update,i=this.refresh,this.update=function(t){t!==i.call(s)&&n.apply(this,arguments)},this.refresh=function(){s.set(i.call(s))},this.bind(this.update),this.element.on(this.events,this.refresh)},find:function(t){return a(t,this.element)},refresh:function(){},update:function(){}}),o.Element.synchronizer={},a.each(["html","val"],function(t,e){o.Element.synchronizer[e]={update:function(t){this.elLine truncated
|
||||
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
* @output wp-includes/js/customize-loader.js
|
||||
*/
|
||||
|
||||
/* global _wpCustomizeLoaderSettings */
|
||||
|
||||
/**
|
||||
* Expose a public API that allows the customizer to be
|
||||
* loaded on any page.
|
||||
*
|
||||
* @namespace wp
|
||||
*/
|
||||
window.wp = window.wp || {};
|
||||
|
||||
(function( exports, $ ){
|
||||
var api = wp.customize,
|
||||
Loader;
|
||||
|
||||
$.extend( $.support, {
|
||||
history: !! ( window.history && history.pushState ),
|
||||
hashchange: ('onhashchange' in window) && (document.documentMode === undefined || document.documentMode > 7)
|
||||
});
|
||||
|
||||
/**
|
||||
* Allows the Customizer to be overlaid on any page.
|
||||
*
|
||||
* By default, any element in the body with the load-customize class will open
|
||||
* an iframe overlay with the URL specified.
|
||||
*
|
||||
* e.g. <a class="load-customize" href="<?php echo wp_customize_url(); ?>">Open Customizer</a>
|
||||
*
|
||||
* @memberOf wp.customize
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.Events
|
||||
*/
|
||||
Loader = $.extend( {}, api.Events,/** @lends wp.customize.Loader.prototype */{
|
||||
/**
|
||||
* Setup the Loader; triggered on document#ready.
|
||||
*/
|
||||
initialize: function() {
|
||||
this.body = $( document.body );
|
||||
|
||||
// Ensure the loader is supported.
|
||||
// Check for settings, postMessage support, and whether we require CORS support.
|
||||
if ( ! Loader.settings || ! $.support.postMessage || ( ! $.support.cors && Loader.settings.isCrossDomain ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.window = $( window );
|
||||
this.element = $( '<div id="customize-container" />' ).appendTo( this.body );
|
||||
|
||||
// Bind events for opening and closing the overlay.
|
||||
this.bind( 'open', this.overlay.show );
|
||||
this.bind( 'close', this.overlay.hide );
|
||||
|
||||
// Any element in the body with the `load-customize` class opens
|
||||
// the Customizer.
|
||||
$('#wpbody').on( 'click', '.load-customize', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
// Store a reference to the link that opened the Customizer.
|
||||
Loader.link = $(this);
|
||||
// Load the theme.
|
||||
Loader.open( Loader.link.attr('href') );
|
||||
});
|
||||
|
||||
// Add navigation listeners.
|
||||
if ( $.support.history ) {
|
||||
this.window.on( 'popstate', Loader.popstate );
|
||||
}
|
||||
|
||||
if ( $.support.hashchange ) {
|
||||
this.window.on( 'hashchange', Loader.hashchange );
|
||||
this.window.triggerHandler( 'hashchange' );
|
||||
}
|
||||
},
|
||||
|
||||
popstate: function( e ) {
|
||||
var state = e.originalEvent.state;
|
||||
if ( state && state.customize ) {
|
||||
Loader.open( state.customize );
|
||||
} else if ( Loader.active ) {
|
||||
Loader.close();
|
||||
}
|
||||
},
|
||||
|
||||
hashchange: function() {
|
||||
var hash = window.location.toString().split('#')[1];
|
||||
|
||||
if ( hash && 0 === hash.indexOf( 'wp_customize=on' ) ) {
|
||||
Loader.open( Loader.settings.url + '?' + hash );
|
||||
}
|
||||
|
||||
if ( ! hash && ! $.support.history ) {
|
||||
Loader.close();
|
||||
}
|
||||
},
|
||||
|
||||
beforeunload: function () {
|
||||
if ( ! Loader.saved() ) {
|
||||
return Loader.settings.l10n.saveAlert;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the Customizer overlay for a specific URL.
|
||||
*
|
||||
* @param string src URL to load in the Customizer.
|
||||
*/
|
||||
open: function( src ) {
|
||||
|
||||
if ( this.active ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the full page on mobile devices.
|
||||
if ( Loader.settings.browser.mobile ) {
|
||||
return window.location = src;
|
||||
}
|
||||
|
||||
// Store the document title prior to opening the Live Preview.
|
||||
this.originalDocumentTitle = document.title;
|
||||
|
||||
this.active = true;
|
||||
this.body.addClass('customize-loading');
|
||||
|
||||
/*
|
||||
* Track the dirtiness state (whether the drafted changes have been published)
|
||||
* of the Customizer in the iframe. This is used to decide whether to display
|
||||
* an AYS alert if the user tries to close the window before saving changes.
|
||||
*/
|
||||
this.saved = new api.Value( true );
|
||||
|
||||
this.iframe = $( '<iframe />', { 'src': src, 'title': Loader.settings.l10n.mainIframeTitle } ).appendTo( this.element );
|
||||
this.iframe.one( 'load', this.loaded );
|
||||
|
||||
// Create a postMessage connection with the iframe.
|
||||
this.messenger = new api.Messenger({
|
||||
url: src,
|
||||
channel: 'loader',
|
||||
targetWindow: this.iframe[0].contentWindow
|
||||
});
|
||||
|
||||
// Expose the changeset UUID on the parent window's URL so that the customized state can survive a refresh.
|
||||
if ( history.replaceState ) {
|
||||
this.messenger.bind( 'changeset-uuid', function( changesetUuid ) {
|
||||
var urlParser = document.createElement( 'a' );
|
||||
urlParser.href = location.href;
|
||||
urlParser.search = $.param( _.extend(
|
||||
api.utils.parseQueryString( urlParser.search.substr( 1 ) ),
|
||||
{ changeset_uuid: changesetUuid }
|
||||
) );
|
||||
history.replaceState( { customize: urlParser.href }, '', urlParser.href );
|
||||
} );
|
||||
}
|
||||
|
||||
// Wait for the connection from the iframe before sending any postMessage events.
|
||||
this.messenger.bind( 'ready', function() {
|
||||
Loader.messenger.send( 'back' );
|
||||
});
|
||||
|
||||
this.messenger.bind( 'close', function() {
|
||||
if ( $.support.history ) {
|
||||
history.back();
|
||||
} else if ( $.support.hashchange ) {
|
||||
window.location.hash = '';
|
||||
} else {
|
||||
Loader.close();
|
||||
}
|
||||
});
|
||||
|
||||
// Prompt AYS dialog when navigating away.
|
||||
$( window ).on( 'beforeunload', this.beforeunload );
|
||||
|
||||
this.messenger.bind( 'saved', function () {
|
||||
Loader.saved( true );
|
||||
} );
|
||||
this.messenger.bind( 'change', function () {
|
||||
Loader.saved( false );
|
||||
} );
|
||||
|
||||
this.messenger.bind( 'title', function( newTitle ){
|
||||
window.document.title = newTitle;
|
||||
});
|
||||
|
||||
this.pushState( src );
|
||||
|
||||
this.trigger( 'open' );
|
||||
},
|
||||
|
||||
pushState: function ( src ) {
|
||||
var hash = src.split( '?' )[1];
|
||||
|
||||
// Ensure we don't call pushState if the user hit the forward button.
|
||||
if ( $.support.history && window.location.href !== src ) {
|
||||
history.pushState( { customize: src }, '', src );
|
||||
} else if ( ! $.support.history && $.support.hashchange && hash ) {
|
||||
window.location.hash = 'wp_customize=on&' + hash;
|
||||
}
|
||||
|
||||
this.trigger( 'open' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback after the Customizer has been opened.
|
||||
*/
|
||||
opened: function() {
|
||||
Loader.body.addClass( 'customize-active full-overlay-active' ).attr( 'aria-busy', 'true' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Close the Customizer overlay.
|
||||
*/
|
||||
close: function() {
|
||||
var self = this, onConfirmClose;
|
||||
if ( ! self.active ) {
|
||||
return;
|
||||
}
|
||||
|
||||
onConfirmClose = function( confirmed ) {
|
||||
if ( confirmed ) {
|
||||
self.active = false;
|
||||
self.trigger( 'close' );
|
||||
|
||||
// Restore document title prior to opening the Live Preview.
|
||||
if ( self.originalDocumentTitle ) {
|
||||
document.title = self.originalDocumentTitle;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Go forward since Customizer is exited by history.back().
|
||||
history.forward();
|
||||
}
|
||||
self.messenger.unbind( 'confirmed-close', onConfirmClose );
|
||||
};
|
||||
self.messenger.bind( 'confirmed-close', onConfirmClose );
|
||||
|
||||
Loader.messenger.send( 'confirm-close' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback after the Customizer has been closed.
|
||||
*/
|
||||
closed: function() {
|
||||
Loader.iframe.remove();
|
||||
Loader.messenger.destroy();
|
||||
Loader.iframe = null;
|
||||
Loader.messenger = null;
|
||||
Loader.saved = null;
|
||||
Loader.body.removeClass( 'customize-active full-overlay-active' ).removeClass( 'customize-loading' );
|
||||
$( window ).off( 'beforeunload', Loader.beforeunload );
|
||||
/*
|
||||
* Return focus to the link that opened the Customizer overlay after
|
||||
* the body element visibility is restored.
|
||||
*/
|
||||
if ( Loader.link ) {
|
||||
Loader.link.focus();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback for the `load` event on the Customizer iframe.
|
||||
*/
|
||||
loaded: function() {
|
||||
Loader.body.removeClass( 'customize-loading' ).attr( 'aria-busy', 'false' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Overlay hide/show utility methods.
|
||||
*/
|
||||
overlay: {
|
||||
show: function() {
|
||||
this.element.fadeIn( 200, Loader.opened );
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.element.fadeOut( 200, Loader.closed );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Bootstrap the Loader on document#ready.
|
||||
$( function() {
|
||||
Loader.settings = _wpCustomizeLoaderSettings;
|
||||
Loader.initialize();
|
||||
});
|
||||
|
||||
// Expose the API publicly on window.wp.customize.Loader.
|
||||
api.Loader = Loader;
|
||||
})( wp, jQuery );
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
window.wp=window.wp||{},function(i){var n,o=wp.customize;i.extend(i.support,{history:!(!window.history||!history.pushState),hashchange:"onhashchange"in window&&(void 0===document.documentMode||7<document.documentMode)}),n=i.extend({},o.Events,{initialize:function(){this.body=i(document.body),n.settings&&i.support.postMessage&&(i.support.cors||!n.settings.isCrossDomain)&&(this.window=i(window),this.element=i('<div id="customize-container" />').appendTo(this.body),this.bind("open",this.overlay.show),this.bind("close",this.overlay.hide),i("#wpbody").on("click",".load-customize",function(e){e.preventDefault(),n.link=i(this),n.open(n.link.attr("href"))}),i.support.history&&this.window.on("popstate",n.popstate),i.support.hashchange)&&(this.window.on("hashchange",n.hashchange),this.window.triggerHandler("hashchange"))},popstate:function(e){e=e.originalEvent.state;e&&e.customize?n.open(e.customize):n.active&&n.close()},hashchange:function(){var e=window.location.toString().split("#")[1];e&&0===e.indexOf("wp_customize=on")&&n.open(n.settings.url+"?"+e),e||i.support.history||n.close()},beforeunload:function(){if(!n.saved())return n.settings.l10n.saveAlert},open:function(e){if(!this.active){if(n.settings.browser.mobile)return window.location=e;this.originalDocumentTitle=document.title,this.active=!0,this.body.addClass("customize-loading"),this.saved=new o.Value(!0),this.iframe=i("<iframe />",{src:e,title:n.settings.l10n.mainIframeTitle}).appendTo(this.element),this.iframe.one("load",this.loaded),this.messenger=new o.Messenger({url:e,channel:"loader",targetWindow:this.iframe[0].contentWindow}),history.replaceState&&this.messenger.bind("changeset-uuid",function(e){var t=document.createElement("a");t.href=location.href,t.search=i.param(_.extend(o.utils.parseQueryString(t.search.substr(1)),{changeset_uuid:e})),history.replaceState({customize:t.href},"",t.href)}),this.messenger.bind("ready",function(){n.messenger.send("back")}),this.messenger.bind("close",function(){i.support.history?history.back():i.support.hashchange?window.location.hash="":n.close()}),i(window).on("beforeunload",this.beforeunload),this.messenger.bind("saved",function(){n.saved(!0)}),this.messenger.bind("change",function(){n.saved(!1)}),this.messenger.bind("title",function(e){window.document.title=e}),this.pushState(e),this.trigger("open")}},pushState:function(e){var t=e.split("?")[1];i.support.history&&window.location.href!==e?history.pushState({customize:e},"",e):!i.support.history&&i.support.hashchange&&t&&(window.location.hash="wp_customize=on&"+t),this.trigger("open")},opened:function(){n.body.addClass("customize-active full-overlay-active").attr("aria-busy","true")},close:function(){var t,i=this;i.active&&(i.messenger.bind("confirmed-close",t=function(e){e?(i.active=!1,i.trigger("close"),i.originalDocumentTitle&&(document.title=i.originalDocumentTitle)):history.forward(),i.messenger.unbind("confirmed-close",t)}),n.messenger.send("confirm-close"))},closed:function(){n.iframe.remove(),n.messenger.destroy(),n.iframe=null,n.messenger=null,n.saved=null,n.body.removeClass("customize-active full-overlay-active").removeClass("customize-loading"),i(window).off("beforeunload",n.beforeunload),n.link&&n.link.focus()},loaded:function(){n.body.removeClass("customize-loading").attr("aria-busy","false")},overlay:{show:function(){this.element.fadeIn(200,n.opened)},hide:function(){this.element.fadeOut(200,n.closed)}}}),i(function(){n.settings=_wpCustomizeLoaderSettings,n.initialize()}),o.Loader=n}((wp,jQuery));
|
||||
@@ -0,0 +1,281 @@
|
||||
/**
|
||||
* @output wp-includes/js/customize-models.js
|
||||
*/
|
||||
|
||||
/* global _wpCustomizeHeader */
|
||||
(function( $, wp ) {
|
||||
var api = wp.customize;
|
||||
/** @namespace wp.customize.HeaderTool */
|
||||
api.HeaderTool = {};
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ImageModel
|
||||
*
|
||||
* A header image. This is where saves via the Customizer API are
|
||||
* abstracted away, plus our own Ajax calls to add images to and remove
|
||||
* images from the user's recently uploaded images setting on the server.
|
||||
* These calls are made regardless of whether the user actually saves new
|
||||
* Customizer settings.
|
||||
*
|
||||
* @memberOf wp.customize.HeaderTool
|
||||
* @alias wp.customize.HeaderTool.ImageModel
|
||||
*
|
||||
* @constructor
|
||||
* @augments Backbone.Model
|
||||
*/
|
||||
api.HeaderTool.ImageModel = Backbone.Model.extend(/** @lends wp.customize.HeaderTool.ImageModel.prototype */{
|
||||
defaults: function() {
|
||||
return {
|
||||
header: {
|
||||
attachment_id: 0,
|
||||
url: '',
|
||||
timestamp: _.now(),
|
||||
thumbnail_url: ''
|
||||
},
|
||||
choice: '',
|
||||
selected: false,
|
||||
random: false
|
||||
};
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
this.on('hide', this.hide, this);
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.set('choice', '');
|
||||
api('header_image').set('remove-header');
|
||||
api('header_image_data').set('remove-header');
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
var data = this.get('header'),
|
||||
curr = api.HeaderTool.currentHeader.get('header').attachment_id;
|
||||
|
||||
// If the image we're removing is also the current header,
|
||||
// unset the latter.
|
||||
if (curr && data.attachment_id === curr) {
|
||||
api.HeaderTool.currentHeader.trigger('hide');
|
||||
}
|
||||
|
||||
wp.ajax.post( 'custom-header-remove', {
|
||||
nonce: _wpCustomizeHeader.nonces.remove,
|
||||
wp_customize: 'on',
|
||||
theme: api.settings.theme.stylesheet,
|
||||
attachment_id: data.attachment_id
|
||||
});
|
||||
|
||||
this.trigger('destroy', this, this.collection);
|
||||
},
|
||||
|
||||
save: function() {
|
||||
if (this.get('random')) {
|
||||
api('header_image').set(this.get('header').random);
|
||||
api('header_image_data').set(this.get('header').random);
|
||||
} else {
|
||||
if (this.get('header').defaultName) {
|
||||
api('header_image').set(this.get('header').url);
|
||||
api('header_image_data').set(this.get('header').defaultName);
|
||||
} else {
|
||||
api('header_image').set(this.get('header').url);
|
||||
api('header_image_data').set(this.get('header'));
|
||||
}
|
||||
}
|
||||
|
||||
api.HeaderTool.combinedList.trigger('control:setImage', this);
|
||||
},
|
||||
|
||||
importImage: function() {
|
||||
var data = this.get('header');
|
||||
if (data.attachment_id === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp.ajax.post( 'custom-header-add', {
|
||||
nonce: _wpCustomizeHeader.nonces.add,
|
||||
wp_customize: 'on',
|
||||
theme: api.settings.theme.stylesheet,
|
||||
attachment_id: data.attachment_id
|
||||
} );
|
||||
},
|
||||
|
||||
shouldBeCropped: function() {
|
||||
if (this.get('themeFlexWidth') === true &&
|
||||
this.get('themeFlexHeight') === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('themeFlexWidth') === true &&
|
||||
this.get('themeHeight') === this.get('imageHeight')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('themeFlexHeight') === true &&
|
||||
this.get('themeWidth') === this.get('imageWidth')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('themeWidth') === this.get('imageWidth') &&
|
||||
this.get('themeHeight') === this.get('imageHeight')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.get('imageWidth') <= this.get('themeWidth')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ChoiceList
|
||||
*
|
||||
* @memberOf wp.customize.HeaderTool
|
||||
* @alias wp.customize.HeaderTool.ChoiceList
|
||||
*
|
||||
* @constructor
|
||||
* @augments Backbone.Collection
|
||||
*/
|
||||
api.HeaderTool.ChoiceList = Backbone.Collection.extend({
|
||||
model: api.HeaderTool.ImageModel,
|
||||
|
||||
// Ordered from most recently used to least.
|
||||
comparator: function(model) {
|
||||
return -model.get('header').timestamp;
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
var current = api.HeaderTool.currentHeader.get('choice').replace(/^https?:\/\//, ''),
|
||||
isRandom = this.isRandomChoice(api.get().header_image);
|
||||
|
||||
// Overridable by an extending class.
|
||||
if (!this.type) {
|
||||
this.type = 'uploaded';
|
||||
}
|
||||
|
||||
// Overridable by an extending class.
|
||||
if (typeof this.data === 'undefined') {
|
||||
this.data = _wpCustomizeHeader.uploads;
|
||||
}
|
||||
|
||||
if (isRandom) {
|
||||
// So that when adding data we don't hide regular images.
|
||||
current = api.get().header_image;
|
||||
}
|
||||
|
||||
this.on('control:setImage', this.setImage, this);
|
||||
this.on('control:removeImage', this.removeImage, this);
|
||||
this.on('add', this.maybeRemoveOldCrop, this);
|
||||
this.on('add', this.maybeAddRandomChoice, this);
|
||||
|
||||
_.each(this.data, function(elt, index) {
|
||||
if (!elt.attachment_id) {
|
||||
elt.defaultName = index;
|
||||
}
|
||||
|
||||
if (typeof elt.timestamp === 'undefined') {
|
||||
elt.timestamp = 0;
|
||||
}
|
||||
|
||||
this.add({
|
||||
header: elt,
|
||||
choice: elt.url.split('/').pop(),
|
||||
selected: current === elt.url.replace(/^https?:\/\//, '')
|
||||
}, { silent: true });
|
||||
}, this);
|
||||
|
||||
if (this.size() > 0) {
|
||||
this.addRandomChoice(current);
|
||||
}
|
||||
},
|
||||
|
||||
maybeRemoveOldCrop: function( model ) {
|
||||
var newID = model.get( 'header' ).attachment_id || false,
|
||||
oldCrop;
|
||||
|
||||
// Bail early if we don't have a new attachment ID.
|
||||
if ( ! newID ) {
|
||||
return;
|
||||
}
|
||||
|
||||
oldCrop = this.find( function( item ) {
|
||||
return ( item.cid !== model.cid && item.get( 'header' ).attachment_id === newID );
|
||||
} );
|
||||
|
||||
// If we found an old crop, remove it from the collection.
|
||||
if ( oldCrop ) {
|
||||
this.remove( oldCrop );
|
||||
}
|
||||
},
|
||||
|
||||
maybeAddRandomChoice: function() {
|
||||
if (this.size() === 1) {
|
||||
this.addRandomChoice();
|
||||
}
|
||||
},
|
||||
|
||||
addRandomChoice: function(initialChoice) {
|
||||
var isRandomSameType = RegExp(this.type).test(initialChoice),
|
||||
randomChoice = 'random-' + this.type + '-image';
|
||||
|
||||
this.add({
|
||||
header: {
|
||||
timestamp: 0,
|
||||
random: randomChoice,
|
||||
width: 245,
|
||||
height: 41
|
||||
},
|
||||
choice: randomChoice,
|
||||
random: true,
|
||||
selected: isRandomSameType
|
||||
});
|
||||
},
|
||||
|
||||
isRandomChoice: function(choice) {
|
||||
return (/^random-(uploaded|default)-image$/).test(choice);
|
||||
},
|
||||
|
||||
shouldHideTitle: function() {
|
||||
return this.size() < 2;
|
||||
},
|
||||
|
||||
setImage: function(model) {
|
||||
this.each(function(m) {
|
||||
m.set('selected', false);
|
||||
});
|
||||
|
||||
if (model) {
|
||||
model.set('selected', true);
|
||||
}
|
||||
},
|
||||
|
||||
removeImage: function() {
|
||||
this.each(function(m) {
|
||||
m.set('selected', false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.DefaultsList
|
||||
*
|
||||
* @memberOf wp.customize.HeaderTool
|
||||
* @alias wp.customize.HeaderTool.DefaultsList
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.customize.HeaderTool.ChoiceList
|
||||
* @augments Backbone.Collection
|
||||
*/
|
||||
api.HeaderTool.DefaultsList = api.HeaderTool.ChoiceList.extend({
|
||||
initialize: function() {
|
||||
this.type = 'default';
|
||||
this.data = _wpCustomizeHeader.defaults;
|
||||
api.HeaderTool.ChoiceList.prototype.initialize.apply(this);
|
||||
}
|
||||
});
|
||||
|
||||
})( jQuery, window.wp );
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(i){var a=i.customize;a.HeaderTool={},a.HeaderTool.ImageModel=Backbone.Model.extend({defaults:function(){return{header:{attachment_id:0,url:"",timestamp:_.now(),thumbnail_url:""},choice:"",selected:!1,random:!1}},initialize:function(){this.on("hide",this.hide,this)},hide:function(){this.set("choice",""),a("header_image").set("remove-header"),a("header_image_data").set("remove-header")},destroy:function(){var e=this.get("header"),t=a.HeaderTool.currentHeader.get("header").attachment_id;t&&e.attachment_id===t&&a.HeaderTool.currentHeader.trigger("hide"),i.ajax.post("custom-header-remove",{nonce:_wpCustomizeHeader.nonces.remove,wp_customize:"on",theme:a.settings.theme.stylesheet,attachment_id:e.attachment_id}),this.trigger("destroy",this,this.collection)},save:function(){this.get("random")?(a("header_image").set(this.get("header").random),a("header_image_data").set(this.get("header").random)):this.get("header").defaultName?(a("header_image").set(this.get("header").url),a("header_image_data").set(this.get("header").defaultName)):(a("header_image").set(this.get("header").url),a("header_image_data").set(this.get("header"))),a.HeaderTool.combinedList.trigger("control:setImage",this)},importImage:function(){var e=this.get("header");void 0!==e.attachment_id&&i.ajax.post("custom-header-add",{nonce:_wpCustomizeHeader.nonces.add,wp_customize:"on",theme:a.settings.theme.stylesheet,attachment_id:e.attachment_id})},shouldBeCropped:function(){return(!0!==this.get("themeFlexWidth")||!0!==this.get("themeFlexHeight"))&&!(!0===this.get("themeFlexWidth")&&this.get("themeHeight")===this.get("imageHeight")||!0===this.get("themeFlexHeight")&&this.get("themeWidth")===this.get("imageWidth")||this.get("themeWidth")===this.get("imageWidth")&&this.get("themeHeight")===this.get("imageHeight")||this.get("imageWidth")<=this.get("themeWidth"))}}),a.HeaderTool.ChoiceList=Backbone.Collection.extend({model:a.HeaderTool.ImageModel,comparator:function(e){return-e.get("header").timestamp},initialize:function(){var i=a.HeaderTool.currentHeader.get("choice").replace(/^https?:\/\//,""),e=this.isRandomChoice(a.get().header_image);this.type||(this.type="uploaded"),void 0===this.data&&(this.data=_wpCustomizeHeader.uploads),e&&(i=a.get().header_image),this.on("control:setImage",this.setImage,this),this.on("control:removeImage",this.removeImage,this),this.on("add",this.maybeRemoveOldCrop,this),this.on("add",this.maybeAddRandomChoice,this),_.each(this.data,function(e,t){e.attachment_id||(e.defaultName=t),void 0===e.timestamp&&(e.timestamp=0),this.add({header:e,choice:e.url.split("/").pop(),selected:i===e.url.replace(/^https?:\/\//,"")},{silent:!0})},this),0<this.size()&&this.addRandomChoice(i)},maybeRemoveOldCrop:function(t){var e,i=t.get("header").attachment_id||!1;i&&(e=this.find(function(e){return e.cid!==t.cid&&e.get("header").attachment_id===i}))&&this.remove(e)},maybeAddRandomChoice:function(){1===this.size()&&this.addRandomChoice()},addRandomChoice:function(e){var e=RegExp(this.type).test(e),t="random-"+this.type+"-image";this.add({header:{timestamp:0,random:t,width:245,height:41},choice:t,random:!0,selected:e})},isRandomChoice:function(e){return/^random-(uploaded|default)-image$/.test(e)},shouldHideTitle:function(){return this.size()<2},setImage:function(e){this.each(function(e){e.set("selected",!1)}),e&&e.set("selected",!0)},removeImage:function(){this.each(function(e){e.set("selected",!1)})}}),a.HeaderTool.DefaultsList=a.HeaderTool.ChoiceList.extend({initialize:function(){this.type="default",this.data=_wpCustomizeHeader.defaults,a.HeaderTool.ChoiceList.prototype.initialize.apply(this)}})}((jQuery,window.wp));
|
||||
@@ -0,0 +1,446 @@
|
||||
/**
|
||||
* @output wp-includes/js/customize-preview-nav-menus.js
|
||||
*/
|
||||
|
||||
/* global _wpCustomizePreviewNavMenusExports */
|
||||
|
||||
/** @namespace wp.customize.navMenusPreview */
|
||||
wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function( $, _, wp, api ) {
|
||||
'use strict';
|
||||
|
||||
var self = {
|
||||
data: {
|
||||
navMenuInstanceArgs: {}
|
||||
}
|
||||
};
|
||||
if ( 'undefined' !== typeof _wpCustomizePreviewNavMenusExports ) {
|
||||
_.extend( self.data, _wpCustomizePreviewNavMenusExports );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize nav menus preview.
|
||||
*/
|
||||
self.init = function() {
|
||||
var self = this, synced = false;
|
||||
|
||||
/*
|
||||
* Keep track of whether we synced to determine whether or not bindSettingListener
|
||||
* should also initially fire the listener. This initial firing needs to wait until
|
||||
* after all of the settings have been synced from the pane in order to prevent
|
||||
* an infinite selective fallback-refresh. Note that this sync handler will be
|
||||
* added after the sync handler in customize-preview.js, so it will be triggered
|
||||
* after all of the settings are added.
|
||||
*/
|
||||
api.preview.bind( 'sync', function() {
|
||||
synced = true;
|
||||
} );
|
||||
|
||||
if ( api.selectiveRefresh ) {
|
||||
// Listen for changes to settings related to nav menus.
|
||||
api.each( function( setting ) {
|
||||
self.bindSettingListener( setting );
|
||||
} );
|
||||
api.bind( 'add', function( setting ) {
|
||||
|
||||
/*
|
||||
* Handle case where an invalid nav menu item (one for which its associated object has been deleted)
|
||||
* is synced from the controls into the preview. Since invalid nav menu items are filtered out from
|
||||
* being exported to the frontend by the _is_valid_nav_menu_item filter in wp_get_nav_menu_items(),
|
||||
* the customizer controls will have a nav_menu_item setting where the preview will have none, and
|
||||
* this can trigger an infinite fallback refresh when the nav menu item lacks any valid items.
|
||||
*/
|
||||
if ( setting.get() && ! setting.get()._invalid ) {
|
||||
self.bindSettingListener( setting, { fire: synced } );
|
||||
}
|
||||
} );
|
||||
api.bind( 'remove', function( setting ) {
|
||||
self.unbindSettingListener( setting );
|
||||
} );
|
||||
|
||||
/*
|
||||
* Ensure that wp_nav_menu() instances nested inside of other partials
|
||||
* will be recognized as being present on the page.
|
||||
*/
|
||||
api.selectiveRefresh.bind( 'render-partials-response', function( response ) {
|
||||
if ( response.nav_menu_instance_args ) {
|
||||
_.extend( self.data.navMenuInstanceArgs, response.nav_menu_instance_args );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
api.preview.bind( 'active', function() {
|
||||
self.highlightControls();
|
||||
} );
|
||||
};
|
||||
|
||||
if ( api.selectiveRefresh ) {
|
||||
|
||||
/**
|
||||
* Partial representing an invocation of wp_nav_menu().
|
||||
*
|
||||
* @memberOf wp.customize.navMenusPreview
|
||||
* @alias wp.customize.navMenusPreview.NavMenuInstancePartial
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.selectiveRefresh.Partial
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.NavMenuInstancePartial = api.selectiveRefresh.Partial.extend(/** @lends wp.customize.navMenusPreview.NavMenuInstancePartial.prototype */{
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @param {string} id - Partial ID.
|
||||
* @param {Object} options
|
||||
* @param {Object} options.params
|
||||
* @param {Object} options.params.navMenuArgs
|
||||
* @param {string} options.params.navMenuArgs.args_hmac
|
||||
* @param {string} [options.params.navMenuArgs.theme_location]
|
||||
* @param {number} [options.params.navMenuArgs.menu]
|
||||
* @param {Object} [options.constructingContainerContext]
|
||||
*/
|
||||
initialize: function( id, options ) {
|
||||
var partial = this, matches, argsHmac;
|
||||
matches = id.match( /^nav_menu_instance\[([0-9a-f]{32})]$/ );
|
||||
if ( ! matches ) {
|
||||
throw new Error( 'Illegal id for nav_menu_instance partial. The key corresponds with the args HMAC.' );
|
||||
}
|
||||
argsHmac = matches[1];
|
||||
|
||||
options = options || {};
|
||||
options.params = _.extend(
|
||||
{
|
||||
selector: '[data-customize-partial-id="' + id + '"]',
|
||||
navMenuArgs: options.constructingContainerContext || {},
|
||||
containerInclusive: true
|
||||
},
|
||||
options.params || {}
|
||||
);
|
||||
api.selectiveRefresh.Partial.prototype.initialize.call( partial, id, options );
|
||||
|
||||
if ( ! _.isObject( partial.params.navMenuArgs ) ) {
|
||||
throw new Error( 'Missing navMenuArgs' );
|
||||
}
|
||||
if ( partial.params.navMenuArgs.args_hmac !== argsHmac ) {
|
||||
throw new Error( 'args_hmac mismatch with id' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Return whether the setting is related to this partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
* @param {wp.customize.Value|string} setting - Object or ID.
|
||||
* @param {number|Object|false|null} newValue - New value, or null if the setting was just removed.
|
||||
* @param {number|Object|false|null} oldValue - Old value, or null if the setting was just added.
|
||||
* @return {boolean}
|
||||
*/
|
||||
isRelatedSetting: function( setting, newValue, oldValue ) {
|
||||
var partial = this, navMenuLocationSetting, navMenuId, isNavMenuItemSetting, _newValue, _oldValue, urlParser;
|
||||
if ( _.isString( setting ) ) {
|
||||
setting = api( setting );
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent nav_menu_item changes only containing type_label differences triggering a refresh.
|
||||
* These settings in the preview do not include type_label property, and so if one of these
|
||||
* nav_menu_item settings is dirty, after a refresh the nav menu instance would do a selective
|
||||
* refresh immediately because the setting from the pane would have the type_label whereas
|
||||
* the setting in the preview would not, thus triggering a change event. The following
|
||||
* condition short-circuits this unnecessary selective refresh and also prevents an infinite
|
||||
* loop in the case where a nav_menu_instance partial had done a fallback refresh.
|
||||
* @todo Nav menu item settings should not include a type_label property to begin with.
|
||||
*/
|
||||
isNavMenuItemSetting = /^nav_menu_item\[/.test( setting.id );
|
||||
if ( isNavMenuItemSetting && _.isObject( newValue ) && _.isObject( oldValue ) ) {
|
||||
_newValue = _.clone( newValue );
|
||||
_oldValue = _.clone( oldValue );
|
||||
delete _newValue.type_label;
|
||||
delete _oldValue.type_label;
|
||||
|
||||
// Normalize URL scheme when parent frame is HTTPS to prevent selective refresh upon initial page load.
|
||||
if ( 'https' === api.preview.scheme.get() ) {
|
||||
urlParser = document.createElement( 'a' );
|
||||
urlParser.href = _newValue.url;
|
||||
urlParser.protocol = 'https:';
|
||||
_newValue.url = urlParser.href;
|
||||
urlParser.href = _oldValue.url;
|
||||
urlParser.protocol = 'https:';
|
||||
_oldValue.url = urlParser.href;
|
||||
}
|
||||
|
||||
// Prevent original_title differences from causing refreshes if title is present.
|
||||
if ( newValue.title ) {
|
||||
delete _oldValue.original_title;
|
||||
delete _newValue.original_title;
|
||||
}
|
||||
|
||||
if ( _.isEqual( _oldValue, _newValue ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( partial.params.navMenuArgs.theme_location ) {
|
||||
if ( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' === setting.id ) {
|
||||
return true;
|
||||
}
|
||||
navMenuLocationSetting = api( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' );
|
||||
}
|
||||
|
||||
navMenuId = partial.params.navMenuArgs.menu;
|
||||
if ( ! navMenuId && navMenuLocationSetting ) {
|
||||
navMenuId = navMenuLocationSetting();
|
||||
}
|
||||
|
||||
if ( ! navMenuId ) {
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
( 'nav_menu[' + navMenuId + ']' === setting.id ) ||
|
||||
( isNavMenuItemSetting && (
|
||||
( newValue && newValue.nav_menu_term_id === navMenuId ) ||
|
||||
( oldValue && oldValue.nav_menu_term_id === navMenuId )
|
||||
) )
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Make sure that partial fallback behavior is invoked if there is no associated menu.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
refresh: function() {
|
||||
var partial = this, menuId, deferred = $.Deferred();
|
||||
|
||||
// Make sure the fallback behavior is invoked when the partial is no longer associated with a menu.
|
||||
if ( _.isNumber( partial.params.navMenuArgs.menu ) ) {
|
||||
menuId = partial.params.navMenuArgs.menu;
|
||||
} else if ( partial.params.navMenuArgs.theme_location && api.has( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' ) ) {
|
||||
menuId = api( 'nav_menu_locations[' + partial.params.navMenuArgs.theme_location + ']' ).get();
|
||||
}
|
||||
if ( ! menuId ) {
|
||||
partial.fallback();
|
||||
deferred.reject();
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
return api.selectiveRefresh.Partial.prototype.refresh.call( partial );
|
||||
},
|
||||
|
||||
/**
|
||||
* Render content.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @param {wp.customize.selectiveRefresh.Placement} placement
|
||||
*/
|
||||
renderContent: function( placement ) {
|
||||
var partial = this, previousContainer = placement.container;
|
||||
|
||||
// Do fallback behavior to refresh preview if menu is now empty.
|
||||
if ( '' === placement.addedContent ) {
|
||||
placement.partial.fallback();
|
||||
}
|
||||
|
||||
if ( api.selectiveRefresh.Partial.prototype.renderContent.call( partial, placement ) ) {
|
||||
|
||||
// Trigger deprecated event.
|
||||
$( document ).trigger( 'customize-preview-menu-refreshed', [ {
|
||||
instanceNumber: null, // @deprecated
|
||||
wpNavArgs: placement.context, // @deprecated
|
||||
wpNavMenuArgs: placement.context,
|
||||
oldContainer: previousContainer,
|
||||
newContainer: placement.container
|
||||
} ] );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
api.selectiveRefresh.partialConstructor.nav_menu_instance = self.NavMenuInstancePartial;
|
||||
|
||||
/**
|
||||
* Request full refresh if there are nav menu instances that lack partials which also match the supplied args.
|
||||
*
|
||||
* @param {Object} navMenuInstanceArgs
|
||||
*/
|
||||
self.handleUnplacedNavMenuInstances = function( navMenuInstanceArgs ) {
|
||||
var unplacedNavMenuInstances;
|
||||
unplacedNavMenuInstances = _.filter( _.values( self.data.navMenuInstanceArgs ), function( args ) {
|
||||
return ! api.selectiveRefresh.partial.has( 'nav_menu_instance[' + args.args_hmac + ']' );
|
||||
} );
|
||||
if ( _.findWhere( unplacedNavMenuInstances, navMenuInstanceArgs ) ) {
|
||||
api.selectiveRefresh.requestFullRefresh();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add change listener for a nav_menu[], nav_menu_item[], or nav_menu_locations[] setting.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {wp.customize.Value} setting
|
||||
* @param {Object} [options]
|
||||
* @param {boolean} options.fire Whether to invoke the callback after binding.
|
||||
* This is used when a dynamic setting is added.
|
||||
* @return {boolean} Whether the setting was bound.
|
||||
*/
|
||||
self.bindSettingListener = function( setting, options ) {
|
||||
var matches;
|
||||
options = options || {};
|
||||
|
||||
matches = setting.id.match( /^nav_menu\[(-?\d+)]$/ );
|
||||
if ( matches ) {
|
||||
setting._navMenuId = parseInt( matches[1], 10 );
|
||||
setting.bind( this.onChangeNavMenuSetting );
|
||||
if ( options.fire ) {
|
||||
this.onChangeNavMenuSetting.call( setting, setting(), false );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
matches = setting.id.match( /^nav_menu_item\[(-?\d+)]$/ );
|
||||
if ( matches ) {
|
||||
setting._navMenuItemId = parseInt( matches[1], 10 );
|
||||
setting.bind( this.onChangeNavMenuItemSetting );
|
||||
if ( options.fire ) {
|
||||
this.onChangeNavMenuItemSetting.call( setting, setting(), false );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
matches = setting.id.match( /^nav_menu_locations\[(.+?)]/ );
|
||||
if ( matches ) {
|
||||
setting._navMenuThemeLocation = matches[1];
|
||||
setting.bind( this.onChangeNavMenuLocationsSetting );
|
||||
if ( options.fire ) {
|
||||
this.onChangeNavMenuLocationsSetting.call( setting, setting(), false );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove change listeners for nav_menu[], nav_menu_item[], or nav_menu_locations[] setting.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {wp.customize.Value} setting
|
||||
*/
|
||||
self.unbindSettingListener = function( setting ) {
|
||||
setting.unbind( this.onChangeNavMenuSetting );
|
||||
setting.unbind( this.onChangeNavMenuItemSetting );
|
||||
setting.unbind( this.onChangeNavMenuLocationsSetting );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle change for nav_menu[] setting for nav menu instances lacking partials.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @this {wp.customize.Value}
|
||||
*/
|
||||
self.onChangeNavMenuSetting = function() {
|
||||
var setting = this;
|
||||
|
||||
self.handleUnplacedNavMenuInstances( {
|
||||
menu: setting._navMenuId
|
||||
} );
|
||||
|
||||
// Ensure all nav menu instances with a theme_location assigned to this menu are handled.
|
||||
api.each( function( otherSetting ) {
|
||||
if ( ! otherSetting._navMenuThemeLocation ) {
|
||||
return;
|
||||
}
|
||||
if ( setting._navMenuId === otherSetting() ) {
|
||||
self.handleUnplacedNavMenuInstances( {
|
||||
theme_location: otherSetting._navMenuThemeLocation
|
||||
} );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle change for nav_menu_item[] setting for nav menu instances lacking partials.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {Object} newItem New value for nav_menu_item[] setting.
|
||||
* @param {Object} oldItem Old value for nav_menu_item[] setting.
|
||||
* @this {wp.customize.Value}
|
||||
*/
|
||||
self.onChangeNavMenuItemSetting = function( newItem, oldItem ) {
|
||||
var item = newItem || oldItem, navMenuSetting;
|
||||
navMenuSetting = api( 'nav_menu[' + String( item.nav_menu_term_id ) + ']' );
|
||||
if ( navMenuSetting ) {
|
||||
self.onChangeNavMenuSetting.call( navMenuSetting );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle change for nav_menu_locations[] setting for nav menu instances lacking partials.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @this {wp.customize.Value}
|
||||
*/
|
||||
self.onChangeNavMenuLocationsSetting = function() {
|
||||
var setting = this, hasNavMenuInstance;
|
||||
self.handleUnplacedNavMenuInstances( {
|
||||
theme_location: setting._navMenuThemeLocation
|
||||
} );
|
||||
|
||||
// If there are no wp_nav_menu() instances that refer to the theme location, do full refresh.
|
||||
hasNavMenuInstance = !! _.findWhere( _.values( self.data.navMenuInstanceArgs ), {
|
||||
theme_location: setting._navMenuThemeLocation
|
||||
} );
|
||||
if ( ! hasNavMenuInstance ) {
|
||||
api.selectiveRefresh.requestFullRefresh();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect nav menu items with their corresponding controls in the pane.
|
||||
*
|
||||
* Setup shift-click on nav menu items which are more granular than the nav menu partial itself.
|
||||
* Also this applies even if a nav menu is not partial-refreshable.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
self.highlightControls = function() {
|
||||
var selector = '.menu-item';
|
||||
|
||||
// Skip adding highlights if not in the customizer preview iframe.
|
||||
if ( ! api.settings.channel ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Focus on the menu item control when shift+clicking the menu item.
|
||||
$( document ).on( 'click', selector, function( e ) {
|
||||
var navMenuItemParts;
|
||||
if ( ! e.shiftKey ) {
|
||||
return;
|
||||
}
|
||||
|
||||
navMenuItemParts = $( this ).attr( 'class' ).match( /(?:^|\s)menu-item-(-?\d+)(?:\s|$)/ );
|
||||
if ( navMenuItemParts ) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation(); // Make sure a sub-nav menu item will get focused instead of parent items.
|
||||
api.preview.send( 'focus-nav-menu-item-control', parseInt( navMenuItemParts[1], 10 ) );
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
api.bind( 'preview-ready', function() {
|
||||
self.init();
|
||||
} );
|
||||
|
||||
return self;
|
||||
|
||||
}( jQuery, _, wp, wp.customize ) );
|
||||
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
wp.customize.navMenusPreview=wp.customize.MenusCustomizerPreview=function(a,c,l){"use strict";var t={data:{navMenuInstanceArgs:{}}};return"undefined"!=typeof _wpCustomizePreviewNavMenusExports&&c.extend(t.data,_wpCustomizePreviewNavMenusExports),t.init=function(){var n=this,t=!1;l.preview.bind("sync",function(){t=!0}),l.selectiveRefresh&&(l.each(function(e){n.bindSettingListener(e)}),l.bind("add",function(e){e.get()&&!e.get()._invalid&&n.bindSettingListener(e,{fire:t})}),l.bind("remove",function(e){n.unbindSettingListener(e)}),l.selectiveRefresh.bind("render-partials-response",function(e){e.nav_menu_instance_args&&c.extend(n.data.navMenuInstanceArgs,e.nav_menu_instance_args)})),l.preview.bind("active",function(){n.highlightControls()})},l.selectiveRefresh&&(t.NavMenuInstancePartial=l.selectiveRefresh.Partial.extend({initialize:function(e,n){var t=this,a=e.match(/^nav_menu_instance\[([0-9a-f]{32})]$/);if(!a)throw new Error("Illegal id for nav_menu_instance partial. The key corresponds with the args HMAC.");if(a=a[1],(n=n||{}).params=c.extend({selector:'[data-customize-partial-id="'+e+'"]',navMenuArgs:n.constructingContainerContext||{},containerInclusive:!0},n.params||{}),l.selectiveRefresh.Partial.prototype.initialize.call(t,e,n),!c.isObject(t.params.navMenuArgs))throw new Error("Missing navMenuArgs");if(t.params.navMenuArgs.args_hmac!==a)throw new Error("args_hmac mismatch with id")},isRelatedSetting:function(e,n,t){var a,i,r,s,o,u=this;if(c.isString(e)&&(e=l(e)),(i=/^nav_menu_item\[/.test(e.id))&&c.isObject(n)&&c.isObject(t)&&(r=c.clone(n),s=c.clone(t),delete r.type_label,delete s.type_label,"https"===l.preview.scheme.get()&&((o=document.createElement("a")).href=r.url,o.protocol="https:",r.url=o.href,o.href=s.url,o.protocol="https:",s.url=o.href),n.title&&(delete s.original_title,delete r.original_title),c.isEqual(s,r)))return!1;if(u.params.navMenuArgs.theme_location){if("nav_menu_locations["+u.params.navMenuArgs.theme_location+"]"===e.id)return!0;a=l("nav_menu_locations["+u.params.navMenuArgs.theme_location+"]")}return!!(o=!(o=u.params.navMenuArgs.menu)&&a?a():o)&&("nav_menu["+o+"]"===e.id||i&&(n&&n.nav_menu_term_id===o||t&&t.nav_menu_term_id===o))},refresh:function(){var e,n=this,t=a.Deferred();return c.isNumber(n.params.navMenuArgs.menu)?e=n.params.navMenuArgs.menu:n.params.navMenuArgs.theme_location&&l.has("nav_menu_locations["+n.params.navMenuArgs.theme_location+"]")&&(e=l("nav_menu_locations["+n.params.navMenuArgs.theme_location+"]").get()),e?l.selectiveRefresh.Partial.prototype.refresh.call(n):(n.fallback(),t.reject(),t.promise())},renderContent:function(e){var n=e.container;""===e.addedContent&&e.partial.fallback(),l.selectiveRefresh.Partial.prototype.renderContent.call(this,e)&&a(document).trigger("customize-preview-menu-refreshed",[{instanceNumber:null,wpNavArgs:e.context,wpNavMenuArgs:e.context,oldContainer:n,newContainer:e.container}])}}),l.selectiveRefresh.partialConstructor.nav_menu_instance=t.NavMenuInstancePartial,t.handleUnplacedNavMenuInstances=function(e){var n=c.filter(c.values(t.data.navMenuInstanceArgs),function(e){return!l.selectiveRefresh.partial.has("nav_menu_instance["+e.args_hmac+"]")});return!!c.findWhere(n,e)&&(l.selectiveRefresh.requestFullRefresh(),!0)},t.bindSettingListener=function(e,n){var t;return n=n||{},(t=e.id.match(/^nav_menu\[(-?\d+)]$/))?(e._navMenuId=parseInt(t[1],10),e.bind(this.onChangeNavMenuSetting),n.fire&&this.onChangeNavMenuSetting.call(e,e(),!1),!0):(t=e.id.match(/^nav_menu_item\[(-?\d+)]$/))?(e._navMenuItemId=parseInt(t[1],10),e.bind(this.onChangeNavMenuItemSetting),n.fire&&this.onChangeNavMenuItemSetting.call(e,e(),!1),!0):!!(t=e.id.match(/^nav_menu_locations\[(.+?)]/))&&(e._navMenuThemeLocation=t[1],e.bind(this.onChangeNavMenuLocationsSetting),n.fire&&this.onChangeNavMenuLocationsSetting.call(e,e(),!1),!0)},t.unbindSettingListener=function(e){e.unbind(this.onChangeNavMenuSetting),e.unbind(this.onChangeNavMenuItemSetting),e.unbind(this.onChangeNavMenuLocationsSetting)},t.onChangeNavMenuSetting=function(){var n=this;t.handleUnplacedNavMenuInstances({menu:n._navMenuId}),l.each(function(e){e._navMenuThemeLocation&&n._navMenuId===e()&&t.handleUnplacedNavMenuInstances({theme_location:e._navMenuThemeLocation})})},t.onChangeNavMenuItemSetting=function(e,n){e=l("nav_menu["+String((e||n).nav_menu_term_id)+"]");e&&t.onChangeNavMenuSetting.call(e)},t.onChangeNavMenuLocationsSetting=function(){t.handleUnplacedNavMenuInstances({theme_location:this._navMenuThemeLocation}),!c.findWhere(c.values(t.data.navMenuInstanceArgs),{theme_location:this._navMenuThemeLocation})&&l.selectiveRefresh.requestFullRefresh()}),t.highlightControls=function(){l.settings.channel&&a(document).on("click",".menu-item",function(e){var n;e.shiftKey&&(n=a(this).attr("class").match(/(?:^|\s)menu-item-(-?\d+)(?:\s|$)/))&&(e.preventDefault(),e.stopPropagation(),l.preview.send("focus-nav-menu-item-control",parseInt(n[1],10)))})},l.bind("preview-ready",function(){t.init()}),t}(jQuery,_,wp.customize);
|
||||
@@ -0,0 +1,773 @@
|
||||
/**
|
||||
* @output wp-includes/js/customize-preview-widgets.js
|
||||
*/
|
||||
|
||||
/* global _wpWidgetCustomizerPreviewSettings */
|
||||
|
||||
/**
|
||||
* Handles the initialization, refreshing and rendering of widget partials and sidebar widgets.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @namespace wp.customize.widgetsPreview
|
||||
*
|
||||
* @param {jQuery} $ The jQuery object.
|
||||
* @param {Object} _ The utilities library.
|
||||
* @param {Object} wp Current WordPress environment instance.
|
||||
* @param {Object} api Information from the API.
|
||||
*
|
||||
* @return {Object} Widget-related variables.
|
||||
*/
|
||||
wp.customize.widgetsPreview = wp.customize.WidgetCustomizerPreview = (function( $, _, wp, api ) {
|
||||
|
||||
var self;
|
||||
|
||||
self = {
|
||||
renderedSidebars: {},
|
||||
renderedWidgets: {},
|
||||
registeredSidebars: [],
|
||||
registeredWidgets: {},
|
||||
widgetSelectors: [],
|
||||
preview: null,
|
||||
l10n: {
|
||||
widgetTooltip: ''
|
||||
},
|
||||
selectiveRefreshableWidgets: {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the widgets preview.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
self.init = function() {
|
||||
var self = this;
|
||||
|
||||
self.preview = api.preview;
|
||||
if ( ! _.isEmpty( self.selectiveRefreshableWidgets ) ) {
|
||||
self.addPartials();
|
||||
}
|
||||
|
||||
self.buildWidgetSelectors();
|
||||
self.highlightControls();
|
||||
|
||||
self.preview.bind( 'highlight-widget', self.highlightWidget );
|
||||
|
||||
api.preview.bind( 'active', function() {
|
||||
self.highlightControls();
|
||||
} );
|
||||
|
||||
/*
|
||||
* Refresh a partial when the controls pane requests it. This is used currently just by the
|
||||
* Gallery widget so that when an attachment's caption is updated in the media modal,
|
||||
* the widget in the preview will then be refreshed to show the change. Normally doing this
|
||||
* would not be necessary because all of the state should be contained inside the changeset,
|
||||
* as everything done in the Customizer should not make a change to the site unless the
|
||||
* changeset itself is published. Attachments are a current exception to this rule.
|
||||
* For a proposal to include attachments in the customized state, see #37887.
|
||||
*/
|
||||
api.preview.bind( 'refresh-widget-partial', function( widgetId ) {
|
||||
var partialId = 'widget[' + widgetId + ']';
|
||||
if ( api.selectiveRefresh.partial.has( partialId ) ) {
|
||||
api.selectiveRefresh.partial( partialId ).refresh();
|
||||
} else if ( self.renderedWidgets[ widgetId ] ) {
|
||||
api.preview.send( 'refresh' ); // Fallback in case theme does not support 'customize-selective-refresh-widgets'.
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
self.WidgetPartial = api.selectiveRefresh.Partial.extend(/** @lends wp.customize.widgetsPreview.WidgetPartial.prototype */{
|
||||
|
||||
/**
|
||||
* Represents a partial widget instance.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @constructs
|
||||
* @augments wp.customize.selectiveRefresh.Partial
|
||||
*
|
||||
* @alias wp.customize.widgetsPreview.WidgetPartial
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @param {string} id The partial's ID.
|
||||
* @param {Object} options Options used to initialize the partial's
|
||||
* instance.
|
||||
* @param {Object} options.params The options parameters.
|
||||
*/
|
||||
initialize: function( id, options ) {
|
||||
var partial = this, matches;
|
||||
matches = id.match( /^widget\[(.+)]$/ );
|
||||
if ( ! matches ) {
|
||||
throw new Error( 'Illegal id for widget partial.' );
|
||||
}
|
||||
|
||||
partial.widgetId = matches[1];
|
||||
partial.widgetIdParts = self.parseWidgetId( partial.widgetId );
|
||||
options = options || {};
|
||||
options.params = _.extend(
|
||||
{
|
||||
settings: [ self.getWidgetSettingId( partial.widgetId ) ],
|
||||
containerInclusive: true
|
||||
},
|
||||
options.params || {}
|
||||
);
|
||||
|
||||
api.selectiveRefresh.Partial.prototype.initialize.call( partial, id, options );
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes the widget partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Promise|void} Either a promise postponing the refresh, or void.
|
||||
*/
|
||||
refresh: function() {
|
||||
var partial = this, refreshDeferred;
|
||||
if ( ! self.selectiveRefreshableWidgets[ partial.widgetIdParts.idBase ] ) {
|
||||
refreshDeferred = $.Deferred();
|
||||
refreshDeferred.reject();
|
||||
partial.fallback();
|
||||
return refreshDeferred.promise();
|
||||
} else {
|
||||
return api.selectiveRefresh.Partial.prototype.refresh.call( partial );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sends the widget-updated message to the parent so the spinner will get
|
||||
* removed from the widget control.
|
||||
*
|
||||
* @inheritDoc
|
||||
* @param {wp.customize.selectiveRefresh.Placement} placement The placement
|
||||
* function.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
renderContent: function( placement ) {
|
||||
var partial = this;
|
||||
if ( api.selectiveRefresh.Partial.prototype.renderContent.call( partial, placement ) ) {
|
||||
api.preview.send( 'widget-updated', partial.widgetId );
|
||||
api.selectiveRefresh.trigger( 'widget-updated', partial );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.SidebarPartial = api.selectiveRefresh.Partial.extend(/** @lends wp.customize.widgetsPreview.SidebarPartial.prototype */{
|
||||
|
||||
/**
|
||||
* Represents a partial widget area.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.selectiveRefresh.Partial
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
* @alias wp.customize.widgetsPreview.SidebarPartial
|
||||
*
|
||||
* @param {string} id The partial's ID.
|
||||
* @param {Object} options Options used to initialize the partial's instance.
|
||||
* @param {Object} options.params The options parameters.
|
||||
*/
|
||||
initialize: function( id, options ) {
|
||||
var partial = this, matches;
|
||||
matches = id.match( /^sidebar\[(.+)]$/ );
|
||||
if ( ! matches ) {
|
||||
throw new Error( 'Illegal id for sidebar partial.' );
|
||||
}
|
||||
partial.sidebarId = matches[1];
|
||||
|
||||
options = options || {};
|
||||
options.params = _.extend(
|
||||
{
|
||||
settings: [ 'sidebars_widgets[' + partial.sidebarId + ']' ]
|
||||
},
|
||||
options.params || {}
|
||||
);
|
||||
|
||||
api.selectiveRefresh.Partial.prototype.initialize.call( partial, id, options );
|
||||
|
||||
if ( ! partial.params.sidebarArgs ) {
|
||||
throw new Error( 'The sidebarArgs param was not provided.' );
|
||||
}
|
||||
if ( partial.params.settings.length > 1 ) {
|
||||
throw new Error( 'Expected SidebarPartial to only have one associated setting' );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets up the partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
ready: function() {
|
||||
var sidebarPartial = this;
|
||||
|
||||
// Watch for changes to the sidebar_widgets setting.
|
||||
_.each( sidebarPartial.settings(), function( settingId ) {
|
||||
api( settingId ).bind( _.bind( sidebarPartial.handleSettingChange, sidebarPartial ) );
|
||||
} );
|
||||
|
||||
// Trigger an event for this sidebar being updated whenever a widget inside is rendered.
|
||||
api.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) {
|
||||
var isAssignedWidgetPartial = (
|
||||
placement.partial.extended( self.WidgetPartial ) &&
|
||||
( -1 !== _.indexOf( sidebarPartial.getWidgetIds(), placement.partial.widgetId ) )
|
||||
);
|
||||
if ( isAssignedWidgetPartial ) {
|
||||
api.selectiveRefresh.trigger( 'sidebar-updated', sidebarPartial );
|
||||
}
|
||||
} );
|
||||
|
||||
// Make sure that a widget partial has a container in the DOM prior to a refresh.
|
||||
api.bind( 'change', function( widgetSetting ) {
|
||||
var widgetId, parsedId;
|
||||
parsedId = self.parseWidgetSettingId( widgetSetting.id );
|
||||
if ( ! parsedId ) {
|
||||
return;
|
||||
}
|
||||
widgetId = parsedId.idBase;
|
||||
if ( parsedId.number ) {
|
||||
widgetId += '-' + String( parsedId.number );
|
||||
}
|
||||
if ( -1 !== _.indexOf( sidebarPartial.getWidgetIds(), widgetId ) ) {
|
||||
sidebarPartial.ensureWidgetPlacementContainers( widgetId );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the before/after boundary nodes for all instances of this sidebar
|
||||
* (usually one).
|
||||
*
|
||||
* Note that TreeWalker is not implemented in IE8.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Array.<{before: Comment, after: Comment, instanceNumber: number}>}
|
||||
* An array with an object for each sidebar instance, containing the
|
||||
* node before and after the sidebar instance and its instance number.
|
||||
*/
|
||||
findDynamicSidebarBoundaryNodes: function() {
|
||||
var partial = this, regExp, boundaryNodes = {}, recursiveCommentTraversal;
|
||||
regExp = /^(dynamic_sidebar_before|dynamic_sidebar_after):(.+):(\d+)$/;
|
||||
recursiveCommentTraversal = function( childNodes ) {
|
||||
_.each( childNodes, function( node ) {
|
||||
var matches;
|
||||
if ( 8 === node.nodeType ) {
|
||||
matches = node.nodeValue.match( regExp );
|
||||
if ( ! matches || matches[2] !== partial.sidebarId ) {
|
||||
return;
|
||||
}
|
||||
if ( _.isUndefined( boundaryNodes[ matches[3] ] ) ) {
|
||||
boundaryNodes[ matches[3] ] = {
|
||||
before: null,
|
||||
after: null,
|
||||
instanceNumber: parseInt( matches[3], 10 )
|
||||
};
|
||||
}
|
||||
if ( 'dynamic_sidebar_before' === matches[1] ) {
|
||||
boundaryNodes[ matches[3] ].before = node;
|
||||
} else {
|
||||
boundaryNodes[ matches[3] ].after = node;
|
||||
}
|
||||
} else if ( 1 === node.nodeType ) {
|
||||
recursiveCommentTraversal( node.childNodes );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
recursiveCommentTraversal( document.body.childNodes );
|
||||
return _.values( boundaryNodes );
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the placements for this partial.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Array} An array containing placement objects for each of the
|
||||
* dynamic sidebar boundary nodes.
|
||||
*/
|
||||
placements: function() {
|
||||
var partial = this;
|
||||
return _.map( partial.findDynamicSidebarBoundaryNodes(), function( boundaryNodes ) {
|
||||
return new api.selectiveRefresh.Placement( {
|
||||
partial: partial,
|
||||
container: null,
|
||||
startNode: boundaryNodes.before,
|
||||
endNode: boundaryNodes.after,
|
||||
context: {
|
||||
instanceNumber: boundaryNodes.instanceNumber
|
||||
}
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the list of widget IDs associated with this widget area.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @throws {Error} If there's no settingId.
|
||||
* @throws {Error} If the setting doesn't exist in the API.
|
||||
* @throws {Error} If the API doesn't pass an array of widget IDs.
|
||||
*
|
||||
* @return {Array} A shallow copy of the array containing widget IDs.
|
||||
*/
|
||||
getWidgetIds: function() {
|
||||
var sidebarPartial = this, settingId, widgetIds;
|
||||
settingId = sidebarPartial.settings()[0];
|
||||
if ( ! settingId ) {
|
||||
throw new Error( 'Missing associated setting.' );
|
||||
}
|
||||
if ( ! api.has( settingId ) ) {
|
||||
throw new Error( 'Setting does not exist.' );
|
||||
}
|
||||
widgetIds = api( settingId ).get();
|
||||
if ( ! _.isArray( widgetIds ) ) {
|
||||
throw new Error( 'Expected setting to be array of widget IDs' );
|
||||
}
|
||||
return widgetIds.slice( 0 );
|
||||
},
|
||||
|
||||
/**
|
||||
* Reflows widgets in the sidebar, ensuring they have the proper position in the
|
||||
* DOM.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Array.<wp.customize.selectiveRefresh.Placement>} List of placements
|
||||
* that were reflowed.
|
||||
*/
|
||||
reflowWidgets: function() {
|
||||
var sidebarPartial = this, sidebarPlacements, widgetIds, widgetPartials, sortedSidebarContainers = [];
|
||||
widgetIds = sidebarPartial.getWidgetIds();
|
||||
sidebarPlacements = sidebarPartial.placements();
|
||||
|
||||
widgetPartials = {};
|
||||
_.each( widgetIds, function( widgetId ) {
|
||||
var widgetPartial = api.selectiveRefresh.partial( 'widget[' + widgetId + ']' );
|
||||
if ( widgetPartial ) {
|
||||
widgetPartials[ widgetId ] = widgetPartial;
|
||||
}
|
||||
} );
|
||||
|
||||
_.each( sidebarPlacements, function( sidebarPlacement ) {
|
||||
var sidebarWidgets = [], needsSort = false, thisPosition, lastPosition = -1;
|
||||
|
||||
// Gather list of widget partial containers in this sidebar, and determine if a sort is needed.
|
||||
_.each( widgetPartials, function( widgetPartial ) {
|
||||
_.each( widgetPartial.placements(), function( widgetPlacement ) {
|
||||
|
||||
if ( sidebarPlacement.context.instanceNumber === widgetPlacement.context.sidebar_instance_number ) {
|
||||
thisPosition = widgetPlacement.container.index();
|
||||
sidebarWidgets.push( {
|
||||
partial: widgetPartial,
|
||||
placement: widgetPlacement,
|
||||
position: thisPosition
|
||||
} );
|
||||
if ( thisPosition < lastPosition ) {
|
||||
needsSort = true;
|
||||
}
|
||||
lastPosition = thisPosition;
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
if ( needsSort ) {
|
||||
_.each( sidebarWidgets, function( sidebarWidget ) {
|
||||
sidebarPlacement.endNode.parentNode.insertBefore(
|
||||
sidebarWidget.placement.container[0],
|
||||
sidebarPlacement.endNode
|
||||
);
|
||||
|
||||
// @todo Rename partial-placement-moved?
|
||||
api.selectiveRefresh.trigger( 'partial-content-moved', sidebarWidget.placement );
|
||||
} );
|
||||
|
||||
sortedSidebarContainers.push( sidebarPlacement );
|
||||
}
|
||||
} );
|
||||
|
||||
if ( sortedSidebarContainers.length > 0 ) {
|
||||
api.selectiveRefresh.trigger( 'sidebar-updated', sidebarPartial );
|
||||
}
|
||||
|
||||
return sortedSidebarContainers;
|
||||
},
|
||||
|
||||
/**
|
||||
* Makes sure there is a widget instance container in this sidebar for the given
|
||||
* widget ID.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} widgetId The widget ID.
|
||||
*
|
||||
* @return {wp.customize.selectiveRefresh.Partial} The widget instance partial.
|
||||
*/
|
||||
ensureWidgetPlacementContainers: function( widgetId ) {
|
||||
var sidebarPartial = this, widgetPartial, wasInserted = false, partialId = 'widget[' + widgetId + ']';
|
||||
widgetPartial = api.selectiveRefresh.partial( partialId );
|
||||
if ( ! widgetPartial ) {
|
||||
widgetPartial = new self.WidgetPartial( partialId, {
|
||||
params: {}
|
||||
} );
|
||||
}
|
||||
|
||||
// Make sure that there is a container element for the widget in the sidebar, if at least a placeholder.
|
||||
_.each( sidebarPartial.placements(), function( sidebarPlacement ) {
|
||||
var foundWidgetPlacement, widgetContainerElement;
|
||||
|
||||
foundWidgetPlacement = _.find( widgetPartial.placements(), function( widgetPlacement ) {
|
||||
return ( widgetPlacement.context.sidebar_instance_number === sidebarPlacement.context.instanceNumber );
|
||||
} );
|
||||
if ( foundWidgetPlacement ) {
|
||||
return;
|
||||
}
|
||||
|
||||
widgetContainerElement = $(
|
||||
sidebarPartial.params.sidebarArgs.before_widget.replace( /%1\$s/g, widgetId ).replace( /%2\$s/g, 'widget' ) +
|
||||
sidebarPartial.params.sidebarArgs.after_widget
|
||||
);
|
||||
|
||||
// Handle rare case where before_widget and after_widget are empty.
|
||||
if ( ! widgetContainerElement[0] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
widgetContainerElement.attr( 'data-customize-partial-id', widgetPartial.id );
|
||||
widgetContainerElement.attr( 'data-customize-partial-type', 'widget' );
|
||||
widgetContainerElement.attr( 'data-customize-widget-id', widgetId );
|
||||
|
||||
/*
|
||||
* Make sure the widget container element has the customize-container context data.
|
||||
* The sidebar_instance_number is used to disambiguate multiple instances of the
|
||||
* same sidebar are rendered onto the template, and so the same widget is embedded
|
||||
* multiple times.
|
||||
*/
|
||||
widgetContainerElement.data( 'customize-partial-placement-context', {
|
||||
'sidebar_id': sidebarPartial.sidebarId,
|
||||
'sidebar_instance_number': sidebarPlacement.context.instanceNumber
|
||||
} );
|
||||
|
||||
sidebarPlacement.endNode.parentNode.insertBefore( widgetContainerElement[0], sidebarPlacement.endNode );
|
||||
wasInserted = true;
|
||||
} );
|
||||
|
||||
api.selectiveRefresh.partial.add( widgetPartial );
|
||||
|
||||
if ( wasInserted ) {
|
||||
sidebarPartial.reflowWidgets();
|
||||
}
|
||||
|
||||
return widgetPartial;
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles changes to the sidebars_widgets[] setting.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {Array} newWidgetIds New widget IDs.
|
||||
* @param {Array} oldWidgetIds Old widget IDs.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
handleSettingChange: function( newWidgetIds, oldWidgetIds ) {
|
||||
var sidebarPartial = this, needsRefresh, widgetsRemoved, widgetsAdded, addedWidgetPartials = [];
|
||||
|
||||
needsRefresh = (
|
||||
( oldWidgetIds.length > 0 && 0 === newWidgetIds.length ) ||
|
||||
( newWidgetIds.length > 0 && 0 === oldWidgetIds.length )
|
||||
);
|
||||
if ( needsRefresh ) {
|
||||
sidebarPartial.fallback();
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle removal of widgets.
|
||||
widgetsRemoved = _.difference( oldWidgetIds, newWidgetIds );
|
||||
_.each( widgetsRemoved, function( removedWidgetId ) {
|
||||
var widgetPartial = api.selectiveRefresh.partial( 'widget[' + removedWidgetId + ']' );
|
||||
if ( widgetPartial ) {
|
||||
_.each( widgetPartial.placements(), function( placement ) {
|
||||
var isRemoved = (
|
||||
placement.context.sidebar_id === sidebarPartial.sidebarId ||
|
||||
( placement.context.sidebar_args && placement.context.sidebar_args.id === sidebarPartial.sidebarId )
|
||||
);
|
||||
if ( isRemoved ) {
|
||||
placement.container.remove();
|
||||
}
|
||||
} );
|
||||
}
|
||||
delete self.renderedWidgets[ removedWidgetId ];
|
||||
} );
|
||||
|
||||
// Handle insertion of widgets.
|
||||
widgetsAdded = _.difference( newWidgetIds, oldWidgetIds );
|
||||
_.each( widgetsAdded, function( addedWidgetId ) {
|
||||
var widgetPartial = sidebarPartial.ensureWidgetPlacementContainers( addedWidgetId );
|
||||
addedWidgetPartials.push( widgetPartial );
|
||||
self.renderedWidgets[ addedWidgetId ] = true;
|
||||
} );
|
||||
|
||||
_.each( addedWidgetPartials, function( widgetPartial ) {
|
||||
widgetPartial.refresh();
|
||||
} );
|
||||
|
||||
api.selectiveRefresh.trigger( 'sidebar-updated', sidebarPartial );
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes the sidebar partial.
|
||||
*
|
||||
* Note that the meat is handled in handleSettingChange because it has the
|
||||
* context of which widgets were removed.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {Promise} A promise postponing the refresh.
|
||||
*/
|
||||
refresh: function() {
|
||||
var partial = this, deferred = $.Deferred();
|
||||
|
||||
deferred.fail( function() {
|
||||
partial.fallback();
|
||||
} );
|
||||
|
||||
if ( 0 === partial.placements().length ) {
|
||||
deferred.reject();
|
||||
} else {
|
||||
_.each( partial.reflowWidgets(), function( sidebarPlacement ) {
|
||||
api.selectiveRefresh.trigger( 'partial-content-rendered', sidebarPlacement );
|
||||
} );
|
||||
deferred.resolve();
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
});
|
||||
|
||||
api.selectiveRefresh.partialConstructor.sidebar = self.SidebarPartial;
|
||||
api.selectiveRefresh.partialConstructor.widget = self.WidgetPartial;
|
||||
|
||||
/**
|
||||
* Adds partials for the registered widget areas (sidebars).
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
self.addPartials = function() {
|
||||
_.each( self.registeredSidebars, function( registeredSidebar ) {
|
||||
var partial, partialId = 'sidebar[' + registeredSidebar.id + ']';
|
||||
partial = api.selectiveRefresh.partial( partialId );
|
||||
if ( ! partial ) {
|
||||
partial = new self.SidebarPartial( partialId, {
|
||||
params: {
|
||||
sidebarArgs: registeredSidebar
|
||||
}
|
||||
} );
|
||||
api.selectiveRefresh.partial.add( partial );
|
||||
}
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the selector for the sidebar's widgets based on the registered
|
||||
* sidebar's info.
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
self.buildWidgetSelectors = function() {
|
||||
var self = this;
|
||||
|
||||
$.each( self.registeredSidebars, function( i, sidebar ) {
|
||||
var widgetTpl = [
|
||||
sidebar.before_widget,
|
||||
sidebar.before_title,
|
||||
sidebar.after_title,
|
||||
sidebar.after_widget
|
||||
].join( '' ),
|
||||
emptyWidget,
|
||||
widgetSelector,
|
||||
widgetClasses;
|
||||
|
||||
emptyWidget = $( widgetTpl );
|
||||
widgetSelector = emptyWidget.prop( 'tagName' ) || '';
|
||||
widgetClasses = emptyWidget.prop( 'className' ) || '';
|
||||
|
||||
// Prevent a rare case when before_widget, before_title, after_title and after_widget is empty.
|
||||
if ( ! widgetClasses ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove class names that incorporate the string formatting placeholders %1$s and %2$s.
|
||||
widgetClasses = widgetClasses.replace( /\S*%[12]\$s\S*/g, '' );
|
||||
widgetClasses = widgetClasses.replace( /^\s+|\s+$/g, '' );
|
||||
if ( widgetClasses ) {
|
||||
widgetSelector += '.' + widgetClasses.split( /\s+/ ).join( '.' );
|
||||
}
|
||||
self.widgetSelectors.push( widgetSelector );
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Highlights the widget on widget updates or widget control mouse overs.
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @since 3.9.0
|
||||
* @param {string} widgetId ID of the widget.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
self.highlightWidget = function( widgetId ) {
|
||||
var $body = $( document.body ),
|
||||
$widget = $( '#' + widgetId );
|
||||
|
||||
$body.find( '.widget-customizer-highlighted-widget' ).removeClass( 'widget-customizer-highlighted-widget' );
|
||||
|
||||
$widget.addClass( 'widget-customizer-highlighted-widget' );
|
||||
setTimeout( function() {
|
||||
$widget.removeClass( 'widget-customizer-highlighted-widget' );
|
||||
}, 500 );
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows a title and highlights widgets on hover. On shift+clicking focuses the
|
||||
* widget control.
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
self.highlightControls = function() {
|
||||
var self = this,
|
||||
selector = this.widgetSelectors.join( ',' );
|
||||
|
||||
// Skip adding highlights if not in the customizer preview iframe.
|
||||
if ( ! api.settings.channel ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$( selector ).attr( 'title', this.l10n.widgetTooltip );
|
||||
// Highlights widget when entering the widget editor.
|
||||
$( document ).on( 'mouseenter', selector, function() {
|
||||
self.preview.send( 'highlight-widget-control', $( this ).prop( 'id' ) );
|
||||
});
|
||||
|
||||
// Open expand the widget control when shift+clicking the widget element.
|
||||
$( document ).on( 'click', selector, function( e ) {
|
||||
if ( ! e.shiftKey ) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
self.preview.send( 'focus-widget-control', $( this ).prop( 'id' ) );
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a widget ID.
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} widgetId The widget ID.
|
||||
*
|
||||
* @return {{idBase: string, number: number|null}} An object containing the idBase
|
||||
* and number of the parsed widget ID.
|
||||
*/
|
||||
self.parseWidgetId = function( widgetId ) {
|
||||
var matches, parsed = {
|
||||
idBase: '',
|
||||
number: null
|
||||
};
|
||||
|
||||
matches = widgetId.match( /^(.+)-(\d+)$/ );
|
||||
if ( matches ) {
|
||||
parsed.idBase = matches[1];
|
||||
parsed.number = parseInt( matches[2], 10 );
|
||||
} else {
|
||||
parsed.idBase = widgetId; // Likely an old single widget.
|
||||
}
|
||||
|
||||
return parsed;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses a widget setting ID.
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} settingId Widget setting ID.
|
||||
*
|
||||
* @return {{idBase: string, number: number|null}|null} Either an object containing the idBase
|
||||
* and number of the parsed widget setting ID,
|
||||
* or null.
|
||||
*/
|
||||
self.parseWidgetSettingId = function( settingId ) {
|
||||
var matches, parsed = {
|
||||
idBase: '',
|
||||
number: null
|
||||
};
|
||||
|
||||
matches = settingId.match( /^widget_([^\[]+?)(?:\[(\d+)])?$/ );
|
||||
if ( ! matches ) {
|
||||
return null;
|
||||
}
|
||||
parsed.idBase = matches[1];
|
||||
if ( matches[2] ) {
|
||||
parsed.number = parseInt( matches[2], 10 );
|
||||
}
|
||||
return parsed;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a widget ID into a Customizer setting ID.
|
||||
*
|
||||
* @memberOf wp.customize.widgetsPreview
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param {string} widgetId The widget ID.
|
||||
*
|
||||
* @return {string} The setting ID.
|
||||
*/
|
||||
self.getWidgetSettingId = function( widgetId ) {
|
||||
var parsed = this.parseWidgetId( widgetId ), settingId;
|
||||
|
||||
settingId = 'widget_' + parsed.idBase;
|
||||
if ( parsed.number ) {
|
||||
settingId += '[' + String( parsed.number ) + ']';
|
||||
}
|
||||
|
||||
return settingId;
|
||||
};
|
||||
|
||||
api.bind( 'preview-ready', function() {
|
||||
$.extend( self, _wpWidgetCustomizerPreviewSettings );
|
||||
self.init();
|
||||
});
|
||||
|
||||
return self;
|
||||
})( jQuery, _, wp, wp.customize );
|
||||
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
wp.customize.widgetsPreview=wp.customize.WidgetCustomizerPreview=function(d,o,c){var s={renderedSidebars:{},renderedWidgets:{},registeredSidebars:[],registeredWidgets:{},widgetSelectors:[],preview:null,l10n:{widgetTooltip:""},selectiveRefreshableWidgets:{},init:function(){var i=this;i.preview=c.preview,o.isEmpty(i.selectiveRefreshableWidgets)||i.addPartials(),i.buildWidgetSelectors(),i.highlightControls(),i.preview.bind("highlight-widget",i.highlightWidget),c.preview.bind("active",function(){i.highlightControls()}),c.preview.bind("refresh-widget-partial",function(e){var t="widget["+e+"]";c.selectiveRefresh.partial.has(t)?c.selectiveRefresh.partial(t).refresh():i.renderedWidgets[e]&&c.preview.send("refresh")})}};return s.WidgetPartial=c.selectiveRefresh.Partial.extend({initialize:function(e,t){var i=this,r=e.match(/^widget\[(.+)]$/);if(!r)throw new Error("Illegal id for widget partial.");i.widgetId=r[1],i.widgetIdParts=s.parseWidgetId(i.widgetId),(t=t||{}).params=o.extend({settings:[s.getWidgetSettingId(i.widgetId)],containerInclusive:!0},t.params||{}),c.selectiveRefresh.Partial.prototype.initialize.call(i,e,t)},refresh:function(){var e,t=this;return s.selectiveRefreshableWidgets[t.widgetIdParts.idBase]?c.selectiveRefresh.Partial.prototype.refresh.call(t):((e=d.Deferred()).reject(),t.fallback(),e.promise())},renderContent:function(e){var t=this;c.selectiveRefresh.Partial.prototype.renderContent.call(t,e)&&(c.preview.send("widget-updated",t.widgetId),c.selectiveRefresh.trigger("widget-updated",t))}}),s.SidebarPartial=c.selectiveRefresh.Partial.extend({initialize:function(e,t){var i=this,r=e.match(/^sidebar\[(.+)]$/);if(!r)throw new Error("Illegal id for sidebar partial.");if(i.sidebarId=r[1],(t=t||{}).params=o.extend({settings:["sidebars_widgets["+i.sidebarId+"]"]},t.params||{}),c.selectiveRefresh.Partial.prototype.initialize.call(i,e,t),!i.params.sidebarArgs)throw new Error("The sidebarArgs param was not provided.");if(1<i.params.settings.length)throw new Error("Expected SidebarPartial to only have one associated setting")},ready:function(){var i=this;o.each(i.settings(),function(e){c(e).bind(o.bind(i.handleSettingChange,i))}),c.selectiveRefresh.bind("partial-content-rendered",function(e){e.partial.extended(s.WidgetPartial)&&-1!==o.indexOf(i.getWidgetIds(),e.partial.widgetId)&&c.selectiveRefresh.trigger("sidebar-updated",i)}),c.bind("change",function(e){var t,e=s.parseWidgetSettingId(e.id);e&&(t=e.idBase,e.number&&(t+="-"+String(e.number)),-1!==o.indexOf(i.getWidgetIds(),t))&&i.ensureWidgetPlacementContainers(t)})},findDynamicSidebarBoundaryNodes:function(){var i=this,r={},a=/^(dynamic_sidebar_before|dynamic_sidebar_after):(.+):(\d+)$/,n=function(e){o.each(e,function(e){var t;8===e.nodeType?(t=e.nodeValue.match(a))&&t[2]===i.sidebarId&&(o.isUndefined(r[t[3]])&&(r[t[3]]={before:null,after:null,instanceNumber:parseInt(t[3],10)}),"dynamic_sidebar_before"===t[1]?r[t[3]].before=e:r[t[3]].after=e):1===e.nodeType&&n(e.childNodes)})};return n(document.body.childNodes),o.values(r)},placements:function(){var t=this;return o.map(t.findDynamicSidebarBoundaryNodes(),function(e){return new c.selectiveRefresh.Placement({partial:t,container:null,startNode:e.before,endNode:e.after,context:{instanceNumber:e.instanceNumber}})})},getWidgetIds:function(){var e=this.settings()[0];if(!e)throw new Error("Missing associated setting.");if(!c.has(e))throw new Error("Setting does not exist.");if(e=c(e).get(),o.isArray(e))return e.slice(0);throw new Error("Expected setting to be array of widget IDs")},reflowWidgets:function(){var e=this,t=[],i=e.getWidgetIds(),r=e.placements(),s={};return o.each(i,function(e){var t=c.selectiveRefresh.partial("widget["+e+"]");t&&(s[e]=t)}),o.each(r,function(i){var r,a=[],n=!1,d=-1;o.each(s,function(t){o.each(t.placements(),function(e){i.context.instanceNumber===e.context.sidebar_instance_number&&(r=e.container.index(),a.push({partial:t,placement:e,position:r}),r<d&&(n=!0),d=r)})}),n&&(o.each(a,function(e){i.endNode.parentNode.insertBefore(e.placement.container[0],i.endNode),c.selectiveRefresh.trigger("partial-content-moved",e.placement)}),t.push(i))}),0<t.length&&c.selectiveRefresh.trigger("sidebar-updated",e),t},ensureWidgetPlacementContainers:function(i){var r=this,a=!1,e="widget["+i+"]",n=c.selectiveRefresh.partial(e);return n=n||new s.WidgetPartial(e,{params:{}}),o.each(r.placements(),function(t){var e;o.find(n.placements(),function(e){return e.context.sidebar_instance_number===t.context.instanceNumber})||(e=d(r.params.sidebarArgs.before_widget.replace(/%1\$s/g,i).replace(/%2\$s/g,"widget")+r.params.sidebarArgs.after_widget))[0]&&(e.attr("data-customize-partial-id",n.id),e.attr("data-customize-partial-type","widget"),e.attr("data-customize-widget-id",i),e.data("customize-partial-placement-context",{sidebar_id:r.sidebarId,sidebar_instance_number:t.context.instanceNumber}),t.endNode.parentNode.insertBefore(e[0],t.endNode),a=!0)}),c.selectiveRefresh.partial.add(n),a&&r.reflowWidgets(),n},handleSettingCLine truncated
|
||||
@@ -0,0 +1,916 @@
|
||||
/*
|
||||
* Script run inside a Customizer preview frame.
|
||||
*
|
||||
* @output wp-includes/js/customize-preview.js
|
||||
*/
|
||||
(function( exports, $ ){
|
||||
var api = wp.customize,
|
||||
debounce,
|
||||
currentHistoryState = {};
|
||||
|
||||
/*
|
||||
* Capture the state that is passed into history.replaceState() and history.pushState()
|
||||
* and also which is returned in the popstate event so that when the changeset_uuid
|
||||
* gets updated when transitioning to a new changeset there the current state will
|
||||
* be supplied in the call to history.replaceState().
|
||||
*/
|
||||
( function( history ) {
|
||||
var injectUrlWithState;
|
||||
|
||||
if ( ! history.replaceState ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amend the supplied URL with the customized state.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access private
|
||||
*
|
||||
* @param {string} url URL.
|
||||
* @return {string} URL with customized state.
|
||||
*/
|
||||
injectUrlWithState = function( url ) {
|
||||
var urlParser, oldQueryParams, newQueryParams;
|
||||
urlParser = document.createElement( 'a' );
|
||||
urlParser.href = url;
|
||||
oldQueryParams = api.utils.parseQueryString( location.search.substr( 1 ) );
|
||||
newQueryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) );
|
||||
|
||||
newQueryParams.customize_changeset_uuid = oldQueryParams.customize_changeset_uuid;
|
||||
if ( oldQueryParams.customize_autosaved ) {
|
||||
newQueryParams.customize_autosaved = 'on';
|
||||
}
|
||||
if ( oldQueryParams.customize_theme ) {
|
||||
newQueryParams.customize_theme = oldQueryParams.customize_theme;
|
||||
}
|
||||
if ( oldQueryParams.customize_messenger_channel ) {
|
||||
newQueryParams.customize_messenger_channel = oldQueryParams.customize_messenger_channel;
|
||||
}
|
||||
urlParser.search = $.param( newQueryParams );
|
||||
return urlParser.href;
|
||||
};
|
||||
|
||||
history.replaceState = ( function( nativeReplaceState ) {
|
||||
return function historyReplaceState( data, title, url ) {
|
||||
currentHistoryState = data;
|
||||
return nativeReplaceState.call( history, data, title, 'string' === typeof url && url.length > 0 ? injectUrlWithState( url ) : url );
|
||||
};
|
||||
} )( history.replaceState );
|
||||
|
||||
history.pushState = ( function( nativePushState ) {
|
||||
return function historyPushState( data, title, url ) {
|
||||
currentHistoryState = data;
|
||||
return nativePushState.call( history, data, title, 'string' === typeof url && url.length > 0 ? injectUrlWithState( url ) : url );
|
||||
};
|
||||
} )( history.pushState );
|
||||
|
||||
window.addEventListener( 'popstate', function( event ) {
|
||||
currentHistoryState = event.state;
|
||||
} );
|
||||
|
||||
}( history ) );
|
||||
|
||||
/**
|
||||
* Returns a debounced version of the function.
|
||||
*
|
||||
* @todo Require Underscore.js for this file and retire this.
|
||||
*/
|
||||
debounce = function( fn, delay, context ) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var args = arguments;
|
||||
|
||||
context = context || this;
|
||||
|
||||
clearTimeout( timeout );
|
||||
timeout = setTimeout( function() {
|
||||
timeout = null;
|
||||
fn.apply( context, args );
|
||||
}, delay );
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @memberOf wp.customize
|
||||
* @alias wp.customize.Preview
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.customize.Messenger
|
||||
* @augments wp.customize.Class
|
||||
* @mixes wp.customize.Events
|
||||
*/
|
||||
api.Preview = api.Messenger.extend(/** @lends wp.customize.Preview.prototype */{
|
||||
/**
|
||||
* @param {Object} params - Parameters to configure the messenger.
|
||||
* @param {Object} options - Extend any instance parameter or method with this object.
|
||||
*/
|
||||
initialize: function( params, options ) {
|
||||
var preview = this, urlParser = document.createElement( 'a' );
|
||||
|
||||
api.Messenger.prototype.initialize.call( preview, params, options );
|
||||
|
||||
urlParser.href = preview.origin();
|
||||
preview.add( 'scheme', urlParser.protocol.replace( /:$/, '' ) );
|
||||
|
||||
preview.body = $( document.body );
|
||||
preview.window = $( window );
|
||||
|
||||
if ( api.settings.channel ) {
|
||||
|
||||
// If in an iframe, then intercept the link clicks and form submissions.
|
||||
preview.body.on( 'click.preview', 'a', function( event ) {
|
||||
preview.handleLinkClick( event );
|
||||
} );
|
||||
preview.body.on( 'submit.preview', 'form', function( event ) {
|
||||
preview.handleFormSubmit( event );
|
||||
} );
|
||||
|
||||
preview.window.on( 'scroll.preview', debounce( function() {
|
||||
preview.send( 'scroll', preview.window.scrollTop() );
|
||||
}, 200 ) );
|
||||
|
||||
preview.bind( 'scroll', function( distance ) {
|
||||
preview.window.scrollTop( distance );
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle link clicks in preview.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access public
|
||||
*
|
||||
* @param {jQuery.Event} event Event.
|
||||
*/
|
||||
handleLinkClick: function( event ) {
|
||||
var preview = this, link, isInternalJumpLink;
|
||||
link = $( event.target ).closest( 'a' );
|
||||
|
||||
// No-op if the anchor is not a link.
|
||||
if ( _.isUndefined( link.attr( 'href' ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Allow internal jump links and JS links to behave normally without preventing default.
|
||||
isInternalJumpLink = ( '#' === link.attr( 'href' ).substr( 0, 1 ) );
|
||||
if ( isInternalJumpLink || ! /^https?:$/.test( link.prop( 'protocol' ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the link is not previewable, prevent the browser from navigating to it.
|
||||
if ( ! api.isLinkPreviewable( link[0] ) ) {
|
||||
wp.a11y.speak( api.settings.l10n.linkUnpreviewable );
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
// Prevent initiating navigating from click and instead rely on sending url message to pane.
|
||||
event.preventDefault();
|
||||
|
||||
/*
|
||||
* Note the shift key is checked so shift+click on widgets or
|
||||
* nav menu items can just result on focusing on the corresponding
|
||||
* control instead of also navigating to the URL linked to.
|
||||
*/
|
||||
if ( event.shiftKey ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: It's not relevant to send scroll because sending url message will have the same effect.
|
||||
preview.send( 'url', link.prop( 'href' ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle form submit.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access public
|
||||
*
|
||||
* @param {jQuery.Event} event Event.
|
||||
*/
|
||||
handleFormSubmit: function( event ) {
|
||||
var preview = this, urlParser, form;
|
||||
urlParser = document.createElement( 'a' );
|
||||
form = $( event.target );
|
||||
urlParser.href = form.prop( 'action' );
|
||||
|
||||
// If the link is not previewable, prevent the browser from navigating to it.
|
||||
if ( 'GET' !== form.prop( 'method' ).toUpperCase() || ! api.isLinkPreviewable( urlParser ) ) {
|
||||
wp.a11y.speak( api.settings.l10n.formUnpreviewable );
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the default wasn't prevented already (in which case the form
|
||||
* submission is already being handled by JS), and if it has a GET
|
||||
* request method, then take the serialized form data and add it as
|
||||
* a query string to the action URL and send this in a url message
|
||||
* to the customizer pane so that it will be loaded. If the form's
|
||||
* action points to a non-previewable URL, the customizer pane's
|
||||
* previewUrl setter will reject it so that the form submission is
|
||||
* a no-op, which is the same behavior as when clicking a link to an
|
||||
* external site in the preview.
|
||||
*/
|
||||
if ( ! event.isDefaultPrevented() ) {
|
||||
if ( urlParser.search.length > 1 ) {
|
||||
urlParser.search += '&';
|
||||
}
|
||||
urlParser.search += form.serialize();
|
||||
preview.send( 'url', urlParser.href );
|
||||
}
|
||||
|
||||
// Prevent default since navigation should be done via sending url message or via JS submit handler.
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Inject the changeset UUID into links in the document.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access protected
|
||||
* @access private
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
api.addLinkPreviewing = function addLinkPreviewing() {
|
||||
var linkSelectors = 'a[href], area[href]';
|
||||
|
||||
// Inject links into initial document.
|
||||
$( document.body ).find( linkSelectors ).each( function() {
|
||||
api.prepareLinkPreview( this );
|
||||
} );
|
||||
|
||||
// Inject links for new elements added to the page.
|
||||
if ( 'undefined' !== typeof MutationObserver ) {
|
||||
api.mutationObserver = new MutationObserver( function( mutations ) {
|
||||
_.each( mutations, function( mutation ) {
|
||||
$( mutation.target ).find( linkSelectors ).each( function() {
|
||||
api.prepareLinkPreview( this );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
api.mutationObserver.observe( document.documentElement, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
} );
|
||||
} else {
|
||||
|
||||
// If mutation observers aren't available, fallback to just-in-time injection.
|
||||
$( document.documentElement ).on( 'click focus mouseover', linkSelectors, function() {
|
||||
api.prepareLinkPreview( this );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Should the supplied link is previewable.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access public
|
||||
*
|
||||
* @param {HTMLAnchorElement|HTMLAreaElement} element Link element.
|
||||
* @param {string} element.search Query string.
|
||||
* @param {string} element.pathname Path.
|
||||
* @param {string} element.host Host.
|
||||
* @param {Object} [options]
|
||||
* @param {Object} [options.allowAdminAjax=false] Allow admin-ajax.php requests.
|
||||
* @return {boolean} Is appropriate for changeset link.
|
||||
*/
|
||||
api.isLinkPreviewable = function isLinkPreviewable( element, options ) {
|
||||
var matchesAllowedUrl, parsedAllowedUrl, args, elementHost;
|
||||
|
||||
args = _.extend( {}, { allowAdminAjax: false }, options || {} );
|
||||
|
||||
if ( 'javascript:' === element.protocol ) { // jshint ignore:line
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only web URLs can be previewed.
|
||||
if ( 'https:' !== element.protocol && 'http:' !== element.protocol ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
elementHost = element.host.replace( /:(80|443)$/, '' );
|
||||
parsedAllowedUrl = document.createElement( 'a' );
|
||||
matchesAllowedUrl = ! _.isUndefined( _.find( api.settings.url.allowed, function( allowedUrl ) {
|
||||
parsedAllowedUrl.href = allowedUrl;
|
||||
return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:(80|443)$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) );
|
||||
} ) );
|
||||
if ( ! matchesAllowedUrl ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip wp login and signup pages.
|
||||
if ( /\/wp-(login|signup)\.php$/.test( element.pathname ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Allow links to admin ajax as faux frontend URLs.
|
||||
if ( /\/wp-admin\/admin-ajax\.php$/.test( element.pathname ) ) {
|
||||
return args.allowAdminAjax;
|
||||
}
|
||||
|
||||
// Disallow links to admin, includes, and content.
|
||||
if ( /\/wp-(admin|includes|content)(\/|$)/.test( element.pathname ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Inject the customize_changeset_uuid query param into links on the frontend.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access protected
|
||||
*
|
||||
* @param {HTMLAnchorElement|HTMLAreaElement} element Link element.
|
||||
* @param {string} element.search Query string.
|
||||
* @param {string} element.host Host.
|
||||
* @param {string} element.protocol Protocol.
|
||||
* @return {void}
|
||||
*/
|
||||
api.prepareLinkPreview = function prepareLinkPreview( element ) {
|
||||
var queryParams, $element = $( element );
|
||||
|
||||
// Skip elements with no href attribute. Check first to avoid more expensive checks down the road.
|
||||
if ( ! element.hasAttribute( 'href' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip links in admin bar.
|
||||
if ( $element.closest( '#wpadminbar' ).length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore links with href="#", href="#id", or non-HTTP protocols (e.g. javascript: and mailto:).
|
||||
if ( '#' === $element.attr( 'href' ).substr( 0, 1 ) || ! /^https?:$/.test( element.protocol ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure links in preview use HTTPS if parent frame uses HTTPS.
|
||||
if ( api.settings.channel && 'https' === api.preview.scheme.get() && 'http:' === element.protocol && -1 !== api.settings.url.allowedHosts.indexOf( element.host ) ) {
|
||||
element.protocol = 'https:';
|
||||
}
|
||||
|
||||
// Ignore links with class wp-playlist-caption.
|
||||
if ( $element.hasClass( 'wp-playlist-caption' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! api.isLinkPreviewable( element ) ) {
|
||||
|
||||
// Style link as unpreviewable only if previewing in iframe; if previewing on frontend, links will be allowed to work normally.
|
||||
if ( api.settings.channel ) {
|
||||
$element.addClass( 'customize-unpreviewable' );
|
||||
}
|
||||
return;
|
||||
}
|
||||
$element.removeClass( 'customize-unpreviewable' );
|
||||
|
||||
queryParams = api.utils.parseQueryString( element.search.substring( 1 ) );
|
||||
queryParams.customize_changeset_uuid = api.settings.changeset.uuid;
|
||||
if ( api.settings.changeset.autosaved ) {
|
||||
queryParams.customize_autosaved = 'on';
|
||||
}
|
||||
if ( ! api.settings.theme.active ) {
|
||||
queryParams.customize_theme = api.settings.theme.stylesheet;
|
||||
}
|
||||
if ( api.settings.channel ) {
|
||||
queryParams.customize_messenger_channel = api.settings.channel;
|
||||
}
|
||||
element.search = $.param( queryParams );
|
||||
};
|
||||
|
||||
/**
|
||||
* Inject the changeset UUID into Ajax requests.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access protected
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
api.addRequestPreviewing = function addRequestPreviewing() {
|
||||
|
||||
/**
|
||||
* Rewrite Ajax requests to inject customizer state.
|
||||
*
|
||||
* @param {Object} options Options.
|
||||
* @param {string} options.type Type.
|
||||
* @param {string} options.url URL.
|
||||
* @param {Object} originalOptions Original options.
|
||||
* @param {XMLHttpRequest} xhr XHR.
|
||||
* @return {void}
|
||||
*/
|
||||
var prefilterAjax = function( options, originalOptions, xhr ) {
|
||||
var urlParser, queryParams, requestMethod, dirtyValues = {};
|
||||
urlParser = document.createElement( 'a' );
|
||||
urlParser.href = options.url;
|
||||
|
||||
// Abort if the request is not for this site.
|
||||
if ( ! api.isLinkPreviewable( urlParser, { allowAdminAjax: true } ) ) {
|
||||
return;
|
||||
}
|
||||
queryParams = api.utils.parseQueryString( urlParser.search.substring( 1 ) );
|
||||
|
||||
// Note that _dirty flag will be cleared with changeset updates.
|
||||
api.each( function( setting ) {
|
||||
if ( setting._dirty ) {
|
||||
dirtyValues[ setting.id ] = setting.get();
|
||||
}
|
||||
} );
|
||||
|
||||
if ( ! _.isEmpty( dirtyValues ) ) {
|
||||
requestMethod = options.type.toUpperCase();
|
||||
|
||||
// Override underlying request method to ensure unsaved changes to changeset can be included (force Backbone.emulateHTTP).
|
||||
if ( 'POST' !== requestMethod ) {
|
||||
xhr.setRequestHeader( 'X-HTTP-Method-Override', requestMethod );
|
||||
queryParams._method = requestMethod;
|
||||
options.type = 'POST';
|
||||
}
|
||||
|
||||
// Amend the post data with the customized values.
|
||||
if ( options.data ) {
|
||||
options.data += '&';
|
||||
} else {
|
||||
options.data = '';
|
||||
}
|
||||
options.data += $.param( {
|
||||
customized: JSON.stringify( dirtyValues )
|
||||
} );
|
||||
}
|
||||
|
||||
// Include customized state query params in URL.
|
||||
queryParams.customize_changeset_uuid = api.settings.changeset.uuid;
|
||||
if ( api.settings.changeset.autosaved ) {
|
||||
queryParams.customize_autosaved = 'on';
|
||||
}
|
||||
if ( ! api.settings.theme.active ) {
|
||||
queryParams.customize_theme = api.settings.theme.stylesheet;
|
||||
}
|
||||
|
||||
// Ensure preview nonce is included with every customized request, to allow post data to be read.
|
||||
queryParams.customize_preview_nonce = api.settings.nonce.preview;
|
||||
|
||||
urlParser.search = $.param( queryParams );
|
||||
options.url = urlParser.href;
|
||||
};
|
||||
|
||||
$.ajaxPrefilter( prefilterAjax );
|
||||
};
|
||||
|
||||
/**
|
||||
* Inject changeset UUID into forms, allowing preview to persist through submissions.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access protected
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
api.addFormPreviewing = function addFormPreviewing() {
|
||||
|
||||
// Inject inputs for forms in initial document.
|
||||
$( document.body ).find( 'form' ).each( function() {
|
||||
api.prepareFormPreview( this );
|
||||
} );
|
||||
|
||||
// Inject inputs for new forms added to the page.
|
||||
if ( 'undefined' !== typeof MutationObserver ) {
|
||||
api.mutationObserver = new MutationObserver( function( mutations ) {
|
||||
_.each( mutations, function( mutation ) {
|
||||
$( mutation.target ).find( 'form' ).each( function() {
|
||||
api.prepareFormPreview( this );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
api.mutationObserver.observe( document.documentElement, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Inject changeset into form inputs.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access protected
|
||||
*
|
||||
* @param {HTMLFormElement} form Form.
|
||||
* @return {void}
|
||||
*/
|
||||
api.prepareFormPreview = function prepareFormPreview( form ) {
|
||||
var urlParser, stateParams = {};
|
||||
|
||||
if ( ! form.action ) {
|
||||
form.action = location.href;
|
||||
}
|
||||
|
||||
urlParser = document.createElement( 'a' );
|
||||
urlParser.href = form.action;
|
||||
|
||||
// Make sure forms in preview use HTTPS if parent frame uses HTTPS.
|
||||
if ( api.settings.channel && 'https' === api.preview.scheme.get() && 'http:' === urlParser.protocol && -1 !== api.settings.url.allowedHosts.indexOf( urlParser.host ) ) {
|
||||
urlParser.protocol = 'https:';
|
||||
form.action = urlParser.href;
|
||||
}
|
||||
|
||||
if ( 'GET' !== form.method.toUpperCase() || ! api.isLinkPreviewable( urlParser ) ) {
|
||||
|
||||
// Style form as unpreviewable only if previewing in iframe; if previewing on frontend, all forms will be allowed to work normally.
|
||||
if ( api.settings.channel ) {
|
||||
$( form ).addClass( 'customize-unpreviewable' );
|
||||
}
|
||||
return;
|
||||
}
|
||||
$( form ).removeClass( 'customize-unpreviewable' );
|
||||
|
||||
stateParams.customize_changeset_uuid = api.settings.changeset.uuid;
|
||||
if ( api.settings.changeset.autosaved ) {
|
||||
stateParams.customize_autosaved = 'on';
|
||||
}
|
||||
if ( ! api.settings.theme.active ) {
|
||||
stateParams.customize_theme = api.settings.theme.stylesheet;
|
||||
}
|
||||
if ( api.settings.channel ) {
|
||||
stateParams.customize_messenger_channel = api.settings.channel;
|
||||
}
|
||||
|
||||
_.each( stateParams, function( value, name ) {
|
||||
var input = $( form ).find( 'input[name="' + name + '"]' );
|
||||
if ( input.length ) {
|
||||
input.val( value );
|
||||
} else {
|
||||
$( form ).prepend( $( '<input>', {
|
||||
type: 'hidden',
|
||||
name: name,
|
||||
value: value
|
||||
} ) );
|
||||
}
|
||||
} );
|
||||
|
||||
// Prevent links from breaking out of preview iframe.
|
||||
if ( api.settings.channel ) {
|
||||
form.target = '_self';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Watch current URL and send keep-alive (heartbeat) messages to the parent.
|
||||
*
|
||||
* Keep the customizer pane notified that the preview is still alive
|
||||
* and that the user hasn't navigated to a non-customized URL.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access protected
|
||||
*/
|
||||
api.keepAliveCurrentUrl = ( function() {
|
||||
var previousPathName = location.pathname,
|
||||
previousQueryString = location.search.substr( 1 ),
|
||||
previousQueryParams = null,
|
||||
stateQueryParams = [ 'customize_theme', 'customize_changeset_uuid', 'customize_messenger_channel', 'customize_autosaved' ];
|
||||
|
||||
return function keepAliveCurrentUrl() {
|
||||
var urlParser, currentQueryParams;
|
||||
|
||||
// Short-circuit with keep-alive if previous URL is identical (as is normal case).
|
||||
if ( previousQueryString === location.search.substr( 1 ) && previousPathName === location.pathname ) {
|
||||
api.preview.send( 'keep-alive' );
|
||||
return;
|
||||
}
|
||||
|
||||
urlParser = document.createElement( 'a' );
|
||||
if ( null === previousQueryParams ) {
|
||||
urlParser.search = previousQueryString;
|
||||
previousQueryParams = api.utils.parseQueryString( previousQueryString );
|
||||
_.each( stateQueryParams, function( name ) {
|
||||
delete previousQueryParams[ name ];
|
||||
} );
|
||||
}
|
||||
|
||||
// Determine if current URL minus customized state params and URL hash.
|
||||
urlParser.href = location.href;
|
||||
currentQueryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) );
|
||||
_.each( stateQueryParams, function( name ) {
|
||||
delete currentQueryParams[ name ];
|
||||
} );
|
||||
|
||||
if ( previousPathName !== location.pathname || ! _.isEqual( previousQueryParams, currentQueryParams ) ) {
|
||||
urlParser.search = $.param( currentQueryParams );
|
||||
urlParser.hash = '';
|
||||
api.settings.url.self = urlParser.href;
|
||||
api.preview.send( 'ready', {
|
||||
currentUrl: api.settings.url.self,
|
||||
activePanels: api.settings.activePanels,
|
||||
activeSections: api.settings.activeSections,
|
||||
activeControls: api.settings.activeControls,
|
||||
settingValidities: api.settings.settingValidities
|
||||
} );
|
||||
} else {
|
||||
api.preview.send( 'keep-alive' );
|
||||
}
|
||||
previousQueryParams = currentQueryParams;
|
||||
previousQueryString = location.search.substr( 1 );
|
||||
previousPathName = location.pathname;
|
||||
};
|
||||
} )();
|
||||
|
||||
api.settingPreviewHandlers = {
|
||||
|
||||
/**
|
||||
* Preview changes to custom logo.
|
||||
*
|
||||
* @param {number} attachmentId Attachment ID for custom logo.
|
||||
* @return {void}
|
||||
*/
|
||||
custom_logo: function( attachmentId ) {
|
||||
$( 'body' ).toggleClass( 'wp-custom-logo', !! attachmentId );
|
||||
},
|
||||
|
||||
/**
|
||||
* Preview changes to custom css.
|
||||
*
|
||||
* @param {string} value Custom CSS.
|
||||
* @return {void}
|
||||
*/
|
||||
custom_css: function( value ) {
|
||||
var style;
|
||||
if ( api.settings.theme.isBlockTheme ) {
|
||||
style = $( 'style#global-styles-inline-css' );
|
||||
|
||||
// Forbid milestone comments from appearing in Custom CSS which would break live preview.
|
||||
value = value.replace( /\/\*(BEGIN|END)_CUSTOMIZER_CUSTOM_CSS\*\//g, '' );
|
||||
|
||||
var textContent = style.text().replace(
|
||||
/(\/\*BEGIN_CUSTOMIZER_CUSTOM_CSS\*\/)((?:.|\s)*?)(\/\*END_CUSTOMIZER_CUSTOM_CSS\*\/)/,
|
||||
function ( match, beforeComment, oldValue, afterComment ) {
|
||||
return beforeComment + '\n' + value + '\n' + afterComment;
|
||||
}
|
||||
);
|
||||
style.text( textContent );
|
||||
} else {
|
||||
style = $( 'style#wp-custom-css' );
|
||||
style.text( value );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Preview changes to any of the background settings.
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
background: function() {
|
||||
var css = '', settings = {};
|
||||
|
||||
_.each( ['color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment'], function( prop ) {
|
||||
settings[ prop ] = api( 'background_' + prop );
|
||||
} );
|
||||
|
||||
/*
|
||||
* The body will support custom backgrounds if either the color or image are set.
|
||||
*
|
||||
* See get_body_class() in /wp-includes/post-template.php
|
||||
*/
|
||||
$( document.body ).toggleClass( 'custom-background', !! ( settings.color() || settings.image() ) );
|
||||
|
||||
if ( settings.color() ) {
|
||||
css += 'background-color: ' + settings.color() + ';';
|
||||
}
|
||||
|
||||
if ( settings.image() ) {
|
||||
css += 'background-image: url("' + settings.image() + '");';
|
||||
css += 'background-size: ' + settings.size() + ';';
|
||||
css += 'background-position: ' + settings.position_x() + ' ' + settings.position_y() + ';';
|
||||
css += 'background-repeat: ' + settings.repeat() + ';';
|
||||
css += 'background-attachment: ' + settings.attachment() + ';';
|
||||
}
|
||||
|
||||
$( '#custom-background-css' ).text( 'body.custom-background { ' + css + ' }' );
|
||||
}
|
||||
};
|
||||
|
||||
$( function() {
|
||||
var bg, setValue, handleUpdatedChangesetUuid;
|
||||
|
||||
api.settings = window._wpCustomizeSettings;
|
||||
if ( ! api.settings ) {
|
||||
return;
|
||||
}
|
||||
|
||||
api.preview = new api.Preview({
|
||||
url: window.location.href,
|
||||
channel: api.settings.channel
|
||||
});
|
||||
|
||||
api.addLinkPreviewing();
|
||||
api.addRequestPreviewing();
|
||||
api.addFormPreviewing();
|
||||
|
||||
/**
|
||||
* Create/update a setting value.
|
||||
*
|
||||
* @param {string} id - Setting ID.
|
||||
* @param {*} value - Setting value.
|
||||
* @param {boolean} [createDirty] - Whether to create a setting as dirty. Defaults to false.
|
||||
*/
|
||||
setValue = function( id, value, createDirty ) {
|
||||
var setting = api( id );
|
||||
if ( setting ) {
|
||||
setting.set( value );
|
||||
} else {
|
||||
createDirty = createDirty || false;
|
||||
setting = api.create( id, value, {
|
||||
id: id
|
||||
} );
|
||||
|
||||
// Mark dynamically-created settings as dirty so they will get posted.
|
||||
if ( createDirty ) {
|
||||
setting._dirty = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
api.preview.bind( 'settings', function( values ) {
|
||||
$.each( values, setValue );
|
||||
});
|
||||
|
||||
api.preview.trigger( 'settings', api.settings.values );
|
||||
|
||||
$.each( api.settings._dirty, function( i, id ) {
|
||||
var setting = api( id );
|
||||
if ( setting ) {
|
||||
setting._dirty = true;
|
||||
}
|
||||
} );
|
||||
|
||||
api.preview.bind( 'setting', function( args ) {
|
||||
var createDirty = true;
|
||||
setValue.apply( null, args.concat( createDirty ) );
|
||||
});
|
||||
|
||||
api.preview.bind( 'sync', function( events ) {
|
||||
|
||||
/*
|
||||
* Delete any settings that already exist locally which haven't been
|
||||
* modified in the controls while the preview was loading. This prevents
|
||||
* situations where the JS value being synced from the pane may differ
|
||||
* from the PHP-sanitized JS value in the preview which causes the
|
||||
* non-sanitized JS value to clobber the PHP-sanitized value. This
|
||||
* is particularly important for selective refresh partials that
|
||||
* have a fallback refresh behavior since infinite refreshing would
|
||||
* result.
|
||||
*/
|
||||
if ( events.settings && events['settings-modified-while-loading'] ) {
|
||||
_.each( _.keys( events.settings ), function( syncedSettingId ) {
|
||||
if ( api.has( syncedSettingId ) && ! events['settings-modified-while-loading'][ syncedSettingId ] ) {
|
||||
delete events.settings[ syncedSettingId ];
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
$.each( events, function( event, args ) {
|
||||
api.preview.trigger( event, args );
|
||||
});
|
||||
api.preview.send( 'synced' );
|
||||
});
|
||||
|
||||
api.preview.bind( 'active', function() {
|
||||
api.preview.send( 'nonce', api.settings.nonce );
|
||||
|
||||
api.preview.send( 'documentTitle', document.title );
|
||||
|
||||
// Send scroll in case of loading via non-refresh.
|
||||
api.preview.send( 'scroll', $( window ).scrollTop() );
|
||||
});
|
||||
|
||||
/**
|
||||
* Handle update to changeset UUID.
|
||||
*
|
||||
* @param {string} uuid - UUID.
|
||||
* @return {void}
|
||||
*/
|
||||
handleUpdatedChangesetUuid = function( uuid ) {
|
||||
api.settings.changeset.uuid = uuid;
|
||||
|
||||
// Update UUIDs in links and forms.
|
||||
$( document.body ).find( 'a[href], area[href]' ).each( function() {
|
||||
api.prepareLinkPreview( this );
|
||||
} );
|
||||
$( document.body ).find( 'form' ).each( function() {
|
||||
api.prepareFormPreview( this );
|
||||
} );
|
||||
|
||||
/*
|
||||
* Replace the UUID in the URL. Note that the wrapped history.replaceState()
|
||||
* will handle injecting the current api.settings.changeset.uuid into the URL,
|
||||
* so this is merely to trigger that logic.
|
||||
*/
|
||||
if ( history.replaceState ) {
|
||||
history.replaceState( currentHistoryState, '', location.href );
|
||||
}
|
||||
};
|
||||
|
||||
api.preview.bind( 'changeset-uuid', handleUpdatedChangesetUuid );
|
||||
|
||||
api.preview.bind( 'saved', function( response ) {
|
||||
if ( response.next_changeset_uuid ) {
|
||||
handleUpdatedChangesetUuid( response.next_changeset_uuid );
|
||||
}
|
||||
api.trigger( 'saved', response );
|
||||
} );
|
||||
|
||||
// Update the URLs to reflect the fact we've started autosaving.
|
||||
api.preview.bind( 'autosaving', function() {
|
||||
if ( api.settings.changeset.autosaved ) {
|
||||
return;
|
||||
}
|
||||
|
||||
api.settings.changeset.autosaved = true; // Start deferring to any autosave once changeset is updated.
|
||||
|
||||
$( document.body ).find( 'a[href], area[href]' ).each( function() {
|
||||
api.prepareLinkPreview( this );
|
||||
} );
|
||||
$( document.body ).find( 'form' ).each( function() {
|
||||
api.prepareFormPreview( this );
|
||||
} );
|
||||
if ( history.replaceState ) {
|
||||
history.replaceState( currentHistoryState, '', location.href );
|
||||
}
|
||||
} );
|
||||
|
||||
/*
|
||||
* Clear dirty flag for settings when saved to changeset so that they
|
||||
* won't be needlessly included in selective refresh or ajax requests.
|
||||
*/
|
||||
api.preview.bind( 'changeset-saved', function( data ) {
|
||||
_.each( data.saved_changeset_values, function( value, settingId ) {
|
||||
var setting = api( settingId );
|
||||
if ( setting && _.isEqual( setting.get(), value ) ) {
|
||||
setting._dirty = false;
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
api.preview.bind( 'nonce-refresh', function( nonce ) {
|
||||
$.extend( api.settings.nonce, nonce );
|
||||
} );
|
||||
|
||||
/*
|
||||
* Send a message to the parent customize frame with a list of which
|
||||
* containers and controls are active.
|
||||
*/
|
||||
api.preview.send( 'ready', {
|
||||
currentUrl: api.settings.url.self,
|
||||
activePanels: api.settings.activePanels,
|
||||
activeSections: api.settings.activeSections,
|
||||
activeControls: api.settings.activeControls,
|
||||
settingValidities: api.settings.settingValidities
|
||||
} );
|
||||
|
||||
// Send ready when URL changes via JS.
|
||||
setInterval( api.keepAliveCurrentUrl, api.settings.timeouts.keepAliveSend );
|
||||
|
||||
// Display a loading indicator when preview is reloading, and remove on failure.
|
||||
api.preview.bind( 'loading-initiated', function () {
|
||||
$( 'body' ).addClass( 'wp-customizer-unloading' );
|
||||
});
|
||||
api.preview.bind( 'loading-failed', function () {
|
||||
$( 'body' ).removeClass( 'wp-customizer-unloading' );
|
||||
});
|
||||
|
||||
/* Custom Backgrounds */
|
||||
bg = $.map( ['color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment'], function( prop ) {
|
||||
return 'background_' + prop;
|
||||
} );
|
||||
|
||||
api.when.apply( api, bg ).done( function() {
|
||||
$.each( arguments, function() {
|
||||
this.bind( api.settingPreviewHandlers.background );
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Custom Logo
|
||||
*
|
||||
* Toggle the wp-custom-logo body class when a logo is added or removed.
|
||||
*
|
||||
* @since 4.5.0
|
||||
*/
|
||||
api( 'custom_logo', function ( setting ) {
|
||||
api.settingPreviewHandlers.custom_logo.call( setting, setting.get() );
|
||||
setting.bind( api.settingPreviewHandlers.custom_logo );
|
||||
} );
|
||||
|
||||
api( 'custom_css[' + api.settings.theme.stylesheet + ']', function( setting ) {
|
||||
setting.bind( api.settingPreviewHandlers.custom_css );
|
||||
} );
|
||||
|
||||
api.trigger( 'preview-ready' );
|
||||
});
|
||||
|
||||
})( wp, jQuery );
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(r){var s,i,a,o,c,n,u,l,d,h=wp.customize,p={};(i=history).replaceState&&(c=function(e){var t,n=document.createElement("a");return n.href=e,e=h.utils.parseQueryString(location.search.substr(1)),(t=h.utils.parseQueryString(n.search.substr(1))).customize_changeset_uuid=e.customize_changeset_uuid,e.customize_autosaved&&(t.customize_autosaved="on"),e.customize_theme&&(t.customize_theme=e.customize_theme),e.customize_messenger_channel&&(t.customize_messenger_channel=e.customize_messenger_channel),n.search=r.param(t),n.href},i.replaceState=(a=i.replaceState,function(e,t,n){return p=e,a.call(i,e,t,"string"==typeof n&&0<n.length?c(n):n)}),i.pushState=(o=i.pushState,function(e,t,n){return p=e,o.call(i,e,t,"string"==typeof n&&0<n.length?c(n):n)}),window.addEventListener("popstate",function(e){p=e.state})),s=function(t,n,i){var s;return function(){var e=arguments;i=i||this,clearTimeout(s),s=setTimeout(function(){s=null,t.apply(i,e)},n)}},h.Preview=h.Messenger.extend({initialize:function(e,t){var n=this,i=document.createElement("a");h.Messenger.prototype.initialize.call(n,e,t),i.href=n.origin(),n.add("scheme",i.protocol.replace(/:$/,"")),n.body=r(document.body),n.window=r(window),h.settings.channel&&(n.body.on("click.preview","a",function(e){n.handleLinkClick(e)}),n.body.on("submit.preview","form",function(e){n.handleFormSubmit(e)}),n.window.on("scroll.preview",s(function(){n.send("scroll",n.window.scrollTop())},200)),n.bind("scroll",function(e){n.window.scrollTop(e)}))},handleLinkClick:function(e){var t=r(e.target).closest("a");_.isUndefined(t.attr("href"))||"#"!==t.attr("href").substr(0,1)&&/^https?:$/.test(t.prop("protocol"))&&(h.isLinkPreviewable(t[0])?(e.preventDefault(),e.shiftKey||this.send("url",t.prop("href"))):(wp.a11y.speak(h.settings.l10n.linkUnpreviewable),e.preventDefault()))},handleFormSubmit:function(e){var t=document.createElement("a"),n=r(e.target);t.href=n.prop("action"),"GET"===n.prop("method").toUpperCase()&&h.isLinkPreviewable(t)?e.isDefaultPrevented()||(1<t.search.length&&(t.search+="&"),t.search+=n.serialize(),this.send("url",t.href)):wp.a11y.speak(h.settings.l10n.formUnpreviewable),e.preventDefault()}}),h.addLinkPreviewing=function(){var t="a[href], area[href]";r(document.body).find(t).each(function(){h.prepareLinkPreview(this)}),"undefined"!=typeof MutationObserver?(h.mutationObserver=new MutationObserver(function(e){_.each(e,function(e){r(e.target).find(t).each(function(){h.prepareLinkPreview(this)})})}),h.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0})):r(document.documentElement).on("click focus mouseover",t,function(){h.prepareLinkPreview(this)})},h.isLinkPreviewable=function(t,e){var n,i,e=_.extend({},{allowAdminAjax:!1},e||{});return"javascript:"===t.protocol||("https:"===t.protocol||"http:"===t.protocol)&&(i=t.host.replace(/:(80|443)$/,""),n=document.createElement("a"),!_.isUndefined(_.find(h.settings.url.allowed,function(e){return n.href=e,n.protocol===t.protocol&&n.host.replace(/:(80|443)$/,"")===i&&0===t.pathname.indexOf(n.pathname.replace(/\/$/,""))})))&&!/\/wp-(login|signup)\.php$/.test(t.pathname)&&(/\/wp-admin\/admin-ajax\.php$/.test(t.pathname)?e.allowAdminAjax:!/\/wp-(admin|includes|content)(\/|$)/.test(t.pathname))},h.prepareLinkPreview=function(e){var t,n=r(e);e.hasAttribute("href")&&!n.closest("#wpadminbar").length&&"#"!==n.attr("href").substr(0,1)&&/^https?:$/.test(e.protocol)&&(h.settings.channel&&"https"===h.preview.scheme.get()&&"http:"===e.protocol&&-1!==h.settings.url.allowedHosts.indexOf(e.host)&&(e.protocol="https:"),n.hasClass("wp-playlist-caption")||(h.isLinkPreviewable(e)?(n.removeClass("customize-unpreviewable"),(t=h.utils.parseQueryString(e.search.substring(1))).customize_changeset_uuid=h.settings.changeset.uuid,h.settings.changeset.autosaved&&(t.customize_autosaved="on"),h.settings.theme.active||(t.customize_theme=h.settings.theme.stylesheet),h.settings.channel&&(t.customize_messenger_channel=h.settings.channel),e.search=r.param(t)):h.settings.channel&&n.addClass("customize-unpreviewable")))},h.addRequestPreviewing=function(){r.ajaxPrefilter(function(e,t,n){var i,s,a={},o=document.createElement("a");o.href=e.url,h.isLinkPreviewable(o,{allowAdminAjax:!0})&&(i=h.utils.parseQueryString(o.search.substring(1)),h.each(function(e){e._dirty&&(a[e.id]=e.get())}),_.isEmpty(a)||("POST"!==(s=e.type.toUpperCase())&&(n.setRequestHeader("X-HTTP-Method-Override",s),i._method=s,e.type="POST"),e.data?e.data+="&":e.data="",e.data+=r.param({customized:JSON.stringify(a)})),i.customize_changeset_uuid=h.settings.changeset.uuid,h.settings.changeset.autosaved&&(i.customize_autosaved="on"),h.settings.theme.active||(i.customize_theme=h.settings.theme.stylesheet),i.customize_preview_nonce=h.settings.nonce.preview,o.search=r.param(i),e.url=o.href)})},h.addFormPreviewing=function(){r(document.body).find("form").each(function(){h.prepareFormPreview(this)}),"undefined"!=typeof MutationObserver&&(h.mutationObserver=new MutationObserver(function(e){_.each(eLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
wp.customize.selectiveRefresh=function(o,r){"use strict";var t,s,c={ready:o.Deferred(),editShortcutVisibility:new r.Value,data:{partials:{},renderQueryVar:"",l10n:{shiftClickToEdit:""}},currentRequest:null};return _.extend(c,r.Events),t=c.Partial=r.Class.extend({id:null,defaults:{selector:null,primarySetting:null,containerInclusive:!1,fallbackRefresh:!0},initialize:function(e,t){var n=this;t=t||{},n.id=e,n.params=_.extend({settings:[]},n.defaults,t.params||t),n.deferred={},n.deferred.ready=o.Deferred(),n.deferred.ready.done(function(){n.ready()})},ready:function(){var n=this;_.each(n.placements(),function(e){o(e.container).attr("title",c.data.l10n.shiftClickToEdit),n.createEditShortcutForPlacement(e)}),o(document).on("click",n.params.selector,function(t){t.shiftKey&&(t.preventDefault(),_.each(n.placements(),function(e){o(e.container).is(t.currentTarget)&&n.showControl()}))})},createEditShortcutForPlacement:function(e){var t,n=this;!e.container||!(t=o(e.container)).length||t.is("area, audio, base, bdi, bdo, br, button, canvas, col, colgroup, command, datalist, embed, head, hr, html, iframe, img, input, keygen, label, link, map, math, menu, meta, noscript, object, optgroup, option, param, progress, rp, rt, ruby, script, select, source, style, svg, table, tbody, textarea, tfoot, thead, title, tr, track, video, wbr")||t.closest("head").length||((t=n.createEditShortcut()).on("click",function(e){e.preventDefault(),e.stopPropagation(),n.showControl()}),n.addEditShortcutToPlacement(e,t))},addEditShortcutToPlacement:function(e,t){e=o(e.container);e.prepend(t),e.is(":visible")&&"none"!==e.css("display")||t.addClass("customize-partial-edit-shortcut-hidden")},getEditShortcutClassName:function(){return"customize-partial-edit-shortcut-"+this.id.replace(/]/g,"").replace(/\[/g,"-")},getEditShortcutTitle:function(){var e=c.data.l10n;switch(this.getType()){case"widget":return e.clickEditWidget;case"blogname":case"blogdescription":return e.clickEditTitle;case"nav_menu":return e.clickEditMenu;default:return e.clickEditMisc}},getType:function(){var e=this,t=e.params.primarySetting||_.first(e.settings())||"unknown";return e.params.type||(t.match(/^nav_menu_instance\[/)?"nav_menu":t.match(/^widget_.+\[\d+]$/)?"widget":t)},createEditShortcut:function(){var e=this.getEditShortcutTitle(),t=o("<span>",{class:"customize-partial-edit-shortcut "+this.getEditShortcutClassName()}),e=o("<button>",{"aria-label":e,title:e,class:"customize-partial-edit-shortcut-button"}),n=o('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M13.89 3.39l2.71 2.72c.46.46.42 1.24.03 1.64l-8.01 8.02-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.03c.39-.39 1.22-.39 1.68.07zm-2.73 2.79l-5.59 5.61 1.11 1.11 5.54-5.65zm-2.97 8.23l5.58-5.6-1.07-1.08-5.59 5.6z"/></svg>');return e.append(n),t.append(e),t},placements:function(){var n=this,e=n.params.selector||"";return e&&(e+=", "),o(e+='[data-customize-partial-id="'+n.id+'"]').map(function(){var e=o(this),t=e.data("customize-partial-placement-context");if(_.isString(t)&&"{"===t.substr(0,1))throw new Error("context JSON parse error");return new s({partial:n,container:e,context:t})}).get()},settings:function(){var e=this;return e.params.settings&&0!==e.params.settings.length?e.params.settings:e.params.primarySetting?[e.params.primarySetting]:[e.id]},isRelatedSetting:function(e){return!!(e=_.isString(e)?r(e):e)&&-1!==_.indexOf(this.settings(),e.id)},showControl:function(){var e=this,t=(t=e.params.primarySetting)||_.first(e.settings());"nav_menu"===e.getType()&&(e.params.navMenuArgs.theme_location?t="nav_menu_locations["+e.params.navMenuArgs.theme_location+"]":e.params.navMenuArgs.menu&&(t="nav_menu["+String(e.params.navMenuArgs.menu)+"]")),r.preview.send("focus-control-for-setting",t)},preparePlacement:function(e){o(e.container).addClass("customize-partial-refreshing")},_pendingRefreshPromise:null,refresh:function(){var n=this,e=c.requestPartial(n);return n._pendingRefreshPromise||(_.each(n.placements(),function(e){n.preparePlacement(e)}),e.done(function(e){_.each(e,function(e){n.renderContent(e)})}),e.fail(function(e,t){n.fallback(e,t)}),(n._pendingRefreshPromise=e).always(function(){n._pendingRefreshPromise=null})),e},renderContent:function(t){var e,n,r=this;if(!t.container)return r.fallback(new Error("no_container"),[t]),!1;if(t.container=o(t.container),!1===t.addedContent)return r.fallback(new Error("missing_render"),[t]),!1;if(!_.isString(t.addedContent))return r.fallback(new Error("non_string_content"),[t]),!1;c.originalDocumentWrite=document.write,document.write=function(){throw new Error(c.data.l10n.badDocumentWrite)};try{if(e=t.addedContent,wp.emoji&&wp.emoji.parse&&!o.contains(document.head,t.container[0])&&(e=wp.emoji.parse(e)),r.params.containerInclusive)n=o(e),t.context=_.extend(t.context,n.data("customize-partial-placement-context")||{}),n.data("customize-partial-placement-context",t.context),t.removedNodes=t.container,t.container=n,t.removedNodes.replaceWith(t.container),t.container.attr("title",cLine truncated
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
* @output wp-includes/js/customize-views.js
|
||||
*/
|
||||
|
||||
(function( $, wp, _ ) {
|
||||
|
||||
if ( ! wp || ! wp.customize ) { return; }
|
||||
var api = wp.customize;
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.CurrentView
|
||||
*
|
||||
* Displays the currently selected header image, or a placeholder in lack
|
||||
* thereof.
|
||||
*
|
||||
* Instantiate with model wp.customize.HeaderTool.currentHeader.
|
||||
*
|
||||
* @memberOf wp.customize.HeaderTool
|
||||
* @alias wp.customize.HeaderTool.CurrentView
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.CurrentView = wp.Backbone.View.extend(/** @lends wp.customize.HeaderTool.CurrentView.prototype */{
|
||||
template: wp.template('header-current'),
|
||||
|
||||
initialize: function() {
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template(this.model.toJSON()));
|
||||
this.setButtons();
|
||||
return this;
|
||||
},
|
||||
|
||||
setButtons: function() {
|
||||
var elements = $('#customize-control-header_image .actions .remove');
|
||||
var addButton = $('#customize-control-header_image .actions .new');
|
||||
|
||||
if (this.model.get('choice')) {
|
||||
elements.show();
|
||||
addButton.removeClass('upload-button');
|
||||
} else {
|
||||
elements.hide();
|
||||
addButton.addClass('upload-button');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ChoiceView
|
||||
*
|
||||
* Represents a choosable header image, be it user-uploaded,
|
||||
* theme-suggested or a special Randomize choice.
|
||||
*
|
||||
* Takes a wp.customize.HeaderTool.ImageModel.
|
||||
*
|
||||
* Manually changes model wp.customize.HeaderTool.currentHeader via the
|
||||
* `select` method.
|
||||
*
|
||||
* @memberOf wp.customize.HeaderTool
|
||||
* @alias wp.customize.HeaderTool.ChoiceView
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.ChoiceView = wp.Backbone.View.extend(/** @lends wp.customize.HeaderTool.ChoiceView.prototype */{
|
||||
template: wp.template('header-choice'),
|
||||
|
||||
className: 'header-view',
|
||||
|
||||
events: {
|
||||
'click .choice,.random': 'select',
|
||||
'click .close': 'removeImage'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
var properties = [
|
||||
this.model.get('header').url,
|
||||
this.model.get('choice')
|
||||
];
|
||||
|
||||
this.listenTo(this.model, 'change:selected', this.toggleSelected);
|
||||
|
||||
if (_.contains(properties, api.get().header_image)) {
|
||||
api.HeaderTool.currentHeader.set(this.extendedModel());
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html(this.template(this.extendedModel()));
|
||||
|
||||
this.toggleSelected();
|
||||
return this;
|
||||
},
|
||||
|
||||
toggleSelected: function() {
|
||||
this.$el.toggleClass('selected', this.model.get('selected'));
|
||||
},
|
||||
|
||||
extendedModel: function() {
|
||||
var c = this.model.get('collection');
|
||||
return _.extend(this.model.toJSON(), {
|
||||
type: c.type
|
||||
});
|
||||
},
|
||||
|
||||
select: function() {
|
||||
this.preventJump();
|
||||
this.model.save();
|
||||
api.HeaderTool.currentHeader.set(this.extendedModel());
|
||||
},
|
||||
|
||||
preventJump: function() {
|
||||
var container = $('.wp-full-overlay-sidebar-content'),
|
||||
scroll = container.scrollTop();
|
||||
|
||||
_.defer(function() {
|
||||
container.scrollTop(scroll);
|
||||
});
|
||||
},
|
||||
|
||||
removeImage: function(e) {
|
||||
e.stopPropagation();
|
||||
this.model.destroy();
|
||||
this.remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.ChoiceListView
|
||||
*
|
||||
* A container for ChoiceViews. These choices should be of one same type:
|
||||
* user-uploaded headers or theme-defined ones.
|
||||
*
|
||||
* Takes a wp.customize.HeaderTool.ChoiceList.
|
||||
*
|
||||
* @memberOf wp.customize.HeaderTool
|
||||
* @alias wp.customize.HeaderTool.ChoiceListView
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.ChoiceListView = wp.Backbone.View.extend(/** @lends wp.customize.HeaderTool.ChoiceListView.prototype */{
|
||||
initialize: function() {
|
||||
this.listenTo(this.collection, 'add', this.addOne);
|
||||
this.listenTo(this.collection, 'remove', this.render);
|
||||
this.listenTo(this.collection, 'sort', this.render);
|
||||
this.listenTo(this.collection, 'change', this.toggleList);
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.empty();
|
||||
this.collection.each(this.addOne, this);
|
||||
this.toggleList();
|
||||
},
|
||||
|
||||
addOne: function(choice) {
|
||||
var view;
|
||||
choice.set({ collection: this.collection });
|
||||
view = new api.HeaderTool.ChoiceView({ model: choice });
|
||||
this.$el.append(view.render().el);
|
||||
},
|
||||
|
||||
toggleList: function() {
|
||||
var title = this.$el.parents().prev('.customize-control-title'),
|
||||
randomButton = this.$el.find('.random').parent();
|
||||
if (this.collection.shouldHideTitle()) {
|
||||
title.add(randomButton).hide();
|
||||
} else {
|
||||
title.add(randomButton).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* wp.customize.HeaderTool.CombinedList
|
||||
*
|
||||
* Aggregates wp.customize.HeaderTool.ChoiceList collections (or any
|
||||
* Backbone object, really) and acts as a bus to feed them events.
|
||||
*
|
||||
* @memberOf wp.customize.HeaderTool
|
||||
* @alias wp.customize.HeaderTool.CombinedList
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.Backbone.View
|
||||
*/
|
||||
api.HeaderTool.CombinedList = wp.Backbone.View.extend(/** @lends wp.customize.HeaderTool.CombinedList.prototype */{
|
||||
initialize: function(collections) {
|
||||
this.collections = collections;
|
||||
this.on('all', this.propagate, this);
|
||||
},
|
||||
propagate: function(event, arg) {
|
||||
_.each(this.collections, function(collection) {
|
||||
collection.trigger(event, arg);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})( jQuery, window.wp, _ );
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(i,e,o){var t;e&&e.customize&&((t=e.customize).HeaderTool.CurrentView=e.Backbone.View.extend({template:e.template("header-current"),initialize:function(){this.listenTo(this.model,"change",this.render),this.render()},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.setButtons(),this},setButtons:function(){var e=i("#customize-control-header_image .actions .remove"),t=i("#customize-control-header_image .actions .new");this.model.get("choice")?(e.show(),t.removeClass("upload-button")):(e.hide(),t.addClass("upload-button"))}}),t.HeaderTool.ChoiceView=e.Backbone.View.extend({template:e.template("header-choice"),className:"header-view",events:{"click .choice,.random":"select","click .close":"removeImage"},initialize:function(){var e=[this.model.get("header").url,this.model.get("choice")];this.listenTo(this.model,"change:selected",this.toggleSelected),o.contains(e,t.get().header_image)&&t.HeaderTool.currentHeader.set(this.extendedModel())},render:function(){return this.$el.html(this.template(this.extendedModel())),this.toggleSelected(),this},toggleSelected:function(){this.$el.toggleClass("selected",this.model.get("selected"))},extendedModel:function(){var e=this.model.get("collection");return o.extend(this.model.toJSON(),{type:e.type})},select:function(){this.preventJump(),this.model.save(),t.HeaderTool.currentHeader.set(this.extendedModel())},preventJump:function(){var e=i(".wp-full-overlay-sidebar-content"),t=e.scrollTop();o.defer(function(){e.scrollTop(t)})},removeImage:function(e){e.stopPropagation(),this.model.destroy(),this.remove()}}),t.HeaderTool.ChoiceListView=e.Backbone.View.extend({initialize:function(){this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"remove",this.render),this.listenTo(this.collection,"sort",this.render),this.listenTo(this.collection,"change",this.toggleList),this.render()},render:function(){this.$el.empty(),this.collection.each(this.addOne,this),this.toggleList()},addOne:function(e){e.set({collection:this.collection}),e=new t.HeaderTool.ChoiceView({model:e}),this.$el.append(e.render().el)},toggleList:function(){var e=this.$el.parents().prev(".customize-control-title"),t=this.$el.find(".random").parent();this.collection.shouldHideTitle()?e.add(t).hide():e.add(t).show()}}),t.HeaderTool.CombinedList=e.Backbone.View.extend({initialize:function(e){this.collections=e,this.on("all",this.propagate,this)},propagate:function(t,i){o.each(this.collections,function(e){e.trigger(t,i)})}}))}(jQuery,window.wp,_);
|
||||
Vendored
+156
@@ -0,0 +1,156 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).a11y = (() => {
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// package-external:@wordpress/dom-ready
|
||||
var require_dom_ready = __commonJS({
|
||||
"package-external:@wordpress/dom-ready"(exports, module) {
|
||||
module.exports = window.wp.domReady;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/i18n
|
||||
var require_i18n = __commonJS({
|
||||
"package-external:@wordpress/i18n"(exports, module) {
|
||||
module.exports = window.wp.i18n;
|
||||
}
|
||||
});
|
||||
|
||||
// packages/a11y/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
setup: () => setup,
|
||||
speak: () => speak
|
||||
});
|
||||
var import_dom_ready = __toESM(require_dom_ready(), 1);
|
||||
|
||||
// packages/a11y/build-module/script/add-container.mjs
|
||||
function addContainer(ariaLive = "polite") {
|
||||
const container = document.createElement("div");
|
||||
container.id = `a11y-speak-${ariaLive}`;
|
||||
container.className = "a11y-speak-region";
|
||||
container.setAttribute(
|
||||
"style",
|
||||
"position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
|
||||
);
|
||||
container.setAttribute("aria-live", ariaLive);
|
||||
container.setAttribute("aria-relevant", "additions text");
|
||||
container.setAttribute("aria-atomic", "true");
|
||||
const { body } = document;
|
||||
if (body) {
|
||||
body.appendChild(container);
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
// packages/a11y/build-module/script/add-intro-text.mjs
|
||||
var import_i18n = __toESM(require_i18n(), 1);
|
||||
function addIntroText() {
|
||||
const introText = document.createElement("p");
|
||||
introText.id = "a11y-speak-intro-text";
|
||||
introText.className = "a11y-speak-intro-text";
|
||||
introText.textContent = (0, import_i18n.__)("Notifications");
|
||||
introText.setAttribute(
|
||||
"style",
|
||||
"position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
|
||||
);
|
||||
introText.setAttribute("hidden", "");
|
||||
const { body } = document;
|
||||
if (body) {
|
||||
body.appendChild(introText);
|
||||
}
|
||||
return introText;
|
||||
}
|
||||
|
||||
// packages/a11y/build-module/shared/clear.mjs
|
||||
function clear() {
|
||||
const regions = document.getElementsByClassName("a11y-speak-region");
|
||||
const introText = document.getElementById("a11y-speak-intro-text");
|
||||
for (let i = 0; i < regions.length; i++) {
|
||||
regions[i].textContent = "";
|
||||
}
|
||||
if (introText) {
|
||||
introText.setAttribute("hidden", "hidden");
|
||||
}
|
||||
}
|
||||
|
||||
// packages/a11y/build-module/shared/filter-message.mjs
|
||||
var previousMessage = "";
|
||||
function filterMessage(message) {
|
||||
message = message.replace(/<[^<>]+>/g, " ");
|
||||
if (previousMessage === message) {
|
||||
message += "\xA0";
|
||||
}
|
||||
previousMessage = message;
|
||||
return message;
|
||||
}
|
||||
|
||||
// packages/a11y/build-module/shared/index.mjs
|
||||
function speak(message, ariaLive) {
|
||||
clear();
|
||||
message = filterMessage(message);
|
||||
const introText = document.getElementById("a11y-speak-intro-text");
|
||||
const containerAssertive = document.getElementById(
|
||||
"a11y-speak-assertive"
|
||||
);
|
||||
const containerPolite = document.getElementById("a11y-speak-polite");
|
||||
if (containerAssertive && ariaLive === "assertive") {
|
||||
containerAssertive.textContent = message;
|
||||
} else if (containerPolite) {
|
||||
containerPolite.textContent = message;
|
||||
}
|
||||
if (introText) {
|
||||
introText.removeAttribute("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
// packages/a11y/build-module/index.mjs
|
||||
function setup() {
|
||||
const introText = document.getElementById("a11y-speak-intro-text");
|
||||
const containerAssertive = document.getElementById(
|
||||
"a11y-speak-assertive"
|
||||
);
|
||||
const containerPolite = document.getElementById("a11y-speak-polite");
|
||||
if (introText === null) {
|
||||
addIntroText();
|
||||
}
|
||||
if (containerAssertive === null) {
|
||||
addContainer("assertive");
|
||||
}
|
||||
if (containerPolite === null) {
|
||||
addContainer("polite");
|
||||
}
|
||||
}
|
||||
(0, import_dom_ready.default)(setup);
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
"use strict";var wp;(wp||={}).a11y=(()=>{var v=Object.create;var r=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var d=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),B=(t,e)=>{for(var n in e)r(t,n,{get:e[n],enumerable:!0})},s=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E(e))!I.call(t,o)&&o!==n&&r(t,o,{get:()=>e[o],enumerable:!(i=A(e,o))||i.enumerable});return t};var p=(t,e,n)=>(n=t!=null?v(C(t)):{},s(e||!t||!t.__esModule?r(n,"default",{value:t,enumerable:!0}):n,t)),T=t=>s(r({},"__esModule",{value:!0}),t);var c=d((P,l)=>{l.exports=window.wp.domReady});var u=d((_,m)=>{m.exports=window.wp.i18n});var N={};B(N,{setup:()=>w,speak:()=>g});var k=p(c(),1);function a(t="polite"){let e=document.createElement("div");e.id=`a11y-speak-${t}`,e.className="a11y-speak-region",e.setAttribute("style","position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"),e.setAttribute("aria-live",t),e.setAttribute("aria-relevant","additions text"),e.setAttribute("aria-atomic","true");let{body:n}=document;return n&&n.appendChild(e),e}var f=p(u(),1);function x(){let t=document.createElement("p");t.id="a11y-speak-intro-text",t.className="a11y-speak-intro-text",t.textContent=(0,f.__)("Notifications"),t.setAttribute("style","position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"),t.setAttribute("hidden","");let{body:e}=document;return e&&e.appendChild(t),t}function y(){let t=document.getElementsByClassName("a11y-speak-region"),e=document.getElementById("a11y-speak-intro-text");for(let n=0;n<t.length;n++)t[n].textContent="";e&&e.setAttribute("hidden","hidden")}var h="";function b(t){return t=t.replace(/<[^<>]+>/g," "),h===t&&(t+="\xA0"),h=t,t}function g(t,e){y(),t=b(t);let n=document.getElementById("a11y-speak-intro-text"),i=document.getElementById("a11y-speak-assertive"),o=document.getElementById("a11y-speak-polite");i&&e==="assertive"?i.textContent=t:o&&(o.textContent=t),n&&n.removeAttribute("hidden")}function w(){let t=document.getElementById("a11y-speak-intro-text"),e=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");t===null&&x(),e===null&&a("assertive"),n===null&&a("polite")}(0,k.default)(w);return T(N);})();
|
||||
Vendored
+450
@@ -0,0 +1,450 @@
|
||||
var wp;
|
||||
(wp ||= {}).annotations = (() => {
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
for (var name2 in all)
|
||||
__defProp(target, name2, { get: all[name2], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// package-external:@wordpress/rich-text
|
||||
var require_rich_text = __commonJS({
|
||||
"package-external:@wordpress/rich-text"(exports, module) {
|
||||
module.exports = window.wp.richText;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/i18n
|
||||
var require_i18n = __commonJS({
|
||||
"package-external:@wordpress/i18n"(exports, module) {
|
||||
module.exports = window.wp.i18n;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/hooks
|
||||
var require_hooks = __commonJS({
|
||||
"package-external:@wordpress/hooks"(exports, module) {
|
||||
module.exports = window.wp.hooks;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/data
|
||||
var require_data = __commonJS({
|
||||
"package-external:@wordpress/data"(exports, module) {
|
||||
module.exports = window.wp.data;
|
||||
}
|
||||
});
|
||||
|
||||
// packages/annotations/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
store: () => store
|
||||
});
|
||||
|
||||
// packages/annotations/build-module/format/index.mjs
|
||||
var import_rich_text2 = __toESM(require_rich_text(), 1);
|
||||
|
||||
// packages/annotations/build-module/format/annotation.mjs
|
||||
var import_i18n = __toESM(require_i18n(), 1);
|
||||
var import_rich_text = __toESM(require_rich_text(), 1);
|
||||
|
||||
// packages/annotations/build-module/store/constants.mjs
|
||||
var STORE_NAME = "core/annotations";
|
||||
|
||||
// packages/annotations/build-module/format/annotation.mjs
|
||||
var FORMAT_NAME = "core/annotation";
|
||||
var ANNOTATION_ATTRIBUTE_PREFIX = "annotation-text-";
|
||||
function applyAnnotations(record, annotations2 = []) {
|
||||
annotations2.forEach((annotation2) => {
|
||||
let { start, end } = annotation2;
|
||||
if (start > record.text.length) {
|
||||
start = record.text.length;
|
||||
}
|
||||
if (end > record.text.length) {
|
||||
end = record.text.length;
|
||||
}
|
||||
const className = ANNOTATION_ATTRIBUTE_PREFIX + annotation2.source;
|
||||
const id = ANNOTATION_ATTRIBUTE_PREFIX + annotation2.id;
|
||||
record = (0, import_rich_text.applyFormat)(
|
||||
record,
|
||||
{
|
||||
type: FORMAT_NAME,
|
||||
attributes: {
|
||||
className,
|
||||
id
|
||||
}
|
||||
},
|
||||
start,
|
||||
end
|
||||
);
|
||||
});
|
||||
return record;
|
||||
}
|
||||
function retrieveAnnotationPositions(formats) {
|
||||
const positions = {};
|
||||
formats.forEach((characterFormats, i) => {
|
||||
characterFormats = characterFormats || [];
|
||||
characterFormats = characterFormats.filter(
|
||||
(format) => format.type === FORMAT_NAME
|
||||
);
|
||||
characterFormats.forEach((format) => {
|
||||
let { id } = format.attributes;
|
||||
id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, "");
|
||||
if (!positions.hasOwnProperty(id)) {
|
||||
positions[id] = {
|
||||
start: i
|
||||
};
|
||||
}
|
||||
positions[id].end = i + 1;
|
||||
});
|
||||
});
|
||||
return positions;
|
||||
}
|
||||
function updateAnnotationsWithPositions(annotations2, positions, { removeAnnotation, updateAnnotationRange }) {
|
||||
annotations2.forEach((currentAnnotation) => {
|
||||
const position = positions[currentAnnotation.id];
|
||||
if (!position) {
|
||||
removeAnnotation(currentAnnotation.id);
|
||||
return;
|
||||
}
|
||||
const { start, end } = currentAnnotation;
|
||||
if (start !== position.start || end !== position.end) {
|
||||
updateAnnotationRange(
|
||||
currentAnnotation.id,
|
||||
position.start,
|
||||
position.end
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
var annotation = {
|
||||
name: FORMAT_NAME,
|
||||
title: (0, import_i18n.__)("Annotation"),
|
||||
tagName: "mark",
|
||||
className: "annotation-text",
|
||||
attributes: {
|
||||
className: "class",
|
||||
id: "id"
|
||||
},
|
||||
edit() {
|
||||
return null;
|
||||
},
|
||||
__experimentalGetPropsForEditableTreePreparation(select, { richTextIdentifier, blockClientId }) {
|
||||
return {
|
||||
annotations: select(
|
||||
STORE_NAME
|
||||
).__experimentalGetAnnotationsForRichText(
|
||||
blockClientId,
|
||||
richTextIdentifier
|
||||
)
|
||||
};
|
||||
},
|
||||
__experimentalCreatePrepareEditableTree({ annotations: annotations2 }) {
|
||||
return (formats, text) => {
|
||||
if (annotations2.length === 0) {
|
||||
return formats;
|
||||
}
|
||||
let record = { formats, text };
|
||||
record = applyAnnotations(record, annotations2);
|
||||
return record.formats;
|
||||
};
|
||||
},
|
||||
__experimentalGetPropsForEditableTreeChangeHandler(dispatch) {
|
||||
return {
|
||||
removeAnnotation: dispatch(STORE_NAME).__experimentalRemoveAnnotation,
|
||||
updateAnnotationRange: dispatch(STORE_NAME).__experimentalUpdateAnnotationRange
|
||||
};
|
||||
},
|
||||
__experimentalCreateOnChangeEditableValue(props) {
|
||||
return (formats) => {
|
||||
const positions = retrieveAnnotationPositions(formats);
|
||||
const { removeAnnotation, updateAnnotationRange, annotations: annotations2 } = props;
|
||||
updateAnnotationsWithPositions(annotations2, positions, {
|
||||
removeAnnotation,
|
||||
updateAnnotationRange
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// packages/annotations/build-module/format/index.mjs
|
||||
var { name, ...settings } = annotation;
|
||||
(0, import_rich_text2.registerFormatType)(name, settings);
|
||||
|
||||
// packages/annotations/build-module/block/index.mjs
|
||||
var import_hooks = __toESM(require_hooks(), 1);
|
||||
var import_data = __toESM(require_data(), 1);
|
||||
var addAnnotationClassName = (OriginalComponent) => {
|
||||
return (0, import_data.withSelect)((select, { clientId, className }) => {
|
||||
const annotations2 = select(STORE_NAME).__experimentalGetAnnotationsForBlock(
|
||||
clientId
|
||||
);
|
||||
return {
|
||||
className: annotations2.map((annotation2) => {
|
||||
return "is-annotated-by-" + annotation2.source;
|
||||
}).concat(className).filter(Boolean).join(" ")
|
||||
};
|
||||
})(OriginalComponent);
|
||||
};
|
||||
(0, import_hooks.addFilter)(
|
||||
"editor.BlockListBlock",
|
||||
"core/annotations",
|
||||
addAnnotationClassName
|
||||
);
|
||||
|
||||
// packages/annotations/build-module/store/index.mjs
|
||||
var import_data3 = __toESM(require_data(), 1);
|
||||
|
||||
// packages/annotations/build-module/store/reducer.mjs
|
||||
function filterWithReference(collection, predicate) {
|
||||
const filteredCollection = collection.filter(predicate);
|
||||
return collection.length === filteredCollection.length ? collection : filteredCollection;
|
||||
}
|
||||
var mapValues = (obj, callback) => Object.entries(obj).reduce(
|
||||
(acc, [key, value]) => ({
|
||||
...acc,
|
||||
[key]: callback(value)
|
||||
}),
|
||||
{}
|
||||
);
|
||||
function isValidAnnotationRange(annotation2) {
|
||||
return typeof annotation2.start === "number" && typeof annotation2.end === "number" && annotation2.start <= annotation2.end;
|
||||
}
|
||||
function annotations(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case "ANNOTATION_ADD":
|
||||
const blockClientId = action.blockClientId;
|
||||
const newAnnotation = {
|
||||
id: action.id,
|
||||
blockClientId,
|
||||
richTextIdentifier: action.richTextIdentifier,
|
||||
source: action.source,
|
||||
selector: action.selector,
|
||||
range: action.range
|
||||
};
|
||||
if (newAnnotation.selector === "range" && !isValidAnnotationRange(newAnnotation.range)) {
|
||||
return state;
|
||||
}
|
||||
const previousAnnotationsForBlock = state?.[blockClientId] ?? [];
|
||||
return {
|
||||
...state,
|
||||
[blockClientId]: [
|
||||
...previousAnnotationsForBlock,
|
||||
newAnnotation
|
||||
]
|
||||
};
|
||||
case "ANNOTATION_REMOVE":
|
||||
return mapValues(state, (annotationsForBlock) => {
|
||||
return filterWithReference(
|
||||
annotationsForBlock,
|
||||
(annotation2) => {
|
||||
return annotation2.id !== action.annotationId;
|
||||
}
|
||||
);
|
||||
});
|
||||
case "ANNOTATION_UPDATE_RANGE":
|
||||
return mapValues(state, (annotationsForBlock) => {
|
||||
let hasChangedRange = false;
|
||||
const newAnnotations = annotationsForBlock.map(
|
||||
(annotation2) => {
|
||||
if (annotation2.id === action.annotationId) {
|
||||
hasChangedRange = true;
|
||||
return {
|
||||
...annotation2,
|
||||
range: {
|
||||
start: action.start,
|
||||
end: action.end
|
||||
}
|
||||
};
|
||||
}
|
||||
return annotation2;
|
||||
}
|
||||
);
|
||||
return hasChangedRange ? newAnnotations : annotationsForBlock;
|
||||
});
|
||||
case "ANNOTATION_REMOVE_SOURCE":
|
||||
return mapValues(state, (annotationsForBlock) => {
|
||||
return filterWithReference(
|
||||
annotationsForBlock,
|
||||
(annotation2) => {
|
||||
return annotation2.source !== action.source;
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
return state;
|
||||
}
|
||||
var reducer_default = annotations;
|
||||
|
||||
// packages/annotations/build-module/store/selectors.mjs
|
||||
var selectors_exports = {};
|
||||
__export(selectors_exports, {
|
||||
__experimentalGetAllAnnotationsForBlock: () => __experimentalGetAllAnnotationsForBlock,
|
||||
__experimentalGetAnnotations: () => __experimentalGetAnnotations,
|
||||
__experimentalGetAnnotationsForBlock: () => __experimentalGetAnnotationsForBlock,
|
||||
__experimentalGetAnnotationsForRichText: () => __experimentalGetAnnotationsForRichText
|
||||
});
|
||||
var import_data2 = __toESM(require_data(), 1);
|
||||
var EMPTY_ARRAY = [];
|
||||
var __experimentalGetAnnotationsForBlock = (0, import_data2.createSelector)(
|
||||
(state, blockClientId) => {
|
||||
return (state?.[blockClientId] ?? []).filter((annotation2) => {
|
||||
return annotation2.selector === "block";
|
||||
});
|
||||
},
|
||||
(state, blockClientId) => [state?.[blockClientId] ?? EMPTY_ARRAY]
|
||||
);
|
||||
function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
|
||||
return state?.[blockClientId] ?? EMPTY_ARRAY;
|
||||
}
|
||||
var __experimentalGetAnnotationsForRichText = (0, import_data2.createSelector)(
|
||||
(state, blockClientId, richTextIdentifier) => {
|
||||
return (state?.[blockClientId] ?? []).filter((annotation2) => {
|
||||
return annotation2.selector === "range" && richTextIdentifier === annotation2.richTextIdentifier;
|
||||
}).map((annotation2) => {
|
||||
const { range, ...other } = annotation2;
|
||||
return {
|
||||
...range,
|
||||
...other
|
||||
};
|
||||
});
|
||||
},
|
||||
(state, blockClientId) => [state?.[blockClientId] ?? EMPTY_ARRAY]
|
||||
);
|
||||
function __experimentalGetAnnotations(state) {
|
||||
return Object.values(state).flat();
|
||||
}
|
||||
|
||||
// packages/annotations/build-module/store/actions.mjs
|
||||
var actions_exports = {};
|
||||
__export(actions_exports, {
|
||||
__experimentalAddAnnotation: () => __experimentalAddAnnotation,
|
||||
__experimentalRemoveAnnotation: () => __experimentalRemoveAnnotation,
|
||||
__experimentalRemoveAnnotationsBySource: () => __experimentalRemoveAnnotationsBySource,
|
||||
__experimentalUpdateAnnotationRange: () => __experimentalUpdateAnnotationRange
|
||||
});
|
||||
|
||||
// node_modules/uuid/dist/esm-browser/rng.js
|
||||
var getRandomValues;
|
||||
var rnds8 = new Uint8Array(16);
|
||||
function rng() {
|
||||
if (!getRandomValues) {
|
||||
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/uuid/dist/esm-browser/stringify.js
|
||||
var byteToHex = [];
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
byteToHex.push((i + 256).toString(16).slice(1));
|
||||
}
|
||||
function unsafeStringify(arr, offset = 0) {
|
||||
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]];
|
||||
}
|
||||
|
||||
// node_modules/uuid/dist/esm-browser/native.js
|
||||
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
||||
var native_default = {
|
||||
randomUUID
|
||||
};
|
||||
|
||||
// node_modules/uuid/dist/esm-browser/v4.js
|
||||
function v4(options, buf, offset) {
|
||||
if (native_default.randomUUID && !buf && !options) {
|
||||
return native_default.randomUUID();
|
||||
}
|
||||
options = options || {};
|
||||
const rnds = options.random || (options.rng || rng)();
|
||||
rnds[6] = rnds[6] & 15 | 64;
|
||||
rnds[8] = rnds[8] & 63 | 128;
|
||||
if (buf) {
|
||||
offset = offset || 0;
|
||||
for (let i = 0; i < 16; ++i) {
|
||||
buf[offset + i] = rnds[i];
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
return unsafeStringify(rnds);
|
||||
}
|
||||
var v4_default = v4;
|
||||
|
||||
// packages/annotations/build-module/store/actions.mjs
|
||||
function __experimentalAddAnnotation({
|
||||
blockClientId,
|
||||
richTextIdentifier = null,
|
||||
range = null,
|
||||
selector = "range",
|
||||
source = "default",
|
||||
id = v4_default()
|
||||
}) {
|
||||
const action = {
|
||||
type: "ANNOTATION_ADD",
|
||||
id,
|
||||
blockClientId,
|
||||
richTextIdentifier,
|
||||
source,
|
||||
selector
|
||||
};
|
||||
if (selector === "range") {
|
||||
action.range = range;
|
||||
}
|
||||
return action;
|
||||
}
|
||||
function __experimentalRemoveAnnotation(annotationId) {
|
||||
return {
|
||||
type: "ANNOTATION_REMOVE",
|
||||
annotationId
|
||||
};
|
||||
}
|
||||
function __experimentalUpdateAnnotationRange(annotationId, start, end) {
|
||||
return {
|
||||
type: "ANNOTATION_UPDATE_RANGE",
|
||||
annotationId,
|
||||
start,
|
||||
end
|
||||
};
|
||||
}
|
||||
function __experimentalRemoveAnnotationsBySource(source) {
|
||||
return {
|
||||
type: "ANNOTATION_REMOVE_SOURCE",
|
||||
source
|
||||
};
|
||||
}
|
||||
|
||||
// packages/annotations/build-module/store/index.mjs
|
||||
var store = (0, import_data3.createReduxStore)(STORE_NAME, {
|
||||
reducer: reducer_default,
|
||||
selectors: selectors_exports,
|
||||
actions: actions_exports
|
||||
});
|
||||
(0, import_data3.register)(store);
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
var wp;(wp||={}).annotations=(()=>{var X=Object.create;var l=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),_=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of z(e))!K.call(t,o)&&o!==n&&l(t,o,{get:()=>e[o],enumerable:!(r=q(e,o))||r.enumerable});return t};var s=(t,e,n)=>(n=t!=null?X(J(t)):{},S(e||!t||!t.__esModule?l(n,"default",{value:t,enumerable:!0}):n,t)),Q=t=>S(l({},"__esModule",{value:!0}),t);var g=m((Nt,D)=>{D.exports=window.wp.richText});var M=m((Tt,C)=>{C.exports=window.wp.i18n});var F=m((Ot,G)=>{G.exports=window.wp.hooks});var d=m((ht,B)=>{B.exports=window.wp.data});var _t={};_(_t,{store:()=>b});var k=s(g(),1);var P=s(M(),1),T=s(g(),1);var p="core/annotations";var E="core/annotation",N="annotation-text-";function Z(t,e=[]){return e.forEach(n=>{let{start:r,end:o}=n;r>t.text.length&&(r=t.text.length),o>t.text.length&&(o=t.text.length);let i=N+n.source,u=N+n.id;t=(0,T.applyFormat)(t,{type:E,attributes:{className:i,id:u}},r,o)}),t}function $(t){let e={};return t.forEach((n,r)=>{n=n||[],n=n.filter(o=>o.type===E),n.forEach(o=>{let{id:i}=o.attributes;i=i.replace(N,""),e.hasOwnProperty(i)||(e[i]={start:r}),e[i].end=r+1})}),e}function tt(t,e,{removeAnnotation:n,updateAnnotationRange:r}){t.forEach(o=>{let i=e[o.id];if(!i){n(o.id);return}let{start:u,end:x}=o;(u!==i.start||x!==i.end)&&r(o.id,i.start,i.end)})}var V={name:E,title:(0,P.__)("Annotation"),tagName:"mark",className:"annotation-text",attributes:{className:"class",id:"id"},edit(){return null},__experimentalGetPropsForEditableTreePreparation(t,{richTextIdentifier:e,blockClientId:n}){return{annotations:t(p).__experimentalGetAnnotationsForRichText(n,e)}},__experimentalCreatePrepareEditableTree({annotations:t}){return(e,n)=>{if(t.length===0)return e;let r={formats:e,text:n};return r=Z(r,t),r.formats}},__experimentalGetPropsForEditableTreeChangeHandler(t){return{removeAnnotation:t(p).__experimentalRemoveAnnotation,updateAnnotationRange:t(p).__experimentalUpdateAnnotationRange}},__experimentalCreateOnChangeEditableValue(t){return e=>{let n=$(e),{removeAnnotation:r,updateAnnotationRange:o,annotations:i}=t;tt(i,n,{removeAnnotation:r,updateAnnotationRange:o})}}};var{name:et,...nt}=V;(0,k.registerFormatType)(et,nt);var j=s(F(),1),H=s(d(),1);var rt=t=>(0,H.withSelect)((e,{clientId:n,className:r})=>({className:e(p).__experimentalGetAnnotationsForBlock(n).map(i=>"is-annotated-by-"+i.source).concat(r).filter(Boolean).join(" ")}))(t);(0,j.addFilter)("editor.BlockListBlock","core/annotations",rt);var f=s(d(),1);function L(t,e){let n=t.filter(e);return t.length===n.length?t:n}var v=(t,e)=>Object.entries(t).reduce((n,[r,o])=>({...n,[r]:e(o)}),{});function ot(t){return typeof t.start=="number"&&typeof t.end=="number"&&t.start<=t.end}function it(t={},e){switch(e.type){case"ANNOTATION_ADD":let n=e.blockClientId,r={id:e.id,blockClientId:n,richTextIdentifier:e.richTextIdentifier,source:e.source,selector:e.selector,range:e.range};if(r.selector==="range"&&!ot(r.range))return t;let o=t?.[n]??[];return{...t,[n]:[...o,r]};case"ANNOTATION_REMOVE":return v(t,i=>L(i,u=>u.id!==e.annotationId));case"ANNOTATION_UPDATE_RANGE":return v(t,i=>{let u=!1,x=i.map(A=>A.id===e.annotationId?(u=!0,{...A,range:{start:e.start,end:e.end}}):A);return u?x:i});case"ANNOTATION_REMOVE_SOURCE":return v(t,i=>L(i,u=>u.source!==e.source))}return t}var W=it;var O={};_(O,{__experimentalGetAllAnnotationsForBlock:()=>ut,__experimentalGetAnnotations:()=>st,__experimentalGetAnnotationsForBlock:()=>at,__experimentalGetAnnotationsForRichText:()=>pt});var R=s(d(),1),y=[],at=(0,R.createSelector)((t,e)=>(t?.[e]??[]).filter(n=>n.selector==="block"),(t,e)=>[t?.[e]??y]);function ut(t,e){return t?.[e]??y}var pt=(0,R.createSelector)((t,e,n)=>(t?.[e]??[]).filter(r=>r.selector==="range"&&n===r.richTextIdentifier).map(r=>{let{range:o,...i}=r;return{...o,...i}}),(t,e)=>[t?.[e]??y]);function st(t){return Object.values(t).flat()}var U={};_(U,{__experimentalAddAnnotation:()=>ct,__experimentalRemoveAnnotation:()=>ft,__experimentalRemoveAnnotationsBySource:()=>At,__experimentalUpdateAnnotationRange:()=>xt});var c,lt=new Uint8Array(16);function h(){if(!c&&(c=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(lt)}var a=[];for(let t=0;t<256;++t)a.push((t+256).toString(16).slice(1));function Y(t,e=0){return a[t[e+0]]+a[t[e+1]]+a[t[e+2]]+a[t[e+3]]+"-"+a[t[e+4]]+a[t[e+5]]+"-"+a[t[e+6]]+a[t[e+7]]+"-"+a[t[e+8]]+a[t[e+9]]+"-"+a[t[e+10]]+a[t[e+11]]+a[t[e+12]]+a[t[e+13]]+a[t[e+14]]+a[t[e+15]]}var mt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),I={randomUUID:mt};function dt(t,e,n){if(I.randomUUID&&!e&&!t)return I.Line truncated
|
||||
Vendored
+525
@@ -0,0 +1,525 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).apiFetch = (() => {
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// package-external:@wordpress/i18n
|
||||
var require_i18n = __commonJS({
|
||||
"package-external:@wordpress/i18n"(exports, module) {
|
||||
module.exports = window.wp.i18n;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/url
|
||||
var require_url = __commonJS({
|
||||
"package-external:@wordpress/url"(exports, module) {
|
||||
module.exports = window.wp.url;
|
||||
}
|
||||
});
|
||||
|
||||
// packages/api-fetch/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
default: () => index_default
|
||||
});
|
||||
var import_i18n3 = __toESM(require_i18n(), 1);
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/nonce.mjs
|
||||
function createNonceMiddleware(nonce) {
|
||||
const middleware = (options, next) => {
|
||||
const { headers = {} } = options;
|
||||
for (const headerName in headers) {
|
||||
if (headerName.toLowerCase() === "x-wp-nonce" && headers[headerName] === middleware.nonce) {
|
||||
return next(options);
|
||||
}
|
||||
}
|
||||
return next({
|
||||
...options,
|
||||
headers: {
|
||||
...headers,
|
||||
"X-WP-Nonce": middleware.nonce
|
||||
}
|
||||
});
|
||||
};
|
||||
middleware.nonce = nonce;
|
||||
return middleware;
|
||||
}
|
||||
var nonce_default = createNonceMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/namespace-endpoint.mjs
|
||||
var namespaceAndEndpointMiddleware = (options, next) => {
|
||||
let path = options.path;
|
||||
let namespaceTrimmed, endpointTrimmed;
|
||||
if (typeof options.namespace === "string" && typeof options.endpoint === "string") {
|
||||
namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, "");
|
||||
endpointTrimmed = options.endpoint.replace(/^\//, "");
|
||||
if (endpointTrimmed) {
|
||||
path = namespaceTrimmed + "/" + endpointTrimmed;
|
||||
} else {
|
||||
path = namespaceTrimmed;
|
||||
}
|
||||
}
|
||||
delete options.namespace;
|
||||
delete options.endpoint;
|
||||
return next({
|
||||
...options,
|
||||
path
|
||||
});
|
||||
};
|
||||
var namespace_endpoint_default = namespaceAndEndpointMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/root-url.mjs
|
||||
var createRootURLMiddleware = (rootURL) => (options, next) => {
|
||||
return namespace_endpoint_default(options, (optionsWithPath) => {
|
||||
let url = optionsWithPath.url;
|
||||
let path = optionsWithPath.path;
|
||||
let apiRoot;
|
||||
if (typeof path === "string") {
|
||||
apiRoot = rootURL;
|
||||
if (-1 !== rootURL.indexOf("?")) {
|
||||
path = path.replace("?", "&");
|
||||
}
|
||||
path = path.replace(/^\//, "");
|
||||
if ("string" === typeof apiRoot && -1 !== apiRoot.indexOf("?")) {
|
||||
path = path.replace("?", "&");
|
||||
}
|
||||
url = apiRoot + path;
|
||||
}
|
||||
return next({
|
||||
...optionsWithPath,
|
||||
url
|
||||
});
|
||||
});
|
||||
};
|
||||
var root_url_default = createRootURLMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/preloading.mjs
|
||||
var import_url = __toESM(require_url(), 1);
|
||||
function createPreloadingMiddleware(preloadedData) {
|
||||
const cache = Object.fromEntries(
|
||||
Object.entries(preloadedData).map(([path, data]) => [
|
||||
(0, import_url.normalizePath)(path),
|
||||
data
|
||||
])
|
||||
);
|
||||
return (options, next) => {
|
||||
const { parse = true } = options;
|
||||
let rawPath = options.path;
|
||||
if (!rawPath && options.url) {
|
||||
const { rest_route: pathFromQuery, ...queryArgs } = (0, import_url.getQueryArgs)(
|
||||
options.url
|
||||
);
|
||||
if (typeof pathFromQuery === "string") {
|
||||
rawPath = (0, import_url.addQueryArgs)(pathFromQuery, queryArgs);
|
||||
}
|
||||
}
|
||||
if (typeof rawPath !== "string") {
|
||||
return next(options);
|
||||
}
|
||||
const method = options.method || "GET";
|
||||
const path = (0, import_url.normalizePath)(rawPath);
|
||||
if ("GET" === method && cache[path]) {
|
||||
const cacheData = cache[path];
|
||||
delete cache[path];
|
||||
return prepareResponse(cacheData, !!parse);
|
||||
} else if ("OPTIONS" === method && cache[method] && cache[method][path]) {
|
||||
const cacheData = cache[method][path];
|
||||
delete cache[method][path];
|
||||
return prepareResponse(cacheData, !!parse);
|
||||
}
|
||||
return next(options);
|
||||
};
|
||||
}
|
||||
function prepareResponse(responseData, parse) {
|
||||
if (parse) {
|
||||
return Promise.resolve(responseData.body);
|
||||
}
|
||||
try {
|
||||
return Promise.resolve(
|
||||
new window.Response(JSON.stringify(responseData.body), {
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
headers: responseData.headers
|
||||
})
|
||||
);
|
||||
} catch {
|
||||
Object.entries(
|
||||
responseData.headers
|
||||
).forEach(([key, value]) => {
|
||||
if (key.toLowerCase() === "link") {
|
||||
responseData.headers[key] = value.replace(
|
||||
/<([^>]+)>/,
|
||||
(_, url) => `<${encodeURI(url)}>`
|
||||
);
|
||||
}
|
||||
});
|
||||
return Promise.resolve(
|
||||
parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), {
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
headers: responseData.headers
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
var preloading_default = createPreloadingMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/fetch-all-middleware.mjs
|
||||
var import_url2 = __toESM(require_url(), 1);
|
||||
var modifyQuery = ({ path, url, ...options }, queryArgs) => ({
|
||||
...options,
|
||||
url: url && (0, import_url2.addQueryArgs)(url, queryArgs),
|
||||
path: path && (0, import_url2.addQueryArgs)(path, queryArgs)
|
||||
});
|
||||
var parseResponse = (response) => response.json ? response.json() : Promise.reject(response);
|
||||
var parseLinkHeader = (linkHeader) => {
|
||||
if (!linkHeader) {
|
||||
return {};
|
||||
}
|
||||
const match = linkHeader.match(/<([^>]+)>; rel="next"/);
|
||||
return match ? {
|
||||
next: match[1]
|
||||
} : {};
|
||||
};
|
||||
var getNextPageUrl = (response) => {
|
||||
const { next } = parseLinkHeader(response.headers.get("link"));
|
||||
return next;
|
||||
};
|
||||
var requestContainsUnboundedQuery = (options) => {
|
||||
const pathIsUnbounded = !!options.path && options.path.indexOf("per_page=-1") !== -1;
|
||||
const urlIsUnbounded = !!options.url && options.url.indexOf("per_page=-1") !== -1;
|
||||
return pathIsUnbounded || urlIsUnbounded;
|
||||
};
|
||||
var fetchAllMiddleware = async (options, next) => {
|
||||
if (options.parse === false) {
|
||||
return next(options);
|
||||
}
|
||||
if (!requestContainsUnboundedQuery(options)) {
|
||||
return next(options);
|
||||
}
|
||||
const response = await index_default({
|
||||
...modifyQuery(options, {
|
||||
per_page: 100
|
||||
}),
|
||||
// Ensure headers are returned for page 1.
|
||||
parse: false
|
||||
});
|
||||
const results = await parseResponse(response);
|
||||
if (!Array.isArray(results)) {
|
||||
return results;
|
||||
}
|
||||
let nextPage = getNextPageUrl(response);
|
||||
if (!nextPage) {
|
||||
return results;
|
||||
}
|
||||
let mergedResults = [].concat(results);
|
||||
while (nextPage) {
|
||||
const nextResponse = await index_default({
|
||||
...options,
|
||||
// Ensure the URL for the next page is used instead of any provided path.
|
||||
path: void 0,
|
||||
url: nextPage,
|
||||
// Ensure we still get headers so we can identify the next page.
|
||||
parse: false
|
||||
});
|
||||
const nextResults = await parseResponse(nextResponse);
|
||||
mergedResults = mergedResults.concat(nextResults);
|
||||
nextPage = getNextPageUrl(nextResponse);
|
||||
}
|
||||
return mergedResults;
|
||||
};
|
||||
var fetch_all_middleware_default = fetchAllMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/http-v1.mjs
|
||||
var OVERRIDE_METHODS = /* @__PURE__ */ new Set(["PATCH", "PUT", "DELETE"]);
|
||||
var DEFAULT_METHOD = "GET";
|
||||
var httpV1Middleware = (options, next) => {
|
||||
const { method = DEFAULT_METHOD } = options;
|
||||
if (OVERRIDE_METHODS.has(method.toUpperCase())) {
|
||||
options = {
|
||||
...options,
|
||||
headers: {
|
||||
...options.headers,
|
||||
"X-HTTP-Method-Override": method,
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
method: "POST"
|
||||
};
|
||||
}
|
||||
return next(options);
|
||||
};
|
||||
var http_v1_default = httpV1Middleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/user-locale.mjs
|
||||
var import_url3 = __toESM(require_url(), 1);
|
||||
var userLocaleMiddleware = (options, next) => {
|
||||
if (typeof options.url === "string" && !(0, import_url3.hasQueryArg)(options.url, "_locale")) {
|
||||
options.url = (0, import_url3.addQueryArgs)(options.url, { _locale: "user" });
|
||||
}
|
||||
if (typeof options.path === "string" && !(0, import_url3.hasQueryArg)(options.path, "_locale")) {
|
||||
options.path = (0, import_url3.addQueryArgs)(options.path, { _locale: "user" });
|
||||
}
|
||||
return next(options);
|
||||
};
|
||||
var user_locale_default = userLocaleMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/media-upload.mjs
|
||||
var import_i18n2 = __toESM(require_i18n(), 1);
|
||||
|
||||
// packages/api-fetch/build-module/utils/response.mjs
|
||||
var import_i18n = __toESM(require_i18n(), 1);
|
||||
async function parseJsonAndNormalizeError(response) {
|
||||
try {
|
||||
return await response.json();
|
||||
} catch {
|
||||
throw {
|
||||
code: "invalid_json",
|
||||
message: (0, import_i18n.__)("The response is not a valid JSON response.")
|
||||
};
|
||||
}
|
||||
}
|
||||
async function parseResponseAndNormalizeError(response, shouldParseResponse = true) {
|
||||
if (!shouldParseResponse) {
|
||||
return response;
|
||||
}
|
||||
if (response.status === 204) {
|
||||
return null;
|
||||
}
|
||||
return await parseJsonAndNormalizeError(response);
|
||||
}
|
||||
async function parseAndThrowError(response, shouldParseResponse = true) {
|
||||
if (!shouldParseResponse) {
|
||||
throw response;
|
||||
}
|
||||
throw await parseJsonAndNormalizeError(response);
|
||||
}
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/media-upload.mjs
|
||||
function isMediaUploadRequest(options) {
|
||||
const isCreateMethod = !!options.method && options.method === "POST";
|
||||
const isMediaEndpoint = !!options.path && options.path.indexOf("/wp/v2/media") !== -1 || !!options.url && options.url.indexOf("/wp/v2/media") !== -1;
|
||||
return isMediaEndpoint && isCreateMethod;
|
||||
}
|
||||
var mediaUploadMiddleware = (options, next) => {
|
||||
if (!isMediaUploadRequest(options)) {
|
||||
return next(options);
|
||||
}
|
||||
let retries = 0;
|
||||
const maxRetries = 5;
|
||||
const postProcess = (attachmentId) => {
|
||||
retries++;
|
||||
return next({
|
||||
path: `/wp/v2/media/${attachmentId}/post-process`,
|
||||
method: "POST",
|
||||
data: { action: "create-image-subsizes" },
|
||||
parse: false
|
||||
}).catch(() => {
|
||||
if (retries < maxRetries) {
|
||||
return postProcess(attachmentId);
|
||||
}
|
||||
next({
|
||||
path: `/wp/v2/media/${attachmentId}?force=true`,
|
||||
method: "DELETE"
|
||||
});
|
||||
return Promise.reject();
|
||||
});
|
||||
};
|
||||
return next({ ...options, parse: false }).catch((response) => {
|
||||
if (!(response instanceof globalThis.Response)) {
|
||||
return Promise.reject(response);
|
||||
}
|
||||
const attachmentId = response.headers.get(
|
||||
"x-wp-upload-attachment-id"
|
||||
);
|
||||
if (response.status >= 500 && response.status < 600 && attachmentId) {
|
||||
return postProcess(attachmentId).catch(() => {
|
||||
if (options.parse !== false) {
|
||||
return Promise.reject({
|
||||
code: "post_process",
|
||||
message: (0, import_i18n2.__)(
|
||||
"Media upload failed. If this is a photo or a large image, please scale it down and try again."
|
||||
)
|
||||
});
|
||||
}
|
||||
return Promise.reject(response);
|
||||
});
|
||||
}
|
||||
return parseAndThrowError(response, options.parse);
|
||||
}).then(
|
||||
(response) => parseResponseAndNormalizeError(response, options.parse)
|
||||
);
|
||||
};
|
||||
var media_upload_default = mediaUploadMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/middlewares/theme-preview.mjs
|
||||
var import_url4 = __toESM(require_url(), 1);
|
||||
var createThemePreviewMiddleware = (themePath) => (options, next) => {
|
||||
if (typeof options.url === "string") {
|
||||
const wpThemePreview = (0, import_url4.getQueryArg)(
|
||||
options.url,
|
||||
"wp_theme_preview"
|
||||
);
|
||||
if (wpThemePreview === void 0) {
|
||||
options.url = (0, import_url4.addQueryArgs)(options.url, {
|
||||
wp_theme_preview: themePath
|
||||
});
|
||||
} else if (wpThemePreview === "") {
|
||||
options.url = (0, import_url4.removeQueryArgs)(
|
||||
options.url,
|
||||
"wp_theme_preview"
|
||||
);
|
||||
}
|
||||
}
|
||||
if (typeof options.path === "string") {
|
||||
const wpThemePreview = (0, import_url4.getQueryArg)(
|
||||
options.path,
|
||||
"wp_theme_preview"
|
||||
);
|
||||
if (wpThemePreview === void 0) {
|
||||
options.path = (0, import_url4.addQueryArgs)(options.path, {
|
||||
wp_theme_preview: themePath
|
||||
});
|
||||
} else if (wpThemePreview === "") {
|
||||
options.path = (0, import_url4.removeQueryArgs)(
|
||||
options.path,
|
||||
"wp_theme_preview"
|
||||
);
|
||||
}
|
||||
}
|
||||
return next(options);
|
||||
};
|
||||
var theme_preview_default = createThemePreviewMiddleware;
|
||||
|
||||
// packages/api-fetch/build-module/index.mjs
|
||||
var DEFAULT_HEADERS = {
|
||||
// The backend uses the Accept header as a condition for considering an
|
||||
// incoming request as a REST request.
|
||||
//
|
||||
// See: https://core.trac.wordpress.org/ticket/44534
|
||||
Accept: "application/json, */*;q=0.1"
|
||||
};
|
||||
var DEFAULT_OPTIONS = {
|
||||
credentials: "include"
|
||||
};
|
||||
var middlewares = [
|
||||
user_locale_default,
|
||||
namespace_endpoint_default,
|
||||
http_v1_default,
|
||||
fetch_all_middleware_default
|
||||
];
|
||||
function registerMiddleware(middleware) {
|
||||
middlewares.unshift(middleware);
|
||||
}
|
||||
var defaultFetchHandler = (nextOptions) => {
|
||||
const { url, path, data, parse = true, ...remainingOptions } = nextOptions;
|
||||
let { body, headers } = nextOptions;
|
||||
headers = { ...DEFAULT_HEADERS, ...headers };
|
||||
if (data) {
|
||||
body = JSON.stringify(data);
|
||||
headers["Content-Type"] = "application/json";
|
||||
}
|
||||
const responsePromise = globalThis.fetch(
|
||||
// Fall back to explicitly passing `window.location` which is the behavior if `undefined` is passed.
|
||||
url || path || window.location.href,
|
||||
{
|
||||
...DEFAULT_OPTIONS,
|
||||
...remainingOptions,
|
||||
body,
|
||||
headers
|
||||
}
|
||||
);
|
||||
return responsePromise.then(
|
||||
(response) => {
|
||||
if (!response.ok) {
|
||||
return parseAndThrowError(response, parse);
|
||||
}
|
||||
return parseResponseAndNormalizeError(response, parse);
|
||||
},
|
||||
(err) => {
|
||||
if (err && err.name === "AbortError") {
|
||||
throw err;
|
||||
}
|
||||
if (!globalThis.navigator.onLine) {
|
||||
throw {
|
||||
code: "offline_error",
|
||||
message: (0, import_i18n3.__)(
|
||||
"Unable to connect. Please check your Internet connection."
|
||||
)
|
||||
};
|
||||
}
|
||||
throw {
|
||||
code: "fetch_error",
|
||||
message: (0, import_i18n3.__)(
|
||||
"Could not get a valid response from the server."
|
||||
)
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
var fetchHandler = defaultFetchHandler;
|
||||
function setFetchHandler(newFetchHandler) {
|
||||
fetchHandler = newFetchHandler;
|
||||
}
|
||||
var apiFetch = (options) => {
|
||||
const enhancedHandler = middlewares.reduceRight(
|
||||
(next, middleware) => {
|
||||
return (workingOptions) => middleware(workingOptions, next);
|
||||
},
|
||||
fetchHandler
|
||||
);
|
||||
return enhancedHandler(options).catch((error) => {
|
||||
if (error.code !== "rest_cookie_invalid_nonce") {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
return globalThis.fetch(apiFetch.nonceEndpoint).then((response) => {
|
||||
if (!response.ok) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
return response.text();
|
||||
}).then((text) => {
|
||||
apiFetch.nonceMiddleware.nonce = text;
|
||||
return apiFetch(options);
|
||||
});
|
||||
});
|
||||
};
|
||||
apiFetch.use = registerMiddleware;
|
||||
apiFetch.setFetchHandler = setFetchHandler;
|
||||
apiFetch.createNonceMiddleware = nonce_default;
|
||||
apiFetch.createPreloadingMiddleware = preloading_default;
|
||||
apiFetch.createRootURLMiddleware = root_url_default;
|
||||
apiFetch.fetchAllMiddleware = fetch_all_middleware_default;
|
||||
apiFetch.mediaUploadMiddleware = media_upload_default;
|
||||
apiFetch.createThemePreviewMiddleware = theme_preview_default;
|
||||
var index_default = apiFetch;
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
if (typeof wp.apiFetch === 'object' && wp.apiFetch.default) { wp.apiFetch = wp.apiFetch.default; }
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
"use strict";var wp;(wp||={}).apiFetch=(()=>{var $=Object.create;var w=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var A=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),X=(e,r)=>{for(var a in r)w(e,a,{get:r[a],enumerable:!0})},x=(e,r,a,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of G(r))!K.call(e,n)&&n!==a&&w(e,n,{get:()=>r[n],enumerable:!(t=q(r,n))||t.enumerable});return e};var f=(e,r,a)=>(a=e!=null?$(V(e)):{},x(r||!e||!e.__esModule?w(a,"default",{value:e,enumerable:!0}):a,e)),B=e=>x(w({},"__esModule",{value:!0}),e);var v=A((ge,O)=>{O.exports=window.wp.i18n});var p=A((Pe,j)=>{j.exports=window.wp.url});var ve={};X(ve,{default:()=>g});var P=f(v(),1);function Y(e){let r=(a,t)=>{let{headers:n={}}=a;for(let d in n)if(d.toLowerCase()==="x-wp-nonce"&&n[d]===r.nonce)return t(a);return t({...a,headers:{...n,"X-WP-Nonce":r.nonce}})};return r.nonce=e,r}var R=Y;var Z=(e,r)=>{let a=e.path,t,n;return typeof e.namespace=="string"&&typeof e.endpoint=="string"&&(t=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),n?a=t+"/"+n:a=t),delete e.namespace,delete e.endpoint,r({...e,path:a})},_=Z;var W=e=>(r,a)=>_(r,t=>{let n=t.url,d=t.path,i;return typeof d=="string"&&(i=e,e.indexOf("?")!==-1&&(d=d.replace("?","&")),d=d.replace(/^\//,""),typeof i=="string"&&i.indexOf("?")!==-1&&(d=d.replace("?","&")),n=i+d),a({...t,url:n})}),b=W;var m=f(p(),1);function ee(e){let r=Object.fromEntries(Object.entries(e).map(([a,t])=>[(0,m.normalizePath)(a),t]));return(a,t)=>{let{parse:n=!0}=a,d=a.path;if(!d&&a.url){let{rest_route:s,...o}=(0,m.getQueryArgs)(a.url);typeof s=="string"&&(d=(0,m.addQueryArgs)(s,o))}if(typeof d!="string")return t(a);let i=a.method||"GET",l=(0,m.normalizePath)(d);if(i==="GET"&&r[l]){let s=r[l];return delete r[l],U(s,!!n)}else if(i==="OPTIONS"&&r[i]&&r[i][l]){let s=r[i][l];return delete r[i][l],U(s,!!n)}return t(a)}}function U(e,r){if(r)return Promise.resolve(e.body);try{return Promise.resolve(new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}catch{return Object.entries(e.headers).forEach(([a,t])=>{a.toLowerCase()==="link"&&(e.headers[a]=t.replace(/<([^>]+)>/,(n,d)=>`<${encodeURI(d)}>`))}),Promise.resolve(r?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}}var N=ee;var M=f(p(),1);var re=({path:e,url:r,...a},t)=>({...a,url:r&&(0,M.addQueryArgs)(r,t),path:e&&(0,M.addQueryArgs)(e,t)}),L=e=>e.json?e.json():Promise.reject(e),ae=e=>{if(!e)return{};let r=e.match(/<([^>]+)>; rel="next"/);return r?{next:r[1]}:{}},S=e=>{let{next:r}=ae(e.headers.get("link"));return r},te=e=>{let r=!!e.path&&e.path.indexOf("per_page=-1")!==-1,a=!!e.url&&e.url.indexOf("per_page=-1")!==-1;return r||a},de=async(e,r)=>{if(e.parse===!1||!te(e))return r(e);let a=await g({...re(e,{per_page:100}),parse:!1}),t=await L(a);if(!Array.isArray(t))return t;let n=S(a);if(!n)return t;let d=[].concat(t);for(;n;){let i=await g({...e,path:void 0,url:n,parse:!1}),l=await L(i);d=d.concat(l),n=S(i)}return d},E=de;var ne=new Set(["PATCH","PUT","DELETE"]),ie="GET",le=(e,r)=>{let{method:a=ie}=e;return ne.has(a.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":a,"Content-Type":"application/json"},method:"POST"}),r(e)},H=le;var h=f(p(),1),ce=(e,r)=>(typeof e.url=="string"&&!(0,h.hasQueryArg)(e.url,"_locale")&&(e.url=(0,h.addQueryArgs)(e.url,{_locale:"user"})),typeof e.path=="string"&&!(0,h.hasQueryArg)(e.path,"_locale")&&(e.path=(0,h.addQueryArgs)(e.path,{_locale:"user"})),r(e)),Q=ce;var I=f(v(),1);var C=f(v(),1);async function F(e){try{return await e.json()}catch{throw{code:"invalid_json",message:(0,C.__)("The response is not a valid JSON response.")}}}async function y(e,r=!0){return r?e.status===204?null:await F(e):e}async function T(e,r=!0){throw r?await F(e):e}function oe(e){let r=!!e.method&&e.method==="POST";return(!!e.path&&e.path.indexOf("/wp/v2/media")!==-1||!!e.url&&e.url.indexOf("/wp/v2/media")!==-1)&&r}var ue=(e,r)=>{if(!oe(e))return r(e);let a=0,t=5,n=d=>(a++,r({path:`/wp/v2/media/${d}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch(()=>a<t?n(d):(r({path:`/wp/v2/media/${d}?force=true`,method:"DELETE"}),Promise.reject())));return r({...e,parse:!1}).catch(d=>{if(!(d instanceof globalThis.Response))return Promise.reject(d);let i=d.headers.get("x-wp-upload-attachment-id");return d.status>=500&&d.status<600&&i?n(i).catch(()=>e.parse!==!1?Promise.reject({code:"post_process",message:(0,I.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(d)):T(d,e.parse)}).then(d=>y(d,e.parse))},z=ue;var u=f(p(),1),se=e=>(r,a)=>{if(typeof r.url=="string"){let t=(0,u.getQueryArg)(r.url,"wp_theme_preview");t===void 0?r.url=(0,u.addQueryArgs)(r.url,{wp_theme_preview:e}):t===""&&(r.url=(0,u.removeQueryArgs)(r.url,"wp_theme_preview")Line truncated
|
||||
if (typeof wp.apiFetch === 'object' && wp.apiFetch.default) { wp.apiFetch = wp.apiFetch.default; }
|
||||
Vendored
+282
@@ -0,0 +1,282 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).autop = (() => {
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// packages/autop/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
autop: () => autop,
|
||||
removep: () => removep
|
||||
});
|
||||
var htmlSplitRegex = (() => {
|
||||
const comments = "!(?:-(?!->)[^\\-]*)*(?:-->)?";
|
||||
const cdata = "!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?";
|
||||
const escaped = "(?=!--|!\\[CDATA\\[)((?=!-)" + // If yes, which type?
|
||||
comments + "|" + cdata + ")";
|
||||
const regex = "(<(" + // Conditional expression follows.
|
||||
escaped + // Find end of escaped element.
|
||||
"|[^>]*>?))";
|
||||
return new RegExp(regex);
|
||||
})();
|
||||
function htmlSplit(input) {
|
||||
const parts = [];
|
||||
let workingInput = input;
|
||||
let match;
|
||||
while (match = workingInput.match(htmlSplitRegex)) {
|
||||
const index = match.index;
|
||||
parts.push(workingInput.slice(0, index));
|
||||
parts.push(match[0]);
|
||||
workingInput = workingInput.slice(index + match[0].length);
|
||||
}
|
||||
if (workingInput.length) {
|
||||
parts.push(workingInput);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
function replaceInHtmlTags(haystack, replacePairs) {
|
||||
const textArr = htmlSplit(haystack);
|
||||
let changed = false;
|
||||
const needles = Object.keys(replacePairs);
|
||||
for (let i = 1; i < textArr.length; i += 2) {
|
||||
for (let j = 0; j < needles.length; j++) {
|
||||
const needle = needles[j];
|
||||
if (-1 !== textArr[i].indexOf(needle)) {
|
||||
textArr[i] = textArr[i].replace(
|
||||
new RegExp(needle, "g"),
|
||||
replacePairs[needle]
|
||||
);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
haystack = textArr.join("");
|
||||
}
|
||||
return haystack;
|
||||
}
|
||||
function autop(text, br = true) {
|
||||
const preTags = [];
|
||||
if (text.trim() === "") {
|
||||
return "";
|
||||
}
|
||||
text = text + "\n";
|
||||
if (text.indexOf("<pre") !== -1) {
|
||||
const textParts = text.split("</pre>");
|
||||
const lastText = textParts.pop();
|
||||
text = "";
|
||||
for (let i = 0; i < textParts.length; i++) {
|
||||
const textPart = textParts[i];
|
||||
const start = textPart.indexOf("<pre");
|
||||
if (start === -1) {
|
||||
text += textPart;
|
||||
continue;
|
||||
}
|
||||
const name = "<pre wp-pre-tag-" + i + "></pre>";
|
||||
preTags.push([name, textPart.substr(start) + "</pre>"]);
|
||||
text += textPart.substr(0, start) + name;
|
||||
}
|
||||
text += lastText;
|
||||
}
|
||||
text = text.replace(/<br\s*\/?>\s*<br\s*\/?>/g, "\n\n");
|
||||
const allBlocks = "(?: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)";
|
||||
text = text.replace(
|
||||
new RegExp("(<" + allBlocks + "[\\s/>])", "g"),
|
||||
"\n\n$1"
|
||||
);
|
||||
text = text.replace(
|
||||
new RegExp("(</" + allBlocks + ">)", "g"),
|
||||
"$1\n\n"
|
||||
);
|
||||
text = text.replace(/\r\n|\r/g, "\n");
|
||||
text = replaceInHtmlTags(text, { "\n": " <!-- wpnl --> " });
|
||||
if (text.indexOf("<option") !== -1) {
|
||||
text = text.replace(/\s*<option/g, "<option");
|
||||
text = text.replace(/<\/option>\s*/g, "</option>");
|
||||
}
|
||||
if (text.indexOf("</object>") !== -1) {
|
||||
text = text.replace(/(<object[^>]*>)\s*/g, "$1");
|
||||
text = text.replace(/\s*<\/object>/g, "</object>");
|
||||
text = text.replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g, "$1");
|
||||
}
|
||||
if (text.indexOf("<source") !== -1 || text.indexOf("<track") !== -1) {
|
||||
text = text.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g, "$1");
|
||||
text = text.replace(/\s*([<\[]\/(?:audio|video)[>\]])/g, "$1");
|
||||
text = text.replace(/\s*(<(?:source|track)[^>]*>)\s*/g, "$1");
|
||||
}
|
||||
if (text.indexOf("<figcaption") !== -1) {
|
||||
text = text.replace(/\s*(<figcaption[^>]*>)/, "$1");
|
||||
text = text.replace(/<\/figcaption>\s*/, "</figcaption>");
|
||||
}
|
||||
text = text.replace(/\n\n+/g, "\n\n");
|
||||
const texts = text.split(/\n\s*\n/).filter(Boolean);
|
||||
text = "";
|
||||
texts.forEach((textPiece) => {
|
||||
text += "<p>" + textPiece.replace(/^\n*|\n*$/g, "") + "</p>\n";
|
||||
});
|
||||
text = text.replace(/<p>\s*<\/p>/g, "");
|
||||
text = text.replace(
|
||||
/<p>([^<]+)<\/(div|address|form)>/g,
|
||||
"<p>$1</p></$2>"
|
||||
);
|
||||
text = text.replace(
|
||||
new RegExp("<p>\\s*(</?" + allBlocks + "[^>]*>)\\s*</p>", "g"),
|
||||
"$1"
|
||||
);
|
||||
text = text.replace(/<p>(<li.+?)<\/p>/g, "$1");
|
||||
text = text.replace(/<p><blockquote([^>]*)>/gi, "<blockquote$1><p>");
|
||||
text = text.replace(/<\/blockquote><\/p>/g, "</p></blockquote>");
|
||||
text = text.replace(
|
||||
new RegExp("<p>\\s*(</?" + allBlocks + "[^>]*>)", "g"),
|
||||
"$1"
|
||||
);
|
||||
text = text.replace(
|
||||
new RegExp("(</?" + allBlocks + "[^>]*>)\\s*</p>", "g"),
|
||||
"$1"
|
||||
);
|
||||
if (br) {
|
||||
text = text.replace(
|
||||
/<(script|style).*?<\/\\1>/g,
|
||||
(match) => match[0].replace(/\n/g, "<WPPreserveNewline />")
|
||||
);
|
||||
text = text.replace(/<br>|<br\/>/g, "<br />");
|
||||
text = text.replace(
|
||||
/(<br \/>)?\s*\n/g,
|
||||
(a, b) => b ? a : "<br />\n"
|
||||
);
|
||||
text = text.replace(/<WPPreserveNewline \/>/g, "\n");
|
||||
}
|
||||
text = text.replace(
|
||||
new RegExp("(</?" + allBlocks + "[^>]*>)\\s*<br />", "g"),
|
||||
"$1"
|
||||
);
|
||||
text = text.replace(
|
||||
/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,
|
||||
"$1"
|
||||
);
|
||||
text = text.replace(/\n<\/p>$/g, "</p>");
|
||||
preTags.forEach((preTag) => {
|
||||
const [name, original] = preTag;
|
||||
text = text.replace(name, () => original);
|
||||
});
|
||||
if (-1 !== text.indexOf("<!-- wpnl -->")) {
|
||||
text = text.replace(/\s?<!-- wpnl -->\s?/g, "\n");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
function removep(html) {
|
||||
const blocklist = "blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure";
|
||||
const blocklist1 = blocklist + "|div|p";
|
||||
const blocklist2 = blocklist + "|pre";
|
||||
const preserve = [];
|
||||
let preserveLinebreaks = false;
|
||||
let preserveBr = false;
|
||||
if (!html) {
|
||||
return "";
|
||||
}
|
||||
if (html.indexOf("<script") !== -1 || html.indexOf("<style") !== -1) {
|
||||
html = html.replace(
|
||||
/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,
|
||||
(match) => {
|
||||
preserve.push(match);
|
||||
return "<wp-preserve>";
|
||||
}
|
||||
);
|
||||
}
|
||||
if (html.indexOf("<pre") !== -1) {
|
||||
preserveLinebreaks = true;
|
||||
html = html.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g, (a) => {
|
||||
a = a.replace(/<br ?\/?>(\r\n|\n)?/g, "<wp-line-break>");
|
||||
a = a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, "<wp-line-break>");
|
||||
return a.replace(/\r?\n/g, "<wp-line-break>");
|
||||
});
|
||||
}
|
||||
if (html.indexOf("[caption") !== -1) {
|
||||
preserveBr = true;
|
||||
html = html.replace(/\[caption[\s\S]+?\[\/caption\]/g, (a) => {
|
||||
return a.replace(/<br([^>]*)>/g, "<wp-temp-br$1>").replace(/[\r\n\t]+/, "");
|
||||
});
|
||||
}
|
||||
html = html.replace(
|
||||
new RegExp("\\s*</(" + blocklist1 + ")>\\s*", "g"),
|
||||
"</$1>\n"
|
||||
);
|
||||
html = html.replace(
|
||||
new RegExp("\\s*<((?:" + blocklist1 + ")(?: [^>]*)?)>", "g"),
|
||||
"\n<$1>"
|
||||
);
|
||||
html = html.replace(/(<p [^>]+>[\s\S]*?)<\/p>/g, "$1</p#>");
|
||||
html = html.replace(/<div( [^>]*)?>\s*<p>/gi, "<div$1>\n\n");
|
||||
html = html.replace(/\s*<p>/gi, "");
|
||||
html = html.replace(/\s*<\/p>\s*/gi, "\n\n");
|
||||
html = html.replace(/\n[\s\u00a0]+\n/g, "\n\n");
|
||||
html = html.replace(/(\s*)<br ?\/?>\s*/gi, (_, space) => {
|
||||
if (space && space.indexOf("\n") !== -1) {
|
||||
return "\n\n";
|
||||
}
|
||||
return "\n";
|
||||
});
|
||||
html = html.replace(/\s*<div/g, "\n<div");
|
||||
html = html.replace(/<\/div>\s*/g, "</div>\n");
|
||||
html = html.replace(
|
||||
/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,
|
||||
"\n\n[caption$1[/caption]\n\n"
|
||||
);
|
||||
html = html.replace(/caption\]\n\n+\[caption/g, "caption]\n\n[caption");
|
||||
html = html.replace(
|
||||
new RegExp("\\s*<((?:" + blocklist2 + ")(?: [^>]*)?)\\s*>", "g"),
|
||||
"\n<$1>"
|
||||
);
|
||||
html = html.replace(
|
||||
new RegExp("\\s*</(" + blocklist2 + ")>\\s*", "g"),
|
||||
"</$1>\n"
|
||||
);
|
||||
html = html.replace(/<((li|dt|dd)[^>]*)>/g, " <$1>");
|
||||
if (html.indexOf("<option") !== -1) {
|
||||
html = html.replace(/\s*<option/g, "\n<option");
|
||||
html = html.replace(/\s*<\/select>/g, "\n</select>");
|
||||
}
|
||||
if (html.indexOf("<hr") !== -1) {
|
||||
html = html.replace(/\s*<hr( [^>]*)?>\s*/g, "\n\n<hr$1>\n\n");
|
||||
}
|
||||
if (html.indexOf("<object") !== -1) {
|
||||
html = html.replace(/<object[\s\S]+?<\/object>/g, (a) => {
|
||||
return a.replace(/[\r\n]+/g, "");
|
||||
});
|
||||
}
|
||||
html = html.replace(/<\/p#>/g, "</p>\n");
|
||||
html = html.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, "\n$1");
|
||||
html = html.replace(/^\s+/, "");
|
||||
html = html.replace(/[\s\u00a0]+$/, "");
|
||||
if (preserveLinebreaks) {
|
||||
html = html.replace(/<wp-line-break>/g, "\n");
|
||||
}
|
||||
if (preserveBr) {
|
||||
html = html.replace(/<wp-temp-br([^>]*)>/g, "<br$1>");
|
||||
}
|
||||
if (preserve.length) {
|
||||
html = html.replace(/<wp-preserve>/g, () => {
|
||||
return preserve.shift();
|
||||
});
|
||||
}
|
||||
return html;
|
||||
}
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
"use strict";var wp;(wp||={}).autop=(()=>{var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var $=(e,n)=>{for(var r in n)l(e,r,{get:n[r],enumerable:!0})},w=(e,n,r,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of u(n))!b.call(e,i)&&i!==r&&l(e,i,{get:()=>n[i],enumerable:!(c=f(n,i))||c.enumerable});return e};var v=e=>w(l({},"__esModule",{value:!0}),e);var S={};$(S,{autop:()=>R,removep:()=>j});var k=(()=>{let c="(<("+("(?=!--|!\\[CDATA\\[)((?=!-)"+"!(?:-(?!->)[^\\-]*)*(?:-->)?"+"|"+"!\\[CDATA\\[[^\\]]*(?:](?!]>)[^\\]]*)*?(?:]]>)?"+")")+"|[^>]*>?))";return new RegExp(c)})();function O(e){let n=[],r=e,c;for(;c=r.match(k);){let i=c.index;n.push(r.slice(0,i)),n.push(c[0]),r=r.slice(i+c[0].length)}return r.length&&n.push(r),n}function E(e,n){let r=O(e),c=!1,i=Object.keys(n);for(let s=1;s<r.length;s+=2)for(let a=0;a<i.length;a++){let p=i[a];if(r[s].indexOf(p)!==-1){r[s]=r[s].replace(new RegExp(p,"g"),n[p]),c=!0;break}}return c&&(e=r.join("")),e}function R(e,n=!0){let r=[];if(e.trim()==="")return"";if(e=e+`
|
||||
`,e.indexOf("<pre")!==-1){let s=e.split("</pre>"),a=s.pop();e="";for(let p=0;p<s.length;p++){let o=s[p],g=o.indexOf("<pre");if(g===-1){e+=o;continue}let d="<pre wp-pre-tag-"+p+"></pre>";r.push([d,o.substr(g)+"</pre>"]),e+=o.substr(0,g)+d}e+=a}e=e.replace(/<br\s*\/?>\s*<br\s*\/?>/g,`
|
||||
|
||||
`);let c="(?: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)";e=e.replace(new RegExp("(<"+c+"[\\s/>])","g"),`
|
||||
|
||||
$1`),e=e.replace(new RegExp("(</"+c+">)","g"),`$1
|
||||
|
||||
`),e=e.replace(/\r\n|\r/g,`
|
||||
`),e=E(e,{"\n":" <!-- wpnl --> "}),e.indexOf("<option")!==-1&&(e=e.replace(/\s*<option/g,"<option"),e=e.replace(/<\/option>\s*/g,"</option>")),e.indexOf("</object>")!==-1&&(e=e.replace(/(<object[^>]*>)\s*/g,"$1"),e=e.replace(/\s*<\/object>/g,"</object>"),e=e.replace(/\s*(<\/?(?:param|embed)[^>]*>)\s*/g,"$1")),(e.indexOf("<source")!==-1||e.indexOf("<track")!==-1)&&(e=e.replace(/([<\[](?:audio|video)[^>\]]*[>\]])\s*/g,"$1"),e=e.replace(/\s*([<\[]\/(?:audio|video)[>\]])/g,"$1"),e=e.replace(/\s*(<(?:source|track)[^>]*>)\s*/g,"$1")),e.indexOf("<figcaption")!==-1&&(e=e.replace(/\s*(<figcaption[^>]*>)/,"$1"),e=e.replace(/<\/figcaption>\s*/,"</figcaption>")),e=e.replace(/\n\n+/g,`
|
||||
|
||||
`);let i=e.split(/\n\s*\n/).filter(Boolean);return e="",i.forEach(s=>{e+="<p>"+s.replace(/^\n*|\n*$/g,"")+`</p>
|
||||
`}),e=e.replace(/<p>\s*<\/p>/g,""),e=e.replace(/<p>([^<]+)<\/(div|address|form)>/g,"<p>$1</p></$2>"),e=e.replace(new RegExp("<p>\\s*(</?"+c+"[^>]*>)\\s*</p>","g"),"$1"),e=e.replace(/<p>(<li.+?)<\/p>/g,"$1"),e=e.replace(/<p><blockquote([^>]*)>/gi,"<blockquote$1><p>"),e=e.replace(/<\/blockquote><\/p>/g,"</p></blockquote>"),e=e.replace(new RegExp("<p>\\s*(</?"+c+"[^>]*>)","g"),"$1"),e=e.replace(new RegExp("(</?"+c+"[^>]*>)\\s*</p>","g"),"$1"),n&&(e=e.replace(/<(script|style).*?<\/\\1>/g,s=>s[0].replace(/\n/g,"<WPPreserveNewline />")),e=e.replace(/<br>|<br\/>/g,"<br />"),e=e.replace(/(<br \/>)?\s*\n/g,(s,a)=>a?s:`<br />
|
||||
`),e=e.replace(/<WPPreserveNewline \/>/g,`
|
||||
`)),e=e.replace(new RegExp("(</?"+c+"[^>]*>)\\s*<br />","g"),"$1"),e=e.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)/g,"$1"),e=e.replace(/\n<\/p>$/g,"</p>"),r.forEach(s=>{let[a,p]=s;e=e.replace(a,()=>p)}),e.indexOf("<!-- wpnl -->")!==-1&&(e=e.replace(/\s?<!-- wpnl -->\s?/g,`
|
||||
`)),e}function j(e){let n="blockquote|ul|ol|li|dl|dt|dd|table|thead|tbody|tfoot|tr|th|td|h[1-6]|fieldset|figure",r=n+"|div|p",c=n+"|pre",i=[],s=!1,a=!1;return e?((e.indexOf("<script")!==-1||e.indexOf("<style")!==-1)&&(e=e.replace(/<(script|style)[^>]*>[\s\S]*?<\/\1>/g,p=>(i.push(p),"<wp-preserve>"))),e.indexOf("<pre")!==-1&&(s=!0,e=e.replace(/<pre[^>]*>[\s\S]+?<\/pre>/g,p=>(p=p.replace(/<br ?\/?>(\r\n|\n)?/g,"<wp-line-break>"),p=p.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"<wp-line-break>"),p.replace(/\r?\n/g,"<wp-line-break>")))),e.indexOf("[caption")!==-1&&(a=!0,e=e.replace(/\[caption[\s\S]+?\[\/caption\]/g,p=>p.replace(/<br([^>]*)>/g,"<wp-temp-br$1>").replace(/[\r\n\t]+/,""))),e=e.replace(new RegExp("\\s*</("+r+")>\\s*","g"),`</$1>
|
||||
`),e=e.replace(new RegExp("\\s*<((?:"+r+")(?: [^>]*)?)>","g"),`
|
||||
<$1>`),e=e.replace(/(<p [^>]+>[\s\S]*?)<\/p>/g,"$1</p#>"),e=e.replace(/<div( [^>]*)?>\s*<p>/gi,`<div$1>
|
||||
|
||||
`),e=e.replace(/\s*<p>/gi,""),e=e.replace(/\s*<\/p>\s*/gi,`
|
||||
|
||||
`),e=e.replace(/\n[\s\u00a0]+\n/g,`
|
||||
|
||||
`),e=e.replace(/(\s*)<br ?\/?>\s*/gi,(p,o)=>o&&o.indexOf(`
|
||||
`)!==-1?`
|
||||
|
||||
`:`
|
||||
`),e=e.replace(/\s*<div/g,`
|
||||
<div`),e=e.replace(/<\/div>\s*/g,`</div>
|
||||
`),e=e.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi,`
|
||||
|
||||
[caption$1[/caption]
|
||||
|
||||
`),e=e.replace(/caption\]\n\n+\[caption/g,`caption]
|
||||
|
||||
[caption`),e=e.replace(new RegExp("\\s*<((?:"+c+")(?: [^>]*)?)\\s*>","g"),`
|
||||
<$1>`),e=e.replace(new RegExp("\\s*</("+c+")>\\s*","g"),`</$1>
|
||||
`),e=e.replace(/<((li|dt|dd)[^>]*)>/g," <$1>"),e.indexOf("<option")!==-1&&(e=e.replace(/\s*<option/g,`
|
||||
<option`),e=e.replace(/\s*<\/select>/g,`
|
||||
</select>`)),e.indexOf("<hr")!==-1&&(e=e.replace(/\s*<hr( [^>]*)?>\s*/g,`
|
||||
|
||||
<hr$1>
|
||||
|
||||
`)),e.indexOf("<object")!==-1&&(e=e.replace(/<object[\s\S]+?<\/object>/g,p=>p.replace(/[\r\n]+/g,""))),e=e.replace(/<\/p#>/g,`</p>
|
||||
`),e=e.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g,`
|
||||
$1`),e=e.replace(/^\s+/,""),e=e.replace(/[\s\u00a0]+$/,""),s&&(e=e.replace(/<wp-line-break>/g,`
|
||||
`)),a&&(e=e.replace(/<wp-temp-br([^>]*)>/g,"<br$1>")),i.length&&(e=e.replace(/<wp-preserve>/g,()=>i.shift())),e):""}return v(S);})();
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
var wp;
|
||||
(wp ||= {}).baseStyles = (() => {
|
||||
})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
var wp;(wp||={}).baseStyles=(()=>{})();
|
||||
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).blob = (() => {
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// packages/blob/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
createBlobURL: () => createBlobURL,
|
||||
downloadBlob: () => downloadBlob,
|
||||
getBlobByURL: () => getBlobByURL,
|
||||
getBlobTypeByURL: () => getBlobTypeByURL,
|
||||
isBlobURL: () => isBlobURL,
|
||||
revokeBlobURL: () => revokeBlobURL
|
||||
});
|
||||
var cache = {};
|
||||
function createBlobURL(file) {
|
||||
const url = window.URL.createObjectURL(file);
|
||||
cache[url] = file;
|
||||
return url;
|
||||
}
|
||||
function getBlobByURL(url) {
|
||||
return cache[url];
|
||||
}
|
||||
function getBlobTypeByURL(url) {
|
||||
return getBlobByURL(url)?.type.split("/")[0];
|
||||
}
|
||||
function revokeBlobURL(url) {
|
||||
if (cache[url]) {
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
delete cache[url];
|
||||
}
|
||||
function isBlobURL(url) {
|
||||
if (!url || !url.indexOf) {
|
||||
return false;
|
||||
}
|
||||
return url.indexOf("blob:") === 0;
|
||||
}
|
||||
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);
|
||||
}
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
"use strict";var wp;(wp||={}).blob=(()=>{var i=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var L=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0})},R=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of u(n))!w.call(e,o)&&o!==t&&i(e,o,{get:()=>n[o],enumerable:!(r=b(n,o))||r.enumerable});return e};var U=e=>R(i({},"__esModule",{value:!0}),e);var p={};L(p,{createBlobURL:()=>a,downloadBlob:()=>B,getBlobByURL:()=>l,getBlobTypeByURL:()=>f,isBlobURL:()=>y,revokeBlobURL:()=>s});var d={};function a(e){let n=window.URL.createObjectURL(e);return d[n]=e,n}function l(e){return d[e]}function f(e){return l(e)?.type.split("/")[0]}function s(e){d[e]&&window.URL.revokeObjectURL(e),delete d[e]}function y(e){return!e||!e.indexOf?!1:e.indexOf("blob:")===0}function B(e,n,t=""){if(!e||!n)return;let r=new window.Blob([n],{type:t}),o=window.URL.createObjectURL(r),c=document.createElement("a");c.href=o,c.download=e,c.style.display="none",document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(o)}return U(p);})();
|
||||
+1421
File diff suppressed because it is too large.
Load diff
+1
@@ -0,0 +1 @@
|
||||
var wp;(wp||={}).blockDirectory=(()=>{var ga=Object.create;var X=Object.defineProperty;var _a=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var va=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Q=(t,e)=>{for(var a in e)X(t,a,{get:e[a],enumerable:!0})},At=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of ka(e))!xa.call(t,l)&&l!==a&&X(t,l,{get:()=>e[l],enumerable:!(r=_a(e,l))||r.enumerable});return t};var o=(t,e,a)=>(a=t!=null?ga(va(t)):{},At(e||!t||!t.__esModule?X(a,"default",{value:t,enumerable:!0}):a,t)),Ba=t=>At(X({},"__esModule",{value:!0}),t);var Mt=p((mr,Ft)=>{Ft.exports=window.wp.plugins});var Ht=p((cr,Ut)=>{Ut.exports=window.wp.hooks});var E=p((pr,zt)=>{zt.exports=window.wp.blocks});var _=p((br,$t)=>{$t.exports=window.wp.data});var N=p((hr,Vt)=>{Vt.exports=window.wp.element});var wt=p((yr,qt)=>{qt.exports=window.wp.editor});var P=p((gr,Kt)=>{Kt.exports=window.wp.blockEditor});var g=p((_r,Gt)=>{Gt.exports=window.wp.i18n});var tt=p((kr,Jt)=>{Jt.exports=window.wp.apiFetch});var Xt=p((vr,Zt)=>{Zt.exports=window.wp.notices});var te=p((xr,Qt)=>{Qt.exports=window.wp.url});var be=p((qr,pe)=>{pe.exports=window.wp.compose});var j=p((Wr,he)=>{he.exports=window.wp.components});var Tt=p((Yr,ye)=>{ye.exports=window.wp.coreData});var ke=p((Gr,_e)=>{_e.exports=window.wp.htmlEntities});var st=p((Zr,ve)=>{ve.exports=window.wp.primitives});var m=p((Xr,xe)=>{xe.exports=window.ReactJSXRuntime});var Ue=p((Eo,Me)=>{Me.exports=window.wp.a11y});var ur={};Q(ur,{store:()=>d});var pa=o(Mt(),1),ba=o(Ht(),1);var ue=o(E(),1),W=o(_(),1),de=o(N(),1),me=o(wt(),1);var ot=o(_(),1);var Wt=o(_(),1),Ta=(t={},e)=>{switch(e.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...t,[e.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...t,[e.filterValue]:{results:e.downloadableBlocks,isRequesting:!1}}}return t},Ea=(t={installedBlockTypes:[],isInstalling:{}},e)=>{switch(e.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...t,installedBlockTypes:[...t.installedBlockTypes,e.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...t,installedBlockTypes:t.installedBlockTypes.filter(a=>a.name!==e.item.name)};case"SET_INSTALLING_BLOCK":return{...t,isInstalling:{...t.isInstalling,[e.blockId]:e.isInstalling}}}return t},Sa=(t={},e)=>{switch(e.type){case"SET_ERROR_NOTICE":return{...t,[e.blockId]:{message:e.message,isFatal:e.isFatal}};case"CLEAR_ERROR_NOTICE":let{[e.blockId]:a,...r}=t;return r}return t},Yt=(0,Wt.combineReducers)({downloadableBlocks:Ta,blockManagement:Ea,errorNotices:Sa});var gt={};Q(gt,{getDownloadableBlocks:()=>La,getErrorNoticeForBlock:()=>Ra,getErrorNotices:()=>ja,getInstalledBlockTypes:()=>q,getNewBlockTypes:()=>Ca,getUnusedBlockTypes:()=>Da,isInstalling:()=>Na,isRequestingDownloadableBlocks:()=>Ia});var A=o(_(),1),$=o(P(),1),V=[];function Ia(t,e){return t.downloadableBlocks[e]?.isRequesting??!1}function La(t,e){return t.downloadableBlocks[e]?.results??V}function q(t){return t.blockManagement.installedBlockTypes}var Ca=(0,A.createRegistrySelector)(t=>(0,A.createSelector)(e=>{let a=q(e);if(!a.length)return V;let{getBlockName:r,getClientIdsWithDescendants:l}=t($.store),f=a.map(i=>i.name),s=l().flatMap(i=>{let u=r(i);return f.includes(u)?u:[]}),n=a.filter(i=>s.includes(i.name));return n.length>0?n:V},e=>[q(e),t($.store).getClientIdsWithDescendants()])),Da=(0,A.createRegistrySelector)(t=>(0,A.createSelector)(e=>{let a=q(e);if(!a.length)return V;let{getBlockName:r,getClientIdsWithDescendants:l}=t($.store),f=a.map(i=>i.name),s=l().flatMap(i=>{let u=r(i);return f.includes(u)?u:[]}),n=a.filter(i=>!s.includes(i.name));return n.length>0?n:V},e=>[q(e),t($.store).getClientIdsWithDescendants()]));function Na(t,e){return t.blockManagement.isInstalling[e]||!1}function ja(t){return t.errorNotices}function Ra(t,e){return t.errorNotices[e]}var vt={};Q(vt,{addInstalledBlockType:()=>Fa,clearErrorNotice:()=>za,fetchDownloadableBlocks:()=>kt,installBlockType:()=>Pa,receiveDownloadableBlocks:()=>rt,removeInstalledBlockType:()=>Ma,setErrorNotice:()=>Ha,setIsInstalling:()=>Ua,uninstallBlockType:()=>Aa});var at=o(E(),1),B=o(g(),1),F=o(tt(),1),et=o(Xt(),1),re=o(te(),1);var ee=o(tt(),1),Oa=t=>new Promise((e,a)=>{let r=document.createElement(t.nodeName);["id","rel","src","href","type"].forEach(l=>{t[l]&&(r[l]=t[l])}),t.innerHTML&&r.appendChild(document.createTextNode(t.innerHTML)),r.onload=()=>e(!0),r.onerror=()=>a(new Error("Error loading asset.")),document.body.appendChild(r),(r.nodeName.toLowerCase()==="link"||r.nodeName.toLowerCase()==="script"&&!r.src)&&e()});async function ae(){let e=await(await(0,ee.default)({url:document.location.href,parse:!1})).text(),a=new window.DOMParser().parseFromString(e,"text/html"),r=Array.from(a.querySelectorAll('link[rel="stylesheet"],script')).filter(l=>l.id&&!document.getElementById(l.id));for(let l of r)await Oa(l)}function _t(t){if(!t)return!1;let e=t.links["wp:plugin"]||t.links.self;return e&&e.length?eLine truncated
|
||||
Vendored
+75545
File diff suppressed because it is too large.
Load diff
+259
@@ -0,0 +1,259 @@
|
||||
"use strict";var wp;(wp||={}).blockEditor=(()=>{var Gme=Object.create;var l0=Object.defineProperty;var Wme=Object.getOwnPropertyDescriptor;var $me=Object.getOwnPropertyNames;var Kme=Object.getPrototypeOf,Yme=Object.prototype.hasOwnProperty;var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ip=(e,t)=>{for(var o in t)l0(e,o,{get:t[o],enumerable:!0})},l6=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $me(t))!Yme.call(e,n)&&n!==o&&l0(e,n,{get:()=>t[n],enumerable:!(r=Wme(t,n))||r.enumerable});return e};var l=(e,t,o)=>(o=e!=null?Gme(Kme(e)):{},l6(t||!e||!e.__esModule?l0(o,"default",{value:e,enumerable:!0}):o,e)),qme=e=>l6(l0({},"__esModule",{value:!0}),e);var $=oe((hLe,u6)=>{u6.exports=window.wp.blocks});var R=oe((gLe,d6)=>{d6.exports=window.wp.element});var F=oe((bLe,f6)=>{f6.exports=window.wp.data});var Z=oe((kLe,m6)=>{m6.exports=window.wp.compose});var ut=oe((vLe,p6)=>{p6.exports=window.wp.hooks});var A=oe((wLe,C6)=>{C6.exports=window.wp.components});var CO=oe((CLe,B6)=>{B6.exports=window.wp.privateApis});var Re=oe((OLe,R6)=>{R6.exports=window.wp.deprecated});var w=oe((ALe,O6)=>{O6.exports=window.ReactJSXRuntime});var dn=oe((NLe,L6)=>{L6.exports=window.wp.url});var N=oe(($Le,j6)=>{j6.exports=window.wp.i18n});var yf=oe((KLe,U6)=>{"use strict";U6.exports=function e(t,o){if(t===o)return!0;if(t&&o&&typeof t=="object"&&typeof o=="object"){if(t.constructor!==o.constructor)return!1;var r,n,i;if(Array.isArray(t)){if(r=t.length,r!=o.length)return!1;for(n=r;n--!==0;)if(!e(t[n],o[n]))return!1;return!0}if(t instanceof Map&&o instanceof Map){if(t.size!==o.size)return!1;for(n of t.entries())if(!o.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],o.get(n[0])))return!1;return!0}if(t instanceof Set&&o instanceof Set){if(t.size!==o.size)return!1;for(n of t.entries())if(!o.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(o)){if(r=t.length,r!=o.length)return!1;for(n=r;n--!==0;)if(t[n]!==o[n])return!1;return!0}if(t.constructor===RegExp)return t.source===o.source&&t.flags===o.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===o.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===o.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(o).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(o,i[n]))return!1;for(n=r;n--!==0;){var s=i[n];if(!e(t[s],o[s]))return!1}return!0}return t!==t&&o!==o}});var q=oe((rNe,J6)=>{J6.exports=window.wp.primitives});var dr=oe((wVe,ej)=>{ej.exports=window.wp.richText});var oj=oe((CVe,tj)=>{tj.exports=window.wp.blockSerializationDefaultParser});var Xo=oe((t3e,Vj)=>{Vj.exports=window.wp.a11y});var Un=oe((o3e,Gj)=>{Gj.exports=window.wp.notices});var Zp=oe((r3e,Wj)=>{Wj.exports=window.wp.preferences});var TU=oe((oFe,Kw)=>{var CU={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u1EA4:"A",\u1EAE:"A",\u1EB2:"A",\u1EB4:"A",\u1EB6:"A",\u00C6:"AE",\u1EA6:"A",\u1EB0:"A",\u0202:"A",\u1EA2:"A",\u1EA0:"A",\u1EA8:"A",\u1EAA:"A",\u1EAC:"A",\u00C7:"C",\u1E08:"C",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u1EBE:"E",\u1E16:"E",\u1EC0:"E",\u1E14:"E",\u1E1C:"E",\u0206:"E",\u1EBA:"E",\u1EBC:"E",\u1EB8:"E",\u1EC2:"E",\u1EC4:"E",\u1EC6:"E",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u1E2E:"I",\u020A:"I",\u1EC8:"I",\u1ECA:"I",\u00D0:"D",\u00D1:"N",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u1ED0:"O",\u1E4C:"O",\u1E52:"O",\u020E:"O",\u1ECE:"O",\u1ECC:"O",\u1ED4:"O",\u1ED6:"O",\u1ED8:"O",\u1EDC:"O",\u1EDE:"O",\u1EE0:"O",\u1EDA:"O",\u1EE2:"O",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u1EE6:"U",\u1EE4:"U",\u1EEC:"U",\u1EEE:"U",\u1EF0:"U",\u00DD:"Y",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u1EA5:"a",\u1EAF:"a",\u1EB3:"a",\u1EB5:"a",\u1EB7:"a",\u00E6:"ae",\u1EA7:"a",\u1EB1:"a",\u0203:"a",\u1EA3:"a",\u1EA1:"a",\u1EA9:"a",\u1EAB:"a",\u1EAD:"a",\u00E7:"c",\u1E09:"c",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u1EBF:"e",\u1E17:"e",\u1EC1:"e",\u1E15:"e",\u1E1D:"e",\u0207:"e",\u1EBB:"e",\u1EBD:"e",\u1EB9:"e",\u1EC3:"e",\u1EC5:"e",\u1EC7:"e",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u1E2F:"i",\u020B:"i",\u1EC9:"i",\u1ECB:"i",\u00F0:"d",\u00F1:"n",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u1ED1:"o",\u1E4D:"o",\u1E53:"o",\u020F:"o",\u1ECF:"o",\u1ECD:"o",\u1ED5:"o",\u1ED7:"o",\u1ED9:"o",\u1EDD:"o",\u1EDF:"o",\u1EE1:"o",\u1EDB:"o",\u1EE3:"o",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u1EE7:"u",\u1EE5:"u",\u1EED:"u",\u1EEF:"u",\u1EF1:"u",\u00FD:"y",\u00FF:"y",\u0100:"A",\u0101:"a",\u0102:"A",\u0103:"a",\u0104:"A",\u0105:"a",\u0106:"C",\u0107:"c",\u0108:"C",\u0109:"c",\u010A:"C",\u010B:"c",\u010C:"C",\u010D:"c",C\u0306:"C",c\u0306:"c",\u010E:"D",\u010F:"d",\u0110:"D",\u0111:"d",\u0112:"E",\u0113:"e",\u0114:"E",\u0115:"e",\u0116:"E",\u0117:"e",\u0118:"E",\u0119:"e",\u011A:"E",\u011B:"e",\u011C:"G",\u01F4:"G",\u011D:"g",\u01F5:"g",\u011E:"G",\u011F:"g",\u0120:"G",\u0121:"g",\u0122:"G",\u0123:"g",\u0124:"H",\u0125:"h",\u012Line truncated
|
||||
`+h+a("^")}return" "+c(m)+u}).join(`
|
||||
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
||||
|
||||
`+t+`
|
||||
`),this.name+": "+this.message+t}};VG.exports=By;By.default=By});var FG=oe(()=>{});var HG=oe((IHe,UG)=>{"use strict";var{SourceMapConsumer:zG,SourceMapGenerator:jG}=R1(),{existsSync:P_e,readFileSync:R_e}=FG(),{dirname:WD,join:O_e}=O1();function A_e(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Ey=class{constructor(t,o){if(o.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let r=o.map?o.map.prev:void 0,n=this.loadMap(o.from,r);!this.mapFile&&o.from&&(this.mapFile=o.from),this.mapFile&&(this.root=WD(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new zG(this.text)),this.consumerCache}decodeInline(t){let o=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,n=/^data:application\/json;charset=utf-?8,/,i=/^data:application\/json,/;if(n.test(t)||i.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(o.test(t)||r.test(t))return A_e(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let o=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!o)return;let r=t.lastIndexOf(o.pop()),n=t.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(t.substring(r,n)))}loadFile(t){if(this.root=WD(t),P_e(t))return this.mapFile=t,R_e(t,"utf-8").toString().trim()}loadMap(t,o){if(o===!1)return!1;if(o){if(typeof o=="string")return o;if(typeof o=="function"){let r=o(t);if(r){let n=this.loadFile(r);if(!n)throw new Error("Unable to load previous source map: "+r.toString());return n}}else{if(o instanceof zG)return jG.fromSourceMap(o).toString();if(o instanceof jG)return o.toString();if(this.isMap(o))return JSON.stringify(o);throw new Error("Unsupported previous source map format: "+o.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return t&&(r=O_e(WD(t),r)),this.loadFile(r)}}}startWith(t,o){return t?t.substr(0,o.length)===o:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};UG.exports=Ey;Ey.default=Ey});var ZD=oe((PHe,KG)=>{"use strict";var{SourceMapConsumer:L_e,SourceMapGenerator:N_e}=R1(),{fileURLToPath:GG,pathToFileURL:L1}=UD(),{isAbsolute:YD,resolve:qD}=O1(),{nanoid:M_e}=AG(),$D=HD(),WG=A1(),D_e=HG(),KD=Symbol("fromOffsetCache"),V_e=!!(L_e&&N_e),$G=!!(qD&&YD),Dh=class{constructor(t,o={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,o.from&&(!$G||/^\w+:\/\//.test(o.from)||YD(o.from)?this.file=o.from:this.file=qD(o.from)),$G&&V_e){let r=new D_e(this.css,o);if(r.text){this.map=r;let n=r.consumer().file;!this.file&&n&&(this.file=this.mapResolve(n))}}this.file||(this.id="<input css "+M_e(6)+">"),this.map&&(this.map.file=this.from)}error(t,o,r,n={}){let i,s,a;if(o&&typeof o=="object"){let u=o,d=r;if(typeof u.offset=="number"){let f=this.fromOffset(u.offset);o=f.line,r=f.col}else o=u.line,r=u.column;if(typeof d.offset=="number"){let f=this.fromOffset(d.offset);s=f.line,a=f.col}else s=d.line,a=d.column}else if(!r){let u=this.fromOffset(o);o=u.line,r=u.col}let c=this.origin(o,r,s,a);return c?i=new WG(t,c.endLine===void 0?c.line:{column:c.column,line:c.line},c.endLine===void 0?c.column:{column:c.endColumn,line:c.endLine},c.source,c.file,n.plugin):i=new WG(t,s===void 0?o:{column:r,line:o},s===void 0?r:{column:a,line:s},this.css,this.file,n.plugin),i.input={column:r,endColumn:a,endLine:s,line:o,source:this.css},this.file&&(L1&&(i.input.url=L1(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let o,r;if(this[KD])r=this[KD];else{let i=this.css.split(`
|
||||
`);r=new Array(i.length);let s=0;for(let a=0,c=i.length;a<c;a++)r[a]=s,s+=i[a].length+1;this[KD]=r}o=r[r.length-1];let n=0;if(t>=o)n=r.length-1;else{let i=r.length-2,s;for(;n<i;)if(s=n+(i-n>>1),t<r[s])i=s-1;else if(t>=r[s+1])n=s+1;else{n=s;break}}return{col:t-r[n]+1,line:n+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:qD(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,o,r,n){if(!this.map)return!1;let i=this.map.consumer(),s=i.originalPositionFor({column:o,line:t});if(!s.source)return!1;let a;typeof r=="number"&&(a=i.originalPositionFor({column:n,line:r}));let c;YD(s.source)?c=L1(s.source):c=new URL(s.source,this.map.consumer().sourceRoot||L1(this.map.mapFile));let u={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:c.toString()};if(c.protocol==="file:")if(GG)u.file=GG(c);else throw new Error("file: protocol is not available in this PostCSS build");let d=i.sourceContentFor(s.source);return d&&(u.source=d),u}toJSON(){let t={};for(let o of["hasBOM","css","file","id"])this[o]!=null&&(t[o]=this[o]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}};KG.exports=Dh;Dh.default=Dh;$D&&$D.registerInput&&$D.registerInput(Dh)});var QD=oe((RHe,JG)=>{"use strict";var{SourceMapConsumer:qG,SourceMapGenerator:N1}=R1(),{dirname:M1,relative:ZG,resolve:XG,sep:QG}=O1(),{pathToFileURL:YG}=UD(),F_e=ZD(),z_e=!!(qG&&N1),j_e=!!(M1&&XG&&ZG&&QG),XD=class{constructor(t,o,r,n){this.stringify=t,this.mapOpts=r.map||{},this.root=o,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let o=`
|
||||
`;this.css.includes(`\r
|
||||
`)&&(o=`\r
|
||||
`),this.css+=o+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let o=this.toUrl(this.path(t.file)),r=t.root||M1(t.file),n;this.mapOpts.sourcesContent===!1?(n=new qG(t.text),n.sourcesContent&&(n.sourcesContent=null)):n=t.consumer(),this.map.applySourceMap(n,o,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let o=this.root.nodes.length-1;o>=0;o--)t=this.root.nodes[o],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(o)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),j_e&&z_e&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,o=>{t+=o}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=N1.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new N1({file:this.outputFile(),ignoreInvalidMapping:!0}),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>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new N1({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,o=1,r="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""},i,s;this.stringify(this.root,(a,c,u)=>{if(this.css+=a,c&&u!=="end"&&(n.generated.line=t,n.generated.column=o-1,c.source&&c.source.start?(n.source=this.sourcePath(c),n.original.line=c.source.start.line,n.original.column=c.source.start.column-1,this.map.addMapping(n)):(n.source=r,n.original.line=1,n.original.column=0,this.map.addMapping(n))),i=a.match(/\n/g),i?(t+=i.length,s=a.lastIndexOf(`
|
||||
`),o=a.length-s):o+=a.length,c&&u!=="start"){let d=c.parent||{raws:{}};(!(c.type==="decl"||c.type==="atrule"&&!c.nodes)||c!==d.last||d.raws.semicolon)&&(c.source&&c.source.end?(n.source=this.sourcePath(c),n.original.line=c.source.end.line,n.original.column=c.source.end.column-1,n.generated.line=t,n.generated.column=o-2,this.map.addMapping(n)):(n.source=r,n.original.line=1,n.original.column=0,n.generated.line=t,n.generated.column=o-1,this.map.addMapping(n)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(o=>o.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let o=this.memoizedPaths.get(t);if(o)return o;let r=this.opts.to?M1(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=M1(XG(r,this.mapOpts.annotation)));let n=ZG(r,t);return this.memoizedPaths.set(t,n),n}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let o=t.source.input.map;this.previousMaps.includes(o)||this.previousMaps.push(o)}});else{let t=new F_e(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(o=>{if(o.source){let r=o.source.input.from;if(r&&!t[r]){t[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,o.source.input.css)}}});else if(this.css){let o=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(o,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let o=this.memoizedFileURLs.get(t);if(o)return o;if(YG){let r=YG(t).toString();return this.memoizedFileURLs.set(t,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let o=this.memoizedURLs.get(t);if(o)return o;QG==="\\"&&(t=t.replace(/\\/g,"/"));let r=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,r),r}};JG.exports=XD});var JD=oe((OHe,tW)=>{"use strict";var eW={after:`
|
||||
`,beforeClose:`
|
||||
`,beforeComment:`
|
||||
`,beforeDecl:`
|
||||
`,beforeOpen:" ",beforeRule:`
|
||||
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function U_e(e){return e[0].toUpperCase()+e.slice(1)}var Ty=class{constructor(t){this.builder=t}atrule(t,o){let r="@"+t.name,n=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?r+=t.raws.afterName:n&&(r+=" "),t.nodes)this.block(t,r+n);else{let i=(t.raws.between||"")+(o?";":"");this.builder(r+n+i,t)}}beforeAfter(t,o){let r;t.type==="decl"?r=this.raw(t,null,"beforeDecl"):t.type==="comment"?r=this.raw(t,null,"beforeComment"):o==="before"?r=this.raw(t,null,"beforeRule"):r=this.raw(t,null,"beforeClose");let n=t.parent,i=0;for(;n&&n.type!=="root";)i+=1,n=n.parent;if(r.includes(`
|
||||
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<i;a++)r+=s}return r}block(t,o){let r=this.raw(t,"between","beforeOpen");this.builder(o+r+"{",t,"start");let n;t.nodes&&t.nodes.length?(this.body(t),n=this.raw(t,"after")):n=this.raw(t,"after","emptyBody"),n&&this.builder(n),this.builder("}",t,"end")}body(t){let o=t.nodes.length-1;for(;o>0&&t.nodes[o].type==="comment";)o-=1;let r=this.raw(t,"semicolon");for(let n=0;n<t.nodes.length;n++){let i=t.nodes[n],s=this.raw(i,"before");s&&this.builder(s),this.stringify(i,o!==n||r)}}comment(t){let o=this.raw(t,"left","commentLeft"),r=this.raw(t,"right","commentRight");this.builder("/*"+o+t.text+r+"*/",t)}decl(t,o){let r=this.raw(t,"between","colon"),n=t.prop+r+this.rawValue(t,"value");t.important&&(n+=t.raws.important||" !important"),o&&(n+=";"),this.builder(n,t)}document(t){this.body(t)}raw(t,o,r){let n;if(r||(r=o),o&&(n=t.raws[o],typeof n<"u"))return n;let i=t.parent;if(r==="before"&&(!i||i.type==="root"&&i.first===t||i&&i.type==="document"))return"";if(!i)return eW[r];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[r]<"u")return s.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(t,r);{let a="raw"+U_e(r);this[a]?n=this[a](s,t):s.walk(c=>{if(n=c.raws[o],typeof n<"u")return!1})}return typeof n>"u"&&(n=eW[r]),s.rawCache[r]=n,n}rawBeforeClose(t){let o;return t.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return o=r.raws.after,o.includes(`
|
||||
`)&&(o=o.replace(/[^\n]+$/,"")),!1}),o&&(o=o.replace(/\S/g,"")),o}rawBeforeComment(t,o){let r;return t.walkComments(n=>{if(typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
||||
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(o,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(t,o){let r;return t.walkDecls(n=>{if(typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
||||
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(o,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(t){let o;return t.walk(r=>{if(r.type!=="decl"&&(o=r.raws.between,typeof o<"u"))return!1}),o}rawBeforeRule(t){let o;return t.walk(r=>{if(r.nodes&&(r.parent!==t||t.first!==r)&&typeof r.raws.before<"u")return o=r.raws.before,o.includes(`
|
||||
`)&&(o=o.replace(/[^\n]+$/,"")),!1}),o&&(o=o.replace(/\S/g,"")),o}rawColon(t){let o;return t.walkDecls(r=>{if(typeof r.raws.between<"u")return o=r.raws.between.replace(/[^\s:]/g,""),!1}),o}rawEmptyBody(t){let o;return t.walk(r=>{if(r.nodes&&r.nodes.length===0&&(o=r.raws.after,typeof o<"u"))return!1}),o}rawIndent(t){if(t.raws.indent)return t.raws.indent;let o;return t.walk(r=>{let n=r.parent;if(n&&n!==t&&n.parent&&n.parent===t&&typeof r.raws.before<"u"){let i=r.raws.before.split(`
|
||||
`);return o=i[i.length-1],o=o.replace(/\S/g,""),!1}}),o}rawSemicolon(t){let o;return t.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(o=r.raws.semicolon,typeof o<"u"))return!1}),o}rawValue(t,o){let r=t[o],n=t.raws[o];return n&&n.value===r?n.raw:r}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,o){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,o)}};tW.exports=Ty;Ty.default=Ty});var D1=oe((AHe,oW)=>{"use strict";var H_e=JD();function e5(e,t){new H_e(t).stringify(e)}oW.exports=e5;e5.default=e5});var t5=oe((LHe,nW)=>{"use strict";var rW={};nW.exports=function(t){rW[t]||(rW[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))}});var V1=oe((NHe,o5)=>{"use strict";o5.exports.isClean=Symbol("isClean");o5.exports.my=Symbol("my")});var z1=oe((MHe,iW)=>{"use strict";var{isClean:F1,my:G_e}=V1(),W_e=A1(),$_e=JD(),K_e=D1();function r5(e,t){let o=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r)||r==="proxyCache")continue;let n=e[r],i=typeof n;r==="parent"&&i==="object"?t&&(o[r]=t):r==="source"?o[r]=n:Array.isArray(n)?o[r]=n.map(s=>r5(s,o)):(i==="object"&&n!==null&&(n=r5(n)),o[r]=n)}return o}var Iy=class{constructor(t={}){this.raws={},this[F1]=!1,this[G_e]=!0;for(let o in t)if(o==="nodes"){this.nodes=[];for(let r of t[o])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[o]=t[o]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let o=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${o.input.from}:${o.start.line}:${o.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let o in t)this[o]=t[o];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let o=r5(this);for(let r in t)o[r]=t[r];return o}cloneAfter(t={}){let o=this.clone(t);return this.parent.insertAfter(this,o),o}cloneBefore(t={}){let o=this.clone(t);return this.parent.insertBefore(this,o),o}error(t,o={}){if(this.source){let{end:r,start:n}=this.rangeBy(o);return this.source.input.error(t,{column:n.column,line:n.line},{column:r.column,line:r.line},o)}return new W_e(t)}getProxyProcessor(){return{get(t,o){return o==="proxyOf"?t:o==="root"?()=>t.root().toProxy():t[o]},set(t,o,r){return t[o]===r||(t[o]=r,(o==="prop"||o==="value"||o==="name"||o==="params"||o==="important"||o==="text")&&t.markDirty()),!0}}}markDirty(){if(this[F1]){this[F1]=!1;let t=this;for(;t=t.parent;)t[F1]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,o){let r=this.source.start;if(t.index)r=this.positionInside(t.index,o);else if(t.word){o=this.toString();let n=o.indexOf(t.word);n!==-1&&(r=this.positionInside(n,o))}return r}positionInside(t,o){let r=o||this.toString(),n=this.source.start.column,i=this.source.start.line;for(let s=0;s<t;s++)r[s]===`
|
||||
`?(n=1,i+=1):n+=1;return{column:n,line:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let o={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:o.column+1,line:o.line};if(t.word){let n=this.toString(),i=n.indexOf(t.word);i!==-1&&(o=this.positionInside(i,n),r=this.positionInside(i+t.word.length,n))}else t.start?o={column:t.start.column,line:t.start.line}:t.index&&(o=this.positionInside(t.index)),t.end?r={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?r=this.positionInside(t.endIndex):t.index&&(r=this.positionInside(t.index+1));return(r.line<o.line||r.line===o.line&&r.column<=o.column)&&(r={column:o.column+1,line:o.line}),{end:r,start:o}}raw(t,o){return new $_e().raw(this,t,o)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let o=this,r=!1;for(let n of t)n===this?r=!0:r?(this.parent.insertAfter(o,n),o=n):this.parent.insertBefore(o,n);r||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,o){let r={},n=o==null;o=o||new Map;let i=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))r[s]=a.map(c=>typeof c=="object"&&c.toJSON?c.toJSON(null,o):c);else if(typeof a=="object"&&a.toJSON)r[s]=a.toJSON(null,o);else if(s==="source"){let c=o.get(a.input);c==null&&(c=i,o.set(a.input,i),i++),r[s]={end:a.end,inputId:c,start:a.start}}else r[s]=a}return n&&(r.inputs=[...o.keys()].map(s=>s.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=K_e){t.stringify&&(t=t.stringify);let o="";return t(this,r=>{o+=r}),o}warn(t,o,r){let n={node:this};for(let i in r)n[i]=r[i];return t.warn(o,n)}get proxyOf(){return this}};iW.exports=Iy;Iy.default=Iy});var n5=oe((DHe,sW)=>{"use strict";var Y_e=z1(),Py=class extends Y_e{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};sW.exports=Py;Py.default=Py});var i5=oe((VHe,aW)=>{"use strict";var q_e=z1(),Ry=class extends q_e{constructor(t){super(t),this.type="comment"}};aW.exports=Ry;Ry.default=Ry});var rm=oe((FHe,gW)=>{"use strict";var{isClean:lW,my:cW}=V1(),uW=n5(),dW=i5(),Z_e=z1(),fW,s5,a5,mW;function pW(e){return e.map(t=>(t.nodes&&(t.nodes=pW(t.nodes)),delete t.source,t))}function hW(e){if(e[lW]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)hW(t)}var Os=class e extends Z_e{append(...t){for(let o of t){let r=this.normalize(o,this.last);for(let n of r)this.proxyOf.nodes.push(n)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let o of this.nodes)o.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let o=this.getIterator(),r,n;for(;this.indexes[o]<this.proxyOf.nodes.length&&(r=this.indexes[o],n=t(this.proxyOf.nodes[r],r),n!==!1);)this.indexes[o]+=1;return delete this.indexes[o],n}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,o){return o==="proxyOf"?t:t[o]?o==="each"||typeof o=="string"&&o.startsWith("walk")?(...r)=>t[o](...r.map(n=>typeof n=="function"?(i,s)=>n(i.toProxy(),s):n)):o==="every"||o==="some"?r=>t[o]((n,...i)=>r(n.toProxy(),...i)):o==="root"?()=>t.root().toProxy():o==="nodes"?t.nodes.map(r=>r.toProxy()):o==="first"||o==="last"?t[o].toProxy():t[o]:t[o]},set(t,o,r){return t[o]===r||(t[o]=r,(o==="name"||o==="params"||o==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,o){let r=this.index(t),n=this.normalize(o,this.proxyOf.nodes[r]).reverse();r=this.index(t);for(let s of n)this.proxyOf.nodes.splice(r+1,0,s);let i;for(let s in this.indexes)i=this.indexes[s],r<i&&(this.indexes[s]=i+n.length);return this.markDirty(),this}insertBefore(t,o){let r=this.index(t),n=r===0?"prepend":!1,i=this.normalize(o,this.proxyOf.nodes[r],n).reverse();r=this.index(t);for(let a of i)this.proxyOf.nodes.splice(r,0,a);let s;for(let a in this.indexes)s=this.indexes[a],r<=s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}normalize(t,o){if(typeof t=="string")t=pW(fW(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let n of t)n.parent&&n.parent.removeChild(n,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let n of t)n.parent&&n.parent.removeChild(n,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new uW(t)]}else if(t.selecto
Line truncated
|
||||
`," "];return Oy.split(e,t)},split(e,t,o){let r=[],n="",i=!1,s=0,a=!1,c="",u=!1;for(let d of e)u?u=!1:d==="\\"?u=!0:a?d===c&&(a=!1):d==='"'||d==="'"?(a=!0,c=d):d==="("?s+=1:d===")"?s>0&&(s-=1):s===0&&t.includes(d)&&(i=!0),i?(n!==""&&r.push(n.trim()),n="",i=!1):n+=d;return(o||n!=="")&&r.push(n.trim()),r}};EW.exports=Oy;Oy.default=Oy});var RW=oe((GHe,PW)=>{"use strict";var IW=rm(),Q_e=TW(),Fh=class extends IW{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Q_e.comma(this.selector)}set selectors(t){let o=this.selector?this.selector.match(/,\s*/):null,r=o?o[0]:","+this.raw("between","beforeOpen");this.selector=t.join(r)}};PW.exports=Fh;Fh.default=Fh;IW.registerRule(Fh)});var NW=oe((WHe,LW)=>{"use strict";var J_e=n5(),e0e=vW(),t0e=i5(),o0e=_W(),r0e=H1(),OW=RW(),AW={empty:!0,space:!0};function n0e(e){for(let t=e.length-1;t>=0;t--){let o=e[t],r=o[3]||o[2];if(r)return r}}var l5=class{constructor(t){this.input=t,this.root=new r0e,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let o=new o0e;o.name=t[1].slice(1),o.name===""&&this.unnamedAtrule(o,t),this.init(o,t[2]);let r,n,i,s=!1,a=!1,c=[],u=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),r=t[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){o.source.end=this.getPosition(t[2]),o.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){a=!0;break}else if(r==="}"){if(c.length>0){for(i=c.length-1,n=c[i];n&&n[0]==="space";)n=c[--i];n&&(o.source.end=this.getPosition(n[3]||n[2]),o.source.end.offset++)}this.end(t);break}else c.push(t);else c.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(c),c.length?(o.raws.afterName=this.spacesAndCommentsFromStart(c),this.raw(o,"params",c),s&&(t=c[c.length-1],o.source.end=this.getPosition(t[3]||t[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),a&&(o.nodes=[],this.current=o)}checkMissedSemicolon(t){let o=this.colon(t);if(o===!1)return;let r=0,n;for(let i=o-1;i>=0&&(n=t[i],!(n[0]!=="space"&&(r+=1,r===2)));i--);throw this.input.error("Missed semicolon",n[0]==="word"?n[3]+1:n[2])}colon(t){let o=0,r,n,i;for(let[s,a]of t.entries()){if(r=a,n=r[0],n==="("&&(o+=1),n===")"&&(o-=1),o===0&&n===":")if(!i)this.doubleColon(r);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=r}return!1}comment(t){let o=new t0e;this.init(o,t[2]),o.source.end=this.getPosition(t[3]||t[2]),o.source.end.offset++;let r=t[1].slice(2,-2);if(/^\s*$/.test(r))o.text="",o.raws.left=r,o.raws.right="";else{let n=r.match(/^(\s*)([^]*\S)(\s*)$/);o.text=n[2],o.raws.left=n[1],o.raws.right=n[3]}}createTokenizer(){this.tokenizer=e0e(this.input)}decl(t,o){let r=new J_e;this.init(r,t[0][2]);let n=t[t.length-1];for(n[0]===";"&&(this.semicolon=!0,t.pop()),r.source.end=this.getPosition(n[3]||n[2]||n0e(t)),r.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),r.raws.before+=t.shift()[1];for(r.source.start=this.getPosition(t[0][2]),r.prop="";t.length;){let u=t[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=t.shift()[1]}r.raws.between="";let i;for(;t.length;)if(i=t.shift(),i[0]===":"){r.raws.between+=i[1];break}else i[0]==="word"&&/\w/.test(i[1])&&this.unknownWord([i]),r.raws.between+=i[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let u=t.length-1;u>=0;u--){if(i=t[u],i[1].toLowerCase()==="!important"){r.important=!0;let d=this.stringFrom(t,u);d=this.spacesFromEnd(t)+d,d!==" !important"&&(r.raws.important=d);break}else if(i[1].toLowerCase()==="important"){let d=t.slice(0),f="";for(let m=u;m>0;m--){let h=d[m][0];if(f.trim().indexOf("!")===0&&h!=="space")break;f=d.pop()[1]+f}f.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=f,t=d)}if(i[0]!=="space"&&i[0]!=="comment")break}t.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=s.map(u=>u[1]).join(""),s=[]),this.raw(r,"value",s.concat(t),o),r.value.includes(":")&&!o&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let o=new OW;this.init(o,t[2]),o.selector="",o.raws.between="",this.current=o}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current
Line truncated
|
||||
${b.join("; ")};
|
||||
}`),i&&d&&(g+=yu(t,a,"flex",d)),g},getOrientation(e){let{orientation:t="horizontal"}=e;return t},getAlignments(){return[]}};function Vve({layout:e,onChange:t}){let{orientation:o="horizontal"}=e,r=o==="horizontal"?oH.horizontal:oH.vertical,{verticalAlignment:n=r}=e;return(0,oo.jsx)(iC,{onChange:s=>{t({...e,verticalAlignment:s})},value:n,controls:o==="horizontal"?["top","center","bottom","stretch"]:["top","center","bottom","space-between"]})}var Fve={placement:"bottom-start"};function rH({layout:e,onChange:t,isToolbar:o=!1}){let{justifyContent:r="left",orientation:n="horizontal"}=e,i=c=>{t({...e,justifyContent:c})},s=["left","center","right"];if(n==="horizontal"?s.push("space-between"):s.push("stretch"),o)return(0,oo.jsx)(ah,{allowedControls:s,value:r,onChange:i,popoverProps:Fve});let a=[{value:"left",icon:ru,label:(0,Pi.__)("Justify items left")},{value:"center",icon:ou,label:(0,Pi.__)("Justify items center")},{value:"right",icon:nu,label:(0,Pi.__)("Justify items right")}];return n==="horizontal"?a.push({value:"space-between",icon:Fp,label:(0,Pi.__)("Space between items")}):a.push({value:"stretch",icon:zp,label:(0,Pi.__)("Stretch items")}),(0,oo.jsx)(mn.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,label:(0,Pi.__)("Justification"),value:r,onChange:i,className:"block-editor-hooks__flex-layout-justification-controls",children:a.map(({value:c,icon:u,label:d})=>(0,oo.jsx)(mn.__experimentalToggleGroupControlOptionIcon,{value:c,icon:u,label:d},c))})}function zve({layout:e,onChange:t}){let{flexWrap:o="wrap"}=e;return(0,oo.jsx)(mn.ToggleControl,{label:(0,Pi.__)("Allow to wrap to multiple lines"),onChange:r=>{t({...e,flexWrap:r?"wrap":"nowrap"})},checked:o==="wrap"})}function jve({layout:e,onChange:t}){let{orientation:o="horizontal",verticalAlignment:r,justifyContent:n}=e;return(0,oo.jsxs)(mn.__experimentalToggleGroupControl,{__next40pxDefaultSize:!0,className:"block-editor-hooks__flex-layout-orientation-controls",label:(0,Pi.__)("Orientation"),value:o,onChange:i=>{let s=r,a=n;return i==="horizontal"?(r==="space-between"&&(s="center"),n==="stretch"&&(a="left")):(r==="stretch"&&(s="top"),n==="space-between"&&(a="left")),t({...e,orientation:i,verticalAlignment:s,justifyContent:a})},children:[(0,oo.jsx)(mn.__experimentalToggleGroupControlOptionIcon,{icon:Qk,value:"horizontal",label:(0,Pi.__)("Horizontal")}),(0,oo.jsx)(mn.__experimentalToggleGroupControlOptionIcon,{icon:DO,value:"vertical",label:(0,Pi.__)("Vertical")})]})}var iH=l(N(),1);var sH={name:"default",label:(0,iH.__)("Flow"),inspectorControls:function(){return null},toolBarControls:function(){return null},getLayoutStyle:function({selector:t,style:o,blockName:r,hasBlockGapSupport:n,layoutDefinitions:i=Hn}){let s=mr(o?.spacing?.blockGap),a="";Ue(r,"spacing","blockGap")||(s?.top?a=mr(s?.top):typeof s=="string"&&(a=mr(s)));let c="";return n&&a&&(c+=yu(t,i,"default",a)),c},getOrientation(){return"vertical"},getAlignments(e,t){let o=oC(e);if(e.alignments!==void 0)return e.alignments.includes("none")||e.alignments.unshift("none"),e.alignments.map(n=>({name:n,info:o[n]}));let r=[{name:"left"},{name:"center"},{name:"right"}];if(!t){let{contentSize:n,wideSize:i}=e;n&&r.unshift({name:"full"}),i&&r.unshift({name:"wide",info:o.wide})}return r.unshift({name:"none",info:o.none}),r}};var pn=l(A(),1),Bl=l(N(),1);var lH=l(Uv(),1);var Qo=l(w(),1),cH={name:"constrained",label:(0,Bl.__)("Constrained"),inspectorControls:function({layout:t,onChange:o,layoutBlockSupport:r={}}){let{wideSize:n,contentSize:i,justifyContent:s="center"}=t,{allowJustification:a=!0,allowCustomContentAndWideSize:c=!0}=r,u=h=>{o({...t,justifyContent:h})},d=[{value:"left",icon:ru,label:(0,Bl.__)("Justify items left")},{value:"center",icon:ou,label:(0,Bl.__)("Justify items center")},{value:"right",icon:nu,label:(0,Bl.__)("Justify items right")}],[f]=me("spacing.units"),m=(0,pn.__experimentalUseCustomUnits)({availableUnits:f||["%","px","em","rem","vw"]});return(0,Qo.jsxs)(pn.__experimentalVStack,{spacing:4,className:"block-editor-hooks__layout-constrained",children:[c&&(0,Qo.jsxs)(Qo.Fragment,{children:[(0,Qo.jsx)(pn.__experimentalUnitControl,{__next40pxDefaultSize:!0,label:(0,Bl.__)("Content width"),labelPosition:"top",value:i||n||"",onChange:h=>{h=0>parseFloat(h)?"0":h,o({...t,contentSize:h!==""?h:void 0})},units:m,prefix:(0,Qo.jsx)(pn.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,Qo.jsx)(we,{icon:_f})})}),(0,Qo.jsx)(pn.__experimentalUnitControl,{__next40pxDefaultSize:!0,label:(0,Bl.__)("Wide width"),labelPosition:"top",value:n||i||"",onChange:h=>{h=0>parseFloat(h)?"0":h,o({...t,wideSize:h!==""?h:void 0})},units:m,prefix:(0,Qo.jsx)(pn.__experimentalInputControlPrefixWrapper,{variant:"icon",children:(0,Qo.jsx)(we,{icon:Lf})})}),(0,Qo.jsx)("p",{className:"block-editor-hooks__layout-constrained-helptext",children:(0,Bl.__)("Customize the width for all elements that are assigned to the center or wide columns.")})]}),a&&(0,Qo.jsx)(pn.__experimentalToggleGroupControl,{__next40pxD
Line truncated
|
||||
${Gn(t,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")} {
|
||||
max-width: ${a??c};
|
||||
margin-left: ${m};
|
||||
margin-right: ${h};
|
||||
}
|
||||
${Gn(t,"> .alignwide")} {
|
||||
max-width: ${c??a};
|
||||
}
|
||||
${Gn(t,"> .alignfull")} {
|
||||
max-width: none;
|
||||
}
|
||||
`:"";return u==="left"?p+=`${Gn(t,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")}
|
||||
{ margin-left: ${m}; }`:u==="right"&&(p+=`${Gn(t,"> :where(:not(.alignleft):not(.alignright):not(.alignfull))")}
|
||||
{ margin-right: ${h}; }`),r?.spacing?.padding&&(0,lH.getCSSRules)(r).forEach(b=>{if(b.key==="paddingRight"){let v=b.value==="0"?"0px":b.value;p+=`
|
||||
${Gn(t,"> .alignfull")} {
|
||||
margin-right: calc(${v} * -1);
|
||||
}
|
||||
`}else if(b.key==="paddingLeft"){let v=b.value==="0"?"0px":b.value;p+=`
|
||||
${Gn(t,"> .alignfull")} {
|
||||
margin-left: calc(${v} * -1);
|
||||
}
|
||||
`}}),i&&f&&(p+=yu(t,s,"constrained",f)),p},getOrientation(){return"vertical"},getAlignments(e){let t=oC(e);if(e.alignments!==void 0)return e.alignments.includes("none")||e.alignments.unshift("none"),e.alignments.map(i=>({name:i,info:t[i]}));let{contentSize:o,wideSize:r}=e,n=[{name:"left"},{name:"center"},{name:"right"}];return o&&n.unshift({name:"full"}),r&&n.unshift({name:"wide",info:t.wide}),n.unshift({name:"none",info:t.none}),n}},Uve={placement:"bottom-start"};function Hve({layout:e,onChange:t}){let{justifyContent:o="center"}=e;return(0,Qo.jsx)(ah,{allowedControls:["left","center","right"],value:o,onChange:i=>{t({...e,justifyContent:i})},popoverProps:Uve})}var Fr=l(N(),1),nt=l(A(),1),sC=l(R(),1);var Ye=l(w(),1),Gve={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},Wve=[{value:"px",label:"px",default:0},{value:"rem",label:"rem",default:0},{value:"em",label:"em",default:0}],uH={name:"grid",label:(0,Fr.__)("Grid"),inspectorControls:function({layout:t={},onChange:o,layoutBlockSupport:r={}}){let{allowSizingOnChildren:n=!1}=r,i=!0,s=!t?.isManualPlacement||window.__experimentalEnableGridInteractivity;return(0,Ye.jsxs)(Ye.Fragment,{children:[window.__experimentalEnableGridInteractivity&&(0,Ye.jsx)(Yve,{layout:t,onChange:o}),(0,Ye.jsxs)(nt.__experimentalVStack,{spacing:4,children:[i&&(0,Ye.jsx)(Kve,{layout:t,onChange:o,allowSizingOnChildren:n}),s&&(0,Ye.jsx)($ve,{layout:t,onChange:o})]})]})},toolBarControls:function(){return null},getLayoutStyle:function({selector:t,layout:o,style:r,blockName:n,hasBlockGapSupport:i,globalBlockGapValue:s,layoutDefinitions:a=Hn}){let{minimumColumnWidth:c=null,columnCount:u=null,rowCount:d=null}=o,f="1.2rem";if(s){let b=mr(s,"0.5em").split(" ");f=b.length>1?b[1]:b[0]}let m=r?.spacing?.blockGap&&!Ue(n,"spacing","blockGap")?mr(r?.spacing?.blockGap,f):void 0,h="",p=[];if(c&&u>0){let g=m||f;(g==="0"||g===0)&&(g="0px");let b=`max(min( ${c}, 100%), ( 100% - (${g}*${u-1}) ) / ${u})`;p.push(`grid-template-columns: repeat(auto-fill, minmax(${b}, 1fr))`,"container-type: inline-size"),d&&p.push(`grid-template-rows: repeat(${d}, minmax(1rem, auto))`)}else u?(p.push(`grid-template-columns: repeat(${u}, minmax(0, 1fr))`),d&&p.push(`grid-template-rows: repeat(${d}, minmax(1rem, auto))`)):p.push(`grid-template-columns: repeat(auto-fill, minmax(min(${c||"12rem"}, 100%), 1fr))`,"container-type: inline-size");return p.length&&(h=`${Gn(t)} { ${p.join("; ")}; }`),i&&m&&(h+=yu(t,a,"grid",m)),h},getOrientation(){return"horizontal"},getAlignments(){return[]}};function $ve({layout:e,onChange:t}){let{minimumColumnWidth:o,columnCount:r,isManualPlacement:n}=e,s=o||(n||r?null:"12rem"),[a,c="rem"]=(0,nt.__experimentalParseQuantityAndUnitFromRawValue)(s),u=f=>{t({...e,minimumColumnWidth:[f,c].join("")})},d=f=>{let m;["em","rem"].includes(f)&&c==="px"?m=(a/16).toFixed(2)+f:["em","rem"].includes(c)&&f==="px"&&(m=Math.round(a*16)+f),t({...e,minimumColumnWidth:m})};return(0,Ye.jsxs)("fieldset",{className:"block-editor-hooks__grid-layout-minimum-width-control",children:[(0,Ye.jsx)(nt.BaseControl.VisualLabel,{as:"legend",children:(0,Fr.__)("Min. column width")}),(0,Ye.jsxs)(nt.Flex,{gap:4,children:[(0,Ye.jsx)(nt.FlexItem,{isBlock:!0,children:(0,Ye.jsx)(nt.__experimentalUnitControl,{size:"__unstable-large",onChange:f=>{t({...e,minimumColumnWidth:f===""?void 0:f})},onUnitChange:d,value:s,units:Wve,min:0,label:(0,Fr.__)("Minimum column width"),hideLabelFromVision:!0})}),(0,Ye.jsx)(nt.FlexItem,{isBlock:!0,children:(0,Ye.jsx)(nt.RangeControl,{__next40pxDefaultSize:!0,onChange:u,value:a||0,min:0,max:Gve[c]||600,withInputField:!1,label:(0,Fr.__)("Minimum column width"),hideLabelFromVision:!0})})]}),(0,Ye.jsx)("p",{className:"components-base-control__help",children:(0,Fr.__)("Columns will wrap to fewer per row when they can no longer maintain the minimum width.")})]})}function Kve({layout:e,onChange:t,allowSizingOnChildren:o}){let{columnCount:n=void 0,rowCount:i,isManualPlacement:s}=e;return(0,Ye.jsx)(Ye.Fragment,{children:(0,Ye.jsxs)("fieldset",{className:"block-editor-hooks__grid-layout-columns-and-rows-controls",children:[!s&&(0,Ye.jsx)(nt.BaseControl.VisualLabel,{as:"legend",children:(0,Fr.__)("Max. columns")}),(0,Ye.jsxs)(nt.Flex,{gap:4,children:[(0,Ye.jsx)(nt.FlexItem,{isBlock:!0,children:(0,Ye.jsx)(nt.__experimentalNumberControl,{size:"__unstable-large",onChange:a=>{let u=a===""||a==="0"?s?1:void 0:parseInt(a,10);t({...e,columnCount:u})},value:n,min:1,label:(0,Fr.__)("Columns"),hideLabelFromVision:!s})}),(0,Ye.jsx)(nt.FlexItem,{isBlock:!0,children:o&&s?(0,Ye.jsx)(nt.__experimentalNumberControl,{size:"__unstable-large",onChange:a=>{let c=a===""||a==="0"?1:parseInt(a,10);t({...e,rowCount:c})},value:i,min:1,label:(0,Fr.__)("Rows")}):(0,Ye.jsx)(nt.RangeControl,{__next40pxDefaultSize:!0,value:n??1,onChange:a=>t({...e,columnCount:a===""||a=
Line truncated
|
||||
`),(0,kG.__unstableStripHTML)(e).trim().replace(/\n\n+/g,`
|
||||
|
||||
`)}function xy(){let e=(0,Lh.useRegistry)(),{getBlocksByClientId:t,getSelectedBlockClientIds:o,hasMultiSelection:r,getSettings:n,getBlockName:i,__unstableIsFullySelected:s,__unstableIsSelectionCollapsed:a,__unstableIsSelectionMergeable:c,__unstableGetSelectedBlocksWithPartialSelection:u,canInsertBlockType:d,getBlockRootClientId:f}=(0,Lh.useSelect)(_),{flashBlock:m,removeBlocks:h,replaceBlocks:p,__unstableDeleteSelection:g,__unstableExpandSelection:b,__unstableSplitSelection:v}=(0,Lh.useDispatch)(_),k=Oh();return(0,yG.useRefEffect)(y=>{function S(x){if(x.defaultPrevented)return;let C=o();if(C.length===0)return;if(!r()){let{target:L}=x,{ownerDocument:T}=L;if(x.type==="copy"||x.type==="cut"?(0,B1.documentHasUncollapsedSelection)(T):(0,B1.documentHasSelection)(T)&&!T.activeElement.isContentEditable)return}let{activeElement:B}=x.target.ownerDocument;if(!y.contains(B))return;let I=c(),P=a()||s(),E=!P&&!I;if(x.type==="copy"||x.type==="cut")if(x.preventDefault(),C.length===1&&m(C[0]),E)b();else{k(x.type,C);let L;if(P)L=t(C);else{let[T,O]=u(),D=t(C.slice(1,C.length-1));L=[T,...D,O]}C1(x,L,e)}if(x.type==="cut")P&&!E?h(C):(x.target.ownerDocument.activeElement.contentEditable=!1,g());else if(x.type==="paste"){let{__experimentalCanUserUseUnfilteredHTML:L,mediaUpload:T}=n();if(x.clipboardData.getData("rich-text")==="true")return;let{plainText:D,html:U,files:G}=Ah(x),j=s(),z=[];if(G.length){if(!T){x.preventDefault();return}let ce=(0,_a.getBlockTransforms)("from");z=G.reduce((ie,re)=>{let Q=(0,_a.findTransform)(ce,Y=>Y.type==="files"&&Y.isMatch([re]));return Q&&ie.push(Q.transform([re])),ie},[]).flat()}else z=(0,_a.pasteHandler)({HTML:U,plainText:D,mode:j?"BLOCKS":"AUTO",canUserUseUnfilteredHTML:L});if(typeof z=="string")return;if(j){p(C,z,z.length-1,-1),x.preventDefault();return}if(!r()&&!(0,_a.hasBlockSupport)(i(C[0]),"splitting",!1)&&!x.__deprecatedOnSplit)return;let[W]=C,ee=f(W),se=[];for(let ce of z)if(d(ce.name,ee))se.push(ce);else{let ie=i(ee),re=ce.name!==ie?(0,_a.switchToBlockType)(ce,ie):[ce];if(!re)return;for(let Q of re)for(let Y of Q.innerBlocks)se.push(Y)}v(se),x.preventDefault()}}return y.ownerDocument.addEventListener("copy",S),y.ownerDocument.addEventListener("cut",S),y.ownerDocument.addEventListener("paste",S),()=>{y.ownerDocument.removeEventListener("copy",S),y.ownerDocument.removeEventListener("cut",S),y.ownerDocument.removeEventListener("paste",S)}},[])}var Nh=l(w(),1);function FD(){let[e,t,o]=$9(),r=(0,SG.useSelect)(n=>n(_).hasMultiSelection(),[]);return[e,(0,wy.useMergeRefs)([t,xy(),mG(),nG(),cG(),dG(),W9(),tG(),Y9(),X9(),(0,wy.useRefEffect)(n=>(n.tabIndex=0,n.dataset.hasMultiSelection=r,r?(n.setAttribute("aria-label",(0,_G.__)("Multiple selected blocks")),()=>{delete n.dataset.hasMultiSelection,n.removeAttribute("aria-label")}):()=>{delete n.dataset.hasMultiSelection}),[r])]),o]}function d_e({children:e,...t},o){let[r,n,i]=FD();return(0,Nh.jsxs)(Nh.Fragment,{children:[r,(0,Nh.jsx)("div",{...t,ref:(0,wy.useMergeRefs)([n,o]),className:V(t.className,"block-editor-writing-flow"),children:e}),i]})}var E1=(0,xG.forwardRef)(d_e);var T1=null;function wG(){return T1||(T1=Array.from(document.styleSheets).reduce((e,t)=>{try{t.cssRules}catch{return e}let{ownerNode:o,cssRules:r}=t;if(o===null||!r||o.id.startsWith("wp-")||!o.id)return e;function n(i){return Array.from(i).find(({selectorText:s,conditionText:a,cssRules:c})=>a?n(c):s&&(s.includes(".editor-styles-wrapper")||s.includes(".wp-block")))}if(n(r)){let i=o.tagName==="STYLE";if(i){let s=o.id.replace("-inline-css","-css"),a=document.getElementById(s);a&&e.push(a.cloneNode(!0))}if(e.push(o.cloneNode(!0)),!i){let s=o.id.replace("-css","-inline-css"),a=document.getElementById(s);a&&e.push(a.cloneNode(!0))}}return e},[]),T1)}var kn=l(R(),1),Cy=l(Z(),1);function CG({frameSize:e,containerWidth:t,maxContainerWidth:o,scaleContainerWidth:r}){return(Math.min(t,o)-e*2)/r}function f_e(e,t){let{scaleValue:o,scrollHeight:r}=e,{frameSize:n,scaleValue:i}=t;return r*(i/o)+n*2}function m_e(e,t){let{containerHeight:o,frameSize:r,scaleValue:n,scrollTop:i}=e,{containerHeight:s,frameSize:a,scaleValue:c,scrollHeight:u}=t,d=i;d=(d+o/2-r)/n-o/2,d=(d+s/2)*c+a-s/2,d=i<=r?0:d;let f=u-s;return Math.round(Math.min(Math.max(0,d),Math.max(0,f)))}function p_e(e,t){let{scaleValue:o,frameSize:r,scrollTop:n}=e,{scaleValue:i,frameSize:s,scrollTop:a}=t;return[{translate:"0 0",scale:o,paddingTop:`${r/o}px`,paddingBottom:`${r/o}px`},{translate:`0 ${n-a}px`,scale:i,paddingTop:`${s/i}px`,paddingBottom:`${s/i}px`}]}function BG({frameSize:e,iframeDocument:t,maxContainerWidth:o=750,scale:r}){let[n,{height:i}]=(0,Cy.useResizeObserver)(),[s,{width:a,height:c}]=(0,Cy.useResizeObserver)(),u=(0,kn.useRef)(0),d=r!==1,f=(0,Cy.useReducedMotion)(),m=r==="auto-scaled",h=(0,kn.useRef)(!1),p=(0,kn.useRef)(null);(0,kn.useEffect)(()=>{d||(u.current=a)},[a,d]);let g=Math.max(u.current,a),b=m?CG({frameSize:e,containerWidth:a,maxContainerWidth:o,scaleContainerWidth:g}):r,v=(0,kn.useRef)({scaleValue:b,frameSize:e,contai
Line truncated
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<base href="${window.location.href}">
|
||||
<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>
|
||||
${e.styles??""}
|
||||
${e.scripts??""}
|
||||
</head>
|
||||
<body>
|
||||
<script>document.currentScript.parentElement.remove()<\/script>
|
||||
</body>
|
||||
</html>`;return t=URL.createObjectURL(new Blob([o],{type:"text/html"})),EG.set(e,t),g_e?.register(e,t),t}function k_e({contentRef:e,children:t,tabIndex:o=0,scale:r=1,frameSize:n=0,readonly:i,forwardedRef:s,title:a=(0,TG.__)("Editor canvas"),...c}){let{resolvedAssets:u,isPreviewMode:d}=(0,zD.useSelect)(T=>{let O=T(_).getSettings();return{resolvedAssets:O.__unstableResolvedAssets,isPreviewMode:O.isPreviewMode}},[]),[f,m]=(0,om.useState)(),[h,p]=(0,om.useState)([]),[g,b,v]=FD(),k=(0,Vu.useRefEffect)(T=>{T._load=()=>{m(T.contentDocument)};let O;function D(z){z.preventDefault()}function U(z){z.target.tagName==="A"&&z.target.getAttribute("href")?.startsWith("#")&&(z.preventDefault(),O.defaultView.location.hash=z.target.getAttribute("href").slice(1))}let{ownerDocument:G}=T;p(Array.from(G.body.classList).filter(z=>z.startsWith("admin-color-")||z.startsWith("post-type-")||z==="wp-embed-responsive"));function j(){let{contentDocument:z}=T,{documentElement:W}=z;O=z,W.classList.add("block-editor-iframe__html"),z.dir=G.dir;for(let ee of wG())z.getElementById(ee.id)||(z.head.appendChild(ee.cloneNode(!0)),d||console.warn(`${ee.id} was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,ee));O.addEventListener("dragover",D,!1),O.addEventListener("drop",D,!1),O.addEventListener("click",U)}return T.addEventListener("load",j),()=>{delete T._load,T.removeEventListener("load",j),O?.removeEventListener("dragover",D),O?.removeEventListener("drop",D),O?.removeEventListener("click",U)}},[]),{contentResizeListener:y,containerResizeListener:S,isZoomedOut:x,scaleContainerWidth:C}=BG({scale:r,frameSize:parseInt(n),iframeDocument:f}),B=(0,Vu.useDisabled)({isDisabled:!i}),I=(0,Vu.useMergeRefs)([h_e(f),e,b,B]),P=b_e(u),E=o>=0&&!d,L=(0,Rs.jsxs)(Rs.Fragment,{children:[E&&g,(0,Rs.jsx)("iframe",{...c,style:{...c.style,height:c.style?.height,border:0},ref:(0,Vu.useMergeRefs)([s,k]),tabIndex:o,src:P,title:a,onKeyDown:T=>{if(c.onKeyDown&&c.onKeyDown(T),T.currentTarget.ownerDocument!==T.target.ownerDocument){let{stopPropagation:O}=T.nativeEvent;T.nativeEvent.stopPropagation=()=>{},T.stopPropagation(),T.nativeEvent.stopPropagation=O,PG(T,window.KeyboardEvent,T.currentTarget)}},children:f&&(0,om.createPortal)((0,Rs.jsxs)("body",{ref:I,className:V("block-editor-iframe__body","editor-styles-wrapper",...h),children:[y,(0,Rs.jsx)(IG.__experimentalStyleProvider,{document:f,children:t})]}),f.documentElement)}),E&&v]});return(0,Rs.jsxs)("div",{className:"block-editor-iframe__container",children:[S,(0,Rs.jsx)("div",{className:V("block-editor-iframe__scale-container",x&&"is-zoomed-out"),style:{"--wp-block-editor-iframe-zoom-out-scale-container-width":x&&`${C}px`},children:L})]})}function v_e(e,t){return(0,zD.useSelect)(r=>r(_).getSettings().__internalIsInitialized,[])?(0,Rs.jsx)(k_e,{...e,forwardedRef:t}):null}var Mh=(0,om.forwardRef)(v_e);var x$=l(A(),1),Hh=l(R(),1),w$=l(F(),1);var P1={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},y_e=new Set(["combinator","comma"]);var S_e=e=>{switch(e){case"pseudo-element":case"pseudo-class":return new RegExp(P1[e].source.replace("(?<argument>\xB6*)","(?<argument>.*)"),"gu");default:return P1[e]}};function __e(e,t){let o=0,r="";for(;t<e.length;t++){let n=e[t];switch(n){case"(":++o;break;case")":--o;break}if(r+=n,o===0)return r}return r}function x_e(e,t=P1){if(!e)return[];let o=[e];for(let[n,i]of Object.entries(t))for(let s=0;s<o.length;s++){let a=o[s];if(typeof a!="string")continue;i.lastIndex=0;let c=i.exec(a);if(!c)continue;let u=c.index-1,d=[],f=c[0],m=a.slice(0,u+1);m&&d.push(m),d.push({...c.groups,type:n,content:f});let h=a.slice(u+f.length+1);h&&d.push(h),o.splice(s,1,...d)}let r=0;for(let n of o)switch(typeof n){case"string":throw new Error(`Unexpected sequence ${n} found at index ${r}`);case"object":r+=n.content.length,n.pos=[r-n.content.length,r],y_e.has(n.type)&&(n.content=n.content.trim()||" ");break}return o}var w_e=/(['"])([^\\\n]+?)\1/g,C_e=/\\./g;function jD(e,t=P1){if(e=e.trim(),e==="")return[];let o=[];e=e.replace(C_e,(i,s)=>(o.push({value:i,offset:s}),"\uE000".repeat(i.length))),e=e.replace(w_e,(i,s,a,c)=>(o.push({value:i,offset:c}),`${s}${"\uE001".repeat(a.length)}${s}`));{let i=0,s;for(;(s=e.indexOf("(",i))>-1;){let a=__e(e,s);o.push({value:a,offset:s}),e=`${e.substring(0,s)}(${"\xB6".repeat(a.length-2)})${e.substring(s+a.length)}`,i=s+a.length}}let r=x_e(e,t),n=new Set;for(let i of o.reverse())for(let s of r){let{offset:a,value:c}=i;if(!(s.pos[0]<=a&&Line truncated
|
||||
`+i.showSourceCode(!1)):console.warn("wp.blockEditor.transformStyles Failed to transform CSS.",i),null}}var F0e=(e,t="",o)=>{let r=b$.get(t);return r||(r=new WeakMap,b$.set(t,r)),e.map(n=>{let i=r.get(n);return i||(i=V0e(n,t,o),r.set(n,i)),i})},Uh=F0e;var Uu=l(w(),1);Kc([Yc,Op]);function z0e(e,t){return(0,Hh.useCallback)(o=>{if(!o)return;let{ownerDocument:r}=o,{defaultView:n,body:i}=r,s=t?r.querySelector(t):i,a;if(s)a=n?.getComputedStyle(s,null).getPropertyValue("background-color");else{let u=r.createElement("div");u.classList.add("editor-styles-wrapper"),i.appendChild(u),a=n?.getComputedStyle(u,null).getPropertyValue("background-color"),i.removeChild(u)}let c=Bt(a);c.luminance()>.5||c.alpha()===0?i.classList.remove("is-dark-theme"):i.classList.add("is-dark-theme")},[e,t])}function j0e({styles:e,scope:t,transformOptions:o}){let r=(0,w$.useSelect)(s=>M(s(_)).getStyleOverrides(),[]),[n,i]=(0,Hh.useMemo)(()=>{let s=Object.values(e??[]);for(let[a,c]of r){let u=s.findIndex(({id:f})=>a===f),d={...c,id:a};u===-1?s.push(d):s[u]=d}return[Uh(s.filter(a=>a?.css),t,o),s.filter(a=>a.__unstableType==="svgs").map(a=>a.assets).join("")]},[e,r,t,o]);return(0,Uu.jsxs)(Uu.Fragment,{children:[(0,Uu.jsx)("style",{ref:z0e(n,t)}),n.map((s,a)=>(0,Uu.jsx)("style",{children:s},a)),(0,Uu.jsx)(x$.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:i}})]})}var Nl=(0,Hh.memo)(j0e);var Fi=l(w(),1),U0e=(0,q1.memo)(Gh),_5=2e3,H0e=[];function G0e({viewportWidth:e,containerWidth:t,minHeight:o,additionalStyles:r=H0e}){e||(e=t);let[n,{height:i}]=(0,Dy.useResizeObserver)(),{styles:s}=(0,C$.useSelect)(d=>({styles:d(_).getSettings().styles}),[]),a=(0,q1.useMemo)(()=>s&&[...s,{css:"body{height:auto;overflow:hidden;border:none;padding:0;}",__unstableType:"presets"},...r],[s,r]),c=t/e,u=i?t/(i*c):0;return(0,Fi.jsx)(B$.Disabled,{className:"block-editor-block-preview__content",style:{transform:`scale(${c})`,aspectRatio:u,maxHeight:i>_5?_5*c:void 0,minHeight:o},children:(0,Fi.jsxs)(Mh,{contentRef:(0,Dy.useRefEffect)(d=>{let{ownerDocument:{documentElement:f}}=d;f.classList.add("block-editor-block-preview__content-iframe"),f.style.position="absolute",f.style.width="100%",d.style.boxSizing="border-box",d.style.position="absolute",d.style.width="100%"},[]),"aria-hidden":!0,tabIndex:-1,style:{position:"absolute",width:e,height:i,pointerEvents:"none",maxHeight:_5,minHeight:c!==0&&c<1&&o?o/c:o},children:[(0,Fi.jsx)(Nl,{styles:a}),n,(0,Fi.jsx)(U0e,{renderAppender:!1})]})})}function E$(e){let[t,{width:o}]=(0,Dy.useResizeObserver)();return(0,Fi.jsxs)(Fi.Fragment,{children:[(0,Fi.jsx)("div",{style:{position:"relative",width:"100%",height:0},children:t}),(0,Fi.jsx)("div",{className:"block-editor-block-preview__container",children:!!o&&(0,Fi.jsx)(G0e,{...e,containerWidth:o})})]})}var Wh=l(R(),1),R$=l(I$(),1),P$=(0,R$.createQueue)();function O$({children:e,placeholder:t}){let[o,r]=(0,Wh.useState)(!1);return(0,Wh.useEffect)(()=>{let n={};return P$.add(n,()=>{(0,Wh.flushSync)(()=>{r(!0)})}),()=>{P$.cancel(n)}},[]),o?e:t}var am=l(w(),1),W0e=[];function $0e({blocks:e,viewportWidth:t=1200,minHeight:o,additionalStyles:r=W0e,__experimentalMinHeight:n,__experimentalPadding:i}){n&&(o=n,(0,x5.default)("The __experimentalMinHeight prop",{since:"6.2",version:"6.4",alternative:"minHeight"})),i&&(r=[...r,{css:`body { padding: ${i}px; }`}],(0,x5.default)("The __experimentalPadding prop of BlockPreview",{since:"6.2",version:"6.4",alternative:"additionalStyles"}));let s=(0,w5.useSelect)(u=>u(_).getSettings(),[]),a=(0,sm.useMemo)(()=>({...s,focusMode:!1,isPreviewMode:!0}),[s]),c=(0,sm.useMemo)(()=>Array.isArray(e)?e:[e],[e]);return!e||e.length===0?null:(0,am.jsx)(Ph,{value:c,settings:a,children:(0,am.jsx)(E$,{viewportWidth:t,minHeight:o,additionalStyles:r})})}var A$=(0,sm.memo)($0e);A$.Async=O$;var vn=A$;function L$({blocks:e,props:t={},layout:o}){let r=(0,w5.useSelect)(u=>u(_).getSettings(),[]),n=(0,sm.useMemo)(()=>({...r,styles:void 0,focusMode:!1,isPreviewMode:!0}),[r]),i=(0,Z1.useDisabled)(),s=(0,Z1.useMergeRefs)([t.ref,i]),a=(0,sm.useMemo)(()=>Array.isArray(e)?e:[e],[e]),c=(0,am.jsxs)(Ph,{value:a,settings:n,children:[(0,am.jsx)(Nl,{}),(0,am.jsx)(Vy,{renderAppender:!1,layout:o})]});return{...t,ref:s,className:V(t.className,"block-editor-block-preview__live-content","components-disabled"),children:e?.length?c:null}}var Hu=l(w(),1);function K0e({item:e}){let{name:t,title:o,icon:r,description:n,initialAttributes:i,example:s}=e,a=(0,$h.isReusableBlock)(e),c=(0,N$.useMemo)(()=>s?(0,$h.getBlockFromExample)(t,{attributes:{...s.attributes,...i},innerBlocks:s.innerBlocks}):(0,$h.createBlock)(t,i),[t,s,i]),u=144,d=280,f=s?.viewportWidth??500,m=d/f,h=m!==0&&m<1&&u?u/m:u;return(0,Hu.jsxs)("div",{className:"block-editor-inserter__preview-container",children:[(0,Hu.jsx)("div",{className:"block-editor-inserter__preview",children:a||s?(0,Hu.jsx)
Line truncated
|
||||
body {
|
||||
padding: 24px;
|
||||
min-height:${Math.round(h)}px;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
}
|
||||
.is-root-container { width: 100%; }
|
||||
`}]})}):(0,Hu.jsx)("div",{className:"block-editor-inserter__preview-content-missing",children:(0,M$.__)("No preview available.")})}),!a&&(0,Hu.jsx)(yy,{title:o,icon:r,description:n})]})}var X1=K0e;var Jh=l(N(),1),Vl=l(R(),1),R5=l(Z(),1);var Z$=l($(),1),X$=l(Z(),1);var Qh=l(R(),1),Gu=l($(),1),Y$=l(A(),1),Fy=l(it(),1);var G$=l(A(),1),W$=l(R(),1);var Kh=l(R(),1),D$=l(N(),1),V$=l(Xo(),1),F$=l(w(),1);function Y0e(e,t){let[o,r]=(0,Kh.useState)(!1);return(0,Kh.useEffect)(()=>{o&&(0,V$.speak)((0,D$.__)("Use left and right arrow keys to move through blocks"))},[o]),(0,F$.jsx)("div",{ref:t,role:"listbox","aria-orientation":"horizontal",onFocus:()=>{r(!0)},onBlur:n=>{!n.currentTarget.contains(n.relatedTarget)&&r(!1)},...e})}var C5=(0,Kh.forwardRef)(Y0e);var z$=l(R(),1),j$=l(A(),1),U$=l(w(),1);function q0e(e,t){return(0,U$.jsx)(j$.Composite.Group,{role:"presentation",ref:t,...e})}var B5=(0,z$.forwardRef)(q0e);var J1=l(A(),1),H$=l(R(),1),Q1=l(w(),1);function Z0e({isFirst:e,as:t,children:o,...r},n){return(0,Q1.jsx)(J1.Composite.Item,{ref:n,role:"option",accessibleWhenDisabled:!0,...r,render:i=>{let s={...i,tabIndex:e?0:i.tabIndex};return t?(0,Q1.jsx)(t,{...s,children:o}):typeof o=="function"?o(s):(0,Q1.jsx)(J1.Button,{__next40pxDefaultSize:!0,...s,children:o})}})}var E5=(0,H$.forwardRef)(Z0e);var T5=l(w(),1);function X0e({key:e,children:t}){return(0,T5.jsx)(W$.Fragment,{children:t},e)}function Q0e({children:e}){return(0,T5.jsx)(G$.Composite,{focusShift:!0,focusWrap:"horizontal",render:X0e,children:e})}var Yh=Q0e;var $$=l(A(),1),tB=l($(),1),oB=l(F(),1),K$=l(R(),1);var Zh=l(N(),1),qh=l(A(),1);var As=l(w(),1);function eB({count:e,icon:t,isPattern:o,fadeWhenDisabled:r}){let n=o&&(0,Zh.__)("Pattern");return(0,As.jsx)("div",{className:"block-editor-block-draggable-chip-wrapper",children:(0,As.jsx)("div",{className:"block-editor-block-draggable-chip","data-testid":"block-draggable-chip",children:(0,As.jsxs)(qh.Flex,{justify:"center",className:"block-editor-block-draggable-chip__content",children:[(0,As.jsx)(qh.FlexItem,{children:t?(0,As.jsx)(Ae,{icon:t}):n||(0,Zh.sprintf)((0,Zh._n)("%d block","%d blocks",e),e)}),(0,As.jsx)(qh.FlexItem,{children:(0,As.jsx)(Ae,{icon:tv})}),r&&(0,As.jsx)(qh.FlexItem,{className:"block-editor-block-draggable-chip__disabled",children:(0,As.jsx)("span",{className:"block-editor-block-draggable-chip__disabled-icon"})})]})})})}var I5=l(w(),1),J0e=({isEnabled:e,blocks:t,icon:o,children:r,pattern:n})=>{let i=t.length===1?t[0].name:void 0,s=(0,oB.useSelect)(f=>i&&f(tB.store).getBlockType(i)?.icon,[i]),{startDragging:a,stopDragging:c}=M((0,oB.useDispatch)(_)),u=(0,K$.useMemo)(()=>n?.type===Nt.user&&n?.syncStatus!=="unsynced"?[(0,tB.createBlock)("core/block",{ref:n.id})]:void 0,[n?.type,n?.syncStatus,n?.id]);if(!e)return r({draggable:!1,onDragStart:void 0,onDragEnd:void 0});let d=u??t;return(0,I5.jsx)($$.Draggable,{__experimentalTransferDataType:"wp-blocks",transferData:{type:"inserter",blocks:d},onDragStart:f=>{a();let m=new Set;for(let h of d){let p=`wp-block:${h.name}`;m.has(p)||(f.dataTransfer.items.add("",p),m.add(p))}},onDragEnd:()=>{c()},__experimentalDragComponent:(0,I5.jsx)(eB,{count:t.length,icon:o||!n&&s,isPattern:!!n}),children:({onDraggableStart:f,onDraggableEnd:m})=>r({draggable:!0,onDragStart:f,onDragEnd:m})})},Xh=J0e;var Ml=l(w(),1);function exe({className:e,isFirst:t,item:o,onSelect:r,onHover:n,isDraggable:i,...s}){let a=(0,Qh.useRef)(!1),c=o.icon?{backgroundColor:o.icon.background,color:o.icon.foreground}:{},u=(0,Qh.useMemo)(()=>[(0,Gu.createBlock)(o.name,o.initialAttributes,(0,Gu.createBlocksFromInnerBlocksTemplate)(o.innerBlocks))],[o.name,o.initialAttributes,o.innerBlocks]),d=(0,Gu.isReusableBlock)(o)&&o.syncStatus!=="unsynced"||(0,Gu.isTemplatePart)(o);return(0,Ml.jsx)(Xh,{isEnabled:i&&!o.isDisabled,blocks:u,icon:o.icon,children:({draggable:f,onDragStart:m,onDragEnd:h})=>(0,Ml.jsx)("div",{className:V("block-editor-block-types-list__list-item",{"is-synced":d}),draggable:f,onDragStart:p=>{a.current=!0,m&&(n(null),m(p))},onDragEnd:p=>{a.current=!1,h&&h(p)},children:(0,Ml.jsxs)(E5,{isFirst:t,className:V("block-editor-block-types-list__item",e),disabled:o.isDisabled,onClick:p=>{p.preventDefault(),r(o,(0,Fy.isAppleOS)()?p.metaKey:p.ctrlKey),n(null)},onKeyDown:p=>{let{keyCode:g}=p;g===Fy.ENTER&&(p.preventDefault(),r(o,(0,Fy.isAppleOS)()?p.metaKey:p.ctrlKey),n(null))},onMouseEnter:()=>{a.current||n(o)},onMouseLeave:()=>n(null),...s,children:[(0,Ml.jsx)("span",{className:"block-editor-block-types-list__item-icon",style:c,children:(0,Ml.jsx)(Ae,{icon:o.icon,showColors:!0})}),(0,Ml.jsx)("span",{className:"block-editor-block-types-list__item-title",children:(0,Ml.jsx)(Y$.__experimentalTruncate,{numberOfLines:3,children:o.title})})]})})})}var q$=(0,Qh.memo)(exe);var zy=l(w(),1);function txe(e,t){let o=[];for(let r=0,n=e.length;r<n;r+=t)o.push(e.slice(r,r+t));return o}function Q$({items:e=[],onSelect:t,onHover:o=()=>{},children:r,label:n,isDraggable:i=!0}){let s="block-editor-block-types-lis
Line truncated
|
||||
.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;
|
||||
`),p+="}"),a.blockStyles&&c.forEach(({selector:g,duotoneSelector:b,styles:v,fallbackGapValue:k,hasLayoutSupport:y,featureSelectors:S,styleVariationSelectors:x,skipSelectorWrapper:C,name:B})=>{if(S){let E=KX(S,v);E=$X(E,e.settings,B),Object.entries(E).forEach(([L,T])=>{if(T.length){let O=T.join(";");p+=`:root :where(${L}){${O};}`}})}if(b){let E={};v?.filter&&(E.filter=v.filter,delete v.filter);let L=Ag(E);L.length&&(p+=`${b}{${L.join(";")};}`)}!n&&(Oa===g||y)&&(p+=FV({style:v,selector:g,hasBlockGapSupport:o,hasFallbackGapSupport:r,fallbackGapValue:k}));let I=Ag(v,g,d,e,i);if(I?.length){let E=C?g:`:root :where(${g})`;p+=`${E}{${I.join(";")};}`}v?.css&&(p+=CS(v.css,`:root :where(${g})`)),a.variationStyles&&x&&Object.entries(x).forEach(([E,L])=>{let T=v?.variations?.[E];if(T){if(S){let D=KX(S,T);D=$X(D,e.settings,B),Object.entries(D).forEach(([U,G])=>{if(G.length){let j=N1e(U,L),z=G.join(";");p+=`:root :where(${j}){${z};}`}})}let O=Ag(T,L,d,e);if(O.length&&(p+=`:root :where(${L}){${O.join(";")};}`),T?.css&&(p+=CS(T.css,`:root :where(${L})`)),y&&T?.spacing?.blockGap){let D=L+g;p+=FV({style:T,selector:D,hasBlockGapSupport:!0,hasFallbackGapSupport:r,fallbackGapValue:k})}}});let P=Object.entries(v).filter(([E])=>E.startsWith(":"));P?.length&&P.forEach(([E,L])=>{let T=Ag(L);if(!T?.length)return;let D=`:root :where(${g.split(",").map(U=>U+E).join(",")}){${T.join(";")};}`;p+=D})}),a.layoutStyles&&(p=p+".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }",p=p+".wp-site-blocks > .alignright { float: right; margin-left: 2em; }",p=p+".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"),a.blockGap&&o){let g=VV(e?.styles?.spacing?.blockGap)||"0.5em";p=p+`:root :where(.wp-site-blocks) > * { margin-block-start: ${g}; margin-block-end: 0; }`,p=p+":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }",p=p+":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"}return a.presets&&u.forEach(({selector:g,presets:b})=>{(Oa===g||_S===g)&&(g="");let v=L1e(g,b);v.length>0&&(p+=v)}),p};var F1e=(e,t)=>{if(e?.selectors&&Object.keys(e.selectors).length>0)return e.selectors;let o={root:t};return Object.entries(A1e).forEach(([r,n])=>{let i=oi(e,r);i&&(o[n]=i)}),o},rT=(e,t)=>{let{getBlockStyles:o}=(0,YX.select)(qr.store),r={};return e.forEach(n=>{let i=n.name,s=oi(n);if(!s)return;let a=oi(n,"filter.duotone");if(!a){let h=oi(n),p=(0,qr.getBlockSupport)(n,"color.__experimentalDuotone",!1);a=p&&h&&js(h,p)}let c=!!n?.supports?.layout||!!n?.supports?.__experimentalLayout,u=n?.supports?.spacing?.blockGap?.__experimentalDefault,d=o(i),f={};d?.forEach(h=>{let p=t?`-${t}`:"",g=`${h.name}${p}`,b=VX(g,s);f[g]=b});let m=F1e(n,s);r[i]={duotoneSelector:a??void 0,fallbackGapValue:u,featureSelectors:Object.keys(m).length?m:void 0,hasLayoutSupport:c,name:i,selector:s,styleVariationSelectors:d?.length?f:void 0}}),r};function CS(e,t){let o="";return!e||e.trim()===""||e.split("&").forEach(n=>{if(!n||n.trim()==="")return;if(!n.includes("{"))o+=`:root :where(${t}){${n.trim()}}`;else{let s=n.replace("}","").split("{");if(s.length!==2)return;let[a,c]=s,u=a.match(/([>+~\s]*::[a-zA-Z-]+)/),d=u?u[1]:"",f=u?a.replace(d,"").trim():a.trim(),m;f===""?m=t:m=a.startsWith(" ")?js(t,f):DX(t,f),o+=`:root :where(${m})${d}{${c.trim()}}`}}),o}var ES=l(w(),1),zV="is-style-";function qX(e){return e?e.split(/\s+/).reduce((t,o)=>{if(o.startsWith(zV)){let r=o.slice(zV.length);r!=="default"&&t.push(r)}return t},[]):[]}function jV(e,t=[]){let o=qX(e);if(!o)return null;for(let r of o)if(t.some(n=>n.name===r))return r;return null}function z1e({override:e}){tc(e)}function UV({config:e}){let{getBlockStyles:t,overrides:o}=(0,BS.useSelect)(i=>({getBlockStyles:i(Lg.store).getBlockStyles,overrides:M(i(_)).getStyleOverrides()}),[]),{getBlockName:r}=(0,BS.useSelect)(_),n=(0,nT.useMemo)(()=>{if(!o?.length)return;let i=[],s=[];for(let[,a]of o)if(a?.variation&&a?.clientId&&!s.includes(a.clientId)){let c=r(a.clientId),u=e?.styles?.blocks?.[c]?.variations?.[a.variation];if(u){let d={settings:e?.settings,styles:{blocks:{[c]:{variations:{[`${a.variation}-${a.clientId}`]:u}}}}},f=rT((0,Lg.getBlockTypes)(),a.clientId),b=oT(d,f,!1,!0,!0,!0,{blockGap:!1,blockStyles:!0,layoutStyles:!1,marginReset:!1,presets:!1,rootPadding:!1,variationStyles:!0});i.push({id:`${a.variation}-${a.clientId}`,css:b,__unstableType:"variation",variation:a.variation,clientId:a.clientId}),s.push(a.clientId)}}return i},[e,o,t,r]);return!n||!n.length?null:(0,ES.jsx)(ES.Fragment,{children:n.map(i=>(0,ES.jsx)(z1e,{override:i},i.id))})}function HV(e,t,o){if(!e?.styles?.blocks?.[t]?.variations?.[o])return;let r=i=>{Object.keys(i).forEach(s=>{let a=i[s];if(typeof a=="object"&&a!==null)if(a.ref!==void 0)if(typeof a.ref!="string"||a.ref.trim()==="")delete i[s];else{let c=yl(e,a.ref);c?i[s]=c:delete i[s]}else r(a),Object.keys(a).length===0&&delete i[s]})},n=JSON.parse(JSON.stringify(e.styles.blocks[t].variations[o]));return r(n),n}function j1e(e,t,
Line truncated
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
touch-action: none;
|
||||
cursor: move;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.reactEasyCrop_Image,
|
||||
.reactEasyCrop_Video {
|
||||
will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
|
||||
}
|
||||
|
||||
.reactEasyCrop_Contain {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
margin: auto;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
.reactEasyCrop_Cover_Horizontal {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.reactEasyCrop_Cover_Vertical {
|
||||
width: auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.reactEasyCrop_CropArea {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 0 0 9999em;
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.reactEasyCrop_CropAreaRound {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.reactEasyCrop_CropAreaGrid::before {
|
||||
content: ' ';
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 33.33%;
|
||||
right: 33.33%;
|
||||
border-top: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.reactEasyCrop_CropAreaGrid::after {
|
||||
content: ' ';
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||
top: 33.33%;
|
||||
bottom: 33.33%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
`,LEe=1,NEe=3,MEe=1,foe=(function(e){IU(t,e);function t(){var o=e!==null&&e.apply(this,arguments)||this;return o.cropperRef=es.createRef(),o.imageRef=es.createRef(),o.videoRef=es.createRef(),o.containerPosition={x:0,y:0},o.containerRef=null,o.styleRef=null,o.containerRect=null,o.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},o.dragStartPosition={x:0,y:0},o.dragStartCrop={x:0,y:0},o.gestureZoomStart=0,o.gestureRotationStart=0,o.isTouching=!1,o.lastPinchDistance=0,o.lastPinchRotation=0,o.rafDragTimeout=null,o.rafPinchTimeout=null,o.wheelTimer=null,o.currentDoc=typeof document<"u"?document:null,o.currentWindow=typeof window<"u"?window:null,o.resizeObserver=null,o.previousCropSize=null,o.isInitialized=!1,o.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},o.initResizeObserver=function(){if(!(typeof window.ResizeObserver>"u"||!o.containerRef)){var r=!0;o.resizeObserver=new window.ResizeObserver(function(n){if(r){r=!1;return}o.computeSizes()}),o.resizeObserver.observe(o.containerRef)}},o.preventZoomSafari=function(r){return r.preventDefault()},o.cleanEvents=function(){o.currentDoc&&(o.currentDoc.removeEventListener("mousemove",o.onMouseMove),o.currentDoc.removeEventListener("mouseup",o.onDragStopped),o.currentDoc.removeEventListener("touchmove",o.onTouchMove),o.currentDoc.removeEventListener("touchend",o.onDragStopped),o.currentDoc.removeEventListener("gesturechange",o.onGestureChange),o.currentDoc.removeEventListener("gestureend",o.onGestureEnd),o.currentDoc.removeEventListener("scroll",o.onScroll))},o.clearScrollEvent=function(){o.containerRef&&o.containerRef.removeEventListener("wheel",o.onWheel),o.wheelTimer&&clearTimeout(o.wheelTimer)},o.onMediaLoad=function(){var r=o.computeSizes();r&&(o.previousCropSize=r,o.emitCropData(),o.setInitialCrop(r),o.isInitialized=!0),o.props.onMediaLoaded&&o.props.onMediaLoaded(o.mediaSize)},o.setInitialCrop=function(r){if(o.props.initialCroppedAreaPercentages){var n=IEe(o.props.initialCroppedAreaPercentages,o.mediaSize,o.props.rotation,r,o.props.minZoom,o.props.maxZoom),i=n.crop,s=n.zoom;o.props.onCropChange(i),o.props.onZoomChange&&o.props.onZoomChange(s)}else if(o.props.initialCroppedAreaPixels){var a=REe(o.props.initialCroppedAreaPixels,o.mediaSize,o.props.rotation,r,o.props.minZoom,o.props.maxZoom),i=a.crop,s=a.zoom;o.props.onCropChange(i),o.props.onZoomChange&&o.props.onZoomChange(s)}},o.computeSizes=function(){var r,n,i,s,a,c,u=o.imageRef.current||o.videoRef.current;if(u&&o.containerRef){o.containerRect=o.containerRef.getBoundingClientRect(),o.saveContainerPosition();var d=o.containerRect.width/o.containerRect.height,f=((r=o.imageRef.current)===null||r===void 0?void 0:r.naturalWidth)||((n=o.videoRef.current)===null||n===void 0?void 0:n.videoWidth)||0,m=((i=o.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((s=o.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0,h=u.offsetWidth<f||u.offsetHeight<m,p=f/m,g=void 0;if(h)switch(o.state.mediaObjectFit){default:case"contain":g=d>p?{width:o.containerRect.height*p,height:o.containerRect.height}:{width:o.containerRect.width,height:o.containerRect.width/p};break;case"horizontal-cover":g={width:o.containerRect.width,height:o.containerRect.width/p};break;case"vertical-cover":g={width:o.containerRect.height*p,height:o.containerRect.height};break}else g={width:u.offsetWidth,height:u.offsetHeight};o.mediaSize=Fo(Fo({},g),{naturalWidth:f,naturalHeight:m}),o.props.setMediaSize&&o.props.setMediaSize(o.mediaSize);var b=o.props.cropSize?o.props.cropSize:wEe(o.mediaSize.width,o.mediaSize.height,o.containerRect.width,o.containerRect.height,o.props.aspect,o.props.rotation);return(((a=o.state.cropSize)===null||a===void 0?void 0:a.height)!==b.height||((c=o.state.cropSize)===null||c===void 0?void 0:c.width)!==b.width)&&o.props.onCropSizeChange&&o.props.onCropSizeChange(b),o.setState({cropSize:b},o.recomputeCropPosition),o.props.setCropSize&&o.props.setCropSize(b),b}},o.saveContainerPosition=function(){if(o.containerRef){var r=o.containerRef.getBoundingClientRect();o.containerPosition={x:r.left,y:r.top}}},o.onMouseDown=function(r){o.currentDoc&&(r.preventDefault(),o.currentDoc.addEventListener("mousemove",o.onMouseMove),o.currentDoc.addEventListener("mouseup",o.onDragStopped),o.saveContainerPosition(),o.onDragStart(t.getMousePoint(r)))},o.onMouseMove=function(r){return o.onDrag(t.getMousePoint(r))},o.onScroll=function(r){o.currentDoc&&(r.preventDefault(),o.saveContainerPosition())},o.onTouchStart=function(r){o.currentDoc&&(o.isTouching=!0,!(o.props.onTouchRequest&&!o.props.onTouchRequest(r))&&(o.currentDoc.addEventListener("touchmove",o.onTouchMove,{passive:!1}),o.currentDoc.addEventListener("touchend",o.onDragStopped),o.saveContainerPosition(),r.touches.length===2?o.onPinchStart(r):r.touches.length===1&&o.onDragStart(t.getTouchPoint(r.touches[0]))))},o.onTouchMove=function(r){r.preventDefault(),r.touches.length===2?o.onPinchMove(r):r.touches.length===1&&o.onDrag(t.getTouchPoint(r.touches[0]))}
Line truncated
|
||||
|
||||
`,g),window.console.log(`Received plain text (RichText):
|
||||
|
||||
`,p),i){s((0,Wa.insert)(a,p));return}let b=n.clipboardData.getData("rich-text")==="true";function v(x){let C=c.reduce((B,{__unstablePasteRule:I})=>(I&&B===a&&(B=I(a,{html:g,plainText:p})),B),a);if(C!==a)s(C);else{let B=(0,Wa.create)({html:x});Lne(B,a.activeFormats),s((0,Wa.insert)(a,B))}}if(b){v(g);return}if(h){s((0,Wa.insert)(a,(0,Wa.create)({text:p})));return}let k="INLINE",y=p.trim();f&&(0,Wa.isEmpty)(a)&&(0,Mne.isURL)(y)&&/^https?:/.test(y)&&(k="BLOCKS");let S=(0,Nne.pasteHandler)({HTML:g,plainText:p,mode:k,tagName:u,preserveWhiteSpace:m});typeof S=="string"?v(S):S.length>0&&d&&(0,Wa.isEmpty)(a)&&d(S,S.length-1,-1)}let{defaultView:r}=t.ownerDocument;return r.addEventListener("paste",o),()=>{r.removeEventListener("paste",o)}};var e_=l(it(),1),eP=l(dr(),1),Vne=e=>t=>{function o(r){let{keyCode:n}=r;if(r.defaultPrevented)return;let{value:i,onMerge:s,onRemove:a}=e.current;if(n===e_.DELETE||n===e_.BACKSPACE){let{start:c,end:u,text:d}=i,f=n===e_.BACKSPACE,m=i.activeFormats&&!!i.activeFormats.length;if(!(0,eP.isCollapsed)(i)||m||f&&c!==0||!f&&u!==d.length)return;s?s(!f):a&&(0,eP.isEmpty)(i)&&f&&a(!f),r.preventDefault()}}return t.addEventListener("keydown",o),()=>{t.removeEventListener("keydown",o)}};var kF=l(it(),1),t_=l(dr(),1),Fne=e=>t=>{function o(i){if(i.keyCode!==kF.ENTER)return;let{onReplace:s,onSplit:a}=e.current;s&&a&&(i.__deprecatedOnSplit=!0)}function r(i){if(i.defaultPrevented||i.target!==t||i.keyCode!==kF.ENTER)return;let{value:s,onChange:a,disableLineBreaks:c,onSplitAtEnd:u,onSplitAtDoubleLineEnd:d,registry:f}=e.current;i.preventDefault();let{text:m,start:h,end:p}=s;i.shiftKey?c||a((0,t_.insert)(s,`
|
||||
`)):u&&h===p&&p===m.length?u():d&&h===p&&p===m.length&&m.slice(-2)===`
|
||||
|
||||
`?f.batch(()=>{let g={...s};g.start=g.end-2,a((0,t_.remove)(g)),d()}):c||a((0,t_.insert)(s,`
|
||||
`))}let{defaultView:n}=t.ownerDocument;return n.addEventListener("keydown",r),t.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",r),t.removeEventListener("keydown",o)}};var zne=e=>t=>{function o(){let{registry:r}=e.current;if(!r.select(_).isMultiSelecting())return;let n=t.parentElement.closest('[contenteditable="true"]');n&&n.focus()}return t.addEventListener("focus",o),()=>{t.removeEventListener("focus",o)}};var PTe=[wne,Tne,Ine,Pne,Rne,One,Ane,Dne,Vne,Fne,zne];function tP(e){let t=(0,Bb.useRef)(e);(0,Bb.useInsertionEffect)(()=>{t.current=e});let o=(0,Bb.useMemo)(()=>PTe.map(r=>r(t)),[t]);return(0,jne.useRefEffect)(r=>{if(!e.isSelected)return;let n=o.map(i=>i(r));return()=>{n.forEach(i=>i())}},[o,e.isSelected])}var oP=l(dr(),1),rP=l(R(),1);var Une=l(w(),1),Hne=l(jr(),1),RTe={},vF=Symbol("usesContext");function OTe({onChange:e,onFocus:t,value:o,forwardedRef:r,settings:n,isVisible:i}){let{name:s,edit:a,[vF]:c}=n,u=(0,rP.useContext)(xr),d=(0,rP.useMemo)(()=>c?Object.fromEntries(Object.entries(u).filter(([g])=>c.includes(g))):RTe,[c,u]);if(!a)return null;let f=(0,oP.getActiveFormat)(o,s),m=f!==void 0,h=(0,oP.getActiveObject)(o),p=h!==void 0&&h.type===s;return(0,Une.jsx)(a,{isActive:m,isVisible:i,activeAttributes:m?f.attributes||{}:{},isObjectActive:p,activeObjectAttributes:p?h.attributes||{}:{},value:o,onChange:e,onFocus:t,contentRef:r,context:d},s)}function nP({formatTypes:e,...t}){return e.map(o=>(0,Hne.createElement)(OTe,{settings:o,...t,key:o.name}))}var Gne=l(R(),1),Wne=l($(),1),$ne=l(Re(),1);var yF=l(w(),1);function SF(e,t){if(Eb.isEmpty(e)){let o=JI(t);return o?`<${o}></${o}>`:""}return Array.isArray(e)?((0,$ne.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/"}),Wne.children.toHTML(e)):typeof e=="string"?e:e.toHTMLString()}function o_({value:e,tagName:t,multiline:o,format:r,...n}){return e=(0,yF.jsx)(Gne.RawHTML,{children:SF(e,o)}),t?(0,yF.jsx)(t,{...n,children:e}):e}var Xne=l(R(),1),xF=l($(),1),Qne=l(dr(),1),Jne=l(Re(),1);var Kne=l(R(),1),Yne=l(Re(),1),iP=l(F(),1),qne=l(it(),1),Tb=l(dr(),1);var _F=l(w(),1);function ATe({children:e,identifier:t,tagName:o="div",value:r="",onChange:n,multiline:i,...s},a){(0,Yne.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/"});let{clientId:c}=Ie(),{getSelectionStart:u,getSelectionEnd:d}=(0,iP.useSelect)(_),{selectionChange:f}=(0,iP.useDispatch)(_),m=JI(i);r=r||`<${m}></${m}>`;let p=`</${m}>${r}<${m}>`.split(`</${m}><${m}>`);p.shift(),p.pop();function g(b){n(`<${m}>${b.join(`</${m}><${m}>`)}</${m}>`)}return(0,_F.jsx)(o,{ref:a,children:p.map((b,v)=>(0,_F.jsx)(sP,{identifier:`${t}-${v}`,tagName:m,value:b,onChange:k=>{let y=p.slice();y[v]=k,g(y)},isSelected:void 0,onKeyDown:k=>{if(k.keyCode!==qne.ENTER)return;k.preventDefault();let{offset:y}=u(),{offset:S}=d();if(typeof y!="number"||typeof S!="number")return;let x=(0,Tb.create)({html:b});x.start=y,x.end=S;let C=(0,Tb.split)(x).map(I=>(0,Tb.toHTMLString)({value:I})),B=p.slice();B.splice(v,1,...C),g(B),f(c,`${t}-${v+1}`,0,0)},onMerge:k=>{let y=p.slice(),S=0;if(k){if(!y[v+1])return;y.splice(v,2,y[v]+y[v+1]),S=y[v].length-1}else{if(!y[v-1])return;y.splice(v-1,2,y[v-1]+y[v]),S=y[v-1].length-1}g(y),f(c,`${t}-${v-(k?0:1)}`,S,S)},...s},v))})}var Zne=(0,Kne.forwardRef)(ATe);var eie=l(w(),1);function tie(e){return(0,Xne.forwardRef)((t,o)=>{let r=t.value,n=t.onChange;Array.isArray(r)&&((0,Jne.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/"}),r=xF.children.toHTML(t.value),n=s=>t.onChange(xF.children.fromDOM((0,Qne.__unstableCreateElement)(document,s).childNodes)));let i=t.multiline?Zne:e;return(0,eie.jsx)(i,{...t,value:r,onChange:n,ref:o})})}var oie=l(it(),1),Ib=l(R(),1);function wF({character:e,type:t,onUse:o}){let r=(0,Ib.useContext)(Pb),n=(0,Ib.useRef)();return n.current=o,(0,Ib.useEffect)(()=>{function i(s){oie.isKeyboardEvent[t](s,e)&&(n.current(),s.preventDefault())}return r.current.add(i),()=>{r.current.delete(i)}},[e,t]),null}var aP=l(A(),1),rie=l(it(),1),CF=l(w(),1);function BF({name:e,shortcutType:t,shortcutCharacter:o,...r}){let n,i="RichText.ToolbarControls";return e&&(i+=`.${e}`),t&&o&&(n=rie.displayShortcut[t](o)),(0,CF.jsx)(aP.Fill,{name:i,children:(0,CF.jsx)(aP.ToolbarButton,{...r,shortcut:n})})}var Rb=l(R(),1);function EF({inputType:e,onInput:t}){let o=(0,Rb.useContext)(Ob),r=(0,Rb.useRef)();return r.current=t,(0,Rb.useEffect)(()=>{function n(i){i.inputType===e&&(r.current(),i.preventDefault())}return o.current.add(n),()=>{o.curren
Line truncated
|
||||
<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="${e}">
|
||||
<!--
|
||||
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="${o.r.join(" ")}"></feFuncR>
|
||||
<feFuncG type="table" tableValues="${o.g.join(" ")}"></feFuncG>
|
||||
<feFuncB type="table" tableValues="${o.b.join(" ")}"></feFuncB>
|
||||
<feFuncA type="table" tableValues="${o.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>`}var Vc=l(w(),1),Tz=[],mAe=window?.navigator.userAgent&&window.navigator.userAgent.includes("Safari")&&!window.navigator.userAgent.includes("Chrome")&&!window.navigator.userAgent.includes("Chromium");Kc([Yc]);function Iz({presetSetting:e,defaultSetting:t}){let[o,r,n,i]=me(t,`${e}.custom`,`${e}.theme`,`${e}.default`);return(0,G_.useMemo)(()=>[...r||Tz,...n||Tz,...o&&i||Tz],[o,r,n,i])}function zfe(e,t){if(!e)return;let o=t?.find(({slug:r})=>e===`var:preset|duotone|${r}`);return o?o.colors:void 0}function pAe(e,t){if(!e||!Array.isArray(e))return;let o=t?.find(r=>r?.colors?.every((n,i)=>n===e[i]));return o?`var:preset|duotone|${o.slug}`:void 0}function hAe({style:e,setAttributes:t,name:o}){let r=e?.color?.duotone,n=is(o),i=ao(),s=Iz({presetSetting:"color.duotone",defaultSetting:"color.defaultDuotone"}),a=Iz({presetSetting:"color.palette",defaultSetting:"color.defaultPalette"}),[c,u]=me("color.custom","color.customDuotone"),d=!c,f=!u||a?.length===0&&d;if(s?.length===0&&f||i!=="default")return null;let m=r==="unset"||Array.isArray(r)?r:zfe(r,s);return(0,Vc.jsxs)(Vc.Fragment,{children:[(0,Vc.jsx)(fe,{group:"filter",children:(0,Vc.jsx)(KP,{value:{filter:{duotone:m}},onChange:h=>{let p={...e,color:{...h?.filter}};t({style:Me(p)})},settings:n})}),(0,Vc.jsx)(Mt,{group:"block",__experimentalShareWithChildBlocks:!0,children:(0,Vc.jsx)(eI,{duotonePalette:s,colorPalette:a,disableCustomDuotone:f,disableCustomColors:d,value:m,onChange:h=>{let p=pAe(h,s),g={...e,color:{...e?.color,duotone:p??h}};t({style:Me(g)})},settings:n})})]})}var Pz={shareWithChildBlocks:!0,edit:hAe,useBlockProps:vAe,attributeKeys:["style"],hasSupport(e){return(0,uf.hasBlockSupport)(e,"filter.duotone")}};function gAe(e){return(0,uf.hasBlockSupport)(e,"filter.duotone")&&(e.attributes.style||Object.assign(e.attributes,{style:{type:"object"}})),e}function bAe({clientId:e,id:t,selector:o,attribute:r}){let n=Iz({presetSetting:"color.duotone",defaultSetting:"color.defaultDuotone"}),i=Array.isArray(r),s=i?void 0:zfe(r,n),a=typeof r=="string"&&s,c=typeof r=="string"&&!a,u=null;a?u=s:(c||i)&&(u=r);let m=o.split(",").map(g=>`.${t}${g.trim()}`).join(", "),h=Array.isArray(u)||u==="unset";tc(h?{css:u!=="unset"?Dfe(m,t):Mfe(m),__unstableType:"presets"}:void 0),tc(h?{assets:u!=="unset"?UR(t,u):"",__unstableType:"svgs"}:void 0);let p=Xe(e);(0,G_.useEffect)(()=>{if(h&&p&&mAe){let g=p.style.display;p.style.setProperty("display","inline-block"),p.offsetHeight,p.style.setProperty("display",g)}},[h,p,u])}var kAe={};function vAe({clientId:e,name:t,style:o}){let r=(0,Vfe.useInstanceId)(kAe),n=(0,G_.useMemo)(()=>{let c=(0,uf.getBlockType)(t);if(c){if(!(0,uf.getBlockSupport)(c,"filter.duotone",!1))return null;let d=(0,uf.getBlockSupport)(c,"color.__experimentalDuotone",!1);if(d){let f=oi(c);return typeof d=="string"?bg(f,d):f}return oi(c,"filter.duotone",{fallback:!0})}},[t]),i=o?.color?.duotone,s=`wp-duotone-${r}`,a=n&&i;return bAe({clientId:e,id:s,selector:n,attribute:i}),{className:a?s:""}}(0,Ffe.addFilter)("blocks.registerBlockType","core/editor/duotone/add-attributes",gAe);var GR=l(R(),1),W_=l(F(),1),jfe=l(Z(),1),$_=l($(),1),K_=l(N(),1);var Ufe=l(Un(),1);var HR=l(w(),1),yAe={},SAe={};function _Ae({blockName:e,setAttributes:t,style:o}){if(ao()!=="default")return null;let n=(0,$_.getBlockType)(e);function i(a){let c=a?.css?.trim()?a.css:void 0;t({style:Me({...a,css:c})})}let s=(0,K_.sprintf)((0,K_.__)("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, e.g. color: red;."),n?.title);return(0,HR.jsx)(fe,{group:"advanced",children:(0,HR.jsx)(ZP,{value:o,onChange:i,inheritedValue:o,help:s})})}var xAe="custom-css-edit-warning";function wAe({clientId:e,name:t,setAttributes:o}){let{style:r,canEditCSS:n}=(0,W_.useSelect)(i=>{let{getBlockAttributes:s,getSettings:a}=i(_);return{style:s(e)?.style||SAe,canEditCSS:a().canEditCSS}},[e]);return n?(0,HR.jsx)(_Ae,{blockName:t,setAttributes:o,style:r}):null}function CAe({style:e}){let t=e?.css,o=typeof t=="string"&&t.trim().length>0&&qP(t),r=(0,W_.useSelect)(u=>u(_).getSettings().canEditCSS,[]),{createWarningNotice:n}=(0,W_.useDispatch)(Ufe.store),i=!!t?.trim();(0,GR.useEffect)(()=>{!r&&i&&n((0,K_.__)("This post contains blocks with custom CSS. You do not have permission to edit CSS. If you save this post, the custom CSS will be removed."),{id:xAe,isDismissible:!0})},[r,i,n]);let s=(0,jfe.useInstanceId)(yAe,"wp-custom-css"),a=`.${s}`,c=(0,GR.useMemo)(()=>{if(o)return CS(t,a)},[t,a,o]);return Qn({css:c}),o?{className:`has-custom-css ${s}`}:{}}function BAe(e,t,o){if(!(0,$_.hasBlockSupport)(t,"customCSS",!0)||!o?.style?.css?.trim())return e;let r=e.className?`${e.className} has-custom-css`:"has-custom-css";return{...e,className:r}}var WR={edit:wAe,useBlockProps:CAe,addSaveProps:BAe,attributeKeys:["style"],hasSupport(e){return(0,$_.hasBlockSupport)(e,"customCSS",!0)}};var $R=l(Z(),1),Oz=l(ut(),1),Fc=l($(),1),KR=l(F(),1),fl=l(A(),1),Rk=l(N(),1);var Yo=l(Line truncated
|
||||
calc(${a} + ${r})
|
||||
calc(${c} + ${n})
|
||||
calc(${u} + ${i})
|
||||
calc(${d} + ${s})
|
||||
`}}}var ki=l(w(),1);function Z_({clientId:e,contentRef:t,parentLayout:o,childGridClientId:r}){let n=(0,df.useSelect)(a=>a(_).getSettings().isDistractionFree,[]),i=Xe(e);if(n||!i)return null;let s=o?.isManualPlacement&&window.__experimentalEnableGridInteractivity;return(0,ki.jsx)(LAe,{gridClientId:e,gridElement:i,isManualGrid:s,ref:t,childGridClientId:r})}var LAe=(0,fs.forwardRef)(({gridClientId:e,gridElement:t,isManualGrid:o,childGridClientId:r},n)=>{let[i,s]=(0,fs.useState)(()=>Mz(t)),[a,c]=(0,fs.useState)(!1),u=Xe(r),d=(0,fs.useMemo)(()=>u?Gfe(u):null,[u]);return(0,fs.useEffect)(()=>{let f=()=>s(Mz(t)),m=new window.ResizeObserver(f);m.observe(t,{box:"border-box"});let h=new window.ResizeObserver(f);return h.observe(t),()=>{m.disconnect(),h.disconnect()}},[t]),(0,fs.useEffect)(()=>{function f(){c(!0)}function m(){c(!1)}return document.addEventListener("drag",f),document.addEventListener("dragend",m),()=>{document.removeEventListener("drag",f),document.removeEventListener("dragend",m)}},[]),(0,ki.jsx)(Hi,{className:V("block-editor-grid-visualizer",{"is-dropping-allowed":a}),clientId:e,__unstablePopoverSlot:"__unstable-block-tools-after",children:(0,ki.jsx)("div",{ref:n,className:"block-editor-grid-visualizer__grid",style:i.style,children:o?(0,ki.jsx)(MAe,{gridClientId:e,gridInfo:i,childGridRect:d}):(0,ki.jsx)(NAe,{gridInfo:i,childGridRect:d})})})});function NAe({gridInfo:e,childGridRect:t}){return q_(1,e.numRows).map(o=>q_(1,e.numColumns).map(r=>{let n=e.currentColor;return t?.contains(r,o)&&(n="transparent"),(0,ki.jsx)($fe,{color:n},`${o}-${r}`)}))}function MAe({gridClientId:e,gridInfo:t,childGridRect:o}){let[r,n]=(0,fs.useState)(null),i=(0,df.useSelect)(a=>{let{getBlockOrder:c,getBlockStyles:u}=M(a(_)),d=c(e);return u(d)},[e]),s=(0,fs.useMemo)(()=>{let a=[];for(let c of Object.values(i)){let{columnStart:u,rowStart:d,columnSpan:f=1,rowSpan:m=1}=c?.layout??{};!u||!d||a.push(new aa({columnStart:u,rowStart:d,columnSpan:f,rowSpan:m}))}return a},[i]);return q_(1,t.numRows).map(a=>q_(1,t.numColumns).map(c=>{let u=o?.contains(c,a),d=t.currentColor;u&&(d="transparent");let f=s.some(h=>h.contains(c,a)),m=r?.contains(c,a)??!1;return(0,ki.jsx)($fe,{color:d,className:m&&"is-highlighted",children:f&&!u?(0,ki.jsx)(DAe,{column:c,row:a,gridClientId:e,gridInfo:t,setHighlightedRect:n}):(0,ki.jsx)(VAe,{column:c,row:a,gridClientId:e,gridInfo:t,setHighlightedRect:n})},`${a}-${c}`)}))}function $fe({color:e,children:t,className:o}){return(0,ki.jsx)("div",{className:V("block-editor-grid-visualizer__cell",o),style:{boxShadow:`inset 0 0 0 1px color-mix(in srgb, ${e} 20%, #0000)`,color:e},children:t})}function Kfe(e,t,o,r,n){let{getBlockAttributes:i,getBlockRootClientId:s,canInsertBlockType:a,getBlockName:c}=(0,df.useSelect)(_),{updateBlockAttributes:u,moveBlocksToPosition:d,__unstableMarkNextChangeAsNotPersistent:f}=(0,df.useDispatch)(_),m=np(o,r.numColumns);return FAe({validateDrag(h){let p=c(h);if(!a(p,o))return!1;let g=i(h),b=new aa({columnStart:e,rowStart:t,columnSpan:g.style?.layout?.columnSpan,rowSpan:g.style?.layout?.rowSpan});return new aa({columnSpan:r.numColumns,rowSpan:r.numRows}).containsRect(b)},onDragEnter(h){let p=i(h);n(new aa({columnStart:e,rowStart:t,columnSpan:p.style?.layout?.columnSpan,rowSpan:p.style?.layout?.rowSpan}))},onDragLeave(){n(h=>h?.columnStart===e&&h?.rowStart===t?null:h)},onDrop(h){n(null);let p=i(h);u(h,{style:{...p.style,layout:{...p.style?.layout,columnStart:e,rowStart:t}}}),f(),d([h],s(h),o,m(e,t))}})}function DAe({column:e,row:t,gridClientId:o,gridInfo:r,setHighlightedRect:n}){return(0,ki.jsx)("div",{className:"block-editor-grid-visualizer__drop-zone",ref:Kfe(e,t,o,r,n)})}function VAe({column:e,row:t,gridClientId:o,gridInfo:r,setHighlightedRect:n}){let{updateBlockAttributes:i,moveBlocksToPosition:s,__unstableMarkNextChangeAsNotPersistent:a}=(0,df.useDispatch)(_),c=np(o,r.numColumns);return(0,ki.jsx)(Qu,{rootClientId:o,className:"block-editor-grid-visualizer__appender",ref:Kfe(e,t,o,r,n),style:{color:r.currentColor},onSelect:u=>{u&&(i(u.clientId,{style:{layout:{columnStart:e,rowStart:t}}}),a(),s([u.clientId],o,o,c(e,t)))}})}function FAe({validateDrag:e,onDragEnter:t,onDragLeave:o,onDrop:r}){let{getDraggedBlockClientIds:n}=(0,df.useSelect)(_);return(0,Wfe.__experimentalUseDropZone)({onDragEnter(){let[i]=n();i&&e(i)&&t(i)},onDragLeave(){o()},onDrop(){let[i]=n();i&&e(i)&&r(i)}})}var Yfe=l(A(),1),X_=l(R(),1);var qR=l(w(),1);function Dz({clientId:e,bounds:t,onChange:o,parentLayout:r}){let n=Xe(e),i=n?.parentElement,{isManualPlacement:s}=r;return!n||!i?null:(0,qR.jsx)(zAe,{clientId:e,bounds:t,blockElement:n,rootBlockElement:i,onChange:o,isManualGrid:s&&window.__experimentalEnableGridInteractivity})}function zAe({clientId:e,bounds:t,blockElement:o,rootBlockElement:r,onChange:n,isManualGrid:i}){let[s,a]=(0,X_.useState)(null),[c,u]=(0,X_.useState)({top:!1,bottom:!1,left:!1,right:!1});(0,X_.useEffect)(()=>{let h=new window.ResizeObserver(()=>{let p=o.getBoundingClientRect(),g=r.getBoundingClientRect(
Line truncated
|
||||
flex-basis: ${n};
|
||||
box-sizing: border-box;
|
||||
}`:r==="fill"?p=`${h} {
|
||||
flex-grow: 1;
|
||||
}`:i&&a?p=`${h} {
|
||||
grid-column: ${i} / span ${a};
|
||||
}`:i?p=`${h} {
|
||||
grid-column: ${i};
|
||||
}`:a&&(p=`${h} {
|
||||
grid-column: span ${a};
|
||||
}`),s&&c?p+=`${h} {
|
||||
grid-row: ${s} / span ${c};
|
||||
}`:s?p+=`${h} {
|
||||
grid-row: ${s};
|
||||
}`:c&&(p+=`${h} {
|
||||
grid-row: span ${c};
|
||||
}`),(a||i)&&(f||!d))){let g=parseFloat(f);isNaN(g)&&(g=12);let b=f?.replace(g,"");["px","rem","em"].includes(b)||(b="rem");let v=2;a&&i?v=a+i-1:a?v=a:v=i;let k=b==="px"?24:1.5,y=v*g+(v-1)*k,S=g*2+k-1,x=a&&a>1?"1/-1":"auto";p+=`@container (max-width: ${Math.max(y,S)}${b}) {
|
||||
${h} {
|
||||
grid-column: ${x};
|
||||
grid-row: auto;
|
||||
}
|
||||
}`}if(Qn({css:p}),!!p)return{className:`wp-container-content-${m}`}}function GAe({clientId:e,style:t,setAttributes:o}){let r=Uf()||{},{type:n="default",allowSizingOnChildren:i=!1,isManualPlacement:s}=r;return n!=="grid"?null:(0,jc.jsx)(WAe,{clientId:e,style:t,setAttributes:o,allowSizingOnChildren:i,isManualPlacement:s,parentLayout:r})}function WAe({clientId:e,style:t,setAttributes:o,allowSizingOnChildren:r,isManualPlacement:n,parentLayout:i}){let{rootClientId:s,isVisible:a,parentBlockVisibility:c,blockBlockVisibility:u,deviceType:d,isChildBlockAGrid:f}=(0,zz.useSelect)(y=>{let{getBlockRootClientId:S,getBlockEditingMode:x,getTemplateLock:C,getBlockAttributes:B,getSettings:I}=y(_),P=S(e);if(C(P)||x(P)!=="default")return{rootClientId:P,isVisible:!1};let E=B(P),L=B(e),T=I();return{rootClientId:P,isVisible:!0,parentBlockVisibility:E?.metadata?.blockVisibility,blockBlockVisibility:L?.metadata?.blockVisibility,deviceType:T?.[wi]?.toLowerCase()||Et.desktop.value,isChildBlockAGrid:L?.layout?.type==="grid"}},[e]),{isBlockCurrentlyHidden:m}=Mi({blockVisibility:c,deviceType:d}),{isBlockCurrentlyHidden:h}=Mi({blockVisibility:u,deviceType:d}),[p,g]=(0,Qfe.useState)(),b=f?e:void 0;if(!a||m)return null;let v=r&&!h;function k(y){o({style:{...t,layout:{...t?.layout,...y}}})}return(0,jc.jsxs)(jc.Fragment,{children:[(0,jc.jsx)(Z_,{clientId:s,contentRef:g,parentLayout:i,childGridClientId:b}),v&&(0,jc.jsx)(Dz,{clientId:e,bounds:p,onChange:k,parentLayout:i}),n&&window.__experimentalEnableGridInteractivity&&(0,jc.jsx)(Vz,{layout:t?.layout,parentLayout:i,onChange:k,gridClientId:s,blockClientId:e})]})}var jz={useBlockProps:HAe,edit:GAe,attributeKeys:["style"],hasSupport(){return!0}};var Hz=l(ut(),1),Uz=l($(),1),Jfe="metadata";function $Ae(e){return e?.attributes?.[Jfe]?.type||(e.attributes={...e.attributes,[Jfe]:{type:"object"}}),e}function KAe(e,t,o,r){if(r.length===1&&e.innerBlocks.length===t.length||r.length===1&&t.length>1||r.length>1&&t.length===1||r.length>1&&t.length>1&&r.length!==t.length)return e;let n=t[o]?.attributes?.metadata;if(!n)return e;let i={};return n.noteId&&!e.attributes?.metadata?.noteId&&(i.noteId=n.noteId),n.name&&!e.attributes?.metadata?.name&&(0,Uz.hasBlockSupport)(e.name,"renaming",!0)&&(i.name=n.name),n.blockVisibility!==void 0&&!e.attributes?.metadata?.blockVisibility&&(0,Uz.hasBlockSupport)(e.name,"visibility",!0)&&(i.blockVisibility=n.blockVisibility),Object.keys(i).length>0?{...e,attributes:{...e.attributes,metadata:{...e.attributes.metadata,...i}}}:e}(0,Hz.addFilter)("blocks.registerBlockType","core/metadata/addMetaAttribute",$Ae);(0,Hz.addFilter)("blocks.switchToBlockType.transformedBlock","core/metadata/addTransforms",KAe);var Gz=l(N(),1),QR=l(R(),1),JR=l(A(),1),eO=l($(),1),Ak=l(F(),1);var ff=l(w(),1),YAe={};function qAe({name:e,clientId:t,metadata:{ignoredHookedBlocks:o=[]}={}}){let r=(0,Ak.useSelect)(h=>h(eO.store).getBlockTypes(),[]),n=(0,QR.useMemo)(()=>r?.filter(({name:h,blockHooks:p})=>p&&e in p||o.includes(h)),[r,e,o]),i=(0,Ak.useSelect)(h=>{let{getBlocks:p,getBlockRootClientId:g,getGlobalBlockCount:b}=h(_),v=g(t),k=n.reduce((y,S)=>{if(b(S.name)===0)return y;let x=S?.blockHooks?.[e],C;switch(x){case"before":case"after":C=p(v);break;case"first_child":case"last_child":C=p(t);break;case void 0:C=[...p(v),...p(t)];break}let B=C?.find(I=>I.name===S.name);return B?{...y,[S.name]:B.clientId}:y},{});return Object.values(k).length>0?k:YAe},[n,e,t]),{getBlockIndex:s,getBlockCount:a,getBlockRootClientId:c}=(0,Ak.useSelect)(_),{insertBlock:u,removeBlock:d}=(0,Ak.useDispatch)(_);if(!n.length)return null;let f=n.reduce((h,p)=>{let[g]=p.name.split("/");return h[g]||(h[g]=[]),h[g].push(p),h},{}),m=(h,p)=>{let g=s(t),b=a(t),v=c(t);switch(p){case"before":case"after":u(h,p==="after"?g+1:g,v,!1);break;case"first_child":case"last_child":u(h,p==="first_child"?0:b,t,!1);break;case void 0:u(h,g+1,v,!1);break}};return(0,ff.jsx)(fe,{children:(0,ff.jsxs)(JR.PanelBody,{className:"block-editor-hooks__block-hooks",title:(0,Gz.__)("Plugins"),initialOpen:!0,children:[(0,ff.jsx)("p",{className:"block-editor-hooks__block-hooks-helptext",children:(0,Gz.__)("Manage the inclusion of blocks added automatically by plugins.")}),Object.keys(f).map(h=>(0,ff.jsxs)(QR.Fragment,{children:[(0,ff.jsx)("h3",{children:h}),f[h].map(p=>{let g=p.name in i;return(0,ff.jsx)(JR.ToggleControl,{checked:g,label:p.title,onChange:()=>{if(!g){let b=p.blockHooks[e];m((0,eO.createBlock)(p.name),b);return}d(i[p.name],!1)}},p.title)})]},h))]})})}var eme={edit:qAe,attributeKeys:["metadata"],hasSupport(){return!0}};var Wz=l(N(),1),tme=l($(),1),Lk=l(A(),1),ome=l(F(),1),rme=l(R(),1),nme=l(Z(),1);var mf=l(w(),1),ZAe=()=>(0,nme.useViewportMatch)("medium","<")?{}:{popoverProps:{placement:"left-start",offset:259}},XAe=({name:e,metadata:t})=>{let o=(0,rme.useContext)(xr),{removeAllBlockBindings:r}=El(),n=ZAe(),{bindableAttributes:i,hasCompatibleFields:s}=(0,ome.useSelect)(c=>{let{__experimentalBlockBindingsSupportedAttributes:u}=c(_).getSettings(),{getAllBlock
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
autosize/dist/autosize.js:
|
||||
(*!
|
||||
autosize 4.0.2
|
||||
license: MIT
|
||||
http://www.jacklmoore.com/autosize
|
||||
*)
|
||||
|
||||
normalize-wheel/src/isEventSupported.js:
|
||||
(**
|
||||
* 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
|
||||
*)
|
||||
*/
|
||||
Vendored
+73591
File diff suppressed because it is too large.
Load diff
+51
@@ -0,0 +1,51 @@
|
||||
"use strict";var wp;(wp||={}).blockLibrary=(()=>{var qpe=Object.create;var Bb=Object.defineProperty;var Zpe=Object.getOwnPropertyDescriptor;var Kpe=Object.getOwnPropertyNames;var Qpe=Object.getPrototypeOf,Ype=Object.prototype.hasOwnProperty;var Xpe=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ce=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Z=(e,t)=>{for(var r in t)Bb(e,r,{get:t[r],enumerable:!0})},ER=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Kpe(t))!Ype.call(e,n)&&n!==r&&Bb(e,n,{get:()=>t[n],enumerable:!(a=Zpe(t,n))||a.enumerable});return e};var o=(e,t,r)=>(r=e!=null?qpe(Qpe(e)):{},ER(t||!e||!e.__esModule?Bb(r,"default",{value:e,enumerable:!0}):r,e)),Jpe=e=>ER(Bb({},"__esModule",{value:!0}),e);var W=Ce((ECe,DR)=>{DR.exports=window.wp.blocks});var me=Ce((DCe,LR)=>{LR.exports=window.wp.compose});var V=Ce((LCe,MR)=>{MR.exports=window.wp.data});var T=Ce((MCe,AR)=>{AR.exports=window.wp.blockEditor});var Fu=Ce((ACe,RR)=>{RR.exports=window.wp.serverSideRender});var P=Ce((RCe,zR)=>{zR.exports=window.wp.i18n});var Z7=Ce(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.Doctype=rr.CDATA=rr.Tag=rr.Style=rr.Script=rr.Comment=rr.Directive=rr.Text=rr.Root=rr.isTag=rr.ElementType=void 0;var ri;(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(ri=rr.ElementType||(rr.ElementType={}));function tde(e){return e.type===ri.Tag||e.type===ri.Script||e.type===ri.Style}rr.isTag=tde;rr.Root=ri.Root;rr.Text=ri.Text;rr.Directive=ri.Directive;rr.Comment=ri.Comment;rr.Script=ri.Script;rr.Style=ri.Style;rr.Tag=ri.Tag;rr.CDATA=ri.CDATA;rr.Doctype=ri.Doctype});var X7=Ce(Ue=>{"use strict";var Hu=Ue&&Ue.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,n){a.__proto__=n}||function(a,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(a[i]=n[i])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function a(){this.constructor=t}t.prototype=r===null?Object.create(r):(a.prototype=r.prototype,new a)}})(),d0=Ue&&Ue.__assign||function(){return d0=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},d0.apply(this,arguments)};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.cloneNode=Ue.hasChildren=Ue.isDocument=Ue.isDirective=Ue.isComment=Ue.isText=Ue.isCDATA=Ue.isTag=Ue.Element=Ue.Document=Ue.CDATA=Ue.NodeWithChildren=Ue.ProcessingInstruction=Ue.Comment=Ue.Text=Ue.DataNode=Ue.Node=void 0;var wn=Z7(),Q7=(function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(t){this.parent=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(t){this.prev=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(t){this.next=t},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(t){return t===void 0&&(t=!1),Y7(this,t)},e})();Ue.Node=Q7;var Ib=(function(e){Hu(t,e);function t(r){var a=e.call(this)||this;return a.data=r,a}return Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(r){this.data=r},enumerable:!1,configurable:!0}),t})(Q7);Ue.DataNode=Ib;var FR=(function(e){Hu(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=wn.ElementType.Text,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),t})(Ib);Ue.Text=FR;var HR=(function(e){Hu(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=wn.ElementType.Comment,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),t})(Ib);Ue.Comment=HR;var OR=(function(e){Hu(t,e);function t(r,a){var n=e.call(this,a)||this;return n.name=r,n.type=wn.ElementType.Directive,n}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),t})(Ib);Ue.ProcessingInstruction=OR;var Nb=(function(e){Hu(t,e);function t(r){var a=e.call(this)||this;return a.children=r,a}return Object.defineProperty(t.prototype,"firstChild",{get:function(){var r;return(r=this.children[0])!==null&&r!==void 0?r:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children.lengthLine truncated
|
||||
`,bz="/",yz="*",pp="",Ade="comment",Rde="declaration";function zde(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,a=1;function n(h){var g=h.match(Pde);g&&(r+=g.length);var b=h.lastIndexOf(Mde);a=~b?h.length-b:a+h.length}function i(){var h={line:r,column:a};return function(g){return g.position=new l(h),u(),g}}function l(h){this.start=h,this.end={line:r,column:a},this.source=t.source}l.prototype.content=e;function s(h){var g=new Error(t.source+":"+r+":"+a+": "+h);if(g.reason=h,g.filename=t.source,g.line=r,g.column=a,g.source=e,!t.silent)throw g}function c(h){var g=h.exec(e);if(g){var b=g[0];return n(b),e=e.slice(b.length),g}}function u(){c(Bde)}function m(h){var g;for(h=h||[];g=p();)g!==!1&&h.push(g);return h}function p(){var h=i();if(!(bz!=e.charAt(0)||yz!=e.charAt(1))){for(var g=2;pp!=e.charAt(g)&&(yz!=e.charAt(g)||bz!=e.charAt(g+1));)++g;if(g+=2,pp===e.charAt(g-1))return s("End of comment missing");var b=e.slice(2,g-2);return a+=2,n(b),e=e.slice(g),a+=2,h({type:Ade,comment:b})}}function d(){var h=i(),g=c(Ide);if(g){if(p(),!c(Nde))return s("property missing ':'");var b=c(Ede),y=h({type:Rde,property:_z(g[0].replace(vz,pp)),value:b?_z(b[0].replace(vz,pp)):pp});return c(Dde),y}}function f(){var h=[];m(h);for(var g;g=d();)g!==!1&&(h.push(g),m(h));return h}return u(),f()}function _z(e){return e?e.replace(Lde,pp):pp}xz.exports=zde});var wz=Ce(v0=>{"use strict";var Vde=v0&&v0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(v0,"__esModule",{value:!0});v0.default=Hde;var Fde=Vde(kz());function Hde(e,t){let r=null;if(!e||typeof e!="string")return r;let a=(0,Fde.default)(e),n=typeof t=="function";return a.forEach(i=>{if(i.type!=="declaration")return;let{property:l,value:s}=i;n?t(l,s,i):s&&(r=r||{},r[l]=s)}),r}});var Sz=Ce(Rb=>{"use strict";Object.defineProperty(Rb,"__esModule",{value:!0});Rb.camelCase=void 0;var Ode=/^--[a-zA-Z0-9_-]+$/,jde=/-([a-z])/g,Ude=/^[^-]+$/,Gde=/^-(webkit|moz|ms|o|khtml)-/,Wde=/^-(ms)-/,$de=function(e){return!e||Ude.test(e)||Ode.test(e)},qde=function(e,t){return t.toUpperCase()},Cz=function(e,t){return"".concat(t,"-")},Zde=function(e,t){return t===void 0&&(t={}),$de(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Wde,Cz):e=e.replace(Gde,Cz),e.replace(jde,qde))};Rb.camelCase=Zde});var Pz=Ce((sS,Tz)=>{"use strict";var Kde=sS&&sS.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Qde=Kde(wz()),Yde=Sz();function lS(e,t){var r={};return!e||typeof e!="string"||(0,Qde.default)(e,function(a,n){a&&n&&(r[(0,Yde.camelCase)(a,t)]=n)}),r}lS.default=lS;Tz.exports=lS});var cS=Ce(Ga=>{"use strict";var Xde=Ga&&Ga.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ga,"__esModule",{value:!0});Ga.returnFirstArg=Ga.canTextBeChildOfNode=Ga.ELEMENTS_WITH_NO_TEXT_CHILDREN=Ga.PRESERVE_CUSTOM_ATTRIBUTES=void 0;Ga.isCustomComponent=rfe;Ga.setStyleProp=afe;var Jde=iS(),efe=Xde(Pz()),tfe=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function rfe(e,t){return e.includes("-")?!tfe.has(e):!!(t&&typeof t.is=="string")}var ofe={reactCompat:!0};function afe(e,t){if(typeof e=="string"){if(!e.trim()){t.style={};return}try{t.style=(0,efe.default)(e,ofe)}catch{t.style={}}}}Ga.PRESERVE_CUSTOM_ATTRIBUTES=Number(Jde.version.split(".")[0])>=16;Ga.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var nfe=function(e){return!Ga.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(e.name)};Ga.canTextBeChildOfNode=nfe;var ife=function(e){return e};Ga.returnFirstArg=ife});var mS=Ce(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});uS.default=ufe;var b0=hz(),Bz=cS(),lfe=["checked","value"],sfe=["input","select","textarea"],cfe={reset:!0,submit:!0};function ufe(e,t){e===void 0&&(e={});var r={},a=!!(e.type&&cfe[e.type]);for(var n in e){var i=e[n];if((0,b0.isCustomAttribute)(n)){r[n]=i;continue}var l=n.toLowerCase(),s=Iz(l);if(s){var c=(0,b0.getPropertyInfo)(s);switch(lfe.includes(s)&&sfe.includes(t)&&!a&&(s=Iz("default"+l)),r[s]=i,c&&c.type){case b0.BOOLEAN:r[s]=!0;break;case b0.OVERLOADED_BOOLEAN:i===""&&(r[s]=!0);break}continue}Bz.PRESERVE_CUSTOM_ATTRIBUTES&&(r[n]=i)}return(0,Bz.setStyleProp)(e.style,r),r}function Iz(e){return b0.possibleStandardNames[e]}});var Ez=Ce(_0=>{"use strict";var mfe=_0&&_0.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_0,"__esModule",{value:!0});_0.default=Nz;var pS=iS(),pfe=mfe(mS()),y0=cS(),dfe={cloneElement:pS.cloneElement,createElement:pS.createElement,isValidElement:pS.isValidElement};function Nz(e,t){t===void 0&&(t={});for(var r=[],a=typeof t.replace=="function",n=t.transform||y0.returnFirstArg,i=t.library||dfe,l=i.cloneElement,s=i.createElement,c=i.isValidElement,u=e.length,m=0;m<u;m++){var p=e[m];if(a){var d=t.replace(p,m);if(c(d)){u>1&&(d=l(d,{key:
Line truncated
|
||||
// to describe units of markup that
|
||||
// when composed together, form the
|
||||
// content or layout of a page.
|
||||
registerBlockType( name, settings );`)}},merge(e,t){return{content:e.content+`
|
||||
|
||||
`+t.content}},transforms:HH,edit:RH,save:FH};window.__experimentalContentOnlyInspectorFields&&(dk[jhe]=[{id:"content",label:(0,wI.__)("Code"),type:"text",Edit:"rich-text"}],dk[Uhe]={fields:["content"]});var Ghe=()=>E({name:jH,metadata:uk,settings:dk});var TI={};Z(TI,{init:()=>Khe,metadata:()=>hk,name:()=>ZH,settings:()=>KH});var UH=o(T(),1),SI=o(v(),1),Whe=[{attributes:{verticalAlignment:{type:"string"},width:{type:"number",min:0,max:100}},isEligible({width:e}){return isFinite(e)},migrate(e){return{...e,width:`${e.width}%`}},save({attributes:e}){let{verticalAlignment:t,width:r}=e,a=w({[`is-vertically-aligned-${t}`]:t}),n={flexBasis:r+"%"};return(0,SI.jsx)("div",{className:a,style:n,children:(0,SI.jsx)(UH.InnerBlocks.Content,{})})}}],GH=Whe;var Ko=o(T(),1),tm=o(M(),1),fk=o(V(),1),Ap=o(P(),1);var ci=o(v(),1);function $he({width:e,setAttributes:t}){let[r]=(0,Ko.useSettings)("spacing.units"),a=(0,tm.__experimentalUseCustomUnits)({availableUnits:r||["%","px","em","rem","vw"]}),n=q();return(0,ci.jsx)(tm.__experimentalToolsPanel,{label:(0,Ap.__)("Settings"),resetAll:()=>{t({width:void 0})},dropdownMenuProps:n,children:(0,ci.jsx)(tm.__experimentalToolsPanelItem,{hasValue:()=>e!==void 0,label:(0,Ap.__)("Width"),onDeselect:()=>t({width:void 0}),isShownByDefault:!0,children:(0,ci.jsx)(tm.__experimentalUnitControl,{label:(0,Ap.__)("Width"),__unstableInputWidth:"calc(50% - 8px)",__next40pxDefaultSize:!0,value:e||"",onChange:i=>{i=0>parseFloat(i)?"0":i,t({width:i})},units:a})})})}function qhe({attributes:{verticalAlignment:e,width:t,templateLock:r,allowedBlocks:a},setAttributes:n,clientId:i}){let l=w("block-core-columns",{[`is-vertically-aligned-${e}`]:e}),{columnsIds:s,hasChildBlocks:c,rootClientId:u}=(0,fk.useSelect)(k=>{let{getBlockOrder:_,getBlockRootClientId:x}=k(Ko.store),S=x(i);return{hasChildBlocks:_(i).length>0,rootClientId:S,columnsIds:_(S)}},[i]),{updateBlockAttributes:m}=(0,fk.useDispatch)(Ko.store),p=k=>{n({verticalAlignment:k}),m(u,{verticalAlignment:null})},d=Number.isFinite(t)?t+"%":t,f=(0,Ko.useBlockProps)({className:l,style:d?{flexBasis:d}:void 0}),h=s.length,g=s.indexOf(i)+1,b=(0,Ap.sprintf)((0,Ap.__)("%1$s (%2$d of %3$d)"),f["aria-label"],g,h),y=(0,Ko.useInnerBlocksProps)({...f,"aria-label":b},{templateLock:r,allowedBlocks:a,renderAppender:c?void 0:Ko.InnerBlocks.ButtonBlockAppender});return(0,ci.jsxs)(ci.Fragment,{children:[(0,ci.jsx)(Ko.BlockControls,{children:(0,ci.jsx)(Ko.BlockVerticalAlignmentToolbar,{onChange:p,value:e,controls:["top","center","bottom","stretch"]})}),(0,ci.jsx)(Ko.InspectorControls,{children:(0,ci.jsx)($he,{width:t,setAttributes:n})}),(0,ci.jsx)("div",{...y})]})}var WH=qhe;var hk={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/column",title:"Column",category:"design",parent:["core/columns"],description:"A single column within a columns block.",textdomain:"default",attributes:{verticalAlignment:{type:"string"},width:{type:"string"},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},supports:{__experimentalOnEnter:!0,anchor:!0,reusable:!1,html:!1,color:{gradients:!0,heading:!0,button:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},shadow:!0,spacing:{blockGap:!0,padding:!0,__experimentalDefaultControls:{padding:!0,blockGap:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},layout:!0,interactivity:{clientNavigation:!0},allowedBlocks:!0}};var gk=o(T(),1),$H=o(v(),1);function qH({attributes:e}){let{verticalAlignment:t,width:r}=e,a=w({[`is-vertically-aligned-${t}`]:t}),n;if(r&&/\d/.test(r)){let s=Number.isFinite(r)?r+"%":r;!Number.isFinite(r)&&r?.endsWith("%")&&(s=Math.round(Number.parseFloat(r)*1e12)/1e12+"%"),n={flexBasis:s}}let i=gk.useBlockProps.save({className:a,style:n}),l=gk.useInnerBlocksProps.save(i);return(0,$H.jsx)("div",{...l})}var{name:ZH}=hk,KH={icon:s9,edit:WH,save:qH,deprecated:GH},Khe=()=>E({name:ZH,metadata:hk,settings:KH});var II={};Z(II,{init:()=>sge,metadata:()=>yk,name:()=>nO,settings:()=>iO});var O1=o(P(),1);var QH=o(W(),1),zp=o(T(),1),Rp=o(v(),1);function vk(e){let{doc:t}=vk;t||(t=document.implementation.createHTMLDocument(""),vk.doc=t);let r;t.body.innerHTML=e;for(let a of t.body.firstChild.classList)if(r=a.match(/^layout-column-(\d+)$/))return Number(r[1])-1}var Qhe=e=>{if(!e.customTextColor&&!e.customBackgroundColor)return e;let t={color:{}};e.customTextColor&&(t.color.text=e.customTextColor),e.customBackgroundColor&&(t.color.background=e.customBackgroundColor);let{customTextColor:r,customBackgroundColor:a,...n}=e;return{...n,style:t,isStackedOnMobile:!0}},YH=[{attributes:{verticalAlignment:{type:"string"},backgroundColor:{type:"string"},customBack
Line truncated
|
||||
Details: https://developer.mozilla.org/en/docs/Web/HTML/CORS_enabled_image`),r.silent,c)}return this.prepareResult(l)},e.prototype.getColorFromArray4=function(t,r){r=r||{};var a=4,n=t.length,i=DU(r);if(n<a)return i;var l=n-n%a,s=(r.step||1)*a,c;switch(r.algorithm||"sqrt"){case"simple":c=K0e;break;case"sqrt":c=Q0e;break;case"dominant":c=Z0e;break;default:throw Y1("".concat(r.algorithm," is unknown algorithm"))}return c(t,l,{defaultColor:i,ignoredColor:j0e(r.ignoredColor),step:s})},e.prototype.prepareResult=function(t){var r=t.slice(0,3),a=[t[0],t[1],t[2],t[3]/255],n=O0e(t);return{value:[t[0],t[1],t[2],t[3]],rgb:"rgb("+r.join(",")+")",rgba:"rgba("+a.join(",")+")",hex:EU(r),hexa:EU(t),isDark:n,isLight:!n}},e.prototype.destroy=function(){this.canvas&&(this.canvas.width=1,this.canvas.height=1,this.canvas=null),this.ctx=null},e.prototype.bindImageEvents=function(t,r){var a=this;return new Promise(function(n,i){var l=function(){u();var m=a.getColor(t,r);m.error?i(m.error):n(m)},s=function(){u(),i(Y1('Error loading image "'.concat(t.src,'".')))},c=function(){u(),i(Y1('Image "'.concat(t.src,'" loading aborted')))},u=function(){t.removeEventListener("load",l),t.removeEventListener("error",s),t.removeEventListener("abort",c)};t.addEventListener("load",l),t.addEventListener("error",s),t.addEventListener("abort",c)})},e})();var FU=o(Yc(),1);IU([NU]);var th="#FFF",HU="#000";function i1e(e,t){return{r:e.r*e.a+t.r*t.a*(1-e.a),g:e.g*e.a+t.g*t.a*(1-e.a),b:e.b*e.a+t.b*t.a*(1-e.a),a:e.a+t.a*(1-e.a)}}function s5(){return s5.fastAverageColor||(s5.fastAverageColor=new zU),s5.fastAverageColor}var rh=Af(async e=>{if(!e)return th;let{r:t,g:r,b:a,a:n}=Ja(th).toRgb();try{let i=(0,FU.applyFilters)("media.crossOrigin",void 0,e);return(await s5().getColorAsync(e,{defaultColor:[t,r,a,n*255],silent:!0,crossOrigin:i})).hex}catch{return th}});function Qp(e,t,r){if(t===r||e===100)return Ja(t).isDark();let a=Ja(t).alpha(e/100).toRgb(),n=Ja(r).toRgb(),i=i1e(a,n);return Ja(i).isDark()}var Ut=o(v(),1);function l1e(e){return[["core/paragraph",{style:{typography:{textAlign:"center"}},placeholder:(0,pN.__)("Write title\u2026"),...e}]]}var s1e=(e,t)=>!e&&(0,OU.isBlobURL)(t);function c1e({attributes:e,clientId:t,isSelected:r,overlayColor:a,setAttributes:n,setOverlayColor:i,toggleSelection:l,context:{postId:s,postType:c}}){let{contentPosition:u,id:m,url:p,backgroundType:d,useFeaturedImage:f,dimRatio:h,focalPoint:g,hasParallax:b,isDark:y,isRepeated:k,minHeight:_,minHeightUnit:x,alt:S,allowedBlocks:C,templateLock:N,tagName:B="div",isUserOverlayColor:D,sizeSlug:A,poster:H}=e,[F]=(0,J1.useEntityProp)("postType",c,"featured_media",s),{getSettings:z}=(0,um.useSelect)(Bo.store),{__unstableMarkNextChangeAsNotPersistent:I}=(0,um.useDispatch)(Bo.store),R=(0,jl.useRef)({attributes:e,overlayColor:a});(0,jl.useLayoutEffect)(()=>{R.current={attributes:e,overlayColor:a}});let{media:$}=(0,um.useSelect)(Pe=>({media:F&&f?Pe(J1.store).getEntityRecord("postType","attachment",F,{context:"view"}):void 0}),[F,f]),j=$?.media_details?.sizes?.[A]?.source_url??$?.source_url;(0,jl.useEffect)(()=>{(async()=>{if(!f)return;let Pe=await rh(j),{attributes:Ht,overlayColor:qr}=R.current,Co=qr.color;Ht.isUserOverlayColor||(Co=Pe,I(),i(Co));let So=Qp(Ht.dimRatio,Co,Pe);I(),n({isDark:So,isUserOverlayColor:Ht.isUserOverlayColor||!1})})()},[j,I,n,i,f]);let G=f?j:p?.replaceAll("&","&"),O=f?Qt:d,{createErrorNotice:J}=(0,um.useDispatch)(jU.store),{gradientClass:ee,gradientValue:oe}=(0,Bo.__experimentalUseGradient)(),X=async Pe=>{let Ht=Xj(Pe),qr=[Pe?.type,Pe?.media_type].includes(Qt),Co=await rh(qr?Pe?.url:void 0),{attributes:So,overlayColor:Sl}=R.current,qi=Sl.color;So.isUserOverlayColor||(qi=Co,i(qi),I());let Zi=So.url===void 0&&So.dimRatio===100?50:So.dimRatio,vf=Qp(Zi,qi,Co);if(O===Qt&&Ht?.id){let{imageDefaultSize:zc}=z();A&&(Pe?.sizes?.[A]||Pe?.media_details?.sizes?.[A])?(Ht.sizeSlug=A,Ht.url=Pe?.sizes?.[A]?.url||Pe?.media_details?.sizes?.[A]?.source_url):Pe?.sizes?.[zc]||Pe?.media_details?.sizes?.[zc]?(Ht.sizeSlug=zc,Ht.url=Pe?.sizes?.[zc]?.url||Pe?.media_details?.sizes?.[zc]?.source_url):Ht.sizeSlug=Xf}n({...Ht,focalPoint:void 0,useFeaturedImage:void 0,dimRatio:Zi,isDark:vf,isUserOverlayColor:So.isUserOverlayColor||!1})},te=()=>{let Pe=a.color;D||(Pe=HU,i(void 0),I());let Ht=Qp(h,Pe,th);n({url:void 0,id:void 0,backgroundType:void 0,focalPoint:void 0,hasParallax:void 0,isRepeated:void 0,useFeaturedImage:void 0,isDark:Ht})},ne=async Pe=>{let Ht=await rh(G),{attributes:qr}=R.current,Co=Qp(qr.dimRatio,Pe,Ht);i(Pe),I(),n({isUserOverlayColor:!0,isDark:Co})},le=async Pe=>{let Ht=await rh(G),{overlayColor:qr}=R.current,Co=Qp(Pe,qr.color,Ht);n({dimRatio:Pe,isDark:Co})},pe=Pe=>{J(Pe,{type:"snackbar"})},Ie=Pe=>{n({url:Pe,backgroundType:Kc,dimRatio:p===void 0&&h===100?50:h,id:void 0,focalPoint:void 0,hasParallax:void 0,isRepeated:void 0,useFeaturedImage:void 0})},{embedPreview:Ne,isFetchingEmbed:ae}=(0,um.useSelect)(Pe=>{if(O!==Kc||!G)return{embedPreview:void 0,isFetchingEmbed:!1};let{getEmbedP
Line truncated
|
||||
${t}
|
||||
`}),!td.RichText.isEmpty(r)&&(0,ev.jsx)(td.RichText.Content,{className:(0,td.__experimentalGetElementClassName)("caption"),tagName:"figcaption",value:r})]})}var kN=o(W(),1);var{name:I1e}=Ls,N1e={from:[{type:"raw",isMatch:e=>e.nodeName==="P"&&/^\s*(https?:\/\/\S+)\s*$/i.test(e.textContent)&&e.textContent?.match(/https/gi)?.length===1,transform:e=>(0,kN.createBlock)(I1e,{url:e.textContent.trim()})}],to:[{type:"block",blocks:["core/paragraph"],isMatch:({url:e})=>!!e,transform:({url:e,caption:t,className:r})=>{let a=`<a href="${e}">${e}</a>`;return t?.trim()&&(a+=`<br />${t}`),(0,kN.createBlock)("core/paragraph",{content:a,className:Qu(r)})}}]},MG=N1e;var ue=o(P(),1);function ft(e){return(0,ue.sprintf)((0,ue.__)("%s Embed"),e)}var AG=[{name:"twitter",title:ft("X"),icon:aG,keywords:["x","twitter","tweet",(0,ue.__)("social")],description:(0,ue.__)("Embed an X post."),patterns:[/^https?:\/\/(www\.)?twitter\.com\/.+/i],attributes:{providerNameSlug:"twitter",responsive:!0}},{name:"youtube",title:ft("YouTube"),icon:nG,keywords:[(0,ue.__)("music"),(0,ue.__)("video")],description:(0,ue.__)("Embed a YouTube video."),patterns:[/^https?:\/\/((m|www)\.)?youtube\.com\/.+/i,/^https?:\/\/youtu\.be\/.+/i],attributes:{providerNameSlug:"youtube",responsive:!0}},{name:"facebook",title:ft("Facebook"),icon:iG,keywords:[(0,ue.__)("social")],description:(0,ue.__)("Embed a Facebook post."),scope:["block"],patterns:[],attributes:{providerNameSlug:"facebook",previewable:!1,responsive:!0}},{name:"instagram",title:ft("Instagram"),icon:lG,keywords:[(0,ue.__)("image"),(0,ue.__)("social")],description:(0,ue.__)("Embed an Instagram post."),scope:["block"],patterns:[],attributes:{providerNameSlug:"instagram",responsive:!0}},{name:"wordpress",title:ft("WordPress"),icon:sG,keywords:[(0,ue.__)("post"),(0,ue.__)("blog")],description:(0,ue.__)("Embed a WordPress post."),attributes:{providerNameSlug:"wordpress"}},{name:"soundcloud",title:ft("SoundCloud"),icon:v5,keywords:[(0,ue.__)("music"),(0,ue.__)("audio")],description:(0,ue.__)("Embed SoundCloud content."),patterns:[/^https?:\/\/(www\.)?soundcloud\.com\/.+/i],attributes:{providerNameSlug:"soundcloud",responsive:!0}},{name:"spotify",title:ft("Spotify"),icon:cG,keywords:[(0,ue.__)("music"),(0,ue.__)("audio")],description:(0,ue.__)("Embed Spotify content."),patterns:[/^https?:\/\/(open|play)\.spotify\.com\/.+/i],attributes:{providerNameSlug:"spotify",responsive:!0}},{name:"flickr",title:ft("Flickr"),icon:uG,keywords:[(0,ue.__)("image")],description:(0,ue.__)("Embed Flickr content."),patterns:[/^https?:\/\/(www\.)?flickr\.com\/.+/i,/^https?:\/\/flic\.kr\/.+/i],attributes:{providerNameSlug:"flickr",responsive:!0}},{name:"vimeo",title:ft("Vimeo"),icon:mG,keywords:[(0,ue.__)("video")],description:(0,ue.__)("Embed a Vimeo video."),patterns:[/^https?:\/\/(www\.)?vimeo\.com\/.+/i],attributes:{providerNameSlug:"vimeo",responsive:!0}},{name:"animoto",title:ft("Animoto"),icon:hG,description:(0,ue.__)("Embed an Animoto video."),patterns:[/^https?:\/\/(www\.)?(animoto|video214)\.com\/.+/i],attributes:{providerNameSlug:"animoto",responsive:!0}},{name:"cloudup",title:ft("Cloudup"),icon:Gl,description:(0,ue.__)("Embed Cloudup content."),patterns:[/^https?:\/\/cloudup\.com\/.+/i],attributes:{providerNameSlug:"cloudup",responsive:!0}},{name:"collegehumor",title:ft("CollegeHumor"),icon:nh,description:(0,ue.__)("Embed CollegeHumor content."),scope:["block"],patterns:[],attributes:{providerNameSlug:"collegehumor",responsive:!0}},{name:"crowdsignal",title:ft("Crowdsignal"),icon:Gl,keywords:["polldaddy",(0,ue.__)("survey")],description:(0,ue.__)("Embed Crowdsignal (formerly Polldaddy) content."),patterns:[/^https?:\/\/((.+\.)?polldaddy\.com|poll\.fm|.+\.crowdsignal\.net|.+\.survey\.fm)\/.+/i],attributes:{providerNameSlug:"crowdsignal",responsive:!0}},{name:"dailymotion",title:ft("Dailymotion"),icon:gG,keywords:[(0,ue.__)("video")],description:(0,ue.__)("Embed a Dailymotion video."),patterns:[/^https?:\/\/(www\.)?dailymotion\.com\/.+/i],attributes:{providerNameSlug:"dailymotion",responsive:!0}},{name:"imgur",title:ft("Imgur"),icon:vN,description:(0,ue.__)("Embed Imgur content."),patterns:[/^https?:\/\/(.+\.)?imgur\.com\/.+/i],attributes:{providerNameSlug:"imgur",responsive:!0}},{name:"issuu",title:ft("Issuu"),icon:Gl,description:(0,ue.__)("Embed Issuu content."),patterns:[/^https?:\/\/(www\.)?issuu\.com\/.+/i],attributes:{providerNameSlug:"issuu",responsive:!0}},{name:"kickstarter",title:ft("Kickstarter"),icon:Gl,description:(0,ue.__)("Embed Kickstarter content."),patterns:[/^https?:\/\/(www\.)?kickstarter\.com\/.+/i,/^https?:\/\/kck\.st\/.+/i],attributes:{providerNameSlug:"kickstarter",responsive:!0}},{name:"mixcloud",title:ft("Mixcloud"),icon:v5,keywords:[(0,ue.__)("music"),(0,ue.__)("audio")],description:(0,ue.__)("Embed Mixcloud content."),patterns:[/^https?:\/\/(www\.)?mixcloud\.com\/.+/i],attributes:{providerNameSlug:"mixcloud",responsive:!0}},{name:"pocket-casts",title:ft("Pocket Casts"),icon:yG,keywords:[(0,ue._
Line truncated
|
||||
${t}
|
||||
`}),!rd.RichText.isEmpty(r)&&(0,od.jsx)(rd.RichText.Content,{tagName:"figcaption",value:r})]})}},D1e={attributes:zG,save({attributes:{url:e,caption:t,type:r,providerNameSlug:a}}){if(!e)return null;let n=w("wp-block-embed",{[`is-type-${r}`]:r,[`is-provider-${a}`]:a});return(0,od.jsxs)("figure",{className:n,children:[`
|
||||
${e}
|
||||
`,!rd.RichText.isEmpty(t)&&(0,od.jsx)(rd.RichText.Content,{tagName:"figcaption",value:t})]})}},L1e=[E1e,D1e],VG=L1e;var{name:FG}=Ls,HG={icon:Gl,edit:DG,save:LG,transforms:MG,variations:RG,deprecated:VG},M1e=()=>E({name:FG,metadata:Ls,settings:HG});var PN={};Z(PN,{init:()=>W1e,metadata:()=>w5,name:()=>eW,settings:()=>T5});var uh=o(P(),1);var JG=o(W(),1);var fo=o(T(),1),Wl=o(P(),1),Gt=o(v(),1),A1e={attributes:{id:{type:"number"},href:{type:"string"},fileId:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"id"},fileName:{type:"string",source:"html",selector:"a:not([download])"},textLinkHref:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"href"},textLinkTarget:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"target"},showDownloadButton:{type:"boolean",default:!0},downloadButtonText:{type:"string",source:"html",selector:"a[download]"},displayPreview:{type:"boolean"},previewHeight:{type:"number",default:600}},supports:{anchor:!0,align:!0},save({attributes:e}){let{href:t,fileId:r,fileName:a,textLinkHref:n,textLinkTarget:i,showDownloadButton:l,downloadButtonText:s,displayPreview:c,previewHeight:u}=e,m=fo.RichText.isEmpty(a)?(0,Wl.__)("PDF embed"):(0,Wl.sprintf)((0,Wl.__)("Embed of %s."),a),p=!fo.RichText.isEmpty(a),d=p?r:void 0;return t&&(0,Gt.jsxs)("div",{...fo.useBlockProps.save(),children:[c&&(0,Gt.jsx)(Gt.Fragment,{children:(0,Gt.jsx)("object",{className:"wp-block-file__embed",data:t,type:"application/pdf",style:{width:"100%",height:`${u}px`},"aria-label":m})}),p&&(0,Gt.jsx)("a",{id:d,href:n,target:i,rel:i?"noreferrer noopener":void 0,children:(0,Gt.jsx)(fo.RichText.Content,{value:a})}),l&&(0,Gt.jsx)("a",{href:t,className:w("wp-block-file__button",(0,fo.__experimentalGetElementClassName)("button")),download:!0,"aria-describedby":d,children:(0,Gt.jsx)(fo.RichText.Content,{value:s})})]})}},R1e={attributes:{id:{type:"number"},href:{type:"string"},fileId:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"id"},fileName:{type:"string",source:"html",selector:"a:not([download])"},textLinkHref:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"href"},textLinkTarget:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"target"},showDownloadButton:{type:"boolean",default:!0},downloadButtonText:{type:"string",source:"html",selector:"a[download]"},displayPreview:{type:"boolean"},previewHeight:{type:"number",default:600}},supports:{anchor:!0,align:!0},save({attributes:e}){let{href:t,fileId:r,fileName:a,textLinkHref:n,textLinkTarget:i,showDownloadButton:l,downloadButtonText:s,displayPreview:c,previewHeight:u}=e,m=fo.RichText.isEmpty(a)?(0,Wl.__)("PDF embed"):(0,Wl.sprintf)((0,Wl.__)("Embed of %s."),a),p=!fo.RichText.isEmpty(a),d=p?r:void 0;return t&&(0,Gt.jsxs)("div",{...fo.useBlockProps.save(),children:[c&&(0,Gt.jsx)(Gt.Fragment,{children:(0,Gt.jsx)("object",{className:"wp-block-file__embed",data:t,type:"application/pdf",style:{width:"100%",height:`${u}px`},"aria-label":m})}),p&&(0,Gt.jsx)("a",{id:d,href:n,target:i,rel:i?"noreferrer noopener":void 0,children:(0,Gt.jsx)(fo.RichText.Content,{value:a})}),l&&(0,Gt.jsx)("a",{href:t,className:"wp-block-file__button",download:!0,"aria-describedby":d,children:(0,Gt.jsx)(fo.RichText.Content,{value:s})})]})}},z1e={attributes:{id:{type:"number"},href:{type:"string"},fileName:{type:"string",source:"html",selector:"a:not([download])"},textLinkHref:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"href"},textLinkTarget:{type:"string",source:"attribute",selector:"a:not([download])",attribute:"target"},showDownloadButton:{type:"boolean",default:!0},downloadButtonText:{type:"string",source:"html",selector:"a[download]"},displayPreview:{type:"boolean"},previewHeight:{type:"number",default:600}},supports:{anchor:!0,align:!0},save({attributes:e}){let{href:t,fileName:r,textLinkHref:a,textLinkTarget:n,showDownloadButton:i,downloadButtonText:l,displayPreview:s,previewHeight:c}=e,u=fo.RichText.isEmpty(r)?(0,Wl.__)("PDF embed"):(0,Wl.sprintf)((0,Wl.__)("Embed of %s."),r);return t&&(0,Gt.jsxs)("div",{...fo.useBlockProps.save(),children:[s&&(0,Gt.jsx)(Gt.Fragment,{children:(0,Gt.jsx)("object",{className:"wp-block-file__embed",data:t,type:"application/pdf",style:{width:"100%",height:`${c}px`},"aria-label":u})}),!fo.RichText.isEmpty(r)&&(0,Gt.jsx)("a",{href:a,target:n,rel:n?"noreferrer noopener":void 0,children:(0,Gt.jsx)(fo.RichText.Content,{value:r})}),i&&(0,Gt.jsx)("a",{href:t,className:"wp-block-file__button",download:!0,children:(0,Gt.jsx)(fo.RichText.Content,{value:l})})]})}},V1e=[A1e,R1e,z1e],OG=V1e;var SN=o(Rr(),1),ch=o(M(),1),sh=o(V(),1),No=o(T(),1),k5=o(U(),1),$G=o(me(),1),$l=o(P(),1);var qG=o(Q(),1),TN=o(xr(),1),ZG=o(mr(),1);var Xo=o(P(),1),Jo=o(M(),1),jG=o(T(),1);var Io=o(v(),1);function UG({hrefs:e,openInNewWindow:t,showDownloadButton:r,changeLinkDestinationOption:a,changeOpenInNewWindow:n,changeShowDownloadButton:i,displayPrev
Line truncated
|
||||
--wp--style--unstable-gallery-gap: ${n==="0"?"0px":n};
|
||||
gap: ${a}
|
||||
}`;return(0,id.useStyleOverride)({css:l}),null}var He=o(v(),1),c$=8,u$=[{icon:L0,label:(0,he.__)("Link images to attachment pages"),value:qs,noticeText:(0,he.__)("Attachment Pages")},{icon:Wu,label:(0,he.__)("Link images to media files"),value:$s,noticeText:(0,he.__)("Media Files")},{icon:kp,label:(0,he.__)("Enlarge on click"),value:ov,noticeText:(0,he.__)("Lightbox effect"),infoText:(0,he.__)("Scale images with a lightbox effect")},{icon:U0,label:(0,he._x)("None","Media item link option"),value:Ws,noticeText:(0,he.__)("None")}],Ive=[{label:(0,he.__)("Icon"),value:"icon"},{label:(0,he.__)("Text"),value:"text"},{label:(0,he.__)("Both"),value:"both"}],WN=["image"],Nve=ea.Platform.isNative?(0,he.__)("Add media"):(0,he.__)("Drag and drop images, upload, or choose from your library."),Eve=ea.Platform.isNative?{type:"stepper"}:{},Dve={name:"core/image"},Lve=[];function f$(e){let{setAttributes:t,attributes:r,className:a,clientId:n,isSelected:i,insertBlocksAfter:l,isContentLocked:s,onFocus:c}=e,[u,m,p,d]=(0,Do.useSettings)("blocks.core/image.lightbox","dimensions.aspectRatios.default","dimensions.aspectRatios.theme","dimensions.defaultAspectRatios"),f=u?.allowEditing?u$:u$.filter(Y=>Y.value!==ov),{navigationButtonType:h,columns:g,imageCrop:b,randomOrder:y,linkTarget:k,linkTo:_,sizeSlug:x,aspectRatio:S}=r,{__unstableMarkNextChangeAsNotPersistent:C,replaceInnerBlocks:N,updateBlockAttributes:B,selectBlock:D}=(0,sv.useDispatch)(Do.store),{createSuccessNotice:A,createErrorNotice:H}=(0,sv.useDispatch)(d$.store),{getBlock:F,getSettings:z,innerBlockImages:I,blockWasJustInserted:R,multiGallerySelection:$}=(0,sv.useSelect)(Y=>{let{getBlockName:ze,getMultiSelectedBlockClientIds:Me,getSettings:Xe,getBlock:Te,wasBlockJustInserted:Bt}=Y(Do.store),yr=Me();return{getBlock:Te,getSettings:Xe,innerBlockImages:Te(n)?.innerBlocks??Lve,blockWasJustInserted:Bt(n,"inserter_menu"),multiGallerySelection:yr.length&&yr.every(xn=>ze(xn)==="core/gallery")}},[n]),j=(0,ea.useMemo)(()=>I?.map(Y=>({clientId:Y.clientId,id:Y.attributes.id,url:Y.attributes.url,attributes:Y.attributes,fromSavedContent:!!Y.originalContent})),[I]),G=l$(I),O=o$(j,G),J=u?.enabled?j.filter(Y=>Y.attributes?.lightbox?.enabled===void 0||Y.attributes?.lightbox?.enabled===!0).length>0:j.filter(Y=>Y.attributes.lightbox?.enabled).length>0,ee=p?.map(({name:Y,ratio:ze})=>({label:Y,value:ze})),oe=m?.map(({name:Y,ratio:ze})=>({label:Y,value:ze})),X=[{label:(0,he._x)("Original","Aspect ratio option for dimensions control"),value:"auto"},...d?oe||[]:[],...ee||[]];(0,ea.useEffect)(()=>{O?.forEach(Y=>{C(),B(Y.clientId,{...ne(Y.attributes),id:Y.id,align:void 0})})},[O]);let te=r$(G,i,z);function ne(Y){let ze=Y.id?G.find(({id:Te})=>Te===Y.id):null,Me;Y.className&&Y.className!==""&&(Me=Y.className);let Xe;return Y.linkTarget||Y.rel?Xe={linkTarget:Y.linkTarget,rel:Y.rel}:Xe=jN(k,r),{...KW(ze,x),...ON(ze,_,Y?.linkDestination),...Xe,className:Me,sizeSlug:x,caption:Y.caption.length>0?Y.caption:ze.caption?.raw,alt:Y.alt||ze.alt_text,aspectRatio:S==="auto"?void 0:S}}function le(Y){let ze=ea.Platform.isNative&&Y.id?G.find(({id:Xe})=>Xe===Y.id):null,Me=ze?ze?.media_type:Y.type;return WN.some(Xe=>Me?.indexOf(Xe)===0)||Y.blob}function pe(Y){let ze=Object.prototype.toString.call(Y)==="[object FileList]",Me=ze?Array.from(Y).map(Je=>Je.url?Je:{blob:(0,$N.createBlobURL)(Je)}):Y;Me.every(le)||H((0,he.__)("If uploading to a gallery all files need to be image formats"),{id:"gallery-upload-invalid-file",type:"snackbar"});let Xe=Me.filter(Je=>Je.url||le(Je)).map(Je=>Je.url?Je:{blob:Je.blob||(0,$N.createBlobURL)(Je)}),Te=Xe.reduce((Je,$r,ip)=>(Je[$r.id]=ip,Je),{}),Bt=ze?I:I.filter(Je=>Xe.find($r=>$r.id===Je.attributes.id)),xn=Xe.filter(Je=>!Bt.find($r=>Je.id===$r.attributes.id)).map(Je=>(0,p$.createBlock)("core/image",{id:Je.id,blob:Je.blob,url:Je.url,caption:Je.caption,alt:Je.alt}));N(n,Bt.concat(xn).sort((Je,$r)=>Te[Je.attributes.id]-Te[$r.attributes.id])),xn?.length>0&&D(xn[0].clientId)}function Ie(Y){H(Y,{type:"snackbar"})}function Ne(Y){t({linkTo:Y});let ze={},Me=[];F(n).innerBlocks.forEach(Te=>{Me.push(Te.clientId);let Bt=Te.attributes.id?G.find(({id:yr})=>yr===Te.attributes.id):null;ze[Te.clientId]=ON(Bt,Y,!1,Te.attributes,u)}),B(Me,ze,{uniqueByBlock:!0});let Xe=[...f].find(Te=>Te.value===Y);A((0,he.sprintf)((0,he.__)("All gallery image links updated to: %s"),Xe.noticeText),{id:"gallery-attributes-linkTo",type:"snackbar"})}function ae(Y){t({columns:Y})}function Re(){t({imageCrop:!b})}function Ee(){t({randomOrder:!y})}function ie(Y){let ze=Y?"_blank":void 0;t({linkTarget:ze});let Me={},Xe=[];F(n).innerBlocks.forEach(Bt=>{Xe.push(Bt.clientId),Me[Bt.clientId]=jN(ze,Bt.attributes)}),B(Xe,Me,{uniqueByBlock:!0});let Te=Y?(0,he.__)("All gallery images updated to open in new tab"):(0,he.__)("All gallery images updated to not open in new tab");A(Te,{id:"gallery-attributes-openInNewTab",type:"snackbar"})}function fe(Y){t({sizeSlug:Y});let ze={},Me=[];F(n).innerBlocks.forEach(Te=>{Me.push(Te.clientId);let Bt=Te.a
Line truncated
|
||||
html,body,:root {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
overflow: visible !important;
|
||||
min-height: auto !important;
|
||||
}
|
||||
`;function s4({content:e,isSelected:t}){let r=(0,tq.useSelect)(n=>n(l4.store).getSettings().styles,[]),a=(0,J$.useMemo)(()=>[g2e,...(0,l4.transformStyles)((r??[]).filter(n=>n.css))],[r]);return(0,sd.jsxs)(sd.Fragment,{children:[(0,sd.jsx)(eq.SandBox,{html:e,styles:a,title:(0,rq.__)("Custom HTML Preview"),tabIndex:-1}),!t&&(0,sd.jsx)("div",{className:"block-library-html__preview-overlay"})]})}var xi=o(P(),1),pv=o(U(),1),aq=o(V(),1),ta=o(M(),1),bh=o(T(),1);var nq=o(me(),1);function oq(e=""){if(!e||!e.trim())return{html:"",css:"",js:""};let t=document.implementation.createHTMLDocument("");t.body.innerHTML=e;let r=t.body.querySelector('style[data-wp-block-html="css"]'),a=r?r.textContent.trim():"";r&&r.remove();let n=t.body.querySelector('script[data-wp-block-html="js"]'),i=n?n.textContent.trim():"";return n&&n.remove(),{html:t.body.innerHTML.trim(),css:a,js:i}}function iE({html:e="",css:t="",js:r=""}){let a=[];return t.trim()&&a.push(`<style data-wp-block-html="css">
|
||||
${t}
|
||||
</style>`),r.trim()&&a.push(`<script data-wp-block-html="js">
|
||||
${r}
|
||||
<\/script>`),e.trim()&&a.push(e),a.join(`
|
||||
|
||||
`)}var Ct=o(v(),1),{Tabs:gm}=K(ta.privateApis);function lE({isOpen:e,onRequestClose:t,content:r,setAttributes:a}){let{html:n,css:i,js:l}=oq(r),[s,c]=(0,pv.useState)(n),[u,m]=(0,pv.useState)(i),[p,d]=(0,pv.useState)(l),[f,h]=(0,pv.useState)(!1),g=(0,nq.useViewportMatch)("small","<"),{canUserUseUnfilteredHTML:b}=(0,aq.useSelect)(S=>({canUserUseUnfilteredHTML:S(bh.store).getSettings().__experimentalCanUserUseUnfilteredHTML}),[]),y=!b&&(i.trim()||l.trim());if(!e)return null;let k=()=>{a({content:iE({html:s,css:b?u:"",js:b?p:""})})},_=()=>{k(),t()},x=()=>{h(S=>!S)};return(0,Ct.jsx)(Ct.Fragment,{children:(0,Ct.jsx)(ta.Modal,{title:(0,xi.__)("Edit HTML"),onRequestClose:t,className:"block-library-html__modal",size:"large",isDismissible:!1,shouldCloseOnClickOutside:!1,isFullScreen:f,__experimentalHideHeader:!0,children:(0,Ct.jsx)(gm,{orientation:"horizontal",defaultTabId:"html",children:(0,Ct.jsxs)(ta.__experimentalVStack,{expanded:!0,children:[(0,Ct.jsxs)(ta.__experimentalHStack,{justify:"space-between",className:"block-library-html__modal-header",children:[(0,Ct.jsx)("div",{children:(0,Ct.jsxs)(gm.TabList,{children:[(0,Ct.jsx)(gm.Tab,{tabId:"html",children:"HTML"}),b&&(0,Ct.jsx)(gm.Tab,{tabId:"css",children:"CSS"}),b&&(0,Ct.jsx)(gm.Tab,{tabId:"js",children:(0,xi.__)("JavaScript")})]})}),!g&&(0,Ct.jsx)("div",{children:(0,Ct.jsx)(ta.Button,{__next40pxDefaultSize:!0,icon:f?tB:kp,label:(0,xi.__)("Enable/disable fullscreen"),onClick:x,variant:"tertiary"})})]}),y&&(0,Ct.jsx)(ta.Notice,{status:"warning",isDismissible:!1,className:"block-library-html__modal-notice",children:(0,xi.__)("This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML.")}),(0,Ct.jsxs)(ta.Flex,{direction:g?"column":"row",className:"block-library-html__modal-tabs",align:"stretch",gap:8,children:[(0,Ct.jsxs)("div",{className:"block-library-html__modal-content",children:[(0,Ct.jsx)(gm.TabPanel,{tabId:"html",focusable:!1,className:"block-library-html__modal-tab",children:(0,Ct.jsx)(bh.PlainText,{value:s,onChange:c,placeholder:(0,xi.__)("Write HTML\u2026"),"aria-label":(0,xi.__)("HTML"),className:"block-library-html__modal-editor"})}),b&&(0,Ct.jsx)(gm.TabPanel,{tabId:"css",focusable:!1,className:"block-library-html__modal-tab",children:(0,Ct.jsx)(bh.PlainText,{value:u,onChange:m,placeholder:(0,xi.__)("Write CSS\u2026"),"aria-label":(0,xi.__)("CSS"),className:"block-library-html__modal-editor"})}),b&&(0,Ct.jsx)(gm.TabPanel,{tabId:"js",focusable:!1,className:"block-library-html__modal-tab",children:(0,Ct.jsx)(bh.PlainText,{value:p,onChange:d,placeholder:(0,xi.__)("Write JavaScript\u2026"),"aria-label":(0,xi.__)("JavaScript"),className:"block-library-html__modal-editor"})})]}),(0,Ct.jsx)("div",{className:"block-library-html__preview",children:(0,Ct.jsx)(s4,{content:iE({html:s,css:u,js:p})})})]}),(0,Ct.jsxs)(ta.__experimentalHStack,{alignment:"center",justify:"flex-end",spacing:4,className:"block-library-html__modal-footer",children:[(0,Ct.jsx)(ta.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,xi.__)("Cancel")}),(0,Ct.jsx)(ta.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:_,children:(0,xi.__)("Update")})]})]})})})})}var Ta=o(v(),1);function lq({attributes:e,setAttributes:t,isSelected:r}){let[a,n]=(0,iq.useState)(!1),i=(0,vm.useBlockProps)({className:"block-library-html__edit"});return e.content?.trim()?(0,Ta.jsxs)("div",{...i,children:[(0,Ta.jsx)(vm.BlockControls,{children:(0,Ta.jsx)(Jl.ToolbarGroup,{children:(0,Ta.jsx)(Jl.ToolbarButton,{onClick:()=>n(!0),children:(0,yh.__)("Edit code")})})}),(0,Ta.jsx)(vm.InspectorControls,{children:(0,Ta.jsx)(Jl.__experimentalVStack,{className:"block-editor-block-inspector-edit-contents",expanded:!0,children:(0,Ta.jsx)(Jl.Button,{className:"block-editor-block-inspector-edit-contents__button",__next40pxDefaultSize:!0,variant:"secondary",onClick:()=>n(!0),children:(0,yh.__)("Edit code")})})}),(0,Ta.jsx)(s4,{content:e.content,isSelected:r}),(0,Ta.jsx)(lE,{isOpen:a,onRequestClose:()=>n(!1),content:e.content,setAttributes:t})]}):(0,Ta.jsxs)("div",{...i,children:[(0,Ta.jsx)(Jl.Placeholder,{icon:(0,Ta.jsx)(vm.BlockIcon,{icon:B0}),label:(0,yh.__)("Custom HTML"),instructions:(0,yh.__)("Add custom HTML code and preview how it looks."),children:(0,Ta.jsx)(Jl.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:()=>n(!0),children:(0,yh.__)("Edit HTML")})}),(0,Ta.jsx)(lE,{isOpen:a,onRequestClose:()=>n(!1),content:e.content,setAttributes:t})]})}var c4={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/html",title:"Custom HTML",category:"widgets",description:"Add custom HTML code and preview it as you edit.",keywords:["embed"],textdomain:"default",attributes:{content:{type:"string",source:"raw",role:"content"}},supports:{customClassName:!1,className:!1,html:!1,interactivity:{clientNavigation:!0},customCSS:!1,visibility:!1},editorStyle:"wp-block-html-editor"};var sq=o(U(),1),cq=o(v(),1);function uq
Line truncated
|
||||
`)&&(kt.caption=kt.caption.replace(/\n/g,"<br>")),z.current&&!kt.caption){let{caption:mt,...wo}=kt;kt=wo}let Wr;(!de.id||de.id!==p)&&(Wr={sizeSlug:at});let ut=e.linkDestination;if(!ut)switch(window?.wp?.media?.view?.settings?.defaultProps?.link||nd){case"file":case dh:ut=dh;break;case"post":case fh:ut=fh;break;case FN:ut=FN;break;case nd:ut=nd;break}let br;switch(ut){case dh:br=de.url;break;case fh:br=de.link;break}kt.href=br,t({blob:void 0,...kt,...Wr,linkDestination:ut}),x()}function ne(de){let ct=(0,v4.getProtocol)(de)?de:(0,v4.prependHTTPS)(de);ct!==u&&(t({blob:void 0,url:ct,id:void 0,sizeSlug:$().imageDefaultSize}),x())}Es({url:_,allowedTypes:tu,onChange:te,onError:oe});let pe=g4(p,u)?u:void 0,Ie=(0,ud.useSelect)(de=>!window.__clientSideMediaProcessing||!p?!1:de(qq.store).isUploadingById(p),[p]),Ne=!!u&&(0,es.jsx)("img",{alt:(0,Js.__)("Edit image"),title:(0,Js.__)("Edit image"),className:"edit-image-preview",src:u}),ae=(0,on.__experimentalUseBorderProps)(e),Re=(0,on.__experimentalGetShadowClassesAndStyles)(e),Ee=w(a,{"is-transient":!!_||Ie,"is-resized":!!d||!!f,[`size-${h}`]:h,"has-custom-border":!!ae.className||ae.style&&Object.keys(ae.style).length>0}),ie=(0,on.useBlockProps)({ref:S,className:Ee}),{lockUrlControls:fe=!1,lockUrlControlsMessage:ke}=(0,ud.useSelect)(de=>{if(!r)return{};let ct=(0,fv.getBlockBindingsSource)(k?.bindings?.url?.source);return{lockUrlControls:!!k?.bindings?.url&&!ct?.canUserEditValue?.({select:de,context:l,args:k?.bindings?.url?.args}),lockUrlControlsMessage:ct?.label?(0,Js.sprintf)((0,Js.__)("Connected to %s"),ct.label):(0,Js.__)("Connected to dynamic data")}},[l,r,k?.bindings?.url]);return(0,es.jsxs)(es.Fragment,{children:[(0,es.jsxs)("figure",{...ie,children:[(0,es.jsx)(Vq,{temporaryURL:_,isSideloading:Ie,attributes:e,setAttributes:t,isSingleSelected:r,insertBlocksAfter:n,onReplace:i,onSelectImage:te,onSelectURL:ne,onUploadError:oe,context:l,clientId:s,blockEditingMode:J,parentLayoutType:C,maxContentWidth:D}),(0,es.jsx)(on.MediaPlaceholder,{icon:(0,es.jsx)(on.BlockIcon,{icon:Wu}),onSelect:te,onSelectURL:ne,onError:oe,placeholder:de=>(0,es.jsxs)(Gq.Placeholder,{className:w("block-editor-media-placeholder",{[ae.className]:!!ae.className&&!r}),icon:!F&&(fe?XT:Wu),withIllustration:!r||F,label:!F&&(0,Js.__)("Image"),instructions:!fe&&!F&&(0,Js.__)("Drag and drop an image, upload, or choose from your library."),style:{aspectRatio:!(d&&f)&&g?g:void 0,width:f&&g?"100%":d,height:d&&g?"100%":f,objectFit:b,...ae.style,...Re.style},children:[fe&&!F&&ke,!fe&&!F&&de,A]}),allowedTypes:tu,handleUpload:de=>de.length===1,value:{id:p,src:pe},mediaPreview:Ne,disableMediaButtons:_||u})]}),r&&N&&B]})}var Zq=F2e;var b4={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/image",title:"Image",category:"media",usesContext:["allowResize","imageCrop","fixedHeight","navigationButtonType","postId","postType","queryId","galleryId"],description:"Insert an image to make a visual statement.",keywords:["img","photo","picture"],textdomain:"default",attributes:{blob:{type:"string",role:"local"},url:{type:"string",source:"attribute",selector:"img",attribute:"src",role:"content"},alt:{type:"string",source:"attribute",selector:"img",attribute:"alt",default:"",role:"content"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",role:"content"},lightbox:{type:"object",enabled:{type:"boolean"}},title:{type:"string",source:"attribute",selector:"img",attribute:"title",role:"content"},href:{type:"string",source:"attribute",selector:"figure > a",attribute:"href",role:"content"},rel:{type:"string",source:"attribute",selector:"figure > a",attribute:"rel"},linkClass:{type:"string",source:"attribute",selector:"figure > a",attribute:"class"},id:{type:"number",role:"content"},width:{type:"string"},height:{type:"string"},aspectRatio:{type:"string"},scale:{type:"string"},focalPoint:{type:"object"},sizeSlug:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string",source:"attribute",selector:"figure > a",attribute:"target"}},supports:{interactivity:!0,align:["left","center","right","wide","full"],anchor:!0,color:{text:!1,background:!1},filter:{duotone:!0},spacing:{margin:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0,__experimentalDefaultControls:{color:!0,radius:!0,width:!0}},shadow:{__experimentalSkipSerialization:!0}},selectors:{border:".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",shadow:".wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder",filter:{duotone:".wp-block-image img, .wp-block-image .components-placeholder"}},styles:[{name:"default",label:"Default",isDefault:!0},{name:"rounded",label:"Rounded"}],editorStyle:"wp-block-image-editor",style:"wp-block-image"};var ts=o(T(),1);var au=o(v(),1);function Kq({attributes:e}){let{url:t,alt:r,caption:a,align:n,href:i,rel:l,linkClass:s,width:c,height:u,aspectRatio:m,scale:
Line truncated
|
||||
`).map(a=>(0,iu.createBlock)("core/list-item",{content:(0,Bh.toHTMLString)({value:a})}))}return(0,iu.createBlock)("core/list",{anchor:e.anchor},t)}},{type:"raw",selector:"ol,ul",schema:e=>({ol:BZ(e).ol,ul:BZ(e).ul}),transform:kE},...["*","-"].map(e=>({type:"prefix",prefix:e,transform(t){return(0,iu.createBlock)("core/list",{},[(0,iu.createBlock)("core/list-item",{content:t})])}})),...["1.","1)"].map(e=>({type:"prefix",prefix:e,transform(t){return(0,iu.createBlock)("core/list",{ordered:!0},[(0,iu.createBlock)("core/list-item",{content:t})])}}))],to:[...["core/paragraph","core/heading"].map(e=>({type:"block",blocks:[e],transform:(t,r)=>CE(r).map(a=>(0,iu.createBlock)(e,{content:a}))}))]},IZ=ybe;var{name:NZ}=P4,EZ={icon:Nl,example:{innerBlocks:[{name:"core/list-item",attributes:{content:(0,Ih.__)("Alice.")}},{name:"core/list-item",attributes:{content:(0,Ih.__)("The White Rabbit.")}},{name:"core/list-item",attributes:{content:(0,Ih.__)("The Cheshire Cat.")}},{name:"core/list-item",attributes:{content:(0,Ih.__)("The Mad Hatter.")}},{name:"core/list-item",attributes:{content:(0,Ih.__)("The Queen of Hearts.")}}]},transforms:IZ,edit:TZ,save:PZ,deprecated:hZ},_be=()=>E({name:NZ,metadata:P4,settings:EZ});var PE={};Z(PE,{init:()=>Cbe,metadata:()=>N4,name:()=>OZ,settings:()=>jZ});var _m=o(P(),1),I4=o(T(),1),km=o(M(),1),xm=o(U(),1),LZ=o(V(),1),MZ=o(bv(),1);var Ci=o(v(),1),{Badge:xbe}=K(km.privateApis);function AZ({attributes:e,setAttributes:t,isSelected:r}){let{latex:a,mathML:n}=e,[i,l]=(0,xm.useState)(),[s,c]=(0,xm.useState)(null),[u,m]=(0,xm.useState)(),p=(0,xm.useRef)(a),{__unstableMarkNextChangeAsNotPersistent:d}=(0,LZ.useDispatch)(I4.store);(0,xm.useEffect)(()=>{import("@wordpress/latex-to-mathml").then(h=>{m(()=>h.default),p.current&&(d(),t({mathML:h.default(p.current,{displayMode:!0})}))})},[p,t,d]);let f=(0,I4.useBlockProps)({ref:l,position:"relative"});return(0,Ci.jsxs)("div",{...f,children:[n?(0,Ci.jsx)("math",{display:"block",dangerouslySetInnerHTML:{__html:n}}):"\u200B",r&&(0,Ci.jsx)(km.Popover,{placement:"bottom-start",offset:8,anchor:i,focusOnMount:!1,__unstableSlotName:"__unstable-block-tools-after",children:(0,Ci.jsx)("div",{style:{padding:"4px",minWidth:"300px"},children:(0,Ci.jsxs)(km.__experimentalVStack,{spacing:1,children:[(0,Ci.jsx)(km.TextareaControl,{__next40pxDefaultSize:!0,label:(0,_m.__)("LaTeX math syntax"),hideLabelFromVision:!0,value:a,className:"wp-block-math__textarea-control",onChange:h=>{if(!u){t({latex:h});return}let g="";try{g=u(h,{displayMode:!0}),c(null)}catch(b){c(b.message),(0,MZ.speak)((0,_m.sprintf)((0,_m.__)("Error parsing mathematical expression: %s"),b.message))}t({mathML:g,latex:h})},placeholder:(0,_m.__)("e.g., x^2, \\frac{a}{b}")}),s&&(0,Ci.jsxs)(Ci.Fragment,{children:[(0,Ci.jsx)(xbe,{intent:"error",className:"wp-block-math__error",children:(0,_m.sprintf)((0,_m.__)("Error: %s"),s)}),(0,Ci.jsx)("style",{children:".wp-block-math__error .components-badge__content{white-space:normal}"})]})]})})})]})}var N4={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/math",title:"Math",category:"text",description:"Display mathematical notation using LaTeX.",keywords:["equation","formula","latex","mathematics"],textdomain:"default",supports:{anchor:!0,html:!1,__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0},color:{gradients:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},typography:{fontSize:!0,__experimentalDefaultControls:{fontSize:!0}}},attributes:{latex:{type:"string",role:"content"},mathML:{type:"string",source:"html",selector:"math"}}};var RZ=o(T(),1),TE=o(v(),1);function zZ({attributes:e}){let{latex:t,mathML:r}=e;return t?(0,TE.jsx)("div",{...RZ.useBlockProps.save(),children:(0,TE.jsx)("math",{display:"block",dangerouslySetInnerHTML:{__html:r}})}):null}var VZ=o(T(),1),FZ=o(v(),1),wbe={attributes:{latex:{type:"string",role:"content"},mathML:{type:"string",source:"html",selector:"math"}},save({attributes:e}){let{latex:t,mathML:r}=e;return t?(0,FZ.jsx)("math",{...VZ.useBlockProps.save(),display:"block",dangerouslySetInnerHTML:{__html:r}}):null}},HZ=[wbe];var{name:OZ}=N4,jZ={icon:IT,example:{attributes:{latex:"x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}",mathML:'<semantics><mrow><mi>x</mi><mo>=</mo><mfrac><mrow><mo lspace="0em" rspace="0em">\u2212</mo><mi>b</mi><mo>\xB1</mo><msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup><mo>\u2212</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex">x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}</annotation></semantics>'},viewportWidth:300},edit:AZ,save:zZ,deprecated:HZ},Cbe=()=>E({name:OZ,metadata:N4,settings:jZ});var RE={};Z(RE,{init:()=>Nbe,metadata:()=>E4,name:()=>sK,settings:()=>A4});var nK=o(P(),1);var iK=o(T(),1),lK=o(W(),1);var E4={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/list-item",title:"List Item",categ
Line truncated
|
||||
`)})}var ZK=o(W(),1),iye={from:[{type:"raw",schema:{"wp-block":{attributes:["data-block"]}},isMatch:e=>e.dataset&&e.dataset.block==="core/more",transform(e){let{customText:t,noTeaser:r}=e.dataset,a={};return t&&(a.customText=t),r===""&&(a.noTeaser=!0),(0,ZK.createBlock)("core/more",a)}}]},KK=iye;var{fieldsKey:lye,formKey:sye}=K(YK.privateApis),{name:XK}=X4,J4={icon:RT,example:{},__experimentalLabel(e,{context:t}){let r=e?.metadata?.name;if((t==="list-view"||t==="breadcrumb")&&r)return r;if(t==="accessibility")return e.customText},transforms:KK,edit:GK,save:qK};window.__experimentalContentOnlyInspectorFields&&(J4[lye]=[{id:"customText",label:(0,QK.__)("Content"),type:"text",Edit:"rich-text"}],J4[sye]={fields:["customText"]});var cye=()=>E({name:XK,metadata:X4,settings:J4});var TD={};Z(TD,{init:()=>p_e,metadata:()=>e3,name:()=>kX,settings:()=>wX});var $3=o(P(),1);var yX=o(V(),1),_X=o(Q(),1),xX=o(Wo(),1);var e3={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/navigation",title:"Navigation",category:"theme",allowedBlocks:["core/navigation-link","core/search","core/social-links","core/page-list","core/spacer","core/home-link","core/icon","core/site-title","core/site-logo","core/navigation-submenu","core/loginout","core/buttons"],description:"A collection of blocks that allow visitors to get around your site.",keywords:["menu","navigation","links"],textdomain:"default",attributes:{ref:{type:"number"},textColor:{type:"string"},customTextColor:{type:"string"},rgbTextColor:{type:"string"},backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},rgbBackgroundColor:{type:"string"},showSubmenuIcon:{type:"boolean",default:!0},submenuVisibility:{type:"string",enum:["hover","click","always"],default:"hover"},overlayMenu:{type:"string",default:"mobile"},overlay:{type:"string"},icon:{type:"string",default:"handle"},hasIcon:{type:"boolean",default:!0},__unstableLocation:{type:"string"},overlayBackgroundColor:{type:"string"},customOverlayBackgroundColor:{type:"string"},overlayTextColor:{type:"string"},customOverlayTextColor:{type:"string"},maxNestingLevel:{type:"number",default:5},templateLock:{type:["string","boolean"],enum:["all","insert","contentOnly",!1]}},providesContext:{textColor:"textColor",customTextColor:"customTextColor",backgroundColor:"backgroundColor",customBackgroundColor:"customBackgroundColor",overlayTextColor:"overlayTextColor",customOverlayTextColor:"customOverlayTextColor",overlayBackgroundColor:"overlayBackgroundColor",customOverlayBackgroundColor:"customOverlayBackgroundColor",fontSize:"fontSize",customFontSize:"customFontSize",showSubmenuIcon:"showSubmenuIcon",submenuVisibility:"submenuVisibility",openSubmenusOnClick:"openSubmenusOnClick",style:"style",maxNestingLevel:"maxNestingLevel"},supports:{anchor:!0,align:["wide","full"],ariaLabel:!0,contentRole:!0,html:!1,inserter:!0,typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0,__experimentalLetterSpacing:!0,__experimentalTextDecoration:!0,__experimentalSkipSerialization:["textDecoration"],__experimentalDefaultControls:{fontSize:!0}},spacing:{blockGap:!0,units:["px","em","rem","vh","vw"],__experimentalDefaultControls:{blockGap:!0}},layout:{allowSwitching:!1,allowInheriting:!1,allowVerticalAlignment:!1,allowSizingOnChildren:!0,default:{type:"flex"}},interactivity:!0,renaming:!1},editorStyle:"wp-block-navigation-editor",style:"wp-block-navigation"};var $t=o(U(),1),tt=o(T(),1),Td=o(Q(),1),ss=o(V(),1),Hr=o(M(),1),It=o(P(),1),U3=o(bv(),1);var pX=o(W(),1),dX=o(me(),1);var Fh=o(Q(),1),tQ=o(V(),1);var Pi={name:"core/navigation-link",attributes:{kind:"post-type",type:"page"}},JK=["core/navigation-link/page","core/navigation-link"],$E={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"},eQ=["postType","wp_navigation",$E],ic="navigation-overlay";function Hh(e){let t=(0,Fh.useResourcePermissions)({kind:"postType",name:"wp_navigation",id:e}),{navigationMenu:r,isNavigationMenuResolved:a,isNavigationMenuMissing:n}=(0,tQ.useSelect)(h=>mye(h,e),[e]),{canCreate:i,canUpdate:l,canDelete:s,isResolving:c,hasResolved:u}=t,{records:m,isResolving:p,hasResolved:d}=(0,Fh.useEntityRecords)("postType","wp_navigation",$E),f=e?m?.length>1:m?.length>0;return{navigationMenu:r,isNavigationMenuResolved:a,isNavigationMenuMissing:n,navigationMenus:m,isResolvingNavigationMenus:p,hasResolvedNavigationMenus:d,canSwitchNavigationMenu:f,canUserCreateNavigationMenus:i,isResolvingCanUserCreateNavigationMenus:c,hasResolvedCanUserCreateNavigationMenus:u,canUserUpdateNavigationMenu:l,hasResolvedCanUserUpdateNavigationMenu:e?u:void 0,canUserDeleteNavigationMenu:s,hasResolvedCanUserDeleteNavigationMenu:e?u:void 0}}function mye(e,t){if(!t)return{isNavigationMenuResolved:!1,isNavigationMenuMissing:!0};let{getEntityRecord:r,getEditedEntityRecord:a,hasFinishedResolution:n}=e(Fh.store),i=["postType","wp_navigation",t],l=r(...i),s=a(...i),c=n("getEditedEn
Line truncated
|
||||
Window, very small in the distance, illuminated.
|
||||
All around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;`)}},transforms:Ore,edit:Fre,save:Hre,merge(e,t){return{content:e.content+`
|
||||
|
||||
`+t.content}}};window.__experimentalContentOnlyInspectorFields&&(fC[Vke]=[{id:"content",label:(0,TL.__)("Content"),type:"text",Edit:"rich-text"}],fC[Fke]={fields:["content"]});var Hke=()=>E({name:Ure,metadata:pC,settings:fC});var BL={};Z(BL,{init:()=>Jke,metadata:()=>gC,name:()=>eoe,settings:()=>vC});var v2=o(P(),1);var Jre=o(W(),1);var ht=o(T(),1),Wre=o(V(),1);var Vd="is-style-solid-color";var fr=o(v(),1),h2={value:{type:"string",source:"html",selector:"blockquote",multiline:"p"},citation:{type:"string",source:"html",selector:"cite",default:""},mainColor:{type:"string"},customMainColor:{type:"string"},textColor:{type:"string"},customTextColor:{type:"string"}};function Gre(e){if(!e)return;let t=e.match(/border-color:([^;]+)[;]?/);if(t&&t[1])return t[1]}function Fd(e){e=e||"<p></p>";let r=`</p>${e}<p>`.split("</p><p>");return r.shift(),r.pop(),r.join("<br>")}var Oke={attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",role:"content"},citation:{type:"string",source:"html",selector:"cite",default:"",role:"content"},textAlign:{type:"string"}},supports:{anchor:!0,align:["left","right","wide","full"],color:{gradients:!0,background:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0,fontAppearance:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},__experimentalStyle:{typography:{fontSize:"1.5em",lineHeight:"1.6"}}},save({attributes:e}){let{textAlign:t,citation:r,value:a}=e,n=!ht.RichText.isEmpty(r);return(0,fr.jsx)("figure",{...ht.useBlockProps.save({className:w({[`has-text-align-${t}`]:t})}),children:(0,fr.jsxs)("blockquote",{children:[(0,fr.jsx)(ht.RichText.Content,{value:a,multiline:!0}),n&&(0,fr.jsx)(ht.RichText.Content,{tagName:"cite",value:r})]})})},migrate({value:e,...t}){return{value:Fd(e),...t}}},jke={attributes:{...h2},supports:{anchor:!0,align:["left","right","wide","full"],color:{gradients:!0,background:!0,link:!0},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0}},save({attributes:e}){let{mainColor:t,customMainColor:r,customTextColor:a,textColor:n,value:i,citation:l,className:s}=e,c=s?.includes(Vd),u,m;if(c){let h=(0,ht.getColorClassName)("background-color",t);u=w({"has-background":h||r,[h]:h}),m={backgroundColor:h?void 0:r}}else r&&(m={borderColor:r});let p=(0,ht.getColorClassName)("color",n),d=w({"has-text-color":n||a,[p]:p}),f=p?void 0:{color:a};return(0,fr.jsx)("figure",{...ht.useBlockProps.save({className:u,style:m}),children:(0,fr.jsxs)("blockquote",{className:d,style:f,children:[(0,fr.jsx)(ht.RichText.Content,{value:i,multiline:!0}),!ht.RichText.isEmpty(l)&&(0,fr.jsx)(ht.RichText.Content,{tagName:"cite",value:l})]})})},migrate({value:e,className:t,mainColor:r,customMainColor:a,customTextColor:n,...i}){let l=t?.includes(Vd),s;return a&&(l?s={color:{background:a}}:s={border:{color:a}}),n&&s&&(s.color={...s.color,text:n}),{value:Fd(e),className:t,backgroundColor:l?r:void 0,borderColor:l?void 0:r,textAlign:l?"left":void 0,...i,style:s}}},Uke={attributes:{...h2,figureStyle:{source:"attribute",selector:"figure",attribute:"style"}},save({attributes:e}){let{mainColor:t,customMainColor:r,textColor:a,customTextColor:n,value:i,citation:l,className:s,figureStyle:c}=e,u=s?.includes(Vd),m,p;if(u){let g=(0,ht.getColorClassName)("background-color",t);m=w({"has-background":g||r,[g]:g}),p={backgroundColor:g?void 0:r}}else r?p={borderColor:r}:t&&(p={borderColor:Gre(c)});let d=(0,ht.getColorClassName)("color",a),f=(a||n)&&w("has-text-color",{[d]:d});return(0,fr.jsx)("figure",{className:m,style:p,children:(0,fr.jsxs)("blockquote",{className:f,style:d?void 0:{color:n},children:[(0,fr.jsx)(ht.RichText.Content,{value:i,multiline:!0}),!ht.RichText.isEmpty(l)&&(0,fr.jsx)(ht.RichText.Content,{tagName:"cite",value:l})]})})},migrate({value:e,className:t,figureStyle:r,mainColor:a,customMainColor:n,customTextColor:i,...l}){let s=t?.includes(Vd),c;if(n&&(s?c={color:{background:n}}:c={border:{color:n}}),i&&c&&(c.color={...c.color,text:i}),!s&&a&&r){let u=Gre(r);if(u)return{value:Fd(e),...l,className:t,style:{border:{color:u}}}}return{value:Fd(e),className:t,backgroundColor:s?a:void 0,borderColor:s?void 0:a,textAlign:s?"left":void 0,...l,style:c}}},Gke={attributes:h2,save({attributes:e}){let{mainColor:t,customMainColor:r,textColor:a,customTextColor:n,value:i,citation:l,className:s}=e,c=s?.includes(Vd),u,m;if(c)u=(0,ht.getColorClassName)("background-color",t),u||(m={backgroundColor:r});else if(r)m={borderColor:r};else if(t){let h=(0,Wre.select)(ht.store).getSettings().colors??[];m={borderColor:(0,ht.getColorObjectByAttributeValues)(h,t).color}}let p=(0,ht.getColorClassName)("color",a),d=a||n?w("has-text-color",{[p]:p}):void 0;return(0,fr.Line truncated
|
||||
`)}),anchor:e.anchor})},{type:"block",blocks:["core/heading"],transform:({content:e,anchor:t})=>(0,xu.createBlock)("core/pullquote",{value:e,anchor:t})}],to:[{type:"block",blocks:["core/paragraph"],transform:({value:e,citation:t})=>{let r=[];return e&&r.push((0,xu.createBlock)("core/paragraph",{content:e})),t&&r.push((0,xu.createBlock)("core/paragraph",{content:t})),r.length===0?(0,xu.createBlock)("core/paragraph",{content:""}):r}},{type:"block",blocks:["core/heading"],transform:({value:e,citation:t})=>{if(!e)return(0,xu.createBlock)("core/heading",{content:t});let r=(0,xu.createBlock)("core/heading",{content:e});return t?[r,(0,xu.createBlock)("core/heading",{content:t})]:r}}]},Xre=Qke;var{fieldsKey:Yke,formKey:Xke}=K(Jre.privateApis),{name:eoe}=gC,vC={icon:EP,example:{attributes:{value:(0,v2.__)("One of the hardest things to do in technology is disrupt yourself."),citation:(0,v2.__)("Matt Mullenweg")}},transforms:Xre,edit:Qre,save:Yre,deprecated:$re};window.__experimentalContentOnlyInspectorFields&&(vC[Yke]=[{id:"value",label:(0,v2.__)("Content"),type:"text",Edit:"rich-text"},{id:"citation",label:(0,v2.__)("Citation"),type:"text",Edit:"rich-text"}],vC[Xke]={fields:["value","citation"]});var Jke=()=>E({name:eoe,metadata:gC,settings:vC});var UL={};Z(UL,{init:()=>N5e,metadata:()=>bC,name:()=>Nae,settings:()=>Eae});var bC={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/query",title:"Query Loop",category:"theme",description:"An advanced block that allows displaying post types based on different query parameters and visual configurations.",keywords:["posts","list","blog","blogs","custom post types"],textdomain:"default",attributes:{queryId:{type:"number"},query:{type:"object",default:{perPage:null,pages:0,offset:0,postType:"post",order:"desc",orderBy:"date",author:"",search:"",exclude:[],sticky:"",inherit:!0,taxQuery:null,parents:[],format:[]}},tagName:{type:"string",default:"div"},namespace:{type:"string"},enhancedPagination:{type:"boolean",default:!1}},usesContext:["templateSlug"],providesContext:{queryId:"queryId",query:"query",displayLayout:"displayLayout",enhancedPagination:"enhancedPagination"},supports:{anchor:!0,align:["wide","full"],html:!1,layout:!0,interactivity:!0},editorStyle:"wp-block-query-editor"};var hae=o(V(),1),gae=o(U(),1),vae=o(T(),1);var EC=o(V(),1),uae=o(me(),1),w2=o(U(),1),hl=o(T(),1),mae=o(P(),1),pae=o(Q(),1);var moe=o(M(),1),kC=o(P(),1);var gc=o(V(),1),Od=o(U(),1),b2=o(Q(),1),yC=o(T(),1),toe=o(Wo(),1),Hd=o(P(),1),ku=o(W(),1),y2=e=>{let t=e?.reduce((r,a)=>{let{mapById:n,mapByName:i,names:l}=r;return n[a.id]=a,i[a.name]=a,l.push(a.name),r},{mapById:{},mapByName:{},names:[]});return{entities:e,...t}},t5e=(e,t)=>{let r=t.split("."),a=e;return r.forEach(n=>{a=a?.[n]}),a},IL=(e,t)=>(e||[]).map(r=>({...r,name:(0,toe.decodeEntities)(t5e(r,t))})),roe=()=>{let e=(0,gc.useSelect)(n=>{let{getPostTypes:i}=n(b2.store),l=["attachment"];return i({per_page:-1})?.filter(({viewable:c,slug:u})=>c&&!l.includes(u))},[]),t=(0,Od.useMemo)(()=>{if(e?.length)return e.reduce((n,i)=>(n[i.slug]=i.taxonomies,n),{})},[e]),r=(0,Od.useMemo)(()=>(e||[]).map(({labels:n,slug:i})=>({label:n.singular_name,value:i})),[e]),a=(0,Od.useMemo)(()=>e?.length?e.reduce((n,i)=>(n[i.slug]=i.supports?.["post-formats"]||!1,n),{}):{},[e]);return{postTypesTaxonomiesMap:t,postTypesSelectOptions:r,postTypeFormatSupportMap:a}},_C=e=>{let t=(0,gc.useSelect)(r=>{let{getTaxonomies:a,getPostType:n}=r(b2.store);return n(e)?.taxonomies?.length>0?a({type:e,per_page:-1}):[]},[e]);return(0,Od.useMemo)(()=>t?.filter(({visibility:r})=>!!r?.publicly_queryable),[t])};function ooe(e){return(0,gc.useSelect)(t=>{let r=t(b2.store).getPostType(e);return r?.viewable&&r?.hierarchical},[e])}function aoe(e){let t=(0,gc.useSelect)(r=>!!r(b2.store).getPostType(e)?.supports?.["page-attributes"],[e]);return(0,Od.useMemo)(()=>{let r=[{label:(0,Hd.__)("Newest to oldest"),value:"date/desc"},{label:(0,Hd.__)("Oldest to newest"),value:"date/asc"},{label:(0,Hd.__)("A \u2192 Z"),value:"title/asc"},{label:(0,Hd.__)("Z \u2192 A"),value:"title/desc"}];return t&&r.push({label:(0,Hd.__)("Ascending by order"),value:"menu_order/asc"},{label:(0,Hd.__)("Descending by order"),value:"menu_order/desc"}),r},[t])}function noe(e){return(0,gc.useSelect)(t=>t(ku.store).getActiveBlockVariation("core/query",e)?.allowedControls,[e])}function Fi(e,t){return e?e.includes(t):!0}var ioe=(e,t)=>{let{query:{postType:r,inherit:a},namespace:n}=t,i=e.map(c=>(0,ku.cloneBlock)(c)),l=[],s=[...i];for(;s.length>0;){let c=s.shift();c.name==="core/query"&&(c.attributes.query={...c.attributes.query,postType:r,inherit:a},n&&(c.attributes.namespace=n),l.push(c.clientId)),c.innerBlocks?.forEach(u=>{s.push(u)})}return{newBlocks:i,queryClientIds:l}};function loe(e,t){return(0,gc.useSelect)(r=>{let a=r(ku.store).getActiveBlockVariation("core/query",t)?.name;if(!a)return"core/query";let{getBlockRootClientId:n,getPatternsByBlockTypes:i}=r(yC.store),l=n(e);return i(`core/query/${a}`,l).lengt
Line truncated
|
||||
Down in the reeds by the river?
|
||||
Spreading ruin and scattering ban,
|
||||
Splashing and paddling with hoofs of a goat,
|
||||
And breaking the golden lilies afloat
|
||||
With the dragon-fly on the river.`)}},transforms:Jme,deprecated:Kme,merge(e,t){return{content:e.content+`
|
||||
|
||||
`+t.content}},edit:Yme,save:Xme};window.__experimentalContentOnlyInspectorFields&&(M7[tCe]=[{id:"content",label:(0,gR.__)("Content"),type:"text",Edit:"rich-text"}],M7[rCe]={fields:["content"]});var oCe=()=>E({name:tpe,metadata:D7,settings:M7});var _R={};Z(_R,{init:()=>yCe,metadata:()=>n0,name:()=>bpe,settings:()=>z7});var R7=o(P(),1);var vpe=o(W(),1);var hb=o(T(),1);var n0={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/video",title:"Video",category:"media",description:"Embed a video from your media library or upload a new one.",keywords:["movie"],textdomain:"default",attributes:{autoplay:{type:"boolean",source:"attribute",selector:"video",attribute:"autoplay"},caption:{type:"rich-text",source:"rich-text",selector:"figcaption",role:"content"},controls:{type:"boolean",source:"attribute",selector:"video",attribute:"controls",default:!0},id:{type:"number",role:"content"},loop:{type:"boolean",source:"attribute",selector:"video",attribute:"loop"},muted:{type:"boolean",source:"attribute",selector:"video",attribute:"muted"},poster:{type:"string",source:"attribute",selector:"video",attribute:"poster"},preload:{type:"string",source:"attribute",selector:"video",attribute:"preload",default:"metadata"},blob:{type:"string",role:"local"},src:{type:"string",source:"attribute",selector:"video",attribute:"src",role:"content"},playsInline:{type:"boolean",source:"attribute",selector:"video",attribute:"playsinline"},tracks:{role:"content",type:"array",items:{type:"object"},default:[]}},supports:{anchor:!0,align:!0,spacing:{margin:!0,padding:!0,__experimentalDefaultControls:{margin:!1,padding:!1}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-video-editor",style:"wp-block-video"};var rpe=o(v(),1);function i0({tracks:e=[]}){return e.map(t=>{let{id:r,...a}=t;return(0,rpe.jsx)("track",{...a},r??a.src)})}var l0=o(v(),1),{attributes:nCe}=n0,iCe={attributes:nCe,save({attributes:e}){let{autoplay:t,caption:r,controls:a,loop:n,muted:i,poster:l,preload:s,src:c,playsInline:u,tracks:m}=e;return(0,l0.jsxs)("figure",{...hb.useBlockProps.save(),children:[c&&(0,l0.jsx)("video",{autoPlay:t,controls:a,loop:n,muted:i,poster:l,preload:s!=="metadata"?s:void 0,src:c,playsInline:u,children:(0,l0.jsx)(i0,{tracks:m})}),!hb.RichText.isEmpty(r)&&(0,l0.jsx)(hb.RichText.Content,{tagName:"figcaption",value:r})]})}},lCe=[iCe],ope=lCe;var upe=o(Rr(),1),np=o(M(),1),_n=o(T(),1),c0=o(U(),1),gb=o(P(),1),mpe=o(V(),1);var ppe=o(xr(),1),dpe=o(mr(),1);var Gr=o(P(),1),yn=o(M(),1),pf=o(U(),1),va=o(v(),1),sCe=[{value:"auto",label:(0,Gr.__)("Auto")},{value:"metadata",label:(0,Gr.__)("Metadata")},{value:"none",label:(0,Gr._x)("None","Preload value")}],cCe=({setAttributes:e,attributes:t})=>{let{autoplay:r,controls:a,loop:n,muted:i,playsInline:l,preload:s}=t,c=(0,Gr.__)("Autoplay may cause usability issues for some users."),u=pf.Platform.select({web:(0,pf.useCallback)(d=>d?c:null,[]),native:c}),m=(0,pf.useMemo)(()=>{let d=f=>h=>{e({[f]:h,...f==="autoplay"&&{muted:h,playsInline:h}})};return{autoplay:d("autoplay"),loop:d("loop"),muted:d("muted"),controls:d("controls"),playsInline:d("playsInline")}},[]),p=(0,pf.useCallback)(d=>{e({preload:d})},[]);return(0,va.jsxs)(va.Fragment,{children:[(0,va.jsx)(yn.__experimentalToolsPanelItem,{label:(0,Gr.__)("Autoplay"),isShownByDefault:!0,hasValue:()=>!!r,onDeselect:()=>{e({autoplay:!1,muted:!1})},children:(0,va.jsx)(yn.ToggleControl,{label:(0,Gr.__)("Autoplay"),onChange:m.autoplay,checked:!!r,help:u})}),(0,va.jsx)(yn.__experimentalToolsPanelItem,{label:(0,Gr.__)("Loop"),isShownByDefault:!0,hasValue:()=>!!n,onDeselect:()=>{e({loop:!1})},children:(0,va.jsx)(yn.ToggleControl,{label:(0,Gr.__)("Loop"),onChange:m.loop,checked:!!n})}),(0,va.jsx)(yn.__experimentalToolsPanelItem,{label:(0,Gr.__)("Muted"),isShownByDefault:!0,hasValue:()=>!!i,onDeselect:()=>{e({muted:!1})},children:(0,va.jsx)(yn.ToggleControl,{label:(0,Gr.__)("Muted"),onChange:m.muted,checked:!!i,disabled:r,help:r?(0,Gr.__)("Muted because of Autoplay."):null})}),(0,va.jsx)(yn.__experimentalToolsPanelItem,{label:(0,Gr.__)("Playback controls"),isShownByDefault:!0,hasValue:()=>!a,onDeselect:()=>{e({controls:!0})},children:(0,va.jsx)(yn.ToggleControl,{label:(0,Gr.__)("Playback controls"),onChange:m.controls,checked:!!a})}),(0,va.jsx)(yn.__experimentalToolsPanelItem,{label:(0,Gr.__)("Play inline"),isShownByDefault:!0,hasValue:()=>!!l,onDeselect:()=>{e({playsInline:!1})},children:(0,va.jsx)(yn.ToggleControl,{label:(0,Gr.__)("Play inline"),onChange:m.playsInline,checked:!!l,disabled:r,help:r?(0,Gr.__)("Play inline enabled because of Autoplay."):(0,Gr.__)("When enabled, videos will play directly within the webpage on mobile browsers, instead of opening in a fullscreen player.")})}),(0,va.jsx)(yn.__experimentalToolsPanelItem,{label:(0,Gr.__)("Preload"),isShownByDefault:!0,hasValue:()=>s!=="metadata",onDeselect:()=>{e({preload:"metadata"})},children:(0,va.jsx)(yn.SelectControl,{__next40pxDefaultSize:!0,label:(0,Gr.__)("Preload"),value:s,onChange:p,op
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
fast-average-color/dist/index.esm.js:
|
||||
(*! Fast Average Color | © 2022 Denis Seleznev | MIT License | https://github.com/fast-average-color/fast-average-color *)
|
||||
*/
|
||||
@@ -0,0 +1,228 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).blockSerializationDefaultParser = (() => {
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// packages/block-serialization-default-parser/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
parse: () => parse
|
||||
});
|
||||
var document;
|
||||
var offset;
|
||||
var output;
|
||||
var stack;
|
||||
var tokenizer = /<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g;
|
||||
function Block(blockName, attrs, innerBlocks, innerHTML, innerContent) {
|
||||
return {
|
||||
blockName,
|
||||
attrs,
|
||||
innerBlocks,
|
||||
innerHTML,
|
||||
innerContent
|
||||
};
|
||||
}
|
||||
function Freeform(innerHTML) {
|
||||
return Block(null, {}, [], innerHTML, [innerHTML]);
|
||||
}
|
||||
function Frame(block, tokenStart, tokenLength, prevOffset, leadingHtmlStart) {
|
||||
return {
|
||||
block,
|
||||
tokenStart,
|
||||
tokenLength,
|
||||
prevOffset: prevOffset || tokenStart + tokenLength,
|
||||
leadingHtmlStart
|
||||
};
|
||||
}
|
||||
var parse = (doc) => {
|
||||
document = doc;
|
||||
offset = 0;
|
||||
output = [];
|
||||
stack = [];
|
||||
tokenizer.lastIndex = 0;
|
||||
do {
|
||||
} while (proceed());
|
||||
return output;
|
||||
};
|
||||
function proceed() {
|
||||
const stackDepth = stack.length;
|
||||
const next = nextToken();
|
||||
const [tokenType, blockName, attrs, startOffset, tokenLength] = next;
|
||||
const leadingHtmlStart = startOffset > offset ? offset : null;
|
||||
switch (tokenType) {
|
||||
case "no-more-tokens":
|
||||
if (0 === stackDepth) {
|
||||
addFreeform();
|
||||
return false;
|
||||
}
|
||||
if (1 === stackDepth) {
|
||||
addBlockFromStack();
|
||||
return false;
|
||||
}
|
||||
while (0 < stack.length) {
|
||||
addBlockFromStack();
|
||||
}
|
||||
return false;
|
||||
case "void-block":
|
||||
if (0 === stackDepth) {
|
||||
if (null !== leadingHtmlStart) {
|
||||
output.push(
|
||||
Freeform(
|
||||
document.substr(
|
||||
leadingHtmlStart,
|
||||
startOffset - leadingHtmlStart
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
output.push(Block(blockName, attrs, [], "", []));
|
||||
offset = startOffset + tokenLength;
|
||||
return true;
|
||||
}
|
||||
addInnerBlock(
|
||||
Block(blockName, attrs, [], "", []),
|
||||
startOffset,
|
||||
tokenLength
|
||||
);
|
||||
offset = startOffset + tokenLength;
|
||||
return true;
|
||||
case "block-opener":
|
||||
stack.push(
|
||||
Frame(
|
||||
Block(blockName, attrs, [], "", []),
|
||||
startOffset,
|
||||
tokenLength,
|
||||
startOffset + tokenLength,
|
||||
leadingHtmlStart
|
||||
)
|
||||
);
|
||||
offset = startOffset + tokenLength;
|
||||
return true;
|
||||
case "block-closer":
|
||||
if (0 === stackDepth) {
|
||||
addFreeform();
|
||||
return false;
|
||||
}
|
||||
if (1 === stackDepth) {
|
||||
addBlockFromStack(startOffset);
|
||||
offset = startOffset + tokenLength;
|
||||
return true;
|
||||
}
|
||||
const stackTop = stack.pop();
|
||||
const html = document.substr(
|
||||
stackTop.prevOffset,
|
||||
startOffset - stackTop.prevOffset
|
||||
);
|
||||
stackTop.block.innerHTML += html;
|
||||
stackTop.block.innerContent.push(html);
|
||||
stackTop.prevOffset = startOffset + tokenLength;
|
||||
addInnerBlock(
|
||||
stackTop.block,
|
||||
stackTop.tokenStart,
|
||||
stackTop.tokenLength,
|
||||
startOffset + tokenLength
|
||||
);
|
||||
offset = startOffset + tokenLength;
|
||||
return true;
|
||||
default:
|
||||
addFreeform();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function parseJSON(input) {
|
||||
try {
|
||||
return JSON.parse(input);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function nextToken() {
|
||||
const matches = tokenizer.exec(document);
|
||||
if (null === matches) {
|
||||
return ["no-more-tokens", "", null, 0, 0];
|
||||
}
|
||||
const startedAt = matches.index;
|
||||
const [
|
||||
match,
|
||||
closerMatch,
|
||||
namespaceMatch,
|
||||
nameMatch,
|
||||
attrsMatch,
|
||||
,
|
||||
voidMatch
|
||||
] = matches;
|
||||
const length = match.length;
|
||||
const isCloser = !!closerMatch;
|
||||
const isVoid = !!voidMatch;
|
||||
const namespace = namespaceMatch || "core/";
|
||||
const name = namespace + nameMatch;
|
||||
const hasAttrs = !!attrsMatch;
|
||||
const attrs = hasAttrs ? parseJSON(attrsMatch) : {};
|
||||
if (isCloser && (isVoid || hasAttrs)) {
|
||||
}
|
||||
if (isVoid) {
|
||||
return ["void-block", name, attrs, startedAt, length];
|
||||
}
|
||||
if (isCloser) {
|
||||
return ["block-closer", name, null, startedAt, length];
|
||||
}
|
||||
return ["block-opener", name, attrs, startedAt, length];
|
||||
}
|
||||
function addFreeform(rawLength) {
|
||||
const length = rawLength ? rawLength : document.length - offset;
|
||||
if (0 === length) {
|
||||
return;
|
||||
}
|
||||
output.push(Freeform(document.substr(offset, length)));
|
||||
}
|
||||
function addInnerBlock(block, tokenStart, tokenLength, lastOffset) {
|
||||
const parent = stack[stack.length - 1];
|
||||
parent.block.innerBlocks.push(block);
|
||||
const html = document.substr(
|
||||
parent.prevOffset,
|
||||
tokenStart - parent.prevOffset
|
||||
);
|
||||
if (html) {
|
||||
parent.block.innerHTML += html;
|
||||
parent.block.innerContent.push(html);
|
||||
}
|
||||
parent.block.innerContent.push(null);
|
||||
parent.prevOffset = lastOffset ? lastOffset : tokenStart + tokenLength;
|
||||
}
|
||||
function addBlockFromStack(endOffset) {
|
||||
const { block, leadingHtmlStart, prevOffset, tokenStart } = stack.pop();
|
||||
const html = endOffset ? document.substr(prevOffset, endOffset - prevOffset) : document.substr(prevOffset);
|
||||
if (html) {
|
||||
block.innerHTML += html;
|
||||
block.innerContent.push(html);
|
||||
}
|
||||
if (null !== leadingHtmlStart) {
|
||||
output.push(
|
||||
Freeform(
|
||||
document.substr(
|
||||
leadingHtmlStart,
|
||||
tokenStart - leadingHtmlStart
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
output.push(block);
|
||||
}
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
@@ -0,0 +1 @@
|
||||
"use strict";var wp;(wp||={}).blockSerializationDefaultParser=(()=>{var m=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var F=(t,e)=>{for(var s in e)m(t,s,{get:e[s],enumerable:!0})},H=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!B.call(t,n)&&n!==s&&m(t,n,{get:()=>e[n],enumerable:!(o=S(e,n))||o.enumerable});return t};var w=t=>H(m({},"__esModule",{value:!0}),t);var L={};F(L,{parse:()=>y});var a,l,i,f,C=/<!--\s+(\/)?wp:([a-z][a-z0-9_-]*\/)?([a-z][a-z0-9_-]*)\s+({(?:(?=([^}]+|}+(?=})|(?!}\s+\/?-->)[^])*)\5|[^]*?)}\s+)?(\/)?-->/g;function k(t,e,s,o,n){return{blockName:t,attrs:e,innerBlocks:s,innerHTML:o,innerContent:n}}function g(t){return k(null,{},[],t,[t])}function N(t,e,s,o,n){return{block:t,tokenStart:e,tokenLength:s,prevOffset:o||e+s,leadingHtmlStart:n}}var y=t=>{a=t,l=0,i=[],f=[],C.lastIndex=0;do;while(A());return i};function A(){let t=f.length,e=J(),[s,o,n,r,c]=e,p=r>l?l:null;switch(s){case"no-more-tokens":if(t===0)return d(),!1;if(t===1)return v(),!1;for(;0<f.length;)v();return!1;case"void-block":return t===0?(p!==null&&i.push(g(a.substr(p,r-p))),i.push(k(o,n,[],"",[])),l=r+c,!0):(z(k(o,n,[],"",[]),r,c),l=r+c,!0);case"block-opener":return f.push(N(k(o,n,[],"",[]),r,c,r+c,p)),l=r+c,!0;case"block-closer":if(t===0)return d(),!1;if(t===1)return v(r),l=r+c,!0;let u=f.pop(),h=a.substr(u.prevOffset,r-u.prevOffset);return u.block.innerHTML+=h,u.block.innerContent.push(h),u.prevOffset=r+c,z(u.block,u.tokenStart,u.tokenLength,r+c),l=r+c,!0;default:return d(),!1}}function I(t){try{return JSON.parse(t)}catch{return null}}function J(){let t=C.exec(a);if(t===null)return["no-more-tokens","",null,0,0];let e=t.index,[s,o,n,r,c,,p]=t,u=s.length,h=!!o,O=!!p,b=(n||"core/")+r,M=!!c,x=M?I(c):{};return O?["void-block",b,x,e,u]:h?["block-closer",b,null,e,u]:["block-opener",b,x,e,u]}function d(t){let e=t||a.length-l;e!==0&&i.push(g(a.substr(l,e)))}function z(t,e,s,o){let n=f[f.length-1];n.block.innerBlocks.push(t);let r=a.substr(n.prevOffset,e-n.prevOffset);r&&(n.block.innerHTML+=r,n.block.innerContent.push(r)),n.block.innerContent.push(null),n.prevOffset=o||e+s}function v(t){let{block:e,leadingHtmlStart:s,prevOffset:o,tokenStart:n}=f.pop(),r=t?a.substr(o,t-o):a.substr(o);r&&(e.innerHTML+=r,e.innerContent.push(r)),s!==null&&i.push(g(a.substr(s,n-s))),i.push(e)}return w(L);})();
|
||||
+1531
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,2 @@
|
||||
"use strict";var wp;(wp||={}).blockSerializationSpecParser=(()=>{var Pe=(c,b)=>()=>(b||c((b={exports:{}}).exports,b),b.exports);var De=Pe((je,ce)=>{function Te(c,b){function e(){this.constructor=c}e.prototype=b.prototype,c.prototype=new e}function S(c,b,e,y){this.message=c,this.expected=b,this.found=e,this.location=y,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,S)}Te(S,Error);S.buildMessage=function(c,b){var e={literal:function(p){return'"'+P(p.text)+'"'},class:function(p){var $="",v;for(v=0;v<p.parts.length;v++)$+=p.parts[v]instanceof Array?A(p.parts[v][0])+"-"+A(p.parts[v][1]):A(p.parts[v]);return"["+(p.inverted?"^":"")+$+"]"},any:function(p){return"any character"},end:function(p){return"end of input"},other:function(p){return p.description}};function y(p){return p.charCodeAt(0).toString(16).toUpperCase()}function P(p){return p.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+y($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+y($)})}function A(p){return p.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function($){return"\\x0"+y($)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function($){return"\\x"+y($)})}function D(p){return e[p.type](p)}function I(p){var $=new Array(p.length),v,F;for(v=0;v<p.length;v++)$[v]=D(p[v]);if($.sort(),$.length>0){for(v=1,F=1;v<$.length;v++)$[v-1]!==$[v]&&($[F]=$[v],F++);$.length=F}switch($.length){case 1:return $[0];case 2:return $[0]+" or "+$[1];default:return $.slice(0,-1).join(", ")+", or "+$[$.length-1]}}function C(p){return p?'"'+P(p)+'"':"end of input"}return"Expected "+I(c)+" but "+C(b)+" found."};function Re(c,b){b=b!==void 0?b:{};var e={},y={Block_List:te},P=te,A=ke(),D=function(r,l,g){return[l,g]},I=function(r,l,g){return Fe(r,l,g)},C="<!--",p=B("<!--",!1),$="wp:",v=B("wp:",!1),F=function(r,l){return l},Q="/-->",ae=B("/-->",!1),oe=function(r,l){return{blockName:r,attrs:l||{},innerBlocks:[],innerHTML:"",innerContent:[]}},ge=function(r,l,g){var t=Le(l),a=t[0],f=t[1],n=t[2];return{blockName:r.blockName,attrs:r.attrs,innerBlocks:f,innerHTML:a,innerContent:n}},_="-->",M=B("-->",!1),ue=function(r,l){return{blockName:r,attrs:l||{}}},W="/wp:",he=B("/wp:",!1),pe=function(r){return{blockName:r}},O="/",j=B("/",!1),$e=function(r){return"core/"+r},de=/^[a-z]/,ve=X([["a","z"]],!1,!1),Y=/^[a-z0-9_\-]/,Z=X([["a","z"],["0","9"],"_","-"],!1,!1),be=le("JSON-encoded attributes embedded in a block's opening comment"),Ae="{",me=B("{",!1),J="}",U=B("}",!1),ee="",xe=function(r){return Se(r)},se=/^[ \t\r\n]/,re=X([" "," ","\r",`
|
||||
`],!1,!1),s=0,m=0,z=[{line:1,column:1}],w=0,V=[],u=0,H;if("startRule"in b){if(!(b.startRule in y))throw new Error(`Can't start parsing from rule "`+b.startRule+'".');P=y[b.startRule]}function Me(){return c.substring(m,s)}function ze(){return T(m,s)}function He(r,l){throw l=l!==void 0?l:T(m,s),fe([le(r)],c.substring(m,s),l)}function Ie(r,l){throw l=l!==void 0?l:T(m,s),Ee(r,l)}function B(r,l){return{type:"literal",text:r,ignoreCase:l}}function X(r,l,g){return{type:"class",parts:r,inverted:l,ignoreCase:g}}function ke(){return{type:"any"}}function we(){return{type:"end"}}function le(r){return{type:"other",description:r}}function ie(r){var l=z[r],g;if(l)return l;for(g=r-1;!z[g];)g--;for(l=z[g],l={line:l.line,column:l.column};g<r;)c.charCodeAt(g)===10?(l.line++,l.column=1):l.column++,g++;return z[r]=l,l}function T(r,l){var g=ie(r),t=ie(l);return{start:{offset:r,line:g.line,column:g.column},end:{offset:l,line:t.line,column:t.column}}}function h(r){s<w||(s>w&&(w=s,V=[]),V.push(r))}function Ee(r,l){return new S(r,null,null,l)}function fe(r,l,g){return new S(S.buildMessage(r,l),r,l,g)}function te(){var r,l,g,t,a,f,n,i,o,d;for(r=s,l=s,g=[],t=s,a=s,u++,f=x(),u--,f===e?a=void 0:(s=a,a=e),a!==e?(c.length>s?(f=c.charAt(s),s++):(f=e,u===0&&h(A)),f!==e?(a=[a,f],t=a):(s=t,t=e)):(s=t,t=e);t!==e;)g.push(t),t=s,a=s,u++,f=x(),u--,f===e?a=void 0:(s=a,a=e),a!==e?(c.length>s?(f=c.charAt(s),s++):(f=e,u===0&&h(A)),f!==e?(a=[a,f],t=a):(s=t,t=e)):(s=t,t=e);if(g!==e?l=c.substring(l,s):l=g,l!==e){if(g=[],t=s,a=x(),a!==e){for(f=s,n=[],i=s,o=s,u++,d=x(),u--,d===e?o=void 0:(s=o,o=e),o!==e?(c.length>s?(d=c.charAt(s),s++):(d=e,u===0&&h(A)),d!==e?(o=[o,d],i=o):(s=i,i=e)):(s=i,i=e);i!==e;)n.push(i),i=s,o=s,u++,d=x(),u--,d===e?o=void 0:(s=o,o=e),o!==e?(c.length>s?(d=c.charAt(s),s++):(d=e,u===0&&h(A)),d!==e?(o=[o,d],i=o):(s=i,i=e)):(s=i,i=e);n!==e?f=c.substring(f,s):f=n,f!==e?(m=t,a=D(l,a,f),t=a):(s=t,t=e)}else s=t,t=e;for(;t!==e;)if(g.push(t),t=s,a=x(),a!==e){for(f=s,n=[],i=s,o=s,u++,d=x(),u--,d===e?o=void 0:(s=o,o=e),o!==e?(c.length>s?(d=c.charAt(s),s++):(d=e,u===0&&h(A)),d!==e?(o=[o,d],i=o):(s=i,i=e)):(s=i,i=e);i!==e;)n.push(i),i=s,o=s,u++,d=x(),u--,d===e?o=void 0:(s=o,o=e),o!==e?(c.length>s?(d=c.charAt(s),s++):(d=e,u===0&&h(A)),d!==e?(o=[o,d],i=o):(s=i,i=e)):(s=i,i=e);n!==e?f=c.substring(f,s):f=n,f!==e?(m=t,a=D(l,a,f),t=a):(s=t,t=e)}else s=t,t=e;if(g!==e){for(t=s,a=[],c.length>s?(f=c.charAt(s),s++):(f=e,u===0&&h(A));f!==e;)a.push(f),c.length>s?(f=c.charAt(s),s++):(f=e,u===0&&h(A));a!==e?t=c.substring(t,s):t=a,t!==e?(m=r,l=I(l,g,t),r=l):(s=r,r=e)}else s=r,r=e}else s=r,r=e;return r}function x(){var r;return r=ye(),r===e&&(r=Ce()),r}function ye(){var r,l,g,t,a,f,n,i,o;return r=s,c.substr(s,4)===C?(l=C,s+=4):(l=e,u===0&&h(p)),l!==e?(g=E(),g!==e?(c.substr(s,3)===$?(t=$,s+=3):(t=e,u===0&&h(v)),t!==e?(a=q(),a!==e?(f=E(),f!==e?(n=s,i=ne(),i!==e?(o=E(),o!==e?(m=n,i=F(a,i),n=i):(s=n,n=e)):(s=n,n=e),n===e&&(n=null),n!==e?(c.substr(s,4)===Q?(i=Q,s+=4):(i=e,u===0&&h(ae)),i!==e?(m=r,l=oe(a,n),r=l):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e),r}function Ce(){var r,l,g,t,a,f,n,i,o;if(r=s,l=_e(),l!==e){if(g=[],t=x(),t===e){if(t=s,a=[],f=s,n=s,u++,i=x(),u--,i===e?n=void 0:(s=n,n=e),n!==e?(i=s,u++,o=R(),u--,o===e?i=void 0:(s=i,i=e),i!==e?(c.length>s?(o=c.charAt(s),s++):(o=e,u===0&&h(A)),o!==e?(n=[n,i,o],f=n):(s=f,f=e)):(s=f,f=e)):(s=f,f=e),f!==e)for(;f!==e;)a.push(f),f=s,n=s,u++,i=x(),u--,i===e?n=void 0:(s=n,n=e),n!==e?(i=s,u++,o=R(),u--,o===e?i=void 0:(s=i,i=e),i!==e?(c.length>s?(o=c.charAt(s),s++):(o=e,u===0&&h(A)),o!==e?(n=[n,i,o],f=n):(s=f,f=e)):(s=f,f=e)):(s=f,f=e);else a=e;a!==e?t=c.substring(t,s):t=a}for(;t!==e;)if(g.push(t),t=x(),t===e){if(t=s,a=[],f=s,n=s,u++,i=x(),u--,i===e?n=void 0:(s=n,n=e),n!==e?(i=s,u++,o=R(),u--,o===e?i=void 0:(s=i,i=e),i!==e?(c.length>s?(o=c.charAt(s),s++):(o=e,u===0&&h(A)),o!==e?(n=[n,i,o],f=n):(s=f,f=e)):(s=f,f=e)):(s=f,f=e),f!==e)for(;f!==e;)a.push(f),f=s,n=s,u++,i=x(),u--,i===e?n=void 0:(s=n,n=e),n!==e?(i=s,u++,o=R(),u--,o===e?i=void 0:(s=i,i=e),i!==e?(c.length>s?(o=c.charAt(s),s++):(o=e,u===0&&h(A)),o!==e?(n=[n,i,o],f=n):(s=f,f=e)):(s=f,f=e)):(s=f,f=e);else a=e;a!==e?t=c.substring(t,s):t=a}g!==e?(t=R(),t!==e?(m=r,l=ge(l,g,t),r=l):(s=r,r=e)):(s=r,r=e)}else s=r,r=e;return r}function _e(){var r,l,g,t,a,f,n,i,o;return r=s,c.substr(s,4)===C?(l=C,s+=4):(l=e,u===0&&h(p)),l!==e?(g=E(),g!==e?(c.substr(s,3)===$?(t=$,s+=3):(t=e,u===0&&h(v)),t!==e?(a=q(),a!==e?(f=E(),f!==e?(n=s,i=ne(),i!==e?(o=E(),o!==e?(m=n,i=F(a,i),n=i):(s=n,n=e)):(s=n,n=e),n===e&&(n=null),n!==e?(c.substr(s,3)===_?(i=_,s+=3):(i=e,u===0&&h(M)),i!==e?(m=r,l=ue(a,n),r=l):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(s=r,r=e),r}function R(){var r,l,g,t,a,f,n;return r=s,c.substr(s,4)===C?(l=C,s+=4):(l=e,u===0&&h(p)),l!==e?(g=E(),g!==e?(c.substr(s,4)===W?(t=W,s+=4):(t=e,u===0&&h(he)),t!==e?(a=q(),a!==e?(f=E(),f!==e?(c.substr(s,3)===_?(n=_,s+=3):(n=e,u===0&&h(M)),n!==e?(m=r,l=pe(a),r=l):(s=r,r=e)):(s=r,r=e)):(s=r,r=e)):(sLine truncated
|
||||
Vendored
+10392
File diff suppressed because it is too large.
Load diff
Vendored
+194
@@ -0,0 +1,194 @@
|
||||
var wp;(wp||={}).blocks=(()=>{var zu=Object.create;var ir=Object.defineProperty;var qu=Object.getOwnPropertyDescriptor;var Iu=Object.getOwnPropertyNames;var Vu=Object.getPrototypeOf,xu=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ie=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})},hn=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Iu(t))!xu.call(e,o)&&o!==r&&ir(e,o,{get:()=>t[o],enumerable:!(a=qu(t,o))||a.enumerable});return e};var B=(e,t,r)=>(r=e!=null?zu(Vu(e)):{},hn(t||!e||!e.__esModule?ir(r,"default",{value:e,enumerable:!0}):r,e)),Hu=e=>hn(ir({},"__esModule",{value:!0}),e);var Be=z((Dd,gn)=>{gn.exports=window.wp.data});var sr=z((Gd,vn)=>{vn.exports=window.wp.i18n});var De=z((Xd,jn)=>{jn.exports=window.wp.element});var Z=z((Zd,zn)=>{zn.exports=window.wp.dom});var xe=z((Qd,qn)=>{qn.exports=window.wp.richText});var J=z((Jd,In)=>{In.exports=window.wp.deprecated});var pt=z((rc,Hn)=>{Hn.exports=window.wp.warning});var Fn=z((nc,Un)=>{Un.exports=window.wp.privateApis});var Ba=z((_c,yr)=>{var Ea={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u1EA4:"A",\u1EAE:"A",\u1EB2:"A",\u1EB4:"A",\u1EB6:"A",\u00C6:"AE",\u1EA6:"A",\u1EB0:"A",\u0202:"A",\u1EA2:"A",\u1EA0:"A",\u1EA8:"A",\u1EAA:"A",\u1EAC:"A",\u00C7:"C",\u1E08:"C",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u1EBE:"E",\u1E16:"E",\u1EC0:"E",\u1E14:"E",\u1E1C:"E",\u0206:"E",\u1EBA:"E",\u1EBC:"E",\u1EB8:"E",\u1EC2:"E",\u1EC4:"E",\u1EC6:"E",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u1E2E:"I",\u020A:"I",\u1EC8:"I",\u1ECA:"I",\u00D0:"D",\u00D1:"N",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u1ED0:"O",\u1E4C:"O",\u1E52:"O",\u020E:"O",\u1ECE:"O",\u1ECC:"O",\u1ED4:"O",\u1ED6:"O",\u1ED8:"O",\u1EDC:"O",\u1EDE:"O",\u1EE0:"O",\u1EDA:"O",\u1EE2:"O",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u1EE6:"U",\u1EE4:"U",\u1EEC:"U",\u1EEE:"U",\u1EF0:"U",\u00DD:"Y",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u1EA5:"a",\u1EAF:"a",\u1EB3:"a",\u1EB5:"a",\u1EB7:"a",\u00E6:"ae",\u1EA7:"a",\u1EB1:"a",\u0203:"a",\u1EA3:"a",\u1EA1:"a",\u1EA9:"a",\u1EAB:"a",\u1EAD:"a",\u00E7:"c",\u1E09:"c",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u1EBF:"e",\u1E17:"e",\u1EC1:"e",\u1E15:"e",\u1E1D:"e",\u0207:"e",\u1EBB:"e",\u1EBD:"e",\u1EB9:"e",\u1EC3:"e",\u1EC5:"e",\u1EC7:"e",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u1E2F:"i",\u020B:"i",\u1EC9:"i",\u1ECB:"i",\u00F0:"d",\u00F1:"n",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u1ED1:"o",\u1E4D:"o",\u1E53:"o",\u020F:"o",\u1ECF:"o",\u1ECD:"o",\u1ED5:"o",\u1ED7:"o",\u1ED9:"o",\u1EDD:"o",\u1EDF:"o",\u1EE1:"o",\u1EDB:"o",\u1EE3:"o",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u1EE7:"u",\u1EE5:"u",\u1EED:"u",\u1EEF:"u",\u1EF1:"u",\u00FD:"y",\u00FF:"y",\u0100:"A",\u0101:"a",\u0102:"A",\u0103:"a",\u0104:"A",\u0105:"a",\u0106:"C",\u0107:"c",\u0108:"C",\u0109:"c",\u010A:"C",\u010B:"c",\u010C:"C",\u010D:"c",C\u0306:"C",c\u0306:"c",\u010E:"D",\u010F:"d",\u0110:"D",\u0111:"d",\u0112:"E",\u0113:"e",\u0114:"E",\u0115:"e",\u0116:"E",\u0117:"e",\u0118:"E",\u0119:"e",\u011A:"E",\u011B:"e",\u011C:"G",\u01F4:"G",\u011D:"g",\u01F5:"g",\u011E:"G",\u011F:"g",\u0120:"G",\u0121:"g",\u0122:"G",\u0123:"g",\u0124:"H",\u0125:"h",\u0126:"H",\u0127:"h",\u1E2A:"H",\u1E2B:"h",\u0128:"I",\u0129:"i",\u012A:"I",\u012B:"i",\u012C:"I",\u012D:"i",\u012E:"I",\u012F:"i",\u0130:"I",\u0131:"i",\u0132:"IJ",\u0133:"ij",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u1E30:"K",\u1E31:"k",K\u0306:"K",k\u0306:"k",\u0139:"L",\u013A:"l",\u013B:"L",\u013C:"l",\u013D:"L",\u013E:"l",\u013F:"L",\u0140:"l",\u0141:"l",\u0142:"l",\u1E3E:"M",\u1E3F:"m",M\u0306:"M",m\u0306:"m",\u0143:"N",\u0144:"n",\u0145:"N",\u0146:"n",\u0147:"N",\u0148:"n",\u0149:"n",N\u0306:"N",n\u0306:"n",\u014C:"O",\u014D:"o",\u014E:"O",\u014F:"o",\u0150:"O",\u0151:"o",\u0152:"OE",\u0153:"oe",P\u0306:"P",p\u0306:"p",\u0154:"R",\u0155:"r",\u0156:"R",\u0157:"r",\u0158:"R",\u0159:"r",R\u0306:"R",r\u0306:"r",\u0212:"R",\u0213:"r",\u015A:"S",\u015B:"s",\u015C:"S",\u015D:"s",\u015E:"S",\u0218:"S",\u0219:"s",\u015F:"s",\u0160:"S",\u0161:"s",\u0162:"T",\u0163:"t",\u021B:"t",\u021A:"T",\u0164:"T",\u0165:"t",\u0166:"T",\u0167:"t",T\u0306:"T",t\u0306:"t",\u0168:"U",\u0169:"u",\u016A:"U",\u016B:"u",\u016C:"U",\u016D:"u",\u016E:"U",\u016F:"u",\u0170:"U",\u0171:"u",\u0172:"U",\u0173:"u",\u0216:"U",\u0217:"u",V\u0306:"V",v\u0306:"v",\u0174:"W",\u0175:"w",\u1E82:"W",\u1E83:"w",X\u0306:"X",x\u0306:"x",\u0176:"Y",\u0177:"y",\u0178:"Y",Y\u0306:"Y",y\u0306:"y",\u0179:"Z",\u017A:"z",\u017B:"Z",\u017C:"z",\u017D:"Z",\u017E:"z",\u017F:"s",\u0192:"f",\u01A0:"O",\u01A1:"o",\u01AF:"U",\u01B0:"u",\u01CD:"A",\u01CE:"a",\u01CF:"I",\u01D0:"i",\u01D1:"O",\u01D2:"o",\u01D3:"U",\u01D4:"u",\u01D5:"U",\u01D6:"u",\u01D7:"U",\u01D8:"u",\u01D9:"U",\u01DA:"u",\u01DB:"U",\u01DC:"u",\u1EE8:"U",\u1EE9:"u",\u1E78:"U",\u1E79:"u",\u01FA:"A",\u01FB:"a",\u01FC:"AE",\u01FD:"ae",\u01FE:"O",\u01FF:"o",\u00DE:"TH",\u00FE:"thLine truncated
|
||||
`),l=l.replace(/\r/g,`
|
||||
`),l=l.replace(/\u00A0/g," "),i.smartIndentationFix&&(l=v(l)),l=`
|
||||
|
||||
`+l+`
|
||||
|
||||
`,l=r.subParser("detab")(l,i,y),l=l.replace(/^[ \t]+$/mg,""),r.helper.forEach(u,function(C){l=r.subParser("runExtension")(C,l,i,y)}),l=r.subParser("metadata")(l,i,y),l=r.subParser("hashPreCodeTags")(l,i,y),l=r.subParser("githubCodeBlocks")(l,i,y),l=r.subParser("hashHTMLBlocks")(l,i,y),l=r.subParser("hashCodeTags")(l,i,y),l=r.subParser("stripLinkDefinitions")(l,i,y),l=r.subParser("blockGamut")(l,i,y),l=r.subParser("unhashHTMLSpans")(l,i,y),l=r.subParser("unescapeSpecialChars")(l,i,y),l=l.replace(/¨D/g,"$$"),l=l.replace(/¨T/g,"\xA8"),l=r.subParser("completeHTMLDocument")(l,i,y),r.helper.forEach(d,function(C){l=r.subParser("runExtension")(C,l,i,y)}),f=y.metadata,l},this.makeMarkdown=this.makeMd=function(l,y){if(l=l.replace(/\r\n/g,`
|
||||
`),l=l.replace(/\r/g,`
|
||||
`),l=l.replace(/>[ \t]+</,">\xA8NBSP;<"),!y)if(window&&window.document)y=window.document;else 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");var C=y.createElement("div");C.innerHTML=l;var A={preList:ne(C)};K(C);for(var O=C.childNodes,S="",F=0;F<O.length;F++)S+=r.subParser("makeMarkdown.node")(O[F],A);function K(x){for(var $=0;$<x.childNodes.length;++$){var Y=x.childNodes[$];Y.nodeType===3?/\S/.test(Y.nodeValue)?(Y.nodeValue=Y.nodeValue.split(`
|
||||
`).join(" "),Y.nodeValue=Y.nodeValue.replace(/(\s)+/g,"$1")):(x.removeChild(Y),--$):Y.nodeType===1&&K(Y)}}function ne(x){for(var $=x.querySelectorAll("pre"),Y=[],X=0;X<$.length;++X)if($[X].childElementCount===1&&$[X].firstChild.tagName.toLowerCase()==="code"){var tt=$[X].firstChild.innerHTML.trim(),nt=$[X].firstChild.getAttribute("data-language")||"";if(nt==="")for(var pn=$[X].firstChild.className.split(" "),at=0;at<pn.length;++at){var mn=pn[at].match(/^language-(.+)$/);if(mn!==null){nt=mn[1];break}}tt=r.helper.unescapeHTMLEntities(tt),Y.push(tt),$[X].outerHTML='<precode language="'+nt+'" precodenum="'+X.toString()+'"></precode>'}else Y.push($[X].innerHTML),$[X].innerHTML="",$[X].setAttribute("prenum",X.toString());return Y}return S},this.setOption=function(l,y){i[l]=y},this.getOption=function(l){return i[l]},this.getOptions=function(){return i},this.addExtension=function(l,y){y=y||null,T(l,y)},this.useExtension=function(l){T(l)},this.setFlavor=function(l){if(!h.hasOwnProperty(l))throw Error(l+" flavor was not found");var y=h[l];m=l;for(var C in y)y.hasOwnProperty(C)&&(i[C]=y[C])},this.getFlavor=function(){return m},this.removeExtension=function(l){r.helper.isArray(l)||(l=[l]);for(var y=0;y<l.length;++y){for(var C=l[y],A=0;A<u.length;++A)u[A]===C&&u[A].splice(A,1);for(var O=0;O<d.length;++A)d[O]===C&&d[O].splice(A,1)}},this.getAllExtensions=function(){return{language:u,output:d}},this.getMetadata=function(l){return l?f.raw:f.parsed},this.getMetadataFormat=function(){return f.format},this._setMetadataPair=function(l,y){f.parsed[l]=y},this._setMetadataFormat=function(l){f.format=l},this._setMetadataRaw=function(l){f.raw=l}},r.subParser("anchors",function(n,i,u){"use strict";n=u.converter._dispatch("anchors.before",n,i,u);var d=function(p,m,f,g,T,k,w){if(r.helper.isUndefined(w)&&(w=""),f=f.toLowerCase(),p.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)g="";else if(!g)if(f||(f=m.toLowerCase().replace(/ ?\n/g," ")),g="#"+f,!r.helper.isUndefined(u.gUrls[f]))g=u.gUrls[f],r.helper.isUndefined(u.gTitles[f])||(w=u.gTitles[f]);else return p;g=g.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var v='<a href="'+g+'"';return w!==""&&w!==null&&(w=w.replace(/"/g,"""),w=w.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback),v+=' title="'+w+'"'),i.openLinksInNewWindow&&!/^#/.test(g)&&(v+=' rel="noopener noreferrer" target="\xA8E95Eblank"'),v+=">"+m+"</a>",v};return n=n.replace(/\[((?:\[[^\]]*]|[^\[\]])*)] ?(?:\n *)?\[(.*?)]()()()()/g,d),n=n.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<([^>]*)>(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,d),n=n.replace(/\[((?:\[[^\]]*]|[^\[\]])*)]()[ \t]*\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?:[ \t]*((["'])([^"]*?)\5))?[ \t]?\)/g,d),n=n.replace(/\[([^\[\]]+)]()()()()()/g,d),i.ghMentions&&(n=n.replace(/(^|\s)(\\)?(@([a-z\d]+(?:[a-z\d.-]+?[a-z\d]+)*))/gmi,function(p,m,f,g,T){if(f==="\\")return m+g;if(!r.helper.isString(i.ghMentionsLink))throw new Error("ghMentionsLink option must be a string");var k=i.ghMentionsLink.replace(/\{u}/g,T),w="";return i.openLinksInNewWindow&&(w=' rel="noopener noreferrer" target="\xA8E95Eblank"'),m+'<a href="'+k+'"'+w+">"+g+"</a>"})),n=u.converter._dispatch("anchors.after",n,i,u),n});var L=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+?\.[^'">\s]+?)()(\1)?(?=\s|$)(?!["<>])/gi,N=/([*~_]+|\b)(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()\[\]])?(\1)?(?=\s|$)(?!["<>])/gi,j=/()<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)()>()/gi,I=/(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,G=/<()(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,Ce=function(n){"use strict";return function(i,u,d,p,m,f,g){d=d.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var T=d,k="",w="",v=u||"",l=g||"";return/^www\./i.test(d)&&(d=d.replace(/^www\./i,"http://www.")),n.excludeTrailingPunctuationFromURLs&&f&&(k=f),n.openLinksInNewWindow&&(w=' rel="noopener noreferrer" target="\xA8E95Eblank"'),v+'<a href="'+d+'"'+w+">"+T+"</a>"+k+l}},ur=function(n,i){"use strict";return function(u,d,p){var m="mailto:";return d=d||"",p=r.subParser("unescapeSpecialChars")(p,n,i),n.encodeEmails?(m=r.helper.encodeEmailAddress(m+p),p=r.helper.encodeEmailAddress(p)):m=m+p,d+'<a href="'+m+'">'+p+"</a>"}};r.subParser("autoLinks",function(n,i,u){"use strict";return n=u.converter._dispatch("autoLinks.before",n,i,u),n=n.replace(j,Ce(i)),n=n.replace(G,ur(i,u)),n=u.converter._dispatch("autoLinks.after",n,i,u),n}),r.subParser("simplifiedAutoLinks",function(n,i,u){"use strict";return i.simplifiedAutoLink&&(n=u.converter._dispatch("simplifiedAutoLinks.before",n,i,u),i.excludeTrailingPunctuationFromURLs?n=n.replace(N,Ce(i)):n=n.replace(L,Ce(i)),n=n.replace(I,ur(i,u)),n=u.converter._dispatch("simplifiedAutoLinks.after",n,i,u)),n}),r.subParser("blockGamut",function(n,i,u){"use strict";return n=u.converter._dispatch("blockGamut.before",n,i,u),n=r.subParser("bLine truncated
|
||||
|
||||
`;var d=/(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;return i.splitAdjacentBlockquotes&&(d=/^ {0,3}>[\s\S]*?(?:\n\n)/gm),n=n.replace(d,function(p){return p=p.replace(/^[ \t]*>[ \t]?/gm,""),p=p.replace(/¨0/g,""),p=p.replace(/^[ \t]+$/gm,""),p=r.subParser("githubCodeBlocks")(p,i,u),p=r.subParser("blockGamut")(p,i,u),p=p.replace(/(^|\n)/g,"$1 "),p=p.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(m,f){var g=f;return g=g.replace(/^ /mg,"\xA80"),g=g.replace(/¨0/g,""),g}),r.subParser("hashBlock")(`<blockquote>
|
||||
`+p+`
|
||||
</blockquote>`,i,u)}),n=u.converter._dispatch("blockQuotes.after",n,i,u),n}),r.subParser("codeBlocks",function(n,i,u){"use strict";n=u.converter._dispatch("codeBlocks.before",n,i,u),n+="\xA80";var d=/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=¨0))/g;return n=n.replace(d,function(p,m,f){var g=m,T=f,k=`
|
||||
`;return g=r.subParser("outdent")(g,i,u),g=r.subParser("encodeCode")(g,i,u),g=r.subParser("detab")(g,i,u),g=g.replace(/^\n+/g,""),g=g.replace(/\n+$/g,""),i.omitExtraWLInCodeBlocks&&(k=""),g="<pre><code>"+g+k+"</code></pre>",r.subParser("hashBlock")(g,i,u)+T}),n=n.replace(/¨0/,""),n=u.converter._dispatch("codeBlocks.after",n,i,u),n}),r.subParser("codeSpans",function(n,i,u){"use strict";return n=u.converter._dispatch("codeSpans.before",n,i,u),typeof n>"u"&&(n=""),n=n.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(d,p,m,f){var g=f;return g=g.replace(/^([ \t]*)/g,""),g=g.replace(/[ \t]*$/g,""),g=r.subParser("encodeCode")(g,i,u),g=p+"<code>"+g+"</code>",g=r.subParser("hashHTMLSpans")(g,i,u),g}),n=u.converter._dispatch("codeSpans.after",n,i,u),n}),r.subParser("completeHTMLDocument",function(n,i,u){"use strict";if(!i.completeHTMLDocument)return n;n=u.converter._dispatch("completeHTMLDocument.before",n,i,u);var d="html",p=`<!DOCTYPE HTML>
|
||||
`,m="",f=`<meta charset="utf-8">
|
||||
`,g="",T="";typeof u.metadata.parsed.doctype<"u"&&(p="<!DOCTYPE "+u.metadata.parsed.doctype+`>
|
||||
`,d=u.metadata.parsed.doctype.toString().toLowerCase(),(d==="html"||d==="html5")&&(f='<meta charset="utf-8">'));for(var k in u.metadata.parsed)if(u.metadata.parsed.hasOwnProperty(k))switch(k.toLowerCase()){case"doctype":break;case"title":m="<title>"+u.metadata.parsed.title+`</title>
|
||||
`;break;case"charset":d==="html"||d==="html5"?f='<meta charset="'+u.metadata.parsed.charset+`">
|
||||
`:f='<meta name="charset" content="'+u.metadata.parsed.charset+`">
|
||||
`;break;case"language":case"lang":g=' lang="'+u.metadata.parsed[k]+'"',T+='<meta name="'+k+'" content="'+u.metadata.parsed[k]+`">
|
||||
`;break;default:T+='<meta name="'+k+'" content="'+u.metadata.parsed[k]+`">
|
||||
`}return n=p+"<html"+g+`>
|
||||
<head>
|
||||
`+m+f+T+`</head>
|
||||
<body>
|
||||
`+n.trim()+`
|
||||
</body>
|
||||
</html>`,n=u.converter._dispatch("completeHTMLDocument.after",n,i,u),n}),r.subParser("detab",function(n,i,u){"use strict";return n=u.converter._dispatch("detab.before",n,i,u),n=n.replace(/\t(?=\t)/g," "),n=n.replace(/\t/g,"\xA8A\xA8B"),n=n.replace(/¨B(.+?)¨A/g,function(d,p){for(var m=p,f=4-m.length%4,g=0;g<f;g++)m+=" ";return m}),n=n.replace(/¨A/g," "),n=n.replace(/¨B/g,""),n=u.converter._dispatch("detab.after",n,i,u),n}),r.subParser("ellipsis",function(n,i,u){"use strict";return n=u.converter._dispatch("ellipsis.before",n,i,u),n=n.replace(/\.\.\./g,"\u2026"),n=u.converter._dispatch("ellipsis.after",n,i,u),n}),r.subParser("emoji",function(n,i,u){"use strict";if(!i.emoji)return n;n=u.converter._dispatch("emoji.before",n,i,u);var d=/:([\S]+?):/g;return n=n.replace(d,function(p,m){return r.helper.emojis.hasOwnProperty(m)?r.helper.emojis[m]:p}),n=u.converter._dispatch("emoji.after",n,i,u),n}),r.subParser("encodeAmpsAndAngles",function(n,i,u){"use strict";return n=u.converter._dispatch("encodeAmpsAndAngles.before",n,i,u),n=n.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),n=n.replace(/<(?![a-z\/?$!])/gi,"<"),n=n.replace(/</g,"<"),n=n.replace(/>/g,">"),n=u.converter._dispatch("encodeAmpsAndAngles.after",n,i,u),n}),r.subParser("encodeBackslashEscapes",function(n,i,u){"use strict";return n=u.converter._dispatch("encodeBackslashEscapes.before",n,i,u),n=n.replace(/\\(\\)/g,r.helper.escapeCharactersCallback),n=n.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g,r.helper.escapeCharactersCallback),n=u.converter._dispatch("encodeBackslashEscapes.after",n,i,u),n}),r.subParser("encodeCode",function(n,i,u){"use strict";return n=u.converter._dispatch("encodeCode.before",n,i,u),n=n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/([*_{}\[\]\\=~-])/g,r.helper.escapeCharactersCallback),n=u.converter._dispatch("encodeCode.after",n,i,u),n}),r.subParser("escapeSpecialCharsWithinTagAttributes",function(n,i,u){"use strict";n=u.converter._dispatch("escapeSpecialCharsWithinTagAttributes.before",n,i,u);var d=/<\/?[a-z\d_:-]+(?:[\s]+[\s\S]+?)?>/gi,p=/<!(--(?:(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>/gi;return n=n.replace(d,function(m){return m.replace(/(.)<\/?code>(?=.)/g,"$1`").replace(/([\\`*_~=|])/g,r.helper.escapeCharactersCallback)}),n=n.replace(p,function(m){return m.replace(/([\\`*_~=|])/g,r.helper.escapeCharactersCallback)}),n=u.converter._dispatch("escapeSpecialCharsWithinTagAttributes.after",n,i,u),n}),r.subParser("githubCodeBlocks",function(n,i,u){"use strict";return i.ghCodeBlocks?(n=u.converter._dispatch("githubCodeBlocks.before",n,i,u),n+="\xA80",n=n.replace(/(?:^|\n)(?: {0,3})(```+|~~~+)(?: *)([^\s`~]*)\n([\s\S]*?)\n(?: {0,3})\1/g,function(d,p,m,f){var g=i.omitExtraWLInCodeBlocks?"":`
|
||||
`;return f=r.subParser("encodeCode")(f,i,u),f=r.subParser("detab")(f,i,u),f=f.replace(/^\n+/g,""),f=f.replace(/\n+$/g,""),f="<pre><code"+(m?' class="'+m+" language-"+m+'"':"")+">"+f+g+"</code></pre>",f=r.subParser("hashBlock")(f,i,u),`
|
||||
|
||||
\xA8G`+(u.ghCodeBlocks.push({text:d,codeblock:f})-1)+`G
|
||||
|
||||
`}),n=n.replace(/¨0/,""),u.converter._dispatch("githubCodeBlocks.after",n,i,u)):n}),r.subParser("hashBlock",function(n,i,u){"use strict";return n=u.converter._dispatch("hashBlock.before",n,i,u),n=n.replace(/(^\n+|\n+$)/g,""),n=`
|
||||
|
||||
\xA8K`+(u.gHtmlBlocks.push(n)-1)+`K
|
||||
|
||||
`,n=u.converter._dispatch("hashBlock.after",n,i,u),n}),r.subParser("hashCodeTags",function(n,i,u){"use strict";n=u.converter._dispatch("hashCodeTags.before",n,i,u);var d=function(p,m,f,g){var T=f+r.subParser("encodeCode")(m,i,u)+g;return"\xA8C"+(u.gHtmlSpans.push(T)-1)+"C"};return n=r.helper.replaceRecursiveRegExp(n,d,"<code\\b[^>]*>","</code>","gim"),n=u.converter._dispatch("hashCodeTags.after",n,i,u),n}),r.subParser("hashElement",function(n,i,u){"use strict";return function(d,p){var m=p;return m=m.replace(/\n\n/g,`
|
||||
`),m=m.replace(/^\n/,""),m=m.replace(/\n+$/g,""),m=`
|
||||
|
||||
\xA8K`+(u.gHtmlBlocks.push(m)-1)+`K
|
||||
|
||||
`,m}}),r.subParser("hashHTMLBlocks",function(n,i,u){"use strict";n=u.converter._dispatch("hashHTMLBlocks.before",n,i,u);var d=["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"],p=function(l,y,C,A){var O=l;return C.search(/\bmarkdown\b/)!==-1&&(O=C+u.converter.makeHtml(y)+A),`
|
||||
|
||||
\xA8K`+(u.gHtmlBlocks.push(O)-1)+`K
|
||||
|
||||
`};i.backslashEscapesHTMLTags&&(n=n.replace(/\\<(\/?[^>]+?)>/g,function(l,y){return"<"+y+">"}));for(var m=0;m<d.length;++m)for(var f,g=new RegExp("^ {0,3}(<"+d[m]+"\\b[^>]*>)","im"),T="<"+d[m]+"\\b[^>]*>",k="</"+d[m]+">";(f=r.helper.regexIndexOf(n,g))!==-1;){var w=r.helper.splitAtIndex(n,f),v=r.helper.replaceRecursiveRegExp(w[1],p,T,k,"im");if(v===w[1])break;n=w[0].concat(v)}return n=n.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,r.subParser("hashElement")(n,i,u)),n=r.helper.replaceRecursiveRegExp(n,function(l){return`
|
||||
|
||||
\xA8K`+(u.gHtmlBlocks.push(l)-1)+`K
|
||||
|
||||
`},"^ {0,3}<!--","-->","gm"),n=n.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,r.subParser("hashElement")(n,i,u)),n=u.converter._dispatch("hashHTMLBlocks.after",n,i,u),n}),r.subParser("hashHTMLSpans",function(n,i,u){"use strict";n=u.converter._dispatch("hashHTMLSpans.before",n,i,u);function d(p){return"\xA8C"+(u.gHtmlSpans.push(p)-1)+"C"}return n=n.replace(/<[^>]+?\/>/gi,function(p){return d(p)}),n=n.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g,function(p){return d(p)}),n=n.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g,function(p){return d(p)}),n=n.replace(/<[^>]+?>/gi,function(p){return d(p)}),n=u.converter._dispatch("hashHTMLSpans.after",n,i,u),n}),r.subParser("unhashHTMLSpans",function(n,i,u){"use strict";n=u.converter._dispatch("unhashHTMLSpans.before",n,i,u);for(var d=0;d<u.gHtmlSpans.length;++d){for(var p=u.gHtmlSpans[d],m=0;/¨C(\d+)C/.test(p);){var f=RegExp.$1;if(p=p.replace("\xA8C"+f+"C",u.gHtmlSpans[f]),m===10){console.error("maximum nesting of 10 spans reached!!!");break}++m}n=n.replace("\xA8C"+d+"C",p)}return n=u.converter._dispatch("unhashHTMLSpans.after",n,i,u),n}),r.subParser("hashPreCodeTags",function(n,i,u){"use strict";n=u.converter._dispatch("hashPreCodeTags.before",n,i,u);var d=function(p,m,f,g){var T=f+r.subParser("encodeCode")(m,i,u)+g;return`
|
||||
|
||||
\xA8G`+(u.ghCodeBlocks.push({text:p,codeblock:T})-1)+`G
|
||||
|
||||
`};return n=r.helper.replaceRecursiveRegExp(n,d,"^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>","^ {0,3}</code>\\s*</pre>","gim"),n=u.converter._dispatch("hashPreCodeTags.after",n,i,u),n}),r.subParser("headers",function(n,i,u){"use strict";n=u.converter._dispatch("headers.before",n,i,u);var d=isNaN(parseInt(i.headerLevelStart))?1:parseInt(i.headerLevelStart),p=i.smoothLivePreview?/^(.+)[ \t]*\n={2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n=+[ \t]*\n+/gm,m=i.smoothLivePreview?/^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm:/^(.+)[ \t]*\n-+[ \t]*\n+/gm;n=n.replace(p,function(T,k){var w=r.subParser("spanGamut")(k,i,u),v=i.noHeaderId?"":' id="'+g(k)+'"',l=d,y="<h"+l+v+">"+w+"</h"+l+">";return r.subParser("hashBlock")(y,i,u)}),n=n.replace(m,function(T,k){var w=r.subParser("spanGamut")(k,i,u),v=i.noHeaderId?"":' id="'+g(k)+'"',l=d+1,y="<h"+l+v+">"+w+"</h"+l+">";return r.subParser("hashBlock")(y,i,u)});var f=i.requireSpaceBeforeHeadingText?/^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm:/^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;n=n.replace(f,function(T,k,w){var v=w;i.customizedHeaderId&&(v=w.replace(/\s?\{([^{]+?)}\s*$/,""));var l=r.subParser("spanGamut")(v,i,u),y=i.noHeaderId?"":' id="'+g(w)+'"',C=d-1+k.length,A="<h"+C+y+">"+l+"</h"+C+">";return r.subParser("hashBlock")(A,i,u)});function g(T){var k,w;if(i.customizedHeaderId){var v=T.match(/\{([^{]+?)}\s*$/);v&&v[1]&&(T=v[1])}return k=T,r.helper.isString(i.prefixHeaderId)?w=i.prefixHeaderId:i.prefixHeaderId===!0?w="section-":w="",i.rawPrefixHeaderId||(k=w+k),i.ghCompatibleHeaderId?k=k.replace(/ /g,"-").replace(/&/g,"").replace(/¨T/g,"").replace(/¨D/g,"").replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g,"").toLowerCase():i.rawHeaderId?k=k.replace(/ /g,"-").replace(/&/g,"&").replace(/¨T/g,"\xA8").replace(/¨D/g,"$").replace(/["']/g,"-").toLowerCase():k=k.replace(/[^\w]/g,"").toLowerCase(),i.rawPrefixHeaderId&&(k=w+k),u.hashLinkCounts[k]?k=k+"-"+u.hashLinkCounts[k]++:u.hashLinkCounts[k]=1,k}return n=u.converter._dispatch("headers.after",n,i,u),n}),r.subParser("horizontalRule",function(n,i,u){"use strict";n=u.converter._dispatch("horizontalRule.before",n,i,u);var d=r.subParser("hashBlock")("<hr />",i,u);return n=n.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm,d),n=n.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm,d),n=n.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm,d),n=u.converter._dispatch("horizontalRule.after",n,i,u),n}),r.subParser("images",function(n,i,u){"use strict";n=u.converter._dispatch("images.before",n,i,u);var d=/!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,p=/!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,m=/!\[([^\]]*?)][ \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,f=/!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,g=/!\[([^\[\]]+)]()()()()()/g;function T(w,v,l,y,C,A,O,S){return y=y.replace(/\s/g,""),k(w,v,l,y,C,A,O,S)}function k(w,v,l,y,C,A,O,S){var F=u.gUrls,K=u.gTitles,ne=u.gDimensions;if(l=l.toLowerCase(),S||(S=""),w.search(/\(<?\s*>? ?(['"].*['"])?\)$/m)>-1)y="";else if(y===""||y===null)if((l===""||l===null)&&(l=v.toLowerCase().replace(/ ?\n/g," ")),y="#"+l,!r.helper.isUndefined(F[l]))y=F[l],r.helper.isUndefined(K[l])||(S=K[l]),r.helper.isUndefined(ne[l])||(C=ne[l].width,A=ne[l].height);else return w;v=v.replace(/"/g,""").replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback),y=y.replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback);var x='<img src="'+y+'" alt="'+v+'"';return S&&r.helper.isString(S)&&(S=S.replace(/"/g,""").replace(r.helper.regexes.asteriskDashAndColon,r.helper.escapeCharactersCallback),x+=' title="'+S+'"'),C&&A&&(C=C==="*"?"auto":C,A=A==="*"?"auto":A,x+=' width="'+C+'"',x+=' height="'+A+'"'),x+=" />",x}return n=n.replace(f,k),n=n.replace(m,T),n=n.replace(p,k),n=n.replace(d,k),n=n.replace(g,k),n=u.converter._dispatch("images.after",n,i,u),n}),r.subParser("italicsAndBold",function(n,i,u){"use strict";n=u.converter._dispatch("italicsAndBold.before",n,i,u);function d(p,m,f){return m+p+f}return i.literalMidWordUnderscores?(n=n.replace(/\b___(\S[\s\S]*?)___\b/g,function(p,m){return d(m,"<strong><em>","</em></strong>")}),n=n.replace(/\b__(\S[\s\S]*?)__\b/g,function(p,m){return d(m,"<strong>","</strong>")}),n=n.replace(/\b_(\S[\s\S]*?)_\b/g,function(p,m){return d(m,"<em>","</em>")})):(n=n.replace(/___(\S[\s\S]*?)___/g,function(p,m){return/\S$/.test(m)?d(m,"<strong><em>","</em></strong>"):p}),n=n.replace(/__(\S[\s\S]*?)__/g,function(p,m){return/\S$/.test(m)?d(m,"<strong>","</strong>"):p}),n=n.replace(/_([^\s_][\s\S]*?)_/g,function(p,m){return/\S$/.test(m)?d(m,"<em>","</em>"):p})),i.literalMidWordAsterisks?(n=n.replace(/([^*]|^)\B\*\*\*(\S[\s\S]*?)\*\*\*\B(?!\*)/g,function(p,m,f){return d(f,m+"<strong><em>","</em></strong>")}),n=n.replace(/([^*]|^)\B\*\*(\SLine truncated
|
||||
`),f+="\xA80";var T=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0| {0,3}([*+-]|\d+[.])[ \t]+))/gm,k=/\n[ \t]*\n(?!¨0)/.test(f);return i.disableForced4SpacesIndentedSublists&&(T=/(\n)?(^ {0,3})([*+-]|\d+[.])[ \t]+((\[(x|X| )?])?[ \t]*[^\r]+?(\n{1,2}))(?=\n*(¨0|\2([*+-]|\d+[.])[ \t]+))/gm),f=f.replace(T,function(w,v,l,y,C,A,O){O=O&&O.trim()!=="";var S=r.subParser("outdent")(C,i,u),F="";return A&&i.tasklists&&(F=' class="task-list-item" style="list-style-type: none;"',S=S.replace(/^[ \t]*\[(x|X| )?]/m,function(){var K='<input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"';return O&&(K+=" checked"),K+=">",K})),S=S.replace(/^([-*+]|\d\.)[ \t]+[\S\n ]*/g,function(K){return"\xA8A"+K}),v||S.search(/\n{2,}/)>-1?(S=r.subParser("githubCodeBlocks")(S,i,u),S=r.subParser("blockGamut")(S,i,u)):(S=r.subParser("lists")(S,i,u),S=S.replace(/\n$/,""),S=r.subParser("hashHTMLBlocks")(S,i,u),S=S.replace(/\n\n+/g,`
|
||||
|
||||
`),k?S=r.subParser("paragraphs")(S,i,u):S=r.subParser("spanGamut")(S,i,u)),S=S.replace("\xA8A",""),S="<li"+F+">"+S+`</li>
|
||||
`,S}),f=f.replace(/¨0/g,""),u.gListLevel--,g&&(f=f.replace(/\s+$/,"")),f}function p(f,g){if(g==="ol"){var T=f.match(/^ *(\d+)\./);if(T&&T[1]!=="1")return' start="'+T[1]+'"'}return""}function m(f,g,T){var k=i.disableForced4SpacesIndentedSublists?/^ ?\d+\.[ \t]/gm:/^ {0,3}\d+\.[ \t]/gm,w=i.disableForced4SpacesIndentedSublists?/^ ?[*+-][ \t]/gm:/^ {0,3}[*+-][ \t]/gm,v=g==="ul"?k:w,l="";if(f.search(v)!==-1)(function C(A){var O=A.search(v),S=p(f,g);O!==-1?(l+=`
|
||||
|
||||
<`+g+S+`>
|
||||
`+d(A.slice(0,O),!!T)+"</"+g+`>
|
||||
`,g=g==="ul"?"ol":"ul",v=g==="ul"?k:w,C(A.slice(O))):l+=`
|
||||
|
||||
<`+g+S+`>
|
||||
`+d(A,!!T)+"</"+g+`>
|
||||
`})(f);else{var y=p(f,g);l=`
|
||||
|
||||
<`+g+y+`>
|
||||
`+d(f,!!T)+"</"+g+`>
|
||||
`}return l}return n=u.converter._dispatch("lists.before",n,i,u),n+="\xA80",u.gListLevel?n=n.replace(/^(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(f,g,T){var k=T.search(/[*+-]/g)>-1?"ul":"ol";return m(g,k,!0)}):n=n.replace(/(\n\n|^\n?)(( {0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(¨0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm,function(f,g,T,k){var w=k.search(/[*+-]/g)>-1?"ul":"ol";return m(T,w,!1)}),n=n.replace(/¨0/,""),n=u.converter._dispatch("lists.after",n,i,u),n}),r.subParser("metadata",function(n,i,u){"use strict";if(!i.metadata)return n;n=u.converter._dispatch("metadata.before",n,i,u);function d(p){u.metadata.raw=p,p=p.replace(/&/g,"&").replace(/"/g,"""),p=p.replace(/\n {4}/g," "),p.replace(/^([\S ]+): +([\s\S]+?)$/gm,function(m,f,g){return u.metadata.parsed[f]=g,""})}return n=n.replace(/^\s*«««+(\S*?)\n([\s\S]+?)\n»»»+\n/,function(p,m,f){return d(f),"\xA8M"}),n=n.replace(/^\s*---+(\S*?)\n([\s\S]+?)\n---+\n/,function(p,m,f){return m&&(u.metadata.format=m),d(f),"\xA8M"}),n=n.replace(/¨M/g,""),n=u.converter._dispatch("metadata.after",n,i,u),n}),r.subParser("outdent",function(n,i,u){"use strict";return n=u.converter._dispatch("outdent.before",n,i,u),n=n.replace(/^(\t|[ ]{1,4})/gm,"\xA80"),n=n.replace(/¨0/g,""),n=u.converter._dispatch("outdent.after",n,i,u),n}),r.subParser("paragraphs",function(n,i,u){"use strict";n=u.converter._dispatch("paragraphs.before",n,i,u),n=n.replace(/^\n+/g,""),n=n.replace(/\n+$/g,"");for(var d=n.split(/\n{2,}/g),p=[],m=d.length,f=0;f<m;f++){var g=d[f];g.search(/¨(K|G)(\d+)\1/g)>=0?p.push(g):g.search(/\S/)>=0&&(g=r.subParser("spanGamut")(g,i,u),g=g.replace(/^([ \t]*)/g,"<p>"),g+="</p>",p.push(g))}for(m=p.length,f=0;f<m;f++){for(var T="",k=p[f],w=!1;/¨(K|G)(\d+)\1/.test(k);){var v=RegExp.$1,l=RegExp.$2;v==="K"?T=u.gHtmlBlocks[l]:w?T=r.subParser("encodeCode")(u.ghCodeBlocks[l].text,i,u):T=u.ghCodeBlocks[l].codeblock,T=T.replace(/\$/g,"$$$$"),k=k.replace(/(\n\n)?¨(K|G)\d+\2(\n\n)?/,T),/^<pre\b[^>]*>\s*<code\b[^>]*>/.test(k)&&(w=!0)}p[f]=k}return n=p.join(`
|
||||
`),n=n.replace(/^\n+/g,""),n=n.replace(/\n+$/g,""),u.converter._dispatch("paragraphs.after",n,i,u)}),r.subParser("runExtension",function(n,i,u,d){"use strict";if(n.filter)i=n.filter(i,d.converter,u);else if(n.regex){var p=n.regex;p instanceof RegExp||(p=new RegExp(p,"g")),i=i.replace(p,n.replace)}return i}),r.subParser("spanGamut",function(n,i,u){"use strict";return n=u.converter._dispatch("spanGamut.before",n,i,u),n=r.subParser("codeSpans")(n,i,u),n=r.subParser("escapeSpecialCharsWithinTagAttributes")(n,i,u),n=r.subParser("encodeBackslashEscapes")(n,i,u),n=r.subParser("images")(n,i,u),n=r.subParser("anchors")(n,i,u),n=r.subParser("autoLinks")(n,i,u),n=r.subParser("simplifiedAutoLinks")(n,i,u),n=r.subParser("emoji")(n,i,u),n=r.subParser("underline")(n,i,u),n=r.subParser("italicsAndBold")(n,i,u),n=r.subParser("strikethrough")(n,i,u),n=r.subParser("ellipsis")(n,i,u),n=r.subParser("hashHTMLSpans")(n,i,u),n=r.subParser("encodeAmpsAndAngles")(n,i,u),i.simpleLineBreaks?/\n\n¨K/.test(n)||(n=n.replace(/\n+/g,`<br />
|
||||
`)):n=n.replace(/ +\n/g,`<br />
|
||||
`),n=u.converter._dispatch("spanGamut.after",n,i,u),n}),r.subParser("strikethrough",function(n,i,u){"use strict";function d(p){return i.simplifiedAutoLink&&(p=r.subParser("simplifiedAutoLinks")(p,i,u)),"<del>"+p+"</del>"}return i.strikethrough&&(n=u.converter._dispatch("strikethrough.before",n,i,u),n=n.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g,function(p,m){return d(m)}),n=u.converter._dispatch("strikethrough.after",n,i,u)),n}),r.subParser("stripLinkDefinitions",function(n,i,u){"use strict";var d=/^ {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,p=/^ {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+="\xA80";var m=function(f,g,T,k,w,v,l){return g=g.toLowerCase(),T.match(/^data:.+?\/.+?;base64,/)?u.gUrls[g]=T.replace(/\s/g,""):u.gUrls[g]=r.subParser("encodeAmpsAndAngles")(T,i,u),v?v+l:(l&&(u.gTitles[g]=l.replace(/"|'/g,""")),i.parseImgDimensions&&k&&w&&(u.gDimensions[g]={width:k,height:w}),"")};return n=n.replace(p,m),n=n.replace(d,m),n=n.replace(/¨0/,""),n}),r.subParser("tables",function(n,i,u){"use strict";if(!i.tables)return n;var d=/^ {0,3}\|?.+\|.+\n {0,3}\|?[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:[-=]){2,}[\s\S]+?(?:\n\n|¨0)/gm,p=/^ {0,3}\|.+\|[ \t]*\n {0,3}\|[ \t]*:?[ \t]*(?:[-=]){2,}[ \t]*:?[ \t]*\|[ \t]*\n( {0,3}\|.+\|[ \t]*\n)*(?:\n|¨0)/gm;function m(w){return/^:[ \t]*--*$/.test(w)?' style="text-align:left;"':/^--*[ \t]*:[ \t]*$/.test(w)?' style="text-align:right;"':/^:[ \t]*--*[ \t]*:$/.test(w)?' style="text-align:center;"':""}function f(w,v){var l="";return w=w.trim(),(i.tablesHeaderId||i.tableHeaderId)&&(l=' id="'+w.replace(/ /g,"_").toLowerCase()+'"'),w=r.subParser("spanGamut")(w,i,u),"<th"+l+v+">"+w+`</th>
|
||||
`}function g(w,v){var l=r.subParser("spanGamut")(w,i,u);return"<td"+v+">"+l+`</td>
|
||||
`}function T(w,v){for(var l=`<table>
|
||||
<thead>
|
||||
<tr>
|
||||
`,y=w.length,C=0;C<y;++C)l+=w[C];for(l+=`</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`,C=0;C<v.length;++C){l+=`<tr>
|
||||
`;for(var A=0;A<y;++A)l+=v[C][A];l+=`</tr>
|
||||
`}return l+=`</tbody>
|
||||
</table>
|
||||
`,l}function k(w){var v,l=w.split(`
|
||||
`);for(v=0;v<l.length;++v)/^ {0,3}\|/.test(l[v])&&(l[v]=l[v].replace(/^ {0,3}\|/,"")),/\|[ \t]*$/.test(l[v])&&(l[v]=l[v].replace(/\|[ \t]*$/,"")),l[v]=r.subParser("codeSpans")(l[v],i,u);var y=l[0].split("|").map(function(x){return x.trim()}),C=l[1].split("|").map(function(x){return x.trim()}),A=[],O=[],S=[],F=[];for(l.shift(),l.shift(),v=0;v<l.length;++v)l[v].trim()!==""&&A.push(l[v].split("|").map(function(x){return x.trim()}));if(y.length<C.length)return w;for(v=0;v<C.length;++v)S.push(m(C[v]));for(v=0;v<y.length;++v)r.helper.isUndefined(S[v])&&(S[v]=""),O.push(f(y[v],S[v]));for(v=0;v<A.length;++v){for(var K=[],ne=0;ne<O.length;++ne)r.helper.isUndefined(A[v][ne]),K.push(g(A[v][ne],S[ne]));F.push(K)}return T(O,F)}return n=u.converter._dispatch("tables.before",n,i,u),n=n.replace(/\\(\|)/g,r.helper.escapeCharactersCallback),n=n.replace(d,k),n=n.replace(p,k),n=u.converter._dispatch("tables.after",n,i,u),n}),r.subParser("underline",function(n,i,u){"use strict";return i.underline&&(n=u.converter._dispatch("underline.before",n,i,u),i.literalMidWordUnderscores?(n=n.replace(/\b___(\S[\s\S]*?)___\b/g,function(d,p){return"<u>"+p+"</u>"}),n=n.replace(/\b__(\S[\s\S]*?)__\b/g,function(d,p){return"<u>"+p+"</u>"})):(n=n.replace(/___(\S[\s\S]*?)___/g,function(d,p){return/\S$/.test(p)?"<u>"+p+"</u>":d}),n=n.replace(/__(\S[\s\S]*?)__/g,function(d,p){return/\S$/.test(p)?"<u>"+p+"</u>":d})),n=n.replace(/(_)/g,r.helper.escapeCharactersCallback),n=u.converter._dispatch("underline.after",n,i,u)),n}),r.subParser("unescapeSpecialChars",function(n,i,u){"use strict";return n=u.converter._dispatch("unescapeSpecialChars.before",n,i,u),n=n.replace(/¨E(\d+)E/g,function(d,p){var m=parseInt(p);return String.fromCharCode(m)}),n=u.converter._dispatch("unescapeSpecialChars.after",n,i,u),n}),r.subParser("makeMarkdown.blockquote",function(n,i){"use strict";var u="";if(n.hasChildNodes())for(var d=n.childNodes,p=d.length,m=0;m<p;++m){var f=r.subParser("makeMarkdown.node")(d[m],i);f!==""&&(u+=f)}return u=u.trim(),u="> "+u.split(`
|
||||
`).join(`
|
||||
> `),u}),r.subParser("makeMarkdown.codeBlock",function(n,i){"use strict";var u=n.getAttribute("language"),d=n.getAttribute("precodenum");return"```"+u+`
|
||||
`+i.preList[d]+"\n```"}),r.subParser("makeMarkdown.codeSpan",function(n){"use strict";return"`"+n.innerHTML+"`"}),r.subParser("makeMarkdown.emphasis",function(n,i){"use strict";var u="";if(n.hasChildNodes()){u+="*";for(var d=n.childNodes,p=d.length,m=0;m<p;++m)u+=r.subParser("makeMarkdown.node")(d[m],i);u+="*"}return u}),r.subParser("makeMarkdown.header",function(n,i,u){"use strict";var d=new Array(u+1).join("#"),p="";if(n.hasChildNodes()){p=d+" ";for(var m=n.childNodes,f=m.length,g=0;g<f;++g)p+=r.subParser("makeMarkdown.node")(m[g],i)}return p}),r.subParser("makeMarkdown.hr",function(){"use strict";return"---"}),r.subParser("makeMarkdown.image",function(n){"use strict";var i="";return n.hasAttribute("src")&&(i+="+">",n.hasAttribute("width")&&n.hasAttribute("height")&&(i+=" ="+n.getAttribute("width")+"x"+n.getAttribute("height")),n.hasAttribute("title")&&(i+=' "'+n.getAttribute("title")+'"'),i+=")"),i}),r.subParser("makeMarkdown.links",function(n,i){"use strict";var u="";if(n.hasChildNodes()&&n.hasAttribute("href")){var d=n.childNodes,p=d.length;u="[";for(var m=0;m<p;++m)u+=r.subParser("makeMarkdown.node")(d[m],i);u+="](",u+="<"+n.getAttribute("href")+">",n.hasAttribute("title")&&(u+=' "'+n.getAttribute("title")+'"'),u+=")"}return u}),r.subParser("makeMarkdown.list",function(n,i,u){"use strict";var d="";if(!n.hasChildNodes())return"";for(var p=n.childNodes,m=p.length,f=n.getAttribute("start")||1,g=0;g<m;++g)if(!(typeof p[g].tagName>"u"||p[g].tagName.toLowerCase()!=="li")){var T="";u==="ol"?T=f.toString()+". ":T="- ",d+=T+r.subParser("makeMarkdown.listItem")(p[g],i),++f}return d+=`
|
||||
<!-- -->
|
||||
`,d.trim()}),r.subParser("makeMarkdown.listItem",function(n,i){"use strict";for(var u="",d=n.childNodes,p=d.length,m=0;m<p;++m)u+=r.subParser("makeMarkdown.node")(d[m],i);return/\n$/.test(u)?u=u.split(`
|
||||
`).join(`
|
||||
`).replace(/^ {4}$/gm,"").replace(/\n\n+/g,`
|
||||
|
||||
`):u+=`
|
||||
`,u}),r.subParser("makeMarkdown.node",function(n,i,u){"use strict";u=u||!1;var d="";if(n.nodeType===3)return r.subParser("makeMarkdown.txt")(n,i);if(n.nodeType===8)return"<!--"+n.data+`-->
|
||||
|
||||
`;if(n.nodeType!==1)return"";var p=n.tagName.toLowerCase();switch(p){case"h1":u||(d=r.subParser("makeMarkdown.header")(n,i,1)+`
|
||||
|
||||
`);break;case"h2":u||(d=r.subParser("makeMarkdown.header")(n,i,2)+`
|
||||
|
||||
`);break;case"h3":u||(d=r.subParser("makeMarkdown.header")(n,i,3)+`
|
||||
|
||||
`);break;case"h4":u||(d=r.subParser("makeMarkdown.header")(n,i,4)+`
|
||||
|
||||
`);break;case"h5":u||(d=r.subParser("makeMarkdown.header")(n,i,5)+`
|
||||
|
||||
`);break;case"h6":u||(d=r.subParser("makeMarkdown.header")(n,i,6)+`
|
||||
|
||||
`);break;case"p":u||(d=r.subParser("makeMarkdown.paragraph")(n,i)+`
|
||||
|
||||
`);break;case"blockquote":u||(d=r.subParser("makeMarkdown.blockquote")(n,i)+`
|
||||
|
||||
`);break;case"hr":u||(d=r.subParser("makeMarkdown.hr")(n,i)+`
|
||||
|
||||
`);break;case"ol":u||(d=r.subParser("makeMarkdown.list")(n,i,"ol")+`
|
||||
|
||||
`);break;case"ul":u||(d=r.subParser("makeMarkdown.list")(n,i,"ul")+`
|
||||
|
||||
`);break;case"precode":u||(d=r.subParser("makeMarkdown.codeBlock")(n,i)+`
|
||||
|
||||
`);break;case"pre":u||(d=r.subParser("makeMarkdown.pre")(n,i)+`
|
||||
|
||||
`);break;case"table":u||(d=r.subParser("makeMarkdown.table")(n,i)+`
|
||||
|
||||
`);break;case"code":d=r.subParser("makeMarkdown.codeSpan")(n,i);break;case"em":case"i":d=r.subParser("makeMarkdown.emphasis")(n,i);break;case"strong":case"b":d=r.subParser("makeMarkdown.strong")(n,i);break;case"del":d=r.subParser("makeMarkdown.strikethrough")(n,i);break;case"a":d=r.subParser("makeMarkdown.links")(n,i);break;case"img":d=r.subParser("makeMarkdown.image")(n,i);break;default:d=n.outerHTML+`
|
||||
|
||||
`}return d}),r.subParser("makeMarkdown.paragraph",function(n,i){"use strict";var u="";if(n.hasChildNodes())for(var d=n.childNodes,p=d.length,m=0;m<p;++m)u+=r.subParser("makeMarkdown.node")(d[m],i);return u=u.trim(),u}),r.subParser("makeMarkdown.pre",function(n,i){"use strict";var u=n.getAttribute("prenum");return"<pre>"+i.preList[u]+"</pre>"}),r.subParser("makeMarkdown.strikethrough",function(n,i){"use strict";var u="";if(n.hasChildNodes()){u+="~~";for(var d=n.childNodes,p=d.length,m=0;m<p;++m)u+=r.subParser("makeMarkdown.node")(d[m],i);u+="~~"}return u}),r.subParser("makeMarkdown.strong",function(n,i){"use strict";var u="";if(n.hasChildNodes()){u+="**";for(var d=n.childNodes,p=d.length,m=0;m<p;++m)u+=r.subParser("makeMarkdown.node")(d[m],i);u+="**"}return u}),r.subParser("makeMarkdown.table",function(n,i){"use strict";var u="",d=[[],[]],p=n.querySelectorAll("thead>tr>th"),m=n.querySelectorAll("tbody>tr"),f,g;for(f=0;f<p.length;++f){var T=r.subParser("makeMarkdown.tableCell")(p[f],i),k="---";if(p[f].hasAttribute("style")){var w=p[f].getAttribute("style").toLowerCase().replace(/\s/g,"");switch(w){case"text-align:left;":k=":---";break;case"text-align:right;":k="---:";break;case"text-align:center;":k=":---:";break}}d[0][f]=T.trim(),d[1][f]=k}for(f=0;f<m.length;++f){var v=d.push([])-1,l=m[f].getElementsByTagName("td");for(g=0;g<p.length;++g){var y=" ";typeof l[g]<"u"&&(y=r.subParser("makeMarkdown.tableCell")(l[g],i)),d[v].push(y)}}var C=3;for(f=0;f<d.length;++f)for(g=0;g<d[f].length;++g){var A=d[f][g].length;A>C&&(C=A)}for(f=0;f<d.length;++f){for(g=0;g<d[f].length;++g)f===1?d[f][g].slice(-1)===":"?d[f][g]=r.helper.padEnd(d[f][g].slice(-1),C-1,"-")+":":d[f][g]=r.helper.padEnd(d[f][g],C,"-"):d[f][g]=r.helper.padEnd(d[f][g],C);u+="| "+d[f].join(" | ")+` |
|
||||
`}return u.trim()}),r.subParser("makeMarkdown.tableCell",function(n,i){"use strict";var u="";if(!n.hasChildNodes())return"";for(var d=n.childNodes,p=d.length,m=0;m<p;++m)u+=r.subParser("makeMarkdown.node")(d[m],i,!0);return u.trim()}),r.subParser("makeMarkdown.txt",function(n){"use strict";var i=n.nodeValue;return i=i.replace(/ +/g," "),i=i.replace(/¨NBSP;/g," "),i=r.helper.unescapeHTMLEntities(i),i=i.replace(/([*_~|`])/g,"\\$1"),i=i.replace(/^(\s*)>/g,"\\$1>"),i=i.replace(/^#/gm,"\\#"),i=i.replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3"),i=i.replace(/^( {0,3}\d+)\./gm,"$1\\."),i=i.replace(/^( {0,3})([+-])/gm,"$1\\$2"),i=i.replace(/]([\s]*)\(/g,"\\]$1\\("),i=i.replace(/^ {0,3}\[([\S \t]*?)]:/gm,"\\[$1]:"),i});var ju=this;typeof define=="function"&&define.amd?define(function(){"use strict";return r}):typeof Qr<"u"&&Qr.exports?Qr.exports=r:ju.showdown=r}).call(hu)});var Rd={};Ie(Rd,{__EXPERIMENTAL_ELEMENTS:()=>Vn,__EXPERIMENTAL_PATHS_WITH_OVERRIDE:()=>xn,__EXPERIMENTAL_STYLE_PROPERTY:()=>pe,__experimentalCloneSanitizedBlock:()=>Vt,__experimentalGetAccessibleBlockLabel:()=>_a,__experimentalGetBlockAttributesNamesByRole:()=>ya,__experimentalGetBlockLabel:()=>yt,__experimentalSanitizeBlockAttributes:()=>Ge,__unstableGetBlockProps:()=>Gt,__unstableGetInnerBlocksProps:()=>go,__unstableSerializeAndClean:()=>bo,children:()=>Mo,cloneBlock:()=>xt,createBlock:()=>U,createBlocksFromInnerBlocksTemplate:()=>It,doBlocksMatchTemplate:()=>fn,findTransform:()=>he,getBlockAttributes:()=>ie,getBlockAttributesNamesByRole:()=>vt,getBlockBindingsSource:()=>gt,getBlockBindingsSources:()=>ha,getBlockContent:()=>Xe,getBlockDefaultClassName:()=>po,getBlockFromExample:()=>Ht,getBlockMenuDefaultClassName:()=>mo,getBlockSupport:()=>ta,getBlockTransforms:()=>ue,getBlockType:()=>M,getBlockTypes:()=>Ue,getBlockVariations:()=>ca,getCategories:()=>Nu,getChildBlockNames:()=>oa,getDefaultBlockName:()=>pr,getFreeformContentHandlerName:()=>ee,getGroupingBlockName:()=>fr,getPhrasingContentSchema:()=>Su,getPossibleBlockTransformations:()=>Ja,getSaveContent:()=>ge,getSaveElement:()=>Kt,getUnregisteredTypeHandlerName:()=>me,hasBlockSupport:()=>se,hasChildBlocks:()=>ua,hasChildBlocksWithInserterSupport:()=>ia,isReusableBlock:()=>na,isTemplatePart:()=>aa,isUnmodifiedBlock:()=>_t,isUnmodifiedDefaultBlock:()=>hr,isValidBlockContent:()=>Ro,isValidIcon:()=>$e,node:()=>jo,normalizeIconObject:()=>gr,parse:()=>Ee,parseWithAttributeSchema:()=>Le,pasteHandler:()=>et,privateApis:()=>Du,rawHandler:()=>ln,registerBlockBindingsSource:()=>pa,registerBlockCollection:()=>Xn,registerBlockStyle:()=>sa,registerBlockType:()=>Yn,registerBlockVariation:()=>la,serialize:()=>Mr,serializeRawBlock:()=>we,setCategories:()=>Lu,setDefaultBlockName:()=>ea,setFreeformContentHandlerName:()=>Qn,setGroupingBlockName:()=>ra,setUnregisteredTypeHandlerName:()=>Jn,store:()=>P,switchToBlockType:()=>eo,synchronizeBlocksWithTemplate:()=>rt,unregisterBlockBindingsSource:()=>ma,unregisterBlockStyle:()=>da,unregisterBlockType:()=>Zn,unregisterBlockVariation:()=>fa,unstable__bootstrapServerSideBlockDefinitions:()=>Wn,updateCategory:()=>Pu,validateBlock:()=>be,withBlockContentContext:()=>Pd});var Rr=B(Be(),1);var Oe=function(){return Oe=Object.assign||function(t){for(var r,a=1,o=arguments.length;a<o;a++){r=arguments[a];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])}return t},Oe.apply(this,arguments)};function bn(e){return e.toLowerCase()}var Uu=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Fu=/[^A-Z0-9]+/gi;function yn(e,t){t===void 0&&(t={});for(var r=t.splitRegexp,a=r===void 0?Uu:r,o=t.stripRegexp,s=o===void 0?Fu:o,c=t.transform,h=c===void 0?bn:c,_=t.delimiter,b=_===void 0?" ":_,E=_n(_n(e,a,"$1\0$2"),s,"\0"),L=0,N=E.length;E.charAt(L)==="\0";)L++;for(;E.charAt(N-1)==="\0";)N--;return E.slice(L,N).split("\0").map(h).join(b)}function _n(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce(function(a,o){return a.replace(o,r)},e)}function ot(e,t){var r=e.charAt(0),a=e.substr(1).toLowerCase();return t>0&&r>="0"&&r<="9"?"_"+r+a:""+r.toUpperCase()+a}function wn(e,t){return t===void 0&&(t={}),yn(e,Oe({delimiter:"",transform:ot},t))}function $u(e,t){return t===0?e.toLowerCase():ot(e,t)}function kn(e,t){return t===void 0&&(t={}),wn(e,Oe({transform:$u},t))}var ka=B(Be(),1),ye=B(sr(),1);var Gu={grad:.9,turn:360,rad:360/(2*Math.PI)},fe=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},V=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=Math.pow(10,t)),Math.round(r*e)/r+0},Q=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=1),e>r?r:e>t?e:t},Ln=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},En=function(e){return{r:Q(e.r,0,255),g:Q(e.g,0,255),b:Q(e.b,0,255),a:Q(e.a)}},ut=function(e){return{r:V(e.r),g:V(e.g),b:V(e.b),a:V(e.a,3)}},Ku=/^#([0-9a-f]{3,8})$/i,dr=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Pn=function(e){var t=e.r,r=e.g,a=e.b,o=e.a,s=Math.max(t,r,a),c=s-Math.min(t,r,a),h=c?s===t?(r-a)/c:s===r?2+(a-t)/c:4+(t-r)/c:0;return{hLine truncated
|
||||
`).replace(/\n+/g,`
|
||||
`).trim();return r?Ft(a,o,_):_}var fo=B(io(),1);function po(e){let t="wp-block-"+e.replace(/\//,"-").replace(/^core-/,"");return(0,ke.applyFilters)("blocks.getBlockDefaultClassName",t,e)}function mo(e){let t="editor-block-list-item-"+e.replace(/\//,"-").replace(/^core-/,"");return(0,ke.applyFilters)("blocks.getBlockMenuDefaultClassName",t,e)}var $t={},ho={};function Gt(e={}){let{blockType:t,attributes:r}=$t;return Gt.skipFilters?e:(0,ke.applyFilters)("blocks.getSaveContent.extraProps",{...e},t,r)}function go(e={}){let{innerBlocks:t}=ho;if(!Array.isArray(t))return{...e,children:t};let r=Mr(t,{isInnerBlocks:!0});return{...e,children:(0,fo.jsx)(ve.RawHTML,{children:r})}}function Kt(e,t,r=[]){let a=de(e);if(!a?.save)return null;let{save:o}=a;if(o.prototype instanceof ve.Component){let c=new o({attributes:t});o=c.render.bind(c)}$t.blockType=a,$t.attributes=t,ho.innerBlocks=r;let s=o({attributes:t,innerBlocks:r});if(s!==null&&typeof s=="object"&&(0,ke.hasFilter)("blocks.getSaveContent.extraProps")&&!(a.apiVersion>1)){let c=(0,ke.applyFilters)("blocks.getSaveContent.extraProps",{...s.props},a,t);(0,so.isShallowEqual)(c,s.props)||(s=(0,ve.cloneElement)(s,c))}return(0,ke.applyFilters)("blocks.getSaveElement",s,a,t)}function ge(e,t,r){let a=de(e);return(0,ve.renderToString)(Kt(a,t,r))}function fs(e,t){return Object.entries(e.attributes??{}).reduce((r,[a,o])=>{let s=t[a];return s===void 0||o.source!==void 0||o.role==="local"?r:o.__experimentalRole==="local"?((0,lo.default)("__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(s)||(r[a]=s),r)},{})}function ps(e){return JSON.stringify(e).replaceAll("\\\\","\\u005c").replaceAll("--","\\u002d\\u002d").replaceAll("<","\\u003c").replaceAll(">","\\u003e").replaceAll("&","\\u0026").replaceAll('\\"',"\\u0022")}function Xe(e){let t=e.originalContent;if(e.isValid||e.innerBlocks.length)try{t=ge(e.name,e.attributes,e.innerBlocks)}catch{}return t}function Ft(e,t,r){let a=t&&Object.entries(t).length?ps(t)+" ":"",o=e?.startsWith("core/")?e.slice(5):e;return r?`<!-- wp:${o} ${a}-->
|
||||
`+r+`
|
||||
<!-- /wp:${o} -->`:`<!-- wp:${o} ${a}/-->`}function ms(e,{isInnerBlocks:t=!1}={}){if(!e.isValid&&e.__unstableBlockSource)return we(e.__unstableBlockSource);let r=e.name,a=Xe(e);if(r===me()||!t&&r===ee())return a;let o=M(r);if(!o)return a;let s=fs(o,e.attributes);return Ft(r,s,a)}var bo=(()=>{let e=new WeakMap;return t=>{let r=e.get(t);if(r!==void 0)return r;let a=t;a.length===1&&hr(a[0])&&(a=[]);let o=Mr(a);return a.length===1&&a[0].name===ee()&&a[0].name==="core/freeform"&&(o=(0,co.removep)(o)),e.set(t,o),o}})();function Mr(e,t){return(Array.isArray(e)?e:[e]).map(a=>ms(a,t)).join(`
|
||||
|
||||
`)}var hs=/^#[xX]([A-Fa-f0-9]+)$/,gs=/^#([0-9]+)$/,bs=/^([A-Za-z0-9]+)$/,dl=(function(){function e(t){this.named=t}return e.prototype.parse=function(t){if(t){var r=t.match(hs);if(r)return String.fromCharCode(parseInt(r[1],16));if(r=t.match(gs),r)return String.fromCharCode(parseInt(r[1],10));if(r=t.match(bs),r)return this.named[r[1]]}},e})(),_s=/[\t\n\f ]/,ys=/[A-Za-z]/,ws=/\r\n?/g;function Se(e){return _s.test(e)}function _o(e){return ys.test(e)}function ks(e){return e.replace(ws,`
|
||||
`)}var vs=(function(){function e(t,r){this.delegate=t,this.entityParser=r,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var a=this.peek();if(a==="<")this.transitionTo("tagOpen"),this.markTagStart(),this.consume();else{if(a===`
|
||||
`){var o=this.tagNameBuffer.toLowerCase();(o==="pre"||o==="textarea")&&this.consume()}this.transitionTo("data"),this.delegate.beginData()}},data:function(){var a=this.peek();a==="<"?(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume()):a==="&"?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(a))},tagOpen:function(){var a=this.consume();a==="!"?this.transitionTo("markupDeclarationOpen"):a==="/"?this.transitionTo("endTagOpen"):(a==="@"||a===":"||_o(a))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(a))},markupDeclarationOpen:function(){var a=this.consume();a==="-"&&this.input.charAt(this.index)==="-"&&(this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment())},commentStart:function(){var a=this.consume();a==="-"?this.transitionTo("commentStartDash"):a===">"?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData(a),this.transitionTo("comment"))},commentStartDash:function(){var a=this.consume();a==="-"?this.transitionTo("commentEnd"):a===">"?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("-"),this.transitionTo("comment"))},comment:function(){var a=this.consume();a==="-"?this.transitionTo("commentEndDash"):this.delegate.appendToCommentData(a)},commentEndDash:function(){var a=this.consume();a==="-"?this.transitionTo("commentEnd"):(this.delegate.appendToCommentData("-"+a),this.transitionTo("comment"))},commentEnd:function(){var a=this.consume();a===">"?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("--"+a),this.transitionTo("comment"))},tagName:function(){var a=this.consume();Se(a)?this.transitionTo("beforeAttributeName"):a==="/"?this.transitionTo("selfClosingStartTag"):a===">"?(this.delegate.finishTag(),this.transitionTo("beforeData")):this.appendToTagName(a)},beforeAttributeName:function(){var a=this.peek();if(Se(a)){this.consume();return}else a==="/"?(this.transitionTo("selfClosingStartTag"),this.consume()):a===">"?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):a==="="?(this.delegate.reportSyntaxError("attribute name cannot start with equals sign"),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(a)):(this.transitionTo("attributeName"),this.delegate.beginAttribute())},attributeName:function(){var a=this.peek();Se(a)?(this.transitionTo("afterAttributeName"),this.consume()):a==="/"?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):a==="="?(this.transitionTo("beforeAttributeValue"),this.consume()):a===">"?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):a==='"'||a==="'"||a==="<"?(this.delegate.reportSyntaxError(a+" is not a valid character within attribute names"),this.consume(),this.delegate.appendToAttributeName(a)):(this.consume(),this.delegate.appendToAttributeName(a))},afterAttributeName:function(){var a=this.peek();if(Se(a)){this.consume();return}else a==="/"?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):a==="="?(this.consume(),this.transitionTo("beforeAttributeValue")):a===">"?(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(a))},beforeAttributeValue:function(){var a=this.peek();Se(a)?this.consume():a==='"'?(this.transitionTo("attributeValueDoubleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):a==="'"?(this.transitionTo("attributeValueSingleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):a===">"?(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(a))},attributeValueDoubleQuoted:function(){var a=this.consume();a==='"'?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):a==="&"?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(a)},attributeValueSingleQuoted:function(){var a=this.consume();a==="'"?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):a==="&"?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(a)},
Line truncated
|
||||
`?(this.line++,this.column=0):this.column++,t},e.prototype.consumeCharRef=function(){var t=this.input.indexOf(";",this.index);if(t!==-1){var r=this.input.slice(this.index,t),a=this.entityParser.parse(r);if(a){for(var o=r.length;o;)this.consume(),o--;return this.consume(),a}}},e.prototype.markTagStart=function(){this.delegate.tagOpen()},e.prototype.appendToTagName=function(t){this.tagNameBuffer+=t,this.delegate.appendToTagName(t)},e})(),yo=(function(){function e(t,r){r===void 0&&(r={}),this.options=r,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new vs(this,t),this._currentAttribute=void 0}return e.prototype.tokenize=function(t){return this.tokens=[],this.tokenizer.tokenize(t),this.tokens},e.prototype.tokenizePart=function(t){return this.tokens=[],this.tokenizer.tokenizePart(t),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 t=this.token;if(t===null)throw new Error("token was unexpectedly null");if(arguments.length===0)return t;for(var r=0;r<arguments.length;r++)if(t.type===arguments[r])return t;throw new Error("token type was unexpectedly "+t.type)},e.prototype.push=function(t){this.token=t,this.tokens.push(t)},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.beginData=function(){this.push({type:"Chars",chars:""})},e.prototype.appendToData=function(t){this.current("Chars").chars+=t},e.prototype.finishData=function(){this.addLocInfo()},e.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},e.prototype.appendToCommentData=function(t){this.current("Comment").chars+=t},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(t){this.current("StartTag","EndTag").tagName+=t},e.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},e.prototype.appendToAttributeName=function(t){this.currentAttribute()[0]+=t},e.prototype.beginAttributeValue=function(t){this.currentAttribute()[2]=t},e.prototype.appendToAttributeValue=function(t){this.currentAttribute()[1]+=t},e.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},e.prototype.reportSyntaxError=function(t){this.current().syntaxError=t},e})();var So=B(ko(),1),No=B(J(),1),Lo=B(Eo(),1);function Ne(){function e(t){return(r,...a)=>t("Block validation: "+r,...a)}return{error:e(console.error),warning:e(console.warn),getItems(){return[]}}}function To(){let e=[],t=Ne();return{error(...r){e.push({log:t.error,args:r})},warning(...r){e.push({log:t.warning,args:r})},getItems(){return e}}}var Es=e=>e,Ts=/[\t\n\r\v\f ]+/g,Cs=/^[\t\n\r\v\f ]*$/,Bs=/^url\s*\(['"\s]*(.*?)['"\s]*\)$/,Po=["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"],As=["autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"],Ss=[...Po,...As],Co=[Es,Ds],Ns=/^[\da-z]+$/i,Ls=/^#\d+$/,Ps=/^#x[\da-f]+$/i;function Rs(e){return Ns.test(e)||Ls.test(e)||Ps.test(e)}var Os=class{parse(e){if(Rs(e))return(0,Lo.decodeEntities)("&"+e+";")}};function Wt(e){return e.trim().split(Ts)}function Ds(e){return Wt(e).join(" ")}function Ms(e){return e.attributes.filter(t=>{let[r,a]=t;return a||r.indexOf("data-")===0||Ss.includes(r)})}function Bo(e,t,r=Ne()){let a=e.chars,o=t.chars;for(let s=0;s<Co.length;s++){let c=Co[s];if(a=c(a),o=c(o),a===o)return!0}return r.warning("Expected text `%s`, saw `%s`.",t.chars,e.chars),!1}function js(e){return parseFloat(e)===0?"0":e.indexOf(".")===0?"0"+e:e}function zs(e){return Wt(e).map(js).join(" ").replace(Bs,"url($1)")}function qs(e){let t=e.replace(/;?\s*$/,"").split(";").map(r=>{let[a,...o]=r.split(":"),s=o.join(":");return[a.trim(),zs(s.trim())]});return Object.fromEntries(t)}var Is={class:(e,t)=>{let[r,a]=[e,t].map(Wt),o=r.filter(c=>!a.includes(c)),s=a.filter(c=>!r.i
Line truncated
|
||||
|
||||
%s`,h.toString()),[!1,a.getItems()]}let c=Us(e.originalContent,s,a);return c||a.error(`Block validation failed for \`%s\` (%o).
|
||||
|
||||
Content generated by \`save\` function:
|
||||
|
||||
%s
|
||||
|
||||
Content retrieved from post body:
|
||||
|
||||
%s`,o.name,o,s,e.originalContent),[c,a.getItems()]}function Ro(e,t,r){(0,No.default)("isValidBlockContent introduces opportunity for data loss",{since:"12.6",plugin:"Gutenberg",alternative:"validateBlock"});let a=de(e),o={name:a.name,attributes:t,innerBlocks:[],originalContent:r},[s]=be(o,a);return s}function jr(e,t){let r={...t};if(e==="core/cover-image"&&(e="core/cover"),(e==="core/text"||e==="core/cover-text")&&(e="core/paragraph"),e&&e.indexOf("core/social-link-")===0&&(r.service=e.substring(17),e="core/social-link"),e&&e.indexOf("core-embed/")===0){let a=e.substring(11),o={speaker:"speaker-deck",polldaddy:"crowdsignal"};r.providerNameSlug=a in o?o[a]:a,["amazon-kindle","wordpress"].includes(a)||(r.responsive=!0),e="core/embed"}if(e==="core/post-comment-author"&&(e="core/comment-author-name"),e==="core/post-comment-content"&&(e="core/comment-content"),e==="core/post-comment-date"&&(e="core/comment-date"),e==="core/comments-query-loop"){e="core/comments";let{className:a=""}=r;a.includes("wp-block-comments-query-loop")||(r.className=["wp-block-comments-query-loop",a].join(" "))}if(e==="core/post-comments"&&(e="core/comments",r.legacy=!0),t.layout?.type==="grid"&&typeof t.layout?.columnCount=="string"&&(r.layout={...r.layout,columnCount:parseInt(t.layout.columnCount,10)}),typeof t.style?.layout?.columnSpan=="string"){let a=parseInt(t.style.layout.columnSpan,10);r.style={...r.style,layout:{...r.style.layout,columnSpan:isNaN(a)?void 0:a}}}if(typeof t.style?.layout?.rowSpan=="string"){let a=parseInt(t.style.layout.rowSpan,10);r.style={...r.style,layout:{...r.style.layout,rowSpan:isNaN(a)?void 0:a}}}return[e,r]}function Yt(e,t){for(var r=t.split("."),a;a=r.shift();){if(!(a in e))return;e=e[a]}return e}var Fs=(function(){var e;return function(){return e||(e=document.implementation.createHTMLDocument("")),e}})();function zr(e,t){if(t){if(typeof e=="string"){var r=Fs();r.body.innerHTML=e,e=r.body}if(typeof t=="function")return t(e);if(Object===t.constructor)return Object.keys(t).reduce(function(a,o){return a[o]=zr(e,t[o]),a},{})}}function Qe(e,t){return arguments.length===1&&(t=e,e=void 0),function(r){var a=r;if(e&&(a=r.querySelector(e)),a)return Yt(a,t)}}function Xt(e,t){return arguments.length===1&&(t=e,e=void 0),function(r){var a=Qe(e,"attributes")(r);if(a&&a.hasOwnProperty(t))return a[t].value}}function Zt(e){return Qe(e,"textContent")}function Qt(e,t){return function(r){var a=r.querySelectorAll(e);return[].map.call(a,function(o){return zr(o,t)})}}function Oo(e,t){var r=0,a,o;t=t||{};function s(){var c=a,h=arguments.length,_,b;e:for(;c;){if(c.args.length!==arguments.length){c=c.next;continue}for(b=0;b<h;b++)if(c.args[b]!==arguments[b]){c=c.next;continue e}return c!==a&&(c===o&&(o=c.prev),c.prev.next=c.next,c.next&&(c.next.prev=c.prev),c.next=a,c.prev=null,a.prev=c,a=c),c.val}for(_=new Array(h),b=0;b<h;b++)_[b]=arguments[b];return c={args:_,val:e.apply(null,_)},a?(a.prev=c,c.next=a):o=c,r===t.maxSize?(o=o.prev,o.next=null):r++,a=c,c.val}return s.clear=function(){a=null,o=null,r=0},s}var Io=B(We(),1),Vo=B(xe(),1);var en=B(xe(),1);var Je=B(J(),1);var Do=B(De(),1),ze=B(J(),1);function $s(e){return(0,ze.default)("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}function Gs(...e){(0,ze.default)("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/"});let t=[];for(let r=0;r<e.length;r++){let a=Array.isArray(e[r])?e[r]:[e[r]];for(let o=0;o<a.length;o++){let s=a[o];typeof s=="string"&&typeof t[t.length-1]=="string"?t[t.length-1]+=s:t.push(s)}}return t}function qr(e){(0,ze.default)("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/"});let t=[];for(let r=0;r<e.length;r++)try{t.push(Vr(e[r]))}catch{}return t}function Jt(e){(0,ze.default)("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/"});let t=e;return(0,Do.renderToString)(t)}function Ir(e){return(0,ze.default)("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?qr(r.childNodes):[]}}var Mo={concat:Gs,getChildrenArray:$s,fromDOM:qr,toHTML:Jt,matcher:Ir};function Ys(e,t){return(0,Je.default)("wp.blocks.node.isNodeOfType",{since:"6.1",version:"6.3",link:"https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-a
Line truncated
|
||||
|
||||
New content generated by \`save\` function:
|
||||
|
||||
%s
|
||||
|
||||
Content retrieved from post body:
|
||||
|
||||
%s`,a.name,a,ge(a,b.attributes),b.originalContent),console.groupEnd()):!h.isValid&&!b.isValid&&_.forEach(({log:E,args:L})=>E(...L)),b}function Ee(e,t){return(0,Go.parse)(e).reduce((r,a)=>{let o=Hr(a,t);return o&&r.push(o),r},[])}var Bu=B(J(),1),Au=B(Z(),1);var Wo=B(De(),1);function Ur(){return ue("from").filter(({type:e})=>e==="raw").map(e=>e.isMatch?e:{...e,isMatch:t=>e.selector&&t.matches(e.selector)})}function Fr(e,t){let r=document.implementation.createHTMLDocument("");return r.body.innerHTML=e,Array.from(r.body.children).flatMap(a=>{let o=he(Ur(),({isMatch:h})=>h(a));if(!o)return Wo.Platform.isNative?Ee(`<!-- wp:html -->${a.outerHTML}<!-- /wp:html -->`):U("core/html",ie("core/html",a.outerHTML));let{transform:s,blockName:c}=o;if(s){let h=s(a,t);return a.hasAttribute("class")&&(h.attributes.className=a.getAttribute("class")),h}return U(c,ie(c,a.outerHTML))})}var er=B(Z(),1);function Te(e,t={}){let r=document.implementation.createHTMLDocument(""),a=document.implementation.createHTMLDocument(""),o=r.body,s=a.body;for(o.innerHTML=e;o.firstChild;){let c=o.firstChild;c.nodeType===c.TEXT_NODE?(0,er.isEmpty)(c)?o.removeChild(c):((!s.lastChild||s.lastChild.nodeName!=="P")&&s.appendChild(a.createElement("P")),s.lastChild.appendChild(c)):c.nodeType===c.ELEMENT_NODE?c.nodeName==="BR"?(c.nextSibling&&c.nextSibling.nodeName==="BR"&&(s.appendChild(a.createElement("P")),o.removeChild(c.nextSibling)),s.lastChild&&s.lastChild.nodeName==="P"&&s.lastChild.hasChildNodes()?s.lastChild.appendChild(c):o.removeChild(c)):c.nodeName==="P"?(0,er.isEmpty)(c)&&!t.raw?o.removeChild(c):s.appendChild(c):(0,er.isPhrasingContent)(c)?((!s.lastChild||s.lastChild.nodeName!=="P")&&s.appendChild(a.createElement("P")),s.lastChild.appendChild(c)):s.appendChild(c):o.removeChild(c)}return s.innerHTML}var rr=B(Z(),1);function $r(e,t){if(e.nodeType!==e.COMMENT_NODE||e.nodeValue!=="nextpage"&&e.nodeValue.indexOf("more")!==0)return;let r=pd(e,t);if(!e.parentNode||e.parentNode.nodeName!=="P")(0,rr.replace)(e,r);else{let a=Array.from(e.parentNode.childNodes),o=a.indexOf(e),s=e.parentNode.parentNode||t.body,c=(h,_)=>(h||(h=t.createElement("p")),h.appendChild(_),h);[a.slice(0,o).reduce(c,null),r,a.slice(o+1).reduce(c,null)].forEach(h=>h&&s.insertBefore(h,e.parentNode)),(0,rr.remove)(e.parentNode)}}function pd(e,t){if(e.nodeValue==="nextpage")return hd(t);let r=e.nodeValue.slice(4).trim(),a=e,o=!1;for(;a=a.nextSibling;)if(a.nodeType===a.COMMENT_NODE&&a.nodeValue==="noteaser"){o=!0,(0,rr.remove)(a);break}return md(r,o,t)}function md(e,t,r){let a=r.createElement("wp-block");return a.dataset.block="core/more",e&&(a.dataset.customText=e),t&&(a.dataset.noTeaser=""),a}function hd(e){let t=e.createElement("wp-block");return t.dataset.block="core/nextpage",t}var Xo=B(Z(),1);function Yo(e){return e.nodeName==="OL"||e.nodeName==="UL"}function gd(e){return Array.from(e.childNodes).map(({nodeValue:t=""})=>t).join("")}function Gr(e){if(!Yo(e))return;let t=e,r=e.previousElementSibling;if(r&&r.nodeName===e.nodeName&&t.children.length===1){for(;t.firstChild;)r.appendChild(t.firstChild);t.parentNode.removeChild(t)}let a=e.parentNode;if(a&&a.nodeName==="LI"&&a.children.length===1&&!/\S/.test(gd(a))){let o=a,s=o.previousElementSibling,c=o.parentNode;s&&(s.appendChild(t),c.removeChild(o))}if(a&&Yo(a)){let o=e.previousElementSibling;o?o.appendChild(e):(0,Xo.unwrap)(e)}}function Kr(e){return t=>{t.nodeName==="BLOCKQUOTE"&&(t.innerHTML=Te(t.innerHTML,e))}}var Zo=B(Z(),1);function bd(e,t){let r=e.nodeName.toLowerCase();return r==="figcaption"||(0,Zo.isTextContent)(e)?!1:r in(t?.figure?.children??{})}function _d(e,t){return e.nodeName.toLowerCase()in(t?.figure?.children?.a?.children??{})}function tn(e,t=e){let r=e.ownerDocument.createElement("figure");t.parentNode.insertBefore(r,t),r.appendChild(e)}function Wr(e,t,r){if(!bd(e,r))return;let a=e,o=e.parentNode;_d(e,r)&&o.nodeName==="A"&&o.childNodes.length===1&&(a=e.parentNode);let s=a.closest("p,div");s?e.classList?(e.classList.contains("alignright")||e.classList.contains("alignleft")||e.classList.contains("aligncenter")||!s.textContent.trim())&&tn(a,s):tn(a,s):tn(a)}var nr=B(Jo(),1);var eu=e=>Array.isArray(e)?e:[e],ru=/(\n|<p>)\s*$/,tu=/^\s*(\n|<\/p>)/;function tr(e,t=0,r=[]){let a=ue("from"),o=he(a,b=>r.indexOf(b.blockName)===-1&&b.type==="shortcode"&&eu(b.tag).some(E=>(0,nr.regexp)(E).test(e)));if(!o)return[e];let c=eu(o.tag).find(b=>(0,nr.regexp)(b).test(e)),h,_=t;if(h=(0,nr.next)(c,e,t)){t=h.index+h.content.length;let b=e.substr(0,h.index),E=e.substr(t);if(!h.shortcode.content?.includes("<")&&!(ru.test(b)&&tu.test(E)))return tr(e,t);if(o.isMatch&&!o.isMatch(h.shortcode.attrs))return tr(e,_,[...r,o.blockName]);let L=[];if(typeof o.transform=="function")L=[].concat(o.transform(h.shortcode.attrs,h)),L=L.map(N=>(N.originalContent=h.shortcode.content,Pe(N,M(N.name))));else{let N=Object.fromEntries(Object.entries(o.attributes).filter(([,Ce])=>Ce.shortcode).map(([Ce,ur])=>[Ce,ur.shortcode(h.shortcode.attrs,h)])),j=M(o.blockName);i
Line truncated
|
||||
${a}
|
||||
${o}`)}function Td(e){return e.replace(/(^|\n)•( +)/g,"$1*$2")}function _u(e){return vd.makeHtml(Ed(Td(e)))}function yu(e){if(e.nodeName==="IFRAME"){let t=e.ownerDocument.createTextNode(e.src);e.parentNode.replaceChild(t,e)}}var wu=B(Z(),1);function sn(e){!e.id||e.id.indexOf("docs-internal-guid-")!==0||(e.tagName==="B"?(0,wu.unwrap)(e):e.removeAttribute("id"))}function Cd(e){return e===" "||e==="\r"||e===`
|
||||
`||e===" "}function dn(e){if(e.nodeType!==e.TEXT_NODE)return;let t=e;for(;t=t.parentNode;)if(t.nodeType===t.ELEMENT_NODE&&t.nodeName==="PRE")return;let r=e.data.replace(/[ \r\n\t]+/g," ");if(r[0]===" "){let a=qe(e,"previous");(!a||a.nodeName==="BR"||a.textContent.slice(-1)===" ")&&(r=r.slice(1))}if(r[r.length-1]===" "){let a=qe(e,"next");(!a||a.nodeName==="BR"||a.nodeType===a.TEXT_NODE&&Cd(a.textContent[0]))&&(r=r.slice(0,-1))}r?e.data=r:e.parentNode.removeChild(e)}function cn(e){e.nodeName==="BR"&&(qe(e,"next")||e.parentNode.removeChild(e))}function ku(e){e.nodeName==="P"&&(e.hasChildNodes()||e.parentNode.removeChild(e))}function vu(e){if(e.nodeName!=="SPAN"||e.getAttribute("data-stringify-type")!=="paragraph-break")return;let{parentNode:t}=e;t.insertBefore(e.ownerDocument.createElement("br"),e),t.insertBefore(e.ownerDocument.createElement("br"),e),t.removeChild(e)}function Eu(e){let t=/[\p{L}\s]+/gu,r;for(;r=t.exec(e);){if(e[r.index-1]==="{")continue;let o=r[0];if(e[r.index-1]==="\\"&&(o=o.replace(/^[a-zA-Z]+/,"")),!(o.length<6))return!1}return!!(/\\[a-zA-Z]+\s*\{/g.test(e)||[o=>o.includes("^")&&!o.startsWith("^"),o=>["=","+","-","/","*"].some(s=>o.includes(s)),o=>/\\[a-zA-Z]+/g.test(o)].filter(o=>o(e)).length>=2)}function Tu(e){if(e.nodeType===e.ELEMENT_NODE&&e.tagName==="P"&&e.getAttribute("role")==="heading"&&e.hasAttribute("aria-level")){let t=parseInt(e.getAttribute("aria-level"),10);if(t>=1&&t<=6){let r=`H${t}`,a=e.ownerDocument.createElement(r);for(Array.from(e.attributes).forEach(o=>{o.name!=="role"&&o.name!=="aria-level"&&a.setAttribute(o.name,o.value)});e.firstChild;)a.appendChild(e.firstChild);e.parentNode.replaceChild(a,e)}}}var Jr=(...e)=>window?.console?.log?.(...e);function Cu(e){return e=le(e,[on,sn,Zr,an,nn]),e=(0,Re.removeInvalidHTML)(e,(0,Re.getPhrasingContentSchema)("paste"),{inline:!0}),e=le(e,[dn,cn]),Jr(`Processed inline HTML:
|
||||
|
||||
`,e),e}function et({HTML:e="",plainText:t="",mode:r="AUTO",tagName:a}){if(Jr(`Received HTML (pasteHandler):
|
||||
|
||||
`,e),Jr(`Received plain text (pasteHandler):
|
||||
|
||||
`,t),e=e.replace(/<meta[^>]+>/g,""),e=e.replace(/^\s*<html[^>]*>\s*<body[^>]*>(?:\s*<!--\s*StartFragment\s*-->)?/i,""),e=e.replace(/(?:<!--\s*EndFragment\s*-->\s*)?<\/body>\s*<\/html>\s*$/i,""),r!=="INLINE"){let E=e||t;if(E.indexOf("<!-- wp:")!==-1){let L=Ee(E);if(!(L.length===1&&L[0].name==="core/freeform"))return L}}String.prototype.normalize&&(e=e.normalize()),e=le(e,[vu]);let o=t&&(!e||nu(e));if(o&&Eu(t))return[U("core/math",{latex:t})];o&&(e=t,/^\s+$/.test(t)||(e=_u(e)));let s=Yr(e),c=s.length>1;if(o&&!c&&r==="AUTO"&&t.indexOf(`
|
||||
`)===-1&&t.indexOf("<p>")!==0&&e.indexOf("<p>")===0&&(r="INLINE"),r==="INLINE"||r==="AUTO"&&!c&&su(e,a))return Cu(e);let h=(0,Re.getPhrasingContentSchema)("paste"),_=Xr("paste"),b=s.map(E=>{if(typeof E!="string")return E;let L=[sn,du,on,Gr,pu,an,$r,nn,yu,Wr,Kr(),mu,Tu],N={..._,...h};return E=le(E,L,_),E=(0,Re.removeInvalidHTML)(E,N),E=Te(E),E=le(E,[dn,cn,ku],_),Jr(`Processed HTML piece:
|
||||
|
||||
`,E),Fr(E,et)}).flat().filter(Boolean);if(r==="AUTO"&&b.length===1&&se(b[0].name,"__unstablePasteTextInline",!1)){let E=/^[\n]+|[\n]+$/g,L=t.replace(E,"");if(L!==""&&L.indexOf(`
|
||||
`)===-1)return(0,Re.removeInvalidHTML)(Xe(b[0]),h).replace(E,"")}return b}function Su(e){return(0,Bu.default)("wp.blocks.getPhrasingContentSchema",{since:"5.6",alternative:"wp.dom.getPhrasingContentSchema"}),(0,Au.getPhrasingContentSchema)(e)}function ln({HTML:e=""}){if(e.indexOf("<!-- wp:")!==-1){let a=Ee(e);if(!(a.length===1&&a[0].name==="core/freeform"))return a}let t=Yr(e),r=Xr();return t.map(a=>{if(typeof a!="string")return a;let o=[Gr,$r,Wr,Kr({raw:!0})];return a=le(a,o,r),a=Te(a,{raw:!0}),Fr(a,ln)}).flat().filter(Boolean)}var or=B(Be(),1);function Nu(){return(0,or.select)(P).getCategories()}function Lu(e){(0,or.dispatch)(P).setCategories(e)}function Pu(e,t){(0,or.dispatch)(P).updateCategory(e,t)}var Ru=B(De(),1);function fn(e=[],t=[]){return e.length===t.length&&t.every(([r,,a],o)=>{let s=e[o];return r===s.name&&fn(s.innerBlocks,a)})}var Bd=e=>e?.source==="html",Ad=e=>e?.source==="query";function Ou(e,t){return t?Object.fromEntries(Object.entries(t).map(([r,a])=>[r,Sd(e[r],a)])):{}}function Sd(e,t){return Bd(e)&&Array.isArray(t)?(0,Ru.renderToString)(t):Ad(e)&&t?t.map(r=>Ou(e.query,r)):t}function rt(e=[],t){return t?t.map(([r,a,o],s)=>{let c=e[s];if(c&&c.name===r){let L=rt(c.innerBlocks,o);return{...c,innerBlocks:L}}let h=M(r),_=Ou(h?.attributes??{},a),[b,E]=jr(r,_);return U(b,E,rt([],o))}):e}var Nd=Symbol("fields"),Ld=Symbol("form"),Du={};Gn(Du,{isContentBlock:wa,fieldsKey:Nd,formKey:Ld,parseRawBlock:Hr});var Mu=B(J(),1);function Pd(e){return(0,Mu.default)("wp.blocks.withBlockContentContext",{since:"6.1"}),e}return Hu(Rd);})();
|
||||
/*! Bundled license information:
|
||||
|
||||
react-is/cjs/react-is.production.min.js:
|
||||
(**
|
||||
* @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.
|
||||
*)
|
||||
|
||||
showdown/dist/showdown.js:
|
||||
(*! showdown v 1.9.1 - 02-11-2019 *)
|
||||
|
||||
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.
|
||||
*)
|
||||
*/
|
||||
Vendored
+3958
File diff suppressed because it is too large.
Load diff
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
var wp;(wp||={}).commands=(()=>{var pn=Object.create;var ze=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var gn=Object.getPrototypeOf,yn=Object.prototype.hasOwnProperty;var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qe=(e,t)=>{for(var r in t)ze(e,r,{get:t[r],enumerable:!0})},Mr=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of hn(t))!yn.call(e,a)&&a!==r&&ze(e,a,{get:()=>t[a],enumerable:!(o=vn(t,a))||o.enumerable});return e};var m=(e,t,r)=>(r=e!=null?pn(gn(e)):{},Mr(t||!e||!e.__esModule?ze(r,"default",{value:e,enumerable:!0}):r,e)),Rn=e=>Mr(ze({},"__esModule",{value:!0}),e);var w=oe((fl,Vr)=>{Vr.exports=window.React});var B=oe((pl,Hr)=>{Hr.exports=window.ReactJSXRuntime});var pe=oe((Cl,Yr)=>{Yr.exports=window.ReactDOM});var ce=oe((Qf,$a)=>{$a.exports=window.wp.data});var Te=oe((ec,Ua)=>{Ua.exports=window.wp.element});var Ga=oe((tc,Ha)=>{Ha.exports=window.wp.i18n});var za=oe((rc,Ka)=>{Ka.exports=window.wp.components});var Ya=oe((oc,qa)=>{qa.exports=window.wp.keyboardShortcuts});var br=oe((nc,Xa)=>{Xa.exports=window.wp.primitives});var tn=oe((vc,en)=>{en.exports=window.wp.privateApis});var sl={};qe(sl,{CommandMenu:()=>sn,privateApis:()=>Dr,store:()=>K,useCommand:()=>un,useCommandLoader:()=>mn,useCommands:()=>fn});var Fr=1,bn=.9,wn=.8,En=.17,At=.1,It=.999,Cn=.9999,Sn=.99,xn=/[\\\/_+.#"@\[\(\{&]/,On=/[\\\/_+.#"@\[\(\{&]/g,_n=/[\s-]/,Wr=/[\s-]/g;function Lt(e,t,r,o,a,n,s){if(n===t.length)return a===e.length?Fr:Sn;var i=`${a},${n}`;if(s[i]!==void 0)return s[i];for(var u=o.charAt(n),l=r.indexOf(u,a),c=0,f,h,g,_;l>=0;)f=Lt(e,t,r,o,l+1,n+1,s),f>c&&(l===a?f*=Fr:xn.test(e.charAt(l-1))?(f*=wn,g=e.slice(a,l-1).match(On),g&&a>0&&(f*=Math.pow(It,g.length))):_n.test(e.charAt(l-1))?(f*=bn,_=e.slice(a,l-1).match(Wr),_&&a>0&&(f*=Math.pow(It,_.length))):(f*=En,a>0&&(f*=Math.pow(It,l-a))),e.charAt(l)!==t.charAt(n)&&(f*=Cn)),(f<At&&r.charAt(l-1)===o.charAt(n+1)||o.charAt(n+1)===o.charAt(n)&&r.charAt(l-1)!==o.charAt(n))&&(h=Lt(e,t,r,o,l+1,n+2,s),h*At>f&&(f=h*At)),f>c&&(c=f),l=r.indexOf(u,l+1);return s[i]=c,c}function jr(e){return e.toLowerCase().replace(Wr," ")}function Br(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,Lt(e,t,jr(e),jr(t),0,0,{})}var I=m(w(),1);var cl=!!(typeof window<"u"&&window.document&&window.document.createElement);function Se(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),r===!1||!a.defaultPrevented)return t?.(a)}}var Ur=m(w(),1);function $r(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Tt(...e){return t=>{let r=!1,o=e.map(a=>{let n=$r(a,t);return!r&&typeof n=="function"&&(r=!0),n});if(r)return()=>{for(let a=0;a<o.length;a++){let n=o[a];typeof n=="function"?n():$r(e[a],null)}}}}function Ye(...e){return Ur.useCallback(Tt(...e),e)}var J=m(w(),1),kt=m(B(),1);function Gr(e,t){let r=J.createContext(t),o=n=>{let{children:s,...i}=n,u=J.useMemo(()=>i,Object.values(i));return(0,kt.jsx)(r.Provider,{value:u,children:s})};o.displayName=e+"Provider";function a(n){let s=J.useContext(r);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${n}\` must be used within \`${e}\``)}return[o,a]}function Kr(e,t=[]){let r=[];function o(n,s){let i=J.createContext(s),u=r.length;r=[...r,s];let l=f=>{let{scope:h,children:g,..._}=f,p=h?.[e]?.[u]||i,b=J.useMemo(()=>_,Object.values(_));return(0,kt.jsx)(p.Provider,{value:b,children:g})};l.displayName=n+"Provider";function c(f,h){let g=h?.[e]?.[u]||i,_=J.useContext(g);if(_)return _;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${n}\``)}return[l,c]}let a=()=>{let n=r.map(s=>J.createContext(s));return function(i){let u=i?.[e]||n;return J.useMemo(()=>({[`__scope${e}`]:{...i,[e]:u}}),[i,u])}};return a.scopeName=e,[o,Pn(a,...t)]}function Pn(...e){let t=e[0];if(e.length===1)return t;let r=()=>{let o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(n){let s=o.reduce((i,{useScope:u,scopeName:l})=>{let f=u(n)[`__scope${l}`];return{...i,...f}},{});return J.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Mt=m(w(),1);var zr=m(w(),1),Xe=globalThis?.document?zr.useLayoutEffect:()=>{};var Dn=Mt[" useId ".trim().toString()]||(()=>{}),Nn=0;function Ze(e){let[t,r]=Mt.useState(Dn());return Xe(()=>{e||r(o=>o??String(Nn++))},[e]),e||(t?`radix-${t}`:"")}var Q=m(w(),1);var Je=m(w(),1);var An=Q[" useInsertionEffect ".trim().toString()]||Xe;function qr({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){let[a,n,s]=In({defaultProp:t,onChange:r}),i=e!==void 0,u=i?e:a;{let c=Q.useRef(e!==void 0);Q.useEffect(()=>{let f=c.current;f!==i&&console.warn(`${o} is changing from ${f?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=i},[i,o])}let l=Q.useCallback(c=>{if(i){let f=Ln(c)?c(e):c;f!==e&&s.current?.(fLine truncated
|
||||
.`.concat(Zt,` {
|
||||
overflow: hidden `).concat(o,`;
|
||||
padding-right: `).concat(i,"px ").concat(o,`;
|
||||
}
|
||||
body[`).concat(Pe,`] {
|
||||
overflow: hidden `).concat(o,`;
|
||||
overscroll-behavior: contain;
|
||||
`).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
|
||||
padding-left: `.concat(a,`px;
|
||||
padding-top: `).concat(n,`px;
|
||||
padding-right: `).concat(s,`px;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
margin-right: `).concat(i,"px ").concat(o,`;
|
||||
`),r==="padding"&&"padding-right: ".concat(i,"px ").concat(o,";")].filter(Boolean).join(""),`
|
||||
}
|
||||
|
||||
.`).concat(ve,` {
|
||||
right: `).concat(i,"px ").concat(o,`;
|
||||
}
|
||||
|
||||
.`).concat(he,` {
|
||||
margin-right: `).concat(i,"px ").concat(o,`;
|
||||
}
|
||||
|
||||
.`).concat(ve," .").concat(ve,` {
|
||||
right: 0 `).concat(o,`;
|
||||
}
|
||||
|
||||
.`).concat(he," .").concat(he,` {
|
||||
margin-right: 0 `).concat(o,`;
|
||||
}
|
||||
|
||||
body[`).concat(Pe,`] {
|
||||
`).concat(Jt,": ").concat(i,`px;
|
||||
}
|
||||
`)},Jo=function(){var e=parseInt(document.body.getAttribute(Pe)||"0",10);return isFinite(e)?e:0},Fi=function(){De.useEffect(function(){return document.body.setAttribute(Pe,(Jo()+1).toString()),function(){var e=Jo()-1;e<=0?document.body.removeAttribute(Pe):document.body.setAttribute(Pe,e.toString())}},[])},sr=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,a=o===void 0?"margin":o;Fi();var n=De.useMemo(function(){return ir(a)},[a]);return De.createElement(ki,{styles:Mi(n,!t,a,r?"":"!important")})};var lr=!1;if(typeof window<"u")try{$e=Object.defineProperty({},"passive",{get:function(){return lr=!0,!0}}),window.addEventListener("test",$e,$e),window.removeEventListener("test",$e,$e)}catch{lr=!1}var $e,ge=lr?{passive:!1}:!1;var ji=function(e){return e.tagName==="TEXTAREA"},Qo=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!ji(e)&&r[t]==="visible")},Wi=function(e){return Qo(e,"overflowY")},Bi=function(e){return Qo(e,"overflowX")},ur=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var a=ea(e,o);if(a){var n=ta(e,o),s=n[1],i=n[2];if(s>i)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},Vi=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},$i=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},ea=function(e,t){return e==="v"?Wi(t):Bi(t)},ta=function(e,t){return e==="v"?Vi(t):$i(t)},Ui=function(e,t){return e==="h"&&t==="rtl"?-1:1},ra=function(e,t,r,o,a){var n=Ui(e,window.getComputedStyle(t).direction),s=n*o,i=r.target,u=t.contains(i),l=!1,c=s>0,f=0,h=0;do{if(!i)break;var g=ta(e,i),_=g[0],p=g[1],b=g[2],S=p-b-n*_;(_||S)&&ea(e,i)&&(f+=S,h+=_);var P=i.parentNode;i=P&&P.nodeType===Node.DOCUMENT_FRAGMENT_NODE?P.host:P}while(!u&&i!==document.body||u&&(t.contains(i)||t===i));return(c&&(a&&Math.abs(f)<1||!a&&s>f)||!c&&(a&&Math.abs(h)<1||!a&&-s>h))&&(l=!0),l};var ct=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oa=function(e){return[e.deltaX,e.deltaY]},aa=function(e){return e&&"current"in e?e.current:e},Hi=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Gi=function(e){return`
|
||||
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
||||
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
||||
`)},Ki=0,Ne=[];function na(e){var t=L.useRef([]),r=L.useRef([0,0]),o=L.useRef(),a=L.useState(Ki++)[0],n=L.useState(Ve)[0],s=L.useRef(e);L.useEffect(function(){s.current=e},[e]),L.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var p=Uo([e.lockRef.current],(e.shards||[]).map(aa),!0).filter(Boolean);return p.forEach(function(b){return b.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),p.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var i=L.useCallback(function(p,b){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!s.current.allowPinchZoom;var S=ct(p),P=r.current,T="deltaX"in p?p.deltaX:P[0]-S[0],k="deltaY"in p?p.deltaY:P[1]-S[1],D,C=p.target,R=Math.abs(T)>Math.abs(k)?"h":"v";if("touches"in p&&R==="h"&&C.type==="range")return!1;var z=ur(R,C);if(!z)return!0;if(z?D=R:(D=R==="v"?"h":"v",z=ur(R,C)),!z)return!1;if(!o.current&&"changedTouches"in p&&(T||k)&&(o.current=D),!D)return!0;var se=o.current||D;return ra(se,b,p,se==="h"?T:k,!0)},[]),u=L.useCallback(function(p){var b=p;if(!(!Ne.length||Ne[Ne.length-1]!==n)){var S="deltaY"in b?oa(b):ct(b),P=t.current.filter(function(D){return D.name===b.type&&(D.target===b.target||b.target===D.shadowParent)&&Hi(D.delta,S)})[0];if(P&&P.should){b.cancelable&&b.preventDefault();return}if(!P){var T=(s.current.shards||[]).map(aa).filter(Boolean).filter(function(D){return D.contains(b.target)}),k=T.length>0?i(b,T[0]):!s.current.noIsolation;k&&b.cancelable&&b.preventDefault()}}},[]),l=L.useCallback(function(p,b,S,P){var T={name:p,delta:b,target:S,should:P,shadowParent:zi(S)};t.current.push(T),setTimeout(function(){t.current=t.current.filter(function(k){return k!==T})},1)},[]),c=L.useCallback(function(p){r.current=ct(p),o.current=void 0},[]),f=L.useCallback(function(p){l(p.type,oa(p),p.target,i(p,e.lockRef.current))},[]),h=L.useCallback(function(p){l(p.type,ct(p),p.target,i(p,e.lockRef.current))},[]);L.useEffect(function(){return Ne.push(n),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",u,ge),document.addEventListener("touchmove",u,ge),document.addEventListener("touchstart",c,ge),function(){Ne=Ne.filter(function(p){return p!==n}),document.removeEventListener("wheel",u,ge),document.removeEventListener("touchmove",u,ge),document.removeEventListener("touchstart",c,ge)}},[]);var g=e.removeScrollBar,_=e.inert;return L.createElement(L.Fragment,null,_?L.createElement(n,{styles:Gi(a)}):null,g?L.createElement(sr,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function zi(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ia=tr(ft,na);var sa=dt.forwardRef(function(e,t){return dt.createElement(Be,X({},e,{ref:t,sideCar:ia}))});sa.classNames=Be.classNames;var fr=sa;var qi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ae=new WeakMap,mt=new WeakMap,pt={},cr=0,la=function(e){return e&&(e.host||la(e.parentNode))},Yi=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=la(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Xi=function(e,t,r,o){var a=Yi(t,Array.isArray(e)?e:[e]);pt[r]||(pt[r]=new WeakMap);var n=pt[r],s=[],i=new Set,u=new Set(a),l=function(f){!f||i.has(f)||(i.add(f),l(f.parentNode))};a.forEach(l);var c=function(f){!f||u.has(f)||Array.prototype.forEach.call(f.children,function(h){if(i.has(h))c(h);else try{var g=h.getAttribute(o),_=g!==null&&g!=="false",p=(Ae.get(h)||0)+1,b=(n.get(h)||0)+1;Ae.set(h,p),n.set(h,b),s.push(h),p===1&&_&&mt.set(h,!0),b===1&&h.setAttribute(r,"true"),_||h.setAttribute(o,"true")}catch(S){console.error("aria-hidden: cannot operate on ",h,S)}})};return c(t),i.clear(),cr++,function(){s.forEach(function(f){var h=Ae.get(f)-1,g=n.get(f)-1;Ae.set(f,h),n.set(f,g),h||(mt.has(f)||f.removeAttribute(o),mt.delete(f)),g||f.removeAttribute(r)}),cr--,cr||(Ae=new WeakMap,Ae=new WeakMap,mt=new WeakMap,pt={})}},ua=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),a=t||qi(e);return a?(o.push.apply(o,Array.from(a.querySelectorAll("[aria-live], script"))),Xi(o,a,r,"aria-hidden")):function(){return null}};var N=m(B(),1),ht="Dialog",[fa,Ff]=Kr(ht),[Zi,te]=fa(ht),ca=e=>{let{__scopeDialog:t,children:r,open:o,defaultOpen:a,onOpenChange:n,modal:s=!0}=e,i=I.useRef(null),u=I.useRef(null),[l,c]=qr({prop:o,defaultProp:a??!1,onChange:n,caller:ht});return(0,N.jsx)(Zi,{scope:t,triggerRef:i,contentRef:u,contentId:Ze(),titleId:Ze(),descriptionId:Ze(),open:l,onOpenChange:c,onOpenToggle:I.useCallback(()=>c(f=>!f),[c]),modal:s,children:r})};ca.displayName=ht;var da="DialogTrigger",Ji=I.forwardRef((e,t)=>{let{__scopeDialog:r,...o}=e,a=te(da,r),n=Ye(t,a.triggerR
Line truncated
|
||||
|
||||
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return I.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ls="DialogDescriptionWarning",us=({contentRef:e,descriptionId:t})=>{let o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wa(ls).contentName}}.`;return I.useEffect(()=>{let a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Ea=ca;var Ca=pa,Sa=va,xa=ha;var v=m(w(),1);var Da=m(w(),1),Rs=m(pe(),1);var j=m(w(),1);var cs=m(w(),1);function Oa(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ue(...e){return t=>{let r=!1,o=e.map(a=>{let n=Oa(a,t);return!r&&typeof n=="function"&&(r=!0),n});if(r)return()=>{for(let a=0;a<o.length;a++){let n=o[a];typeof n=="function"?n():Oa(e[a],null)}}}}var gt=m(B(),1),ds=Symbol.for("react.lazy"),yt=j[" use ".trim().toString()];function ms(e){return typeof e=="object"&&e!==null&&"then"in e}function _a(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ds&&"_payload"in e&&ms(e._payload)}function Pa(e){let t=ps(e),r=j.forwardRef((o,a)=>{let{children:n,...s}=o;_a(n)&&typeof yt=="function"&&(n=yt(n._payload));let i=j.Children.toArray(n),u=i.find(hs);if(u){let l=u.props.children,c=i.map(f=>f===u?j.Children.count(l)>1?j.Children.only(null):j.isValidElement(l)?l.props.children:null:f);return(0,gt.jsx)(t,{...s,ref:a,children:j.isValidElement(l)?j.cloneElement(l,void 0,c):null})}return(0,gt.jsx)(t,{...s,ref:a,children:n})});return r.displayName=`${e}.Slot`,r}function ps(e){let t=j.forwardRef((r,o)=>{let{children:a,...n}=r;if(_a(a)&&typeof yt=="function"&&(a=yt(a._payload)),j.isValidElement(a)){let s=ys(a),i=gs(n,a.props);return a.type!==j.Fragment&&(i.ref=o?ue(o,s):s),j.cloneElement(a,i)}return j.Children.count(a)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vs=Symbol("radix.slottable");function hs(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vs}function gs(e,t){let r={...t};for(let o in t){let a=e[o],n=t[o];/^on[A-Z]/.test(o)?a&&n?r[o]=(...i)=>{let u=n(...i);return a(...i),u}:a&&(r[o]=a):o==="style"?r[o]={...a,...n}:o==="className"&&(r[o]=[a,n].filter(Boolean).join(" "))}return{...e,...r}}function ys(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Na=m(B(),1),bs=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ie=bs.reduce((e,t)=>{let r=Pa(`Primitive.${t}`),o=Da.forwardRef((a,n)=>{let{asChild:s,...i}=a,u=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,Na.jsx)(u,{...i,ref:n})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});var vr=m(w(),1);var Aa=m(w(),1),Ia=globalThis?.document?Aa.useLayoutEffect:()=>{};var ws=vr[" useId ".trim().toString()]||(()=>{}),Es=0;function Re(e){let[t,r]=vr.useState(ws());return Ia(()=>{e||r(o=>o??String(Es++))},[e]),e||(t?`radix-${t}`:"")}var Ue='[cmdk-group=""]',hr='[cmdk-group-items=""]',Cs='[cmdk-group-heading=""]',Ta='[cmdk-item=""]',La=`${Ta}:not([aria-disabled="true"])`,gr="cmdk-item-select",Ie="data-value",Ss=(e,t,r)=>Br(e,t,r),ka=v.createContext(void 0),He=()=>v.useContext(ka),Ma=v.createContext(void 0),yr=()=>v.useContext(Ma),Fa=v.createContext(void 0),ja=v.forwardRef((e,t)=>{let r=Le(()=>{var d,E;return{search:"",value:(E=(d=e.value)!=null?d:e.defaultValue)!=null?E:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Le(()=>new Set),a=Le(()=>new Map),n=Le(()=>new Map),s=Le(()=>new Set),i=Wa(e),{label:u,children:l,value:c,onValueChange:f,filter:h,shouldFilter:g,loop:_,disablePointerSelection:p=!1,vimBindings:b=!0,...S}=e,P=Re(),T=Re(),k=Re(),D=v.useRef(null),C=ks();be(()=>{if(c!==void 0){let d=c.trim();r.current.value=d,R.emit()}},[c]),be(()=>{C(6,Ar)},[]);let R=v.useMemo(()=>({subscribe:d=>(s.current.add(d),()=>s.current.delete(d)),snapshot:()=>r.current,setState:(d,E,O)=>{var y,A,M,Z;if(!Object.is(r.current[d],E)){if(r.current[d]=E,d==="search")Pt(),me(),C(1,_t);else if(d==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let q=document.getElementById(k);q?q.focus():(y=document.getElementById(P))==null||y.focus()}if(C(7,()=>{var q;r.current.selectedItemId=(q=Ce())==null?void 0:q.id,R.emit()}),O||C(5,Ar),((A=i.current)==null?void 0:A.value)!==void 0){let q=E??"";(Z=(M=i.current).onValueChange)==null||Z.call(M,q);return}}R.emit()}},emit:()=>{s.current.forEach(d=>d())}}),[]),z=v.useMemo(()=>({value:(d,E,O)=>{var y;E!==((y=n.current.get(d))==null?void 0:y.value)&&(n.current.set(d,{value:E,keywords:O}),r.current.filtered.items.set(d,se(E,O)),C(2,()=>{me(),R.emit()}))},item:(d,E)=>(o.current.add(d),
Line truncated
|
||||
Vendored
+56335
File diff suppressed because it is too large.
Load diff
+183
@@ -0,0 +1,183 @@
|
||||
"use strict";var wp;(wp||={}).components=(()=>{var _cc=Object.create;var ig=Object.defineProperty;var qcc=Object.getOwnPropertyDescriptor;var $cc=Object.getOwnPropertyNames;var clc=Object.getPrototypeOf,llc=Object.prototype.hasOwnProperty;var y9=(c,l)=>()=>(c&&(l=c(c=0)),l);var dl=(c,l)=>()=>(l||c((l={exports:{}}).exports,l),l.exports),qG=(c,l)=>{for(var t in l)ig(c,t,{get:l[t],enumerable:!0})},V9=(c,l,t,e)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of $cc(l))!llc.call(c,d)&&d!==t&&ig(c,d,{get:()=>l[d],enumerable:!(e=qcc(l,d))||e.enumerable});return c};var u=(c,l,t)=>(t=c!=null?_cc(clc(c)):{},V9(l||!c||!c.__esModule?ig(t,"default",{value:c,enumerable:!0}):t,c)),C9=c=>V9(ig({},"__esModule",{value:!0}),c);var kc=dl((oIc,J9)=>{J9.exports=window.wp.primitives});var nc=dl((GIc,Y9)=>{Y9.exports=window.wp.i18n});var dc=dl((XIc,F9)=>{F9.exports=window.wp.compose});var Y=dl((iIc,v9)=>{v9.exports=window.wp.element});var E=dl((RIc,N9)=>{N9.exports=window.React});var V=dl((OIc,j9)=>{j9.exports=window.ReactJSXRuntime});var HF=dl(ZF=>{"use strict";var oa=E();function Ylc(c,l){return c===l&&(c!==0||1/c===1/l)||c!==c&&l!==l}var Flc=typeof Object.is=="function"?Object.is:Ylc,vlc=oa.useState,Nlc=oa.useEffect,flc=oa.useLayoutEffect,Slc=oa.useDebugValue;function klc(c,l){var t=l(),e=vlc({inst:{value:t,getSnapshot:l}}),d=e[0].inst,b=e[1];return flc(function(){d.value=t,d.getSnapshot=l,Yy(d)&&b({inst:d})},[c,t,l]),Nlc(function(){return Yy(d)&&b({inst:d}),c(function(){Yy(d)&&b({inst:d})})},[c]),Slc(t),t}function Yy(c){var l=c.getSnapshot;c=c.value;try{var t=l();return!Flc(c,t)}catch{return!0}}function zlc(c,l){return l()}var Alc=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?zlc:klc;ZF.useSyncExternalStore=oa.useSyncExternalStore!==void 0?oa.useSyncExternalStore:Alc});var IF=dl((AWc,RF)=>{"use strict";RF.exports=HF()});var ua=dl((zpc,kF)=>{kF.exports=window.ReactDOM});var ml=dl((VNc,Cf)=>{Cf.exports=window.wp.deprecated});function MH(c){var l=Object.create(null);return function(t){return l[t]===void 0&&(l[t]=c(t)),l[t]}}var PH=y9(()=>{});var Sk={};qG(Sk,{default:()=>BV});var rnc,BV,yV=y9(()=>{PH();rnc=/^((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|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|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|popover|popoverTarget|popoverTargetAction|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|orientatLine truncated
|
||||
[data-motion-pop-id="${t}"] {
|
||||
position: absolute !important;
|
||||
width: ${o}px !important;
|
||||
height: ${n}px !important;
|
||||
top: ${G}px !important;
|
||||
left: ${X}px !important;
|
||||
}
|
||||
`),()=>{document.head.removeChild(i)}},[l]),(0,Pk.jsx)(CV,{isPresent:l,childRef:e,sizeRef:d,children:cR.cloneElement(c,{ref:e})})}var qk=({children:c,initial:l,isPresent:t,onExitComplete:e,custom:d,presenceAffectsLayout:b,mode:o})=>{let n=iu(Rnc),G=(0,AX.useId)(),X=(0,AX.useCallback)(a=>{n.set(a,!0);for(let m of n.values())if(!m)return;e&&e()},[n,e]),i=(0,AX.useMemo)(()=>({id:G,initial:l,isPresent:t,custom:d,onExitComplete:X,register:a=>(n.set(a,!1),()=>n.delete(a))}),b?[Math.random(),X]:[t,X]);return(0,AX.useMemo)(()=>{n.forEach((a,m)=>n.set(m,!1))},[t]),_k.useEffect(()=>{!t&&!n.size&&e&&e()},[t]),o==="popLayout"&&(c=(0,JV.jsx)(Kk,{isPresent:t,children:c})),(0,JV.jsx)($n.Provider,{value:i,children:c})};function Rnc(){return new Map}var lR=u(E(),1),$x=c=>c.key||"";function hV(c){let l=[];return lR.Children.forEach(c,t=>{(0,lR.isValidElement)(t)&&l.push(t)}),l}var gu=({children:c,exitBeforeEnter:l,custom:t,initial:e=!0,onExitComplete:d,presenceAffectsLayout:b=!0,mode:o="sync"})=>{Ee(!l,"Replace exitBeforeEnter with mode='wait'");let n=(0,Eb.useMemo)(()=>hV(c),[c]),G=n.map($x),X=(0,Eb.useRef)(!0),i=(0,Eb.useRef)(n),a=iu(()=>new Map),[m,x]=(0,Eb.useState)(n),[s,r]=(0,Eb.useState)(n);SH(()=>{X.current=!1,i.current=n;for(let H=0;H<s.length;H++){let R=$x(s[H]);G.includes(R)?a.delete(R):a.get(R)!==!0&&a.set(R,!1)}},[s,G.length,G.join("-")]);let g=[];if(n!==m){let H=[...n];for(let R=0;R<s.length;R++){let W=s[R],I=$x(W);G.includes(I)||(H.splice(R,0,W),g.push(W))}o==="wait"&&g.length&&(H=g),r(hV(H)),x(n);return}let{forceRender:Z}=(0,Eb.useContext)($a);return(0,cs.jsx)(cs.Fragment,{children:s.map(H=>{let R=$x(H),W=n===s||G.includes(R),I=()=>{if(a.has(R))a.set(R,!0);else return;let B=!0;a.forEach(p=>{p||(B=!1)}),B&&(Z?.(),r(i.current),d&&d())};return(0,cs.jsx)(qk,{isPresent:W,initial:!X.current||e?void 0:!1,custom:W?void 0:t,presenceAffectsLayout:b,mode:o,onExitComplete:W?void 0:I,children:H},R)})})};var Zu=u(Y(),1);function Dt(c){return c!=null}function $k(c){let l=c==="";return!Dt(c)||l}function cz(c=[],l){return c.find(Dt)??l}var Inc=c=>parseFloat(c),ls=c=>typeof c=="string"?Inc(c):c;var lz={initial:void 0,fallback:""};function Wnc(c,l=lz){let{initial:t,fallback:e}={...lz,...l},[d,b]=(0,Zu.useState)(c),o=Dt(c);(0,Zu.useEffect)(()=>{o&&d&&b(void 0)},[o,d]);let n=cz([c,d,t],e),G=(0,Zu.useCallback)(X=>{o||b(X)},[o]);return[n,G]}var Ko=Wnc;var ts=u(Y(),1);function pnc(c,l){let t=(0,ts.useRef)(!1);(0,ts.useEffect)(()=>{if(t.current)return c();t.current=!0},l),(0,ts.useEffect)(()=>()=>{t.current=!1},[])}var OX=pnc;var tR=u(Y(),1);function de({defaultValue:c,onChange:l,value:t}){let e=typeof t<"u",d=e?t:c,[b,o]=(0,tR.useState)(d),n=e?t:b,G=(0,tR.useCallback)((i,...a)=>{o(i),l?.(i,...a)},[l]),X;return e&&typeof l=="function"?X=l:!e&&typeof l=="function"?X=G:X=o,[n,X]}var Wd=u(E()),is=u(E());var Bnc=!1;function ync(c){if(c.sheet)return c.sheet;for(var l=0;l<document.styleSheets.length;l++)if(document.styleSheets[l].ownerNode===c)return document.styleSheets[l]}function Vnc(c){var l=document.createElement("style");return l.setAttribute("data-emotion",c.key),c.nonce!==void 0&&l.setAttribute("nonce",c.nonce),l.appendChild(document.createTextNode("")),l.setAttribute("data-s",""),l}var tz=(function(){function c(t){var e=this;this._insertTag=function(d){var b;e.tags.length===0?e.insertionPoint?b=e.insertionPoint.nextSibling:e.prepend?b=e.container.firstChild:b=e.before:b=e.tags[e.tags.length-1].nextSibling,e.container.insertBefore(d,b),e.tags.push(d)},this.isSpeedy=t.speedy===void 0?!Bnc:t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.prepend=t.prepend,this.insertionPoint=t.insertionPoint,this.before=null}var l=c.prototype;return l.hydrate=function(e){e.forEach(this._insertTag)},l.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Vnc(this));var d=this.tags[this.tags.length-1];if(this.isSpeedy){var b=ync(d);try{b.insertRule(e,b.cssRules.length)}catch{}}else d.appendChild(document.createTextNode(e));this.ctr++},l.flush=function(){this.tags.forEach(function(e){var d;return(d=e.parentNode)==null?void 0:d.removeChild(e)}),this.tags=[],this.ctr=0},c})();var Ct="-ms-",es="-moz-",Pc="-webkit-",eR="comm",Hu="rule",Ru="decl";var ez="@import";var dR="@keyframes";var dz="@layer";var bz=Math.abs,QX=String.fromCharCode,oz=Object.assign;function nz(c,l){return Tl(c,0)^45?(((l<<2^Tl(c,0))<<2^Tl(c,1))<<2^Tl(c,2))<<2^Tl(c,3):0}function bR(c){return c.trim()}function YV(c,l){return(c=l.exec(c))?c[0]:c}function Tc(c,l,t){return c.replace(l,t)}function ds(c,l){return c.indexOf(l)}function Tl(c,l){return c.charCodeAt(l)|0}function eG(c,l,t){return c.slice(l,t)}function be(c){return c.length}function Iu(c){return c.length}function Wu(c,l){return l.push(c),c}function FV(c,l){return c.map(l).join("")}var oR=1,pu=1,Gz=0,oe=0,Pl=0,yu="";function bs(c,l,t,e,d,b,o){return{value:c,root:l,parent:t,type:e,props:d,children:b,line:oR,column:pu,length:o,return:""}}function Vu(c,l){retu
Line truncated
|
||||
1,
|
||||
max( 0, var( --selected-width, 0 ), var( --selected-height, 0 ) )
|
||||
);}`,""),zac=c=>{let l=O("border-color:",D.gray[300],";","");return O(c&&l," &:hover{border-color:",D.gray[400],";}&:focus-within{z-index:1;outline:",w.borderWidthFocus," solid ",D.ui.borderFocus,";outline-offset:1px;}","")},Aac={name:"1k18kha",styles:"height:40px"},Oac={name:"j4fzus",styles:"height:36px"},Qac=c=>({default:Oac,"__unstable-large":Aac})[c],GT={name:"7whenc",styles:"display:flex;width:100%"},XT=N("div",{target:"eakva830"})({name:"zjik7",styles:"display:flex"});var uT=u(dc(),1),$u=u(Y(),1),mT=u(nc(),1);var $I=u(Y(),1),OC=(0,$I.createContext)({});OC.displayName="ToggleGroupControlContext";var iT=()=>(0,$I.useContext)(OC),cW=OC;var aT=u(dc(),1),qu=u(Y(),1);function lW(c){let l=(0,qu.useRef)(!0),t=(0,aT.usePrevious)(c),e=(0,qu.useRef)(!1);(0,qu.useEffect)(()=>{l.current&&(l.current=!1)},[]);let d=e.current||!l.current&&t!==c;return(0,qu.useEffect)(()=>{e.current=d},[d]),d?{value:c??"",defaultValue:void 0}:{value:void 0,defaultValue:c}}var tW=u(V(),1);function Tac({children:c,isAdaptiveWidth:l,label:t,onChange:e,size:d,value:b,id:o,setSelectedElement:n,...G},X){let i=(0,uT.useInstanceId)(eW,"toggle-group-control-as-radio-group"),a=o||i,{value:m,defaultValue:x}=lW(b),r=yX({defaultValue:x,value:m,setValue:e?R=>{e(R??void 0)}:void 0,rtl:(0,mT.isRTL)()}),g=xc(r,"value"),Z=r.setValue;(0,$u.useEffect)(()=>{g===""&&r.setActiveId(void 0)},[r,g]);let H=(0,$u.useMemo)(()=>({activeItemIsNotFirstItem:()=>r.getState().activeId!==r.first(),baseId:a,isBlock:!l,size:d,value:g,setValue:Z,setSelectedElement:n}),[a,l,r,g,n,Z,d]);return(0,tW.jsx)(cW.Provider,{value:H,children:(0,tW.jsx)(Ba,{store:r,"aria-label":t,render:(0,tW.jsx)(ic,{}),...G,id:a,ref:X,children:c})})}var eW=(0,$u.forwardRef)(Tac);eW.displayName="ToggleGroupControlAsRadioGroup";var xT=u(dc(),1),dW=u(Y(),1);var QC=u(V(),1);function Dac({children:c,isAdaptiveWidth:l,label:t,onChange:e,size:d,value:b,id:o,setSelectedElement:n,...G},X){let i=(0,xT.useInstanceId)(bW,"toggle-group-control-as-button-group"),a=o||i,{value:m,defaultValue:x}=lW(b),[s,r]=de({defaultValue:x,value:m,onChange:e}),g=(0,dW.useMemo)(()=>({baseId:a,value:s,setValue:r,isBlock:!l,isDeselectable:!0,size:d,setSelectedElement:n}),[a,s,r,l,d,n]);return(0,QC.jsx)(cW.Provider,{value:g,children:(0,QC.jsx)(ic,{"aria-label":t,...G,ref:X,role:"group",children:c})})}var bW=(0,dW.forwardRef)(Dac);bW.displayName="ToggleGroupControlAsButtonGroup";var ei=u(Y(),1),oW=u(dc(),1),wC={element:void 0,top:0,right:0,bottom:0,left:0,width:0,height:0};function Lac(c){let l=c.getBoundingClientRect();if(l.width===0||l.height===0)return;let t=c.offsetParent,e=t?.getBoundingClientRect()??wC,d=t?.scrollLeft??0,b=t?.scrollTop??0,o=parseFloat(getComputedStyle(c).width),n=parseFloat(getComputedStyle(c).height),G=o/l.width,X=n/l.height;return{element:c,top:(l.top-e?.top)*X+b,right:(e?.right-l.right)*G-d,bottom:(e?.bottom-l.bottom)*X-b,left:(l.left-e?.left)*G+d,width:o,height:n}}var Uac=100;function nW(c,l=[]){let[t,e]=(0,ei.useState)(wC),d=(0,ei.useRef)(void 0),b=(0,oW.useEvent)(()=>{if(c&&c.isConnected){let n=Lac(c);if(n)return e(n),clearInterval(d.current),!0}else clearInterval(d.current);return!1}),o=(0,oW.useResizeObserver)(()=>{b()||requestAnimationFrame(()=>{b()||(d.current=setInterval(b,Uac))})});return(0,ei.useLayoutEffect)(()=>{o(c),c||e(wC)},[o,c]),(0,ei.useLayoutEffect)(()=>{b()},l),t}var gT=u(dc(),1),TC=u(Y(),1);var sT=u(dc(),1),GW=u(Y(),1);function rT(c,l){let t=(0,GW.useRef)(c),e=(0,sT.useEvent)(l);(0,GW.useLayoutEffect)(()=>{t.current!==c&&(e({previousValue:t.current}),t.current=c)},[e,c])}function XW(c,l,{prefix:t="subelement",dataAttribute:e=`${t}-animated`,transitionEndFilter:d=()=>!0,roundRect:b=!1}={}){let o=(0,gT.useEvent)(()=>{Object.keys(l).forEach(n=>n!=="element"&&c?.style.setProperty(`--${t}-${n}`,String(b?Math.floor(l[n]):l[n])))});(0,TC.useLayoutEffect)(()=>{o()},[l,o]),rT(l.element,({previousValue:n})=>{l.element&&n&&c?.setAttribute(`data-${e}`,"")}),(0,TC.useLayoutEffect)(()=>{function n(G){d(G)&&c?.removeAttribute(`data-${e}`)}return c?.addEventListener("transitionend",n),()=>c?.removeEventListener("transitionend",n)},[e,c,d])}var c0=u(V(),1);function jac(c,l){let{__nextHasNoMarginBottom:t,__next40pxDefaultSize:e=!1,__shouldNotWarnDeprecated36pxSize:d,className:b,isAdaptiveWidth:o=!1,isBlock:n=!1,isDeselectable:G=!1,label:X,hideLabelFromVision:i=!1,help:a,onChange:m,size:x="default",value:s,children:r,...g}=cc(c,"ToggleGroupControl"),Z=e&&x==="default"?"__unstable-large":x,[H,R]=(0,_s.useState)(),[W,I]=(0,_s.useState)(),B=(0,ZT.useMergeRefs)([I,l]),p=nW(s!=null?H:void 0);XW(W,p,{prefix:"selected",dataAttribute:"indicator-animated",transitionEndFilter:J=>J.pseudoElement==="::before",roundRect:!1});let y=Xc(),h=(0,_s.useMemo)(()=>y(nT({isBlock:n,isDeselectable:G,size:Z}),n&>,b),[b,y,n,G,Z]),C=G?bW:eW;return Lc({componentName:"ToggleGroupControl",size:x,__next40pxDefaultSize:e,__shouldNotWarnDeprecated36pxSize:d}),(0,c0.jsxs)(Dc,{help:a,children:[!i&&(0,c0.jsx)(XT,{children:(0,c0.jsx)(Dc.
Line truncated
|
||||
.react-colorful__interactive {
|
||||
width: calc( 100% - ${z(2)} );
|
||||
margin-left: ${z(1)};
|
||||
}`,rD=N("div",{target:"ez9hsf43"})("padding-top:",z(2),";padding-right:0;padding-left:0;padding-bottom:0;"),gD=N(Uc,{target:"ez9hsf42"})("padding-left:",z(4),";padding-right:",z(4),";"),ZD=N(Il,{target:"ez9hsf41"})("padding-top:",z(4),";padding-left:",z(4),";padding-right:",z(3),";padding-bottom:",z(5),";"),HD=N("div",{target:"ez9hsf40"})(qe,";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:",z(4),";border-bottom:none;}.react-colorful__hue,.react-colorful__alpha{width:184px;height:16px;border-radius:",w.radiusFull,";margin-bottom:",z(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;@media not ( prefers-reduced-motion ){transition:transform ",w.transitionDurationFast," ease-in-out;}}.react-colorful__interactive:focus .react-colorful__pointer{box-shadow:0 0 0 ",w.borderWidthFocus," ",w.surfaceColor,";border:",w.borderWidthFocus," solid black;transform:translate( -50%, -50% ) scale( 1.5 );}.react-colorful__pointer-fill{box-shadow:inset 0 0 0 ",w.borderWidthFocus," #fff;}",Auc,";");var RD=u(dc(),1),b0=u(Y(),1);var qC=u(nc(),1);var $C=u(V(),1),ID=c=>{let{color:l,colorType:t}=c,[e,d]=(0,b0.useState)(null),b=(0,b0.useRef)(void 0),o=(0,RD.useCopyToClipboard)(()=>{switch(t){case"hsl":return l.toHslString();case"rgb":return l.toRgbString();default:case"hex":return l.toHex()}},()=>{b.current&&clearTimeout(b.current),d(l.toHex()),b.current=setTimeout(()=>{d(null),b.current=void 0},3e3)});(0,b0.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);let n=e===l.toHex(),G=n?(0,qC.__)("Copied!"):(0,qC.__)("Copy");return(0,$C.jsx)(Ne,{delay:0,hideOnClick:!1,text:G,children:(0,$C.jsx)(ci,{size:"compact","aria-label":G,ref:o,icon:n?jt:R2,showTooltip:!1})})};var ii=u(V(),1),Go=({min:c,max:l,label:t,abbreviation:e,onChange:d,value:b})=>(0,ii.jsxs)(Uc,{spacing:4,children:[(0,ii.jsx)(mD,{__next40pxDefaultSize:!0,min:c,max:l,label:t,hideLabelFromVision:!0,value:b,onChange:n=>{if(!n){d(0);return}if(typeof n=="string"){d(parseInt(n,10));return}d(n)},prefix:(0,ii.jsx)(mG,{children:(0,ii.jsx)(Jt,{color:D.theme.accent,lineHeight:1,children:e})}),spinControls:"none"}),(0,ii.jsx)(sD,{__next40pxDefaultSize:!0,label:t,hideLabelFromVision:!0,min:c,max:l,value:b,onChange:d,withInputField:!1})]});var nn=u(V(),1),WD=({color:c,onChange:l,enableAlpha:t})=>{let{r:e,g:d,b,a:o}=c.toRgb();return(0,nn.jsxs)(nn.Fragment,{children:[(0,nn.jsx)(Go,{min:0,max:255,label:"Red",abbreviation:"R",value:e,onChange:n=>l(Rc({r:n,g:d,b,a:o}))}),(0,nn.jsx)(Go,{min:0,max:255,label:"Green",abbreviation:"G",value:d,onChange:n=>l(Rc({r:e,g:n,b,a:o}))}),(0,nn.jsx)(Go,{min:0,max:255,label:"Blue",abbreviation:"B",value:b,onChange:n=>l(Rc({r:e,g:d,b:n,a:o}))}),t&&(0,nn.jsx)(Go,{min:0,max:100,label:"Alpha",abbreviation:"A",value:Math.trunc(o*100),onChange:n=>l(Rc({r:e,g:d,b,a:n/100}))})]})};var o0=u(Y(),1);var Gn=u(V(),1),pD=({color:c,onChange:l,enableAlpha:t})=>{let e=(0,o0.useMemo)(()=>c.toHsl(),[c]),[d,b]=(0,o0.useState)({...e}),o=c.isEqual(Rc(d));(0,o0.useEffect)(()=>{o||b(e)},[e,o]);let n=o?d:e,G=X=>{let i=Rc({...n,...X});c.isEqual(i)?b(a=>({...a,...X})):l(i)};return(0,Gn.jsxs)(Gn.Fragment,{children:[(0,Gn.jsx)(Go,{min:0,max:359,label:"Hue",abbreviation:"H",value:n.h,onChange:X=>{G({h:X})}}),(0,Gn.jsx)(Go,{min:0,max:100,label:"Saturation",abbreviation:"S",value:n.s,onChange:X=>{G({s:X})}}),(0,Gn.jsx)(Go,{min:0,max:100,label:"Lightness",abbreviation:"L",value:n.l,onChange:X=>{G({l:X})}}),t&&(0,Gn.jsx)(Go,{min:0,max:100,label:"Alpha",abbreviation:"A",value:Math.trunc(100*n.a),onChange:X=>{G({a:X/100})}})]})};var BD=u(nc(),1);var gW=u(V(),1),yD=({color:c,onChange:l,enableAlpha:t})=>{let e=b=>{if(!b)return;let o=b.startsWith("#")?b:"#"+b;l(Rc(o))},d=(b,o)=>{if(o.payload?.event?.nativeEvent?.inputType!=="insertFromPaste")return{...b};let G=b.value?.startsWith("#")?b.value.slice(1).toUpperCase():b.value?.toUpperCase();return{...b,value:G}};return(0,gW.jsx)(Ds,{prefix:(0,gW.jsx)(mG,{children:(0,gW.jsx)(Jt,{color:D.theme.accent,lineHeight:1,children:"#"})}),value:c.toHex().slice(1).toUpperCase(),onChange:e,maxLength:t?9:7,label:(0,BD.__)("Hex color"),hideLabelFromVision:!0,size:"__unstable-large",__unstableStateReducer:d,__unstableInputWidth:"9em"})};var ZW=u(V(),1),VD=({colorType:c,color:l,onChange:t,enableAlpha:e})=>{let d={color:l,onChange:t,enableAlpha:e};switch(c){case"hsl":return(0,ZW.jsx)(pD,{...d});case"rgb":return(0,ZW.jsx)(WD,{...d});default:case"hex":return(0,ZW.jsx)(yD,{...d})}};var Cc=u(E(),1);function G0(){return(G0=Object.assign||function(c){for(var l=1;l<arguments.length;l++){var t=arguments[l];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(c[e]=t[e])}return c}).apply(this,arguments)}function dJ(c,l){if(c==null)return{};var t,e,d={},b=Object.keys(c);for(e=0;e<b.length;e++)l.indexOf(t=b[e])>=0||(d[t]=c[t]);return d}fu
Line truncated
|
||||
-45deg,
|
||||
transparent 48%,
|
||||
rgb( 0 0 0 / 20% ) 48%,
|
||||
rgb( 0 0 0 / 20% ) 52%,
|
||||
transparent 52%
|
||||
);}`,"")},R0c=28,I0c=12,CL=O("width:",R0c*6+I0c*5,"px;>div:first-of-type>",cd,"{margin-bottom:0;}&& ",cd,"+button:not( .has-text ){min-width:24px;padding:0;}",""),JL=O("",""),hL=O("",""),YL={name:"1ghe26v",styles:"display:flex;justify-content:flex-end;margin-top:12px"},FL=()=>O("flex:1 1 60%;",Fc({marginRight:z(3)})(),";","");var mc=u(nc(),1),NL=u(Y(),1),jc=NL.Platform.OS==="web",uo={px:{value:"px",label:jc?"px":(0,mc.__)("Pixels (px)"),a11yLabel:(0,mc.__)("Pixels (px)"),step:1},"%":{value:"%",label:jc?"%":(0,mc.__)("Percentage (%)"),a11yLabel:(0,mc.__)("Percent (%)"),step:.1},em:{value:"em",label:jc?"em":(0,mc.__)("Relative to parent font size (em)"),a11yLabel:(0,mc._x)("ems","Relative to parent font size (em)"),step:.01},rem:{value:"rem",label:jc?"rem":(0,mc.__)("Relative to root font size (rem)"),a11yLabel:(0,mc._x)("rems","Relative to root font size (rem)"),step:.01},vw:{value:"vw",label:jc?"vw":(0,mc.__)("Viewport width (vw)"),a11yLabel:(0,mc.__)("Viewport width (vw)"),step:.1},vh:{value:"vh",label:jc?"vh":(0,mc.__)("Viewport height (vh)"),a11yLabel:(0,mc.__)("Viewport height (vh)"),step:.1},vmin:{value:"vmin",label:jc?"vmin":(0,mc.__)("Viewport smallest dimension (vmin)"),a11yLabel:(0,mc.__)("Viewport smallest dimension (vmin)"),step:.1},vmax:{value:"vmax",label:jc?"vmax":(0,mc.__)("Viewport largest dimension (vmax)"),a11yLabel:(0,mc.__)("Viewport largest dimension (vmax)"),step:.1},ch:{value:"ch",label:jc?"ch":(0,mc.__)("Width of the zero (0) character (ch)"),a11yLabel:(0,mc.__)("Width of the zero (0) character (ch)"),step:.01},ex:{value:"ex",label:jc?"ex":(0,mc.__)("x-height of the font (ex)"),a11yLabel:(0,mc.__)("x-height of the font (ex)"),step:.01},cm:{value:"cm",label:jc?"cm":(0,mc.__)("Centimeters (cm)"),a11yLabel:(0,mc.__)("Centimeters (cm)"),step:.001},mm:{value:"mm",label:jc?"mm":(0,mc.__)("Millimeters (mm)"),a11yLabel:(0,mc.__)("Millimeters (mm)"),step:.1},in:{value:"in",label:jc?"in":(0,mc.__)("Inches (in)"),a11yLabel:(0,mc.__)("Inches (in)"),step:.001},pc:{value:"pc",label:jc?"pc":(0,mc.__)("Picas (pc)"),a11yLabel:(0,mc.__)("Picas (pc)"),step:1},pt:{value:"pt",label:jc?"pt":(0,mc.__)("Points (pt)"),a11yLabel:(0,mc.__)("Points (pt)"),step:1},svw:{value:"svw",label:jc?"svw":(0,mc.__)("Small viewport width (svw)"),a11yLabel:(0,mc.__)("Small viewport width (svw)"),step:.1},svh:{value:"svh",label:jc?"svh":(0,mc.__)("Small viewport height (svh)"),a11yLabel:(0,mc.__)("Small viewport height (svh)"),step:.1},svi:{value:"svi",label:jc?"svi":(0,mc.__)("Viewport smallest size in the inline direction (svi)"),a11yLabel:(0,mc.__)("Small viewport width or height (svi)"),step:.1},svb:{value:"svb",label:jc?"svb":(0,mc.__)("Viewport smallest size in the block direction (svb)"),a11yLabel:(0,mc.__)("Small viewport width or height (svb)"),step:.1},svmin:{value:"svmin",label:jc?"svmin":(0,mc.__)("Small viewport smallest dimension (svmin)"),a11yLabel:(0,mc.__)("Small viewport smallest dimension (svmin)"),step:.1},lvw:{value:"lvw",label:jc?"lvw":(0,mc.__)("Large viewport width (lvw)"),a11yLabel:(0,mc.__)("Large viewport width (lvw)"),step:.1},lvh:{value:"lvh",label:jc?"lvh":(0,mc.__)("Large viewport height (lvh)"),a11yLabel:(0,mc.__)("Large viewport height (lvh)"),step:.1},lvi:{value:"lvi",label:jc?"lvi":(0,mc.__)("Large viewport width or height (lvi)"),a11yLabel:(0,mc.__)("Large viewport width or height (lvi)"),step:.1},lvb:{value:"lvb",label:jc?"lvb":(0,mc.__)("Large viewport width or height (lvb)"),a11yLabel:(0,mc.__)("Large viewport width or height (lvb)"),step:.1},lvmin:{value:"lvmin",label:jc?"lvmin":(0,mc.__)("Large viewport smallest dimension (lvmin)"),a11yLabel:(0,mc.__)("Large viewport smallest dimension (lvmin)"),step:.1},dvw:{value:"dvw",label:jc?"dvw":(0,mc.__)("Dynamic viewport width (dvw)"),a11yLabel:(0,mc.__)("Dynamic viewport width (dvw)"),step:.1},dvh:{value:"dvh",label:jc?"dvh":(0,mc.__)("Dynamic viewport height (dvh)"),a11yLabel:(0,mc.__)("Dynamic viewport height (dvh)"),step:.1},dvi:{value:"dvi",label:jc?"dvi":(0,mc.__)("Dynamic viewport width or height (dvi)"),a11yLabel:(0,mc.__)("Dynamic viewport width or height (dvi)"),step:.1},dvb:{value:"dvb",label:jc?"dvb":(0,mc.__)("Dynamic viewport width or height (dvb)"),a11yLabel:(0,mc.__)("Dynamic viewport width or height (dvb)"),step:.1},dvmin:{value:"dvmin",label:jc?"dvmin":(0,mc.__)("Dynamic viewport smallest dimension (dvmin)"),a11yLabel:(0,mc.__)("Dynamic viewport smallest dimension (dvmin)"),step:.1},dvmax:{value:"dvmax",label:jc?"dvmax":(0,mc.__)("Dynamic viewport largest dimension (dvmax)"),a11yLabel:(0,mc.__)("Dynamic viewport largest dimension (dvmax)"),step:.1},svmax:{value:"svmax",label:jc?"svmax":(0,mc.__)("Small viewport largest dimension (svmax)"),a11yLabel:(0,mc.__)("Small viewport largest dimension (svmax)"),step:.1},lvmax:{value:"lvmax",label:jc?"lvmax":(0,mc.__)("Large viewport largest dimension (lvmax)"),a11yLabel:(0,mc.__)("Large viewport largest dimension (lvmax)"),step:.1}},pW=Object.values(uo),BW=[uo.px,uo["%"],uo.em,uo.
Line truncated
|
||||
${l}`}function AU(c){let{active:l,borderRadius:t="inherit",className:e,focus:d,hover:b,isInteractive:o=!1,offset:n=0,value:G=0,...X}=cc(c,"Elevation"),i=Xc(),a=(0,zU.useMemo)(()=>{let m=Dt(b)?b:G*2,x=Dt(l)?l:G/2;o||(m=Dt(b)?b:void 0,x=Dt(l)?l:void 0);let s=`box-shadow ${w.transitionDuration} ${w.transitionTimingFunction}`,r={};return r.Base=O({borderRadius:t,bottom:n,boxShadow:QW(G),opacity:w.elevationIntensity,left:n,right:n,top:n},O("@media not ( prefers-reduced-motion ){transition:",s,";}",""),"",""),Dt(m)&&(r.hover=O("*:hover>&{box-shadow:",QW(m),";}","")),Dt(x)&&(r.active=O("*:active>&{box-shadow:",QW(x),";}","")),Dt(d)&&(r.focus=O("*:focus>&{box-shadow:",QW(d),";}","")),i(kU,r.Base,r.hover,r.focus,r.active,e)},[l,t,e,i,d,b,o,n,G]);return{...X,className:a,"aria-hidden":!0}}var OU=u(V(),1);function q0c(c,l){let t=AU(c);return(0,OU.jsx)(ic,{...t,ref:l})}var $0c=tc(q0c,"Elevation"),a0=$0c;var ur=`calc(${w.radiusLarge} - 1px)`,QU=O("box-shadow:0 0 0 1px ",w.surfaceBorderColor,";outline:none;",""),wU={name:"1showjb",styles:"border-bottom:1px solid;box-sizing:border-box;&:last-child{border-bottom:none;}"},TU={name:"14n5oej",styles:"border-top:1px solid;box-sizing:border-box;&:first-of-type{border-top:none;}"},DU={name:"13udsys",styles:"height:100%"},LU={name:"6ywzd",styles:"box-sizing:border-box;height:auto;max-height:100%"},UU={name:"dq805e",styles:"box-sizing:border-box;overflow:hidden;&>img,&>iframe{display:block;height:auto;max-width:100%;width:100%;}"},jU={name:"c990dr",styles:"box-sizing:border-box;display:block;width:100%"},VG=O("&:first-of-type{border-top-left-radius:",ur,";border-top-right-radius:",ur,";}&:last-of-type{border-bottom-left-radius:",ur,";border-bottom-right-radius:",ur,";}",""),u0=O("border-color:",w.colorDivider,";",""),EU={name:"1t90u8d",styles:"box-shadow:none"},wW={name:"1e1ncky",styles:"border:none"},MU=O("border-radius:",ur,";",""),m0=O("background-color:",D.ui.backgroundDisabled,";","");var lj=u(ml(),1),tj=u(Y(),1);var $U=u(Y(),1);var PU=O("background-color:",w.surfaceColor,";color:",D.gray[900],";position:relative;",""),XGl=O("background-color:",w.surfaceBackgroundColor,";","");function KU({borderBottom:c,borderLeft:l,borderRight:t,borderTop:e}){let d=`1px solid ${w.surfaceBorderColor}`;return O({borderBottom:c?d:void 0,borderLeft:l?d:void 0,borderRight:t?d:void 0,borderTop:e?d:void 0},"","")}var cmc=O("",""),lmc=O("background:",w.surfaceBackgroundTintColor,";",""),tmc=O("background:",w.surfaceBackgroundTertiaryColor,";",""),_U=c=>[c,c].join(" "),emc=c=>["90deg",[w.surfaceBackgroundColor,c].join(" "),"transparent 1%"].join(","),dmc=c=>[[w.surfaceBackgroundColor,c].join(" "),"transparent 1%"].join(","),bmc=c=>[`linear-gradient( ${emc(c)} ) center`,`linear-gradient( ${dmc(c)} ) center`,w.surfaceBorderBoldColor].join(","),omc=(c,l)=>O("background:",bmc(l),";background-size:",_U(c),";",""),nmc=[`${w.surfaceBorderSubtleColor} 1px`,"transparent 1px"].join(","),Gmc=["90deg",`${w.surfaceBorderSubtleColor} 1px`,"transparent 1px"].join(","),Xmc=[`linear-gradient( ${nmc} )`,`linear-gradient( ${Gmc} )`].join(","),imc=c=>O("background:",w.surfaceBackgroundColor,";background-image:",Xmc,";background-size:",_U(c),";",""),qU=(c,l,t)=>{switch(c){case"dotted":return omc(l,t);case"grid":return imc(l);case"primary":return cmc;case"secondary":return lmc;case"tertiary":return tmc}};function TW(c){let{backgroundSize:l=12,borderBottom:t=!1,borderLeft:e=!1,borderRight:d=!1,borderTop:b=!1,className:o,variant:n="primary",...G}=cc(c,"Surface"),X=Xc(),i=(0,$U.useMemo)(()=>{let a={borders:KU({borderBottom:t,borderLeft:e,borderRight:d,borderTop:b})};return X(PU,a.borders,qU(n,`${l}px`,`${l-1}px`),o)},[l,t,e,d,b,o,X,n]);return{...G,className:i}}var cj=u(V(),1);function umc(c,l){let t=TW(c);return(0,cj.jsx)(ic,{...t,ref:l})}var mmc=tc(umc,"Surface"),pJ=mmc;function xmc({elevation:c,isElevated:l,...t}){let e={...t},d=c;return l&&((0,lj.default)("Card isElevated prop",{since:"5.9",alternative:"elevation"}),d??=2),typeof d<"u"&&(e.elevation=d),e}function BJ(c){let{className:l,elevation:t=0,isBorderless:e=!1,isRounded:d=!0,size:b="medium",...o}=cc(xmc(c),"Card"),n=Xc(),G=(0,tj.useMemo)(()=>n(QU,e&&EU,d&&MU,l),[l,n,e,d]);return{...TW({...o,className:G}),elevation:t,isBorderless:e,isRounded:d,size:b}}var Zi=u(V(),1);function smc(c,l){let{children:t,elevation:e,isBorderless:d,isRounded:b,size:o,...n}=BJ(c),G=b?w.radiusLarge:0,X=Xc(),i=(0,yJ.useMemo)(()=>X(O({borderRadius:G},"","")),[X,G]),a=(0,yJ.useMemo)(()=>{let m={size:o,isBorderless:d};return{CardBody:m,CardHeader:m,CardFooter:m}},[d,o]);return(0,Zi.jsx)(DX,{value:a,children:(0,Zi.jsxs)(ic,{...n,ref:l,children:[(0,Zi.jsx)(ic,{className:X(DU),children:t}),(0,Zi.jsx)(a0,{className:i,isInteractive:!1,value:e?1:0}),(0,Zi.jsx)(a0,{className:i,isInteractive:!1,value:e})]})})}var rmc=tc(smc,"Card"),DW=rmc;var Xj=u(Y(),1);var ej=O("@media only screen and ( min-device-width: 40em ){&::-webkit-scrollbar{height:12px;width:12px;}&::-webkit-scrollbar-track{background-color:
Line truncated
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
`,kE=N("svg",{target:"ea4tfvq2"})("width:",w.spinnerSize,"px;height:",w.spinnerSize,"px;display:inline-block;margin:5px 11px 0;position:relative;color:",D.theme.accent,";overflow:visible;opacity:1;background-color:transparent;"),zE={name:"9s4963",styles:"fill:transparent;stroke-width:1.5px"},AE=N("circle",{target:"ea4tfvq1"})(zE,";stroke:",D.gray[300],";"),OE=N("path",{target:"ea4tfvq0"})(zE,";stroke:currentColor;stroke-linecap:round;transform-origin:50% 50%;animation:1.4s linear infinite both ",hxc,";");var QE=u(Y(),1),rr=u(V(),1);function Yxc({className:c,...l},t){return(0,rr.jsxs)(kE,{className:Q("components-spinner",c),viewBox:"0 0 100 100",width:"16",height:"16",xmlns:"http://www.w3.org/2000/svg",role:"presentation",focusable:"false",...l,ref:t,children:[(0,rr.jsx)(AE,{cx:"50",cy:"50",r:"50",vectorEffect:"non-scaling-stroke"}),(0,rr.jsx)(OE,{d:"m 50 0 a 50 50 0 0 1 50 50",vectorEffect:"non-scaling-stroke"})]})}var wE=(0,QE.forwardRef)(Yxc);wE.displayName="Spinner";var W0=wE;var xb=u(V(),1),Fxc=()=>{},vxc=gp(class extends ke.Component{handleFocusOutside(l){this.props.onFocusOutside(l)}render(){return this.props.children}}),Zp=(c,l)=>c===null?-1:l.indexOf(c);function DE(c){let{__next40pxDefaultSize:l=!1,value:t,label:e,options:d,onChange:b,onFilterValueChange:o=Fxc,hideLabelFromVision:n,help:G,allowReset:X=!0,className:i,isLoading:a=!1,messages:m={selected:(0,CG.__)("Item selected.")},__experimentalRenderItem:x,expandOnFocus:s=!0,placeholder:r}=Et(c),[g,Z]=de({value:t,onChange:b}),H=d.find(M=>M.value===g),R=H?.label??"",W=(0,TE.useInstanceId)(DE,"combobox-control"),[I,B]=(0,ke.useState)(H||null),[p,y]=(0,ke.useState)(!1),[h,C]=(0,ke.useState)(!1),[J,f]=(0,ke.useState)(""),k=(0,ke.useRef)(null),F=(0,ke.useMemo)(()=>{let M=[],oc=[],Hc=Es(J);return d.forEach(Bc=>{let wc=Es(Bc.label).indexOf(Hc);wc===0?M.push(Bc):wc>0&&oc.push(Bc)}),M.concat(oc)},[J,d]),T=M=>{M.disabled||(Z(M.value),(0,qJ.speak)(m.selected,"assertive"),B(M),f(""),y(!1))},L=(M=1)=>{let Hc=Zp(I,F)+M;Hc<0?Hc=F.length-1:Hc>=F.length&&(Hc=0),B(F[Hc]),y(!0)},v=Vd(M=>{let oc=!1;if(!M.defaultPrevented){switch(M.code){case"Enter":I&&(T(I),oc=!0);break;case"ArrowUp":L(-1),oc=!0;break;case"ArrowDown":L(1),oc=!0;break;case"Escape":y(!1),B(null),oc=!0;break;default:break}oc&&M.preventDefault()}}),A=()=>{C(!1)},S=()=>{C(!0),s&&y(!0),o(""),f("")},U=()=>{y(!0)},P=()=>{y(!1)},bc=M=>{let oc=M.value;f(oc),o(oc),h&&y(!0)},j=()=>{Z(null),k.current?.focus()},ec=M=>{M.stopPropagation()};return(0,ke.useEffect)(()=>{let M=F.length>0,oc=Zp(I,F)>0;M&&!oc&&B(F[0])},[F,I]),(0,ke.useEffect)(()=>{let M=F.length>0;if(p){let oc=M?(0,CG.sprintf)((0,CG._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",F.length),F.length):(0,CG.__)("No results.");(0,qJ.speak)(oc,"polite")}},[F,p]),Lc({componentName:"ComboboxControl",__next40pxDefaultSize:l,size:void 0}),(0,xb.jsx)(vxc,{onFocusOutside:P,children:(0,xb.jsx)(Dc,{className:Q(i,"components-combobox-control"),label:e,id:`components-form-token-input-${W}`,hideLabelFromVision:n,help:G,children:(0,xb.jsxs)("div",{className:"components-combobox-control__suggestions-container",tabIndex:-1,onKeyDown:v,children:[(0,xb.jsxs)(FE,{__next40pxDefaultSize:l,children:[(0,xb.jsx)(Xe,{children:(0,xb.jsx)(mp,{className:"components-combobox-control__input",instanceId:W,ref:k,placeholder:r,value:p?J:R,onFocus:S,onBlur:A,onClick:U,isExpanded:p,selectedSuggestionIndex:Zp(I,F),onChange:bc})}),a&&(0,xb.jsx)(W0,{}),X&&!!g&&!p&&(0,xb.jsx)(lc,{size:"small",icon:PX,onClick:j,onKeyDown:ec,label:(0,CG.__)("Reset")})]}),p&&!a&&(0,xb.jsx)(xp,{instanceId:W,match:{label:J,value:""},displayTransform:M=>M.label,suggestions:F,selectedIndex:Zp(I,F),onHover:B,onSelect:T,scrollIntoView:!0,__experimentalRenderItem:x})]})})})}var Hp=DE;var LE=u(Y(),1),ch=u(dc(),1),lh=u(ml(),1);var th=u(V(),1);function UE(c){if(c.state){let{state:l,...t}=c,{store:e,...d}=UE(l);return{...t,...d,store:e}}return c}var $J={__unstableComposite:"Composite",__unstableCompositeGroup:"Composite.Group or Composite.Row",__unstableCompositeItem:"Composite.Item",__unstableUseCompositeState:"Composite"};function eh(c,l={}){let t=c.displayName??"",e=d=>{(0,lh.default)(`wp.components.${t}`,{since:"6.7",alternative:$J.hasOwnProperty(t)?$J[t]:void 0});let{store:b,...o}=UE(d),n=o;return n={...n,id:(0,ch.useInstanceId)(b,n.baseId,n.id)},Object.entries(l).forEach(([G,X])=>{n.hasOwnProperty(G)&&(Object.assign(n,{[X]:n[G]}),delete n[G])}),delete n.baseId,(0,th.jsx)(c,{...n,store:b})};return e.displayName=t,e}var Nxc=(0,LE.forwardRef)(({role:c,...l},t)=>{let e=c==="row"?Qt.Row:Qt.Group;return(0,th.jsx)(e,{ref:t,role:c,...l})}),dh=eh(Object.assign(Qt,{displayName:"__unstableComposite"}),{baseId:"id"}),jE=eh(Object.assign(Nxc,{displayName:"__unstableCompositeGroup"})),EE=eh(Object.assign(Qt.Item,{displayName:"__unstableCompositeItem"}),{focusable:"accessibleWhenDisabled"});function ME(c={}){(0,lh.default)("wp.components.__unstableUseComposite
Line truncated
|
||||
pointer-events: none;
|
||||
`," &&&{border-radius:",w.radiusRound,";height:",z(7),";width:",z(7),";font-weight:400;",c=>c.isSelected&&`
|
||||
background: ${D.theme.accent};
|
||||
|
||||
&,
|
||||
&:hover:not(:disabled, [aria-disabled=true]) {
|
||||
color: ${D.theme.accentInverted};
|
||||
}
|
||||
|
||||
&:focus:not(:disabled),
|
||||
&:focus:not(:disabled) {
|
||||
border: ${w.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;
|
||||
}
|
||||
`," ",c=>!c.isSelected&&c.isToday&&`
|
||||
background: ${D.theme.gray[200]};
|
||||
`,";}",c=>c.hasEvents&&`
|
||||
::before {
|
||||
border: 2px solid ${c.isSelected?D.theme.accentInverted:D.theme.accent};
|
||||
border-radius: ${w.radiusRound};
|
||||
content: " ";
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
transform: translate(-50%, 9px);
|
||||
}
|
||||
`,";");var gn=class extends Date{constructor(){super(),this.setTime(arguments.length===0?Date.now():arguments.length===1?typeof arguments[0]=="string"?+new Date(arguments[0]):arguments[0]:Date.UTC(...arguments))}getTimezoneOffset(){return 0}},DM=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(c=>{if(DM.test(c)){let l=Date.prototype[c.replace(DM,"$1UTC")];l&&(gn.prototype[c]=l)}});var kxl=new Intl.DateTimeFormat("en-US",{weekday:"short",timeZone:"UTC"}),zxl=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",timeZone:"UTC"}),Axl=new Intl.DateTimeFormat("en-GB",{hour12:!1,hour:"numeric",minute:"numeric",second:"numeric",timeZone:"UTC"});var dd=u(Rr(),1);function Ir(c){if(typeof c=="string")return/Z|[+-]\d{2}(:?\d{2})?$/.test(c)?new gn(new Date(c)):new gn((0,dd.getDate)(c).getTime());let l=c instanceof Date?c.getTime():c;return new gn(l)}function YG(c){let l=Number((0,dd.date)("Y",c)),t=Number((0,dd.date)("n",c))-1,e=Number((0,dd.date)("j",c));return new Date(l,t,e,0,0,0,0)}function Zh(c,l){return l?(c%12+12)%24:c%12}function LM(c){return c%12||12}function Wr(c){return(l,t)=>{let e={...l};return(t.type===_X||t.type===aG||t.type===qX)&&e.value!==void 0&&(e.value=e.value.toString().padStart(c,"0")),e}}var Hh=(c,l)=>new Date(c,l+1,0).getDate();function J0(c,l){let t={year:Number((0,dd.date)("Y",c)),month:Number((0,dd.date)("n",c))-1,date:Number((0,dd.date)("j",c)),hours:Number((0,dd.date)("H",c)),minutes:Number((0,dd.date)("i",c)),seconds:Number((0,dd.date)("s",c)),...l},e=Hh(t.year,t.month);t.date=Math.min(t.date,e);let d=String(t.year).padStart(4,"0"),b=String(t.month+1).padStart(2,"0"),o=String(t.date).padStart(2,"0"),n=String(t.hours).padStart(2,"0"),G=String(t.minutes).padStart(2,"0"),X=String(t.seconds).padStart(2,"0"),i=`${d}-${b}-${o}T${n}:${G}:${X}`;return new gn((0,dd.getDate)(i).getTime())}function Cp(c){let l=c.target?.ownerDocument.defaultView?.HTMLInputElement??HTMLInputElement;return c.target instanceof l?c.target.validity.valid:!1}var Zn="Y-m-d\\TH:i:s";var zd=u(V(),1);function osc({currentDate:c,onChange:l,events:t=[],isInvalidDate:e,onMonthPreviewed:d,startOfWeek:b=0}){let o=Ir(c??new Date),{calendar:n,viewing:G,setSelected:X,setViewing:i,isSelected:a,viewPreviousMonth:m,viewNextMonth:x}=fM({selected:[YG(o)],viewing:YG(o),weekStartsOn:b}),[s,r]=(0,FG.useState)(YG(o)),[g,Z]=(0,FG.useState)(!1),[H,R]=(0,FG.useState)(c);return c!==H&&(R(c),X([YG(o)]),i(YG(o)),r(YG(o))),(0,zd.jsxs)(SM,{className:"components-datetime__date",role:"application","aria-label":(0,re.__)("Calendar"),children:[(0,zd.jsxs)(kM,{children:[(0,zd.jsx)(zM,{icon:(0,re.isRTL)()?QR:AR,variant:"tertiary","aria-label":(0,re.__)("View previous month"),onClick:()=>{m(),r(C0(s,1));let W=C0(G,1);d?.((0,bd.dateI18n)(Zn,W,-W.getTimezoneOffset()))},size:"compact"}),(0,zd.jsxs)(OM,{level:3,children:[(0,zd.jsx)("strong",{children:(0,bd.dateI18n)("F",G,-G.getTimezoneOffset())})," ",(0,bd.dateI18n)("Y",G,-G.getTimezoneOffset())]}),(0,zd.jsx)(AM,{icon:(0,re.isRTL)()?AR:QR,variant:"tertiary","aria-label":(0,re.__)("View next month"),onClick:()=>{x(),r(gb(s,1));let W=gb(G,1);d?.((0,bd.dateI18n)(Zn,W,-W.getTimezoneOffset()))},size:"compact"})]}),(0,zd.jsxs)(QM,{onFocus:()=>Z(!0),onBlur:()=>Z(!1),children:[n[0][0].map(W=>(0,zd.jsx)(wM,{children:(0,bd.dateI18n)("D",W,-W.getTimezoneOffset())},W.toString())),n[0].map(W=>W.map((I,B)=>gh(I,G)?(0,zd.jsx)(nsc,{day:I,column:B+1,isSelected:a(I),isFocusable:yi(I,s),isFocusAllowed:g,isToday:mh(I,YG(new Date)),isInvalid:e?e(I):!1,numEvents:t.filter(p=>mh(p.date,I)).length,onClick:()=>{X([I]),r(I);let p=J0(o,{year:I.getFullYear(),month:I.getMonth(),date:I.getDate()});l?.((0,bd.date)(Zn,p))},onKeyDown:p=>{let y;if(p.key==="ArrowLeft"&&(y=JG(I,(0,re.isRTL)()?1:-1)),p.key==="ArrowRight"&&(y=JG(I,(0,re.isRTL)()?-1:1)),p.key==="ArrowUp"&&(y=YM(I,1)),p.key==="ArrowDown"&&(y=V0(I,1)),p.key==="PageUp"&&(y=C0(I,1)),p.key==="PageDown"&&(y=gb(I,1)),p.key==="Home"){let C=(I.getDay()-b+7)%7;y=VM(I,C)}if(p.key==="End"){let h=I.getDay(),C=(b+6-h)%7;y=JG(I,C)}y&&(p.preventDefault(),r(y),gh(y,G)||(i(y),d?.((0,bd.dateI18n)(Zn,y,-y.getTimezoneOffset()))))}},I.toString()):null))]})]})}function nsc({day:c,column:l,isSelected:t,isFocusable:e,isFocusAllowed:d,isToday:b,isInvalid:o,numEvents:n,onClick:G,onKeyDown:X}){let i=(0,FG.useRef)(null);return(0,FG.useEffect)(()=>{i.current&&e&&d&&i.current.focus()},[e]),(0,zd.jsx)(TM,{__next40pxDefaultSize:!0,ref:i,className:"components-datetime__date__day",disabled:o,tabIndex:e?0:-1,"aria-label":Gsc(c,t,b,n),column:l,isSelected:t,isToday:b,hasEvents:n>0,onClick:G,onKeyDown:X,children:(0,bd.dateI18n)("j",c,-c.getTimezoneOffset())})}function Gsc(c,l,t,e){let{formats:d}=(0,bd.getSettings)(),o=[(0,bd.dateI18n)(d.date,c,-c.getTimezoneOffset())];return l&&o.push((0,re.__)("Selected")),t&&o.push((0,re.__)("Today")),e>0&&o.push((0,re.sprintf)((0,re._n)("There is %d event","There are %d events",e),e)),o.join(". ")}var pr=osc;var Y0=u(Y(),1),lt=u(nc(),1),Hn=u(Rr(),1);var
Line truncated
|
||||
`,w.controlHeight," - ",w.borderWidth,` * 2
|
||||
);display:inline-block;`),PM=N(Yt,{target:"evcr2314"})(Jp," width:",z(9),";&&& ",db,"{padding-left:0;}&&& ",yd,"{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;}"),KM=N("div",{target:"evcr2313"})({name:"1ff36h2",styles:"flex-grow:1"}),_M=N(Yt,{target:"evcr2312"})(Jp," width:",z(9),";"),qM=N(Yt,{target:"evcr2311"})(Jp," width:",z(14),";"),Rh=N("div",{target:"evcr2310"})({name:"ebu3jh",styles:"text-decoration:underline dotted"});var hp=u(V(),1),Xsc=()=>{let{timezone:c}=(0,c7.getSettings)(),l=-1*(new Date().getTimezoneOffset()/60);if(Number(c.offset)===l)return null;let t=Number(c.offset)>=0?"+":"",e=c.abbr!==""&&isNaN(Number(c.abbr))?c.abbr:`UTC${t}${c.offsetFormatted}`,d=c.string.replace("_"," "),b=c.string==="UTC"?(0,$M.__)("Coordinated Universal Time"):`(${e}) ${d}`;return d.trim().length===0?(0,hp.jsx)(Rh,{className:"components-datetime__timezone",children:e}):(0,hp.jsx)(Ne,{placement:"top",text:b,children:(0,hp.jsx)(Rh,{className:"components-datetime__timezone",children:e})})},l7=Xsc;var h0=u(nc(),1),t7=u(Y(),1);var Ad=u(V(),1);function Ih({value:c,defaultValue:l,is12Hour:t,label:e,minutesProps:d,onChange:b}){let[o={hours:new Date().getHours(),minutes:new Date().getMinutes()},n]=de({value:c,onChange:b,defaultValue:l}),G=m(o.hours),X=LM(o.hours),i=s=>(r,{event:g})=>{if(!Cp(g))return;let Z=Number(r);n({...o,[s]:s==="hours"&&t?Zh(Z,G==="PM"):Z})},a=s=>()=>{G!==s&&n({...o,hours:Zh(X,s==="PM")})};function m(s){return s<12?"AM":"PM"}return(0,Ad.jsxs)(e?Br:t7.Fragment,{children:[e&&(0,Ad.jsx)(Dc.VisualLabel,{as:"legend",children:e}),(0,Ad.jsxs)(Uc,{alignment:"left",expanded:!1,children:[(0,Ad.jsxs)(jM,{className:"components-datetime__time-field components-datetime__time-field-time",children:[(0,Ad.jsx)(EM,{className:"components-datetime__time-field-hours-input",label:(0,h0.__)("Hours"),hideLabelFromVision:!0,__next40pxDefaultSize:!0,value:String(t?X:o.hours).padStart(2,"0"),step:1,min:t?1:0,max:t?12:23,required:!0,spinControls:"none",isPressEnterToChange:!0,isDragEnabled:!1,isShiftStepEnabled:!1,onChange:i("hours"),__unstableStateReducer:Wr(2)}),(0,Ad.jsx)(MM,{className:"components-datetime__time-separator","aria-hidden":"true",children:":"}),(0,Ad.jsx)(PM,{className:Q("components-datetime__time-field-minutes-input",d?.className),label:(0,h0.__)("Minutes"),hideLabelFromVision:!0,__next40pxDefaultSize:!0,value:String(o.minutes).padStart(2,"0"),step:1,min:0,max:59,required:!0,spinControls:"none",isPressEnterToChange:!0,isDragEnabled:!1,isShiftStepEnabled:!1,onChange:(...s)=>{i("minutes")(...s),d?.onChange?.(...s)},__unstableStateReducer:Wr(2),...d})]}),t&&(0,Ad.jsxs)(hd,{__next40pxDefaultSize:!0,isBlock:!0,label:(0,h0.__)("Select AM or PM"),hideLabelFromVision:!0,value:G,onChange:s=>{a(s)()},children:[(0,Ad.jsx)(on,{value:"AM",label:(0,h0.__)("AM")}),(0,Ad.jsx)(on,{value:"PM",label:(0,h0.__)("PM")})]})]})]})}var Ht=u(V(),1),isc=["dmy","mdy","ymd"];function Wh({is12Hour:c,currentTime:l,onChange:t,dateOrder:e,hideLabelFromVision:d=!1}){let[b,o]=(0,Y0.useState)(()=>sh(Ir(l??new Date)));(0,Y0.useEffect)(()=>{o(sh(Ir(l??new Date)))},[l]);let n=[{value:"01",label:(0,lt.__)("January")},{value:"02",label:(0,lt.__)("February")},{value:"03",label:(0,lt.__)("March")},{value:"04",label:(0,lt.__)("April")},{value:"05",label:(0,lt.__)("May")},{value:"06",label:(0,lt.__)("June")},{value:"07",label:(0,lt.__)("July")},{value:"08",label:(0,lt.__)("August")},{value:"09",label:(0,lt.__)("September")},{value:"10",label:(0,lt.__)("October")},{value:"11",label:(0,lt.__)("November")},{value:"12",label:(0,lt.__)("December")}],{day:G,month:X,year:i,minutes:a,hours:m}=(0,Y0.useMemo)(()=>({day:(0,Hn.date)("d",b),month:(0,Hn.date)("m",b),year:(0,Hn.date)("Y",b),minutes:(0,Hn.date)("i",b),hours:(0,Hn.date)("H",b)}),[b]),x=I=>(p,{event:y})=>{if(!Cp(y))return;let h=Number(p),C=J0(b,{[I]:h});o(C),t?.((0,Hn.date)(Zn,C))},s=({hours:I,minutes:B})=>{let p=J0(b,{hours:I,minutes:B});o(p),t?.((0,Hn.date)(Zn,p))},r=(0,Ht.jsx)(_M,{className:"components-datetime__time-field components-datetime__time-field-day",label:(0,lt.__)("Day"),hideLabelFromVision:!0,__next40pxDefaultSize:!0,value:G,step:1,min:1,max:Hh(Number(i),Number(X)-1),required:!0,spinControls:"none",isPressEnterToChange:!0,isDragEnabled:!1,isShiftStepEnabled:!1,onChange:x("date")},"day"),g=(0,Ht.jsx)(KM,{children:(0,Ht.jsx)(Fd,{className:"components-datetime__time-field components-datetime__time-field-month",label:(0,lt.__)("Month"),hideLabelFromVision:!0,__next40pxDefaultSize:!0,value:X,options:n,onChange:I=>{let B=J0(b,{month:Number(I)-1});o(B),t?.((0,Hn.date)(Zn,B))}})},"month"),Z=(0,Ht.jsx)(qM,{className:"components-datetime__time-field components-datetime__time-field-year",label:(0,lt.__)("Year"),hideLabelFromVision:!0,__next40pxDefaultSize:!0,value:i,step:1,min:1,max:9999,required:!0,spinControls:"none",isPressEnterToChange:!0,isDragEnabled:!1,isShiftStepEnabled:!1,onChange:x("year"),__unstableStateReducer:Wr(4)},"year"),H=c?"mdy":"dmy",W=(e&&isc.includes(e)?e:H).sp
Line truncated
|
||||
box-shadow: rgb( 0 0 0 / 12% ) 0px 0px 10px;
|
||||
transform: scale( 1.1 );
|
||||
cursor: grabbing;
|
||||
`,";");var M7=u(V(),1);function P7({left:c="50%",top:l="50%",...t}){return(0,M7.jsx)(E7,{...t,className:"components-focal-point-picker__icon_container",style:{left:c,top:l}})}var Ci=u(V(),1);function K7({bounds:c,...l}){return(0,Ci.jsxs)(D7,{...l,className:"components-focal-point-picker__grid",style:{width:c.width,height:c.height},children:[(0,Ci.jsx)(Nh,{style:{top:"33%"}}),(0,Ci.jsx)(Nh,{style:{top:"66%"}}),(0,Ci.jsx)(fh,{style:{left:"33%"}}),(0,Ci.jsx)(fh,{style:{left:"66%"}})]})}var Np=u(V(),1);function _7({alt:c,autoPlay:l,src:t,onLoad:e,mediaRef:d,muted:b=!0,...o}){return t?k7(t)?(0,Np.jsx)("video",{...o,autoPlay:l,className:"components-focal-point-picker__media components-focal-point-picker__media--video",loop:!0,muted:b,onLoadedData:e,ref:d,src:t}):(0,Np.jsx)("img",{...o,alt:c,className:"components-focal-point-picker__media components-focal-point-picker__media--image",onLoad:e,ref:d,src:t}):(0,Np.jsx)(Q7,{className:"components-focal-point-picker__media components-focal-point-picker__media--placeholder",ref:d,...o})}var Zb=u(V(),1),vsc=600;function Nsc({__nextHasNoMarginBottom:c,autoPlay:l=!0,className:t,help:e,hideLabelFromVision:d,label:b,onChange:o,onDrag:n,onDragEnd:G,onDragStart:X,resolvePoint:i,url:a,value:m={x:.5,y:.5},...x}){let[s,r]=(0,Rn.useState)(m),[g,Z]=(0,Rn.useState)(!1),{startDrag:H,endDrag:R,isDragging:W}=(0,fp.__experimentalUseDragging)({onDragStart:v=>{p.current?.focus();let A=J(v);A&&(X?.(A,v),r(A))},onDragMove:v=>{v.preventDefault();let A=J(v);A&&(n?.(A,v),r(A))},onDragEnd:()=>{G?.(),o?.(s)}}),{x:I,y:B}=W?s:m,p=(0,Rn.useRef)(null),[y,h]=(0,Rn.useState)(N0),C=(0,Rn.useRef)(()=>{if(!p.current)return;let{clientWidth:v,clientHeight:A}=p.current;h(v>0&&A>0?{width:v,height:A}:{...N0})});(0,Rn.useEffect)(()=>{let v=C.current;if(!p.current)return;let{defaultView:A}=p.current.ownerDocument;return A?.addEventListener("resize",v),()=>A?.removeEventListener("resize",v)},[]),(0,fp.useIsomorphicLayoutEffect)(()=>{C.current()},[]);let J=({clientX:v,clientY:A,shiftKey:S})=>{if(!p.current)return;let{top:U,left:P}=p.current.getBoundingClientRect(),bc=(v-P)/y.width,j=(A-U)/y.height;return S&&(bc=Math.round(bc/.1)*.1,j=Math.round(j/.1)*.1),f({x:bc,y:j})},f=v=>{let A=i?.(v)??v;A.x=Math.max(0,Math.min(A.x,1)),A.y=Math.max(0,Math.min(A.y,1));let S=U=>Math.round(U*100)/100;return{x:S(A.x),y:S(A.y)}},k=v=>{let{code:A,shiftKey:S}=v;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(A))return;v.preventDefault();let U={x:I,y:B},P=S?.1:.01,bc=A==="ArrowUp"||A==="ArrowLeft"?-1*P:P,j=A==="ArrowUp"||A==="ArrowDown"?"y":"x";U[j]=U[j]+bc,o?.(f(U))},F={left:I!==void 0?I*y.width:.5*y.width,top:B!==void 0?B*y.height:.5*y.height},T=Q("components-focal-point-picker-control",t),L=d?Qc:cd;return OX(()=>{Z(!0);let v=window.setTimeout(()=>{Z(!1)},vsc);return()=>window.clearTimeout(v)},[I,B]),(0,Zb.jsxs)(z7,{...x,as:"fieldset",className:T,children:[!!b&&(0,Zb.jsx)(L,{as:"legend",children:b}),(0,Zb.jsx)(A7,{className:"components-focal-point-picker-wrapper",children:(0,Zb.jsxs)(O7,{className:"components-focal-point-picker",onKeyDown:k,onMouseDown:H,onBlur:()=>{W&&R()},ref:p,role:"button",tabIndex:-1,children:[(0,Zb.jsx)(K7,{bounds:y,showOverlay:g}),(0,Zb.jsx)(_7,{alt:(0,q7.__)("Media preview"),autoPlay:l,onLoad:C.current,src:a}),(0,Zb.jsx)(P7,{...F,isDragging:W})]})}),(0,Zb.jsx)(j7,{hasHelpText:!!e,point:{x:I,y:B},onChange:v=>{o?.(f(v))}}),!!e&&(0,Zb.jsx)(bb,{children:e})]})}var $7=Nsc;var Sp=u(dc(),1),c4=u(ml(),1),l4=u(V(),1);function t4({iframeRef:c,...l}){let t=(0,Sp.useMergeRefs)([c,(0,Sp.useFocusableIframe)()]);return(0,c4.default)("wp.components.FocusableIframe",{since:"5.9",alternative:"wp.compose.useFocusableIframe"}),(0,l4.jsx)("iframe",{ref:t,...l})}var Ji=u(nc(),1);var kp=u(Y(),1),r4=u(dc(),1);var e4=N("fieldset",{target:"e8tqeku4"})({name:"k2q51s",styles:"border:0;margin:0;padding:0;display:contents"}),d4=N(Uc,{target:"e8tqeku3"})("height:",z(4),";"),b4=N(lc,{target:"e8tqeku2"})("margin-top:",z(-1),";"),o4=N(Dc.VisualLabel,{target:"e8tqeku1"})("display:flex;gap:",z(1),";justify-content:flex-start;margin-bottom:0;"),n4=N(pp,{target:"e8tqeku0"})({name:"anvx77",styles:".components-custom-select-control__item .components-custom-select-control__item-hint{width:100%;}"});var S0=u(nc(),1),X4=u(Y(),1);function fsc(c){return/^[\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.test(String(c))}function G4(c){if(c.hint)return c.hint;if(fsc(c.size))return String(c.size)}var i4=u(V(),1),Sh={key:"default",name:(0,S0.__)("Default"),value:void 0},Ssc=c=>{let{__next40pxDefaultSize:l,fontSizes:t,value:e,size:d,valueMode:b="literal",onChange:o}=c,n=[Sh,...t.map(X=>{let i=G4(X);return{key:X.slug,name:X.name||X.slug,value:X.size,hint:i}})],G=(0,X4.useMemo)(()=>{if(e===void 0)return Sh;if(b==="slug"){let X=n.find(i=>i.key===e);if(X)return X}return n.find(X=>X.value===e)??Sh},[e,b,n]);return(0,i4.jsx)(n4,{__next40pxDefaultSize:l,__shouldNotWar
Line truncated
|
||||
in srgb,
|
||||
`,D.theme.foreground,`,
|
||||
transparent 90%
|
||||
);border-radius:`,w.radiusFull,";outline:2px solid transparent;outline-offset:2px;:where( & ){width:160px;}"),Mrc={name:"152sa26",styles:"width:var(--indicator-width);transition:width 0.4s ease-in-out"},jP=N("div",{target:"e15u147w1"})("display:inline-block;position:absolute;top:0;height:100%;border-radius:",w.radiusFull,`;background-color:color-mix(
|
||||
in srgb,
|
||||
`,D.theme.foreground,`,
|
||||
transparent 10%
|
||||
);outline:2px solid transparent;outline-offset:-2px;`,({isIndeterminate:c})=>c?O({animationDuration:"1.5s",animationTimingFunction:"ease-in-out",animationIterationCount:"infinite",animationName:jrc((0,LP.isRTL)()),width:`${Erc}%`},"",""):Mrc,";"),EP=N("progress",{target:"e15u147w0"})({name:"11fb690",styles:"position:absolute;top:0;left:0;opacity:0;width:100%;height:100%"});var Tr=u(V(),1);function Krc(c,l){let{className:t,value:e,...d}=c,b=!Number.isFinite(e);return(0,Tr.jsxs)(UP,{className:t,children:[(0,Tr.jsx)(jP,{style:{"--indicator-width":b?void 0:`${e}%`},isIndeterminate:b}),(0,Tr.jsx)(EP,{max:100,value:e,"aria-label":(0,MP.__)("Loading \u2026"),ref:l,...d})]})}var KP=(0,PP.forwardRef)(Krc);KP.displayName="ProgressBar";var _P=KP;var Gd=u(nc(),1);var _rc=c=>c.every(l=>l.parent!==null);function RB(c){let l=c.map(d=>({children:[],parent:null,...d,id:String(d.id)}));if(!_rc(l))return l;let t=l.reduce((d,b)=>{let{parent:o}=b;return d[o]||(d[o]=[]),d[o].push(b),d},{}),e=d=>d.map(b=>{let o=t[b.id];return{...b,children:o&&o.length?e(o):[]}});return e(t[0]||[])}var cK=u(Y(),1),lK=u($P(),1);var tK=u(V(),1);function eK(c,l=0){return c.flatMap(t=>[{value:t.id,label:"\xA0".repeat(l*3)+(0,lK.decodeEntities)(t.name)},...eK(t.children||[],l+1)])}function qrc(c){let{__nextHasNoMarginBottom:l,label:t,noOptionLabel:e,onChange:d,selectedId:b,tree:o=[],...n}=Et(c),G=(0,cK.useMemo)(()=>[e&&{value:"",label:e},...eK(o)].filter(X=>!!X),[e,o]);return Lc({componentName:"TreeSelect",size:n.size,__next40pxDefaultSize:n.__next40pxDefaultSize}),(0,tK.jsx)($s,{__shouldNotWarnDeprecated36pxSize:!0,label:t,options:G,onChange:d,value:b,...n})}var L0=qrc;var dK=u(V(),1);function bK({__next40pxDefaultSize:c,label:l,noOptionLabel:t,authorList:e,selectedAuthorId:d,onChange:b}){if(!e)return null;let o=RB(e);return(0,dK.jsx)(L0,{label:l,noOptionLabel:t,onChange:b,tree:o,selectedId:d!==void 0?String(d):void 0,__next40pxDefaultSize:c})}var oK=u(Y(),1);var nK=u(V(),1);function GK({__next40pxDefaultSize:c,label:l,noOptionLabel:t,categoriesList:e,selectedCategoryId:d,onChange:b,...o}){let n=(0,oK.useMemo)(()=>RB(e),[e]);return(0,nK.jsx)(L0,{label:l,noOptionLabel:t,onChange:b,tree:n,selectedId:d!==void 0?String(d):void 0,...o,__next40pxDefaultSize:c})}var zi=u(V(),1),$rc=1,cgc=100,lgc=20;function tgc(c){return"categoriesList"in c}function egc(c){return"categorySuggestions"in c}var dgc=[{label:(0,Gd.__)("Newest to oldest"),value:"date/desc"},{label:(0,Gd.__)("Oldest to newest"),value:"date/asc"},{label:(0,Gd.__)("A \u2192 Z"),value:"title/asc"},{label:(0,Gd.__)("Z \u2192 A"),value:"title/desc"}];function bgc({authorList:c,selectedAuthorId:l,numberOfItems:t,order:e,orderBy:d,orderByOptions:b=dgc,maxItems:o=cgc,minItems:n=$rc,onAuthorChange:G,onNumberOfItemsChange:X,onOrderChange:i,onOrderByChange:a,...m}){return(0,zi.jsx)(al,{spacing:"4",className:"components-query-controls",children:[i&&a&&(0,zi.jsx)(Fd,{__next40pxDefaultSize:!0,label:(0,Gd.__)("Order by"),value:d===void 0||e===void 0?void 0:`${d}/${e}`,options:b,onChange:x=>{if(typeof x!="string")return;let[s,r]=x.split("/");r!==e&&i(r),s!==d&&a(s)}},"query-controls-order-select"),tgc(m)&&m.categoriesList&&m.onCategoryChange&&(0,zi.jsx)(GK,{__next40pxDefaultSize:!0,categoriesList:m.categoriesList,label:(0,Gd.__)("Category"),noOptionLabel:(0,Gd._x)("All","categories"),selectedCategoryId:m.selectedCategoryId,onChange:m.onCategoryChange},"query-controls-category-select"),egc(m)&&m.categorySuggestions&&m.onCategoryChange&&(0,zi.jsx)(Qp,{__next40pxDefaultSize:!0,label:(0,Gd.__)("Categories"),value:m.selectedCategories&&m.selectedCategories.map(x=>({id:x.id,value:x.name||x.value})),suggestions:Object.keys(m.categorySuggestions),onChange:m.onCategoryChange,maxSuggestions:lgc},"query-controls-categories-select"),G&&(0,zi.jsx)(bK,{__next40pxDefaultSize:!0,authorList:c,label:(0,Gd.__)("Author"),noOptionLabel:(0,Gd._x)("All","authors"),selectedAuthorId:l,onChange:G},"query-controls-author-select"),X&&(0,zi.jsx)(vd,{__next40pxDefaultSize:!0,label:(0,Gd.__)("Number of items"),value:t,onChange:X,min:n,max:o,required:!0},"query-controls-range-control")]})}var XK=bgc;var IB=u(Y(),1);var iK=u(Y(),1),Dr=(0,iK.createContext)({store:void 0,disabled:void 0});Dr.displayName="RadioGroupContext";var Mh=u(V(),1);function ogc({value:c,children:l,...t},e){let{store:d,disabled:b}=(0,IB.useContext)(Dr),o=xc(d,"value"),n=o!==void 0&&o===c;return Lc({componentName:"Radio",size:void 0,__next40pxDefaultSize:t.__next40pxDefaultSize}),(0,Mh.jsx)(BX,{disabled:b,store:d,ref:e,value:c,render:(0,Mh.jsx)(lc,{variant:n?"primary":"secondary",...t}),children:l||c})}var aK=(0,IB.forwardRef)(ogc);aK.displayName="Radio";var uK=aK;var mK=u(ml(),1),pB=u(Y(),1),xK=u(nc(),1);var WB=u(V(),1);function ngc({label:c,checked:l,defaultChecked:t,disabled:e,onChange:d,children:b,...o},n){let G=yX({value:l,defaultValue:t,setValue:i=>{d?.(i??void 0)},rtl:(0,xK.isRTL)()}),X=(0,pB.useMemo)(()=>({store:G,disabled:e}),[G,e]);return(0,mK.default)("wp.componen
Line truncated
|
||||
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;
|
||||
}
|
||||
`;function Ngc({html:c,title:l,type:t,styles:e,scripts:d}){let b=(0,vl.jsxs)("html",{lang:document.documentElement.lang,className:t,children:[(0,vl.jsxs)("head",{children:[(0,vl.jsx)("title",{children:l}),(0,vl.jsx)("style",{dangerouslySetInnerHTML:{__html:UK}}),e.map((o,n)=>(0,vl.jsx)("style",{dangerouslySetInnerHTML:{__html:o}},n))]}),(0,vl.jsxs)("body",{"data-resizable-iframe-connected":"data-resizable-iframe-connected",className:t,children:[(0,vl.jsx)("div",{dangerouslySetInnerHTML:{__html:c}}),(0,vl.jsx)("script",{type:"text/javascript",dangerouslySetInnerHTML:{__html:`(${LK.toString()})();`}}),d.map(o=>(0,vl.jsx)("script",{src:o},o))]})]});return"<!DOCTYPE html>"+(0,pt.renderToString)(b)}function fgc({html:c="",title:l="",type:t,styles:e=[],scripts:d=[],onFocus:b,tabIndex:o}){let n=(0,pt.useRef)(null),[G,X]=(0,pt.useState)(0),[i,a]=(0,pt.useState)(0),m=(0,pt.useMemo)(()=>Ngc({html:c,title:l,type:t,styles:e,scripts:d}),[c,l,t,e,d]);return(0,pt.useEffect)(()=>{let x=n.current;if(!x)return;function s(Z){if(!x||x.contentWindow!==Z.source)return;let H=Z.data||{};if(typeof H=="string")try{H=JSON.parse(H)}catch{}H.action==="resize"&&(X(H.width),a(H.height))}let r=null;function g(){let Z=x?.ownerDocument?.defaultView??null;Z!==r&&(r?.removeEventListener("message",s),r=Z,r?.addEventListener("message",s))}return g(),x.addEventListener("load",g),()=>{x.removeEventListener("load",g),r?.removeEventListener("message",s)}},[]),(0,vl.jsx)("iframe",{ref:(0,j0.useMergeRefs)([n,(0,j0.useFocusableIframe)()]),title:l,tabIndex:o,className:"components-sandbox",sandbox:"allow-scripts allow-presentation",srcDoc:m,onFocus:b,width:Math.ceil(G),height:Math.ceil(i)})}function Sgc({html:c="",title:l="",type:t,styles:e=[],scripts:d=[],onFocus:b,tabIndex:o}){let n=(0,pt.useRef)(null),[G,X]=(0,pt.useState)(0),[i,a]=(0,pt.useState)(0);function m(){try{return!!n.current?.contentDocument?.body}catch{return!1}}function x(s=!1){if(!m())return;let{contentDocument:r,ownerDocument:g}=n.current;if(!s&&r?.body.getAttribute("data-resizable-iframe-connected")!==null)return;let Z=(0,vl.jsxs)("html",{lang:g.documentElement.lang,className:t,children:[(0,vl.jsxs)("head",{children:[(0,vl.jsx)("title",{children:l}),(0,vl.jsx)("style",{dangerouslySetInnerHTML:{__html:UK}}),e.map((H,R)=>(0,vl.jsx)("style",{dangerouslySetInnerHTML:{__html:H}},R))]}),(0,vl.jsxs)("body",{"data-resizable-iframe-connected":"data-resizable-iframe-connected",className:t,children:[(0,vl.jsx)("div",{dangerouslySetInnerHTML:{__html:c}}),(0,vl.jsx)("script",{type:"text/javascript",dangerouslySetInnerHTML:{__html:`(${LK.toString()})();`}}),d.map(H=>(0,vl.jsx)("script",{src:H},H))]})]});r.open(),r.write("<!DOCTYPE html>"+(0,pt.renderToString)(Z)),r.close()}return(0,pt.useEffect)(()=>{x();function s(){x(!1)}function r(H){let R=n.current;if(!R||R.contentWindow!==H.source)return;let W=H.data||{};if(typeof W=="string")try{W=JSON.parse(W)}catch{}W.action==="resize"&&(X(W.width),a(W.height))}let g=n.current,Z=g?.ownerDocument?.defaultView;return g?.addEventListener("load",s,!1),Z?.addEventListener("message",r),()=>{g?.removeEventListener("load",s,!1),Z?.removeEventListener("message",r)}},[]),(0,pt.useEffect)(()=>{x()},[l,e,d]),(0,pt.useEffect)(()=>{x(!0)},[c,t]),(0,vl.jsx)("iframe",{ref:(0,j0.useMergeRefs)([n,(0,j0.useFocusableIframe)()]),title:l,tabIndex:o,className:"components-sandbox",sandbox:"allow-scripts allow-same-origin allow-presentation",onFocus:b,width:Math.ceil(G),height:Math.ceil(i)})}function kgc({allowSameOrigin:c=!1,...l}){return c?(0,vl.jsx)(Sgc,{...l}):(0,vl.jsx)(fgc,{...l})}var jK=kgc;var EK=u(eo(),1),Bb=u(Y(),1),lY=u(nc(),1),tpl=u(Ge(),1);var TG=u(V(),1),zgc=6e3;function Agc(c,l){let t=typeof c=="string"?c:(0,Bb.renderToString)(c);(0,Bb.useEffect)(()=>{t&&(0,EK.speak)(t,l)},[t,l])}function Ogc({className:c,children:l,spokenMessage:t=l,politeness:e="polite",actions:d=[],onRemove:b,icon:o=null,explicitDismiss:n=!1,onDismiss:G,listRef:X},i){function a(g){g&&g.preventDefault&&g.preventDefault(),X?.current?.focus(),G?.(),b?.()}function m(g,Z){g.stopPropagation(),b?.(),Z&&Z(g)}Agc(t,e);let x=(0,Bb.useRef)({onDismiss:G,onRemove:b});(0,Bb.useLayoutEffect)(()=>{x.current={onDismiss:G,onRemove:b}}),(0,Bb.useEffect)(()=>{let g=setTimeout(()=>{n||(x.current.onDismiss?.(),x.current.onRemove?.())},zgc);return()=>clearTimeout(g)},[n]);let s=Q(c,"components-snackbar",{"components-snackbar-explicit-dismiss":!!n});d&&d.length>1&&(d=[d[0]]);let r=Q("components-snackbar__content",{"components-snackbar__content-with-icon":!!o});return(0,TG.jsx)("div",{ref:i,className:s,onClick:n?void 0:a,tabIndex:0,role:n?void 0:"button",onKeyPress:n?void 0:a,"aria-label":n?void 0:(0,lY.__)("Dismiss this notice"),"data-testid":"snackbar",children:(0,TG.jsxs)("div",{className:r,children:[o&&(0,TG.jsx)("div",{className:"components-snackbar__icon",children:o}),l,d.map(({label:g,onClick:Z,url:H,openInNewTab:R=!1},W)=>H!==void 0&&R?(0,TG.jsx)(vp,{href:H,onClick:I=>m(I,Z),className:"components-snackbar__action"
Line truncated
|
||||
-`,Lt.SLIDE_DISTANCE,`
|
||||
);}&[data-side='top']{transform:translateY(
|
||||
`,Lt.SLIDE_DISTANCE,`
|
||||
);}&[data-side='left']{transform:translateX(
|
||||
`,Lt.SLIDE_DISTANCE,`
|
||||
);}&[data-side='right']{transform:translateX(
|
||||
-`,Lt.SLIDE_DISTANCE,`
|
||||
);}&[data-enter][data-side='bottom'],&[data-enter][data-side='top']{transform:translateY( 0 );}&[data-enter][data-side='left'],&[data-enter][data-side='right']{transform:translateX( 0 );}}}`),FY=O("all:unset;position:relative;min-height:",z(8),";box-sizing:border-box;grid-column:1/-1;display:grid;grid-template-columns:",S8,";align-items:center;@supports ( grid-template-columns: subgrid ){grid-template-columns:subgrid;}font-size:",fl("default.fontSize"),";font-family:inherit;font-weight:normal;line-height:20px;color:",D.theme.foreground,";border-radius:",w.radiusSmall,";padding-block:",fZc,";padding-inline:",hY,";scroll-margin:",N8,";user-select:none;outline:none;&[aria-disabled='true']{color:",D.ui.textDisabled,`;cursor:not-allowed;}&[data-active-item]:not( [data-focus-visible] ):not(
|
||||
[aria-disabled='true']
|
||||
){background-color:`,D.theme.accent,";color:",D.theme.accentInverted,";}&[data-focus-visible]{box-shadow:0 0 0 1.5px ",D.theme.accent,";outline:2px solid transparent;}&:active,&[data-active]{}",Li,':not(:focus) &:not(:focus)[aria-expanded="true"]{background-color:',zZc,";color:",D.theme.foreground,";}svg{fill:currentColor;}",""),k8=N(Nx,{target:"e1wg7tti12"})(FY,";"),X5=N(yZ,{target:"e1wg7tti11"})(FY,";"),i5=N(VZ,{target:"e1wg7tti10"})(FY,";"),K0=N("span",{target:"e1wg7tti9"})("grid-column:1;",X5,">&,",i5,">&{min-width:",z(6),";}",X5,">&,",i5,">&,&:not( :empty ){margin-inline-end:",z(2),";}display:flex;align-items:center;justify-content:center;color:",YY,";[data-active-item]:not( [data-focus-visible] )>&,[aria-disabled='true']>&{color:inherit;}"),_0=N("div",{target:"e1wg7tti8"})("grid-column:2;display:flex;align-items:center;justify-content:space-between;gap:",z(3),";pointer-events:none;"),q0=N("div",{target:"e1wg7tti7"})("flex:1;display:inline-flex;flex-direction:column;gap:",z(1),";"),$0=N("span",{target:"e1wg7tti6"})("flex:0 1 fit-content;min-width:0;width:fit-content;display:flex;align-items:center;justify-content:center;gap:",z(3),";color:",YY,";[data-active-item]:not( [data-focus-visible] ) *:not(",Li,") &,[aria-disabled='true'] *:not(",Li,") &{color:inherit;}"),z8=N(pZ,{target:"e1wg7tti5"})({name:"49aokf",styles:"display:contents"}),A8=N(BZ,{target:"e1wg7tti4"})("grid-column:1/-1;padding-block-start:",z(3),";padding-block-end:",z(2),";padding-inline:",hY,";"),O8=N(CZ,{target:"e1wg7tti3"})("grid-column:1/-1;border:none;height:",w.borderWidth,";background-color:",c=>c.variant==="toolbar"?f8:kZc,";margin-block:",z(2),";margin-inline:",hY,";outline:2px solid transparent;"),Q8=N(cl,{target:"e1wg7tti2"})("width:",z(1.5),";",Fc({transform:"scaleX(1)"},{transform:"scaleX(-1)"}),";"),w8=N(cn,{target:"e1wg7tti1"})("font-size:",fl("default.fontSize"),";line-height:20px;color:inherit;"),T8=N(cn,{target:"e1wg7tti0"})("font-size:",fl("helpText.fontSize"),";line-height:16px;color:",YY,";overflow-wrap:anywhere;[data-active-item]:not( [data-focus-visible] ) *:not( ",Li," ) &,[aria-disabled='true'] *:not( ",Li," ) &{color:inherit;}");var Ui=u(V(),1),u5=(0,a5.forwardRef)(function({prefix:l,suffix:t,children:e,disabled:d=!1,hideOnClick:b=!0,store:o,...n},G){let X=(0,a5.useContext)(gl);if(!X?.store)throw new Error("Menu.Item can only be rendered inside a Menu component");let i=o??X.store;return(0,Ui.jsxs)(k8,{ref:G,...n,accessibleWhenDisabled:!0,disabled:d,hideOnClick:b,store:i,children:[(0,Ui.jsx)(K0,{children:l}),(0,Ui.jsxs)(_0,{children:[(0,Ui.jsx)(q0,{children:e}),t&&(0,Ui.jsx)($0,{children:t})]})]})});var m5=u(Y(),1);var Jn=u(V(),1),D8=(0,m5.forwardRef)(function({suffix:l,children:t,disabled:e=!1,hideOnClick:d=!1,...b},o){let n=(0,m5.useContext)(gl);if(!n?.store)throw new Error("Menu.CheckboxItem can only be rendered inside a Menu component");return(0,Jn.jsxs)(X5,{ref:o,...b,accessibleWhenDisabled:!0,disabled:e,hideOnClick:d,store:n.store,children:[(0,Jn.jsx)(Ya,{store:n.store,render:(0,Jn.jsx)(K0,{}),style:{width:"auto",height:"auto"},children:(0,Jn.jsx)(Cl,{icon:jt,size:24})}),(0,Jn.jsxs)(_0,{children:[(0,Jn.jsx)(q0,{children:t}),l&&(0,Jn.jsx)($0,{children:l})]})]})});var x5=u(Y(),1);var s5=u(kc(),1),Vb=u(V(),1),QZc=(0,Vb.jsx)(s5.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Vb.jsx)(s5.Circle,{cx:12,cy:12,r:3})}),L8=(0,x5.forwardRef)(function({suffix:l,children:t,disabled:e=!1,hideOnClick:d=!1,...b},o){let n=(0,x5.useContext)(gl);if(!n?.store)throw new Error("Menu.RadioItem can only be rendered inside a Menu component");return(0,Vb.jsxs)(i5,{ref:o,...b,accessibleWhenDisabled:!0,disabled:e,hideOnClick:d,store:n.store,children:[(0,Vb.jsx)(Ya,{store:n.store,render:(0,Vb.jsx)(K0,{}),style:{width:"auto",height:"auto"},children:(0,Vb.jsx)(Cl,{icon:QZc,size:24})}),(0,Vb.jsxs)(_0,{children:[(0,Vb.jsx)(q0,{children:t}),l&&(0,Vb.jsx)($0,{children:l})]})]})});var r5=u(Y(),1);var U8=u(V(),1),j8=(0,r5.forwardRef)(function(l,t){let e=(0,r5.useContext)(gl);if(!e?.store)throw new Error("Menu.Group can only be rendered inside a Menu component");return(0,U8.jsx)(z8,{ref:t,...l,store:e.store})});var g5=u(Y(),1);var vY=u(V(),1),E8=(0,g5.forwardRef)(function(l,t){let e=(0,g5.useContext)(gl);if(!e?.store)throw new Error("Menu.GroupLabel can only be rendered inside a Menu component");return(0,vY.jsx)(A8,{ref:t,render:(0,vY.jsx)(Jt,{upperCase:!0,variant:"muted",size:"11px",weight:500,lineHeight:"16px"}),...l,store:e.store})});var Z5=u(Y(),1);var M8=u(V(),1),P8=(0,Z5.forwardRef)(function(l,t){let e=(0,Z5.useContext)(gl);if(!e?.store)throw new Error("Menu.Separator can only be rendered inside a Menu component");return(0,M8.jsx)(O8,{ref:t,...l,store:e.store,variant:e.variant})});var H5=u(Y(),1);var K8=u(V(),1),_8=(0,H5.forwardRef)(function(l,t){if(!(0,H5.useContext)(gl)?.store)throw new Error("Menu.ItemLabel can only be rendered inside a Menu component");return(0,K8.jsx)(w8,{numberOfLines:1,ref:t,...l})});var R5
Line truncated
|
||||
to var( --direction-end ),
|
||||
var( --fade-gradient-base )
|
||||
);}&.is-overflowing-last{mask-image:linear-gradient(
|
||||
to var( --direction-start ),
|
||||
var( --fade-gradient-base )
|
||||
);}&.is-overflowing-first.is-overflowing-last{mask-image:linear-gradient(
|
||||
to right,
|
||||
var( --fade-gradient-composed )
|
||||
),linear-gradient( to left, var( --fade-gradient-composed ) );}&::before{bottom:0;height:0;width:calc( var( --antialiasing-factor ) * 1px );transform:translateX(
|
||||
calc(
|
||||
var( --selected-start ) * var( --direction-factor ) *
|
||||
1px
|
||||
)
|
||||
) scaleX(
|
||||
calc(
|
||||
var( --selected-width, 0 ) /
|
||||
var( --antialiasing-factor )
|
||||
)
|
||||
);border-bottom:var( --wp-admin-border-width-focus ) solid `,D.theme.accent,";}}&[aria-orientation='vertical']{&::before{border-radius:",w.radiusSmall,`/calc(
|
||||
`,w.radiusSmall,` /
|
||||
(
|
||||
var( --selected-height, 0 ) /
|
||||
var( --antialiasing-factor )
|
||||
)
|
||||
);top:0;left:0;width:100%;height:calc( var( --antialiasing-factor ) * 1px );transform:translateY( calc( var( --selected-top, 0 ) * 1px ) ) scaleY(
|
||||
calc(
|
||||
var( --selected-height, 0 ) /
|
||||
var( --antialiasing-factor )
|
||||
)
|
||||
);background-color:color-mix(
|
||||
in srgb,
|
||||
`,D.theme.accent,`,
|
||||
transparent 96%
|
||||
);}&[data-select-on-move='true']:has(
|
||||
:is( :focus-visible, [data-focus-visible] )
|
||||
)::before{box-sizing:border-box;border:var( --wp-admin-border-width-focus ) solid `,D.theme.accent,`;border-block-width:calc(
|
||||
var( --wp-admin-border-width-focus, 1px ) /
|
||||
(
|
||||
var( --selected-height, 0 ) /
|
||||
var( --antialiasing-factor )
|
||||
)
|
||||
);}}`),sq=N(na,{target:"enfox0g3"})("&{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-family:",fl("default.fontFamily"),";font-weight:400;font-size:",fl("default.fontSize"),";color:",D.theme.foreground,";position:relative;&[aria-disabled='true']{cursor:default;color:",D.ui.textDisabled,";}&:not( [aria-disabled='true'] ):is( :hover, [data-focus-visible] ){color:",D.theme.accent,";}&:focus:not( :disabled ){box-shadow:none;outline:none;}&::after{position:absolute;pointer-events:none;outline:var( --wp-admin-border-width-focus ) solid ",D.theme.accent,";border-radius:",w.radiusSmall,";opacity:0;@media not ( prefers-reduced-motion ){transition:opacity 0.1s linear;}}&[data-focus-visible]::after{opacity:1;}}[aria-orientation='horizontal'] &{padding-inline:",z(4),";height:",z(12),";scroll-margin:24px;&::after{content:'';inset:",z(3),";}}[aria-orientation='vertical'] &{padding:",z(2)," ",z(3),";min-height:",z(10),";&[aria-selected='true']{color:",D.theme.accent,";fill:currentColor;}}[aria-orientation='vertical'][data-select-on-move='false'] &::after{content:'';inset:var( --wp-admin-border-width-focus );}"),rq=N("span",{target:"enfox0g2"})({name:"9at4z3",styles:"flex-grow:1;display:flex;align-items:center;[aria-orientation='horizontal'] &{justify-content:center;}[aria-orientation='vertical'] &{justify-content:start;}"}),gq=N(cl,{target:"enfox0g1"})("flex-shrink:0;margin-inline-end:",z(-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;}"),Zq=N(xa,{target:"enfox0g0"})("&:focus{box-shadow:none;outline:none;}&[data-focus-visible]{box-shadow:0 0 0 var( --wp-admin-border-width-focus ) ",D.theme.accent,";outline:2px solid transparent;outline-offset:0;}");var bg=u(V(),1),Rq=(0,Hq.forwardRef)(function({children:l,tabId:t,disabled:e,render:d,...b},o){let{store:n,instanceId:G}=cm()??{};if(!n)return null;let X=`${G}-${t}`;return(0,bg.jsxs)(sq,{ref:o,store:n,id:X,disabled:e,render:d,...b,children:[(0,bg.jsx)(rq,{children:l}),(0,bg.jsx)(gq,{icon:MX})]})});var W1l=u(Ge(),1),lm=u(Y(),1),pq=u(dc(),1);var ji=u(Y(),1),Iq=u(dc(),1);function Wq(c,l){let[t,e]=(0,ji.useState)(!1),[d,b]=(0,ji.useState)(!1),[o,n]=(0,ji.useState)(),G=(0,Iq.useEvent)(X=>{for(let i of X)i.target===l.first&&e(!i.isIntersecting),i.target===l.last&&b(!i.isIntersecting)});return(0,ji.useEffect)(()=>{if(!c||!window.IntersectionObserver)return;let X=new IntersectionObserver(G,{root:c,threshold:.9});return n(X),()=>X.disconnect()},[G,c]),(0,ji.useEffect)(()=>{if(o)return l.first&&o.observe(l.first),l.last&&o.observe(l.last),()=>{l.first&&o.unobserve(l.first),l.last&&o.unobserve(l.last)}},[l.first,l.last,o]),{first:t,last:d}}var fY=u(V(),1),PZc=24;function KZc(c,l,{margin:t=PZc}={}){(0,lm.useLayoutEffect)(()=>{if(!c||!l)return;let{scrollLeft:e}=c,d=c.getBoundingClientRect().width,{left:b,width:o}=l,n=e+d,X=b+o+t-n,i=e-(b-t),a=null;i>0?a=e-i:X>0&&(a=e+X),a!==null&&c.scroll?.({left:a})},[t,c,l])}var Bq=(0,lm.forwardRef)(function({children:l,...t},e){let{store:d}=cm()??{},b=xc(d,"selectedId"),o=xc(d,"activeId"),n=xc(d,"selectOnMove"),G=xc(d,"items"),[X,i]=(0,lm.useState)(),a=(0,pq.useMergeRefs)([e,i]),m=d?.item(b),x=xc(d,"renderedItems"),s=x&&m?x.indexOf(m):-1,r=nW(m?.element,[s]),g=Wq(X,{first:G?.at(0)?.element,last:G?.at(-1)?.element});XW(X,r,{prefix:"selected",dataAttribute:"indicator-animated",transitionEndFilter:H=>H.pseudoElement==="::before",roundRect:!0}),KZc(X,r);let Z=()=>{n&&b!==o&&d?.setActiveId(b)};return d?(0,fY.jsx)(xq,{ref:a,store:d,render:H=>(0,fY.jsx)("div",{...H,tabIndex:H.tabIndex??-1}),onBlur:Z,"data-select-on-move":n?"true":"false",...t,className:Q(g.first&&"is-overflowing-first",g.last&&"is-overflowing-last",t.className),children:l}):null});var yq=u(Y(),1);var v1l=u(Ge(),1);var Vq=u(V(),1),Cq=(0,yq.forwardRef)(function({children:l,tabId:t,focusable:e=!0,...d},b){let o=cm(),n=xc(o?.store,"selectedId");if(!o)return null;let{store:G,instanceId:X}=o,i=`${X}-${t}`;return(0,Vq.jsx)(Zq,{ref:b,store:G,id:`${i}-view`,tabId:i,focusable:e,...d,children:n===i&&l})});var Fq=u(V(),1);function y5(c,l){return c&&`${l}-${c}`}function Jq(c,l){return typeof c=="string"?c.replace(`${l}-`,""):c}var vq=Object.assign(function c({selectOnMove:l=!0,defaultTabId:t,orientation:e="horizontal",onSelect:d,children:b,selectedTabId:o,activeTabId:n,defaultActiveTabId:G,onActiveTabIdChange:X}){let i=(0,hq.useInstanceId)(c,"tabs"),a=mX({selectOnMove:l,orientation:e,defaultSelectedId:y5(t,i),setSelectedId:g=>{d?.(Jq(g,i))},selectedId:y5(o,i),defaultActiveId:y5(G,i),setActiveId:g=>{X?.(Jq(g,i))},activeId:y5(n,i),rtl:(0,Yq.isRTL)()}),{items:m,activeId:x}=xc(a),{setActiveId:s}=a;(0,V5.useEffe
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
||||
(**
|
||||
* @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.
|
||||
*)
|
||||
|
||||
react-is/cjs/react-is.production.min.js:
|
||||
(** @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.
|
||||
*)
|
||||
|
||||
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.
|
||||
*)
|
||||
*/
|
||||
Vendored
+2445
File diff suppressed because it is too large.
Load diff
Vendored
+1
@@ -0,0 +1 @@
|
||||
"use strict";var wp;(wp||={}).compose=(()=>{var xr=Object.create;var le=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var Cr=Object.getOwnPropertyNames;var Rr=Object.getPrototypeOf,Or=Object.prototype.hasOwnProperty;var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Tr=(e,t)=>{for(var r in t)le(e,r,{get:t[r],enumerable:!0})},et=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Cr(t))!Or.call(e,o)&&o!==r&&le(e,o,{get:()=>t[o],enumerable:!(n=Sr(t,o))||n.enumerable});return e};var d=(e,t,r)=>(r=e!=null?xr(Rr(e)):{},et(t||!e||!e.__esModule?le(r,"default",{value:e,enumerable:!0}):r,e)),Lr=e=>et(le({},"__esModule",{value:!0}),e);var Z=B((Mn,st)=>{st.exports=window.ReactJSXRuntime});var lt=B((An,ct)=>{ct.exports=window.wp.isShallowEqual});var b=B((kn,dt)=>{dt.exports=window.wp.element});var me=B((Un,ht)=>{ht.exports=window.wp.deprecated});var ye=B((ro,Mt)=>{Mt.exports=window.wp.dom});var _e=B((co,zt)=>{zt.exports=window.wp.keycodes});var Nt=B((Do,De)=>{(function(e,t,r){if(!e)return;for(var n={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"},o={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},i={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},c={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},s,f=1;f<20;++f)n[111+f]="f"+f;for(f=0;f<=9;++f)n[f+96]=f.toString();function p(u,a,m){if(u.addEventListener){u.addEventListener(a,m,!1);return}u.attachEvent("on"+a,m)}function y(u){if(u.type=="keypress"){var a=String.fromCharCode(u.which);return u.shiftKey||(a=a.toLowerCase()),a}return n[u.which]?n[u.which]:o[u.which]?o[u.which]:String.fromCharCode(u.which).toLowerCase()}function R(u,a){return u.sort().join(",")===a.sort().join(",")}function O(u){var a=[];return u.shiftKey&&a.push("shift"),u.altKey&&a.push("alt"),u.ctrlKey&&a.push("ctrl"),u.metaKey&&a.push("meta"),a}function A(u){if(u.preventDefault){u.preventDefault();return}u.returnValue=!1}function k(u){if(u.stopPropagation){u.stopPropagation();return}u.cancelBubble=!0}function E(u){return u=="shift"||u=="ctrl"||u=="alt"||u=="meta"}function z(){if(!s){s={};for(var u in n)u>95&&u<112||n.hasOwnProperty(u)&&(s[n[u]]=u)}return s}function T(u,a,m){return m||(m=z()[u]?"keydown":"keypress"),m=="keypress"&&a.length&&(m="keydown"),m}function K(u){return u==="+"?["+"]:(u=u.replace(/\+{2}/g,"+plus"),u.split("+"))}function F(u,a){var m,l,L,v=[];for(m=K(u),L=0;L<m.length;++L)l=m[L],c[l]&&(l=c[l]),a&&a!="keypress"&&i[l]&&(l=i[l],v.push("shift")),E(l)&&v.push(l);return a=T(l,v,a),{key:l,modifiers:v,action:a}}function N(u,a){return u===null||u===t?!1:u===a?!0:N(u.parentNode,a)}function C(u){var a=this;if(u=u||t,!(a instanceof C))return new C(u);a.target=u,a._callbacks={},a._directMap={};var m={},l,L=!1,v=!1,M=!1;function W(h){h=h||{};var g=!1,x;for(x in m){if(h[x]){g=!0;continue}m[x]=0}g||(M=!1)}function ue(h,g,x,w,S,$){var _,D,Y=[],Q=x.type;if(!a._callbacks[h])return[];for(Q=="keyup"&&E(h)&&(g=[h]),_=0;_<a._callbacks[h].length;++_)if(D=a._callbacks[h][_],!(!w&&D.seq&&m[D.seq]!=D.level)&&Q==D.action&&(Q=="keypress"&&!x.metaKey&&!x.ctrlKey||R(g,D.modifiers))){var Er=!w&&D.combo==S,_r=w&&D.seq==w&&D.level==$;(Er||_r)&&a._callbacks[h].splice(_,1),Y.push(D)}return Y}function We(h,g,x,w){a.stopCallback(g,g.target||g.srcElement,x,w)||h(g,x)===!1&&(A(g),k(g))}a._handleKey=function(h,g,x){var w=ue(h,g,x),S,$={},_=0,D=!1;for(S=0;S<w.length;++S)w[S].seq&&(_=Math.max(_,w[S].level));for(S=0;S<w.length;++S){if(w[S].seq){if(w[S].level!=_)continue;D=!0,$[w[S].seq]=1,We(w[S].callback,x,w[S].combo,w[S].seq);continue}D||We(w[S].callback,x,w[S].combo)}var Y=x.type=="keypress"&&v;x.type==M&&!E(h)&&!Y&&W($),v=D&&x.type=="keydown"};function Ue(h){typeof h.which!="number"&&(h.which=h.keyCode);var g=y(h);if(g){if(h.type=="keyup"&&L===g){L=!1;return}a.handleKey(g,O(h),h)}}function br(){clearTimeout(l),l=setTimeout(W,1e3)}function gr(h,g,x,w){m[h]=0;function S(Q){return function(){M=Q,++m[h],br()}}function $(Q){We(x,Q,h),w!=="keyup"&&(L=y(Q)),setTimeout(W,10)}for(var _=0;_<g.length;++_){var D=_+1===g.length,Y=D?$:S(w||F(g[_+1]).action);Je(g[_],Y,w,h,_)}}function Je(h,g,x,w,S){a._directMap[h+":"+x]=g,h=h.replace(/\s+/g," ");var $=h.split(" "),_;if($.length>1){gr(h,$,g,x);return}_=F(h,x),a._callbacks[_.key]=a._callbacks[_.key]||[],ue(_.key,_.modifiers,{type:_.action},w,h,S),a._callbacks[_.key][w?"unshift":"push"]({callback:g,modifiers:_.modifiers,action:_.action,seq:w,level:S,combo:h})}a._bindMultiple=function(h,g,x){for(var w=0;w<h.length;++w)Je(h[w],g,x)},p(u,"keypress",Ue),p(u,"keydown",Ue),p(u,"keyup",Ue)}C.prototype.bind=fuLine truncated
|
||||
Vendored
+735
@@ -0,0 +1,735 @@
|
||||
var wp;
|
||||
(wp ||= {}).coreCommands = (() => {
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// package-external:@wordpress/element
|
||||
var require_element = __commonJS({
|
||||
"package-external:@wordpress/element"(exports, module) {
|
||||
module.exports = window.wp.element;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/router
|
||||
var require_router = __commonJS({
|
||||
"package-external:@wordpress/router"(exports, module) {
|
||||
module.exports = window.wp.router;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/commands
|
||||
var require_commands = __commonJS({
|
||||
"package-external:@wordpress/commands"(exports, module) {
|
||||
module.exports = window.wp.commands;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/i18n
|
||||
var require_i18n = __commonJS({
|
||||
"package-external:@wordpress/i18n"(exports, module) {
|
||||
module.exports = window.wp.i18n;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/primitives
|
||||
var require_primitives = __commonJS({
|
||||
"package-external:@wordpress/primitives"(exports, module) {
|
||||
module.exports = window.wp.primitives;
|
||||
}
|
||||
});
|
||||
|
||||
// vendor-external:react/jsx-runtime
|
||||
var require_jsx_runtime = __commonJS({
|
||||
"vendor-external:react/jsx-runtime"(exports, module) {
|
||||
module.exports = window.ReactJSXRuntime;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/core-data
|
||||
var require_core_data = __commonJS({
|
||||
"package-external:@wordpress/core-data"(exports, module) {
|
||||
module.exports = window.wp.coreData;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/data
|
||||
var require_data = __commonJS({
|
||||
"package-external:@wordpress/data"(exports, module) {
|
||||
module.exports = window.wp.data;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/url
|
||||
var require_url = __commonJS({
|
||||
"package-external:@wordpress/url"(exports, module) {
|
||||
module.exports = window.wp.url;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/compose
|
||||
var require_compose = __commonJS({
|
||||
"package-external:@wordpress/compose"(exports, module) {
|
||||
module.exports = window.wp.compose;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/html-entities
|
||||
var require_html_entities = __commonJS({
|
||||
"package-external:@wordpress/html-entities"(exports, module) {
|
||||
module.exports = window.wp.htmlEntities;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/private-apis
|
||||
var require_private_apis = __commonJS({
|
||||
"package-external:@wordpress/private-apis"(exports, module) {
|
||||
module.exports = window.wp.privateApis;
|
||||
}
|
||||
});
|
||||
|
||||
// packages/core-commands/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
initializeCommandPalette: () => initializeCommandPalette,
|
||||
privateApis: () => privateApis
|
||||
});
|
||||
var import_element3 = __toESM(require_element(), 1);
|
||||
var import_router2 = __toESM(require_router(), 1);
|
||||
var import_commands3 = __toESM(require_commands(), 1);
|
||||
|
||||
// packages/core-commands/build-module/admin-navigation-commands.mjs
|
||||
var import_commands = __toESM(require_commands(), 1);
|
||||
var import_i18n = __toESM(require_i18n(), 1);
|
||||
|
||||
// packages/icons/build-module/library/brush.mjs
|
||||
var import_primitives = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
|
||||
var brush_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.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" }) });
|
||||
|
||||
// packages/icons/build-module/library/external.mjs
|
||||
var import_primitives2 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
|
||||
var external_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.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" }) });
|
||||
|
||||
// packages/icons/build-module/library/layout.mjs
|
||||
var import_primitives3 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
|
||||
var layout_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.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" }) });
|
||||
|
||||
// packages/icons/build-module/library/navigation.mjs
|
||||
var import_primitives4 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
|
||||
var navigation_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.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" }) });
|
||||
|
||||
// packages/icons/build-module/library/page.mjs
|
||||
var import_primitives5 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
|
||||
var page_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: [
|
||||
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" }),
|
||||
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.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" })
|
||||
] });
|
||||
|
||||
// packages/icons/build-module/library/post.mjs
|
||||
var import_primitives6 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
|
||||
var post_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.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" }) });
|
||||
|
||||
// packages/icons/build-module/library/styles.mjs
|
||||
var import_primitives7 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
|
||||
var styles_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.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" }) });
|
||||
|
||||
// packages/icons/build-module/library/symbol-filled.mjs
|
||||
var import_primitives8 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
||||
var symbol_filled_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.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" }) });
|
||||
|
||||
// packages/icons/build-module/library/symbol.mjs
|
||||
var import_primitives9 = __toESM(require_primitives(), 1);
|
||||
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
||||
var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.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" }) });
|
||||
|
||||
// packages/core-commands/build-module/admin-navigation-commands.mjs
|
||||
var import_element = __toESM(require_element(), 1);
|
||||
var import_core_data = __toESM(require_core_data(), 1);
|
||||
var import_data = __toESM(require_data(), 1);
|
||||
var getViewSiteCommand = () => function useViewSiteCommand() {
|
||||
const homeUrl = (0, import_data.useSelect)((select) => {
|
||||
return select(import_core_data.store).getEntityRecord(
|
||||
"root",
|
||||
"__unstableBase"
|
||||
)?.home;
|
||||
}, []);
|
||||
const commands = (0, import_element.useMemo)(() => {
|
||||
if (!homeUrl) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
{
|
||||
name: "core/view-site",
|
||||
label: (0, import_i18n.__)("View site"),
|
||||
icon: external_default,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
close();
|
||||
window.open(homeUrl, "_blank");
|
||||
}
|
||||
}
|
||||
];
|
||||
}, [homeUrl]);
|
||||
return {
|
||||
isLoading: false,
|
||||
commands
|
||||
};
|
||||
};
|
||||
function useAdminNavigationCommands(menuCommands) {
|
||||
const commands = (0, import_element.useMemo)(() => {
|
||||
return (menuCommands ?? []).map((menuCommand) => {
|
||||
const label = (0, import_i18n.sprintf)(
|
||||
/* translators: %s: menu label */
|
||||
(0, import_i18n.__)("Go to: %s"),
|
||||
menuCommand.label
|
||||
);
|
||||
return {
|
||||
name: menuCommand.name,
|
||||
label,
|
||||
searchLabel: label,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
document.location = menuCommand.url;
|
||||
close();
|
||||
}
|
||||
};
|
||||
});
|
||||
}, [menuCommands]);
|
||||
(0, import_commands.useCommands)(commands);
|
||||
(0, import_commands.useCommandLoader)({
|
||||
name: "core/view-site",
|
||||
hook: getViewSiteCommand()
|
||||
});
|
||||
}
|
||||
|
||||
// packages/core-commands/build-module/site-editor-navigation-commands.mjs
|
||||
var import_commands2 = __toESM(require_commands(), 1);
|
||||
var import_i18n2 = __toESM(require_i18n(), 1);
|
||||
var import_element2 = __toESM(require_element(), 1);
|
||||
var import_data2 = __toESM(require_data(), 1);
|
||||
var import_core_data2 = __toESM(require_core_data(), 1);
|
||||
var import_router = __toESM(require_router(), 1);
|
||||
var import_url = __toESM(require_url(), 1);
|
||||
var import_compose = __toESM(require_compose(), 1);
|
||||
var import_html_entities = __toESM(require_html_entities(), 1);
|
||||
|
||||
// packages/core-commands/build-module/lock-unlock.mjs
|
||||
var import_private_apis = __toESM(require_private_apis(), 1);
|
||||
var { lock, unlock } = (0, import_private_apis.__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"
|
||||
);
|
||||
|
||||
// packages/core-commands/build-module/utils/order-entity-records-by-search.mjs
|
||||
function orderEntityRecordsBySearch(records = [], search = "") {
|
||||
if (!Array.isArray(records) || !records.length) {
|
||||
return [];
|
||||
}
|
||||
if (!search) {
|
||||
return records;
|
||||
}
|
||||
const priority = [];
|
||||
const nonPriority = [];
|
||||
for (let i = 0; i < records.length; i++) {
|
||||
const record = records[i];
|
||||
if (record?.title?.raw?.toLowerCase()?.includes(search?.toLowerCase())) {
|
||||
priority.push(record);
|
||||
} else {
|
||||
nonPriority.push(record);
|
||||
}
|
||||
}
|
||||
return priority.concat(nonPriority);
|
||||
}
|
||||
|
||||
// packages/core-commands/build-module/site-editor-navigation-commands.mjs
|
||||
var { useHistory } = unlock(import_router.privateApis);
|
||||
var icons = {
|
||||
post: post_default,
|
||||
page: page_default,
|
||||
wp_template: layout_default,
|
||||
wp_template_part: symbol_filled_default
|
||||
};
|
||||
function useDebouncedValue(value) {
|
||||
const [debouncedValue, setDebouncedValue] = (0, import_element2.useState)("");
|
||||
const debounced = (0, import_compose.useDebounce)(setDebouncedValue, 250);
|
||||
(0, import_element2.useEffect)(() => {
|
||||
debounced(value);
|
||||
return () => debounced.cancel();
|
||||
}, [debounced, value]);
|
||||
return debouncedValue;
|
||||
}
|
||||
var ROUTE_MAPPING = {
|
||||
"/template": "/templates",
|
||||
"/pattern": "/patterns"
|
||||
};
|
||||
function getSiteEditorPage() {
|
||||
return window.__experimentalExtensibleSiteEditor ? "admin.php?page=site-editor-v2" : "site-editor.php";
|
||||
}
|
||||
function mapRoute(path) {
|
||||
if (!window.__experimentalExtensibleSiteEditor) {
|
||||
return path;
|
||||
}
|
||||
for (const [oldPath, newPath] of Object.entries(ROUTE_MAPPING)) {
|
||||
if (path === oldPath || path.startsWith(oldPath + "?")) {
|
||||
if (path.includes("postType=wp_template_part")) {
|
||||
return "/template-parts";
|
||||
}
|
||||
return path.replace(oldPath, newPath);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
function isInSiteEditor() {
|
||||
const path = (0, import_url.getPath)(window.location.href);
|
||||
return path?.includes("site-editor.php") || path?.includes("page=site-editor-v2");
|
||||
}
|
||||
var getNavigationCommandLoaderPerPostType = (postType) => function useNavigationCommandLoader({ search }) {
|
||||
const history = useHistory();
|
||||
const { isBlockBasedTheme, canCreateTemplate } = (0, import_data2.useSelect)(
|
||||
(select) => {
|
||||
return {
|
||||
isBlockBasedTheme: select(import_core_data2.store).getCurrentTheme()?.is_block_theme,
|
||||
canCreateTemplate: select(import_core_data2.store).canUser("create", {
|
||||
kind: "postType",
|
||||
name: "wp_template"
|
||||
})
|
||||
};
|
||||
},
|
||||
[]
|
||||
);
|
||||
const delayedSearch = useDebouncedValue(search);
|
||||
const { records, isLoading } = (0, import_data2.useSelect)(
|
||||
(select) => {
|
||||
if (!delayedSearch) {
|
||||
return {
|
||||
isLoading: false
|
||||
};
|
||||
}
|
||||
const query = {
|
||||
search: delayedSearch,
|
||||
per_page: 10,
|
||||
orderby: "relevance",
|
||||
status: [
|
||||
"publish",
|
||||
"future",
|
||||
"draft",
|
||||
"pending",
|
||||
"private"
|
||||
]
|
||||
};
|
||||
return {
|
||||
records: select(import_core_data2.store).getEntityRecords(
|
||||
"postType",
|
||||
postType,
|
||||
query
|
||||
),
|
||||
isLoading: !select(import_core_data2.store).hasFinishedResolution(
|
||||
"getEntityRecords",
|
||||
["postType", postType, query]
|
||||
)
|
||||
};
|
||||
},
|
||||
[delayedSearch]
|
||||
);
|
||||
const commands = (0, import_element2.useMemo)(() => {
|
||||
return (records ?? []).map((record) => {
|
||||
const command = {
|
||||
name: postType + "-" + record.id,
|
||||
searchLabel: record.title?.rendered + " " + record.id,
|
||||
label: record.title?.rendered ? (0, import_html_entities.decodeEntities)(record.title?.rendered) : (0, import_i18n2.__)("(no title)"),
|
||||
icon: icons[postType],
|
||||
category: "edit"
|
||||
};
|
||||
if (!canCreateTemplate || postType === "post" || postType === "page" && !isBlockBasedTheme) {
|
||||
return {
|
||||
...command,
|
||||
callback: ({ close }) => {
|
||||
const args = {
|
||||
post: record.id,
|
||||
action: "edit"
|
||||
};
|
||||
const targetUrl = (0, import_url.addQueryArgs)("post.php", args);
|
||||
document.location = targetUrl;
|
||||
close();
|
||||
}
|
||||
};
|
||||
}
|
||||
const isSiteEditor = isInSiteEditor();
|
||||
return {
|
||||
...command,
|
||||
callback: ({ close }) => {
|
||||
if (isSiteEditor) {
|
||||
history.navigate(
|
||||
`/${postType}/${record.id}?canvas=edit`
|
||||
);
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: `/${postType}/${record.id}`,
|
||||
canvas: "edit"
|
||||
}
|
||||
);
|
||||
}
|
||||
close();
|
||||
}
|
||||
};
|
||||
});
|
||||
}, [canCreateTemplate, records, isBlockBasedTheme, history]);
|
||||
return {
|
||||
commands,
|
||||
isLoading
|
||||
};
|
||||
};
|
||||
var getNavigationCommandLoaderPerTemplate = (templateType) => function useNavigationCommandLoader({ search }) {
|
||||
const history = useHistory();
|
||||
const { isBlockBasedTheme, canCreateTemplate } = (0, import_data2.useSelect)(
|
||||
(select) => {
|
||||
return {
|
||||
isBlockBasedTheme: select(import_core_data2.store).getCurrentTheme()?.is_block_theme,
|
||||
canCreateTemplate: select(import_core_data2.store).canUser("create", {
|
||||
kind: "postType",
|
||||
name: templateType
|
||||
})
|
||||
};
|
||||
},
|
||||
[]
|
||||
);
|
||||
const { records, isLoading } = (0, import_data2.useSelect)((select) => {
|
||||
const { getEntityRecords } = select(import_core_data2.store);
|
||||
const query = { per_page: -1 };
|
||||
return {
|
||||
records: getEntityRecords("postType", templateType, query),
|
||||
isLoading: !select(import_core_data2.store).hasFinishedResolution(
|
||||
"getEntityRecords",
|
||||
["postType", templateType, query]
|
||||
)
|
||||
};
|
||||
}, []);
|
||||
const orderedRecords = (0, import_element2.useMemo)(() => {
|
||||
return orderEntityRecordsBySearch(records, search).slice(0, 10);
|
||||
}, [records, search]);
|
||||
const commands = (0, import_element2.useMemo)(() => {
|
||||
if (!canCreateTemplate || !isBlockBasedTheme && !templateType === "wp_template_part") {
|
||||
return [];
|
||||
}
|
||||
const isSiteEditor = (0, import_url.getPath)(window.location.href)?.includes(
|
||||
"site-editor.php"
|
||||
);
|
||||
const result = [];
|
||||
result.push(
|
||||
...orderedRecords.map((record) => {
|
||||
return {
|
||||
name: templateType + "-" + record.id,
|
||||
searchLabel: record.title?.rendered + " " + record.id,
|
||||
label: record.title?.rendered ? record.title?.rendered : (0, import_i18n2.__)("(no title)"),
|
||||
icon: icons[templateType],
|
||||
category: "edit",
|
||||
callback: ({ close }) => {
|
||||
if (isSiteEditor) {
|
||||
history.navigate(
|
||||
`/${templateType}/${record.id}?canvas=edit`
|
||||
);
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: `/${templateType}/${record.id}`,
|
||||
canvas: "edit"
|
||||
}
|
||||
);
|
||||
}
|
||||
close();
|
||||
}
|
||||
};
|
||||
})
|
||||
);
|
||||
if (orderedRecords?.length > 0 && templateType === "wp_template_part") {
|
||||
result.push({
|
||||
name: "core/edit-site/open-template-parts",
|
||||
label: (0, import_i18n2.__)("Go to: Template parts"),
|
||||
icon: symbol_filled_default,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
if (isSiteEditor) {
|
||||
history.navigate(
|
||||
mapRoute(
|
||||
"/pattern?postType=wp_template_part&categoryId=all-parts"
|
||||
)
|
||||
);
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: mapRoute("/pattern"),
|
||||
postType: "wp_template_part",
|
||||
categoryId: "all-parts"
|
||||
}
|
||||
);
|
||||
}
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}, [canCreateTemplate, isBlockBasedTheme, orderedRecords, history]);
|
||||
return {
|
||||
commands,
|
||||
isLoading
|
||||
};
|
||||
};
|
||||
var getSiteEditorBasicNavigationCommands = () => function useSiteEditorBasicNavigationCommands() {
|
||||
const history = useHistory();
|
||||
const isSiteEditor = isInSiteEditor();
|
||||
const { isBlockBasedTheme, canCreateTemplate, canCreatePatterns } = (0, import_data2.useSelect)((select) => {
|
||||
return {
|
||||
isBlockBasedTheme: select(import_core_data2.store).getCurrentTheme()?.is_block_theme,
|
||||
canCreateTemplate: select(import_core_data2.store).canUser("create", {
|
||||
kind: "postType",
|
||||
name: "wp_template"
|
||||
}),
|
||||
canCreatePatterns: select(import_core_data2.store).canUser("create", {
|
||||
kind: "postType",
|
||||
name: "wp_block"
|
||||
})
|
||||
};
|
||||
}, []);
|
||||
const commands = (0, import_element2.useMemo)(() => {
|
||||
const result = [];
|
||||
if (canCreateTemplate && isBlockBasedTheme) {
|
||||
result.push({
|
||||
name: "core/edit-site/open-styles",
|
||||
label: (0, import_i18n2.__)("Go to: Styles"),
|
||||
icon: styles_default,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
if (isSiteEditor) {
|
||||
history.navigate("/styles");
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: "/styles"
|
||||
}
|
||||
);
|
||||
}
|
||||
close();
|
||||
}
|
||||
});
|
||||
result.push({
|
||||
name: "core/edit-site/open-navigation",
|
||||
label: (0, import_i18n2.__)("Go to: Navigation"),
|
||||
icon: navigation_default,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
if (isSiteEditor) {
|
||||
history.navigate("/navigation");
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: "/navigation"
|
||||
}
|
||||
);
|
||||
}
|
||||
close();
|
||||
}
|
||||
});
|
||||
result.push({
|
||||
name: "core/edit-site/open-templates",
|
||||
label: (0, import_i18n2.__)("Go to: Templates"),
|
||||
icon: layout_default,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
if (isSiteEditor) {
|
||||
history.navigate(mapRoute("/template"));
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: mapRoute("/template")
|
||||
}
|
||||
);
|
||||
}
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (canCreatePatterns) {
|
||||
result.push({
|
||||
name: "core/edit-site/open-patterns",
|
||||
label: (0, import_i18n2.__)("Go to: Patterns"),
|
||||
icon: symbol_default,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
if (canCreateTemplate) {
|
||||
if (isSiteEditor) {
|
||||
history.navigate(mapRoute("/pattern"));
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: mapRoute("/pattern")
|
||||
}
|
||||
);
|
||||
}
|
||||
close();
|
||||
} else {
|
||||
document.location.href = "edit.php?post_type=wp_block";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}, [
|
||||
history,
|
||||
isSiteEditor,
|
||||
canCreateTemplate,
|
||||
canCreatePatterns,
|
||||
isBlockBasedTheme
|
||||
]);
|
||||
return {
|
||||
commands,
|
||||
isLoading: false
|
||||
};
|
||||
};
|
||||
var getGlobalStylesOpenCssCommands = () => function useGlobalStylesOpenCssCommands() {
|
||||
const history = useHistory();
|
||||
const isSiteEditor = isInSiteEditor();
|
||||
const { canEditCSS } = (0, import_data2.useSelect)((select) => {
|
||||
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } = select(import_core_data2.store);
|
||||
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
||||
const globalStyles = globalStylesId ? getEntityRecord("root", "globalStyles", globalStylesId) : void 0;
|
||||
return {
|
||||
canEditCSS: !!globalStyles?._links?.["wp:action-edit-css"]
|
||||
};
|
||||
}, []);
|
||||
const commands = (0, import_element2.useMemo)(() => {
|
||||
if (!canEditCSS) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
{
|
||||
name: "core/open-styles-css",
|
||||
label: (0, import_i18n2.__)("Open custom CSS"),
|
||||
icon: brush_default,
|
||||
category: "view",
|
||||
callback: ({ close }) => {
|
||||
close();
|
||||
if (isSiteEditor) {
|
||||
history.navigate("/styles?section=/css");
|
||||
} else {
|
||||
document.location = (0, import_url.addQueryArgs)(
|
||||
getSiteEditorPage(),
|
||||
{
|
||||
p: "/styles",
|
||||
section: "/css"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
}, [history, canEditCSS, isSiteEditor]);
|
||||
return {
|
||||
isLoading: false,
|
||||
commands
|
||||
};
|
||||
};
|
||||
function useSiteEditorNavigationCommands(isNetworkAdmin) {
|
||||
(0, import_commands2.useCommandLoader)({
|
||||
name: "core/edit-site/navigate-pages",
|
||||
hook: getNavigationCommandLoaderPerPostType("page"),
|
||||
disabled: isNetworkAdmin
|
||||
});
|
||||
(0, import_commands2.useCommandLoader)({
|
||||
name: "core/edit-site/navigate-posts",
|
||||
hook: getNavigationCommandLoaderPerPostType("post"),
|
||||
disabled: isNetworkAdmin
|
||||
});
|
||||
(0, import_commands2.useCommandLoader)({
|
||||
name: "core/edit-site/navigate-templates",
|
||||
hook: getNavigationCommandLoaderPerTemplate("wp_template"),
|
||||
disabled: isNetworkAdmin
|
||||
});
|
||||
(0, import_commands2.useCommandLoader)({
|
||||
name: "core/edit-site/navigate-template-parts",
|
||||
hook: getNavigationCommandLoaderPerTemplate("wp_template_part"),
|
||||
disabled: isNetworkAdmin
|
||||
});
|
||||
(0, import_commands2.useCommandLoader)({
|
||||
name: "core/edit-site/basic-navigation",
|
||||
hook: getSiteEditorBasicNavigationCommands(),
|
||||
context: "site-editor",
|
||||
disabled: isNetworkAdmin
|
||||
});
|
||||
(0, import_commands2.useCommandLoader)({
|
||||
name: "core/edit-site/global-styles-css",
|
||||
hook: getGlobalStylesOpenCssCommands(),
|
||||
disabled: isNetworkAdmin
|
||||
});
|
||||
}
|
||||
|
||||
// packages/core-commands/build-module/private-apis.mjs
|
||||
function useCommands2() {
|
||||
useAdminNavigationCommands();
|
||||
useSiteEditorNavigationCommands();
|
||||
}
|
||||
var privateApis = {};
|
||||
lock(privateApis, {
|
||||
useCommands: useCommands2
|
||||
});
|
||||
|
||||
// packages/core-commands/build-module/index.mjs
|
||||
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
|
||||
var { RouterProvider } = unlock(import_router2.privateApis);
|
||||
function CommandPalette({ settings }) {
|
||||
const { menu_commands: menuCommands, is_network_admin: isNetworkAdmin } = settings;
|
||||
useAdminNavigationCommands(menuCommands);
|
||||
useSiteEditorNavigationCommands(isNetworkAdmin);
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RouterProvider, { pathArg: "p", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_commands3.CommandMenu, {}) });
|
||||
}
|
||||
function initializeCommandPalette(settings) {
|
||||
const root = document.createElement("div");
|
||||
document.body.appendChild(root);
|
||||
(0, import_element3.createRoot)(root).render(
|
||||
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_element3.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CommandPalette, { settings }) })
|
||||
);
|
||||
}
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
var wp;(wp||={}).coreCommands=(()=>{var Ja=Object.create;var V=Object.defineProperty;var Qa=Object.getOwnPropertyDescriptor;var Xa=Object.getOwnPropertyNames;var Ka=Object.getPrototypeOf,Ya=Object.prototype.hasOwnProperty;var n=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),at=(a,t)=>{for(var o in t)V(a,o,{get:t[o],enumerable:!0})},wa=(a,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let f of Xa(t))!Ya.call(a,f)&&f!==o&&V(a,f,{get:()=>t[f],enumerable:!(r=Qa(t,f))||r.enumerable});return a};var e=(a,t,o)=>(o=a!=null?Ja(Ka(a)):{},wa(t||!a||!a.__esModule?V(o,"default",{value:a,enumerable:!0}):o,a)),tt=a=>wa(V({},"__esModule",{value:!0}),a);var P=n((nt,va)=>{va.exports=window.wp.element});var W=n((ct,ba)=>{ba.exports=window.wp.router});var E=n((ht,ya)=>{ya.exports=window.wp.commands});var J=n((gt,xa)=>{xa.exports=window.wp.i18n});var g=n((wt,Ca)=>{Ca.exports=window.wp.primitives});var h=n((vt,Sa)=>{Sa.exports=window.ReactJSXRuntime});var ua=n((Ut,La)=>{La.exports=window.wp.coreData});var pa=n((Gt,ka)=>{ka.exports=window.wp.data});var Va=n((It,Ba)=>{Ba.exports=window.wp.url});var Ea=n((Ft,Pa)=>{Pa.exports=window.wp.compose});var za=n((Ot,Ta)=>{Ta.exports=window.wp.htmlEntities});var Aa=n((qt,Ma)=>{Ma.exports=window.wp.privateApis});var ut={};at(ut,{initializeCommandPalette:()=>it,privateApis:()=>ha});var $=e(P(),1),qa=e(W(),1),Za=e(E(),1);var I=e(E(),1),R=e(J(),1);var T=e(g(),1),Q=e(h(),1),X=(0,Q.jsx)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Q.jsx)(T.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"})});var z=e(g(),1),K=e(h(),1),Y=(0,K.jsx)(z.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,K.jsx)(z.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"})});var M=e(g(),1),aa=e(h(),1),A=(0,aa.jsx)(M.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,aa.jsx)(M.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"})});var j=e(g(),1),ta=e(h(),1),ea=(0,ta.jsx)(j.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ta.jsx)(j.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"})});var k=e(g(),1),_=e(h(),1),oa=(0,_.jsxs)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,_.jsx)(k.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,_.jsx)(k.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"})]});var D=e(g(),1),ra=e(h(),1),sa=(0,ra.jsx)(D.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ra.jsx)(D.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"})});var U=e(g(),1),fa=e(h(),1),la=(0,fa.jsx)(U.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,fa.jsx)(U.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"})});var G=e(g(),1),ma=e(h(),1),H=(0,ma.jsx)(G.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,ma.jsx)(G.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"})});var N=e(g(),1),da=e(h(),1),ia=(0,da.jsx)(N.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,da.jsx)(N.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"})});var na=e(P(),1),_a=e(ua(),1),Ra=e(pa(),1),et=()=>function(){let t=(0,Ra.useSelect)(r=>r(_a.store).getEntityRecord("root","__unstableBase")?.home,[]);return{isLoading:!1,commands:(0,na.useMemo)(()=>t?[{name:"core/view-site",label:(0,R.__)("View site"),icon:Y,category:"view",callback:({close:r})=>{r(),window.open(t,"_blank")}}]:[],[t])}};function F(a){let t=(0,na.useMemLine truncated
|
||||
Vendored
+19455
File diff suppressed because it is too large.
Load diff
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
"use strict";var wp;(wp||={}).coreData=(()=>{var Nh=Object.create;var Bn=Object.defineProperty;var Vh=Object.getOwnPropertyDescriptor;var Bh=Object.getOwnPropertyNames;var jh=Object.getPrototypeOf,Fh=Object.prototype.hasOwnProperty;var z=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),bt=(t,e)=>{for(var r in e)Bn(t,r,{get:e[r],enumerable:!0})},Hc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Bh(e))!Fh.call(t,o)&&o!==r&&Bn(t,o,{get:()=>e[o],enumerable:!(n=Vh(e,o))||n.enumerable});return t};var w=(t,e,r)=>(r=t!=null?Nh(jh(t)):{},Hc(e||!t||!t.__esModule?Bn(r,"default",{value:t,enumerable:!0}):r,t)),Yh=t=>Hc(Bn({},"__esModule",{value:!0}),t);var W=z((m_,qc)=>{qc.exports=window.wp.data});var Qe=z((y_,Wc)=>{"use strict";Wc.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(o of e.entries())if(!r.has(o[0]))return!1;for(o of e.entries())if(!t(o[1],r.get(o[0])))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(o of e.entries())if(!r.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(e[o]!==r[o])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var jn=z((E_,Jc)=>{Jc.exports=window.wp.compose});var Xc=z((w_,Qc)=>{Qc.exports=window.wp.undoManager});var sa=z((q_,oa)=>{"use strict";function Tt(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Tt=function(e){return typeof e}:Tt=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tt(t)}function Wh(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ra(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Jh(t,e,r){return e&&ra(t.prototype,e),r&&ra(t,r),t}function na(t,e){var r=t._map,n=t._arrayTreeMap,o=t._objectTreeMap;if(r.has(e))return r.get(e);for(var s=Object.keys(e).sort(),i=Array.isArray(e)?n:o,c=0;c<s.length;c++){var a=s[c];if(i=i.get(a),i===void 0)return;var u=e[a];if(i=i.get(u),i===void 0)return}var l=i.get("_ekm_value");if(l)return r.delete(l[0]),l[0]=e,i.set("_ekm_value",l),r.set(e,l),l}var Qh=(function(){function t(e){if(Wh(this,t),this.clear(),e instanceof t){var r=[];e.forEach(function(o,s){r.push([s,o])}),e=r}if(e!=null)for(var n=0;n<e.length;n++)this.set(e[n][0],e[n][1])}return Jh(t,[{key:"set",value:function(r,n){if(r===null||Tt(r)!=="object")return this._map.set(r,n),this;for(var o=Object.keys(r).sort(),s=[r,n],i=Array.isArray(r)?this._arrayTreeMap:this._objectTreeMap,c=0;c<o.length;c++){var a=o[c];i.has(a)||i.set(a,new t),i=i.get(a);var u=r[a];i.has(u)||i.set(u,new t),i=i.get(u)}var l=i.get("_ekm_value");return l&&this._map.delete(l[0]),i.set("_ekm_value",s),this._map.set(r,s),this}},{key:"get",value:function(r){if(r===null||Tt(r)!=="object")return this._map.get(r);var n=na(this,r);if(n)return n[1]}},{key:"has",value:function(r){return r===null||Tt(r)!=="object"?this._map.has(r):na(this,r)!==void 0}},{key:"delete",value:function(r){return this.has(r)?(this.set(r,void 0),!0):!1}},{key:"forEach",value:function(r){var n=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this;this._map.forEach(function(s,i){i!==null&&Tt(i)==="object"&&(s=s[1]),r.call(o,s,i,n)})}},{key:"clear",value:function(){this._map=new Map,this._arrayTreeMap=new Map,this._objectTreeMap=new Map}},{key:"size",get:function(){return this._map.size}}]),t})();oa.exports=Qh});var Ze=z((W_,ia)=>{ia.exports=window.wp.url});var Ae=z((yS,ma)=>{ma.exports=window.wp.apiFetch});var nr=z((ES,ya)=>{ya.exports=window.wp.blocks});var _s=z((wS,Ea)=>{Ea.exports=window.wp.i18n});var Ai=z((ob,pu)=>{pu.exports=window.wp.privateApis});var Co=z((ab,_u)=>{_u.exports=window.wp.hooks});var Ar=z((gv,ed)=>{ed.exports=window.wp.blockEditor});var bn=z((Nv,gd)=>{gd.exports=window.wp.richText});var er=z((XC,pf)=>{pf.exports=window.wp.deprecated});var kc=z((xR,Of)=>{Of.exports=window.wp.htmlEntities});var We=z((XR,Qf)=>{Qf.exports=window.wp.element});var eh=z((eT,Zf)=>{Zf.exports=window.ReactJSXRuntime});var gh=z((ET,ph)=>{ph.exports=window.wp.warning});var p_={};bt(p_,{EntityProvider:()=>rh,__experimentalFetchLinkSuggestions:()=>Lf,__experimentalFetchUrlDLine truncated
|
||||
`;r.right=new k(R(i,L(s.store,i)),r.left,r.left&&r.left.lastId,r.right,r.right&&r.right.id,e,null,new Te(a)),r.right.integrate(t,0),r.forward()}eu(t,e,r,c)},nu=(t,e,r,n,o)=>{let s=e,i=V();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Y){let u=s.content;i.set(u.key,u)}s=s.right}let c=0,a=!1;for(;e!==s;){if(r===e&&(a=!0),!e.deleted){let u=e.content;if(u.constructor===Y){let{key:l,value:d}=u,f=n.get(l)??null;(i.get(l)!==u||f===d)&&(e.delete(t),c++,!a&&(o.get(l)??null)===d&&f!==d&&(f===null?o.delete(l):o.set(l,f))),!a&&!e.deleted&&Cr(o,u)}}e=e.right}return c},Qg=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;let r=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Y){let n=e.content.key;r.has(n)?e.delete(t):r.add(n)}e=e.left}},ou=t=>{let e=0;return D(t.doc,r=>{let n=t._start,o=t._start,s=V(),i=$n(s);for(;o;)o.deleted===!1&&(o.content.constructor===Y?Cr(i,o.content):(e+=nu(r,n,o,s,i),s=$n(i),n=o)),o=o.right}),e},Xg=t=>{let e=new Set,r=t.doc;for(let[n,o]of t.afterState.entries()){let s=t.beforeState.get(n)||0;o!==s&&Dl(t,r.store.clients.get(n),s,o,i=>{!i.deleted&&i.content.constructor===Y&&i.constructor!==oe&&e.add(i.parent)})}D(r,n=>{Pt(t,t.deleteSet,o=>{if(o instanceof oe||!o.parent._hasFormatting||e.has(o.parent))return;let s=o.parent;o.content.constructor===Y?e.add(s):Qg(n,o)});for(let o of e)ou(o)})},Sl=(t,e,r)=>{let n=r,o=$n(e.currentAttributes),s=e.right;for(;r>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case we:case Ke:case Te:r<e.right.length&&ne(t,R(e.right.id.client,e.right.id.clock+r)),r-=e.right.length,e.right.delete(t);break}e.forward()}s&&nu(t,s,e.right,o,e.currentAttributes);let i=(e.left||e.right).parent;return i._searchMarker&&dn(i._searchMarker,e.index,-n+r),e},ho=class extends jt{constructor(e,r,n){super(e,r),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(o=>{o===null?this.childListChanged=!0:this.keysChanged.add(o)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,r=[];D(e,n=>{let o=new Map,s=new Map,i=this.target._start,c=null,a={},u="",l=0,d=0,f=()=>{if(c!==null){let h=null;switch(c){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof u=="object"||u.length>0)&&(h={insert:u},o.size>0&&(h.attributes={},o.forEach((p,g)=>{p!==null&&(h.attributes[g]=p)}))),u="";break;case"retain":l>0&&(h={retain:l},$a(a)||(h.attributes=Fa({},a))),l=0;break}h&&r.push(h),c=null}};for(;i!==null;){switch(i.content.constructor){case we:case Ke:this.adds(i)?this.deletes(i)||(f(),c="insert",u=i.content.getContent()[0],f()):this.deletes(i)?(c!=="delete"&&(f(),c="delete"),d+=1):i.deleted||(c!=="retain"&&(f(),c="retain"),l+=1);break;case Te:this.adds(i)?this.deletes(i)||(c!=="insert"&&(f(),c="insert"),u+=i.content.str):this.deletes(i)?(c!=="delete"&&(f(),c="delete"),d+=i.length):i.deleted||(c!=="retain"&&(f(),c="retain"),l+=i.length);break;case Y:{let{key:h,value:p}=i.content;if(this.adds(i)){if(!this.deletes(i)){let g=o.get(h)??null;lt(g,p)?p!==null&&i.delete(n):(c==="retain"&&f(),lt(p,s.get(h)??null)?delete a[h]:a[h]=p)}}else if(this.deletes(i)){s.set(h,p);let g=o.get(h)??null;lt(g,p)||(c==="retain"&&f(),a[h]=g)}else if(!i.deleted){s.set(h,p);let g=a[h];g!==void 0&&(lt(g,p)?g!==null&&i.delete(n):(c==="retain"&&f(),p===null?delete a[h]:a[h]=p))}i.deleted||(c==="insert"&&f(),Cr(o,i.content));break}}i=i.right}for(f();r.length>0;){let h=r[r.length-1];if(h.retain!==void 0&&h.attributes===void 0)r.pop();else break}}),this._delta=r}return this._delta}},Sr=class t extends F{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Z(),this._length}_integrate(e,r){super._integrate(e,r);try{this._pending.forEach(n=>n())}catch(n){console.error(n)}this._pending=null}_copy(){return new t}clone(){let e=new t;return e.applyDelta(this.toDelta()),e}_callObserver(e,r){super._callObserver(e,r);let n=new ho(this,e,r);_o(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Z();let e="",r=this._start;for(;r!==null;)!r.deleted&&r.countable&&r.content.constructor===Te&&(e+=r.content.str),r=r.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:r=!0}={}){this.doc!==null?D(this.doc,n=>{let o=new hn(null,this._start,0,new Map);for(let s=0;s<e.length;s++){let i=e[s];if(i.insert!==void 0){let c=!r&&typeof i.insert=="string"&&s===e.length-1&&o.right===null&&i.insert.slice(-1)===`
|
||||
`?i.insert.slice(0,-1):i.insert;(typeof c!="string"||c.length>0)&&Qs(n,this,o,c,i.attributes||{})}else i.retain!==void 0?_l(n,this,o,i.retain,i.attributes||{}):i.delete!==void 0&&Sl(n,o,i.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,r,n){this.doc??Z();let o=[],s=new Map,i=this.doc,c="",a=this._start;function u(){if(c.length>0){let d={},f=!1;s.forEach((p,g)=>{f=!0,d[g]=p});let h={insert:c};f&&(h.attributes=d),o.push(h),c=""}}let l=()=>{for(;a!==null;){if(ct(a,e)||r!==void 0&&ct(a,r))switch(a.content.constructor){case Te:{let d=s.get("ychange");e!==void 0&&!ct(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(u(),s.set("ychange",n?n("removed",a.id):{type:"removed"})):r!==void 0&&!ct(a,r)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(u(),s.set("ychange",n?n("added",a.id):{type:"added"})):d!==void 0&&(u(),s.delete("ychange")),c+=a.content.str;break}case we:case Ke:{u();let d={insert:a.content.getContent()[0]};if(s.size>0){let f={};d.attributes=f,s.forEach((h,p)=>{f[p]=h})}o.push(d);break}case Y:ct(a,e)&&(u(),Cr(s,a.content));break}a=a.right}u()};return e||r?D(i,d=>{e&&ti(d,e),r&&ti(d,r),l()},"cleanup"):l(),o}insert(e,r,n){if(r.length<=0)return;let o=this.doc;o!==null?D(o,s=>{let i=to(s,this,e,!n);n||(n={},i.currentAttributes.forEach((c,a)=>{n[a]=c})),Qs(s,this,i,r,n)}):this._pending.push(()=>this.insert(e,r,n))}insertEmbed(e,r,n){let o=this.doc;o!==null?D(o,s=>{let i=to(s,this,e,!n);Qs(s,this,i,r,n||{})}):this._pending.push(()=>this.insertEmbed(e,r,n||{}))}delete(e,r){if(r===0)return;let n=this.doc;n!==null?D(n,o=>{Sl(o,to(o,this,e,!0),r)}):this._pending.push(()=>this.delete(e,r))}format(e,r,n){if(r===0)return;let o=this.doc;o!==null?D(o,s=>{let i=to(s,this,e,!1);i.right!==null&&_l(s,this,i,r,n)}):this._pending.push(()=>this.format(e,r,n))}removeAttribute(e){this.doc!==null?D(this.doc,r=>{lo(r,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,r){this.doc!==null?D(this.doc,n=>{bi(n,this,e,r)}):this._pending.push(()=>this.setAttribute(e,r))}getAttribute(e){return vi(this,e)}getAttributes(){return Ql(this)}_write(e){e.writeTypeRef(ym)}},Zg=t=>new Sr,on=class{constructor(e,r=()=>!0){this._filter=r,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Z()}[Symbol.iterator](){return this}next(){let e=this._currentNode,r=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(r)))do if(r=e.content.type,!e.deleted&&(r.constructor===$t||r.constructor===Gt)&&r._start!==null)e=r._start;else for(;e!==null;){let n=e.next;if(n!==null){e=n;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},Gt=class t extends F{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,r){super._integrate(e,r),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return e.insert(0,this.toArray().map(r=>r instanceof F?r.clone():r)),e}get length(){return this.doc??Z(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new on(this,e)}querySelector(e){e=e.toUpperCase();let n=new on(this,o=>o.nodeName&&o.nodeName.toUpperCase()===e).next();return n.done?null:n.value}querySelectorAll(e){return e=e.toUpperCase(),ve(new on(this,r=>r.nodeName&&r.nodeName.toUpperCase()===e))}_callObserver(e,r){_o(this,e,new po(this,r,e))}toString(){return Kl(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,r={},n){let o=e.createDocumentFragment();return n!==void 0&&n._createAssociation(o,this),fn(this,s=>{o.insertBefore(s.toDOM(e,r,n),null)}),o}insert(e,r){this.doc!==null?D(this.doc,n=>{Wl(n,this,e,r)}):this._prelimContent.splice(e,0,...r)}insertAfter(e,r){if(this.doc!==null)D(this.doc,n=>{let o=e&&e instanceof F?e._item:e;ao(n,this,o,r)});else{let n=this._prelimContent,o=e===null?0:n.findIndex(s=>s===e)+1;if(o===0&&e!==null)throw ke("Reference item not found");n.splice(o,0,...r)}}delete(e,r=1){this.doc!==null?D(this.doc,n=>{Jl(n,this,e,r)}):this._prelimContent.splice(e,r)}toArray(){return zl(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Hl(this,e)}slice(e=0,r=this.length){return $l(this,e,r)}forEach(e){fn(this,e)}_write(e){e.writeTypeRef(wm)}},em=t=>new Gt,$t=class t extends Gt{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,r){super._integrate(e,r),this._prelimAttrs.forEach((n,o)=>{this.setAttribute(o,n)}),this._prelimAttrs=null}_copy(){return new t(this.nodeName)}clone(){let e=new t(this.nodeName),r=this.getAttributes();return Ga(r,(n,o)=>{e.setAttribut
Line truncated
|
||||
`))&&(e=e.trim()),(!n.newlineIsToken||!r.includes(`
|
||||
`))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
||||
`)&&(e=e.slice(0,-1)),r.endsWith(`
|
||||
`)&&(r=r.slice(0,-1))),super.equals(e,r,n)}},Ju=new zi;function Ki(t,e,r){return Ju.diff(t,e,r)}function Km(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
||||
`));let r=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let o=0;o<n.length;o++){let s=n[o];o%2&&!e.newlineIsToken?r[r.length-1]+=s:r.push(s)}return r}var Oo=w(Qe(),1);var Qu=w(Qe(),1);function Hm(t){return JSON.parse(JSON.stringify(t))}var Hi;(t=>{function e(s={},i={},c=!1){typeof s!="object"&&(s={}),typeof i!="object"&&(i={});let a=Hm(i);c||(a=Object.keys(a).reduce((u,l)=>((a[l]!==null||a[l]!==void 0)&&(u[l]=a[l]),u),{}));for(let u in s)s[u]!==void 0&&i[u]===void 0&&(a[u]=s[u]);return Object.keys(a).length>0?a:void 0}t.compose=e;function r(s={},i={}){typeof s!="object"&&(s={}),typeof i!="object"&&(i={});let c=Object.keys(s).concat(Object.keys(i)).reduce((a,u)=>((0,Qu.default)(s[u],i[u])||(a[u]=i[u]===void 0?null:i[u]),a),{});return Object.keys(c).length>0?c:void 0}t.diff=r;function n(s={},i={}){s=s||{};let c=Object.keys(i).reduce((a,u)=>(i[u]!==s[u]&&s[u]!==void 0&&(a[u]=i[u]),a),{});return Object.keys(s).reduce((a,u)=>(s[u]!==i[u]&&i[u]===void 0&&(a[u]=null),a),c)}t.invert=n;function o(s,i,c=!1){if(typeof s!="object")return i;if(typeof i!="object")return;if(!c)return i;let a=Object.keys(i).reduce((u,l)=>(s[l]===void 0&&(u[l]=i[l]),u),{});return Object.keys(a).length>0?a:void 0}t.transform=o})(Hi||(Hi={}));var Xt=Hi;var qi;(t=>{function e(r){return typeof r.delete=="number"?r.delete:typeof r.retain=="number"?r.retain:typeof r.retain=="object"&&r.retain!==null?1:typeof r.insert=="string"?r.insert.length:1}t.length=e})(qi||(qi={}));var _e=qi;var se=class{ops;index;offset;constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);let e=this.ops[this.index];if(e){let r=this.offset,n=_e.length(e);if(t>=n-r?(t=n-r,this.index+=1,this.offset=0):this.offset+=t,typeof e.delete=="number")return{delete:t};let o={};return e.attributes&&(o.attributes=e.attributes),typeof e.retain=="number"?o.retain=t:typeof e.retain=="object"&&e.retain!==null?o.retain=e.retain:typeof e.insert=="string"?o.insert=e.insert.substr(r,t):o.insert=e.insert,o}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?_e.length(this.ops[this.index])-this.offset:1/0}peekType(){let t=this.ops[this.index];return t?typeof t.delete=="number"?"delete":typeof t.retain=="number"||typeof t.retain=="object"&&t.retain!==null?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index)}else return[];let t=this.offset,e=this.index,r=this.next(),n=this.ops.slice(this.index);return this.offset=t,this.index=e,[r].concat(n)}};function qm(t){return JSON.parse(JSON.stringify(t))}var Wm="\0",Jm=1e4;function Wi(t){return t.map(e=>({...e,count:e.value.length}))}var Xu=(t,e)=>{if(typeof t!="object"||t===null)throw new Error(`cannot retain a ${typeof t}`);if(typeof e!="object"||e===null)throw new Error(`cannot retain a ${typeof e}`);let r=Object.keys(t)[0];if(!r||r!==Object.keys(e)[0])throw new Error(`embed types not matched: ${r} != ${Object.keys(e)[0]}`);return[r,t[r],e[r]]},Qm=class ue{static Op=_e;static OpIterator=se;static AttributeMap=Xt;static handlers={};static registerEmbed(e,r){this.handlers[e]=r}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){let r=this.handlers[e];if(!r)throw new Error(`no handlers for embed type "${e}"`);return r}ops;constructor(e){Array.isArray(e)?this.ops=e:e!=null&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}insert(e,r){let n={};return typeof e=="string"&&e.length===0?this:(n.insert=e,r!=null&&typeof r=="object"&&Object.keys(r).length>0&&(n.attributes=r),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,r){if(typeof e=="number"&&e<=0)return this;let n={retain:e};return r!=null&&typeof r=="object"&&Object.keys(r).length>0&&(n.attributes=r),this.push(n)}push(e){let r=this.ops.length,n=this.ops[r-1];if(e=qm(e),typeof n=="object"){if(typeof e.delete=="number"&&typeof n.delete=="number")return this.ops[r-1]={delete:n.delete+e.delete},this;if(typeof n.delete=="number"&&e.insert!==null&&e.insert!==void 0&&(r-=1,n=this.ops[r-1],typeof n!="object"))return this.ops.unshift(e),this;if((0,Oo.default)(e.attributes,n.attributes)){if(typeof e.insert=="string"&&typeof n.insert=="string")return this.ops[r-1]={insert:n.insert+e.insert},typeof e.attributes=="object"&&(this.ops[r-1].attributes=e.attributes),this;if(typeof e.retain=="number"&&typeof n.retain=="number")return this.ops[r-1]={retain:n.retain+e.retain},typeof e.attributes=="object"&&(this.ops[r-1].attributes=e.attributes),this}}return r===this.ops.length?this.ops.push(e):this.ops.splice(r,0,e),this}chop(){let e=this.ops[this.ops.length-1];return e&&typeof e.retain=="number"&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){let r=[],n=[];return this.forEach(o=>{(e(o)?r:n).push(o)}),[r,n]}reduce(e,r){return this.ops.reduce(e,r)}changeLength(){return this.reduce((e,r)=>r.insert?e+_e.length(r):r.delete?e-r.delete:e,0
Line truncated
|
||||
`){let n=new se(this.ops),o=new ue,s=0;for(;n.hasNext();){if(n.peekType()!=="insert")return;let i=n.peek(),c=_e.length(i)-n.peekLength(),a=typeof i.insert=="string"?i.insert.indexOf(r,c)-c:-1;if(a<0)o.push(n.next());else if(a>0)o.push(n.next(a));else{if(e(o,n.next(1).attributes||{},s)===!1)return;s+=1,o=new ue}}o.length()>0&&e(o,{},s)}invert(e){let r=new ue;return this.reduce((n,o)=>{if(o.insert)r.delete(_e.length(o));else{if(typeof o.retain=="number"&&(o.attributes===null||o.attributes===void 0))return r.retain(o.retain),n+o.retain;if(o.delete||typeof o.retain=="number"){let s=o.delete||o.retain;return e.slice(n,n+s).forEach(c=>{o.delete?r.push(c):o.retain&&o.attributes&&r.retain(_e.length(c),Xt.invert(o.attributes,c.attributes))}),n+s}else if(typeof o.retain=="object"&&o.retain!==null){let s=e.slice(n,n+1),i=new se(s.ops).next(),[c,a,u]=Xu(o.retain,i.insert),l=ue.getHandler(c);return r.retain({[c]:l.invert(a,u)},Xt.invert(o.attributes,i.attributes)),n+1}}return n},0),r.chop()}transform(e,r=!1){if(r=!!r,typeof e=="number")return this.transformPosition(e,r);let n=e,o=new se(this.ops),s=new se(n.ops),i=new ue;for(;o.hasNext()||s.hasNext();)if(o.peekType()==="insert"&&(r||s.peekType()!=="insert"))i.retain(_e.length(o.next()));else if(s.peekType()==="insert")i.push(s.next());else{let c=Math.min(o.peekLength(),s.peekLength()),a=o.next(c),u=s.next(c);if(a.delete)continue;if(u.delete)i.push(u);else{let l=a.retain,d=u.retain,f=typeof d=="object"&&d!==null?d:c;if(typeof l=="object"&&l!==null&&typeof d=="object"&&d!==null){let h=Object.keys(l)[0];if(h===Object.keys(d)[0]){let p=ue.getHandler(h);p&&(f={[h]:p.transform(l[h],d[h],r)})}}i.retain(f,Xt.transform(a.attributes,u.attributes,r))}}return i.chop()}transformPosition(e,r=!1){r=!!r;let n=new se(this.ops),o=0;for(;n.hasNext()&&o<=e;){let s=n.peekLength(),i=n.peekType();if(n.next(),i==="delete"){e-=Math.min(s,e-o);continue}else i==="insert"&&(o<e||!r)&&(e+=s);o+=s}return e}diffWithCursor(e,r){if(this.ops===e.ops)return new ue;let n=this.deltasToStrings(e);if(Math.max(...n.map(d=>d.length))>Jm){let d=Wi(Ki(n[0],n[1])),f=new se(this.ops),h=new se(e.ops);return this.convertChangesToDelta(d,f,h).chop()}else if(r===null)return this.diff(e);let s=Wi(ko(n[0],n[1])),i=0,c=[];for(let d=0;d<s.length;d++){let f=s[d],h=i,p=i+(f.count??0),g=r>h&&r<=p,m=!f.added&&!f.removed,y=f.removed&&!f.added,E=s[d+1],_=E&&E.added&&!E.removed;if(m&&g&&_){let S=this.tryMoveInsertionToCursor(f,E,r,h);if(S){c.push(...S),d++,i=p;continue}}if(y){let S=this.tryMoveDeletionToCursor(f,c,r,i);if(S){c.pop(),c.push(...S),i+=f.count??0;continue}}c.push(f),f.added||(i+=f.count??0)}s=c;let a=new se(this.ops),u=new se(e.ops);return this.convertChangesToDelta(s,a,u).chop()}tryMoveInsertionToCursor(e,r,n,o){let s=r.value,i=s.length,c=n-o-i;if(!(e.value.substring(c,c+s.length)===s))return null;let l=e.value.substring(0,c),d=e.value.substring(c),f=[];return l.length>0&&f.push({value:l,count:l.length,added:!1,removed:!1}),f.push(r),d.length>0&&f.push({value:d,count:d.length,added:!1,removed:!1}),f}tryMoveDeletionToCursor(e,r,n,o){let s=r[r.length-1];if(!s||s.added||s.removed)return null;let i=o-(s.count??0),c=o;if(n<i||n>=c)return null;let a=e.value,u=n-i;if(!(s.value.substring(u,u+a.length)===a))return null;let f=s.value.substring(0,u),h=s.value.substring(u),p=e.count??0,g=h.substring(p),m=[];return f.length>0&&m.push({value:f,count:f.length,added:!1,removed:!1}),m.push(e),g.length>0&&m.push({value:g,count:g.length,added:!1,removed:!1}),m}deltasToStrings(e){return[this,e].map(r=>r.map(n=>{if(n.insert!==null||n.insert!==void 0)return typeof n.insert=="string"?n.insert:Wm;let o=r===e?"on":"with";throw new Error("diff() called "+o+" non-document")}).join(""))}convertChangesToDelta(e,r,n){let o=new ue;return e.forEach(s=>{let i=s.count??0;for(;i>0;){let c=0;if(s.added)c=Math.min(n.peekLength(),i),o.push(n.next(c));else if(s.removed)c=Math.min(i,r.peekLength()),r.next(c),o.delete(c);else{c=Math.min(r.peekLength(),n.peekLength(),i);let a=r.next(c),u=n.next(c);(0,Oo.default)(a.insert,u.insert)?o.retain(c,Xt.diff(a.attributes,u.attributes)):o.push(u).delete(c)}i-=c}}),o}},Zu=Qm;var Uo={};mu(Uo,{ConnectionErrorCode:Tr,createSyncManager:qu,Delta:Zu,CRDT_DOC_META_PERSISTENCE_KEY:So,CRDT_RECORD_MAP_KEY:bo,LOCAL_EDITOR_ORIGIN:vo,LOCAL_UNDO_IGNORED_ORIGIN:hu,retrySyncConnection:()=>Sn.retryNow()});var Od=w(Ar(),1);var ud=w(W(),1);var td=100,rd=5,nd=5e3;function Xm(){let t=window.navigator.userAgent,e="Unknown";return t.includes("Firefox")?e="Firefox":t.includes("Edg")?e="Microsoft Edge":t.includes("Chrome")&&!t.includes("Edg")?e="Chrome":t.includes("Safari")&&!t.includes("Chrome")?e="Safari":t.includes("MSIE")||t.includes("Trident")?e="Internet Explorer":(t.includes("Opera")||t.includes("OPR"))&&(e="Opera"),e}function od(t,e,r){if(t.size!==e.size)return!1;for(let[n,o]of t.entries())if(!e.has(n)||!r(o,e.get(n)))return!1;return!0}function sd(t,e){return!t||!e?t===e:Object.keys(t).length!==Object.keys(e).length?!1:Object.entrie
Line truncated
|
||||
+2454
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
var wp;(wp||={}).customizeWidgets=(()=>{var No=Object.create;var pt=Object.defineProperty;var Fo=Object.getOwnPropertyDescriptor;var Do=Object.getOwnPropertyNames;var Po=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$t=(t,e)=>{for(var r in e)pt(t,r,{get:e[r],enumerable:!0})},ke=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Do(e))!jo.call(t,s)&&s!==r&&pt(t,s,{get:()=>e[s],enumerable:!(o=Fo(e,s))||o.enumerable});return t};var a=(t,e,r)=>(r=t!=null?No(Po(t)):{},ke(e||!t||!t.__esModule?pt(r,"default",{value:t,enumerable:!0}):r,t)),Ho=t=>ke(pt({},"__esModule",{value:!0}),t);var w=p((ba,_e)=>{_e.exports=window.wp.element});var Xt=p((ya,xe)=>{xe.exports=window.wp.blockLibrary});var G=p((va,Ce)=>{Ce.exports=window.wp.widgets});var Yt=p((Sa,Ie)=>{Ie.exports=window.wp.blocks});var b=p((ka,Be)=>{Be.exports=window.wp.data});var rt=p((_a,We)=>{We.exports=window.wp.preferences});var R=p((xa,Ee)=>{Ee.exports=window.wp.components});var E=p((Ca,ze)=>{ze.exports=window.wp.i18n});var z=p((Ia,Ae)=>{Ae.exports=window.wp.blockEditor});var K=p((Ba,Te)=>{Te.exports=window.wp.compose});var ot=p((Wa,Le)=>{Le.exports=window.wp.hooks});var c=p((Ea,Me)=>{Me.exports=window.ReactJSXRuntime});var He=p((Ta,je)=>{je.exports=window.wp.coreData});var Jt=p((La,Ve)=>{Ve.exports=window.wp.mediaUtils});var q=p((Oa,Je)=>{Je.exports=window.wp.keycodes});var V=p((Na,Qe)=>{Qe.exports=window.wp.primitives});var at=p((ss,nr)=>{nr.exports=window.wp.keyboardShortcuts});var Wr=p((Cs,Br)=>{"use strict";Br.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,s,i;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(s=o;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e instanceof Map&&r instanceof Map){if(e.size!==r.size)return!1;for(s of e.entries())if(!r.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],r.get(s[0])))return!1;return!0}if(e instanceof Set&&r instanceof Set){if(e.size!==r.size)return!1;for(s of e.entries())if(!r.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(r)){if(o=e.length,o!=r.length)return!1;for(s=o;s--!==0;)if(e[s]!==r[s])return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),o=i.length,o!==Object.keys(r).length)return!1;for(s=o;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=o;s--!==0;){var d=i[s];if(!t(e[d],r[d]))return!1}return!0}return e!==e&&r!==r}});var zr=p((Is,Er)=>{Er.exports=window.wp.isShallowEqual});var jr=p((Ms,Pr)=>{Pr.exports=window.wp.privateApis});var _o=p((hi,ko)=>{ko.exports=window.wp.dom});var ga={};$t(ga,{initialize:()=>ha,store:()=>x});var Vt=a(w(),1),Ut=a(Xt(),1),et=a(G(),1),Gt=a(Yt(),1),ve=a(b(),1),Oo=a(rt(),1);var D=a(w(),1),Pt=a(R(),1);var Re=a(w(),1),Zt=a(E(),1),Oe=a(R(),1),Ne=a(z(),1),Fe=a(K(),1),De=a(ot(),1),ht=a(c(),1);function Vo({text:t,children:e}){let r=(0,Fe.useCopyToClipboard)(t);return(0,ht.jsx)(Oe.Button,{size:"compact",variant:"secondary",ref:r,children:e})}var Pe=class extends Re.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(t){this.setState({error:t}),(0,De.doAction)("editor.ErrorBoundary.errorLogged",t)}render(){let{error:t}=this.state;return t?(0,ht.jsx)(Ne.Warning,{className:"customize-widgets-error-boundary",actions:[(0,ht.jsx)(Vo,{text:t.stack,children:(0,Zt.__)("Copy Error")},"copy-error")],children:(0,Zt.__)("The editor has encountered an unexpected error.")}):this.props.children}};var ro=a(K(),1),oo=a(He(),1),ao=a(b(),1),Nt=a(w(),1),L=a(z(),1),so=a(Jt(),1),io=a(rt(),1),lo=a(Xt(),1);var Ue=a(w(),1),Ge=a(E(),1),Ke=a(R(),1),qe=a(b(),1),$e=a(z(),1),Xe=a(c(),1);function Uo({inspector:t,closeMenu:e,...r}){let o=(0,qe.useSelect)(i=>i($e.store).getSelectedBlockClientId(),[]),s=(0,Ue.useMemo)(()=>document.getElementById(`block-${o}`),[o]);return(0,Xe.jsx)(Ke.MenuItem,{onClick:()=>{t.open({returnFocusWhenClose:s}),e()},...r,children:(0,Ge.__)("Show more settings")})}var Ye=Uo;function Ze(t){var e,r,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=Ze(t[e]))&&(o&&(o+=" "),o+=r)}else for(r in t)t[r]&&(o&&(o+=" "),o+=r);return o}function Go(){for(var t,e,r=0,o="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=Ze(t))&&(o&&(o+=" "),o+=e);return o}var gt=Go;var zt=a(R(),1),xr=a(z(),1),X=a(w(),1),$=a(q(),1),N=a(E(),1);var wt=a(V(),1),Qt=a(c(),1),te=(0,Qt.jsx)(wt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Qt.jsx)(wt.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"})});var bt=a(V(),1),ee=a(c(),1),re=(0,ee.jsLine truncated
|
||||
Vendored
+115
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).dataControls = (() => {
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// package-external:@wordpress/api-fetch
|
||||
var require_api_fetch = __commonJS({
|
||||
"package-external:@wordpress/api-fetch"(exports, module) {
|
||||
module.exports = window.wp.apiFetch;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/data
|
||||
var require_data = __commonJS({
|
||||
"package-external:@wordpress/data"(exports, module) {
|
||||
module.exports = window.wp.data;
|
||||
}
|
||||
});
|
||||
|
||||
// package-external:@wordpress/deprecated
|
||||
var require_deprecated = __commonJS({
|
||||
"package-external:@wordpress/deprecated"(exports, module) {
|
||||
module.exports = window.wp.deprecated;
|
||||
}
|
||||
});
|
||||
|
||||
// packages/data-controls/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
__unstableAwaitPromise: () => __unstableAwaitPromise,
|
||||
apiFetch: () => apiFetch,
|
||||
controls: () => controls,
|
||||
dispatch: () => dispatch,
|
||||
select: () => select,
|
||||
syncSelect: () => syncSelect
|
||||
});
|
||||
var import_api_fetch = __toESM(require_api_fetch(), 1);
|
||||
var import_data = __toESM(require_data(), 1);
|
||||
var import_deprecated = __toESM(require_deprecated(), 1);
|
||||
function apiFetch(request) {
|
||||
return {
|
||||
type: "API_FETCH",
|
||||
request
|
||||
};
|
||||
}
|
||||
function select(storeNameOrDescriptor, selectorName, ...args) {
|
||||
(0, import_deprecated.default)("`select` control in `@wordpress/data-controls`", {
|
||||
since: "5.7",
|
||||
alternative: "built-in `resolveSelect` control in `@wordpress/data`"
|
||||
});
|
||||
return import_data.controls.resolveSelect(
|
||||
storeNameOrDescriptor,
|
||||
selectorName,
|
||||
...args
|
||||
);
|
||||
}
|
||||
function syncSelect(storeNameOrDescriptor, selectorName, ...args) {
|
||||
(0, import_deprecated.default)("`syncSelect` control in `@wordpress/data-controls`", {
|
||||
since: "5.7",
|
||||
alternative: "built-in `select` control in `@wordpress/data`"
|
||||
});
|
||||
return import_data.controls.select(storeNameOrDescriptor, selectorName, ...args);
|
||||
}
|
||||
function dispatch(storeNameOrDescriptor, actionName, ...args) {
|
||||
(0, import_deprecated.default)("`dispatch` control in `@wordpress/data-controls`", {
|
||||
since: "5.7",
|
||||
alternative: "built-in `dispatch` control in `@wordpress/data`"
|
||||
});
|
||||
return import_data.controls.dispatch(storeNameOrDescriptor, actionName, ...args);
|
||||
}
|
||||
var __unstableAwaitPromise = function(promise) {
|
||||
return {
|
||||
type: "AWAIT_PROMISE",
|
||||
promise
|
||||
};
|
||||
};
|
||||
var controls = {
|
||||
AWAIT_PROMISE({ promise }) {
|
||||
return promise;
|
||||
},
|
||||
API_FETCH({ request }) {
|
||||
return (0, import_api_fetch.default)(request);
|
||||
}
|
||||
};
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
"use strict";var wp;(wp||={}).dataControls=(()=>{var A=Object.create;var n=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var i=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),P=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of S(e))!F.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(l=I(e,o))||l.enumerable});return t};var a=(t,e,r)=>(r=t!=null?A(_(t)):{},p(e||!t||!t.__esModule?n(r,"default",{value:t,enumerable:!0}):r,t)),b=t=>p(n({},"__esModule",{value:!0}),t);var u=i((O,d)=>{d.exports=window.wp.apiFetch});var f=i((R,w)=>{w.exports=window.wp.data});var m=i((W,h)=>{h.exports=window.wp.deprecated});var H={};P(H,{__unstableAwaitPromise:()=>C,apiFetch:()=>x,controls:()=>g,dispatch:()=>T,select:()=>y,syncSelect:()=>E});var v=a(u(),1),s=a(f(),1),c=a(m(),1);function x(t){return{type:"API_FETCH",request:t}}function y(t,e,...r){return(0,c.default)("`select` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `resolveSelect` control in `@wordpress/data`"}),s.controls.resolveSelect(t,e,...r)}function E(t,e,...r){return(0,c.default)("`syncSelect` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `select` control in `@wordpress/data`"}),s.controls.select(t,e,...r)}function T(t,e,...r){return(0,c.default)("`dispatch` control in `@wordpress/data-controls`",{since:"5.7",alternative:"built-in `dispatch` control in `@wordpress/data`"}),s.controls.dispatch(t,e,...r)}var C=function(t){return{type:"AWAIT_PROMISE",promise:t}},g={AWAIT_PROMISE({promise:t}){return t},API_FETCH({request:t}){return(0,v.default)(t)}};return b(H);})();
|
||||
Vendored
+2457
File diff suppressed because it is too large.
Load diff
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";var wp;(wp||={}).data=(()=>{var lr=Object.create;var ne=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var pr=Object.getOwnPropertyNames;var mr=Object.getPrototypeOf,hr=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),oe=(e,t)=>{for(var r in t)ne(e,r,{get:t[r],enumerable:!0})},ze=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of pr(t))!hr.call(e,o)&&o!==r&&ne(e,o,{get:()=>t[o],enumerable:!(n=dr(t,o))||n.enumerable});return e};var v=(e,t,r)=>(r=e!=null?lr(mr(e)):{},ze(t||!e||!e.__esModule?ne(r,"default",{value:e,enumerable:!0}):r,e)),yr=e=>ze(ne({},"__esModule",{value:!0}),e);var be=I((Vn,qe)=>{qe.exports=window.wp.deprecated});var Ee=I((Kn,Qe)=>{"use strict";function U(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?U=function(t){return typeof t}:U=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},U(e)}function wr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Er(e,t,r){return t&&Xe(e.prototype,t),r&&Xe(e,r),e}function Je(e,t){var r=e._map,n=e._arrayTreeMap,o=e._objectTreeMap;if(r.has(t))return r.get(t);for(var s=Object.keys(t).sort(),i=Array.isArray(t)?n:o,f=0;f<s.length;f++){var a=s[f];if(i=i.get(a),i===void 0)return;var u=t[a];if(i=i.get(u),i===void 0)return}var c=i.get("_ekm_value");if(c)return r.delete(c[0]),c[0]=t,i.set("_ekm_value",c),r.set(t,c),c}var Rr=(function(){function e(t){if(wr(this,e),this.clear(),t instanceof e){var r=[];t.forEach(function(o,s){r.push([s,o])}),t=r}if(t!=null)for(var n=0;n<t.length;n++)this.set(t[n][0],t[n][1])}return Er(e,[{key:"set",value:function(r,n){if(r===null||U(r)!=="object")return this._map.set(r,n),this;for(var o=Object.keys(r).sort(),s=[r,n],i=Array.isArray(r)?this._arrayTreeMap:this._objectTreeMap,f=0;f<o.length;f++){var a=o[f];i.has(a)||i.set(a,new e),i=i.get(a);var u=r[a];i.has(u)||i.set(u,new e),i=i.get(u)}var c=i.get("_ekm_value");return c&&this._map.delete(c[0]),i.set("_ekm_value",s),this._map.set(r,s),this}},{key:"get",value:function(r){if(r===null||U(r)!=="object")return this._map.get(r);var n=Je(this,r);if(n)return n[1]}},{key:"has",value:function(r){return r===null||U(r)!=="object"?this._map.has(r):Je(this,r)!==void 0}},{key:"delete",value:function(r){return this.has(r)?(this.set(r,void 0),!0):!1}},{key:"forEach",value:function(r){var n=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this;this._map.forEach(function(s,i){i!==null&&U(i)==="object"&&(s=s[1]),r.call(o,s,i,n)})}},{key:"clear",value:function(){this._map=new Map,this._arrayTreeMap=new Map,this._objectTreeMap=new Map}},{key:"size",get:function(){return this._map.size}}]),e})();Qe.exports=Rr});var et=I((Wn,Ze)=>{Ze.exports=window.wp.reduxRoutine});var q=I((Gn,tt)=>{tt.exports=window.wp.compose});var ct=I((Yn,ut)=>{ut.exports=window.wp.privateApis});var Tt=I((jo,xt)=>{"use strict";var nn=function(t){return on(t)&&!sn(t)};function on(e){return!!e&&typeof e=="object"}function sn(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||cn(e)}var an=typeof Symbol=="function"&&Symbol.for,un=an?Symbol.for("react.element"):60103;function cn(e){return e.$$typeof===un}function fn(e){return Array.isArray(e)?[]:{}}function ee(e,t){return t.clone!==!1&&t.isMergeableObject(e)?B(fn(e),e,t):e}function ln(e,t,r){return e.concat(t).map(function(n){return ee(n,r)})}function dn(e,t){if(!t.customMerge)return B;var r=t.customMerge(e);return typeof r=="function"?r:B}function pn(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function Ot(e){return Object.keys(e).concat(pn(e))}function _t(e,t){try{return t in e}catch{return!1}}function mn(e,t){return _t(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function hn(e,t,r){var n={};return r.isMergeableObject(e)&&Ot(e).forEach(function(o){n[o]=ee(e[o],r)}),Ot(t).forEach(function(o){mn(e,o)||(_t(e,o)&&r.isMergeableObject(t[o])?n[o]=dn(o,r)(e[o],t[o],r):n[o]=ee(t[o],r))}),n}function B(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||ln,r.isMergeableObject=r.isMergeableObject||nn,r.cloneUnlessOtherwiseSpecified=ee;var n=Array.isArray(t),o=Array.isArray(e),s=n===o;return s?n?r.arrayMerge(e,t,r):hn(e,t,r):ee(t,r)}B.all=function(t,r){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(n,o){return B(n,o,r)},{})};var yn=B;xt.exports=yn});var Dt=I((Fo,Pt)=>{Pt.exports=window.wp.priorityQueue});var V=I((Vo,Lt)=>{Lt.exports=window.wp.element});var kt=I(($o,Ut)=>{Ut.exports=window.wp.isShallowEqual});var pe=I((Zo,Bt)=>{Bt.exports=window.ReactJSXRuntime});var kn={};oe(kn,{AsyncModeProvider:()=Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
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.
|
||||
*)
|
||||
*/
|
||||
Vendored
+2042
File diff suppressed because it is too large.
Load diff
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";var wp;(wp||={}).date=(()=>{var E0=Object.create;var j=Object.defineProperty;var R0=Object.getOwnPropertyDescriptor;var S0=Object.getOwnPropertyNames;var h0=Object.getPrototypeOf,g0=Object.prototype.hasOwnProperty;var F=(M,n)=>()=>(n||M((n={exports:{}}).exports,n),n.exports),C0=(M,n)=>{for(var e in n)j(M,e,{get:n[e],enumerable:!0})},b0=(M,n,e,q)=>{if(n&&typeof n=="object"||typeof n=="function")for(let u of S0(n))!g0.call(M,u)&&u!==e&&j(M,u,{get:()=>n[u],enumerable:!(q=R0(n,u))||q.enumerable});return M};var V=(M,n,e)=>(e=M!=null?E0(h0(M)):{},b0(n||!M||!M.__esModule?j(e,"default",{value:M,enumerable:!0}):e,M)),P0=M=>b0(j({},"__esModule",{value:!0}),M);var M0=F((J0,r0)=>{r0.exports=window.moment});var a0=F((p0,x)=>{(function(M,n){"use strict";typeof x=="object"&&x.exports?x.exports=n(M0()):typeof define=="function"&&define.amd?define(["moment"],n):n(M.moment)})(p0,function(M){"use strict";M.version===void 0&&M.default&&(M=M.default);var n="0.5.43",e={},q={},u={},W={},E={},I;(!M||typeof M.version!="string")&&D("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");var Y=M.version.split("."),_=+Y[0],w=+Y[1];(_<2||_===2&&w<6)&&D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js "+M.version+". See momentjs.com");function K(c){return c>96?c-87:c>64?c-29:c-48}function k(c){var o=0,a=c.split("."),i=a[0],b=a[1]||"",d=1,B,m=0,L=1;for(c.charCodeAt(0)===45&&(o=1,L=-1),o;o<i.length;o++)B=K(i.charCodeAt(o)),m=60*m+B;for(o=0;o<b.length;o++)d=d/60,B=K(b.charCodeAt(o)),m+=B*d;return m*L}function y(c){for(var o=0;o<c.length;o++)c[o]=k(c[o])}function Z(c,o){for(var a=0;a<o;a++)c[a]=Math.round((c[a-1]||0)+c[a]*6e4);c[o-1]=1/0}function v(c,o){var a=[],i;for(i=0;i<o.length;i++)a[i]=c[o[i]];return a}function U(c){var o=c.split("|"),a=o[2].split(" "),i=o[3].split(""),b=o[4].split(" ");return y(a),y(i),y(b),Z(b,i.length),{name:o[0],abbrs:v(o[1].split(" "),i),offsets:v(a,i),untils:b,population:o[5]|0}}function C(c){c&&this._set(U(c))}C.prototype={_set:function(c){this.name=c.name,this.abbrs=c.abbrs,this.untils=c.untils,this.offsets=c.offsets,this.population=c.population},_index:function(c){var o=+c,a=this.untils,i;for(i=0;i<a.length;i++)if(o<a[i])return i},countries:function(){var c=this.name;return Object.keys(u).filter(function(o){return u[o].zones.indexOf(c)!==-1})},parse:function(c){var o=+c,a=this.offsets,i=this.untils,b=i.length-1,d,B,m,L;for(L=0;L<b;L++)if(d=a[L],B=a[L+1],m=a[L&&L-1],d<B&&s.moveAmbiguousForward?d=B:d>m&&s.moveInvalidForward&&(d=m),o<i[L]-d*6e4)return a[L];return a[b]},abbr:function(c){return this.abbrs[this._index(c)]},offset:function(c){return D("zone.offset has been deprecated in favor of zone.utcOffset"),this.offsets[this._index(c)]},utcOffset:function(c){return this.offsets[this._index(c)]}};function Q(c,o){this.name=c,this.zones=o}function A(c){var o=c.toTimeString(),a=o.match(/\([a-z ]+\)/i);a&&a[0]?(a=a[0].match(/[A-Z]/g),a=a?a.join(""):void 0):(a=o.match(/[A-Z]{3,5}/g),a=a?a[0]:void 0),a==="GMT"&&(a=void 0),this.at=+c,this.abbr=a,this.offset=c.getTimezoneOffset()}function z(c){this.zone=c,this.offsetScore=0,this.abbrScore=0}z.prototype.scoreOffsetAt=function(c){this.offsetScore+=Math.abs(this.zone.utcOffset(c.at)-c.offset),this.zone.abbr(c.at).replace(/[^A-Z]/g,"")!==c.abbr&&this.abbrScore++};function r(c,o){for(var a,i;i=((o.at-c.at)/12e4|0)*6e4;)a=new A(new Date(c.at+i)),a.offset===c.offset?c=a:o=a;return c}function t(){var c=new Date().getFullYear()-2,o=new A(new Date(c,0,1)),a=[o],i,b,d;for(d=1;d<48;d++)b=new A(new Date(c,d,1)),b.offset!==o.offset&&(i=r(o,b),a.push(i),a.push(new A(new Date(i.at+6e4)))),o=b;for(d=0;d<4;d++)a.push(new A(new Date(c+d,0,1))),a.push(new A(new Date(c+d,6,1)));return a}function p(c,o){return c.offsetScore!==o.offsetScore?c.offsetScore-o.offsetScore:c.abbrScore!==o.abbrScore?c.abbrScore-o.abbrScore:c.zone.population!==o.zone.population?o.zone.population-c.zone.population:o.zone.name.localeCompare(c.zone.name)}function O(c,o){var a,i;for(y(o),a=0;a<o.length;a++)i=o[a],E[i]=E[i]||{},E[i][c]=!0}function f(c){var o=c.length,a={},i=[],b,d,B;for(b=0;b<o;b++){B=E[c[b].offset]||{};for(d in B)B.hasOwnProperty(d)&&(a[d]=!0)}for(b in a)a.hasOwnProperty(b)&&i.push(W[b]);return i}function N(){try{var c=Intl.DateTimeFormat().resolvedOptions().timeZone;if(c&&c.length>3){var o=W[h(c)];if(o)return o;D("Moment Timezone found "+c+" from the Intl api, but did not have that data loaded.")}}catch{}var a=t(),i=a.length,b=f(a),d=[],B,m,L;for(m=0;m<b.length;m++){for(B=new z(R(b[m]),i),L=0;L<i;L++)B.scoreOffsetAt(a[L]);d.push(B)}return d.sort(p),d.length>0?d[0].zone.name:void 0}function X(c){return(!I||c)&&(I=N()),I}function h(c){return(c||"").toLowerCase().replace(/\//g,"_")}function P(c){var o,a,i,b;for(typeof c=="string"&&(c=[c]),o=0;o<c.length;o++)i=c[o].split("|"),a=i[0],b=h(a),e[b]=c[o],W[b]=a,O(b,i[2].split(" "))}function R(c,o){c=h(c);var a=e[c],i;return a instanceof C?a:typeof a=="string"?(a=new C(a),e[c]=a,a):q[c]&&Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
moment-timezone/builds/moment-timezone-with-data-1970-2030.js:
|
||||
(*! moment-timezone.js *)
|
||||
(*! version : 0.5.43 *)
|
||||
(*! Copyright (c) JS Foundation and other contributors *)
|
||||
(*! license : MIT *)
|
||||
(*! github.com/moment/moment-timezone *)
|
||||
|
||||
moment-timezone/moment-timezone-utils.js:
|
||||
(*! moment-timezone-utils.js *)
|
||||
(*! version : 0.5.43 *)
|
||||
(*! Copyright (c) JS Foundation and other contributors *)
|
||||
(*! license : MIT *)
|
||||
(*! github.com/moment/moment-timezone *)
|
||||
*/
|
||||
Vendored
+68
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).deprecated = (() => {
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __commonJS = (cb, mod) => function __require() {
|
||||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||
};
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// package-external:@wordpress/hooks
|
||||
var require_hooks = __commonJS({
|
||||
"package-external:@wordpress/hooks"(exports, module) {
|
||||
module.exports = window.wp.hooks;
|
||||
}
|
||||
});
|
||||
|
||||
// packages/deprecated/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
default: () => deprecated,
|
||||
logged: () => logged
|
||||
});
|
||||
var import_hooks = __toESM(require_hooks(), 1);
|
||||
var logged = /* @__PURE__ */ Object.create(null);
|
||||
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}`;
|
||||
if (message in logged) {
|
||||
return;
|
||||
}
|
||||
(0, import_hooks.doAction)("deprecated", feature, options, message);
|
||||
console.warn(message);
|
||||
logged[message] = true;
|
||||
}
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
if (typeof wp.deprecated === 'object' && wp.deprecated.default) { wp.deprecated = wp.deprecated.default; }
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
"use strict";var wp;(wp||={}).deprecated=(()=>{var k=Object.create;var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var I=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports),N=(e,s)=>{for(var n in s)a(e,n,{get:s[n],enumerable:!0})},$=(e,s,n,t)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of x(s))!A.call(e,o)&&o!==n&&a(e,o,{get:()=>s[o],enumerable:!(t=b(s,o))||t.enumerable});return e};var O=(e,s,n)=>(n=e!=null?k(j(e)):{},$(s||!e||!e.__esModule?a(n,"default",{value:e,enumerable:!0}):n,e)),P=e=>$(a({},"__esModule",{value:!0}),e);var p=I((z,g)=>{g.exports=window.wp.hooks});var q={};N(q,{default:()=>S,logged:()=>c});var u=O(p(),1),c=Object.create(null);function S(e,s={}){let{since:n,version:t,alternative:o,plugin:r,link:d,hint:l}=s,v=r?` from ${r}`:"",M=n?` since version ${n}`:"",m=t?` and will be removed${v} in version ${t}`:"",w=o?` Please use ${o} instead.`:"",f=d?` See: ${d}`:"",h=l?` Note: ${l}`:"",i=`${e} is deprecated${M}${m}.${w}${f}${h}`;i in c||((0,u.doAction)("deprecated",e,s,i),console.warn(i),c[i]=!0)}return P(q);})();
|
||||
if (typeof wp.deprecated === 'object' && wp.deprecated.default) { wp.deprecated = wp.deprecated.default; }
|
||||
+1426
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
(()=>{var t={8015(t){"use strict";t.exports=ReactRefreshRuntime},3565(t,r,e){"use strict";var n=e(/*! ../stable/global-this */1960);t.exports=n},2671(t,r,e){"use strict";e(/*! ../modules/es.global-this */2344),t.exports=e(/*! ../internals/global */1010)},4444(t,r,e){"use strict";t.exports=e(/*! ../full/global-this */214)},214(t,r,e){"use strict";e(/*! ../modules/esnext.global-this */397);var n=e(/*! ../actual/global-this */3565);t.exports=n},2159(t,r,e){"use strict";var n=e(/*! ../internals/is-callable */2250),o=e(/*! ../internals/try-to-string */4640),i=TypeError;t.exports=function(t){if(n(t))return t;throw new i(o(t)+" is not a function")}},6624(t,r,e){"use strict";var n=e(/*! ../internals/is-object */6285),o=String,i=TypeError;t.exports=function(t){if(n(t))return t;throw new i(o(t)+" is not an object")}},5807(t,r,e){"use strict";var n=e(/*! ../internals/function-uncurry-this */1907),o=n({}.toString),i=n("".slice);t.exports=function(t){return i(o(t),8,-1)}},1626(t,r,e){"use strict";var n=e(/*! ../internals/descriptors */9447),o=e(/*! ../internals/object-define-property */4284),i=e(/*! ../internals/create-property-descriptor */5817);t.exports=n?function(t,r,e){return o.f(t,r,i(1,e))}:function(t,r,e){return t[r]=e,t}},5817(t){"use strict";t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},2532(t,r,e){"use strict";var n=e(/*! ../internals/global */1010),o=Object.defineProperty;t.exports=function(t,r){try{o(n,t,{value:r,configurable:!0,writable:!0})}catch(e){n[t]=r}return r}},9447(t,r,e){"use strict";var n=e(/*! ../internals/fails */8828);t.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},9552(t,r,e){"use strict";var n=e(/*! ../internals/global */1010),o=e(/*! ../internals/is-object */6285),i=n.document,s=o(i)&&o(i.createElement);t.exports=function(t){return s?i.createElement(t):{}}},4723(t){"use strict";t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},5683(t,r,e){"use strict";var n,o,i=e(/*! ../internals/global */1010),s=e(/*! ../internals/engine-user-agent */4723),u=i.process,c=i.Deno,a=u&&u.versions||c&&c.version,p=a&&a.v8;p&&(o=(n=p.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!o&&s&&(!(n=s.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=s.match(/Chrome\/(\d+)/))&&(o=+n[1]),t.exports=o},1091(t,r,e){"use strict";var n=e(/*! ../internals/global */1010),o=e(/*! ../internals/function-apply */6024),i=e(/*! ../internals/function-uncurry-this-clause */2361),s=e(/*! ../internals/is-callable */2250),u=e(/*! ../internals/object-get-own-property-descriptor */3846).f,c=e(/*! ../internals/is-forced */7463),a=e(/*! ../internals/path */2046),p=e(/*! ../internals/function-bind-context */8311),f=e(/*! ../internals/create-non-enumerable-property */1626),l=e(/*! ../internals/has-own-property */9724),v=function(t){var r=function(e,n,i){if(this instanceof r){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,i)}return o(t,this,arguments)};return r.prototype=t.prototype,r};t.exports=function(t,r){var e,o,y,b,h,x,d,m,g,w=t.target,j=t.global,_=t.stat,O=t.proto,S=j?n:_?n[w]:n[w]&&n[w].prototype,P=j?a:a[w]||f(a,w,{})[w],E=P.prototype;for(b in r)o=!(e=c(j?b:w+(_?".":"#")+b,t.forced))&&S&&l(S,b),x=P[b],o&&(d=t.dontCallGetSet?(g=u(S,b))&&g.value:S[b]),h=o&&d?d:r[b],(e||O||typeof x!=typeof h)&&(m=t.bind&&o?p(h,n):t.wrap&&o?v(h):O&&s(h)?i(h):h,(t.sham||h&&h.sham||x&&x.sham)&&f(m,"sham",!0),f(P,b,m),O&&(l(a,y=w+"Prototype")||f(a,y,{}),f(a[y],b,h),t.real&&E&&(e||!E[b])&&f(E,b,h)))}},8828(t){"use strict";t.exports=function(t){try{return!!t()}catch(t){return!0}}},6024(t,r,e){"use strict";var n=e(/*! ../internals/function-bind-native */1505),o=Function.prototype,i=o.apply,s=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(n?s.bind(i):function(){return s.apply(i,arguments)})},8311(t,r,e){"use strict";var n=e(/*! ../internals/function-uncurry-this-clause */2361),o=e(/*! ../internals/a-callable */2159),i=e(/*! ../internals/function-bind-native */1505),s=n(n.bind);t.exports=function(t,r){return o(t),void 0===r?t:i?s(t,r):function(){return t.apply(r,arguments)}}},1505(t,r,e){"use strict";var n=e(/*! ../internals/fails */8828);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},3930(t,r,e){"use strict";var n=e(/*! ../internals/function-bind-native */1505),o=Function.prototype.call;t.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},2361(t,r,e){"use strict";var n=e(/*! ../internals/classof-raw */5807),o=e(/*! ../internals/function-uncurry-this */1907);t.exports=function(t){if("Function"===n(t))return o(t)}},1907(t,r,e){"use strict";var n=e(/*! ../internals/function-bind-native */1505),o=Function.prototype,i=o.call,s=n&&o.bind.bind(i,i);t.exports=n?s:function(t){return function(){return i.apply(t,arguments)}}},5582(t,r,e){"use strict";var n=e(/*! ../internals/path */2046),o=e(/*! ../internals/global */1010),iLine truncated
|
||||
@@ -0,0 +1,730 @@
|
||||
/******/ (() => { // webpackBootstrap
|
||||
/******/ "use strict";
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ 644
|
||||
/*!*****************************************************************************!*\
|
||||
!*** ./node_modules/react-refresh/cjs/react-refresh-runtime.development.js ***!
|
||||
\*****************************************************************************/
|
||||
(__unused_webpack_module, exports) {
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-refresh-runtime.development.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.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if (true) {
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// ATTENTION
|
||||
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
||||
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
||||
|
||||
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // We never remove these associations.
|
||||
// It's OK to reference families, but use WeakMap/Set for types.
|
||||
|
||||
var allFamiliesByID = new Map();
|
||||
var allFamiliesByType = new PossiblyWeakMap();
|
||||
var allSignaturesByType = new PossiblyWeakMap(); // This WeakMap is read by React, so we only put families
|
||||
// that have actually been edited here. This keeps checks fast.
|
||||
// $FlowIssue
|
||||
|
||||
var updatedFamiliesByType = new PossiblyWeakMap(); // This is cleared on every performReactRefresh() call.
|
||||
// It is an array of [Family, NextType] tuples.
|
||||
|
||||
var pendingUpdates = []; // This is injected by the renderer via DevTools global hook.
|
||||
|
||||
var helpersByRendererID = new Map();
|
||||
var helpersByRoot = new Map(); // We keep track of mounted roots so we can schedule updates.
|
||||
|
||||
var mountedRoots = new Set(); // If a root captures an error, we remember it so we can retry on edit.
|
||||
|
||||
var failedRoots = new Set(); // In environments that support WeakMap, we also remember the last element for every root.
|
||||
// It needs to be weak because we do this even for roots that failed to mount.
|
||||
// If there is no WeakMap, we won't attempt to do retrying.
|
||||
// $FlowIssue
|
||||
|
||||
var rootElements = // $FlowIssue
|
||||
typeof WeakMap === 'function' ? new WeakMap() : null;
|
||||
var isPerformingRefresh = false;
|
||||
|
||||
function computeFullKey(signature) {
|
||||
if (signature.fullKey !== null) {
|
||||
return signature.fullKey;
|
||||
}
|
||||
|
||||
var fullKey = signature.ownKey;
|
||||
var hooks;
|
||||
|
||||
try {
|
||||
hooks = signature.getCustomHooks();
|
||||
} catch (err) {
|
||||
// This can happen in an edge case, e.g. if expression like Foo.useSomething
|
||||
// depends on Foo which is lazily initialized during rendering.
|
||||
// In that case just assume we'll have to remount.
|
||||
signature.forceReset = true;
|
||||
signature.fullKey = fullKey;
|
||||
return fullKey;
|
||||
}
|
||||
|
||||
for (var i = 0; i < hooks.length; i++) {
|
||||
var hook = hooks[i];
|
||||
|
||||
if (typeof hook !== 'function') {
|
||||
// Something's wrong. Assume we need to remount.
|
||||
signature.forceReset = true;
|
||||
signature.fullKey = fullKey;
|
||||
return fullKey;
|
||||
}
|
||||
|
||||
var nestedHookSignature = allSignaturesByType.get(hook);
|
||||
|
||||
if (nestedHookSignature === undefined) {
|
||||
// No signature means Hook wasn't in the source code, e.g. in a library.
|
||||
// We'll skip it because we can assume it won't change during this session.
|
||||
continue;
|
||||
}
|
||||
|
||||
var nestedHookKey = computeFullKey(nestedHookSignature);
|
||||
|
||||
if (nestedHookSignature.forceReset) {
|
||||
signature.forceReset = true;
|
||||
}
|
||||
|
||||
fullKey += '\n---\n' + nestedHookKey;
|
||||
}
|
||||
|
||||
signature.fullKey = fullKey;
|
||||
return fullKey;
|
||||
}
|
||||
|
||||
function haveEqualSignatures(prevType, nextType) {
|
||||
var prevSignature = allSignaturesByType.get(prevType);
|
||||
var nextSignature = allSignaturesByType.get(nextType);
|
||||
|
||||
if (prevSignature === undefined && nextSignature === undefined) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (prevSignature === undefined || nextSignature === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nextSignature.forceReset) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isReactClass(type) {
|
||||
return type.prototype && type.prototype.isReactComponent;
|
||||
}
|
||||
|
||||
function canPreserveStateBetween(prevType, nextType) {
|
||||
if (isReactClass(prevType) || isReactClass(nextType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (haveEqualSignatures(prevType, nextType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function resolveFamily(type) {
|
||||
// Only check updated types to keep lookups fast.
|
||||
return updatedFamiliesByType.get(type);
|
||||
} // If we didn't care about IE11, we could use new Map/Set(iterable).
|
||||
|
||||
|
||||
function cloneMap(map) {
|
||||
var clone = new Map();
|
||||
map.forEach(function (value, key) {
|
||||
clone.set(key, value);
|
||||
});
|
||||
return clone;
|
||||
}
|
||||
|
||||
function cloneSet(set) {
|
||||
var clone = new Set();
|
||||
set.forEach(function (value) {
|
||||
clone.add(value);
|
||||
});
|
||||
return clone;
|
||||
} // This is a safety mechanism to protect against rogue getters and Proxies.
|
||||
|
||||
|
||||
function getProperty(object, property) {
|
||||
try {
|
||||
return object[property];
|
||||
} catch (err) {
|
||||
// Intentionally ignore.
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function performReactRefresh() {
|
||||
|
||||
if (pendingUpdates.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isPerformingRefresh) {
|
||||
return null;
|
||||
}
|
||||
|
||||
isPerformingRefresh = true;
|
||||
|
||||
try {
|
||||
var staleFamilies = new Set();
|
||||
var updatedFamilies = new Set();
|
||||
var updates = pendingUpdates;
|
||||
pendingUpdates = [];
|
||||
updates.forEach(function (_ref) {
|
||||
var family = _ref[0],
|
||||
nextType = _ref[1];
|
||||
// Now that we got a real edit, we can create associations
|
||||
// that will be read by the React reconciler.
|
||||
var prevType = family.current;
|
||||
updatedFamiliesByType.set(prevType, family);
|
||||
updatedFamiliesByType.set(nextType, family);
|
||||
family.current = nextType; // Determine whether this should be a re-render or a re-mount.
|
||||
|
||||
if (canPreserveStateBetween(prevType, nextType)) {
|
||||
updatedFamilies.add(family);
|
||||
} else {
|
||||
staleFamilies.add(family);
|
||||
}
|
||||
}); // TODO: rename these fields to something more meaningful.
|
||||
|
||||
var update = {
|
||||
updatedFamilies: updatedFamilies,
|
||||
// Families that will re-render preserving state
|
||||
staleFamilies: staleFamilies // Families that will be remounted
|
||||
|
||||
};
|
||||
helpersByRendererID.forEach(function (helpers) {
|
||||
// Even if there are no roots, set the handler on first update.
|
||||
// This ensures that if *new* roots are mounted, they'll use the resolve handler.
|
||||
helpers.setRefreshHandler(resolveFamily);
|
||||
});
|
||||
var didError = false;
|
||||
var firstError = null; // We snapshot maps and sets that are mutated during commits.
|
||||
// If we don't do this, there is a risk they will be mutated while
|
||||
// we iterate over them. For example, trying to recover a failed root
|
||||
// may cause another root to be added to the failed list -- an infinite loop.
|
||||
|
||||
var failedRootsSnapshot = cloneSet(failedRoots);
|
||||
var mountedRootsSnapshot = cloneSet(mountedRoots);
|
||||
var helpersByRootSnapshot = cloneMap(helpersByRoot);
|
||||
failedRootsSnapshot.forEach(function (root) {
|
||||
var helpers = helpersByRootSnapshot.get(root);
|
||||
|
||||
if (helpers === undefined) {
|
||||
throw new Error('Could not find helpers for a root. This is a bug in React Refresh.');
|
||||
}
|
||||
|
||||
if (!failedRoots.has(root)) {// No longer failed.
|
||||
}
|
||||
|
||||
if (rootElements === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rootElements.has(root)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var element = rootElements.get(root);
|
||||
|
||||
try {
|
||||
helpers.scheduleRoot(root, element);
|
||||
} catch (err) {
|
||||
if (!didError) {
|
||||
didError = true;
|
||||
firstError = err;
|
||||
} // Keep trying other roots.
|
||||
|
||||
}
|
||||
});
|
||||
mountedRootsSnapshot.forEach(function (root) {
|
||||
var helpers = helpersByRootSnapshot.get(root);
|
||||
|
||||
if (helpers === undefined) {
|
||||
throw new Error('Could not find helpers for a root. This is a bug in React Refresh.');
|
||||
}
|
||||
|
||||
if (!mountedRoots.has(root)) {// No longer mounted.
|
||||
}
|
||||
|
||||
try {
|
||||
helpers.scheduleRefresh(root, update);
|
||||
} catch (err) {
|
||||
if (!didError) {
|
||||
didError = true;
|
||||
firstError = err;
|
||||
} // Keep trying other roots.
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (didError) {
|
||||
throw firstError;
|
||||
}
|
||||
|
||||
return update;
|
||||
} finally {
|
||||
isPerformingRefresh = false;
|
||||
}
|
||||
}
|
||||
function register(type, id) {
|
||||
{
|
||||
if (type === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof type !== 'function' && typeof type !== 'object') {
|
||||
return;
|
||||
} // This can happen in an edge case, e.g. if we register
|
||||
// return value of a HOC but it returns a cached component.
|
||||
// Ignore anything but the first registration for each type.
|
||||
|
||||
|
||||
if (allFamiliesByType.has(type)) {
|
||||
return;
|
||||
} // Create family or remember to update it.
|
||||
// None of this bookkeeping affects reconciliation
|
||||
// until the first performReactRefresh() call above.
|
||||
|
||||
|
||||
var family = allFamiliesByID.get(id);
|
||||
|
||||
if (family === undefined) {
|
||||
family = {
|
||||
current: type
|
||||
};
|
||||
allFamiliesByID.set(id, family);
|
||||
} else {
|
||||
pendingUpdates.push([family, type]);
|
||||
}
|
||||
|
||||
allFamiliesByType.set(type, family); // Visit inner types because we might not have registered them.
|
||||
|
||||
if (typeof type === 'object' && type !== null) {
|
||||
switch (getProperty(type, '$$typeof')) {
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
register(type.render, id + '$render');
|
||||
break;
|
||||
|
||||
case REACT_MEMO_TYPE:
|
||||
register(type.type, id + '$type');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function setSignature(type, key) {
|
||||
var forceReset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
var getCustomHooks = arguments.length > 3 ? arguments[3] : undefined;
|
||||
|
||||
{
|
||||
if (!allSignaturesByType.has(type)) {
|
||||
allSignaturesByType.set(type, {
|
||||
forceReset: forceReset,
|
||||
ownKey: key,
|
||||
fullKey: null,
|
||||
getCustomHooks: getCustomHooks || function () {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
} // Visit inner types because we might not have signed them.
|
||||
|
||||
|
||||
if (typeof type === 'object' && type !== null) {
|
||||
switch (getProperty(type, '$$typeof')) {
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
setSignature(type.render, key, forceReset, getCustomHooks);
|
||||
break;
|
||||
|
||||
case REACT_MEMO_TYPE:
|
||||
setSignature(type.type, key, forceReset, getCustomHooks);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // This is lazily called during first render for a type.
|
||||
// It captures Hook list at that time so inline requires don't break comparisons.
|
||||
|
||||
function collectCustomHooksForSignature(type) {
|
||||
{
|
||||
var signature = allSignaturesByType.get(type);
|
||||
|
||||
if (signature !== undefined) {
|
||||
computeFullKey(signature);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getFamilyByID(id) {
|
||||
{
|
||||
return allFamiliesByID.get(id);
|
||||
}
|
||||
}
|
||||
function getFamilyByType(type) {
|
||||
{
|
||||
return allFamiliesByType.get(type);
|
||||
}
|
||||
}
|
||||
function findAffectedHostInstances(families) {
|
||||
{
|
||||
var affectedInstances = new Set();
|
||||
mountedRoots.forEach(function (root) {
|
||||
var helpers = helpersByRoot.get(root);
|
||||
|
||||
if (helpers === undefined) {
|
||||
throw new Error('Could not find helpers for a root. This is a bug in React Refresh.');
|
||||
}
|
||||
|
||||
var instancesForRoot = helpers.findHostInstancesForRefresh(root, families);
|
||||
instancesForRoot.forEach(function (inst) {
|
||||
affectedInstances.add(inst);
|
||||
});
|
||||
});
|
||||
return affectedInstances;
|
||||
}
|
||||
}
|
||||
function injectIntoGlobalHook(globalObject) {
|
||||
{
|
||||
// For React Native, the global hook will be set up by require('react-devtools-core').
|
||||
// That code will run before us. So we need to monkeypatch functions on existing hook.
|
||||
// For React Web, the global hook will be set up by the extension.
|
||||
// This will also run before us.
|
||||
var hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
||||
|
||||
if (hook === undefined) {
|
||||
// However, if there is no DevTools extension, we'll need to set up the global hook ourselves.
|
||||
// Note that in this case it's important that renderer code runs *after* this method call.
|
||||
// Otherwise, the renderer will think that there is no global hook, and won't do the injection.
|
||||
var nextID = 0;
|
||||
globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {
|
||||
renderers: new Map(),
|
||||
supportsFiber: true,
|
||||
inject: function (injected) {
|
||||
return nextID++;
|
||||
},
|
||||
onScheduleFiberRoot: function (id, root, children) {},
|
||||
onCommitFiberRoot: function (id, root, maybePriorityLevel, didError) {},
|
||||
onCommitFiberUnmount: function () {}
|
||||
};
|
||||
}
|
||||
|
||||
if (hook.isDisabled) {
|
||||
// This isn't a real property on the hook, but it can be set to opt out
|
||||
// of DevTools integration and associated warnings and logs.
|
||||
// Using console['warn'] to evade Babel and ESLint
|
||||
console['warn']('Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). ' + 'Fast Refresh is not compatible with this shim and will be disabled.');
|
||||
return;
|
||||
} // Here, we just want to get a reference to scheduleRefresh.
|
||||
|
||||
|
||||
var oldInject = hook.inject;
|
||||
|
||||
hook.inject = function (injected) {
|
||||
var id = oldInject.apply(this, arguments);
|
||||
|
||||
if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') {
|
||||
// This version supports React Refresh.
|
||||
helpersByRendererID.set(id, injected);
|
||||
}
|
||||
|
||||
return id;
|
||||
}; // Do the same for any already injected roots.
|
||||
// This is useful if ReactDOM has already been initialized.
|
||||
// https://github.com/facebook/react/issues/17626
|
||||
|
||||
|
||||
hook.renderers.forEach(function (injected, id) {
|
||||
if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') {
|
||||
// This version supports React Refresh.
|
||||
helpersByRendererID.set(id, injected);
|
||||
}
|
||||
}); // We also want to track currently mounted roots.
|
||||
|
||||
var oldOnCommitFiberRoot = hook.onCommitFiberRoot;
|
||||
|
||||
var oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || function () {};
|
||||
|
||||
hook.onScheduleFiberRoot = function (id, root, children) {
|
||||
if (!isPerformingRefresh) {
|
||||
// If it was intentionally scheduled, don't attempt to restore.
|
||||
// This includes intentionally scheduled unmounts.
|
||||
failedRoots.delete(root);
|
||||
|
||||
if (rootElements !== null) {
|
||||
rootElements.set(root, children);
|
||||
}
|
||||
}
|
||||
|
||||
return oldOnScheduleFiberRoot.apply(this, arguments);
|
||||
};
|
||||
|
||||
hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) {
|
||||
var helpers = helpersByRendererID.get(id);
|
||||
|
||||
if (helpers !== undefined) {
|
||||
helpersByRoot.set(root, helpers);
|
||||
var current = root.current;
|
||||
var alternate = current.alternate; // We need to determine whether this root has just (un)mounted.
|
||||
// This logic is copy-pasted from similar logic in the DevTools backend.
|
||||
// If this breaks with some refactoring, you'll want to update DevTools too.
|
||||
|
||||
if (alternate !== null) {
|
||||
var wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null && mountedRoots.has(root);
|
||||
var isMounted = current.memoizedState != null && current.memoizedState.element != null;
|
||||
|
||||
if (!wasMounted && isMounted) {
|
||||
// Mount a new root.
|
||||
mountedRoots.add(root);
|
||||
failedRoots.delete(root);
|
||||
} else if (wasMounted && isMounted) ; else if (wasMounted && !isMounted) {
|
||||
// Unmount an existing root.
|
||||
mountedRoots.delete(root);
|
||||
|
||||
if (didError) {
|
||||
// We'll remount it on future edits.
|
||||
failedRoots.add(root);
|
||||
} else {
|
||||
helpersByRoot.delete(root);
|
||||
}
|
||||
} else if (!wasMounted && !isMounted) {
|
||||
if (didError) {
|
||||
// We'll remount it on future edits.
|
||||
failedRoots.add(root);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Mount a new root.
|
||||
mountedRoots.add(root);
|
||||
}
|
||||
} // Always call the decorated DevTools hook.
|
||||
|
||||
|
||||
return oldOnCommitFiberRoot.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
}
|
||||
function hasUnrecoverableErrors() {
|
||||
// TODO: delete this after removing dependency in RN.
|
||||
return false;
|
||||
} // Exposed for testing.
|
||||
|
||||
function _getMountedRootCount() {
|
||||
{
|
||||
return mountedRoots.size;
|
||||
}
|
||||
} // This is a wrapper over more primitive functions for setting signature.
|
||||
// Signatures let us decide whether the Hook order has changed on refresh.
|
||||
//
|
||||
// This function is intended to be used as a transform target, e.g.:
|
||||
// var _s = createSignatureFunctionForTransform()
|
||||
//
|
||||
// function Hello() {
|
||||
// const [foo, setFoo] = useState(0);
|
||||
// const value = useCustomHook();
|
||||
// _s(); /* Call without arguments triggers collecting the custom Hook list.
|
||||
// * This doesn't happen during the module evaluation because we
|
||||
// * don't want to change the module order with inline requires.
|
||||
// * Next calls are noops. */
|
||||
// return <h1>Hi</h1>;
|
||||
// }
|
||||
//
|
||||
// /* Call with arguments attaches the signature to the type: */
|
||||
// _s(
|
||||
// Hello,
|
||||
// 'useState{[foo, setFoo]}(0)',
|
||||
// () => [useCustomHook], /* Lazy to avoid triggering inline requires */
|
||||
// );
|
||||
|
||||
function createSignatureFunctionForTransform() {
|
||||
{
|
||||
var savedType;
|
||||
var hasCustomHooks;
|
||||
var didCollectHooks = false;
|
||||
return function (type, key, forceReset, getCustomHooks) {
|
||||
if (typeof key === 'string') {
|
||||
// We're in the initial phase that associates signatures
|
||||
// with the functions. Note this may be called multiple times
|
||||
// in HOC chains like _s(hoc1(_s(hoc2(_s(actualFunction))))).
|
||||
if (!savedType) {
|
||||
// We're in the innermost call, so this is the actual type.
|
||||
savedType = type;
|
||||
hasCustomHooks = typeof getCustomHooks === 'function';
|
||||
} // Set the signature for all types (even wrappers!) in case
|
||||
// they have no signatures of their own. This is to prevent
|
||||
// problems like https://github.com/facebook/react/issues/20417.
|
||||
|
||||
|
||||
if (type != null && (typeof type === 'function' || typeof type === 'object')) {
|
||||
setSignature(type, key, forceReset, getCustomHooks);
|
||||
}
|
||||
|
||||
return type;
|
||||
} else {
|
||||
// We're in the _s() call without arguments, which means
|
||||
// this is the time to collect custom Hook signatures.
|
||||
// Only do this once. This path is hot and runs *inside* every render!
|
||||
if (!didCollectHooks && hasCustomHooks) {
|
||||
didCollectHooks = true;
|
||||
collectCustomHooksForSignature(savedType);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
function isLikelyComponentType(type) {
|
||||
{
|
||||
switch (typeof type) {
|
||||
case 'function':
|
||||
{
|
||||
// First, deal with classes.
|
||||
if (type.prototype != null) {
|
||||
if (type.prototype.isReactComponent) {
|
||||
// React class.
|
||||
return true;
|
||||
}
|
||||
|
||||
var ownNames = Object.getOwnPropertyNames(type.prototype);
|
||||
|
||||
if (ownNames.length > 1 || ownNames[0] !== 'constructor') {
|
||||
// This looks like a class.
|
||||
return false;
|
||||
} // eslint-disable-next-line no-proto
|
||||
|
||||
|
||||
if (type.prototype.__proto__ !== Object.prototype) {
|
||||
// It has a superclass.
|
||||
return false;
|
||||
} // Pass through.
|
||||
// This looks like a regular function with empty prototype.
|
||||
|
||||
} // For plain functions and arrows, use name as a heuristic.
|
||||
|
||||
|
||||
var name = type.name || type.displayName;
|
||||
return typeof name === 'string' && /^[A-Z]/.test(name);
|
||||
}
|
||||
|
||||
case 'object':
|
||||
{
|
||||
if (type != null) {
|
||||
switch (getProperty(type, '$$typeof')) {
|
||||
case REACT_FORWARD_REF_TYPE:
|
||||
case REACT_MEMO_TYPE:
|
||||
// Definitely React components.
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports._getMountedRootCount = _getMountedRootCount;
|
||||
exports.collectCustomHooksForSignature = collectCustomHooksForSignature;
|
||||
exports.createSignatureFunctionForTransform = createSignatureFunctionForTransform;
|
||||
exports.findAffectedHostInstances = findAffectedHostInstances;
|
||||
exports.getFamilyByID = getFamilyByID;
|
||||
exports.getFamilyByType = getFamilyByType;
|
||||
exports.hasUnrecoverableErrors = hasUnrecoverableErrors;
|
||||
exports.injectIntoGlobalHook = injectIntoGlobalHook;
|
||||
exports.isLikelyComponentType = isLikelyComponentType;
|
||||
exports.performReactRefresh = performReactRefresh;
|
||||
exports.register = register;
|
||||
exports.setSignature = setSignature;
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
/***/ },
|
||||
|
||||
/***/ 206
|
||||
/*!***********************************************!*\
|
||||
!*** ./node_modules/react-refresh/runtime.js ***!
|
||||
\***********************************************/
|
||||
(module, __unused_webpack_exports, __webpack_require__) {
|
||||
|
||||
|
||||
|
||||
if (false) // removed by dead control flow
|
||||
{} else {
|
||||
module.exports = __webpack_require__(/*! ./cjs/react-refresh-runtime.development.js */ 644);
|
||||
}
|
||||
|
||||
|
||||
/***/ }
|
||||
|
||||
/******/ });
|
||||
/************************************************************************/
|
||||
/******/ // 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
|
||||
/******/ if (!(moduleId in __webpack_modules__)) {
|
||||
/******/ delete __webpack_module_cache__[moduleId];
|
||||
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
||||
/******/ e.code = 'MODULE_NOT_FOUND';
|
||||
/******/ throw e;
|
||||
/******/ }
|
||||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ // This entry module used 'module' so it can't be inlined
|
||||
/******/ var __webpack_exports__ = __webpack_require__(206);
|
||||
/******/ window.ReactRefreshRuntime = __webpack_exports__;
|
||||
/******/
|
||||
/******/ })()
|
||||
;
|
||||
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e={644(e,t){(function(){var e=Symbol.for("react.forward_ref"),n=Symbol.for("react.memo"),r="function"==typeof WeakMap?WeakMap:Map,o=new Map,i=new r,f=new r,a=new r,u=[],c=new Map,s=new Map,l=new Set,d=new Set,p="function"==typeof WeakMap?new WeakMap:null,h=!1;function y(e){if(null!==e.fullKey)return e.fullKey;var t,n=e.ownKey;try{t=e.getCustomHooks()}catch(t){return e.forceReset=!0,e.fullKey=n,n}for(var r=0;r<t.length;r++){var o=t[r];if("function"!=typeof o)return e.forceReset=!0,e.fullKey=n,n;var i=f.get(o);if(void 0!==i){var a=y(i);i.forceReset&&(e.forceReset=!0),n+="\n---\n"+a}}return e.fullKey=n,n}function v(e){return e.prototype&&e.prototype.isReactComponent}function m(e,t){return!v(e)&&!v(t)&&!!function(e,t){var n=f.get(e),r=f.get(t);return void 0===n&&void 0===r||void 0!==n&&void 0!==r&&y(n)===y(r)&&!r.forceReset}(e,t)}function R(e){return a.get(e)}function w(e){var t=new Set;return e.forEach((function(e){t.add(e)})),t}function g(e,t){try{return e[t]}catch(e){return}}function b(t,r){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;if(f.has(t)||f.set(t,{forceReset:o,ownKey:r,fullKey:null,getCustomHooks:i||function(){return[]}}),"object"==typeof t&&null!==t)switch(g(t,"$$typeof")){case e:b(t.render,r,o,i);break;case n:b(t.type,r,o,i)}}function _(e){var t=f.get(e);void 0!==t&&y(t)}t._getMountedRootCount=function(){return l.size},t.collectCustomHooksForSignature=_,t.createSignatureFunctionForTransform=function(){var e,t,n=!1;return function(r,o,i,f){if("string"==typeof o)return e||(e=r,t="function"==typeof f),null==r||"function"!=typeof r&&"object"!=typeof r||b(r,o,i,f),r;!n&&t&&(n=!0,_(e))}},t.findAffectedHostInstances=function(e){var t=new Set;return l.forEach((function(n){var r=s.get(n);if(void 0===r)throw new Error("Could not find helpers for a root. This is a bug in React Refresh.");r.findHostInstancesForRefresh(n,e).forEach((function(e){t.add(e)}))})),t},t.getFamilyByID=function(e){return o.get(e)},t.getFamilyByType=function(e){return i.get(e)},t.hasUnrecoverableErrors=function(){return!1},t.injectIntoGlobalHook=function(e){var t=e.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(void 0===t){var n=0;e.__REACT_DEVTOOLS_GLOBAL_HOOK__=t={renderers:new Map,supportsFiber:!0,inject:function(e){return n++},onScheduleFiberRoot:function(e,t,n){},onCommitFiberRoot:function(e,t,n,r){},onCommitFiberUnmount:function(){}}}if(t.isDisabled)console.warn("Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). Fast Refresh is not compatible with this shim and will be disabled.");else{var r=t.inject;t.inject=function(e){var t=r.apply(this,arguments);return"function"==typeof e.scheduleRefresh&&"function"==typeof e.setRefreshHandler&&c.set(t,e),t},t.renderers.forEach((function(e,t){"function"==typeof e.scheduleRefresh&&"function"==typeof e.setRefreshHandler&&c.set(t,e)}));var o=t.onCommitFiberRoot,i=t.onScheduleFiberRoot||function(){};t.onScheduleFiberRoot=function(e,t,n){return h||(d.delete(t),null!==p&&p.set(t,n)),i.apply(this,arguments)},t.onCommitFiberRoot=function(e,t,n,r){var i=c.get(e);if(void 0!==i){s.set(t,i);var f=t.current,a=f.alternate;if(null!==a){var u=null!=a.memoizedState&&null!=a.memoizedState.element&&l.has(t),p=null!=f.memoizedState&&null!=f.memoizedState.element;!u&&p?(l.add(t),d.delete(t)):u&&p||(u&&!p?(l.delete(t),r?d.add(t):s.delete(t)):u||p||r&&d.add(t))}else l.add(t)}return o.apply(this,arguments)}}},t.isLikelyComponentType=function(t){switch(typeof t){case"function":if(null!=t.prototype){if(t.prototype.isReactComponent)return!0;var r=Object.getOwnPropertyNames(t.prototype);if(r.length>1||"constructor"!==r[0])return!1;if(t.prototype.__proto__!==Object.prototype)return!1}var o=t.name||t.displayName;return"string"==typeof o&&/^[A-Z]/.test(o);case"object":if(null!=t)switch(g(t,"$$typeof")){case e:case n:return!0;default:return!1}return!1;default:return!1}},t.performReactRefresh=function(){if(0===u.length)return null;if(h)return null;h=!0;try{var e=new Set,t=new Set,n=u;u=[],n.forEach((function(n){var r=n[0],o=n[1],i=r.current;a.set(i,r),a.set(o,r),r.current=o,m(i,o)?t.add(r):e.add(r)}));var r={updatedFamilies:t,staleFamilies:e};c.forEach((function(e){e.setRefreshHandler(R)}));var o=!1,i=null,f=w(d),y=w(l),v=(g=s,b=new Map,g.forEach((function(e,t){b.set(t,e)})),b);if(f.forEach((function(e){var t=v.get(e);if(void 0===t)throw new Error("Could not find helpers for a root. This is a bug in React Refresh.");if(d.has(e),null!==p&&p.has(e)){var n=p.get(e);try{t.scheduleRoot(e,n)}catch(e){o||(o=!0,i=e)}}})),y.forEach((function(e){var t=v.get(e);if(void 0===t)throw new Error("Could not find helpers for a root. This is a bug in React Refresh.");l.has(e);try{t.scheduleRefresh(e,r)}catch(e){o||(o=!0,i=e)}})),o)throw i;return r}finally{h=!1}var g,b},t.register=function t(r,f){if(null!==r&&("function"==typeof r||"object"==typeof r)&&!i.has(r)){var a=o.get(f);if(void 0===a?(a={current:r},o.set(f,a)):u.push([a,r]),i.set(rLine truncated
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
var wp;
|
||||
(wp ||= {}).domReady = (() => {
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// packages/dom-ready/build-module/index.mjs
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
default: () => domReady
|
||||
});
|
||||
function domReady(callback) {
|
||||
if (typeof document === "undefined") {
|
||||
return;
|
||||
}
|
||||
if (document.readyState === "complete" || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly.
|
||||
document.readyState === "interactive") {
|
||||
return void callback();
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", callback);
|
||||
}
|
||||
return __toCommonJS(index_exports);
|
||||
})();
|
||||
if (typeof wp.domReady === 'object' && wp.domReady.default) { wp.domReady = wp.domReady.default; }
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
"use strict";var wp;(wp||={}).domReady=(()=>{var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})},m=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of a(t))!i.call(e,d)&&d!==n&&o(e,d,{get:()=>t[d],enumerable:!(r=u(t,d))||r.enumerable});return e};var c=e=>m(o({},"__esModule",{value:!0}),e);var p={};f(p,{default:()=>y});function y(e){if(!(typeof document>"u")){if(document.readyState==="complete"||document.readyState==="interactive")return void e();document.addEventListener("DOMContentLoaded",e)}}return c(p);})();
|
||||
if (typeof wp.domReady === 'object' && wp.domReady.default) { wp.domReady = wp.domReady.default; }
|
||||
Vendored
+1083
File diff suppressed because it is too large.
Load diff
Vendored
+1
@@ -0,0 +1 @@
|
||||
"use strict";var wp;(wp||={}).dom=(()=>{var Dt=Object.create;var v=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var vt=Object.getOwnPropertyNames;var Ot=Object.getPrototypeOf,Lt=Object.prototype.hasOwnProperty;var Ht=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),B=(t,e)=>{for(var r in e)v(t,r,{get:e[r],enumerable:!0})},Z=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of vt(e))!Lt.call(t,n)&&n!==r&&v(t,n,{get:()=>e[n],enumerable:!(o=At(e,n))||o.enumerable});return t};var Ft=(t,e,r)=>(r=t!=null?Dt(Ot(t)):{},Z(e||!t||!t.__esModule?v(r,"default",{value:t,enumerable:!0}):r,t)),Pt=t=>Z(v({},"__esModule",{value:!0}),t);var ut=Ht((Ye,lt)=>{lt.exports=window.wp.deprecated});var Qt={};B(Qt,{__unstableStripHTML:()=>Nt,computeCaretRect:()=>K,documentHasSelection:()=>et,documentHasTextSelection:()=>E,documentHasUncollapsedSelection:()=>tt,focus:()=>Kt,getFilesFromDataTransfer:()=>Jt,getOffsetParent:()=>rt,getPhrasingContentSchema:()=>Et,getRectangleFromRange:()=>h,getScrollContainer:()=>W,insertAfter:()=>y,isEmpty:()=>R,isEntirelySelected:()=>nt,isFormElement:()=>it,isHorizontalEdge:()=>ft,isNumberInput:()=>dt,isPhrasingContent:()=>A,isRTL:()=>T,isSelectionForward:()=>O,isTextContent:()=>Zt,isTextField:()=>C,isVerticalEdge:()=>mt,placeCaretAtHorizontalEdge:()=>pt,placeCaretAtVerticalEdge:()=>gt,remove:()=>g,removeInvalidHTML:()=>Tt,replace:()=>ht,replaceTag:()=>bt,safeHTML:()=>M,unwrap:()=>w,wrap:()=>xt});var z={};B(z,{find:()=>S});function Mt(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(",")}function $(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0}function Vt(t){let e=t.closest("map[name]");if(!e)return!1;let r=t.ownerDocument.querySelector('img[usemap="#'+e.name+'"]');return!!r&&$(r)}function S(t,{sequential:e=!1}={}){let r=t.querySelectorAll(Mt(e));return Array.from(r).filter(o=>{if(!$(o)||o.closest("[inert]"))return!1;let{nodeName:n}=o;return n==="AREA"?Vt(o):!0})}var k={};B(k,{find:()=>jt,findNext:()=>Wt,findPrevious:()=>kt,isTabbableIndex:()=>J});function U(t){let e=t.getAttribute("tabindex");return e===null?0:parseInt(e,10)}function J(t){return U(t)!==-1}function _t(){let t={};return function(r,o){let{nodeName:n,type:i,checked:a,name:s}=o;if(n!=="INPUT"||i!=="radio"||!s)return r.concat(o);let f=t.hasOwnProperty(s);if(!(a||!f))return r;if(f){let d=t[s];r=r.filter(l=>l!==d)}return t[s]=o,r.concat(o)}}function Bt(t,e){return{element:t,index:e}}function zt(t){return t.element}function Ut(t,e){let r=U(t.element),o=U(e.element);return r===o?t.index-e.index:r-o}function j(t){return t.filter(J).map(Bt).sort(Ut).map(zt).reduce(_t(),[])}function jt(t){return j(S(t))}function kt(t){return j(S(t.ownerDocument.body)).reverse().find(e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_PRECEDING)}function Wt(t){return j(S(t.ownerDocument.body)).find(e=>t.compareDocumentPosition(e)&t.DOCUMENT_POSITION_FOLLOWING)}function h(t){if(!t.collapsed){let i=Array.from(t.getClientRects());if(i.length===1)return i[0];let a=i.filter(({width:l})=>l>1);if(a.length===0)return t.getBoundingClientRect();if(a.length===1)return a[0];let{top:s,bottom:f,left:u,right:d}=a[0];for(let{top:l,bottom:c,left:m,right:N}of a)l<s&&(s=l),c>f&&(f=c),m<u&&(u=m),N>d&&(d=N);return new window.DOMRect(u,s,d-u,f-s)}let{startContainer:e}=t,{ownerDocument:r}=e;if(e.nodeName==="BR"){let{parentNode:i}=e;let a=Array.from(i.childNodes).indexOf(e);t=r.createRange(),t.setStart(i,a),t.setEnd(i,a)}let o=t.getClientRects();if(o.length>1)return null;let n=o[0];if(!n||n.height===0){let i=r.createTextNode("\u200B");t=t.cloneRange(),t.insertNode(i),n=t.getClientRects()[0],i.parentNode,i.parentNode.removeChild(i)}return n}function K(t){let e=t.getSelection();let r=e.rangeCount?e.getRangeAt(0):null;return r?h(r):null}function E(t){t.defaultView;let e=t.defaultView.getSelection();let r=e.rangeCount?e.getRangeAt(0):null;return!!r&&!r.collapsed}function b(t){return t?.nodeName==="INPUT"}function C(t){let e=["button","checkbox","hidden","file","radio","image","range","reset","submit","number","email","time"];return b(t)&&t.type&&!e.includes(t.type)||t.nodeName==="TEXTAREA"||t.contentEditable==="true"}function Q(t){if(!b(t)&&!C(t))return!1;try{let{selectionStart:e,selectionEnd:r}=t;return e===null||e!==r}catch{return!0}}function tt(t){return E(t)||!!t.activeElement&&Q(t.activeElement)}function et(t){return!!t.activeElement&&(b(t.activeElement)||C(t.activeElement)||E(t))}function p(t){return t.ownerDocument.defaultView,t.ownerDocument.defaultView.getComputedStyle(t)}function W(t,e="vertical"){if(t){if((e==="vertical"||e==="all")&&t.scrollHeight>t.clientHeight){let{overflowY:r}=p(t);if(/(auto|scroll)/.test(r))return t}if((e==="horizontal"||e==="all")&Line truncated
|
||||
Vendored
+2984
File diff suppressed because it is too large.
Load diff
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
var wp;(wp||={}).editPost=(()=>{var ls=Object.create;var He=Object.defineProperty;var ds=Object.getOwnPropertyDescriptor;var fs=Object.getOwnPropertyNames;var us=Object.getPrototypeOf,ms=Object.prototype.hasOwnProperty;var y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wt=(e,t)=>{for(var r in t)He(e,r,{get:t[r],enumerable:!0})},fo=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of fs(t))!ms.call(e,s)&&s!==r&&He(e,s,{get:()=>t[s],enumerable:!(a=ds(t,s))||a.enumerable});return e};var o=(e,t,r)=>(r=e!=null?ls(us(e)):{},fo(t||!e||!e.__esModule?He(r,"default",{value:e,enumerable:!0}):r,e)),cs=e=>fo(He({},"__esModule",{value:!0}),e);var qe=y((vn,uo)=>{uo.exports=window.wp.blocks});var St=y((bn,mo)=>{mo.exports=window.wp.blockLibrary});var Ce=y((wn,co)=>{co.exports=window.wp.deprecated});var O=y((Sn,po)=>{po.exports=window.wp.element});var h=y((xn,go)=>{go.exports=window.wp.data});var U=y((En,ho)=>{ho.exports=window.wp.preferences});var vo=y((_n,yo)=>{yo.exports=window.wp.widgets});var P=y((Pn,bo)=>{bo.exports=window.wp.editor});var R=y((kn,So)=>{So.exports=window.wp.i18n});var Z=y((Tn,xo)=>{xo.exports=window.wp.components});var v=y((In,Eo)=>{Eo.exports=window.ReactJSXRuntime});var Ee=y((Rn,ko)=>{ko.exports=window.wp.primitives});var Io=y((Un,To)=>{To.exports=window.wp.privateApis});var Je=y((Wn,Bo)=>{Bo.exports=window.wp.compose});var At=y((Kn,Co)=>{Co.exports=window.wp.blockEditor});var Ot=y((Yn,Ro)=>{Ro.exports=window.wp.styleEngine});var jo=y((hl,Vo)=>{Vo.exports=window.wp.plugins});var et=y((yl,Do)=>{Do.exports=window.wp.notices});var Vt=y((vl,No)=>{No.exports=window.wp.commands});var pe=y((bl,$o)=>{$o.exports=window.wp.url});var zo=y((wl,Go)=>{Go.exports=window.wp.htmlEntities});var ee=y((Sl,Uo)=>{Uo.exports=window.wp.coreData});var dr=y((Ll,lr)=>{lr.exports=window.wp.keyboardShortcuts});var mr=y((Vl,ur)=>{ur.exports=window.wp.apiFetch});var pr=y((jl,cr)=>{cr.exports=window.wp.hooks});var Nr=y((ad,Dr)=>{Dr.exports=window.wp.keycodes});var hn={};wt(hn,{PluginBlockSettingsMenuItem:()=>on,PluginDocumentSettingPanel:()=>rn,PluginMoreMenuItem:()=>an,PluginPostPublishPanel:()=>nn,PluginPostStatusInfo:()=>ln,PluginPrePublishPanel:()=>sn,PluginSidebar:()=>dn,PluginSidebarMoreMenuItem:()=>fn,__experimentalFullscreenModeClose:()=>tt,__experimentalMainDashboardButton:()=>mn,__experimentalPluginPostExcerpt:()=>un,initializeEditor:()=>pn,reinitializeEditor:()=>gn,store:()=>w});var qa=o(qe(),1),Ka=o(St(),1),Ya=o(Ce(),1),ht=o(O(),1),se=o(h(),1),Ie=o(U(),1),yt=o(vo(),1),vt=o(P(),1);function wo(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=wo(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function ps(){for(var e,t,r=0,a="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=wo(e))&&(a&&(a+=" "),a+=t);return a}var Q=ps;var _o=o(O(),1),Po=o(v(),1),Mo=(0,_o.forwardRef)(({children:e,className:t,ariaLabel:r,as:a="div",...s},n)=>(0,Po.jsx)(a,{ref:n,className:Q("admin-ui-navigable-region",t),"aria-label":r,role:"region",tabIndex:"-1",...s,children:e}));Mo.displayName="NavigableRegion";var xt=Mo;var Ke=o(Ee(),1),Et=o(v(),1),_t=(0,Et.jsx)(Ke.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Et.jsx)(Ke.Path,{d:"M14 6H6v8h1.5V8.5L17 18l1-1-9.5-9.5H14V6Z"})});var Ye=o(Ee(),1),Pt=o(v(),1),Mt=(0,Pt.jsx)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Pt.jsx)(Ye.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})});var Xe=o(Ee(),1),kt=o(v(),1),Tt=(0,kt.jsx)(Xe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,kt.jsx)(Xe.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})});var Qe=o(Ee(),1),It=o(v(),1),Bt=(0,It.jsx)(Qe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,It.jsx)(Qe.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"})});var Ze=o(Ee(),1),Ct=o(v(),1),Rt=(0,Ct.jsx)(Ze.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,Ct.jsx)(Ze.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
Line truncated
|
||||
This can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.`),window.navigator.userAgent.indexOf("iPhone")!==-1&&window.addEventListener("scroll",m=>{let p=document.getElementsByClassName("interface-interface-skeleton__body")[0];m.target===document&&(window.scrollY>100&&(p.scrollTop=p.scrollTop+window.scrollY),document.getElementsByClassName("is-mode-visual")[0]&&window.scrollTo(0,0))}),window.addEventListener("dragover",m=>m.preventDefault(),!1),window.addEventListener("drop",m=>m.preventDefault(),!1),l.render((0,so.jsx)(ht.StrictMode,{children:(0,so.jsx)(Wa,{settings:a,postId:r,postType:t,initialEdits:s})})),l}function gn(){(0,Ya.default)("wp.editPost.reinitializeEditor",{since:"6.2",version:"6.3"})}return cs(hn);})();
|
||||
Vendored
+47277
File diff suppressed because it is too large.
Load diff
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
"use strict";var wp;(wp||={}).editSite=(()=>{var iB=Object.create;var bp=Object.defineProperty;var sB=Object.getOwnPropertyDescriptor;var aB=Object.getOwnPropertyNames;var lB=Object.getPrototypeOf,uB=Object.prototype.hasOwnProperty;var Po=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Lf=(e,t)=>{for(var r in t)bp(e,r,{get:t[r],enumerable:!0})},HC=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of aB(t))!uB.call(e,n)&&n!==r&&bp(e,n,{get:()=>t[n],enumerable:!(o=sB(t,n))||o.enumerable});return e};var a=(e,t,r)=>(r=e!=null?iB(lB(e)):{},HC(t||!e||!e.__esModule?bp(r,"default",{value:e,enumerable:!0}):r,e)),cB=e=>HC(bp({},"__esModule",{value:!0}),e);var Gr=je((gte,UC)=>{UC.exports=window.wp.blocks});var wp=je((vte,WC)=>{WC.exports=window.wp.blockLibrary});var re=je((yte,qC)=>{qC.exports=window.wp.data});var vl=je((bte,YC)=>{YC.exports=window.wp.deprecated});var B=je((wte,ZC)=>{ZC.exports=window.wp.element});var Ke=je((xte,KC)=>{KC.exports=window.wp.editor});var Ao=je((Ste,XC)=>{XC.exports=window.wp.preferences});var JC=je((_te,QC)=>{QC.exports=window.wp.widgets});var he=je((Tte,tT)=>{tT.exports=window.wp.coreData});var yt=je((Ete,rT)=>{rT.exports=window.wp.blockEditor});var j=je((Pte,oT)=>{oT.exports=window.wp.i18n});var xp=je((Ate,nT)=>{nT.exports=window.wp.patterns});var Sp=je((kte,iT)=>{iT.exports=window.wp.privateApis});var Ne=je((Wte,CT)=>{CT.exports=window.wp.router});var M=je((Yte,ET)=>{ET.exports=window.wp.components});var C=je((Zte,PT)=>{PT.exports=window.ReactJSXRuntime});var Je=je((Qte,OT)=>{OT.exports=window.React});var Yb=je((Cre,qT)=>{qT.exports=window.ReactDOM});var ZT=je(YT=>{"use strict";var Hu=Je();function Cj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tj=typeof Object.is=="function"?Object.is:Cj,Ej=Hu.useState,Pj=Hu.useEffect,Aj=Hu.useLayoutEffect,kj=Hu.useDebugValue;function Rj(e,t){var r=t(),o=Ej({inst:{value:r,getSnapshot:t}}),n=o[0].inst,i=o[1];return Aj(function(){n.value=r,n.getSnapshot=t,Zb(n)&&i({inst:n})},[e,r,t]),Pj(function(){return Zb(n)&&i({inst:n}),e(function(){Zb(n)&&i({inst:n})})},[e]),kj(r),r}function Zb(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Tj(e,r)}catch{return!0}}function Oj(e,t){return t()}var Ij=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Oj:Rj;YT.useSyncExternalStore=Hu.useSyncExternalStore!==void 0?Hu.useSyncExternalStore:Ij});var XT=je((Ere,KT)=>{"use strict";KT.exports=ZT()});var Xb=je((Vre,$T)=>{$T.exports=window.wp.a11y});var me=je((Nre,eE)=>{eE.exports=window.wp.primitives});var Qe=je((fie,tE)=>{tE.exports=window.wp.compose});var uE=je((Aie,lE)=>{lE.exports=window.wp.plugins});var Mn=je((kie,cE)=>{cE.exports=window.wp.notices});var mr=je((Rie,fE)=>{fE.exports=window.wp.htmlEntities});var Wh=je((Oie,dE)=>{dE.exports=window.wp.commands});var Js=je((Iie,mE)=>{mE.exports=window.wp.keycodes});var bt=je((Fie,pE)=>{pE.exports=window.wp.url});var _l=je((Lie,bE)=>{bE.exports=window.wp.dom});var VE=je((Xie,FE)=>{FE.exports=window.wp.keyboardShortcuts});var bg=je((Lse,$P)=>{$P.exports=window.wp.apiFetch});var Dx=je((Oae,RA)=>{RA.exports=window.wp.styleEngine});var kg=je((Hae,LA)=>{"use strict";LA.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;for(n of t.entries())if(!e(n[1],r.get(n[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(n of t.entries())if(!r.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(t[n]!==r[n])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(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var s=i[n];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var Rg=je((Wae,jA)=>{"use strict";var F7=function(t){return V7(t)&&!N7(t)};function V7(e){return!!e&&typeof e=="object"}function N7(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||M7(e)}var D7=typeof Symbol=="function"&&Symbol.for,L7=D7?Symbol.for("react.element"):60103;function M7(e){return e.$$typeof===L7}function B7(e){return Array.isArray(e)?[]:{}}function Gd(e,t){return t.clone!Line truncated
|
||||
<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="${e}">
|
||||
<!--
|
||||
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="${r.r.join(" ")}"></feFuncR>
|
||||
<feFuncG type="table" tableValues="${r.g.join(" ")}"></feFuncG>
|
||||
<feFuncB type="table" tableValues="${r.b.join(" ")}"></feFuncB>
|
||||
<feFuncA type="table" tableValues="${r.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>`}function is(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([0-9])([a-zA-Z])/g,"$1-$2").replace(/([a-zA-Z])([0-9])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function Yx(e){if(!e)return;let t=e.match(/var:preset\|spacing\|(.+)/);return t?`var(--wp--preset--spacing--${t[1]})`:e}function ez(e){if(!e)return null;let t=typeof e=="string";return{top:t?e:e?.top,left:t?e:e?.left}}function Zx(e,t="0"){let r=ez(e);if(!r)return null;let o=Yx(r?.top)||t,n=Yx(r?.left)||t;return o===n?o:`${o} ${n}`}var rk={backgroundSize:"cover",backgroundPosition:"50% 50%"};function ok(e){if(!e||!e?.backgroundImage?.url)return;let t;return e?.backgroundSize||(t={backgroundSize:rk.backgroundSize}),e?.backgroundSize==="contain"&&!e?.backgroundPosition&&(t={backgroundPosition:rk.backgroundPosition}),t}var nk={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)",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]},grid:{name:"grid",slug:"grid",className:"is-layout-grid",displayMode:"grid",baseStyles:[{selector:" > :is(*, div)",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]}};var tz={button:"wp-element-button",caption:"wp-element-caption"},rz={__experimentalBorder:"border",color:"color",dimensions:"dimensions",spacing:"spacing",typography:"typography"};function oz(e={},t){return lc.reduce((r,{path:o,valueKey:n,valueFunc:i,cssVarInfix:s})=>{let l=ft(e,o,[]);return["default","theme","custom"].forEach(u=>{l[u]&&l[u].forEach(c=>{n&&!i?r.push(`--wp--preset--${s}--${is(c.slug)}: ${c[n]}`):i&&typeof i=="function"&&r.push(`--wp--preset--${s}--${is(c.slug)}: ${i(c,t)}`)})}),r},[])}function nz(e="*",t={}){return lc.reduce((r,{path:o,cssVarInfix:n,classes:i})=>{if(!i)return r;let s=ft(t,o,[]);return["default","theme","custom"].forEach(l=>{s[l]&&s[l].forEach(({slug:u})=>{i.forEach(({classSuffix:c,propertyName:f})=>{let m=`.has-${is(u)}-${c}`,d=e.split(",").map(g=>`${g}${m}`).join(","),h=`var(--wp--preset--${n}--${is(u)})`;r+=`${d}{${f}: ${h} !important;}`})})}),r},"")}function iz(e={}){return lc.filter(t=>t.path.at(-1)==="duotone").flatMap(t=>{let r=ft(e,t.path,{});return["default","theme"].filter(o=>r[o]).flatMap(o=>r[o].map(n=>tk(`wp-duotone-${n.slug}`,n.colors))).join("")})}function uk(e={},t,r){let o=[];return Object.keys(e).forEach(n=>{let i=t+is(n.replace("/","-")),s=e[n];if(s instanceof Object){let l=i+r;o=[...o,...uk(s,l,r)]}else o.push(`${i}: ${s}`)}),o}function sz(e,t){let r=e.split(","),o=[];return r.forEach(n=>{o.push(`${t.trim()}${n.trim()}`)}),o.join(", ")}var ik=(e,t,r)=>{if(r!=="core/paragraph"||(t?.blocks?.["core/paragraph"]?.typography?.textIndent??t?.typography?.textIndent??"subsequent")!=="all")return e;let i=".wp-block-paragraph + .wp-block-paragraph",s=".wp-block-paragraph";if(i in e){let l=e[i],u={...e};return delete u[i],u[s]=l,u}return e},sk=(e,t)=>{let r={};return Object.entries(e).forEach(([o,n])=>{if(o==="root"||!t?.[o])return;let i=typeof n=="string";if(!i&&typeof n=="object"&&n!==null&&Object.entries(n).forEach(([s,l])=>{if(s==="root"||!t?.[o][s])return;let u={[o]:{[s]:t[o][s]}},c=fc(u);r[l]=[...r[l]||[],...c],delete t[o][s]}),i||typeof n=="object"&&n!==null&&"root"in n){let s=i?n:n.root,l={[o]:t[o]},u=fc(l);r[s]=[...r[s]||[],...u],delete t[o]}}),r};function fc(e={},t="",r,o={},n=!1){let i=hi===t,s=Object.entries(Ur.__EXPERIMENTAL_STYLE_PROPERTY).reduce((u,[c,{value:f,propertiLine truncated
|
||||
.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;
|
||||
`),g+="}"),l.blockStyles&&u.forEach(({selector:y,duotoneSelector:v,styles:b,fallbackGapValue:w,hasLayoutSupport:x,featureSelectors:T,styleVariationSelectors:E,skipSelectorWrapper:k,name:F})=>{if(T){let N=sk(T,b);N=ik(N,e.settings,F),Object.entries(N).forEach(([A,S])=>{if(S.length){let I=S.join(";");g+=`:root :where(${A}){${I};}`}})}if(v){let N={};b?.filter&&(N.filter=b.filter,delete b.filter);let A=fc(N);A.length&&(g+=`${v}{${A.join(";")};}`)}!n&&(hi===y||x)&&(g+=ak({style:b,selector:y,hasBlockGapSupport:r,hasFallbackGapSupport:o,fallbackGapValue:w}));let P=fc(b,y,f,e,i);if(P?.length){let N=k?y:`:root :where(${y})`;g+=`${N}{${P.join(";")};}`}b?.css&&(g+=Kx(b.css,`:root :where(${y})`)),l.variationStyles&&E&&Object.entries(E).forEach(([N,A])=>{let S=b?.variations?.[N];if(S){if(T){let O=sk(T,S);O=ik(O,e.settings,F),Object.entries(O).forEach(([z,R])=>{if(R.length){let D=sz(z,A),G=R.join(";");g+=`:root :where(${D}){${G};}`}})}let I=fc(S,A,f,e);if(I.length&&(g+=`:root :where(${A}){${I.join(";")};}`),S?.css&&(g+=Kx(S.css,`:root :where(${A})`)),x&&S?.spacing?.blockGap){let O=A+y;g+=ak({style:S,selector:O,hasBlockGapSupport:!0,hasFallbackGapSupport:o,fallbackGapValue:w})}}});let V=Object.entries(b).filter(([N])=>N.startsWith(":"));V?.length&&V.forEach(([N,A])=>{let S=fc(A);if(!S?.length)return;let O=`:root :where(${y.split(",").map(z=>z+N).join(",")}){${S.join(";")};}`;g+=O})}),l.layoutStyles&&(g=g+".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }",g=g+".wp-site-blocks > .alignright { float: right; margin-left: 2em; }",g=g+".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"),l.blockGap&&r){let y=Zx(e?.styles?.spacing?.blockGap)||"0.5em";g=g+`:root :where(.wp-site-blocks) > * { margin-block-start: ${y}; margin-block-end: 0; }`,g=g+":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }",g=g+":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"}return l.presets&&c.forEach(({selector:y,presets:v})=>{(hi===y||jd===y)&&(y="");let b=nz(y,v);b.length>0&&(g+=b)}),g};function fz(e,t){return Xx(e,t).flatMap(({presets:o})=>iz(o))}var dz=(e,t)=>{if(e?.selectors&&Object.keys(e.selectors).length>0)return e.selectors;let r={root:t};return Object.entries(rz).forEach(([o,n])=>{let i=cc(e,o);i&&(r[n]=i)}),r},mz=(e,t)=>{let{getBlockStyles:r}=(0,lk.select)(Ur.store),o={};return e.forEach(n=>{let i=n.name,s=cc(n);if(!s)return;let l=cc(n,"filter.duotone");if(!l){let h=cc(n),g=(0,Ur.getBlockSupport)(n,"color.__experimentalDuotone",!1);l=g&&h&&qn(h,g)}let u=!!n?.supports?.layout||!!n?.supports?.__experimentalLayout,c=n?.supports?.spacing?.blockGap?.__experimentalDefault,f=r(i),m={};f?.forEach(h=>{let g=t?`-${t}`:"",y=`${h.name}${g}`,v=NA(y,s);m[y]=v});let d=dz(n,s);o[i]={duotoneSelector:l??void 0,fallbackGapValue:c,featureSelectors:Object.keys(d).length?d:void 0,hasLayoutSupport:u,name:i,selector:s,styleVariationSelectors:f?.length?m:void 0}}),o};function pz(e){let t=e.styles?.blocks,r=t?.["core/separator"];return r&&r.color?.background&&!r.color?.text&&!r.border?.color?{...e,styles:{...e.styles,blocks:{...t,"core/separator":{...r,color:{...r.color,text:r.color?.background}}}}}:e}function Kx(e,t){let r="";return!e||e.trim()===""||e.split("&").forEach(n=>{if(!n||n.trim()==="")return;if(!n.includes("{"))r+=`:root :where(${t}){${n.trim()}}`;else{let s=n.replace("}","").split("{");if(s.length!==2)return;let[l,u]=s,c=l.match(/([>+~\s]*::[a-zA-Z-]+)/),f=c?c[1]:"",m=c?l.replace(f,"").trim():l.trim(),d;m===""?d=t:d=l.startsWith(" ")?qn(t,m):VA(t,m),r+=`:root :where(${d})${f}{${u.trim()}}`}}),r}function Wd(e={},t=[],r={}){let{hasBlockGapSupport:o,hasFallbackGapSupport:n,disableLayoutStyles:i=!1,disableRootPadding:s=!1,styleOptions:l={}}=r,u=t.length>0?t:(0,Ur.getBlockTypes)(),c=Md(e,"spacing.blockGap"),f=o??c!==null,m=n??!f;if(!e?.styles||!e?.settings)return[[],{}];let d=pz(e),h=mz(u),g=uz(d,h),y=cz(d,h,f,m,i,s,l),v=fz(d,h),b=[{css:g,isGlobalStyles:!0},{css:y,isGlobalStyles:!0},{css:d?.styles?.css??"",isGlobalStyles:!0},{assets:v,__unstableType:"svg",isGlobalStyles:!0}];return u.forEach(w=>{let x=d?.styles?.blocks?.[w.name];if(x?.css){let T=h[w.name].selector;b.push({css:Kx(x.css,T),isGlobalStyles:!0})}}),[b,d.settings]}var Qx=a(B(),1);var ck=a(B(),1),Sr=(0,ck.createContext)({user:{styles:{},settings:{}},base:{styles:{},settings:{}},merged:{styles:{},settings:{}},onChange:()=>{},fontLibraryEnabled:!1});var fk=a(C(),1);function Fg({children:e,value:t,baseValue:r,onChange:o,fontLibraryEnabled:n}){let i=(0,Qx.useMemo)(()=>Vl(r,t),[r,t]),s=(0,Qx.useMemo)(()=>({user:t,base:r,merged:i,onChange:o,fontLibraryEnabled:n}),[t,r,i,o,n]);return(0,fk.jsx)(Sr.Provider,{value:s,children:e})}var ss=a(M(),1),Ak=a(j(),1);var kz=a(re(),1),Rz=a(he(),1);var dk=a(C(),1);function Jx({className:e,...t}){return(0,dk.jsx)(ui,{className:Z(e,"global-styles-ui-icon-with-current-color"),...t})}var ha=a(M(),1);var Nl=a(C(),1);function hz({icon:e,children:t,...r}){return(0,Nl.js
Line truncated
|
||||
`),new S("",f,""),new S("",l,"]"),new S("",l," for "),new S("",E,""),new S("",c,""),new S("",l," a "),new S("",l," that "),new S(" ",b,""),new S("",l,". "),new S(".",l,""),new S(" ",l,", "),new S("",k,""),new S("",l," with "),new S("",l,"'"),new S("",l," from "),new S("",l," by "),new S("",F,""),new S("",P,""),new S(" the ",l,""),new S("",m,""),new S("",l,". The "),new S("",w,""),new S("",l," on "),new S("",l," as "),new S("",l," is "),new S("",g,""),new S("",u,"ing "),new S("",l,`
|
||||
`),new S("",l,":"),new S(" ",l,". "),new S("",l,"ed "),new S("",A,""),new S("",V,""),new S("",h,""),new S("",l,"("),new S("",b,", "),new S("",y,""),new S("",l," at "),new S("",l,"ly "),new S(" the ",l," of "),new S("",d,""),new S("",v,""),new S(" ",b,", "),new S("",b,'"'),new S(".",l,"("),new S("",w," "),new S("",b,'">'),new S("",l,'="'),new S(" ",l,"."),new S(".com/",l,""),new S(" the ",l," of the "),new S("",b,"'"),new S("",l,". This "),new S("",l,","),new S(".",l," "),new S("",b,"("),new S("",b,"."),new S("",l," not "),new S(" ",l,'="'),new S("",l,"er "),new S(" ",w," "),new S("",l,"al "),new S(" ",w,""),new S("",l,"='"),new S("",w,'"'),new S("",b,". "),new S(" ",l,"("),new S("",l,"ful "),new S(" ",b,". "),new S("",l,"ive "),new S("",l,"less "),new S("",w,"'"),new S("",l,"est "),new S(" ",b,"."),new S("",w,'">'),new S(" ",l,"='"),new S("",b,","),new S("",l,"ize "),new S("",w,"."),new S("\xC2\xA0",l,""),new S(" ",l,","),new S("",b,'="'),new S("",w,'="'),new S("",l,"ous "),new S("",w,", "),new S("",b,"='"),new S(" ",b,","),new S(" ",w,'="'),new S(" ",w,", "),new S("",w,","),new S("",w,"("),new S("",w,". "),new S(" ",w,"."),new S("",w,"='"),new S(" ",w,". "),new S(" ",b,'="'),new S(" ",w,"='"),new S(" ",b,"='")];i.kTransforms=I,i.kNumTransforms=I.length;function O(z,R){return z[R]<192?(z[R]>=97&&z[R]<=122&&(z[R]^=32),1):z[R]<224?(z[R+1]^=32,2):(z[R+2]^=5,3)}i.transformDictionaryWord=function(z,R,D,G,U){var ce=I[U].prefix,ye=I[U].suffix,Te=I[U].transform,Ie=Te<x?0:Te-(x-1),He=0,pe=R,Se;Ie>G&&(Ie=G);for(var J=0;J<ce.length;)z[R++]=ce[J++];for(D+=Ie,G-=Ie,Te<=v&&(G-=Te),He=0;He<G;He++)z[R++]=s.dictionary[D+He];if(Se=R-G,Te===b)O(z,Se);else if(Te===w)for(;G>0;){var ie=O(z,Se);Se+=ie,G-=ie}for(var $=0;$<ye.length;)z[R++]=ye[$++];return R-pe}},{"./dictionary":6}],12:[function(o,n,i){n.exports=o("./dec/decode").BrotliDecompressBuffer},{"./dec/decode":3}]},{},[12])(12)})();var Zg=(e=>typeof Po<"u"?Po:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Po<"u"?Po:t)[r]}):e)(function(e){if(typeof Po<"u")return Po.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),a5=(function(){var e,t,r;return(function(){function o(n,i,s){function l(f,m){if(!i[f]){if(!n[f]){var d=typeof Zg=="function"&&Zg;if(!m&&d)return d(f,!0);if(u)return u(f,!0);var h=new Error("Cannot find module '"+f+"'");throw h.code="MODULE_NOT_FOUND",h}var g=i[f]={exports:{}};n[f][0].call(g.exports,function(y){var v=n[f][1][y];return l(v||y)},g,g.exports,o,n,i,s)}return i[f].exports}for(var u=typeof Zg=="function"&&Zg,c=0;c<s.length;c++)l(s[c]);return l}return o})()({1:[function(o,n,i){"use strict";var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function l(f,m){return Object.prototype.hasOwnProperty.call(f,m)}i.assign=function(f){for(var m=Array.prototype.slice.call(arguments,1);m.length;){var d=m.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)l(d,h)&&(f[h]=d[h])}}return f},i.shrinkBuf=function(f,m){return f.length===m?f:f.subarray?f.subarray(0,m):(f.length=m,f)};var u={arraySet:function(f,m,d,h,g){if(m.subarray&&f.subarray){f.set(m.subarray(d,d+h),g);return}for(var y=0;y<h;y++)f[g+y]=m[d+y]},flattenChunks:function(f){var m,d,h,g,y,v;for(h=0,m=0,d=f.length;m<d;m++)h+=f[m].length;for(v=new Uint8Array(h),g=0,m=0,d=f.length;m<d;m++)y=f[m],v.set(y,g),g+=y.length;return v}},c={arraySet:function(f,m,d,h,g){for(var y=0;y<h;y++)f[g+y]=m[d+y]},flattenChunks:function(f){return[].concat.apply([],f)}};i.setTyped=function(f){f?(i.Buf8=Uint8Array,i.Buf16=Uint16Array,i.Buf32=Int32Array,i.assign(i,u)):(i.Buf8=Array,i.Buf16=Array,i.Buf32=Array,i.assign(i,c))},i.setTyped(s)},{}],2:[function(o,n,i){"use strict";var s=o("./common"),l=!0,u=!0;try{String.fromCharCode.apply(null,[0])}catch{l=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{u=!1}for(var c=new s.Buf8(256),f=0;f<256;f++)c[f]=f>=252?6:f>=248?5:f>=240?4:f>=224?3:f>=192?2:1;c[254]=c[254]=1,i.string2buf=function(d){var h,g,y,v,b,w=d.length,x=0;for(v=0;v<w;v++)g=d.charCodeAt(v),(g&64512)===55296&&v+1<w&&(y=d.charCodeAt(v+1),(y&64512)===56320&&(g=65536+(g-55296<<10)+(y-56320),v++)),x+=g<128?1:g<2048?2:g<65536?3:4;for(h=new s.Buf8(x),b=0,v=0;b<x;v++)g=d.charCodeAt(v),(g&64512)===55296&&v+1<w&&(y=d.charCodeAt(v+1),(y&64512)===56320&&(g=65536+(g-55296<<10)+(y-56320),v++)),g<128?h[b++]=g:g<2048?(h[b++]=192|g>>>6,h[b++]=128|g&63):g<65536?(h[b++]=224|g>>>12,h[b++]=128|g>>>6&63,h[b++]=128|g&63):(h[b++]=240|g>>>18,h[b++]=128|g>>>12&63,h[b++]=128|g>>>6&63,h[b++]=128|g&63);return h};function m(d,h){if(h<65534&&(d.subarray&&u||!d.subarray&&l))return String.fromCharCode.apply(null,s.shrinkBuf(d,h));for(var g="",y=0;y<h;y++)g+=String.fromCharCode(d[y]);return g}i.buf2binstring=function(d){return m(d,d.length)},i.binstring2buf=function(d){for(var h=new s.Buf8(d.length),g=0,y=h.length;g<y;g++)h[g]=d.charCodeAt(g);return h},i.buf2string=function(d,h){var g,y,v,b,w=h||d.length,x=new Array(w*2);for(y=0,g=0;g<w;){if(v=d[g++]
Line truncated
|
||||
@font-face {
|
||||
font-family: "${e}";
|
||||
${i.join(`
|
||||
`)}
|
||||
src: url("${t}") format("${o}");
|
||||
}`,globalThis.document.head.appendChild(n),n}var DG=[0,1,0,0],LG=[79,84,84,79],MG=[119,79,70,70],BG=[119,79,70,50];function Xg(e,t){if(e.length===t.length){for(let r=0;r<e.length;r++)if(e[r]!==t[r])return;return!0}}function jG(e){let t=[e.getUint8(0),e.getUint8(1),e.getUint8(2),e.getUint8(3)];if(Xg(t,DG)||Xg(t,LG))return"SFNT";if(Xg(t,MG))return"WOFF";if(Xg(t,BG))return"WOFF2"}function zG(e){if(!e.ok)throw new Error(`HTTP ${e.status} - ${e.statusText}`);return e}var w5=class extends bG{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 NG(this.name,e,this.options),this.loadFont(e)))()}async loadFont(e,t){fetch(e).then(r=>zG(r)&&r.arrayBuffer()).then(r=>this.fromDataBuffer(r,t||e)).catch(r=>{let o=new Kg("error",r,`Failed to load font at ${t||e}`);this.dispatch(o),this.onerror&&this.onerror(o)})}async fromDataBuffer(e,t){this.fontData=new DataView(e);let r=jG(this.fontData);if(!r)throw new Error(`${t} is either an unsupported font format, or not a font at all.`);await this.parseBasicData(r);let o=new Kg("load",{font:this});this.dispatch(o),this.onload&&this.onload(o)}async parseBasicData(e){return FG().then(t=>(e==="SFNT"&&(this.opentype=new _G(this,this.fontData,t)),e==="WOFF"&&(this.opentype=new TG(this,this.fontData,t)),e==="WOFF2"&&(this.opentype=new AG(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 this.getGlyphId(e)!==0}supportsVariation(e){return this.opentype.tables.cmap.supportsVariation(e)!==!1}measureText(e,t=16){if(this.__unloaded)throw new Error("Cannot measure text: font was unloaded. Please reload before calling measureText()");let r=document.createElement("div");r.textContent=e,r.style.fontFamily=this.name,r.style.fontSize=`${t}px`,r.style.color="transparent",r.style.background="transparent",r.style.top="0",r.style.left="0",r.style.position="absolute",document.body.appendChild(r);let o=r.getBoundingClientRect();document.body.removeChild(r);let n=this.opentype.tables["OS/2"];return o.fontSize=t,o.ascender=n.sTypoAscender,o.descender=n.sTypoDescender,o}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);let e=new Kg("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);let e=new Kg("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}};globalThis.Font=w5;var ls=class extends Gt{constructor(e,t,r){super(e),this.plaformID=t,this.encodingID=r}},GG=class extends ls{constructor(e,t,r){super(e,t,r),this.format=0,this.length=e.uint16,this.language=e.uint16,this.glyphIdArray=[...new Array(256)].map(o=>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}]}},HG=class extends ls{constructor(e,t,r){super(e,t,r),this.format=2,this.length=e.uint16,this.language=e.uint16,this.subHeaderKeys=[...new Array(256)].map(s=>e.uint16);let o=Math.max(...this.subHeaderKeys),n=e.currentPosition;ve(this,"subHeaders",()=>(e.currentPosition=n,[...new Array(o)].map(s=>new UG(e))));let i=n+o*8;ve(this,"glyphIndexArray",()=>(e.currentPosition=i,[...new Array(o)].map(s=>e.uint16)))}supports(e){e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented."));let t=e&&255,r=e&&65280,o=this.subHeaders[r],n=this.subHeaders[o],i=n.firstCode,s=i+n.entryCount;return i<=t&&t<=s}reverse(e){return console.warn("reverse not implemented for cmap subtable format 2"),{}}getSupportedCharCodes(e=!1){return e?this.subHeaders.map(t=>({firstCode:t.firstCode,lastCode:t.lastCode})):this.subHeaders.map(t=>({start:t.firstCode,end:t.lastCode}))}},UG=class{constructor(e){this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.first+this.entryCount,this.idDelta=e.int16,this.idRangeOffset=e.uint16}},WG=class extends ls{constructor(e,t,r){super(e,t,r),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;let o=e.currentPosition;ve(this,"endCode",()=>e.readBytes(this.segCount,o,16));let n=o+2+this.segCountX2;ve(this,"startCode",()=>e.readBytes(this.segCount,n,16));let i=n+this.segCountX2;ve(this,"idDelta",()=>e.readBytes(this.segCount,i,16,!0));let s=i+this.segCountX2;ve(this,"idRangeOffset",()=>e.readBytes(this.segCount,s,16));let l=s+this.segCountX2,u=this.length-(l-this.tableStart);ve(this,"glyphIdArray",()=>e.readBytes(u,l,16
Line truncated
|
||||
/*! Bundled license information:
|
||||
|
||||
use-sync-external-store/cjs/use-sync-external-store-shim.production.js:
|
||||
(**
|
||||
* @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.
|
||||
*)
|
||||
|
||||
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.
|
||||
*)
|
||||
*/
|
||||
Vendored
+4092
File diff suppressed because it is too large.
Load diff
Loaded 100 of 17470 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user