/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
import{h as e}from"./index.js";import{c as i}from"./p-BK16Cn81.js";const t="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IndoaXRlIgogICAgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWV5ZSI+CiAgICA8cGF0aCBkPSJNMi4wNjIgMTIuMzQ4YTEgMSAwIDAgMSAwLS42OTYgMTAuNzUgMTAuNzUgMCAwIDEgMTkuODc2IDAgMSAxIDAgMCAxIDAgLjY5NiAxMC43NSAxMC43NSAwIDAgMS0xOS44NzYgMCIgLz4KICAgIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjMiIC8+Cjwvc3ZnPg==",s=({expandedImage:t,style:s={},imageStyle:a={},closeImageViewer:n})=>e("div",null,e("div",{onClick:n,class:i("image-viewer-overlay",{active:t}),style:Object.assign({backdropFilter:t?"blur(3px)":"blur(0px)"},s)},e("button",{class:"image-viewer-close-btn"},e("div",{class:"image-viewer-close-line first"}),e("div",{class:"image-viewer-close-line second"}))),e("img",{style:a,alt:"",class:"image-viewer-expanded-image"}));let a;function n(e,i){if(this.expandedImage===i)return;this.originalImage=e;const t=this.el.shadowRoot.querySelector(".image-viewer-expanded-image");t.src=e.src,document.removeEventListener("keydown",a),a=()=>o.bind(this)(),document.addEventListener("keydown",a);const s=e.getBoundingClientRect();document.body.style.overflow="hidden",Object.assign(t.style,{top:`${s.top}px`,pointerEvents:"auto",left:`${s.left}px`,transitionDuration:"0s",width:`${s.width}px`,height:`${s.height}px`}),setTimeout((()=>{const s=window.innerWidth-160,a=window.innerHeight-32,n=e.naturalWidth/e.naturalHeight;let o,c;s/n<=a?(o=s,c=s/n):(c=a,o=a*n),t.style.transitionDuration="0.3s",Object.assign(t.style,{opacity:"1",width:`${o}px`,height:`${c}px`,top:(window.innerHeight-c)/2+"px",left:(window.innerWidth-o)/2+"px"}),this.expandedImage=i}),200)}function o(e){if(null==e||e.preventDefault(),e&&"Escape"!==e.key)return;document.removeEventListener("keydown",a);const i=this.el.shadowRoot.querySelector(".image-viewer-expanded-image"),t=this.originalImage.getBoundingClientRect();Object.assign(i.style,{top:`${t.top}px`,pointerEvents:"none",left:`${t.left}px`,width:`${t.width}px`,height:`${t.height}px`,transitionDuration:"0.3s"}),setTimeout((()=>{i.src="",i.style.opacity="0",i.style.transitionDuration="0s"}),300),document.body.style.overflow="",this.expandedImage=null}export{s as I,o as c,t as e,n as o}