(()=>{"use strict";var e,t={298(){const e=window.wp.blocks,t=JSON.parse('{"UU":"contact-sheet/photo-strip"}'),o=window.wp.blockEditor,s=window.wp.data,a=window.wp.components,n=window.wp.i18n,i=window.ReactJSXRuntime,r=[{label:(0,n.__)("Original","contact-sheet"),value:"original"},{label:(0,n.__)("Square (1:1)","contact-sheet"),value:"square"},{label:"4:3",value:"4-3"},{label:"3:2",value:"3-2"},{label:"16:9",value:"16-9"},{label:(0,n.__)("3:4 (Portrait)","contact-sheet"),value:"3-4"},{label:(0,n.__)("2:3 (Portrait)","contact-sheet"),value:"2-3"}],l=[{label:(0,n.__)("None","contact-sheet"),value:"none"},{label:(0,n.__)("Fixed Height","contact-sheet"),value:"height"},{label:(0,n.__)("Fixed Width","contact-sheet"),value:"width"}];(0,e.registerBlockType)(t.UU,{edit:function({attributes:e,setAttributes:t,context:c}){const h=(0,o.useBlockProps)(),{aspectRatio:p,sizeConstraint:d,sizeValue:u,borderRadius:v}=e,{postId:g,postType:x,queryId:_}=c,b=(0,s.useSelect)(e=>g?e("core").getEntityRecord("postType",x||"post",g):null,[g,x]);if(!g)return(0,i.jsx)("div",{...h,children:(0,i.jsx)("p",{children:(0,n.__)("Photo Strip: place this block inside a Query Loop.","contact-sheet")})});if(!b)return(0,i.jsx)("div",{...h,children:(0,i.jsx)(a.Spinner,{})});const m=function(e){const t=(new DOMParser).parseFromString(e,"text/html");return Array.from(t.querySelectorAll("img")).map(e=>({src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||""}))}(b.content?.rendered||""),w={borderRadius:v+"px"};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.InspectorControls,{children:(0,i.jsxs)(a.PanelBody,{title:(0,n.__)("Image Settings","contact-sheet"),children:[(0,i.jsx)(a.SelectControl,{label:(0,n.__)("Aspect Ratio","contact-sheet"),value:p,options:r,onChange:e=>t({aspectRatio:e})}),(0,i.jsx)(a.SelectControl,{label:(0,n.__)("Size Constraint","contact-sheet"),value:d,options:l,help:(0,n.__)("Fix one dimension while the other scales freely.","contact-sheet"),onChange:e=>t({sizeConstraint:e})}),"none"!==d&&(0,i.jsx)(a.RangeControl,{label:"height"===d?(0,n.__)("Height (px)","contact-sheet"):(0,n.__)("Width (px)","contact-sheet"),value:u,onChange:e=>t({sizeValue:e}),min:50,max:500,step:10}),(0,i.jsx)(a.RangeControl,{label:(0,n.__)("Border Radius (px)","contact-sheet"),value:v,onChange:e=>t({borderRadius:e}),min:0,max:50})]})}),(0,i.jsx)("div",{...h,children:(0,i.jsx)("div",{className:"photo-strip-item",children:m.length>0?(0,i.jsx)("div",{className:"photo-strip-images",style:{"--ps-height":u+"px"},children:m.map((e,t)=>(0,i.jsx)("div",{className:`photo-strip-image photo-strip-aspect-${p} photo-strip-constraint-${d}`,children:(0,i.jsx)("img",{src:e.src,alt:e.alt,loading:"lazy",style:w})},t))}):void 0!==_?(0,i.jsx)("div",{className:"photo-strip-images",style:{"--ps-height":u+"px"},children:(0,i.jsx)("div",{className:"photo-strip-image is-placeholder",style:w})}):(0,i.jsx)("p",{children:(0,n.__)("No images found in this post.","contact-sheet")})})})]})},save:()=>null})}},o={};function s(e){var a=o[e];if(void 0!==a)return a.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.m=t,e=[],s.O=(t,o,a,n)=>{if(!o){var i=1/0;for(h=0;h<e.length;h++){for(var[o,a,n]=e[h],r=!0,l=0;l<o.length;l++)(!1&n||i>=n)&&Object.keys(s.O).every(e=>s.O[e](o[l]))?o.splice(l--,1):(r=!1,n<i&&(i=n));if(r){e.splice(h--,1);var c=a();void 0!==c&&(t=c)}}return t}n=n||0;for(var h=e.length;h>0&&e[h-1][2]>n;h--)e[h]=e[h-1];e[h]=[o,a,n]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={57:0,350:0};s.O.j=t=>0===e[t];var t=(t,o)=>{var a,n,[i,r,l]=o,c=0;if(i.some(t=>0!==e[t])){for(a in r)s.o(r,a)&&(s.m[a]=r[a]);if(l)var h=l(s)}for(t&&t(o);c<i.length;c++)n=i[c],s.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return s.O(h)},o=globalThis.webpackChunkcontact_sheet=globalThis.webpackChunkcontact_sheet||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var a=s.O(void 0,[350],()=>s(298));a=s.O(a)})();