File manager - Edit - /home/matthif/www/wp-content/plugins/ultimate-addons-for-gutenberg/lib/gutenberg-templates/dist/870.js
Back
"use strict";(self.webpackChunkast_block_templates=self.webpackChunkast_block_templates||[]).push([[870],{7870:function(e,t,o){o.r(t),o.d(t,{default:function(){return C}});var a=o(5711),r=o(5940),s=o(7363),n=o(8195),l=o(5302),c=o(1882),i=o(8096),p=o(5868),m=o(4142),u=o(9148),d=o(6128),g=o(1569),b=o(5622),f=o(8680),h=o(1277),y=o(7712),k=o(6302);const{post:v}=wp.ajax,{parse:I}=wp.blocks;var w=(0,a.Z)((0,r.Z)((e=>{const{getImportItemInfo:t,getCurrentScreen:o,getSitePreview:a,getActiveBlockPaletteSlug:r,getActivePagePaletteSlug:s,getDisableAi:n,getAdaptiveMode:l}=e("ast-block-templates");return{importItemInfo:t(),sitePreview:a(),currentScreen:o(),activeBlockPaletteSlug:r(),activePagePaletteSlug:s(),disableAI:n(),adaptiveMode:l()}})),(0,i.Z)((e=>{const{setImportItemInfo:t,setTogglePopup:o,setOnboardingAiPopup:a}=e("ast-block-templates"),{insertBlocks:r}=wp.data.dispatch("core/block-editor");return{setImportItemInfo:t,onSetTogglePopup:o,insertBlocks:r,setOnboardingAiPopup:a}})))((0,s.memo)((e=>{let{setImportItemInfo:t,requiredPlugins:o,importItemInfo:a,title:r,btnClass:i,insertBlocks:w,onSetTogglePopup:_,item:P,onClick:E,onBlockImport:S,activeBlockPaletteSlug:x,activePagePaletteSlug:A,currentScreen:R,disableAI:N,importing:C=!1,adaptiveMode:$,showIcon:T=!0}=e,[j]=(0,s.useState)(a),B=o||[];const O=i||"",[Z]=(0,s.useState)(r||"Import"),{index:L}=wp.data.select("core/block-editor").getBlockInsertionPoint(),{importInProgress:D,syncLibNotice:q,stepData:{token:M}}=(0,l.Z)((e=>{const{getImportInProgress:t,getNotice:o,getAIStepData:a}=e(k.L);return{importInProgress:t(),syncLibNotice:o(),stepData:a()}}),[]),{setImportInProgress:z,toggleConnectZipAI:F}=(0,c.Z)(k.L),W="info"===q?.type,H=(0,n.gt)(),K=(e,t,o)=>{(0,h.Am)((0,y.Z)({title:e,message:t}),y.Z.getOptions({type:o}))},Q=async()=>{try{await(0,u.j)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"})}catch(e){z(!1),K("Import failed!","Spectra activation failed!","error")}},U=()=>{(0,u.j)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((()=>{X()})).catch((()=>{z(!1),K("Import failed!","WPForms activation failed!","error")}))},V=()=>{const e=j.original_content,t="all-blocks-grid"===R?"block":"page",o="block"===t?j["blocks-category"][0]:j["pages-category"][0];v({action:"ast_block_templates_import_block",content:e,category:o,_ajax_nonce:ast_block_template_vars._ajax_nonce,style:"all-blocks-grid"===R?x:A,disableAI:N,block_type:t,adaptiveMode:$}).done((e=>{z(!1);const t=(0,n.CN)(I(e));w(t,L,"",!1),G(t[0].clientId),_(),document.getElementById("ast-block-templates-modal-wrap").classList.remove("open"),document.body.classList.remove("ast-block-templates-modal-open"),(H.inactive||H.notInstalled)&&(0,b.iP)(),"function"==typeof S&&S(e,L)})).fail((()=>{z(!1),K("Import failed!","Failed to import the block. Please try again later or contact support for assistance.","error")}))},G=e=>{e&&setTimeout((()=>{const t=J(),o="block-"+e,a=t.getElementById(o);a&&a.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})}),2500)},J=()=>{const e=document.getElementsByClassName("is-tablet-preview"),t=document.getElementsByClassName("is-mobile-preview");if(0!==e.length||0!==t.length){const o=e[0]||t[0];let a=!1;o&&(a=o.getElementsByTagName("iframe")[0]);const r=a?.contentWindow.document||a?.contentDocument;if(r)return r}return document},X=()=>{j?.["post-meta"]?.["astra-site-wpforms-path"]||""?v({action:"ast_block_templates_import_wpforms",id:j.id,_ajax_nonce:ast_block_template_vars._ajax_nonce}).done((()=>{V()})).fail((()=>{z(!1),K("Import failed!","WPForms import failed!","error")})):V()};return React.createElement(p.Z,{className:(0,n.AK)("min-w-[4.875rem] h-7 hover:shadow-small sp-text-sm",O,(D&&!C||W)&&"opacity-50 cursor-not-allowed"),type:"button",variant:"primary",onClick:M?async e=>{D||W||(z(!0),"function"==typeof E&&E(e),H.notInstalled?await(async()=>{try{await(0,u.H)({slug:"ultimate-addons-for-gutenberg",init:"ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php",name:"Spectra"}),await Q()}catch(e){z(!1),K("Import failed!","Spectra installation failed!","error")}})():H.inactive&&await Q(),(0,g.I)(P.ID,"astra-blocks").then((e=>{t(e),j=e,B=e?.["post-meta"]?.["astra-blocks-required-plugins"]?d.t.parse(e["post-meta"]["astra-blocks-required-plugins"]):[],B.length?"not-installed"===ast_block_template_vars.wpforms_status?(0,u.H)({slug:"wpforms-lite",init:"wpforms-lite/wpforms.php",name:"WPForms Lite"}).then((()=>{U()})).catch((()=>{z(!1),K("Import failed!","WPForms installation failed!","error")})):"inactive"===ast_block_template_vars.wpforms_status?U():X():X()})).catch((e=>{K("Import failed!",e,"error"),z(!0)})))}:async()=>{F(),(0,n.jw)("ast-import",{blockId:P.ID,blockType:P.type,blockPaletteSlug:x,pagePaletteSlug:A})},isSmall:!0,hasPrefixIcon:!C&&T},C?React.createElement(m.Z,{className:"h-4 w-4 !shrink-0"}):React.createElement(React.Fragment,null,T&&React.createElement(f.Z,{className:"h-4 w-4 !shrink-0"}),React.createElement("span",{className:"truncate"},Z)))}))),_=o(168);const P=e=>{const t=["skip","logo","fav-icon"];for(const o of t)if(e.includes(o))return!0;return!1},E={linearTween(e,t,o,a){return o*e/a+t},easeInQuad(e,t,o,a){return o*(e/=a)*e+t},easeOutQuad(e,t,o,a){return-o*(e/=a)*(e-2)+t},easeInOutQuad(e,t,o,a){return(e/=a/2)<1?o/2*e*e+t:-o/2*(--e*(e-2)-1)+t},easeInCubic(e,t,o,a){return o*(e/=a)*e*e+t},easeOutCubic(e,t,o,a){return e/=a,o*(--e*e*e+1)+t},easeInOutCubic(e,t,o,a){return(e/=a/2)<1?o/2*e*e*e+t:o/2*((e-=2)*e*e+2)+t}};Object.seal(E);var S=E,x=o(7692);const{spectra_common_styles:A,is_rtl:R}=ast_block_template_vars,N="visible";var C=(0,a.Z)((0,r.Z)((e=>{const{getDisableAi:t,getDisablePreview:o,getTogglePopup:a}=e("ast-block-templates");return{disableAi:t(),disablePreview:o(),togglePopup:a()}})))((0,s.memo)((e=>{let{item:t,content:o,stylesheet:a,astraCustomizer:r,globalStylesheet:l,colorPalette:c,dynamicContent:i,selectedImages:p,disableAi:m,togglePopup:u,email:d,phone:g,address:b}=e;const f=(0,s.useRef)(null),h=(0,s.useRef)(null),y=t["thumbnail-image-url"]||"",k=t["featured-image-url"]||"",v=(0,n.gt)();let I=0,E=0,C=0;const[$,T]=(0,s.useState)({importing:!1}),[j,B]=(0,s.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`),[O,Z]=(0,s.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`);function L(){const e=f?.current,t=h?.current;if(!e||!t)return;const o=e.parentNode.offsetWidth/1200,a=o*t.offsetHeight;e.style.transform=`scale(${o})`,e.style.height=`${a}px`}(0,s.useLayoutEffect)((()=>{let e=!0;const t={landscape:[],portrait:[]};p?.forEach((e=>{"landscape"===e.orientation?t.landscape.push(e):t.portrait.push(e)}));const s=t,n=new Image;n.src=y;const u=new Image;u.src=k;const f=h.current;function v(t,o){e&&(t.onload=()=>{o(t.src)})}v(n,B),v(u,Z);const w=document.getElementById("astra-wp-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container"),_=document.getElementById("astra-block-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container");let S="";var x,R,$;if(a&&(x=a,R=s?.landscape,a=m?x:0!==Object.keys(i).length&&i?R&&0===R.length?x:x.replace(/background-image\s*:\s*url\(['"]?([^'")]+)['"]?\)/g,(function(e,t){if(P(t))return e;if(!R[C]?.url)return"";const o=R[C]?.url;return C++,C%=R.length,'background-image: url("'+o+'")'})):x),S+=r?`<style type="text/css" id="gt-astra-customizer">${r}</style>`:"",S+=`<style type="text/css" id="gt-spectra-common-stylesheet">${A}</style>`,S=a?`${S} <style type="text/css" id="gt-common-stylesheet">${a}</style>`:S,l&&(S+=`<style type="text/css" id="gt-global-stylesheet"> ${l} </style>`),w&&(S+=`<style type="text/css" id="gt-wpeditor-css" > ${w} </style>`),_&&(S+=`<style type="text/css" id="gt-blockeditor-css"> ${_} </style>`),f&&o){let e=f.shadowRoot;if(null===e&&(e=f.attachShadow({mode:"open"})),null===e)return;let t=o;if(!m){const e=i??[];e&&Object.keys(e)?.length>0&&Object.keys(e).forEach((o=>{t=null!==e[o]?t.replace(o,e[o]):t})),i&&Object.keys(i).length>0&&($=t,d&&($=$.replace("contact@example.com",d)),g&&($=$.replace("202-555-0188",g)),b&&($=$.replace("2360 Hood Avenue, San Diego, CA, 92123",b)),t=$,t=q(t))}e.innerHTML=S+'<div class="st-block-container">'+t+"</div>",c.forEach(((t,o)=>{e?.host.style.setProperty(`--ast-global-color-${o}`,t)}));const a=f.shadowRoot.querySelectorAll("img");e&&(a.forEach((e=>{P(e.src)||m||0===s.landscape.length||0===s.portrait.length||0===Object.keys(i).length||!i||D(e,"hidden")})),L(),((e,t)=>{if(m)return;if(0===Object.keys(i).length||!i)return;const o=t.landscape?t.landscape:[],a=t.portrait?t.portrait:[];0!==o.length&&0!==a.length&&e?.forEach((function(e,t){P(e.src)||(e.onload=()=>{const r=e.getAttribute("src")||"";if(r.includes("unsplash")||r.includes("pexels")||r.includes("pixabay"))return void D(e,N);const s=(e=>{const t=new Image;return t.src=e,t.width>t.height?"landscape":"portrait"})(e.src);let n;if(I=t%o.length,E=t%a.length,n="landscape"===s?o[I]:a[E],void 0!==n)if(n.url.includes("unsplash")||n.url.includes("pexels")||n.url.includes("pixabay")){if("landscape"===s?(I++,I%=o.length):(E++,E%=a.length),"PICTURE"===e.parentNode.nodeName)e.parentNode.querySelectorAll("source").forEach((e=>{e.setAttribute("srcset",n.optimized_url)})),e.parentNode.querySelector("img").setAttribute("src",n.optimized_url);else{const t=document.createElement("img");t.src=n.optimized_url,e.parentNode.replaceChild(t,e)}D(e,N)}else D(e,N);else D(e,N)},e.onerror=()=>{D(e,N)})}))})(a,s))}return()=>{e=!1}}),[t,m,i,p]),(0,s.useEffect)((()=>{const e=new ResizeObserver(L);return e.observe(document.documentElement),()=>{e&&e.disconnect()}}),[]),(0,s.useEffect)((()=>{const e=document.querySelector("#ast-block-templates-modal-wrap");if(!e)return;const t=new MutationObserver(L);return t.observe(e,{childList:!0,attributes:!0,subtree:!0}),()=>{t&&t.disconnect()}}),[]),(0,s.useEffect)((()=>{const e=h?.current;if(e){const t=e.shadowRoot;c.forEach(((e,o)=>{null!==t&&t.host.style.setProperty(`--ast-global-color-${o}`,e)}))}}),[c]);const D=(e,t)=>{e&&(e.style.visibility=t)},q=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return b?e.replace(/(src="https:\/\/maps\.google\.com\/maps\?q=)([^&]+)(&z=\d+&hl=en&t=m&output=embed&iwloc=near")/g,`$1${encodeURIComponent(b)}$3`):e};let M=0,z=0;const F=(e,t,o)=>{const a=e.scrollTop,r=t-a;let s=0;const n=function(){s+=20;const t=S.linearTween(s,a,r,o);e.scrollTop=t,s<o&&(M=setTimeout(n,20))};n()};(0,s.useEffect)((()=>{u||(I=0,E=0,C=0)}),[u]);const W=R?"origin-top-right":"origin-top-left";return React.createElement(x.Z,{className:(0,n.AK)("w-full h-fit p-5",!0===$.importing?"importing":"")},React.createElement("div",{className:(0,n.AK)("cursor-pointer relative border border-solid border-border-primary hover:border-accent-spectra transition duration-150 ease-in-out overflow-hidden group",$.importing&&"border-accent-spectra")},React.createElement("div",{className:`thumbnail left-0 m-0 min-h-[auto] overflow-visible text-left top-0 ${W} relative pointer-events-none`,ref:f},React.createElement("div",{className:"absolute w-[1200px] pointer-events-none max-h-[1600px] overflow-hidden",ref:h},!o&&React.createElement("img",{srcSet:`${O}, ${j}`,src:j,alt:"Preview"}),React.createElement("div",{className:"preview"},React.createElement("span",{className:"ast-block-templates-icon ast-block-templates-icon-search"})))),React.createElement("div",{className:"absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-end",onMouseEnter:()=>{if("page"!==t.type)return;const e=h.current;M&&clearTimeout(M),z=setTimeout((()=>{F(e,e.scrollHeight,4e3)}),1e3)},onMouseLeave:()=>{z&&clearTimeout(z);const e=h.current;M&&clearTimeout(M),F(e,0,1500)}},React.createElement("div",{className:(0,n.AK)("opacity-0 group-hover:opacity-100 w-full flex items-center justify-between px-3 py-2 backdrop-blur-sm bg-white/[0.85] shadow-action-buttons transition-all duration-150 ease-in-out",!0===$.importing?"opacity-100":"")},React.createElement(w,{title:v.notInstalled?"Install Spectra & Insert":v.inactive?"Activate Spectra & Insert":"Insert",showIcon:v.active,liveRequest:!0,item:t,importing:$.importing,onClick:()=>{T({...$,importing:!0})},onBlockImport:()=>{T({...$,importing:!1})}}),React.createElement(_.Z,{item:t})))))})))}}]);
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings