File "view.min-20250112152745.js"

Full Path: /home/pumpbmko/public_html/wp-content/plugins/gutenberg/build/block-library/blocks/image/view.min-20250112152745.js
File size: 4.27 KB
MIME-type: text/plain
Charset: utf-8

(()=>{"use strict";const t=window.wp.interactivity;let e=!1,n=0;const{state:a,actions:o,callbacks:r}=(0,t.store)("core/image",{state:{currentImageId:null,get currentImage(){return a.metadata[a.currentImageId]},get overlayOpened(){return null!==a.currentImageId},get roleAttribute(){return a.overlayOpened?"dialog":null},get ariaModal(){return a.overlayOpened?"true":null},get enlargedSrc(){return a.currentImage.uploadedSrc||"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},get figureStyles(){return a.overlayOpened&&`${a.currentImage.figureStyles?.replace(/margin[^;]*;?/g,"")};`},get imgStyles(){return a.overlayOpened&&`${a.currentImage.imgStyles?.replace(/;$/,"")}; object-fit:cover;`},get imageButtonRight(){const{imageId:e}=(0,t.getContext)();return a.metadata[e].imageButtonRight},get imageButtonTop(){const{imageId:e}=(0,t.getContext)();return a.metadata[e].imageButtonTop},get isContentHidden(){const e=(0,t.getContext)();return a.overlayEnabled&&a.currentImageId===e.imageId},get isContentVisible(){const e=(0,t.getContext)();return!a.overlayEnabled&&a.currentImageId===e.imageId}},actions:{showLightbox(){const{imageId:e}=(0,t.getContext)();a.metadata[e].imageRef?.complete&&(a.scrollTopReset=document.documentElement.scrollTop,a.scrollLeftReset=document.documentElement.scrollLeft,a.overlayEnabled=!0,a.currentImageId=e,r.setOverlayStyles())},hideLightbox(){a.overlayEnabled&&(a.showClosingAnimation=!0,a.overlayEnabled=!1,setTimeout((function(){a.currentImage.buttonRef.focus({preventScroll:!0}),a.currentImageId=null}),450))},handleKeydown(e){if(a.overlayEnabled){if("Tab"===e.key){e.preventDefault();const{ref:n}=(0,t.getElement)();n.querySelector("button").focus()}"Escape"===e.key&&o.hideLightbox()}},handleTouchMove(t){a.overlayEnabled&&t.preventDefault()},handleTouchStart(){e=!0},handleTouchEnd(){n=Date.now(),e=!1},handleScroll(){a.overlayOpened&&!e&&Date.now()-n>450&&window.scrollTo(a.scrollLeftReset,a.scrollTopReset)}},callbacks:{setOverlayStyles(){if(!a.currentImage.imageRef)return;let{naturalWidth:t,naturalHeight:e,offsetWidth:n,offsetHeight:o}=a.currentImage.imageRef,{x:r,y:i}=a.currentImage.imageRef.getBoundingClientRect();const l=t/e;let g=n/o;if("contain"===a.currentImage.scaleAttr)if(l>g){const t=n/l;i+=(o-t)/2,o=t}else{const t=o*l;r+=(n-t)/2,n=t}g=n/o;let c=parseFloat("none"!==a.currentImage.targetWidth?a.currentImage.targetWidth:t),d=parseFloat("none"!==a.currentImage.targetHeight?a.currentImage.targetHeight:e),s=c/d,u=c,m=d,h=c,p=d;if(l.toFixed(2)!==s.toFixed(2)){if(l>s){const t=c/l;d-t>c?(d=t,c=t*l):d=c/l}else{const t=d*l;c-t>d?(c=t,d=t/l):c=d*l}h=c,p=d,s=c/d,g>s?(u=c,m=u/g):(m=d,u=m*g)}(n>h||o>p)&&(h=n,p=o);let f=0;window.innerWidth>480?f=80:window.innerWidth>1920&&(f=160);const w=Math.min(window.innerWidth-f,h),y=Math.min(window.innerHeight-80,p);g>w/y?(h=w,p=h/g):(p=y,h=p*g);const I=n/h,b=c*(h/u),x=d*(p/m);a.overlayStyles=`\n\t\t\t\t:root {\n\t\t\t\t\t--wp--lightbox-initial-top-position: ${i}px;\n\t\t\t\t\t--wp--lightbox-initial-left-position: ${r}px;\n\t\t\t\t\t--wp--lightbox-container-width: ${h+1}px;\n\t\t\t\t\t--wp--lightbox-container-height: ${p+1}px;\n\t\t\t\t\t--wp--lightbox-image-width: ${b}px;\n\t\t\t\t\t--wp--lightbox-image-height: ${x}px;\n\t\t\t\t\t--wp--lightbox-scale: ${I};\n\t\t\t\t\t--wp--lightbox-scrollbar-width: ${window.innerWidth-document.documentElement.clientWidth}px;\n\t\t\t\t}\n\t\t\t`},setButtonStyles(){const{imageId:e}=(0,t.getContext)(),{ref:n}=(0,t.getElement)();a.metadata[e].imageRef=n,a.metadata[e].currentSrc=n.currentSrc;const{naturalWidth:o,naturalHeight:r,offsetWidth:i,offsetHeight:l}=n;if(0===o||0===r)return;const g=n.parentElement,c=n.parentElement.clientWidth;let d=n.parentElement.clientHeight;const s=g.querySelector("figcaption");if(s){const t=window.getComputedStyle(s);["absolute","fixed"].includes(t.position)||(d=d-s.offsetHeight-parseFloat(t.marginTop)-parseFloat(t.marginBottom))}const u=d-l,m=c-i;let h=u+16,p=m+16;if("contain"===a.metadata[e].scaleAttr){const t=o/r;t>=i/l?(h=(l-i/t)/2+u+16,p=m+16):(h=u+16,p=(i-l*t)/2+m+16)}a.metadata[e].imageButtonTop=h,a.metadata[e].imageButtonRight=p},setOverlayFocus(){if(a.overlayEnabled){const{ref:e}=(0,t.getElement)();e.focus()}},initTriggerButton(){const{imageId:e}=(0,t.getContext)(),{ref:n}=(0,t.getElement)();a.metadata[e].buttonRef=n}}},{lock:!0})})();
//# sourceMappingURL=view.min.js.map