laipower/wp-content/themes/generatepress/assets/dist/block-editor.js

1 line
19 KiB
JavaScript
Raw Normal View History

!function(){"use strict";var t={n:function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},d:function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.wp.plugins,r=window.wp.data;function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,i,o,s=[],u=!0,h=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){h=!0,a=t}finally{try{if(!u&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(h)throw a}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(0,r.select)("core/edit-post")&&(0,r.select)("core/edit-post").__experimentalGetPreviewDeviceType&&(0,e.registerPlugin)("generatepress-responsive-classes",{render:function(){var t=(0,r.useSelect)((function(){var t=(0,r.select)("core/edit-post").__experimentalGetPreviewDeviceType;return t?{deviceType:t()}:{deviceType:null}}),[]).deviceType;return document.querySelector("body").classList.remove("gp-is-device-desktop","gp-is-device-tablet","gp-is-device-mobile"),document.querySelector("body").classList.add("gp-is-device-"+t.toLowerCase()),null}});var i=window.wp.element,o=window.wp.domReady,s=t.n(o);function u(t){return u="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},u(t)}(0,e.registerPlugin)("generatepress-content-width",{render:function(){var t,e=a((0,i.useState)(generatepressBlockEditor.sidebarLayout),2),r=e[0],n=e[1],o=a((0,i.useState)(generatepressBlockEditor.contentAreaType),2),u=o[0],h=o[1],f=null===(t=document.querySelector(".editor-styles-wrapper"))||void 0===t?void 0:t.style;return(0,i.useEffect)((function(){var t,e=document.querySelector(".editor-styles-wrapper");null==e||null===(t=e.style)||void 0===t||t.setProperty("--content-width",function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r="",n="px",a=generatepressBlockEditor.customContentWidth?parseInt(generatepressBlockEditor.customContentWidth):generatepressBlockEditor.containerWidth,i=generatepressBlockEditor.leftSidebarWidth,o=generatepressBlockEditor.rightSidebarWidth;if(r="left-sidebar"===t?a*((100-i)/100):"right-sidebar"===t?a*((100-o)/100):"no-sidebar"===t?a:a*((100-(Number(i)+Number(o)))/100),""===e){var s=parseInt(generatepressBlockEditor.contentPaddingRight)+parseInt(generatepressBlockEditor.contentPaddingLeft);r=Number(r)-s}return"true"!==e||generatepressBlockEditor.customContentWidth||(r=100,n="%"),r+n}(r,u))}),[r,u,JSON.stringify(f)]),s()((function(){var t=document.getElementById("generate-sidebar-layout"),e=document.getElementById("_generate-full-width-content");t&&(t.onchange=function(t){n(t.target.value||generatepressBlockEditor.globalSidebarLayout)}),e&&(e.onchange=function(t){h(t.target.value||generatepressBlockEditor.contentAreaType)})})),null}});var h=/^\s+/,f=/\s+$/;function l(t,e){if(e=e||{},(t=t||"")instanceof l)return t;if(!(this instanceof l))return new l(t,e);var r=function(t){var e,r,n,a={r:0,g:0,b:0},i=1,o=null,s=null,l=null,c=!1,d=!1;return"string"==typeof t&&(t=function(t){t=t.replace(h,"").replace(f,"").toLowerCase();var e,r=!1;if(H[t])t=H[t],r=!0;else if("transparent"==t)return{r:0,g:0,b:0