var z=Object.defineProperty,P=Object.defineProperties;var $=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var N=(t,r,a)=>r in t?z(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,x=(t,r)=>{for(var a in r||(r={}))E.call(r,a)&&N(t,a,r[a]);if(T)for(var a of T(r))M.call(r,a)&&N(t,a,r[a]);return t},u=(t,r)=>P(t,$(r));import{a as S,aq as g,u as y,r as V,j as e,U as F,ak as D,bD as H,cr as L,b5 as W,g as q,s as B,E as G,aW as O,aX as R,aY as U,aV as X,O as Y,aF as J}from"./main-343.js";import{t as p,C}from"./bf-697-110.js";import{E as K}from"./bf-411-252.js";import{S as Q}from"./bf-481-324.js";import{e as j}from"./bf-649-79.js";import"./bf-90-70.js";import"./bf-594-113.js";import"./bf-983-247.js";import"./bf-810-248.js";import"./bf-603-251.js";import"./bf-453-86.js";import"./bf-190-88.js";import"./bf-914-249.js";import"./bf-870-250.js";import"./bf-711-253.js";import"./bf-519-87.js";import"./bf-901-254.js";import"./bf-656-255.js";import"./bf-806-256.js";import"./bf-318-257.js";import"./bf-437-78.js";function js(){const{css:t}=S(),r=g(O),a=g(R),v=g(U),h=y(X),w=y(Y),f=y(J),i=Object.entries(f),d=p.find(s=>(s==null?void 0:s.slug)===h.theme),[o,b]=V.useState({show:!1}),_=s=>{const{themeColors:m,themeVars:n,styles:c}=D(s,i,w);h.confirmations&&c.lgLightStyles&&(c.lgLightStyles.confirmations=[...h.confirmations]),r(m),a(n),v(c),H(L("","","Theme",s,{allThemeColors:m,allThemeVars:n,allStyles:c})),W()},k=(s,m)=>{b(n=>{var c;return u(x({},n),{title:m[s].name,slug:(c=m[s])==null?void 0:c.slug})})},I=s=>{b(m=>{var n;return u(x({},m),{show:!0,title:p[s].name,slug:(n=p[s])==null?void 0:n.slug,activeSlideIndex:s})})},A=()=>{_(o==null?void 0:o.slug),b(s=>u(x({},s),{show:!1}))};return e.jsxs("div",{className:t(l.wrp),children:[e.jsx(Q,{title:e.jsxs("div",{className:t({flx:"center-between",w:"100%"}),children:[e.jsx("h4",{className:t(l.title),children:o.title}),e.jsxs(F,{size:"sm",onClick:A,disabled:(d==null?void 0:d.slug)===(o==null?void 0:o.slug),gap:5,className:t({mr:10,my:5}),children:["Activate",e.jsx(C,{size:"12"})]})]}),show:o.show,defaultActiveSlideIndex:o.activeSlideIndex,setModal:b,onChange:s=>k(s,p),children:p.map(s=>e.jsx("div",{className:t(l.previewWrapper),children:e.jsx("img",{className:t(l.previewImg),src:s.img,alt:"theme-thumbnail"})},s.name))}),e.jsx("h4",{className:t(l.title),children:"Themes"}),e.jsx("div",{className:t(l.thm_container),children:p.map((s,m)=>e.jsx(Z,{onPreviewClick:()=>I(m),applyThemeAction:()=>_(s==null?void 0:s.slug),name:s.name,img:s.img,isActive:(d==null?void 0:d.slug)===(s==null?void 0:s.slug)},s.name))})]})}const Z=({name:t,img:r,isActive:a,applyThemeAction:v,onPreviewClick:h})=>{const{formType:w,formID:f}=q(),{css:i}=S();return e.jsxs("div",{className:i(l.thm_wrp),children:[e.jsxs("div",{className:i(l.thm_btn,a&&l.activeStyle),children:[e.jsxs("div",{"data-thm-ctrl-wrp":!0,className:i(l.thm_control_wrp),children:[e.jsx(j,{msg:"Preview",children:e.jsx("button",{onClick:h,type:"button",className:i(l.thm_ctrl_btn),"aria-label":"Theme Preview",children:e.jsx(K,{size:"20"})})}),a?e.jsx(j,{msg:"Customize theme",children:e.jsx(B,{to:`/form/builder/${w}/${f}/theme-customize/quick-tweaks`,type:"button",className:i(l.thm_ctrl_btn),"aria-label":"Theme Customize",children:e.jsx(G,{size:"20",stroke:"2.2"})})}):e.jsx(j,{msg:"Apply Theme",children:e.jsx("button",{type:"button",onClick:v,className:i(l.thm_ctrl_btn),"aria-label":"Theme Preview",children:e.jsx(C,{size:"20px"})})})]}),e.jsx("img",{className:i(l.thmImg),width:"120",height:"147.64",alt:"Theme thumbnail",src:r})]}),e.jsx("span",{className:i(l.thm_name),children:t})]})},l={wrp:{bd:"var(--white-100)"},title:{mt:10,mb:5},thmImg:{dy:"block"},thm_container:{flx:1,flxp:"jc"},thm_wrp:{w:124,h:170,flxi:1,fd:"column",mx:5,mt:10},thm_btn:{pn:"relative",curp:1,b:"2px solid var(--white-0-83)",brs:8,p:0,bd:"var(--white-100)",ow:"hidden",":hover":{bcr:"var(--white-0-50)","& div[data-thm-ctrl-wrp]":{oy:"1 !important",visibility:"visible"}}},thm_name:{fs:13,mt:4},thm_control_wrp:{pn:"absolute",w:"100%",h:"100%",bd:"#1a1b318c",backdropFilter:"blur(2px)",flx:"center",oy:0,visibility:"hidden",tn:"opacity .3s"},thm_ctrl_btn:{p:0,brs:"50%",w:30,h:30,b:"1px solid gray",flx:"center",mx:2,curp:1,cr:"var(--b-54-12)",bd:"var(--white-0-95)",":hover":{cr:"var(--b-50)",bd:"var(--white-100)"}},activeStyle:{bcr:"var(--b-50)",bs:"0 0 0 2px var(--b-50)"},previewWrapper:{w:"100%",h:"100%",p:"10px 60px",bd:"#d4d9e6",flx:"center"},previewImg:{w:"90%",b:"2px solid #bbbfd3",brs:"10px"}};export{js as default};
