import{d as g,k as T,n as $,v as x}from"/build/_shared/chunk-WRTB4GZ2.js";import{a as S}from"/build/_shared/chunk-ZUBD5LGO.js";import{a as C}from"/build/_shared/chunk-ZXLMDTT4.js";import{b as F,d as h}from"/build/_shared/chunk-G5WX4PPA.js";var J=F((U,D)=>{D.exports={}});var G=h(C(),1),o=h(S(),1);function K({copyLeft:f,copyMiddle:r,copyRight:u,showGridButton:w,className:b,light:d,listView:n,setListView:E}){let[i,N]=(0,G.useState)(!1);return(0,o.jsxs)("div",{className:x("fostr-grid",b),children:[f&&(0,o.jsx)("p",{className:`${r?"col-start-1 col-end-3 flex font-secondary text-sm md:col-start-2 md:col-end-4 lg:col-end-4":"col-start-1 col-end-3 flex font-secondary text-sm md:col-start-2 md:col-end-5 lg:col-end-7"} ${d?"text-light":"text-dark"}`,children:f}),r&&(0,o.jsx)("p",{className:`hidden font-secondary text-sm md:col-start-5 md:col-end-7 md:flex lg:col-start-7 lg:col-end-10 ${d?"text-light":"text-dark"}`,children:r}),u&&!w&&(0,o.jsx)("p",{className:`${r?"col-start-3 col-end-5 flex font-secondary text-sm md:col-start-7 md:col-end-8 lg:col-start-10 lg:col-end-12":"col-start-3 col-end-5 flex justify-end font-secondary text-sm md:col-start-5 md:col-end-8 lg:col-start-7 lg:col-end-12"} ${d?"text-light":"text-dark"}`,children:u}),w&&(0,o.jsx)(g.button,{type:"button",onClick:()=>E(!n),onHoverStart:()=>N(!0),onHoverEnd:()=>N(!1),className:"col-start-3 col-end-5 ml-auto font-secondary text-sm md:col-start-7 md:col-end-8 lg:col-start-10 lg:col-end-12",children:(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsxs)("div",{className:"relative w-17 overflow-hidden md:w-17",children:[(0,o.jsx)(g.span,{initial:n||i?{right:"0%"}:{right:"100%"},variants:{grid:{right:"100%"},list:{right:"0%"}},animate:n||i?"list":"grid",className:"absolute ",children:"List"}),(0,o.jsx)(g.span,{initial:n||i?{left:"100%"}:{left:"0%"},variants:{grid:{left:"0%"},list:{left:"100%"}},animate:n||i?"list":"grid",className:"absolute ",children:"Grid"})]}),(0,o.jsx)("div",{children:"\u2014"}),(0,o.jsxs)("div",{className:"relative flex w-17 gap-2 overflow-hidden md:w-17",children:[(0,o.jsx)(g.span,{initial:!n||i?{right:"100%"}:{right:"0%"},variants:{grid:{right:"100%"},list:{right:"0%"}},animate:n||i?"list":"grid",className:"absolute ",children:"Grid"}),(0,o.jsx)(g.span,{initial:!n||i?{left:"0%"}:{left:"100%"},variants:{grid:{left:"0%"},list:{left:"100%"}},animate:n||i?"list":"grid",className:"absolute ",children:"List"})]})]})}),(0,o.jsx)("div",{className:`col-span-full -ml-8 -mr-8 mt-4 h-px ${d?"bg-light":"bg-dark"}`})]})}var Z=K;var a=h(C(),1);var m=h(S(),1);function O({src:f,alt:r,crop:u,hotspot:w,layout:b,sizes:d,className:n,inViewSettings:E}){let i=(0,a.useRef)(null),N=(0,a.useRef)(null),s=(0,a.useRef)(null),H=(0,a.useRef)(null),L=T(H,{margin:E||"-50% 0% -50% 0%",once:!0}),[R,A]=(0,a.useState)(!1),[t,z]=(0,a.useState)({width:1,height:1}),[B,M]=(0,a.useState)(!0),[e,k]=(0,a.useState)(null),[I,q]=(0,a.useState)(.02);(0,a.useEffect)(()=>{s.current&&z({width:s.current.offsetWidth,height:s.current.offsetHeight})},[s]);let y=v=>{if(!e||t.width==0||t.height==0)return;q(v);let c=t.width*v,l=t.height*v;e.drawImage(s.current,0,0,c,l),e.drawImage(i.current,0,0,c,l,0,0,t.width,t.height)},W=()=>{if(console.log("Resizing"),t.width==0||t.height==0)return;z({width:s.current.offsetWidth,height:s.current.offsetHeight});let c=i.current.getContext("2d");if(k(c),!e||t.width==0||t.height==0)return;e.canvas.width=t.width,e.canvas.height=t.height,e.canvas.style.height=`${t.height}px`,e.canvas.style.width=`${t.width}px`,e.imageSmoothingEnabled=!1,e.webkitImageSmoothingEnabled=!1,e.mozImageSmoothingEnabled=!1,e.msImageSmoothingEnabled=!1;let l=t.width*I,p=t.height*I;e.drawImage(s.current,0,0,l,p),e.drawImage(i.current,0,0,l,p,0,0,t.width,t.height)};(0,a.useEffect)(()=>(window.addEventListener("resize",W),()=>window.removeEventListener("resize",W)),[]),(0,a.useEffect)(()=>{let c=i.current.getContext("2d");if(k(c),!e||t.width==0||t.height==0)return;e.canvas.width=t.width,e.canvas.height=t.height,e.canvas.style.height=`${t.height}px`,e.canvas.style.width=`${t.width}px`,e.imageSmoothingEnabled=!1,e.webkitImageSmoothingEnabled=!1,e.mozImageSmoothingEnabled=!1,e.msImageSmoothingEnabled=!1;let l=t.width*I,p=t.height*I;R&&(e.drawImage(s.current,0,0,l,p),e.drawImage(i.current,0,0,l,p,0,0,t.width,t.height))},[e,s,t.height,t.width]),(0,a.useEffect)(()=>{e&&L&&(M(!1),y(.05),setTimeout(()=>{y(.09)},200),setTimeout(()=>{y(.2)},300),setTimeout(()=>{y(1)},400))},[L,R]),(0,a.useEffect)(()=>{s.current&&s.current.complete&&P()},[]);let P=()=>{console.log("Image loaded"),s.current&&z({width:s.current.offsetWidth,height:s.current.offsetHeight}),A(!0)};return(0,m.jsxs)("div",{className:"relative w-full overflow-hidden",ref:H,children:[B&&(0,m.jsx)($,{alt:r,crop:u,hotspot:w,layout:b,width:10,height:10,src:f,ref:N,className:x("absolute h-auto w-full",n),overrideSizes:!0}),(0,m.jsx)("canvas",{"aria-label":r,ref:i,className:"absolute left-0 top-0 -z-[1]"}),(0,m.jsx)($,{alt:r,crop:u,hotspot:w,layout:b,sizes:d,src:f,ref:s,className:x("h-auto w-full opacity-0",n),onLoad:P})]})}var et=O;export{J as a,Z as b,et as c};