)?d+"px":"0"),"bottom: "+(u=(u=-m)?u+"px":"0")])),b=s(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),E=s(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),w=s(["position: absolute","left: 0","top: 0"]),x=s(["position: absolute","width: 200%","height: 200%"]),y=document.createElement("div"),k=document.createElement("div"),C=document.createElement("div"),z=document.createElement("div"),_=document.createElement("div"),S=document.createElement("div");y.dir="ltr",y.style.cssText=v,y.className=o,k.className=o,k.style.cssText=g,C.style.cssText=b,z.style.cssText=w,_.style.cssText=E,S.style.cssText=x,C.appendChild(z),_.appendChild(S),k.appendChild(C),k.appendChild(_),y.appendChild(k),l.appendChild(y),h(C,"scroll",R),h(_,"scroll",O),r(c).onExpandScroll=R,r(c).onShrinkScroll=O}else f("Aborting because element has been uninstalled");function R(){var e=r(c);e&&e.onExpand?e.onExpand():f("Aborting expand scroll handler: element has been uninstalled")}function O(){var e=r(c);e&&e.onShrink?e.onShrink():f("Aborting shrink scrolconst n={label:e,value:`${e.replace(/ /g,"")}_0_${(new Date).getTime().toString().slice(-6)}`,createdFrom:null,version:0,galleries:t},r=[n,...d];return i({type:"SET_CUSTOM_COLLECTIONS",payload:r}),p(r),n.value},updateCollectionName:function(e,t){if(!t||!e)return"";const n=d.findIndex(e=>e.value===t);if(-1===n)return"";const r=[...d];return r[n].label=e,i({type:"SET_CUSTOM_COLLECTIONS",payload:r}),p(r),r[n].value},deleteCollection:function(e){if(!e)return;const t=d.findIndex(t=>t.value===e);if(-1===t)return;const n=[...d];n.splice(t,1),i({type:"SET_CUSTOM_COLLECTIONS",payload:n}),p(n)}}}const $l={topSection:{borderBottom:"1px solid #DFDFDF",marginBottom:"40px",paddingBottom:"24px",position:"relative"},selectWrapper:{maxWidth:500},selectControl:{width:"100%",textAlign:"center"},alignCenter:{alignItems:"center"}};function Wl(n){const{photographyOnly:r}=n,{state:{photoLibrary:o,imageSearchQuery:a},dispatch:s}=D(),{preMadeCollections:l,wordpressCollections:c,getCollectionGalleries:u,updateGalleries:d,createCollection:p,updateCollectionName:f,deleteCollection:h}=ql(),[m,g]=(0,e.useState)([]),[b,v]=(0,e.useState)(!1),[y,_]=(0,e.useState)([{},{}]),[w,k]=(0,e.useState)(!1),[x,S]=(0,e.useState)(""),[O,j]=(0,e.useState)(!1),[C,I]=(0,e.useState)();async function E(e=null){if(b)return;v(!0);const t=await u(e||o);t&&_(t),v(!1)}function P(e){let t=e;e?.value&&(t=e.value),t!==o?(s({type:"SET_PHOTO_LIBRARY",payload:t}),s({type:"SET_PHOTO_LIBRARY_CHANGED",payload:!0}),_([{},{}]),E(t)):(s({type:"SET_PHOTO_LIBRARY_CHANGED",payload:!1}),E(t))}(0,e.useEffect)(()=>{s({type:"SET_PHOTO_LIBRARY_CHANGED",payload:!1})},[]),(0,e.useEffect)(()=>{l&&c&&(g([{label:(0,t.__)("My Collections","kadence-blocks"),options:c.map(e=>({label:e.label,value:e.value,useActions:!0}))},{label:"Premade Collections",options:l.map(e=>({label:e.label,value:e.value,useActions:!1}))}]),E())},[l,c]),(0,e.useEffect)(()=>{l&&c&&E()},[a]);const A=o&&l&&l.filter(e=>e.value===o);return(0,i.jsxs)("div",{className:"stellarwp-ai-photography-library",children:[(0,i.jsx)(En.Flex,{justifconst n={label:e,value:`${e.replace(/ /g,"")}_0_${(new Date).getTime().toString().slice(-6)}`,createdFrom:null,version:0,galleries:t},r=[n,...d];return i({type:"SET_CUSTOM_COLLECTIONS",payload:r}),p(r),n.value},updateCollectionName:function(e,t){if(!t||!e)return"";const n=d.findIndex(e=>e.value===t);if(-1===n)return"";const r=[...d];return r[n].label=e,i({type:"SET_CUSTOM_COLLECTIONS",payload:r}),p(r),r[n].value},deleteCollection:function(e){if(!e)return;const t=d.findIndex(t=>t.value===e);if(-1===t)return;const n=[...d];n.splice(t,1),i({type:"SET_CUSTOM_COLLECTIONS",payload:n}),p(n)}}}const $l={topSection:{borderBottom:"1px solid #DFDFDF",marginBottom:"40px",paddingBottom:"24px",position:"relative"},selectWrapper:{maxWidth:500},selectControl:{width:"100%",textAlign:"center"},alignCenter:{alignItems:"center"}};function Wl(n){const{photographyOnly:r}=n,{state:{photoLibrary:o,imageSearchQuery:a},dispatch:s}=D(),{preMadeCollections:l,wordpressCollections:c,getCollectionGalleries:u,updateGalleries:d,createCollection:p,updateCollectionName:f,deleteCollection:h}=ql(),[m,g]=(0,e.useState)([]),[b,v]=(0,e.useState)(!1),[y,_]=(0,e.useState)([{},{}]),[w,k]=(0,e.useState)(!1),[x,S]=(0,e.useState)(""),[O,j]=(0,e.useState)(!1),[C,I]=(0,e.useState)();async function E(e=null){if(b)return;v(!0);const t=await u(e||o);t&&_(t),v(!1)}function P(e){let t=e;e?.value&&(t=e.value),t!==o?(s({type:"SET_PHOTO_LIBRARY",payload:t}),s({type:"SET_PHOTO_LIBRARY_CHANGED",payload:!0}),_([{},{}]),E(t)):(s({type:"SET_PHOTO_LIBRARY_CHANGED",payload:!1}),E(t))}(0,e.useEffect)(()=>{s({type:"SET_PHOTO_LIBRARY_CHANGED",payload:!1})},[]),(0,e.useEffect)(()=>{l&&c&&(g([{label:(0,t.__)("My Collections","kadence-blocks"),options:c.map(e=>({label:e.label,value:e.value,useActions:!0}))},{label:"Premade Collections",options:l.map(e=>({label:e.label,value:e.value,useActions:!1}))}]),E())},[l,c]),(0,e.useEffect)(()=>{l&&c&&E()},[a]);const A=o&&l&&l.filter(e=>e.value===o);return(0,i.jsxs)("div",{className:"stellarwp-ai-photography-library",children:[(0,i.jsx)(En.Flex,{justif