1import{n as w}from"./rolldown-runtime-kjsH4l9N.js";import{C as H,K as C,M as S,U as u,Xt as M,f as y,g as c,h as W,i as _,kt as d}from"./runtime-core.esm-bundler-s8AntrsW.js";import{n as P}from"./breakpoints-DX3vDiou.js";import{n as $,t as z}from"./useMedia-C0ZPPaie.js";import{t as x}from"./getBreakpointWidth-CbNy7A-2.js";function I(p){return p.sort((e,h)=>x(h.breakpoint)-x(e.breakpoint))}var A=["srcset","media"],E=["alt","width","height","loading","src","draggable"],R=H({__name:"Pic",props:{sources:{},alt:{},lazy:{type:Boolean,default:!0},encode:{type:Boolean,default:!0},factor:{default:1},bg:{},draggable:{type:Boolean},imageClasses:{},magnolia:{type:Boolean},defaultClasses:{type:Boolean,default:!0},maxWidth:{default:3840},maxHeight:{default:2160}},setup(p){const e=p,{normalizeImageSrc:h}=z(),v=y(()=>{const a=I(e.sources);let g=a.at(0);return g?P.map(r=>{const t=a.find(n=>n.breakpoint===r.name)??g;if(g=t,!t)return;let i=(t.width??r.width)*(t.factor??e.factor),o=t.height?t.height*(t.factor??e.factor):void 0,l=i*2,s=o?o*2:void 0;const f=typeof t.ratio=="number"?t.ratio:typeof t.ratio=="string"?$[t.ratio]:void 0;if(i>e.maxWidth)if(o!==void 0){const n=f??o/i;i=e.maxWidth,o=Math.round(i*n)}else i=e.maxWidth;if(o!==void 0&&o>e.maxHeight){const n=f??o/i;o=e.maxHeight,i=Math.round(o/n)}if(l>e.maxWidth)if(s!==void 0){const n=f??s/l;l=e.maxWidth,s=Math.round(l*n)}else l=e.maxWidth;if(s!==void 0&&s>e.maxHeight){const n=f??s/l;s=e.maxHeight,l=Math.round(s/n)}const b={breakpoint:r,ratio:t.ratio,bg:t.bg??e.bg,encode:e.encode,magnolia:e.magnolia},B=h(t.src,{...b,width:i,height:o,maxWidth:e.maxWidth,maxHeight:e.maxHeight}),k=h(t.src,{...b,width:l,height:s,maxWidth:e.maxWidth,maxHeight:e.maxHeight});return{default:{breakpoint:r.name,src:B},double:{breakpoint:r.name,src:k}}}).filter(Boolean).reverse():[]}),m=y(()=>v.value.at(-1)?.default);return(a,g)=>(u(),c("picture",S({class:{relative:a.defaultClasses}},a.$attrs),[(u(!0),c(_,null,C(d(v),r=>(u(),c(_,{key:`${r?.default?.breakpoint}-${r?.default?.src}`},[r?.default?.src?(u(),c("source",{key:0,srcset:`${r.default.src} 1x, ${r.double.src} 2x`,media:`(min-width: ${("getBreakpointWidth"in a?a.getBreakpointWidth:d(x))(r.default.breakpoint)}px)`},null,8,A)):W("",!0)],64))),128)),d(m)&&a.alt.length>0?(u(),c("img",{key:0,alt:a.alt,width:d(m).width,height:d(m).height,loading:a.lazy?"lazy":void 0,src:d(m).src,class:M(a.imageClasses?a.imageClasses:"w-full h-auto max-h-full"),draggable:e.draggable},null,10,E)):W("",!0)],16))}}),D=w({default:()=>K}),K=Object.assign(R,{__name:"Pic"});export{D as n,K as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.