import"./61a21945.js";import{r as f,R as l,j as u}from"./index.0b22cc41.js";import{s as E,I as h}from"./b89a5bf4.js";import{ModelViewer as y}from"./ddd0cfb5.js";import"./94171a03.js";import"./f41a3a73.js";import"./b11c47a3.js";import"./9f1d76bc.js";import"./f503d834.js";import"./b9d6eef2.js";import"./c0e09fe6.js";import{A as w}from"./636c0604.js";import"./1e24dea3.js";import"./e92055f7.js";import"./801a2dc8.js";import"./2dce7371.js";function g(r,e){if(e==null)return r;const t=Object.keys(e).reduce((o,i)=>{const n=e[i];return n==null?o:o+`&${i}=${n}`},"");return`${r}?${t}`}function I(r,e){return f.exports.useMemo(()=>e?g(r,e):r,[r,e])}function b(r){var m,p;const{data:e,previewImageOptions:t,id:o=e.id,playsInline:i=!0,controls:n=!0,sourceProps:s={},...d}=r,c=E({src:(p=(m=e.previewImage)==null?void 0:m.url)!=null?p:"",...t});if(!e.sources)throw new Error("<Video/> requires a 'data.sources' array");return l.createElement("video",{...d,id:o,playsInline:i,controls:n,poster:c},e.sources.map(a=>{if(!((a==null?void 0:a.url)&&(a==null?void 0:a.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return l.createElement("source",{...s,key:a.url,src:a.url,type:a.mimeType})}))}function v(r){const{data:e,options:t,id:o=e.id,frameBorder:i="0",allow:n="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:s=!0,loading:d="lazy",...c}=r;if(!e.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");const m=I(e.embedUrl,t);return l.createElement("iframe",{...c,id:o!=null?o:e.embedUrl,frameBorder:i,allow:n,allowFullScreen:s,src:m,loading:d})}function T({data:r,options:e,...t}){switch(r.mediaContentType){case"IMAGE":{const o=r.image;return!o||!o.url?(console.warn(`No "image" property was found on the "data" prop for <MediaFile/>, for the "type='image'"`),null):l.createElement(h,{...t,data:o,loaderOptions:e})}case"VIDEO":return l.createElement(b,{...t,data:r,previewImageOptions:e});case"EXTERNAL_VIDEO":return l.createElement(v,{...t,data:r,options:e});case"MODEL_3D":return l.createElement(y,{...t,data:r});default:return null}}function j({media:r,className:e}){return r.length?u("div",{className:`md:grid-flow-row  top-0 md:p-0 md:overflow-x-auto md:grid-cols-2 ${e}`,children:r.map((t,o)=>{let i={};const n=o===0,s=o===3,d=o%3===0,c={...t,image:{...t.image,altText:t.alt||"Product image"}};switch(t.mediaContentType){case"IMAGE":i={width:800,widths:[400,800,1200,1600,2e3,2400]};break;case"VIDEO":i={width:"100%",autoPlay:!0,controls:!1,muted:!0,loop:!0,preload:"auto"};break;case"EXTERNAL_VIDEO":i={width:"100%"};break;case"MODEL_3D":i={width:"100%",interactionPromptThreshold:"0",ar:!0,loading:w,disableZoom:!0};break}o===0&&t.mediaContentType==="IMAGE"&&(i.loading=w);const m=[d?"md:col-span-2":"md:col-span-1",n||s?"":"md:aspect-[4/5]"," bg-white dark:bg-contrast/10  md:w-full"].join(" ");return u("div",{className:m,children:u(T,{tabIndex:"0",className:"w-full h-full fadeIn ",data:c,sizes:d?"(min-width: 64em) 60vw, (min-width: 48em) 50vw, 90vw":"(min-width: 64em) 30vw, (min-width: 48em) 25vw, 90vw",options:{},...i})},t.id||t.image.id)})}):null}export{j as ProductGallery};
//# sourceMappingURL=f696a4e2.js.map