laipower/wp-content/themes/generatepress/assets/dist/customizer.js

3 lines
305 KiB
JavaScript
Raw Normal View History

!function(){var e,t={656:function(e,t,r){"use strict";var a={};function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,"string");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:String(t)}function o(e,t,r){return(t=i(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(a),r.d(a,{FILE:function(){return $o},HTML:function(){return Yo},TEXT:function(){return qo},URL:function(){return Wo}});var s=r(280),l=window.wp.element,c=window.wp.components;function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var d={extend:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return wp.customize.Control.extend(Object.assign({},{ready:function(){var e=this;e.setting.bind((function(){e.renderContent()}))},embed:function(){var e=this,t=e.section();t&&wp.customize.section(t,(function(t){t.expanded.bind((function(t){t&&e.actuallyEmbed()}))}))},actuallyEmbed:function(){var e=this;"resolved"!==e.deferred.embedded.state()&&(e.renderContent(),e.deferred.embedded.resolve())},initialize:function(e,t){var r=this;r.setNotificationContainer=r.setNotificationContainer.bind(r),wp.customize.Control.prototype.initialize.call(r,e,t),wp.customize.control.bind("removed",(function e(t){r===t&&(r.destroy(),r.container.remove(),wp.customize.control.unbind("removed",e))}))},setNotificationContainer:function(e){this.notifications.container=jQuery(e),this.notifications.render()},getWrapper:function(){var e=this,t=e.container[0];if(e.params.choices.wrapper){var r=document.getElementById(e.params.choices.wrapper+"--wrapper");r&&(t=r,e.container.hide())}return t},renderContent:function(){var t=this,r=t.setting.get(),a=(0,s.createElement)(c.SlotFillProvider,null,(0,s.createElement)(e,g(g({},t.params),{},{value:r,setNotificationContainer:t.setNotificationContainer,customizerSetting:t.setting,control:t,choices:t.params.choices,default:t.params.defaultValue})),(0,s.createElement)(c.Popover.Slot,null)),n=t.getWrapper();(0,l.render)(a,n)},destroy:function(){(0,l.unmountComponentAtNode)(this.container[0]),wp.customize.Control.prototype.destroy&&wp.customize.Control.prototype.destroy.call(this)}},t))}},f=d,p=window.wp.i18n;function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function h(e,t){if(e){if("string"==typeof e)return v(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(e,t):void 0}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a,n,i,o,s=[],l=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(a=i.call(r)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return s}}(e,t)||h(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a
/* translators: Unit type (px, em, %) */,{text:(0,p.sprintf)((0,p.__)("%s Preview","generatepress"),t),key:e},(0,s.createElement)(c.Button,{key:e,className:"components-generate-control-button__units--"+e,isSmall:!0
/* translators: %s: values associated with CSS syntax, 'Pixel', 'Em', 'Percentage' */,"aria-label":t,onClick:function(){wp.customize.previewedDevice.set(e),r(e),o(e)}},Ne(e)))})))))},ei=r(80),ti=r.n(ei);function ri(e){var t=e.value,r=e.onChange,a=e.units,n=void 0===a?[]:a,i=e.disabled;return n.length?(n.includes(t)||(n[n.length-1]=t),(0,s.createElement)(s.Fragment,null,(0,s.createElement)(c.DropdownMenu,{className:"gblocks-unit-control-units",label:(0,p.__)("Select a unit","generatepress"),icon:null,toggleProps:{children:t||String.fromCharCode(8212),disabled:i},popoverProps:{className:"gblocks-unit-control-popover",focusOnMount:!0,noArrow:!1}},(function(e){var a=e.onClose;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(c.MenuGroup,null,n.map((function(e){return(0,s.createElement)(c.MenuItem,{key:e,onClick:function(){r(e),a()},isSelected:e===t,variant:e===t?"primary":""},e||String.fromCharCode(8212))})),(0,s.createElement)(c.MenuItem,{onClick:function(){window.open("https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units","_blank").focus()},label:(0,p.__)("Learn more about units","generatepress"),showTooltip:!0},Ne("info"))))})))):null}var ai=["px","em","%","rem","vw","vh","ch","cm","mm","in","pt","pc","ex","lh","rlh","vmin","vmax","vb","vi","svw","svh","svb","svi","svmax","svmin","lvw","lvh","lvb","lvi","lvmax","lvmin","dvw","dvh","dvb","dvi","dvmax","dvmin","fr"];function ni(e){var t=e.label,r=e.units,a=void 0===r?[]:r,n=e.defaultUnit,i=void 0===n?"":n,o=e.unitCount,u=void 0===o?7:o,g=e.id,d=e.disabled,f=void 0!==d&&d,p=e.overrideValue,v=void 0===p?null:p,h=e.overrideAction,m=void 0===h?function(){return null}:h,b=e.onChange,S=e.value,w=e.placeholder,O=e.help,C=void 0===O?"":O,E=e.focusOnMount,D=void 0!==E&&E,N=e.onFocus,x=void 0===N?function(){return null}:N,T=a.concat(ai).slice(0,u),I=y((0,l.useState)(""),2),M=I[0],k=I[1],P=y((0,l.useState)(""),2),_=P[0],R=P[1],L=y((0,l.useState)(""),2),A=L[0],j=L[1],F=(0,l.useRef)(!1),B=(0,l.useRef)(!1),V=(0,l.useRef)(!1),H=function(e){var t=ai.join("|"),r=new RegExp("(".concat(t,")"));return e?e.toString().toLowerCase().split(r).filter((function(e){return""!==e})):[]},z=function(e){return e.length>0?e[0].trim():""},G=i||T[0],U=function(e){return e.length>1?e[1]:e.length>0?"":e.length?void 0:G},K=function(e){return/^([-]?\d|[-]?\.)/.test(e)},$=function(){if(!S){var e=H(v||w);j(z(e)),k(U(e))}};return(0,l.useEffect)((function(){var e=v&&f?v:S;if(K(e)){var t=H(e);R(z(t)),k(U(t))}else R(e),k("");$()}),[S,v]),(0,l.useEffect)((function(){if(F.current){var e=!!v&&!!f,t=K(_)?_+M:_;t||(M!==U(H(w))?j(""):$()),e||t===S||b(t)}else F.current=!0}),[_,M]),(0,l.useEffect)((function(){D&&null!=V&&V.current&&V.current.focus()}),[t]),(0,s.createElement)(c.BaseControl,{label:t,help:C,id:g,className:ti()({"gblocks-unit-control":!0,"gblocks-unit-control__disabled":!!f})},(0,s.createElement)("div",{className:"gblocks-unit-control__input",ref:B},(0,s.createElement)(c.TextControl,{type:"text",value:_,placeholder:A,id:g,autoComplete:"off",disabled:f,onChange:function(e){return R(e)},onFocus:function(){x()},ref:V}),(0,s.createElement)("div",{className:"gblocks-unit-control__input--action"},!!m&&(0,s.createElement)("div",{className:"gblocks-unit-control__override-action"},m()," "),(K(_)||!_&&(!A||K(A)))&&(0,s.createElement)(ri,{value:M,disabled:f||1===T.length,units:T,onChange:function(e){return k(e)}}))))}var ii=function(e){var t=e.label,r=e.units,a=e.defaultUnit,n=void 0===a?"":a,i=e.desktopValue,o=e.desktopInitial,u=e.desktopOnChange,g=e.tabletValue,d=e.tabletInitial,f=e.tabletOnChange,p=e.mobileInitial,v=e.mobileValue,h=e.mobileOnChange,m=y((0,l.useState)("desktop"),2),b=m[0],S=m[1];return(0,s.createElement)(c.BaseControl,null,(0,s.createElement)(Qn,{label:t,devices:["desktop","tablet","mobile"],onClick:function(e){return S(e)}}),(0,s.createElement)("div",{className:"generate-component-input-with-unit"},(0,s.createElement)("div",{className:"generate-component-device-field","data-device":"desktop"},(0,s.createElement)(ni,{key:b,units:r,value:i,placeholder:o,onChange