import{p as b,f as u,a as n,c as V,s as pe}from"./props-b4vEeO_8.js";import{G as se,B as re,C as P,F as C,k as t,N as L,I as N,a3 as me,a4 as ue,J as $,D as F,n as ge}from"./runtime-C3rQLW--.js";import{i as fe}from"./lifecycle-F2p_Qkk3.js";import{c as he,d as ye}from"./create-runtime-stories-7AWWVphH.js";import{i as X}from"./svelte-component-C8Ginrj8.js";import{e as q,i as B}from"./each-CVpBMMjG.js";import{s as D}from"./attributes-Cg6aLqN3.js";import{s as Y}from"./style-DvJ3IcV1.js";import{b as we}from"./size-DMdj3-I9.js";import{B as ee}from"./Block-D3Ui8rd-.js";import{P as ve}from"./PaddingReset-_TGvg1_B.js";import{M as _e}from"./Markdown-DUxFwijc.js";import{r as te}from"./index-CX1x869l.js";const ke=1024,xe=768,ae=(a,e,s)=>{if(a===0)return{breakpoint:s,rows:[]};if(a===1)return{breakpoint:s,rows:[1]};const r=Math.floor(a/e),o=a%e;let i=[];return o===0?i=Array(r).fill(e):i=[o,...Array(r).fill(e)],{breakpoint:s,rows:i}},be=(a,e)=>[ae(a,e==="normal"?2:e==="widest"||e==="fluid"?4:3,ke),ae(a,2,xe)],Pe=(a,e)=>{if(!e)return a.map(o=>[o]);let s=0;const r=[];for(const o of e.rows){const i=[];for(const g of[...Array(o).keys()])i.push(a[g+s]);r.push(i),s+=o}return r};var Se=u('
altText
'),Te=u('
'),je=u('
'),Me=u('
'),Ae=u('
'),Le=u('
',1);function K(a,e){re(e,!0);let s=b(e,"gap",3,15),r=b(e,"id",19,()=>"photopack-"+te()+te()),o=b(e,"class",3,""),i=b(e,"width",3,"normal"),g=b(e,"textWidth",3,"normal"),v=ue(0),S=L(()=>e.layouts?[...e.layouts].sort((d,c)=>d.breakpoint{var d;return(d=t(S))==null?void 0:d.find(c=>c.rows.reduce((p,l)=>p+l,0)===e.images.length&&(t(v)||0)>=c.breakpoint)}),f=L(()=>Pe(e.images,t(I)));ee(a,{get width(){return i()},get id(){return r()},get class(){return`photopack fmy-6 ${o()??""}`},children:(d,c)=>{var p=Le(),l=P(p);q(l,21,()=>t(f),B,(_,E,R)=>{var h=je();let T;q(h,21,()=>t(E),B,(k,y,j)=>{var x=Te(),w=N(x);let M;var U=C(w,2);{var A=m=>{var Z=Se();n(m,Z)};X(U,m=>{t(y).altText||m(A)})}$(m=>{D(x,"aria-labelledby",`${r()??""}-figure-${R}-${j}`),D(w,"src",t(y).src),D(w,"alt",t(y).altText),M=Y(w,"",M,m)},[()=>({"max-height":t(y).maxHeight?t(y).maxHeight+"px":""})]),n(k,x)}),$(k=>T=Y(h,"",T,k),[()=>({gap:`0 ${s()??""}px`,"margin-block-end":Ri()==="fluid");ve(W,{get containerIsFluid(){return t(_)},children:(E,R)=>{var h=Ae(),T=N(h);ee(T,{get width(){return g()},class:"photopack-captions-container",children:(k,y)=>{var j=V(),x=P(j);q(x,17,()=>t(f),B,(w,M,U)=>{var A=V(),m=P(A);q(m,17,()=>t(M),B,(Z,H,ne)=>{var Q=V(),le=P(Q);{var de=G=>{var O=Me(),ce=N(O);_e(ce,{get source(){return t(H).caption}}),$(()=>D(O,"id",`${r()??""}-figure-${U}-${ne}`)),n(G,O)};X(le,G=>{t(H).caption&&G(de)})}n(Z,Q)}),n(w,A)}),n(k,j)},$$slots:{default:!0}}),n(E,h)},$$slots:{default:!0}})}we(l,"clientWidth",_=>me(v,_)),n(d,p)},$$slots:{default:!0}}),se()}K.__docgen={data:[{name:"images",visibility:"public",description:"Array of image objects",keywords:[{name:"required",description:""}],kind:"let",type:{kind:"type",type:"array",text:"Image[]"},static:!1,readonly:!1},{name:"layouts",visibility:"public",description:"Array of layout objects",keywords:[],kind:"let",type:{kind:"type",type:"array",text:"Layout[]"},static:!1,readonly:!1},{name:"gap",visibility:"public",description:"Gap between images.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"15"},{name:"id",visibility:"public",description:"Add an ID to target with SCSS. Should be unique from all other elements.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:"..."},{name:"class",visibility:"public",description:"Add a class to target with SCSS.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"width",visibility:"public",description:"Width of the component within the text well: 'normal' | 'wide' | 'wider' | 'widest' | 'fluid'",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"wide",text:'"wide"'},{kind:"const",type:"string",value:"wider",text:'"wider"'},{kind:"const",type:"string",value:"widest",text:'"widest"'},{kind:"const",type:"string",value:"fluid",text:'"fluid"'}],text:'"normal" | "wide" | "wider" | "widest" | "fluid"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"textWidth",visibility:"public",description:`Set a different width for captions within the text well. For example, "normal" to keep captions inline with the rest of the text well. Can't ever be wider than \`width\`: 'normal' | 'wide' | 'wider' | 'widest' | 'fluid'`,keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"wide",text:'"wide"'},{kind:"const",type:"string",value:"wider",text:'"wider"'},{kind:"const",type:"string",value:"widest",text:'"widest"'},{kind:"const",type:"string",value:"fluid",text:'"fluid"'}],text:'"normal" | "wide" | "wider" | "widest" | "fluid"'},static:!1,readonly:!1,defaultValue:'"normal"'}],name:"PhotoPack.svelte"};const oe={title:"Components/Multimedia/PhotoPack",component:K,argTypes:{width:{control:"select",options:["normal","wide","wider","widest","fluid"]},textWidth:{control:"select",options:["normal","wide","wider","widest","fluid"]}}},{Story:J}=ye();var qe=u(" ",1);function ie(a,e){re(e,!1);const s=[{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194630Z_544493697_UP1E.jpeg",caption:"Spain's Sergio Busquets and Aymeric Laporte react before a Germany goal is disallowed following a VAR review.",altText:"alt text"},{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194619Z_2007900040_UP1.jpeg",caption:"Spain's Sergio Busquets fouls Germany's Jamal Musiala before being shown yellow card.",altText:"alt text"},{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194619Z_635809122_UP1E.jpeg",caption:"Spain's Sergio Busquets is shown a yellow card by referee Danny Desmond Makkelie.",altText:"alt text"},{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T191015Z_1293757566_UP1.jpeg",caption:"Spain's Sergio Busquets in action with Germany's Thomas Muller.",altText:"alt text"}],r=[{breakpoint:450,rows:[1,2,1]},{breakpoint:750,rows:[1,3]}],o=[{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194630Z_544493697_UP1E.jpeg",caption:"Spain's Sergio Busquets and Aymeric Laporte react before a Germany goal is disallowed following a VAR review.",altText:"alt text"},{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194619Z_2007900040_UP1.jpeg",caption:"Spain's Sergio Busquets fouls Germany's Jamal Musiala before being shown yellow card.",altText:"alt text"},{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T194619Z_635809122_UP1E.jpeg",caption:"Spain's Sergio Busquets is shown a yellow card by referee Danny Desmond Makkelie.",altText:"alt text"},{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T191015Z_1293757566_UP1.jpeg",caption:"Spain's Sergio Busquets in action with Germany's Thomas Muller.",altText:"alt text"},{src:"https://graphics.thomsonreuters.com/cdn/django-tools/media/graphics-gallery/galleries/world-cup-2022/spain-germany-11-27/2022-11-27T203612Z_1399473226_UP1.jpeg",caption:"Spain's Alvaro Morata celebrates scoring their first goal.",altText:"alt text"}],i={id:"my-photo-pack",class:"mb-2",width:"wide",textWidth:"normal",gap:15,images:o.slice(0,5),layouts:[{breakpoint:750,rows:[2,3]},{breakpoint:450,rows:[1,2,2]}]};fe();var g=qe(),v=P(g);{let f=F(()=>({width:"wide",textWidth:"normal",images:s,layouts:r}));J(v,{name:"Demo",get args(){return t(f)},parameters:{__svelteCsf:{rawCode:""}}})}var S=C(v,2);J(S,{name:"ArchieML",get args(){return i},parameters:{__svelteCsf:{rawCode:""}}});var I=C(S,2);J(I,{name:"Smart layouts",args:{width:"wide",textWidth:"normal",imageCount:4},argTypes:{imageCount:{control:{type:"range",min:2,max:5,step:1},description:"Number of images to display (demonstrates smart default layouts)"}},children:(d,c=ge)=>{const p=F(()=>{const{imageCount:l,...W}=c();return{imageCount:l,photoPackProps:W}});{let l=F(()=>o.slice(0,t(p).imageCount||4));K(d,pe(()=>t(p).photoPackProps,{get images(){return t(l)}}))}},$$slots:{default:!0},parameters:{__svelteCsf:{rawCode:`{@const { imageCount, ...photoPackProps } = args as SmartDefaultsArgs} `}}}),n(a,g),se()}ie.__docgen={version:3,name:"PhotoPack.stories.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const z=he(ie,oe),Be=["Demo","ArchieML","SmartLayouts"],De=z.Demo,Ce=z.ArchieML,Ie=z.SmartLayouts,ze=Object.freeze(Object.defineProperty({__proto__:null,ArchieML:Ce,Demo:De,SmartLayouts:Ie,__namedExportsOrder:Be,default:oe},Symbol.toStringTag,{value:"Module"}));export{Ce as A,De as D,ze as P};