1import{r as i,j as t}from"./chunk-Dd5i3kUi.js";import{F as h,e as N,t as k}from"./chunk-CRHzQu7D.js";import{g}from"./chunk-Bg_eTBSu.js";import{u as E}from"./chunk-BurZFMUW.js";/* empty css */import"./chunk-CkgDg7cv.js";import"./chunk-sUJGvPm7.js";import"./chunk-CpTOQht3.js";import"./chunk-4MQXs7et.js";import"./chunk-DWJ4oAWS.js";import"./chunk-cKPYAOrf.js";import"./chunk-BFAiRT_b.js";import"./chunk-CWOCMFmd.js";import"./chunk-BwgI00Gv.js";import"./chunk-Bxs7W2hn.js";import"./chunk-Cbe5Fgch.js";import"./chunk-B84M-TV3.js";/* empty css */import"./chunk-jJFeuH8t.js";import"./chunk-DTHZb5Z2.js";/* empty css */import"./chunk-B35OuwoP.js";import"./chunk-BFrH_fqN.js";/* empty css */(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"0962c6fd0bea418f28b4d5b4a85fe9ad3a267ce3"};var s=new r.Error().stack;s&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[s]="bbd22876-1387-4c9f-a7c5-3d931020b562",r._sentryDebugIdIdentifier="sentry-dbid-bbd22876-1387-4c9f-a7c5-3d931020b562")}catch{}})();const p="storymotion_favorite_patterns",Q=({isOpen:r,onClose:s})=>{const{props:u}=E(),f=u,[l,b]=i.useState("all"),[c,x]=i.useState(""),[a,y]=i.useState(()=>{try{const e=localStorage.getItem(p);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}});i.useEffect(()=>{if(!r)return;const e=o=>{o.key==="Escape"&&s()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,s]);const v=i.useMemo(()=>{const e=new Set(g.map(o=>o.category));return["all","favorites",...Array.from(e)]},[]),d=i.useMemo(()=>g.filter(e=>{if(l==="favorites")return a.has(e.id);const o=l==="all"||e.category===l,m=e.name.toLowerCase().includes(c.toLowerCase())||(e.description?.toLowerCase().includes(c.toLowerCase())??!1);return o&&m}),[l,c,a]),w=e=>{f?.onSelectPattern&&f.onSelectPattern(e.id),s()},j=(e,o)=>{o.stopPropagation(),y(m=>{const n=new Set(m);n.has(e)?n.delete(e):n.add(e);try{localStorage.setItem(p,JSON.stringify(Array.from(n)))}catch(S){console.error("Failed to save favorite patterns:",S)}return n})};return r?t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[999999]",children:t.jsxs("div",{className:"bg-white rounded-lg max-w-4xl w-full mx-4 flex flex-col",style:{height:"80vh"},children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Select Backgroun
1d Pattern"}),t.jsx("button",{type:"button",onClick:s,className:"p-1 hover:bg-gray-100 rounded-full transition-colors",children:t.jsx(h,{icon:N,style:{fontSize:"20px"}})})]}),t.jsxs("div",{className:"p-4 border-b border-gray-200 space-y-4",children:[t.jsx("input",{type:"text",placeholder:"Search patterns...",value:c,onChange:e=>x(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"}),t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:v.map(e=>t.jsx("button",{onClick:()=>b(e),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${l===e?"bg-blue-500 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:d.map(e=>t.jsx("div",{className:"group relative",children:t.jsxs("div",{className:"relative aspect-square rounded-xl overflow-hidden bg-white shadow-sm transition-all duration-300 hover:shadow-lg hover:scale-[1.02]",children:[t.jsx("button",{onClick:o=>j(e.id,o),className:`absolute top-2 left-2 z-10 p-2 rounded-full backdrop-blur-md shadow-lg border transition-all duration-200 hover:scale-110 ${a.has(e.id)?"bg-yellow-500/20 border-yellow-500/30 text-yellow-600":"bg-black/20 border-white/30 text-white hover:bg-black/30 hover:border-white/40"}`,title:a.has(e.id)?"Remove from favorites":"Add to favorites",children:t.jsx(h,{icon:k,className:`h-4 w-4 transition-all duration-200 ${a.has(e.id)?"fill-current scale-110":""}`})}),t.jsx("div",{className:"absolute inset-0",style:e.style}),t.jsx("div",{onClick:()=>w(e),className:"absolute inset-0 cursor-pointer bg-gradient-to-t from-black/80 via-black/20 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-300 flex items-center justify-center p-4",children:t.jsxs("div",{className:"text-center transform translate-y-4 group-hover:translate-y-0 transition-transform duration-300",children:[t.jsx("h3",{className:"text-white font-semibold text-sm mb-3 drop-shadow-lg",children:e.name}),t.jsx("button",{className:"px-4 py-2 bg-white/95 hover:bg-white text-black text-sm font-medium rounded-lg shadow-xl backdrop-blur-md transition-all duration-200 hover:scale-105",children:"Select"})]})})]})},e.id))}),d.length===0&&t.jsx("div",{className:"text-center py-12 text-gray-500",children:"No patterns found matching your criteria."})]}),t.jsxs("div",{className:"p-4 border-t border-gray-200 text-center text-sm text-gray-500",children:[d.length," patterns"," ",a.size>0&&`⢠${a.size} favorites`," ⢠Powered by PatternCraft"]})]})}):null};export{Q as SelectBackgroundPatternModal}; 2//# sourceMappingURL=chunk-BYleioIs.js.map
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.