OwlCyberSecurity - MANAGER
Edit File: 910.js
"use strict";(globalThis.webpackChunkast_block_templates=globalThis.webpackChunkast_block_templates||[]).push([[910],{1910:(e,t,s)=>{s.r(t),s.d(t,{default:()=>h});var o=s(3771),l=s(3914),r=s(6597),n=s(8242),c=s(1594),a=s(6134),i=s(9453),u=s(9260),p=s(7510),m=s(5034),d=s(7497);const{spectra_common_styles:g,is_rtl:b}=ast_block_template_vars,y="visible",h=(0,o.A)((0,n.A)((e=>{const{getDisableAi:t,getDisablePreview:s,getTogglePopup:o}=e("astra-sites");return{disableAi:t(),disablePreview:s(),togglePopup:o()}})))((0,c.memo)((({item:e,content:t,stylesheet:s,astraCustomizer:o,globalStylesheet:n,colorPalette:h,dynamicContent:f,selectedImages:v,disableAi:k,togglePopup:E,email:w,phone:_,address:x,onClickBlock:A})=>{const R=(0,c.useRef)(null),$=(0,c.useRef)(null),I=e["thumbnail-image-url"]||"",S=e["featured-image-url"]||"",N=(0,a.Fx)();let C=0,T=0;const{importing:P}=(0,l.A)((e=>{const{getImporting:t}=e("astra-sites");return{importing:t()}})),{setImporting:q}=(0,r.A)("astra-sites"),[O,j]=(0,c.useState)({importing:!1}),[z,W]=(0,c.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`),[B,H]=(0,c.useState)(`${ast_block_template_vars.uri}dist/placeholder_200_200.png`);function L(){const e=R?.current,t=$?.current;if(!e||!t)return;const s=e.parentNode.offsetWidth/1200,o=s*t.offsetHeight;e.style.transform=`scale(${s})`,e.style.height=`${o}px`}(0,c.useEffect)((()=>{P?document.querySelectorAll(".single-block").forEach((e=>{e.style.pointerEvents="none"})):document.querySelectorAll(".single-block").forEach((e=>{e.style.pointerEvents="auto"}))}),[P]),(0,c.useLayoutEffect)((()=>{let e=!0;const l=v,r=new Image;r.src=I;const c=new Image;c.src=S;const a=$.current;function i(t,s){e&&(t.onload=()=>{s(t.src)})}i(r,W),i(c,H);const u=document.getElementById("astra-wp-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container"),m=document.getElementById("astra-block-editor-styles-inline-css")?.textContent.replace(/:root/g,".block-container").replace(/body/g,".block-container"),d=ast_block_template_vars.wp_stylesheet;let b="";if(s&&(s=((e,t=[])=>k?e:0!==Object.keys(f).length&&f?t&&0===t.length?e:e.replace(/background-image\s*:\s*url\(['"]?([^'")]+)['"]?\)/g,(function(e,s){if((0,p.p)(s))return e;if(!t[T]?.url)return"";const o=t[T]?.url;return T++,T%=t.length,'background-image: url("'+o+'")'})):e)(s,l)),b+=d?`<style type="text/css" id="wp-includes-styles">${d}</style>`:"",b+=o?`<style type="text/css" id="gt-astra-customizer">${o}</style>`:"",b+=`<style type="text/css" id="gt-spectra-common-stylesheet">${g}</style>`,b=s?`${b} <style type="text/css" id="gt-common-stylesheet">${s}</style>`:b,n&&(b+=`<style type="text/css" id="gt-global-stylesheet"> ${n} </style>`),u&&(b+=`<style type="text/css" id="gt-wpeditor-css" > ${u} </style>`),m&&(b+=`<style type="text/css" id="gt-blockeditor-css"> ${m} </style>`),a&&t){let e=a.shadowRoot;if(null===e&&(e=a.attachShadow({mode:"open"})),null===e)return;let s=t;if(!k){const e=f??[];e&&Object.keys(e)?.length>0&&Object.keys(e).forEach((t=>{s=null!==e[t]?s.replace(t,e[t]):s})),f&&Object.keys(f).length>0&&(E=s,w&&(E=E.replace("contact@example.com",w)),_&&(E=E.replace("202-555-0188",_)),x&&(E=E.replace("2360 Hood Avenue, San Diego, CA, 92123",x)),s=E,s=D(s))}e.innerHTML=b+'<div class="st-block-container">'+s+"</div>",h.forEach(((t,s)=>{e?.host.style.setProperty(`--ast-global-color-${s}`,t)}));const o=a.shadowRoot.querySelectorAll("img");e&&(o.forEach((e=>{(0,p.p)(e.src)||k||0===l?.length||0===Object.keys(f).length||!f||M(e,"hidden")})),L(),((e,t)=>{k||0!==Object.keys(f).length&&f&&t?.length&&e?.forEach((function(e){(0,p.p)(e.src)||(e.onload=()=>{const s=e.getAttribute("src")||"";if(s.includes("unsplash")||s.includes("pexels")||s.includes("pixabay"))return void M(e,y);const o=t[C];if(void 0!==o)if(o.url.includes("unsplash")||o.url.includes("pexels")||o.url.includes("pixabay")){if(C++,void 0===t[C]&&(C=0),"PICTURE"===e.parentNode.nodeName)e.parentNode.querySelectorAll("source").forEach((e=>{e.setAttribute("srcset",o.optimized_url)})),e.parentNode.querySelector("img").setAttribute("src",o.optimized_url);else{const t=document.createElement("img");t.src=o.optimized_url,e.parentNode.replaceChild(t,e)}M(e,y)}else M(e,y);else M(e,y)},e.onerror=()=>{M(e,y)})}))})(o,l))}var E;return()=>{e=!1}}),[e,k,f,v]),(0,c.useEffect)((()=>{const e=new ResizeObserver(L);return e.observe(document.documentElement),()=>{e&&e.disconnect()}}),[]),(0,c.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,c.useEffect)((()=>{const e=$?.current;if(e){const t=e.shadowRoot;h.forEach(((e,s)=>{null!==t&&t.host.style.setProperty(`--ast-global-color-${s}`,e)}))}}),[h]);const M=(e,t)=>{e&&(e.style.visibility=t)},D=(e="")=>x?e.replace(/(src="https:\/\/maps\.google\.com\/maps\?q=)([^&]+)(&z=\d+&hl=en&t=m&output=embed&iwloc=near")/g,`$1${encodeURIComponent(x)}$3`):e;let F=0,U=0;const G=(e,t,s)=>{const o=e.scrollTop,l=t-o;let r=0;const n=function(){r+=20;const t=m.A.linearTween(r,o,l,s);e.scrollTop=t,r<s&&(F=setTimeout(n,20))};n()};(0,c.useEffect)((()=>{E||(C=0,T=0)}),[E]);const J=b?"origin-top-right":"origin-top-left";return React.createElement(d.A,{className:(0,a.xW)("w-full h-fit",P?"importing":"")},React.createElement("div",{className:(0,a.xW)("cursor-pointer relative border border-solid border-border-primary hover:border-accent-spectra transition duration-150 ease-in-out overflow-hidden group",P&&"border-accent-spectra")},React.createElement("div",{className:`thumbnail left-0 m-0 min-h-[auto] overflow-visible text-left top-0 ${J} relative pointer-events-none`,ref:R},React.createElement("div",{className:"absolute w-[1200px] pointer-events-none max-h-[1600px] overflow-hidden",ref:$},!t&&React.createElement("img",{srcSet:`${B}, ${z}`,src:z,alt:"Preview"}),React.createElement("div",{className:"preview"},React.createElement("span",{className:"ast-block-templates-icon ast-block-templates-icon-search"})))),React.createElement("div",{className:(0,a.xW)("absolute inset-0 grid grid-cols-1 grid-rows-1 place-items-end",P?"pointer-events-none":""),onMouseEnter:()=>{if("page"!==e.type)return;const t=$.current;F&&clearTimeout(F),U=setTimeout((()=>{G(t,t.scrollHeight,4e3)}),1e3)},onMouseLeave:()=>{U&&clearTimeout(U);const e=$.current;F&&clearTimeout(F),G(e,0,1500)},onClick:(K=e,e=>{!P&&e&&null===e.target.closest(".gt-single-block-action-btns")&&"function"==typeof A&&A(K)}),"aria-hidden":"true"},React.createElement("div",{className:(0,a.xW)("gt-single-block-action-btns opacity-100 md: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===O.importing?"opacity-100":"")},React.createElement(i.A,{title:N.notInstalled?"Install Spectra & Insert":N.inactive?"Activate Spectra & Insert":"Insert",showIcon:N.active,liveRequest:!0,item:e,importing:O.importing,onClick:()=>{j({...O,importing:!0}),q(!0)},onBlockImport:()=>{j({...O,importing:!1}),q(!1)},onImportFail:()=>{j({...O,importing:!1}),q(!1)}}),React.createElement(u.A,{item:e})))));var K})))}}]);