@bailierich/booking-components 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {ChevronDown,ChevronLef
7
7
  transform: translateX(${t==="left"?"-50%":"0%"});
8
8
  }
9
9
  }
10
- `}),jsxs("div",{className:`flex items-center whitespace-nowrap ${h[n]} ${k[l]} uppercase tracking-wider`,style:{fontFamily:g?.headingFont||"inherit",color:s||p.text,animation:`scroll-${t} ${C}s linear infinite`,animationPlayState:w?"paused":"running"},children:[jsx("span",{className:"inline-block",children:I}),jsx("span",{className:"inline-block","aria-hidden":"true",children:I})]})]})}function An({address:e,displayType:t="both",mapHeight:r="medium",mapStyle:a="roadmap",zoom:o=15,showMarker:i=true,borderRadius:n=12,directionsButtonText:s="Get Directions",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let g={small:300,medium:400,large:500}[r],b=encodeURIComponent(e),v=`https://www.google.com/maps/dir/?api=1&destination=${b}`,f=`https://www.google.com/maps/embed/v1/place?key=${import.meta.env?.VITE_GOOGLE_MAPS_API_KEY||typeof globalThis<"u"&&globalThis.process?.env?.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY||""}&q=${b}&zoom=${o}&maptype=${a}`;return jsx("div",{className:"container mx-auto px-4",children:jsxs("div",{className:"max-w-4xl mx-auto",children:[(t==="map-only"||t==="both")&&e&&jsx("div",{className:"w-full overflow-hidden mb-6",style:{height:`${g}px`,borderRadius:`${n}px`},children:jsx("iframe",{src:f,className:"w-full h-full",style:{border:0},allowFullScreen:true,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",title:"Location Map"})}),(t==="address-only"||t==="both")&&jsx("div",{className:"p-6 rounded-lg border",style:{backgroundColor:`${l.primary}10`,borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[jsx("div",{className:"flex-1",children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{className:"w-5 h-5 mt-0.5 flex-shrink-0",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsxs("div",{children:[jsx("p",{className:"font-medium mb-1",style:{color:l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.address"},children:e||"Add your address"}),e&&jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline hover:no-underline",style:{color:l.primary},children:"View in Google Maps \uFFFD"})]})]})}),e&&jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"px-6 py-3 rounded-lg font-semibold transition-all hover:opacity-90 text-center",style:{backgroundColor:l.primary,color:"#FFFFFF"},children:s})]})}),!e&&jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:[jsxs("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsx("p",{style:{color:l.text,opacity:.6},children:"Add your business address to display a map"})]})]})})}function Mn({imageUrl:e,altText:t="",caption:r,maxWidth:a="large",alignment:o="center",aspectRatio:i="auto",borderRadius:n=12,linkUrl:s,openInNewTab:l=true,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let g={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},b={auto:null,"16:9":"56.25%","4:3":"75%","1:1":"100%","3:2":"66.67%"},v=o==="center"?"mx-auto":o==="right"?"ml-auto":"mr-auto",w=jsxs("div",{className:`${g[a]} ${v}`,children:[jsx("div",{className:"relative w-full overflow-hidden",style:{borderRadius:`${n}px`,...b[i]&&{paddingBottom:b[i]}},children:e?jsx("img",{src:e,alt:t||"Image",className:i==="auto"?"w-full h-auto":"absolute top-0 left-0 w-full h-full object-cover",style:{borderRadius:`${n}px`}}):jsx("div",{className:"flex items-center justify-center bg-gray-100",style:{backgroundColor:`${c.primary}10`,borderRadius:`${n}px`,minHeight:i==="auto"?"300px":void 0},children:jsxs("div",{className:"text-center px-4",children:[jsx("svg",{className:"w-16 h-16 mx-auto mb-4",fill:"none",stroke:c.primary,viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsx("p",{style:{color:c.text,opacity:.6},children:"Add an image URL to display"})]})})}),r&&e&&jsx("p",{className:"mt-3 text-sm text-center",style:{color:c.text,opacity:.7,fontFamily:d?.bodyFont||"inherit"},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.caption"},children:r})]});return jsx("div",{className:a==="full"?"w-full":"container mx-auto px-4",children:s&&e?jsx("a",{href:s,target:l?"_blank":"_self",rel:l?"noopener noreferrer":void 0,className:"block",children:w}):w})}function Xa({faq:e,index:t,colors:r,typography:a,enableInlineEditing:o,sectionId:i}){let[n,s]=useState(false);return jsxs("div",{className:"border-b border-opacity-10",style:{borderColor:r.text},children:[jsxs("button",{onClick:()=>s(!n),className:"w-full py-4 px-6 flex items-center justify-between text-left hover:bg-opacity-5 transition-colors",style:{backgroundColor:n?`${r.primary}10`:"transparent"},children:[jsx("span",{className:"font-semibold text-lg pr-4",style:{color:r.text,fontFamily:a?.headingFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.question`},children:e.question||"Add question..."}),jsx("svg",{className:"w-5 h-5 flex-shrink-0 transition-transform",style:{color:r.primary,transform:n?"rotate(180deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),n&&jsx("div",{className:"px-6 pb-4 pt-2",style:{color:r.text,opacity:.8,fontFamily:a?.bodyFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.answer`},children:e.answer||"Add answer..."})]})}function $n({title:e="Frequently Asked Questions",faqs:t=[],layout:r="accordion",maxWidth:a="large",colors:o,typography:i,enableInlineEditing:n=false,sectionId:s=""}){return jsx("div",{className:"container mx-auto px-4",children:jsxs("div",{className:`${{full:"max-w-full",large:"max-w-4xl",medium:"max-w-3xl",small:"max-w-2xl"}[a]} mx-auto`,children:[e&&jsx("h2",{className:"text-3xl font-bold text-center mb-8",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":"settings.title"},children:e}),t.length>0?jsx("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${o.text}20`,backgroundColor:`${o.primary}05`},children:t.map((c,d)=>r==="accordion"?jsx(Xa,{faq:c,index:d,colors:o,typography:i,enableInlineEditing:n,sectionId:s},d):jsxs("div",{className:"border-b border-opacity-10 last:border-b-0 p-6",style:{borderColor:o.text},children:[jsx("h3",{className:"font-semibold text-lg mb-2",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.question`},children:c.question||"Add question..."}),jsx("p",{style:{color:o.text,opacity:.8,fontFamily:i?.bodyFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.answer`},children:c.answer||"Add answer..."})]},d))}):jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${o.primary}30`,backgroundColor:`${o.primary}05`},children:[jsx("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:o.primary,viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsx("p",{style:{color:o.text,opacity:.6},children:"Add FAQ items to get started"})]})]})})}function Bn({brandName:e="Your Brand",logoUrl:t,showLogo:r=true,showBrandName:a=true,links:o=[],ctaText:i,ctaUrl:n,sticky:s=true,transparentOnTop:l=false,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let[g,b]=useState(false),[v,w]=useState(false),[f,x]=useState("");useEffect(()=>{let h=()=>{w(window.scrollY>20);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[]),useEffect(()=>{let h=()=>{let k=o.filter(I=>I.url.startsWith("#")).map(I=>document.querySelector(`[data-section-id="${I.url.substring(1)}"]`)).filter(Boolean),S="";k.forEach(I=>{if(I){let R=I.getBoundingClientRect();R.top<=100&&R.bottom>=100&&(S=I.getAttribute("data-section-id")||"");}}),x(S);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[o]);let y=(h,k)=>{if(k.startsWith("#")){h.preventDefault();let S=k.substring(1),I=document.querySelector(`[data-section-id="${S}"]`);I&&I.scrollIntoView({behavior:"smooth",block:"start"}),b(false);}},N=l&&!v;return jsx("nav",{className:`${s?"sticky top-0 z-50":""} ${N?"bg-transparent":s?"bg-white/80 backdrop-blur-md border-b":"bg-white border-b"} transition-all duration-300`,style:{borderColor:N?"transparent":`${c.primary}20`},children:jsxs("div",{className:"container mx-auto px-4",children:[jsxs("div",{className:"flex items-center justify-between h-16 md:h-20",children:[jsxs("div",{className:"flex items-center gap-3",children:[r&&t&&jsx("img",{src:t,alt:e,className:"h-8 md:h-10 w-auto object-contain"}),a&&jsx("h1",{className:"text-xl md:text-2xl font-bold",style:{fontFamily:d?.headingFont||"inherit",color:c.text},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.brandName"},children:e})]}),jsxs("div",{className:"hidden md:flex items-center gap-8",children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsxs("a",{href:h.url,onClick:I=>y(I,h.url),className:"relative text-base font-medium transition-colors group",style:{color:S?c.primary:c.text,fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":`settings.links.${k}.label`},children:[h.label,jsx("span",{className:`absolute -bottom-1 left-0 h-0.5 transition-all ${S?"w-full":"w-0 group-hover:w-full"}`,style:{backgroundColor:c.primary}})]},h.id)}),i&&n&&jsx("a",{href:n,className:"px-6 py-2.5 rounded-full font-semibold transition-all hover:opacity-90 hover:scale-105",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]}),jsx("button",{onClick:()=>b(!g),className:"md:hidden p-2 rounded-lg transition-colors hover:bg-black/5","aria-label":"Toggle menu",children:jsx("svg",{className:"w-6 h-6",fill:"none",stroke:c.text,viewBox:"0 0 24 24",children:g?jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),jsx("div",{className:`md:hidden overflow-hidden transition-all duration-300 ${g?"max-h-96 pb-4":"max-h-0"}`,children:jsxs("div",{className:"flex flex-col space-y-3 pt-4 border-t",style:{borderColor:`${c.primary}20`},children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsx("a",{href:h.url,onClick:I=>y(I,h.url),className:"text-base font-medium py-2 px-4 rounded-lg transition-colors",style:{color:S?c.primary:c.text,backgroundColor:S?`${c.primary}10`:"transparent",fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},children:h.label},h.id)}),i&&n&&jsx("a",{href:n,className:"px-6 py-3 rounded-full font-semibold text-center transition-all hover:opacity-90",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]})})]})})}function zn({title:e,content:t,alignment:r="left",maxWidth:a="medium",textSize:o="medium",backgroundColor:i,textColor:n,paddingY:s="medium",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let p={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},g={left:"text-left",center:"text-center",right:"text-right"},b={small:"text-sm",medium:"text-base",large:"text-lg"};return jsx("div",{className:{none:"py-0",small:"py-8",medium:"py-16",large:"py-24"}[s],style:{backgroundColor:i||"transparent"},children:jsx("div",{className:"container mx-auto px-4",children:jsxs("div",{className:`${p[a]} mx-auto ${g[r]}`,children:[e&&jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-6",style:{color:n||l.text,fontFamily:c?.headingFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.title"},children:e}),jsx("div",{className:`${b[o]} leading-relaxed whitespace-pre-wrap`,style:{color:n||l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.content"},children:t||"Add your text content here..."})]})})})}function $c(e,t=false){if(t)return .15;switch(e){case "fast":return .2;case "slow":return .5;default:return .3}}function Ja(e=50){return {enter:t=>({x:t==="forward"?e:-e,opacity:0}),center:{x:0,opacity:1},exit:t=>({x:t==="forward"?-e:e,opacity:0})}}function Qa(){return {enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}}function Lc(e,t){return e==="fade"?Qa():Ja(t)}var rr={easing:[.4,0,.2,1],spring:{type:"spring",damping:30,stiffness:300},staggerChildren:{staggerChildren:.05,delayChildren:.1},cardHover:{scale:1.02,transition:{duration:.2}},buttonHover:{scale:1.05,transition:{duration:.2}},fadeIn:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},slideUp:{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"}},scaleIn:{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9}},slideInLeft:{initial:{opacity:0,x:-10},animate:{opacity:1,x:0}},slideInRight:{initial:{opacity:0,x:10},animate:{opacity:1,x:0}},backdrop:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}};function Bc(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function zc(e,t=.1,r=.05){return Array.from({length:e},(a,o)=>({initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:t+o*r,ease:rr.easing}}))}function ge(e=0,t=.3){return {initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:t,delay:e,ease:rr.easing}}}function On({services:e,categories:t=[],selectedService:r,onServiceSelect:a,settings:o,colors:i}){let[n,s]=useState(null),[l,c]=useState(new Set(t.length>0?[t[0].id]:[])),d=o.serviceLayout||"grid",u=o.columns||2,p=o.headerContent?.value||"Choose Your Service",g=o.subheaderContent?.value||"Select the service you'd like to book",b=o.showPricing!==false,v=o.showDuration!==false,w=o.showDescription!==false,f=o.enableCategories===true,x=o.categoryStyle||"dropdown",y=o.policyImages||[],N=o.policyText||null,C=o.imageSpacing||"small",h={none:"0px",small:"8px",medium:"16px",large:"24px"},k=o.imageBorderRadius||"0px",S={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[u]||"grid-cols-2",I=f&&n?e.filter(m=>m.category===n):e,R=(m,F)=>{let M=r===m.id;return jsx("button",{onClick:()=>a(m.id),className:`w-full ${F==="grid"?"h-full":""} p-4 rounded-lg border-2 transition-all text-left ${F==="grid"?"flex flex-col":""} ${M?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:M?i.primary:void 0,backgroundColor:M?`${i.primary}10`:void 0},children:F==="grid"?jsxs(Fragment,{children:[jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsx("p",{className:"text-xs opacity-70 mb-2 flex-1",children:m.description}),jsxs("div",{className:"flex justify-between items-center text-sm mt-auto",children:[b&&jsxs("span",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxs("span",{className:"opacity-60",children:[m.duration," min"]})]})]}):jsxs("div",{className:"flex justify-between items-start",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsx("p",{className:"text-sm opacity-70",children:m.description})]}),jsxs("div",{className:"text-right ml-4",children:[b&&jsxs("p",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxs("p",{className:"text-sm opacity-60",children:[m.duration," min"]})]})]})},m.id)};return jsxs("div",{className:"space-y-4",children:[jsxs(motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:i.primary},children:p}),jsx("p",{className:"text-sm opacity-70",children:g})]}),y&&y.length>0&&jsx("div",{className:"w-full flex flex-col",style:{gap:h[C]},children:y.slice(0,3).map((m,F)=>jsx("div",{className:"w-full overflow-hidden",style:{aspectRatio:"720 / 300",borderRadius:k},children:jsx("img",{src:m.url,alt:m.alt||`Policy image ${F+1}`,className:"w-full h-full object-cover"})},F))}),(!y||y.length===0)&&N&&jsx("div",{className:"w-full p-4 rounded-lg border",style:{backgroundColor:`${i.primary}10`,borderColor:`${i.primary}30`},dangerouslySetInnerHTML:{__html:N}}),f&&t.length>0&&jsxs(Fragment,{children:[x==="dropdown"&&jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-2",children:"Service Category"}),jsxs("select",{value:n||"all",onChange:m=>s(m.target.value==="all"?null:m.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent transition-all",style:{"--tw-ring-color":i.primary},children:[jsx("option",{value:"all",children:"All Services"}),t.map(m=>jsx("option",{value:m.id,children:m.name},m.id))]})]}),x==="tabs"&&jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsx("button",{onClick:()=>s(null),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===null?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All Services"}),t.map(m=>jsx("button",{onClick:()=>s(m.id),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===m.id?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="pills"&&jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2 scrollbar-hide",children:[jsx("button",{onClick:()=>s(null),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===null?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All"}),t.map(m=>jsx("button",{onClick:()=>s(m.id),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===m.id?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="chips"&&jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxs("button",{onClick:()=>s(null),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===null?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0,borderColor:n===null?i.primary:void 0},children:[n===null&&jsx("span",{className:"text-[10px]",children:"\u2713"}),"All"]}),t.map(m=>jsxs("button",{onClick:()=>s(m.id),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===m.id?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0,borderColor:n===m.id?i.primary:void 0},children:[n===m.id&&jsx("span",{className:"text-[10px]",children:"\u2713"}),m.name]},m.id))]})]}),f&&x==="accordion"?jsx("div",{className:"space-y-4",children:t.map(m=>{let F=l.has(m.id),M=e.filter(A=>A.category===m.id);return jsxs("div",{children:[jsxs("button",{onClick:()=>{let A=new Set(l);F?A.delete(m.id):A.add(m.id),c(A);},className:"w-full flex items-center justify-between py-2 border-b-2 transition-all group",style:{borderColor:F?i.primary:"#e5e7eb"},children:[jsx("span",{className:"font-semibold text-left transition-colors",style:{color:F?i.primary:void 0},children:m.name}),jsx(ChevronDown,{className:`w-4 h-4 transition-all ${F?"rotate-180":""}`,style:{color:F?i.primary:"#9ca3af"}})]}),F&&jsx("div",{className:`mt-4 ${d==="grid"?`grid ${S} gap-3`:"space-y-3"}`,children:M.map(A=>R(A,d))})]},m.id)})}):d==="grid"?jsx("div",{className:`grid ${S} gap-3`,children:I.map(m=>R(m,"grid"))}):jsx("div",{className:"space-y-3",children:I.map(m=>R(m,"list"))})]})}function oi(){let e=[],t=new Date;t.setHours(0,0,0,0);for(let r=0;r<3;r++){let a=new Date(t.getFullYear(),t.getMonth()+r,1),o=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();for(let i=1;i<=o;i++){if(new Date(a.getFullYear(),a.getMonth(),i)<t||Math.random()>.6)continue;let s=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`;e.push(s);}}return e}var ko={avoid:{bg:"#FEE2E2",text:"#991B1B",label:"Avoid"},caution:{bg:"#FEF3C7",text:"#92400E",label:"Caution"},optimal:{bg:"#D1FAE5",text:"#065F46",label:"Optimal"},neutral:{bg:"#F3F4F6",text:"#4B5563",label:"Neutral"}};function nr({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,cyclePhases:i,selectedService:n,addons:s=[],selectedAddons:l=[],onAddonsChange:c,addonPlacement:d="date_selection"}){console.log("[DateSelection] Addon Debug:",{addonsLength:s.length,hasOnAddonsChange:!!c,addonPlacement:d,showAddons:d!=="separate_step"&&s.length>0&&!!c,addons:s,selectedService:n});let u=a.calendarView||"month",p=a.headerContent?.value||"Select a Date",g=!e||e.length===0,b=useMemo(()=>g?oi():e,[g,e]),v=useMemo(()=>{let D=new Date;if(D.setHours(0,0,0,0),b.length>0){let T=b.find(P=>new Date(P)>=D);if(T){let P=new Date(T);return `${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}`}}return `${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`},[b]),[w,f]=useState(v),x=useMemo(()=>new Set(b),[b]),[y,N]=w.split("-").map(Number),h=["January","February","March","April","May","June","July","August","September","October","November","December"][N-1],k=useMemo(()=>{let D=new Date(y,N-1,1),T=new Date(y,N,0),P=D.getDay(),z=T.getDate(),K=[];for(let Y=0;Y<P;Y++)K.push(null);for(let Y=1;Y<=z;Y++){let Te=`${y}-${String(N).padStart(2,"0")}-${String(Y).padStart(2,"0")}`,U=new Date(Te),ie=new Date;ie.setHours(0,0,0,0),K.push({day:Y,dateStr:Te,isAvailable:x.has(Te)&&U>=ie});}return K},[y,N,x]),S=useMemo(()=>{let D=new Date(y,N-2,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),I=useMemo(()=>{let D=new Date(y,N,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),R=()=>{if(!S)return;let D=new Date(y,N-2,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},m=()=>{if(!I)return;let D=new Date(y,N,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},F=i&&Object.keys(i).length>0,M=()=>{let D=n?.price||0;return l.length>0&&s.length>0&&l.forEach(T=>{let P=s.find(z=>z.id===T);P&&(D+=P.addonPrice||P.price||0);}),D},A=D=>{if(!c)return;let T=l.includes(D);c(T?l.filter(P=>P!==D):[...l,D]);};return jsxs("div",{className:"space-y-6",children:[n&&jsx(motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxs("div",{className:"flex-1",children:[jsx("div",{className:"flex items-center gap-2 mb-3",children:jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Your Selection"})}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.description&&jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:n.description}),n.duration&&jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxs("span",{children:[n.duration," minutes"]})]})]})]}),jsxs("div",{className:"text-right",children:[jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Price"}),jsxs("div",{className:"text-2xl font-bold",style:{color:o.primary},children:["$",n.price]})]})]})}),d!=="separate_step"&&s.length>0&&c&&jsxs(motion.div,{...ge(.1),className:"bg-white rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsx("div",{className:"flex items-center gap-2 mb-4",children:jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Enhance Your Experience"})}),jsx("div",{className:"space-y-3",children:s.map(D=>{let T=l.includes(D.id),P=D.addonPrice||D.price||0;return jsxs("label",{className:"flex items-start gap-4 p-4 rounded-xl border-2 cursor-pointer transition-all group",style:{borderColor:T?o.primary:"#E5E7EB",backgroundColor:T?`${o.primary}08`:"transparent",boxShadow:T?`0 0 0 3px ${o.primary}15`:"none"},children:[jsx("div",{className:"flex items-center pt-0.5",children:jsx("input",{type:"checkbox",checked:T,onChange:()=>A(D.id),className:"w-5 h-5 rounded border-2 border-gray-300 cursor-pointer",style:{accentColor:o.primary}})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-start justify-between gap-3 mb-1",children:[jsx("span",{className:"font-semibold text-base text-gray-900 group-hover:text-gray-700 transition-colors",children:D.name}),jsxs("span",{className:"text-base font-bold whitespace-nowrap flex-shrink-0",style:{color:o.primary},children:["+$",P]})]}),D.description&&jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:D.description})]})]},D.id)})}),l.length>0&&jsx("div",{className:"mt-6 pt-5 border-t-2 border-gray-100",children:jsxs("div",{className:"flex items-center justify-between px-2",children:[jsxs("div",{children:[jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium uppercase tracking-wide",children:"New Total"}),jsxs("div",{className:"text-sm text-gray-600",children:["Service + ",l.length," add-on",l.length>1?"s":""]})]}),jsxs("div",{className:"text-3xl font-bold",style:{color:o.primary},children:["$",M()]})]})})]}),jsx(motion.h2,{...ge(.15),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:o.primary},children:p}),F&&jsx(motion.div,{...ge(.1),className:"bg-white rounded-lg border border-gray-200 px-4 py-3",children:jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 text-xs",children:[jsx("span",{className:"font-medium flex items-center",style:{color:o.primary},children:"Cycle Calendar:"}),jsx("div",{className:"flex items-center gap-3",children:Object.entries(ko).map(([D,T])=>jsxs("div",{className:"flex items-center space-x-1.5",children:[jsx("div",{className:"w-3 h-3 rounded border border-gray-300",style:{backgroundColor:T.bg}}),jsx("span",{children:T.label})]},D))})]})}),u==="month"?jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("button",{className:`p-2 rounded transition-colors ${S?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:R,disabled:!S,children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsxs("p",{className:"font-semibold",children:[h," ",y]}),jsx("button",{className:`p-2 rounded transition-colors ${I?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:m,disabled:!I,children:jsx(ChevronRight,{className:"w-4 h-4"})})]}),jsxs("div",{className:"grid grid-cols-7 gap-2",children:[["Su","Mo","Tu","We","Th","Fr","Sa"].map(D=>jsx("div",{className:"text-center text-xs font-medium py-2 opacity-60",children:D},D)),k.map((D,T)=>{if(!D)return jsx("div",{},`empty-${T}`);let{day:P,dateStr:z,isAvailable:K}=D,Y=t===z,Te=i?.[z],U=Te?ko[Te]:null;return jsx("button",{onClick:()=>K&&r(z),disabled:!K,className:`aspect-square rounded-lg text-sm transition-all ${Y?"text-white shadow-lg font-semibold":K?"hover:scale-105 cursor-pointer":"bg-gray-50 text-gray-300 cursor-not-allowed opacity-40"}`,style:{backgroundColor:Y?o.primary:U?.bg||void 0,color:Y?"white":U?.text||void 0},children:P},z)})]})]}):jsx("div",{className:"grid grid-cols-5 gap-3",children:b.slice(0,5).map(D=>{let T=new Date(D),P=T.getDate(),K=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][T.getDay()],Y=t===D;return jsxs("button",{onClick:()=>r(D),className:`p-4 rounded-lg border-2 transition-all text-center ${Y?"border-current text-white":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:Y?o.primary:void 0,backgroundColor:Y?o.primary:void 0},children:[jsx("p",{className:"text-xs mb-1 opacity-75",children:K}),jsx("p",{className:"text-2xl font-semibold",children:P})]},D)})})]})}function Hn({availableTimes:e,selectedTime:t,onTimeSelect:r,settings:a,serviceDuration:o,colors:i,selectedService:n,selectedDate:s,selectedAddons:l=[],addons:c=[]}){let d=a.timeFormat||"12h",u=a.showDuration!==false,p=a.headerContent?.value||"Pick a Time",g=a.columns||3,b=()=>{let x=n?.price||0;return l.length>0&&c.length>0&&l.forEach(y=>{let N=c.find(C=>C.id===y);N&&(x+=N.addonPrice||N.price||0);}),x},v=x=>new Date(x+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}),w=x=>{let y=x.trim().split(" "),[N,C]=y[0].split(":"),h=parseInt(N),k=C||"00";if(y.length>1){let S=y[1];return d==="24h"?(S==="PM"&&h!==12?h+=12:S==="AM"&&h===12&&(h=0),`${String(h).padStart(2,"0")}:${k}`):x}if(d==="12h"){let S=h>=12?"PM":"AM";return `${h===0?12:h>12?h-12:h}:${k} ${S}`}return `${String(h).padStart(2,"0")}:${k}`},f={2:"grid-cols-2",3:"grid-cols-2 sm:grid-cols-3",4:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-4"}[g]||"grid-cols-3";return jsxs("div",{className:"space-y-6",children:[n&&s&&jsxs(motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsx("div",{className:"flex items-center gap-2 mb-4",children:jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:i.primary},children:"Your Booking"})}),jsxs("div",{className:"mb-3",children:[jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.duration&&jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mt-1",children:[jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxs("span",{children:[n.duration," minutes"]})]})]}),l.length>0&&c.length>0&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-bold text-gray-900 mb-2",children:"Add-ons"}),jsx("div",{className:"space-y-2",children:l.map(x=>{let y=c.find(N=>N.id===x);return y?jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-sm text-gray-700 font-medium",children:y.name}),jsxs("span",{className:"text-sm font-semibold text-gray-900",children:["$",y.addonPrice||y.price||0]})]},x):null})})]}),jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsx("div",{className:"bg-gray-50/50 -mx-6 px-6 py-4 mb-4",children:jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("svg",{className:"w-5 h-5",style:{color:i.primary},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsx("span",{className:"font-bold text-base text-gray-900",children:v(s)})]})})}),jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-base font-bold text-gray-900",children:"Total"}),jsxs("span",{className:"text-2xl font-bold",style:{color:i.primary},children:["$",b()]})]})]}),jsx(motion.h2,{...ge(n&&s?.15:.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:p}),jsx(motion.div,{className:`grid ${f} gap-3`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.3,delay:n&&s?.2:.1},children:e.map((x,y)=>{let N=t===x;return jsxs(motion.button,{onClick:()=>r(x),className:`p-3 rounded-lg border-2 transition-all text-center hover:scale-105 ${N?"border-current text-white shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:N?i.primary:void 0,backgroundColor:N?i.primary:void 0},initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2,delay:.15+y*.03,ease:"easeOut"},children:[jsx("p",{className:"font-medium",children:w(x)}),u&&o&&jsxs("p",{className:"text-xs mt-1 opacity-75",children:[o," min"]})]},x)})})]})}function Wn({addons:e,selectedAddons:t,onAddonsChange:r,settings:a,colors:o}){let i=a.headerContent?.value||"Add Extras",n=a.subheaderContent?.value||"Enhance your experience with these optional add-ons",s=a.showPricing!==false,l=a.showDuration!==false,c=d=>{let u=t.includes(d)?t.filter(p=>p!==d):[...t,d];r(u);};return jsxs("div",{className:"space-y-4",children:[jsxs(motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:o.primary},children:i}),jsx("p",{className:"text-sm opacity-70",children:n})]}),jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:e.map((d,u)=>{let p=t.includes(d.id);return jsxs(motion.button,{onClick:()=>c(d.id),className:`p-4 rounded-lg border-2 transition-all text-left relative ${p?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:p?o.primary:void 0,backgroundColor:p?`${o.primary}10`:void 0},initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1+u*.05},children:[p&&jsx("div",{className:"absolute top-3 right-3 w-6 h-6 rounded-full flex items-center justify-center text-white text-sm",style:{backgroundColor:o.primary},children:"\u2713"}),jsx("p",{className:"font-semibold mb-1 pr-8",children:d.name}),jsx("p",{className:"text-xs opacity-70 mb-3",children:d.description}),jsxs("div",{className:"flex justify-between items-center text-sm",children:[s&&jsxs("span",{className:"font-bold",style:{color:o.primary},children:["+$",d.price]}),l&&jsxs("span",{className:"opacity-60",children:["+",d.duration," min"]})]})]},d.id)})}),t.length>0&&jsxs(motion.div,{className:"bg-gray-50 rounded-lg p-4 mt-4",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},children:[jsx("p",{className:"text-sm font-medium mb-2",children:"Selected Add-ons:"}),jsx("div",{className:"space-y-1",children:t.map(d=>{let u=e.find(p=>p.id===d);return u?jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{children:u.name}),jsxs("span",{className:"font-medium",style:{color:o.primary},children:["+$",u.price]})]},d):null})})]})]})}function jn({isOpen:e,onClose:t,title:r,children:a,isRequired:o=false,maxHeight:i="80vh"}){return useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[e]),useEffect(()=>{if(!o&&e){let n=s=>{s.key==="Escape"&&t();};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)}},[e,o,t]),jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{...rr.backdrop,onClick:o?void 0:t,className:"fixed inset-0 bg-black/50 z-50",style:{backdropFilter:"blur(4px)"}}),jsxs(motion.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:rr.spring,className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-2xl shadow-2xl z-50",style:{maxHeight:i},children:[jsx("div",{className:"flex justify-center pt-3 pb-2",children:jsx("div",{className:"w-12 h-1 bg-gray-300 rounded-full"})}),jsxs("div",{className:"flex items-center justify-between px-6 pb-4 border-b border-gray-200",children:[jsxs("div",{className:"flex items-center gap-2",children:[r&&jsx("h3",{className:"text-lg font-semibold",children:r}),o&&jsx("span",{className:"text-xs font-medium px-2 py-0.5 bg-amber-100 text-amber-800 rounded",children:"Required"})]}),!o&&jsx("button",{onClick:t,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors","aria-label":"Close",children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"overflow-y-auto",style:{maxHeight:`calc(${i} - 120px)`},children:jsx("div",{className:"px-6 py-6",children:a})})]})]})})}function Vn({contactInfo:e,onContactInfoChange:t,settings:r,optInModules:a=[],onOptInData:o,colors:i,isPreview:n=false}){let[s,l]=useState(false),[c,d]=useState(null),[u,p]=useState(()=>{let m={};return a.forEach(F=>{F.defaultChecked&&(m[F.id]=true);}),m}),[g,b]=useState({}),[v,w]=useState({}),f=useRef(false);useEffect(()=>{f.current||(f.current=true,a.forEach(m=>{m.defaultChecked&&m.renderCustomForm&&o&&m.renderCustomForm(()=>{},F=>o(m.id,F),i);}));},[]);let x=r.headerContent?.value||"Your Information",y=m=>m?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)?null:"Please enter a valid email address":"Email is required",N=m=>m?m.replace(/\D/g,"").length<10?"Please enter a valid phone number":null:"Phone number is required",C=m=>!m||m.trim().length===0?"Name is required":m.trim().length<2?"Name must be at least 2 characters":null,h=(m,F)=>{switch(m){case "email":return y(F);case "phone":return N(F);case "name":return C(F);default:return null}},k=[{label:"Name *",type:"text",placeholder:"Your full name",field:"name"},{label:"Email *",type:"email",placeholder:"your@email.com",field:"email"},{label:"Phone *",type:"tel",placeholder:"(555) 123-4567",field:"phone"},{label:"Notes (optional)",type:"textarea",placeholder:"Any special requests or notes...",field:"notes"}],S=(m,F)=>{if(t({...e,[m]:F}),!n&&v[m]){let M=h(m,F);b(A=>({...A,[m]:M||""}));}},I=m=>{if(n)return;w(A=>({...A,[m]:true}));let F=e[m]||"",M=h(m,F);b(A=>({...A,[m]:M||""}));},R=(m,F)=>{if(p(M=>({...M,[m.id]:F})),F){if(m.renderCustomForm){let M=false;if(m.renderCustomForm(()=>{},D=>{o&&o(m.id,D),M=true;},i)===null&&M)return}d(m),l(true);}else o&&o(m.id,null);};return jsxs(Fragment,{children:[jsxs("div",{className:"space-y-4",children:[jsx(motion.h2,{...ge(.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:x}),jsxs("div",{className:"space-y-3",children:[k.map((m,F)=>jsxs(motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.3,delay:.1+F*.05,ease:"easeOut"},children:[jsx("label",{className:"block text-sm font-medium mb-1",children:m.label}),m.type==="textarea"?jsxs(Fragment,{children:[jsx("textarea",{className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent resize-none transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]}):jsxs(Fragment,{children:[jsx("input",{type:m.type,className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]})]},m.label)),a.length>0&&jsx(motion.div,{className:"pt-3 border-t border-gray-200 space-y-3",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:a.map(m=>jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[jsx("input",{type:"checkbox",checked:u[m.id]||false,onChange:F=>R(m,F.target.checked),className:"mt-1 w-4 h-4 rounded border-gray-300",style:{accentColor:i.primary}}),jsxs("div",{children:[jsxs("span",{className:"text-sm font-medium",children:[m.label,m.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.description&&jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:m.description})]})]},m.id))})]})]}),c&&jsx(jn,{isOpen:s,onClose:()=>l(false),title:c.formTitle||"Additional Information",isRequired:c.required,children:c.renderCustomForm?c.renderCustomForm(()=>l(false),m=>{o&&o(c.id,m);},i):jsxs("div",{className:"space-y-4",children:[c.formFields?.map(m=>jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-1",children:[m.label,m.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.type==="textarea"?jsx("textarea",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent resize-none",style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder}):m.type==="select"&&m.options?jsx("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},children:m.options.map(F=>jsx("option",{value:F.value,children:F.label},F.value))}):jsx("input",{type:m.type,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},placeholder:m.placeholder})]},m.id)),jsx("button",{onClick:()=>{o&&c&&o(c.id,{}),l(false);},className:"w-full py-3 rounded-lg text-white font-medium transition-all hover:opacity-90",style:{backgroundColor:i.primary},children:"Save & Continue"})]})})]})}function Yn({service:e,addons:t=[],selectedDate:r,selectedTime:a,paymentProvider:o,paymentConfig:i,onConfirm:n,colors:s,isPreview:l=false}){let c=e?.price||0,d=t.reduce((y,N)=>y+(N.addonPrice||N.price||0),0),u=c+d,p=e?.duration||0,g=t.reduce((y,N)=>y+(N.duration||0),0),b=p+g,v=i.depositPercentage||20,w=(u*(v/100)).toFixed(2),f=u.toFixed(2),x=(parseFloat(f)-parseFloat(w)).toFixed(2);return jsxs("div",{className:"space-y-4",children:[jsx(motion.h2,{...ge(.05),className:"text-xl font-bold text-center",style:{color:s.primary},children:"Confirm & Pay"}),jsx(motion.div,{className:"bg-gray-50 rounded-lg p-4",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1},children:jsxs("div",{className:"space-y-2",children:[e&&jsxs("div",{className:"flex justify-between items-center text-sm",children:[jsxs("div",{children:[jsx("p",{className:"font-medium",children:e.name}),jsxs("p",{className:"text-xs opacity-70",children:[b," min total"]})]}),jsxs("span",{className:"font-bold",style:{color:s.primary},children:["$",c]})]}),t.length>0&&jsx("div",{className:"space-y-1 text-xs",children:t.map(y=>jsxs("div",{className:"flex justify-between opacity-70",children:[jsxs("span",{children:["+ ",y.name]}),jsxs("span",{children:["+$",y.addonPrice||y.price||0]})]},y.id))}),r&&jsxs("div",{className:"flex justify-between items-center text-sm pt-2 border-t border-gray-200",children:[jsx("span",{className:"opacity-70",children:new Date(r+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsx("span",{children:a})]}),jsxs("div",{className:"pt-2 mt-2 border-t border-gray-200 flex justify-between items-center",children:[jsx("span",{className:"text-sm font-medium",children:"Due Today"}),jsxs("span",{className:"text-lg font-bold",style:{color:s.primary},children:["$",w]})]})]})}),jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.2},children:l?jsxs("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:[jsxs("div",{className:"space-y-2",children:[jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsx("span",{className:"text-xs text-gray-400",children:"Card Number"})}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsx("span",{className:"text-xs text-gray-400",children:"MM/YY"})}),jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsx("span",{className:"text-xs text-gray-400",children:"CVV"})})]})]}),jsxs("div",{className:"mt-3 flex items-center justify-center gap-1",children:[jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),jsxs("span",{className:"text-xs text-gray-400",children:["Powered by ",o==="square"?"Square":"Stripe"]})]})]}):jsx("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:jsxs("div",{className:"text-center py-8 text-sm text-gray-500",children:[jsxs("div",{className:"animate-pulse",children:["Initializing ",o==="square"?"Square":"Stripe"," payment..."]}),jsx("div",{className:"mt-4 text-xs text-gray-400",children:"Please wait while we securely load the payment form"})]})})}),jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxs("span",{className:"text-xs",children:["I agree to the ",jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"cancellation policy"})," and understand the $",x," balance is due at appointment."]})]}),jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxs("span",{className:"text-xs",children:["I agree to the ",jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"terms of service"}),"."]})]})]})})]})}var Io={avoid:{phase:"avoid",color:"#EF4444",bgColor:"#FEF2F2",label:"Avoid",icon:"\u{1F534}",description:"Period - avoid waxing"},caution:{phase:"caution",color:"#F59E0B",bgColor:"#FFFBEB",label:"Caution",icon:"\u{1F7E1}",description:"End of period - proceed with caution"},optimal:{phase:"optimal",color:"#10B981",bgColor:"#F0FDF4",label:"Optimal",icon:"\u{1F7E2}",description:"Best time for waxing"},neutral:{phase:"neutral",color:"#6B7280",bgColor:"#F9FAFB",label:"Neutral",icon:"\u26AA",description:"Okay but not optimal"},unknown:{phase:"unknown",color:"#9CA3AF",bgColor:"#F3F4F6",label:"Unknown",icon:"\u2753",description:"No cycle data available"}};function pi({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,fetchCycleData:i,selectedClient:n,onCycleWarning:s,cycleAwareEnabled:l}){let[c,d]=useState({}),[u,p]=useState(false),[g,b]=useState(null),v=useMemo(()=>l!==void 0?l:!!(n?.cycle_opt_in&&i),[l,n?.cycle_opt_in,i]);useEffect(()=>{if(!v||!i||!n){d({});return}e.length!==0&&(p(true),b(null),i(n,e).then(f=>{d(f);}).catch(f=>{console.error("[CycleAwareDateSelection] Error fetching cycle data:",f),b(f.message||"Failed to load cycle data"),d({});}).finally(()=>{p(false);}));},[v,i,n,e]);let w=useCallback(f=>{let x=c[f];x?.phase==="avoid"&&s&&s(x,f),r(f,x);},[c,r,s]);return jsxs("div",{className:"cycle-aware-date-selection space-y-4",children:[v&&Object.keys(c).length>0&&jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[jsxs("h4",{className:"font-medium mb-3 flex items-center",style:{color:o.primary},children:[jsx("span",{className:"mr-2",children:"\u{1F4C5}"}),"Your Cycle Calendar"]}),jsx("div",{className:"grid grid-cols-2 gap-3 text-sm",children:Object.entries(Io).map(([f,x])=>f!=="unknown"&&jsxs("div",{className:"flex items-center space-x-2",children:[jsx("div",{className:"w-3 h-3 rounded-full border border-gray-300",style:{backgroundColor:x.color}}),jsx("span",{children:x.label})]},f))}),jsx("p",{className:"text-xs opacity-70 mt-2",children:"Green dates are optimal for comfortable waxing appointments"})]}),v&&u&&jsx("div",{className:"text-center py-2 text-sm opacity-70",children:"Loading cycle predictions..."}),v&&g&&jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3",children:jsxs("p",{className:"text-yellow-800 text-sm",children:["Unable to load cycle predictions: ",g]})}),jsx(nr,{availableDates:e,selectedDate:t,onDateSelect:w,settings:a,colors:o}),v&&t&&c[t]?.phase==="avoid"&&jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:jsxs("div",{className:"flex items-start space-x-3",children:[jsx("span",{className:"text-red-500 text-xl",children:"\u26A0\uFE0F"}),jsxs("div",{children:[jsx("h4",{className:"font-medium text-red-800 mb-1",children:"This date falls during your predicted period"}),jsx("p",{className:"text-red-700 text-sm mb-3",children:"Waxing during this time may be more uncomfortable than usual. Would you like to see better alternatives?"}),jsxs("div",{className:"flex space-x-2",children:[jsx("button",{className:"px-3 py-1 bg-red-100 text-red-700 rounded text-sm hover:bg-red-200 transition-colors",onClick:()=>{let f=e.filter(x=>c[x]?.phase==="optimal");f.length>0&&w(f[0]);},children:"Show optimal dates"}),jsx("button",{className:"px-3 py-1 text-red-600 text-sm hover:underline",children:"Continue anyway"})]})]})]})})]})}var gi={enabled:true,duration:6e5,warningThreshold:12e4,maxExtensions:2,extensionDuration:3e5,showActions:true,showWarning:true};function Tr({holdStatus:e,config:t,colors:r,onExtend:a,onRelease:o,onWarning:i,onExpired:n,className:s=""}){let[l,c]=useState(Date.now()),[d,u]=useState(false),[p,g]=useState(false),[b,v]=useState(false),w={...gi,...t};useEffect(()=>{if(!e)return;let F=setInterval(()=>{c(Date.now());},1e3);return ()=>clearInterval(F)},[e]);let f=e?Math.max(0,e.expiresAt-l):0,x=f===0&&e!==null,y=f<=w.warningThreshold&&f>0;useEffect(()=>{y&&!d&&i&&e&&(u(true),i(f));},[y,d,i,e,f]),useEffect(()=>{x&&e&&n&&n();},[x,e,n]),useEffect(()=>{u(false);},[e?.holdKey]);let N=useCallback(async()=>{if(!(!a||!e||p))try{g(!0),await a(),u(!1);}catch(F){console.error("[HoldTimer] Failed to extend hold:",F);}finally{g(false);}},[a,e,p]),C=useCallback(async()=>{if(!(!o||!e||b))try{v(!0),await o();}catch(F){console.error("[HoldTimer] Failed to release hold:",F);}finally{v(false);}},[o,e,b]);if(!e||!w.enabled)return null;let h=Math.floor(f/6e4),k=Math.floor(f%6e4/1e3),S=`${h}:${k.toString().padStart(2,"0")}`,I="rgba(139, 92, 246, 0.1)",R="rgba(139, 92, 246, 0.3)",m=r.primary;return x?(I="rgba(239, 68, 68, 0.1)",R="rgba(239, 68, 68, 0.3)",m="#EF4444"):y&&w.showWarning&&(I=`${r.secondary}1A`,R=`${r.secondary}4D`,m=r.secondary),jsx("div",{className:`rounded-lg p-4 text-center ${s}`,style:{backgroundColor:I,borderWidth:"1px",borderStyle:"solid",borderColor:R},children:jsxs("div",{className:"flex flex-col items-center justify-center",children:[jsx("div",{className:"flex flex-col items-center gap-2 mb-4",children:x?jsxs("div",{style:{color:m},className:"font-medium text-base",children:[jsx("span",{children:"Time expired - "}),jsx("button",{onClick:C,disabled:b,className:"underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 inline disabled:opacity-50",style:{color:m},children:b?"Releasing...":"select a new time"})]}):jsxs("div",{style:{color:m},className:"font-medium text-base",children:["Your time slot is reserved for ",S]})}),w.showActions&&!x&&jsxs("div",{className:"flex justify-center gap-2",children:[a&&e.canExtend&&jsxs("button",{onClick:N,disabled:!e.canExtend||p,className:"px-4 py-2 text-sm font-medium rounded transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed text-white",style:{backgroundColor:r.primary},"aria-label":`Extend hold (${e.maxExtensions-e.extensions} extensions remaining)`,children:[p?"Extending...":"Extend",!p&&e.maxExtensions-e.extensions>0&&jsxs("span",{className:"ml-1",children:["(",e.maxExtensions-e.extensions,")"]})]}),o&&jsx("button",{onClick:C,disabled:b,className:"px-4 py-2 text-sm font-medium rounded border transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",style:{borderColor:"rgba(255, 255, 255, 0.2)",color:r.text||"#000000"},"aria-label":"Release hold and return to time selection",children:b?"Releasing...":"Release"})]}),!x&&!e.canExtend&&e.extensions>=e.maxExtensions&&jsx("div",{className:"mt-3 pt-3 border-t border-white/10 text-center",children:jsxs("div",{className:"text-sm",style:{color:r.secondary},children:["Maximum extensions reached - complete booking now or"," ",jsx("button",{onClick:C,disabled:b,className:"hover:underline focus:outline-none focus:underline disabled:opacity-50",style:{color:r.primary},children:b?"releasing...":"select a different time"})]})})]})})}function Ro({config:e,colors:t,services:r=[],categories:a=[],dates:o=[],times:i=[],addons:n=[],paymentProvider:s,paymentConfig:l,isPreview:c=false,onComplete:d,onStepChange:u,onServiceSelect:p,onDateSelect:g,onContactInfoChange:b,validateStep:v,holdTimer:w,stepOrder:f,optInModules:x=[],onOptInData:y,customPaymentForm:N,cyclePhases:C}){let[h,k]=useState(0),[S,I]=useState("forward"),[R,m]=useState(null),[F,M]=useState(null),[A,D]=useState(null),[T,P]=useState([]),[z,K]=useState({}),[Y,Te]=useState({}),[U,ie]=useState(null),Xe=t.bookingText||t.text||"#000000",ot=e.transitions||{},ve=ot.style||"slide",At=ot.speed||"normal",je=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,fe=e.background||{type:"color",value:"#FFFFFF"},O={service:{id:"service",name:"Service",enabled:e.steps?.service_selection?.enabled!==false,settings:e.steps?.service_selection?.settings||{}},date:{id:"date",name:"Date",enabled:e.steps?.date_selection?.enabled!==false,settings:e.steps?.date_selection?.settings||{}},time:{id:"time",name:"Time",enabled:e.steps?.time_selection?.enabled!==false,settings:e.steps?.time_selection?.settings||{}},addons:{id:"addons",name:"Add-ons",enabled:e.steps?.addon_selection?.enabled===true,settings:e.steps?.addon_selection?.settings||{}},details:{id:"details",name:"Details",enabled:e.steps?.contact_form?.enabled!==false,settings:e.steps?.contact_form?.settings||{}},confirm:{id:"confirm",name:"Confirm",enabled:e.steps?.confirmation?.enabled===true,settings:e.steps?.confirmation?.settings||{}}},Ne=f||["service","date","time","addons","details","confirm"],J=Ne.map(E=>O[E]).filter(E=>E&&E.enabled);console.log("[BookingFlow] Step configuration:",{customStepOrder:f,orderedStepIds:Ne,allSteps:J.map(E=>E.id),currentStepIndex:h,currentStepId:J[h]?.id});let re=J[h],at=()=>fe.type==="gradient"?{background:fe.value}:fe.type==="image"?{backgroundImage:`url(${fe.value})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:fe.value},it=()=>{if(je)return .15;switch(At){case "fast":return .2;case "slow":return .5;default:return .3}},fr=()=>ve==="fade"?{enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}:{enter:()=>({x:S==="forward"?50:-50,opacity:0}),center:{x:0,opacity:1},exit:()=>({x:S==="forward"?-50:50,opacity:0})},Kt=()=>{let E=re?.id;if(v)return v(E,{service:R,date:F,time:A,addons:T,contact:z});switch(E){case "service":return R!==null;case "date":return F!==null;case "time":return A!==null;case "details":if(c)return true;let W=z?.name&&z.name.trim().length>=2,_=z?.email&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z.email),ye=z?.phone&&z.phone.replace(/\D/g,"").length>=10;return W&&_&&ye;default:return true}},$t=E=>E<h,Ce=E=>{I(E>h?"forward":"backward"),k(E),u&&u(E,J[E]?.id);},bt=()=>{h<J.length-1&&Ce(h+1);},Lt=async()=>{if(h===0)return;let E=h-1;if(J[E]?.id==="time"&&U&&w?.releaseHold)try{await w.releaseHold(U.holdId),ie(null),D(null);}catch(_){console.error("[BookingFlow] Failed to release hold:",_);}Ce(E);},yr=async E=>{if(D(E),w?.enabled&&w.createHold&&F&&R)try{let W=r.find(ye=>ye.id===R),_=await w.createHold({date:F,time:E,serviceId:R,serviceDuration:W?.duration||60});ie(_);}catch(W){console.error("[BookingFlow] Failed to create hold:",W);return}bt();},br=()=>{ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);},Jt=async()=>{d&&d({service:R,date:F,time:A,addons:T,contact:z,optIn:Y});},Zr=()=>{if(!re)return null;let E={settings:re.settings,colors:t},W=r.find(_=>_.id===R);switch(re.id){case "service":return jsx(On,{...E,services:r,categories:a,selectedService:R,onServiceSelect:se=>{m(se),p&&p(se);}});case "date":return jsx(nr,{...E,availableDates:o,selectedDate:F,onDateSelect:se=>{M(se),g&&g(se);},cyclePhases:C,selectedService:W,addons:n,selectedAddons:T,onAddonsChange:P,addonPlacement:e.steps?.addon_selection?.settings?.placement||"date_selection"});case "time":return jsx(Hn,{...E,availableTimes:i,selectedTime:A,onTimeSelect:yr,serviceDuration:W?.duration||60,selectedService:W,selectedDate:F,selectedAddons:T,addons:n});case "addons":return jsx(Wn,{...E,addons:n,selectedAddons:T,onAddonsChange:P});case "details":return jsx(Vn,{...E,contactInfo:z,onContactInfoChange:se=>{K(se),b&&b(se);},optInModules:x,onOptInData:y});case "confirm":let _=n.filter(se=>T.includes(se.id)),ye=_.reduce((se,Pe)=>se+(Pe.addonPrice||Pe.price||0),0),hr=(W?.price||0)+ye,xr=_.reduce((se,Pe)=>Pe.affectsDuration&&Pe.additionalDuration?se+Pe.additionalDuration:se,W?.duration||60);return N?jsx(N,{bookingData:{service:R,serviceName:W?.name,date:F,time:A,addons:T,contact:z,amount:W?.price||0,duration:xr,clientName:z?.name,clientEmail:z?.email,clientPhone:z?.phone,pendingBooking:{customerClientId:null,serviceId:R,date:F,time:A,notes:z?.notes||"",selectedAddons:_,addonServices:T,addonTotalCost:ye,totalAmount:hr,duration:xr}},onPaymentSuccess:Jt,onPaymentError:Pe=>{console.error("[BookingFlow] Payment error:",Pe);}}):jsx(Yn,{...E,service:W,addons:_,selectedDate:F||"",selectedTime:A||"",paymentProvider:s||"square",paymentConfig:l||{depositPercentage:20},isPreview:c,onConfirm:Jt});default:return null}},st=()=>{let E=e.progressBar?.style||"dots";return E==="bar"?jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsxs("span",{className:"text-sm font-medium",children:["Step ",h+1," of ",J.length]}),jsx("span",{className:"text-xs opacity-60",children:re?.name})]}),jsx("div",{className:"w-full h-2 bg-gray-200 rounded-full overflow-hidden",children:jsx(motion.div,{className:"h-full rounded-full",style:{backgroundColor:t.primary},initial:{width:0},animate:{width:`${(h+1)/J.length*100}%`},transition:{duration:.3,ease:"easeOut"}})})]}):E==="minimal"?jsxs("div",{className:"mb-6 text-center",children:[jsx("p",{className:"text-sm font-medium",style:{color:t.primary},children:re?.name}),jsxs("p",{className:"text-xs opacity-60 mt-1",children:["Step ",h+1," of ",J.length]})]}):jsx("div",{className:"flex justify-center mb-4 overflow-x-auto py-2",children:jsx("div",{className:"flex items-center space-x-1.5 px-4 min-w-max",children:J.map((W,_)=>jsxs("div",{className:"flex items-center",children:[jsx(motion.div,{className:`w-6 h-6 rounded-full flex items-center justify-center font-medium text-xs transition-all flex-shrink-0 ${_===h?"text-white shadow-md":$t(_)?"text-white":"bg-gray-200 text-gray-500"}`,style:{backgroundColor:_<=h?t.primary:void 0},animate:{scale:_===h?1.05:1},transition:{duration:.2},children:$t(_)?"\u2713":_+1}),_<J.length-1&&jsx(motion.div,{className:`w-4 h-0.5 mx-1 transition-all flex-shrink-0 ${_<h?"":"bg-gray-200"}`,style:{backgroundColor:_<h?t.primary:void 0},initial:{scaleX:0},animate:{scaleX:1},transition:{duration:.3,delay:.1}})]},W.id))})})};return jsxs("div",{className:"w-full max-w-4xl mx-auto p-6 rounded-2xl shadow-xl",style:{...at(),color:Xe},children:[st(),w?.enabled&&U&&re?.id!=="time"&&jsx(Tr,{holdStatus:U,config:w.config,colors:t,onExtend:async()=>{if(w.extendHold&&U)try{let E=await w.extendHold(U.holdId);ie(E);}catch(E){console.error("[BookingFlow] Failed to extend hold:",E);}},onRelease:async()=>{if(w.releaseHold&&U)try{await w.releaseHold(U.holdId),ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);}catch(E){console.error("[BookingFlow] Failed to release hold:",E);}},onExpired:br,className:"mb-6"}),jsx("div",{className:"mb-6 min-h-[300px] relative overflow-hidden",children:jsx(AnimatePresence,{mode:"wait",custom:S,children:jsx(motion.div,{custom:S,variants:fr(),initial:"enter",animate:"center",exit:"exit",transition:{duration:it(),ease:[.4,0,.2,1]},children:Zr()},h)})}),!(re?.id==="confirm"&&N)&&jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-200",children:[jsx("button",{onClick:Lt,disabled:h===0,className:"px-4 py-2 rounded-lg border border-gray-300 disabled:opacity-30 disabled:cursor-not-allowed hover:bg-gray-50 transition-all text-sm font-medium",children:"Back"}),h<J.length-1?jsx("button",{onClick:bt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:"Next"}):jsx("button",{onClick:Jt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:re?.id==="confirm"?"Pay & Confirm":"Complete"})]})]})}function yi({section:e,theme:t,BookingFlowComponent:r,config:a,enableInlineEditing:o=false}){let{type:i,settings:n}=e,s=e.id;i==="video_section"&&console.log("\u{1F3AC} Rendering video_section:",{type:i,settings:n,sectionId:s});let l=t?.colors||{primary:"#BCB4FF",secondary:"#CAC426",text:"#000000"},c=t?.typography||{headingFont:"Geist Sans",bodyFont:"Inter",bodySize:"16px"};switch(i){case "logo":return jsx(tn,{logoUrl:n.logoUrl,fallbackText:n.fallbackText,size:n.size,alignment:n.alignment,colors:l,enableInlineEditing:o,sectionId:s});case "header":return jsx(nn,{name:n.name,title:n.title,bio:n.bio,showName:n.showName,showTitle:n.showTitle,showBio:n.showBio,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "featured_link":return jsx(on,{text:n.text,url:n.url,style:n.style,size:n.size,colors:l,enableInlineEditing:o,sectionId:s});case "link_list":return jsx(sn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "social_bar":return jsx(ln,{platforms:n.platforms||[],socialLinks:n.socialLinks,style:n.style,size:n.size,position:n.position,invertIcons:n.invertIcons,colors:l,enableInlineEditing:o,sectionId:s});case "instagram_feed":return jsx(Fn,{username:n.username,colors:l,enableInlineEditing:o,sectionId:s});case "minimal_header":return jsx(bn,{brandName:n.brandName,logoUrl:n.logoUrl,style:n.style,alignment:n.alignment,sticky:n.sticky,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_navigation":return jsx(xn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "feature_content":return jsx(wn,{headline:n.headline,description:n.description,image:n.image,buttonText:n.buttonText,buttonUrl:n.buttonUrl,showButton:n.showButton,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_footer":return jsx(vn,{alignment:n.alignment,showSocial:n.showSocial,showContact:n.showContact,showLinks:n.showLinks,footerText:n.footerText,colors:l,enableInlineEditing:o,sectionId:s});case "hero":return jsx(cn,{headline:n.headline,subheadline:n.subheadline,heroImage:n.heroImage,ctaButton:n.ctaButton,layout:n.layout,imagePosition:n.imagePosition,contentDisplay:n.contentDisplay,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "about":return jsx(dn,{title:n.title,content:n.content,image:n.image,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "services_preview":return jsx(un,{title:n.title,services:n.services,layout:n.layout,columns:n.columns,showPrices:n.showPrices,showDuration:n.showDuration,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "gallery":return jsx(mn,{title:n.title,images:n.images||[],columns:n.columns,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "testimonials":return jsx(gn,{title:n.title,testimonials:n.testimonials,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "team":return jsx(fn,{title:n.title,members:n.members,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "contact":return jsx(yn,{title:n.title,showForm:n.showForm,email:n.email,phone:n.phone,address:n.address,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "before_after":return jsx(Cn,{title:n.title,comparisons:n.comparisons,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "pricing_table":return jsx(Sn,{title:n.title,plans:n.plans,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "booking":return jsx(En,{config:a||{},colors:l,BookingFlowComponent:r,enableInlineEditing:o,sectionId:s});case "fixed_info_card":return jsx(In,{name:n.name,subheading:n.subheading,bio:n.bio,links:n.links||[],bookingButtonText:n.bookingButtonText,bookingButtonUrl:n.bookingButtonUrl,showBookingButton:n.showBookingButton,position:n.position,cardWidth:n.cardWidth,cardColor:n.cardColor,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "video_section":return jsx(Rn,{videoUrl:n.videoUrl,aspectRatio:n.aspectRatio,autoplay:n.autoplay,loop:n.loop,muted:n.muted,controls:n.controls,allowFullScreen:n.allowFullScreen,coverImage:n.coverImage,maxWidth:n.maxWidth,alignment:n.alignment,borderRadius:n.borderRadius,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "scrolling_text_divider":return jsx(Pn,{text:n.text,scrollDirection:n.scrollDirection,scrollSpeed:n.scrollSpeed,orientation:n.orientation,dividerIcon:n.dividerIcon,customIcon:n.customIcon,textSize:n.textSize,textColor:n.textColor,fontWeight:n.fontWeight,backgroundColor:n.backgroundColor,backgroundGradient:n.backgroundGradient,pauseOnHover:n.pauseOnHover,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "location_map":return jsx(An,{address:n.address,displayType:n.displayType,mapHeight:n.mapHeight,mapStyle:n.mapStyle,zoom:n.zoom,showMarker:n.showMarker,borderRadius:n.borderRadius,directionsButtonText:n.directionsButtonText,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "image_section":return jsx(Mn,{imageUrl:n.imageUrl,altText:n.altText,caption:n.caption,maxWidth:n.maxWidth,alignment:n.alignment,aspectRatio:n.aspectRatio,borderRadius:n.borderRadius,linkUrl:n.linkUrl,openInNewTab:n.openInNewTab,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "faq_section":return jsx($n,{title:n.title,faqs:n.faqs,layout:n.layout,maxWidth:n.maxWidth,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "navbar":return jsx(Bn,{brandName:n.brandName,logoUrl:n.logoUrl,showLogo:n.showLogo,showBrandName:n.showBrandName,links:n.links,ctaText:n.ctaText,ctaUrl:n.ctaUrl,sticky:n.sticky,transparentOnTop:n.transparentOnTop,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "text_section":return jsx(zn,{title:n.title,content:n.content,alignment:n.alignment,maxWidth:n.maxWidth,textSize:n.textSize,backgroundColor:n.backgroundColor,textColor:n.textColor,paddingY:n.paddingY,colors:l,typography:c,enableInlineEditing:o,sectionId:s});default:return jsx("div",{className:"container mx-auto px-4 py-16",children:jsx("div",{className:"max-w-4xl mx-auto p-8 rounded-lg border-2 border-dashed text-center",style:{borderColor:l.primary,opacity:.5},children:jsxs("p",{className:"text-lg",style:{color:l.text},children:["Unknown section type: ",i]})})})}}var Xn=null;function xi(){if(!Xn){let e=import.meta.env.VITE_SUPABASE_URL||process.env.NEXT_PUBLIC_SUPABASE_URL,t=import.meta.env.VITE_SUPABASE_ANON_KEY||process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!e||!t)throw new Error("Supabase URL and Anon Key must be provided");Xn=createClient(e,t);}return Xn}var nt={bucket:"form-uploads",limits:{maxSize:5*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp","image/jpg"]}};async function To(e,t,r){if(console.log("\u{1F4E6} uploadFormImage called:",{fileName:e.name,clientId:t,formId:r}),e.size>nt.limits.maxSize)throw new Error(`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`);if(!nt.limits.allowedTypes.includes(e.type))throw new Error(`File type ${e.type} not allowed. Accepted types: JPG, PNG, WebP`);console.log("\u{1F3A8} Starting image optimization...");let a=await vi(e);console.log("\u2705 Image optimized:",{originalSize:e.size,optimizedSize:a.size});let o=Date.now();e.name.split(".").pop()?.toLowerCase()||"jpg";let n=e.name.replace(/[^a-zA-Z0-9.-]/g,"_").substring(0,50),s=`${o}_${n}`,l=`${t}/${r}/${s}`;console.log("\u2601\uFE0F Uploading to Supabase:",{filePath:l,bucket:nt.bucket});let c=xi(),{data:d,error:u}=await c.storage.from(nt.bucket).upload(l,a,{cacheControl:"3600",upsert:false,contentType:a.type});if(console.log("\u{1F4E4} Upload result:",{data:d,error:u}),u)throw console.error("\u274C Supabase upload error:",u),new Error(`Upload failed: ${u.message}`);console.log("\u2705 Upload successful, getting public URL...");let{data:{publicUrl:p}}=c.storage.from(nt.bucket).getPublicUrl(l);return console.log("\u2705 Public URL obtained:",p),{url:p,path:l,filename:e.name,size:a.size,type:a.type}}async function vi(e,t=1920,r=.85){console.log("\u{1F5BC}\uFE0F optimizeImage: Starting optimization");let a=e.type==="image/png"||e.type==="image/webp",o=a?e.type:"image/jpeg";return console.log("\u{1F5BC}\uFE0F optimizeImage: Output type:",o,"Transparency:",a),new Promise((i,n)=>{let s=setTimeout(()=>{console.error("\u23F1\uFE0F optimizeImage: Timeout after 30 seconds"),n(new Error("Image optimization timed out"));},3e4),l=new Image,c=document.createElement("canvas"),d=c.getContext("2d",{alpha:a});if(!d){clearTimeout(s),console.error("\u274C optimizeImage: Canvas context not available"),n(new Error("Canvas context not available"));return}console.log("\u{1F5BC}\uFE0F optimizeImage: Created canvas and context"),l.onload=()=>{console.log("\u{1F5BC}\uFE0F optimizeImage: Image loaded",{width:l.width,height:l.height});try{let u=Math.min(t/l.width,1);c.width=l.width*u,c.height=l.height*u,console.log("\u{1F5BC}\uFE0F optimizeImage: Resizing to",{width:c.width,height:c.height}),a&&d.clearRect(0,0,c.width,c.height),d.drawImage(l,0,0,c.width,c.height),console.log("\u{1F5BC}\uFE0F optimizeImage: Image drawn, converting to blob..."),c.toBlob(p=>{if(clearTimeout(s),!p){console.error("\u274C optimizeImage: Blob conversion failed"),n(new Error("Image optimization failed"));return}console.log("\u2705 optimizeImage: Blob created",{size:p.size,type:o});let g=new File([p],e.name,{type:o,lastModified:Date.now()});console.log("\u2705 optimizeImage: Optimization complete"),i(g);},o,r);}catch(u){clearTimeout(s),console.error("\u274C optimizeImage: Error during processing",u),n(u);}},l.onerror=u=>{clearTimeout(s),console.error("\u274C optimizeImage: Failed to load image",u),n(new Error("Failed to load image"));},console.log("\u{1F5BC}\uFE0F optimizeImage: Creating object URL and loading image..."),l.src=URL.createObjectURL(e);})}function Po(e){return e.size>nt.limits.maxSize?{valid:false,error:`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`}:nt.limits.allowedTypes.includes(e.type)?{valid:true}:{valid:false,error:"File type not allowed. Accepted: JPG, PNG, WebP"}}function Ar({field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n}){let s=useRef(null),[l,c]=useState(false),[d,u]=useState(null),p=n?.labelColor||"#374151",g=n?.fieldStyle||"outlined",v=(()=>{let f="w-full px-4 py-2 transition-all focus:outline-none";if(r)return `${f} bg-red-50 border border-red-300 rounded-lg focus:ring-2 focus:ring-red-500`;switch(g){case "filled":return `${f} bg-gray-100 border border-transparent rounded-lg focus:bg-white focus:ring-2 focus:ring-gray-900 focus:border-transparent`;case "underlined":return `${f} bg-transparent border-0 border-b-2 border-gray-300 rounded-none focus:border-gray-900 focus:ring-0 px-0`;case "minimal":return `${f} bg-transparent border border-gray-200 rounded-lg focus:border-gray-400 focus:ring-1 focus:ring-gray-300`;case "outlined":default:return `${f} bg-white border-2 border-gray-300 rounded-lg focus:border-gray-900 focus:ring-2 focus:ring-gray-900`}})(),w="block text-sm font-medium mb-1";if(e.type==="text"||e.type==="email"||e.type==="tel")return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("input",{type:e.type,id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,className:v,style:{color:p}}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="textarea")return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("textarea",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,rows:4,className:v,style:{color:p}}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="date")return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("input",{type:"date",id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p}}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="select"&&e.options)return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxs("select",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p},children:[jsx("option",{value:"",children:"Select an option..."}),e.options.map(f=>jsx("option",{value:f.value,children:f.label},f.value))]}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="radio"&&e.options)return jsxs("div",{children:[jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("div",{className:"space-y-2 mt-2",children:e.options.map(f=>jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsx("input",{type:"radio",name:e.id,value:f.value,checked:t===f.value,onChange:x=>a(x.target.value),required:e.required,className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2"}),jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:f.label})]},f.value))}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="checkbox"&&e.options){let f=Array.isArray(t)?t:[],x=y=>{let N=f.includes(y)?f.filter(C=>C!==y):[...f,y];a(N);};return jsxs("div",{children:[jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("div",{className:"space-y-2 mt-2",children:e.options.map(y=>jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsx("input",{type:"checkbox",name:`${e.id}[]`,value:y.value,checked:f.includes(y.value),onChange:()=>x(y.value),className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2 rounded"}),jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:y.label})]},y.value))}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]})}if(e.type==="photo"){let f=async x=>{let y=x.target.files?.[0];if(!y)return;u(null);let N=Po(y);if(!N.valid){u(N.error||"Invalid file"),s.current&&(s.current.value="");return}if(!o||!i){u("Missing required configuration for file upload"),s.current&&(s.current.value="");return}c(true);try{let C=await To(y,o,i);a({url:C.url,filename:C.filename,size:C.size,type:C.type,uploadedAt:new Date().toISOString()}),u(null);}catch(C){console.error("Photo upload error:",C),u(C instanceof Error?C.message:"Upload failed"),s.current&&(s.current.value="");}finally{c(false);}};return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxs("div",{className:"mt-1",children:[jsx("input",{ref:s,type:"file",id:e.id,name:e.id,accept:"image/*",onChange:f,required:e.required,disabled:l,className:`block w-full text-sm text-gray-500
10
+ `}),jsxs("div",{className:`flex items-center whitespace-nowrap ${h[n]} ${k[l]} uppercase tracking-wider`,style:{fontFamily:g?.headingFont||"inherit",color:s||p.text,animation:`scroll-${t} ${C}s linear infinite`,animationPlayState:w?"paused":"running"},children:[jsx("span",{className:"inline-block",children:I}),jsx("span",{className:"inline-block","aria-hidden":"true",children:I})]})]})}function An({address:e,displayType:t="both",mapHeight:r="medium",mapStyle:a="roadmap",zoom:o=15,showMarker:i=true,borderRadius:n=12,directionsButtonText:s="Get Directions",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let g={small:300,medium:400,large:500}[r],b=encodeURIComponent(e),v=`https://www.google.com/maps/dir/?api=1&destination=${b}`,f=`https://www.google.com/maps/embed/v1/place?key=${import.meta.env?.VITE_GOOGLE_MAPS_API_KEY||typeof globalThis<"u"&&globalThis.process?.env?.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY||""}&q=${b}&zoom=${o}&maptype=${a}`;return jsx("div",{className:"container mx-auto px-4",children:jsxs("div",{className:"max-w-4xl mx-auto",children:[(t==="map-only"||t==="both")&&e&&jsx("div",{className:"w-full overflow-hidden mb-6",style:{height:`${g}px`,borderRadius:`${n}px`},children:jsx("iframe",{src:f,className:"w-full h-full",style:{border:0},allowFullScreen:true,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",title:"Location Map"})}),(t==="address-only"||t==="both")&&jsx("div",{className:"p-6 rounded-lg border",style:{backgroundColor:`${l.primary}10`,borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[jsx("div",{className:"flex-1",children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{className:"w-5 h-5 mt-0.5 flex-shrink-0",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsxs("div",{children:[jsx("p",{className:"font-medium mb-1",style:{color:l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.address"},children:e||"Add your address"}),e&&jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"text-sm underline hover:no-underline",style:{color:l.primary},children:"View in Google Maps \uFFFD"})]})]})}),e&&jsx("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"px-6 py-3 rounded-lg font-semibold transition-all hover:opacity-90 text-center",style:{backgroundColor:l.primary,color:"#FFFFFF"},children:s})]})}),!e&&jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${l.primary}30`,borderRadius:`${n}px`},children:[jsxs("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:l.primary,viewBox:"0 0 24 24",children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})]}),jsx("p",{style:{color:l.text,opacity:.6},children:"Add your business address to display a map"})]})]})})}function Mn({imageUrl:e,altText:t="",caption:r,maxWidth:a="large",alignment:o="center",aspectRatio:i="auto",borderRadius:n=12,linkUrl:s,openInNewTab:l=true,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let g={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},b={auto:null,"16:9":"56.25%","4:3":"75%","1:1":"100%","3:2":"66.67%"},v=o==="center"?"mx-auto":o==="right"?"ml-auto":"mr-auto",w=jsxs("div",{className:`${g[a]} ${v}`,children:[jsx("div",{className:"relative w-full overflow-hidden",style:{borderRadius:`${n}px`,...b[i]&&{paddingBottom:b[i]}},children:e?jsx("img",{src:e,alt:t||"Image",className:i==="auto"?"w-full h-auto":"absolute top-0 left-0 w-full h-full object-cover",style:{borderRadius:`${n}px`}}):jsx("div",{className:"flex items-center justify-center bg-gray-100",style:{backgroundColor:`${c.primary}10`,borderRadius:`${n}px`,minHeight:i==="auto"?"300px":void 0},children:jsxs("div",{className:"text-center px-4",children:[jsx("svg",{className:"w-16 h-16 mx-auto mb-4",fill:"none",stroke:c.primary,viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsx("p",{style:{color:c.text,opacity:.6},children:"Add an image URL to display"})]})})}),r&&e&&jsx("p",{className:"mt-3 text-sm text-center",style:{color:c.text,opacity:.7,fontFamily:d?.bodyFont||"inherit"},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.caption"},children:r})]});return jsx("div",{className:a==="full"?"w-full":"container mx-auto px-4",children:s&&e?jsx("a",{href:s,target:l?"_blank":"_self",rel:l?"noopener noreferrer":void 0,className:"block",children:w}):w})}function Xa({faq:e,index:t,colors:r,typography:a,enableInlineEditing:o,sectionId:i}){let[n,s]=useState(false);return jsxs("div",{className:"border-b border-opacity-10",style:{borderColor:r.text},children:[jsxs("button",{onClick:()=>s(!n),className:"w-full py-4 px-6 flex items-center justify-between text-left hover:bg-opacity-5 transition-colors",style:{backgroundColor:n?`${r.primary}10`:"transparent"},children:[jsx("span",{className:"font-semibold text-lg pr-4",style:{color:r.text,fontFamily:a?.headingFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.question`},children:e.question||"Add question..."}),jsx("svg",{className:"w-5 h-5 flex-shrink-0 transition-transform",style:{color:r.primary,transform:n?"rotate(180deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),n&&jsx("div",{className:"px-6 pb-4 pt-2",style:{color:r.text,opacity:.8,fontFamily:a?.bodyFont||"inherit"},...o&&{"data-editable":true,"data-section-id":i,"data-field-path":`settings.faqs.${t}.answer`},children:e.answer||"Add answer..."})]})}function $n({title:e="Frequently Asked Questions",faqs:t=[],layout:r="accordion",maxWidth:a="large",colors:o,typography:i,enableInlineEditing:n=false,sectionId:s=""}){return jsx("div",{className:"container mx-auto px-4",children:jsxs("div",{className:`${{full:"max-w-full",large:"max-w-4xl",medium:"max-w-3xl",small:"max-w-2xl"}[a]} mx-auto`,children:[e&&jsx("h2",{className:"text-3xl font-bold text-center mb-8",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":"settings.title"},children:e}),t.length>0?jsx("div",{className:"rounded-lg overflow-hidden",style:{border:`1px solid ${o.text}20`,backgroundColor:`${o.primary}05`},children:t.map((c,d)=>r==="accordion"?jsx(Xa,{faq:c,index:d,colors:o,typography:i,enableInlineEditing:n,sectionId:s},d):jsxs("div",{className:"border-b border-opacity-10 last:border-b-0 p-6",style:{borderColor:o.text},children:[jsx("h3",{className:"font-semibold text-lg mb-2",style:{color:o.text,fontFamily:i?.headingFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.question`},children:c.question||"Add question..."}),jsx("p",{style:{color:o.text,opacity:.8,fontFamily:i?.bodyFont||"inherit"},...n&&{"data-editable":true,"data-section-id":s,"data-field-path":`settings.faqs.${d}.answer`},children:c.answer||"Add answer..."})]},d))}):jsxs("div",{className:"p-12 rounded-lg border-2 border-dashed text-center",style:{borderColor:`${o.primary}30`,backgroundColor:`${o.primary}05`},children:[jsx("svg",{className:"w-12 h-12 mx-auto mb-4",fill:"none",stroke:o.primary,viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsx("p",{style:{color:o.text,opacity:.6},children:"Add FAQ items to get started"})]})]})})}function Bn({brandName:e="Your Brand",logoUrl:t,showLogo:r=true,showBrandName:a=true,links:o=[],ctaText:i,ctaUrl:n,sticky:s=true,transparentOnTop:l=false,colors:c,typography:d,enableInlineEditing:u=false,sectionId:p=""}){let[g,b]=useState(false),[v,w]=useState(false),[f,x]=useState("");useEffect(()=>{let h=()=>{w(window.scrollY>20);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[]),useEffect(()=>{let h=()=>{let k=o.filter(I=>I.url.startsWith("#")).map(I=>document.querySelector(`[data-section-id="${I.url.substring(1)}"]`)).filter(Boolean),S="";k.forEach(I=>{if(I){let R=I.getBoundingClientRect();R.top<=100&&R.bottom>=100&&(S=I.getAttribute("data-section-id")||"");}}),x(S);};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[o]);let y=(h,k)=>{if(k.startsWith("#")){h.preventDefault();let S=k.substring(1),I=document.querySelector(`[data-section-id="${S}"]`);I&&I.scrollIntoView({behavior:"smooth",block:"start"}),b(false);}},N=l&&!v;return jsx("nav",{className:`${s?"sticky top-0 z-50":""} ${N?"bg-transparent":s?"bg-white/80 backdrop-blur-md border-b":"bg-white border-b"} transition-all duration-300`,style:{borderColor:N?"transparent":`${c.primary}20`},children:jsxs("div",{className:"container mx-auto px-4",children:[jsxs("div",{className:"flex items-center justify-between h-16 md:h-20",children:[jsxs("div",{className:"flex items-center gap-3",children:[r&&t&&jsx("img",{src:t,alt:e,className:"h-8 md:h-10 w-auto object-contain"}),a&&jsx("h1",{className:"text-xl md:text-2xl font-bold",style:{fontFamily:d?.headingFont||"inherit",color:c.text},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":"settings.brandName"},children:e})]}),jsxs("div",{className:"hidden md:flex items-center gap-8",children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsxs("a",{href:h.url,onClick:I=>y(I,h.url),className:"relative text-base font-medium transition-colors group",style:{color:S?c.primary:c.text,fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},...u&&{"data-editable":true,"data-section-id":p,"data-field-path":`settings.links.${k}.label`},children:[h.label,jsx("span",{className:`absolute -bottom-1 left-0 h-0.5 transition-all ${S?"w-full":"w-0 group-hover:w-full"}`,style:{backgroundColor:c.primary}})]},h.id)}),i&&n&&jsx("a",{href:n,className:"px-6 py-2.5 rounded-full font-semibold transition-all hover:opacity-90 hover:scale-105",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]}),jsx("button",{onClick:()=>b(!g),className:"md:hidden p-2 rounded-lg transition-colors hover:bg-black/5","aria-label":"Toggle menu",children:jsx("svg",{className:"w-6 h-6",fill:"none",stroke:c.text,viewBox:"0 0 24 24",children:g?jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]}),jsx("div",{className:`md:hidden overflow-hidden transition-all duration-300 ${g?"max-h-96 pb-4":"max-h-0"}`,children:jsxs("div",{className:"flex flex-col space-y-3 pt-4 border-t",style:{borderColor:`${c.primary}20`},children:[o.map((h,k)=>{let S=h.url.startsWith("#")&&h.url.substring(1)===f;return jsx("a",{href:h.url,onClick:I=>y(I,h.url),className:"text-base font-medium py-2 px-4 rounded-lg transition-colors",style:{color:S?c.primary:c.text,backgroundColor:S?`${c.primary}10`:"transparent",fontFamily:d?.bodyFont||"inherit"},...h.linkType==="external"&&!h.url.startsWith("#")?{target:"_blank",rel:"noopener noreferrer"}:{},children:h.label},h.id)}),i&&n&&jsx("a",{href:n,className:"px-6 py-3 rounded-full font-semibold text-center transition-all hover:opacity-90",style:{backgroundColor:c.primary,color:c.buttonText||"#FFFFFF",fontFamily:d?.bodyFont||"inherit"},children:i})]})})]})})}function zn({title:e,content:t,alignment:r="left",maxWidth:a="medium",textSize:o="medium",backgroundColor:i,textColor:n,paddingY:s="medium",colors:l,typography:c,enableInlineEditing:d=false,sectionId:u=""}){let p={full:"max-w-full",large:"max-w-6xl",medium:"max-w-4xl",small:"max-w-2xl"},g={left:"text-left",center:"text-center",right:"text-right"},b={small:"text-sm",medium:"text-base",large:"text-lg"};return jsx("div",{className:{none:"py-0",small:"py-8",medium:"py-16",large:"py-24"}[s],style:{backgroundColor:i||"transparent"},children:jsx("div",{className:"container mx-auto px-4",children:jsxs("div",{className:`${p[a]} mx-auto ${g[r]}`,children:[e&&jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-6",style:{color:n||l.text,fontFamily:c?.headingFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.title"},children:e}),jsx("div",{className:`${b[o]} leading-relaxed whitespace-pre-wrap`,style:{color:n||l.text,fontFamily:c?.bodyFont||"inherit"},...d&&{"data-editable":true,"data-section-id":u,"data-field-path":"settings.content"},children:t||"Add your text content here..."})]})})})}function $c(e,t=false){if(t)return .15;switch(e){case "fast":return .2;case "slow":return .5;default:return .3}}function Ja(e=50){return {enter:t=>({x:t==="forward"?e:-e,opacity:0}),center:{x:0,opacity:1},exit:t=>({x:t==="forward"?-e:e,opacity:0})}}function Qa(){return {enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}}function Lc(e,t){return e==="fade"?Qa():Ja(t)}var rr={easing:[.4,0,.2,1],spring:{type:"spring",damping:30,stiffness:300},staggerChildren:{staggerChildren:.05,delayChildren:.1},cardHover:{scale:1.02,transition:{duration:.2}},buttonHover:{scale:1.05,transition:{duration:.2}},fadeIn:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},slideUp:{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"}},scaleIn:{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9}},slideInLeft:{initial:{opacity:0,x:-10},animate:{opacity:1,x:0}},slideInRight:{initial:{opacity:0,x:10},animate:{opacity:1,x:0}},backdrop:{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}};function Bc(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function zc(e,t=.1,r=.05){return Array.from({length:e},(a,o)=>({initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:t+o*r,ease:rr.easing}}))}function ge(e=0,t=.3){return {initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:t,delay:e,ease:rr.easing}}}function On({services:e,categories:t=[],selectedService:r,onServiceSelect:a,settings:o,colors:i}){let[n,s]=useState(null),[l,c]=useState(new Set(t.length>0?[t[0].id]:[])),d=o.serviceLayout||"grid",u=o.columns||2,p=o.headerContent?.value||"Choose Your Service",g=o.subheaderContent?.value||"Select the service you'd like to book",b=o.showPricing!==false,v=o.showDuration!==false,w=o.showDescription!==false,f=o.enableCategories===true,x=o.categoryStyle||"dropdown",y=o.policyImages||[],N=o.policyText||null,C=o.imageSpacing||"small",h={none:"0px",small:"8px",medium:"16px",large:"24px"},k=o.imageBorderRadius||"0px",S={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"}[u]||"grid-cols-2",I=f&&n?e.filter(m=>m.category===n):e,R=(m,F)=>{let M=r===m.id;return jsx("button",{onClick:()=>a(m.id),className:`w-full ${F==="grid"?"h-full":""} p-4 rounded-lg border-2 transition-all text-left ${F==="grid"?"flex flex-col":""} ${M?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:M?i.primary:void 0,backgroundColor:M?`${i.primary}10`:void 0},children:F==="grid"?jsxs(Fragment,{children:[jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsx("p",{className:"text-xs opacity-70 mb-2 flex-1",children:m.description}),jsxs("div",{className:"flex justify-between items-center text-sm mt-auto",children:[b&&jsxs("span",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxs("span",{className:"opacity-60",children:[m.duration," min"]})]})]}):jsxs("div",{className:"flex justify-between items-start",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"font-semibold mb-1",children:m.name}),w&&jsx("p",{className:"text-sm opacity-70",children:m.description})]}),jsxs("div",{className:"text-right ml-4",children:[b&&jsxs("p",{className:"font-bold",style:{color:i.primary},children:["$",m.price]}),v&&jsxs("p",{className:"text-sm opacity-60",children:[m.duration," min"]})]})]})},m.id)};return jsxs("div",{className:"space-y-4",children:[jsxs(motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:i.primary},children:p}),jsx("p",{className:"text-sm opacity-70",children:g})]}),y&&y.length>0&&jsx("div",{className:"w-full flex flex-col",style:{gap:h[C]},children:y.slice(0,3).map((m,F)=>jsx("div",{className:"w-full overflow-hidden",style:{aspectRatio:"720 / 300",borderRadius:k},children:jsx("img",{src:m.url,alt:m.alt||`Policy image ${F+1}`,className:"w-full h-full object-cover"})},F))}),(!y||y.length===0)&&N&&jsx("div",{className:"w-full p-4 rounded-lg border",style:{backgroundColor:`${i.primary}10`,borderColor:`${i.primary}30`},dangerouslySetInnerHTML:{__html:N}}),f&&t.length>0&&jsxs(Fragment,{children:[x==="dropdown"&&jsxs("div",{children:[jsx("label",{className:"block text-sm font-medium mb-2",children:"Service Category"}),jsxs("select",{value:n||"all",onChange:m=>s(m.target.value==="all"?null:m.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent transition-all",style:{"--tw-ring-color":i.primary},children:[jsx("option",{value:"all",children:"All Services"}),t.map(m=>jsx("option",{value:m.id,children:m.name},m.id))]})]}),x==="tabs"&&jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsx("button",{onClick:()=>s(null),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===null?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All Services"}),t.map(m=>jsx("button",{onClick:()=>s(m.id),className:`px-4 py-2 rounded-lg transition-all text-sm font-medium ${n===m.id?"text-white shadow-lg":"border border-gray-300 hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="pills"&&jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2 scrollbar-hide",children:[jsx("button",{onClick:()=>s(null),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===null?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===null?i.primary:void 0},children:"All"}),t.map(m=>jsx("button",{onClick:()=>s(m.id),className:`px-5 py-2 rounded-full transition-all text-sm font-medium whitespace-nowrap ${n===m.id?"text-white shadow-md":"bg-gray-100 hover:bg-gray-200"}`,style:{backgroundColor:n===m.id?i.primary:void 0},children:m.name},m.id))]}),x==="chips"&&jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxs("button",{onClick:()=>s(null),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===null?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===null?i.primary:void 0,borderColor:n===null?i.primary:void 0},children:[n===null&&jsx("span",{className:"text-[10px]",children:"\u2713"}),"All"]}),t.map(m=>jsxs("button",{onClick:()=>s(m.id),className:`px-3 py-1.5 rounded-lg transition-all text-xs font-medium flex items-center gap-1.5 ${n===m.id?"text-white":"border border-gray-300 bg-white hover:border-gray-400"}`,style:{backgroundColor:n===m.id?i.primary:void 0,borderColor:n===m.id?i.primary:void 0},children:[n===m.id&&jsx("span",{className:"text-[10px]",children:"\u2713"}),m.name]},m.id))]})]}),f&&x==="accordion"?jsx("div",{className:"space-y-4",children:t.map(m=>{let F=l.has(m.id),M=e.filter(A=>A.category===m.id);return jsxs("div",{children:[jsxs("button",{onClick:()=>{let A=new Set(l);F?A.delete(m.id):A.add(m.id),c(A);},className:"w-full flex items-center justify-between py-2 border-b-2 transition-all group",style:{borderColor:F?i.primary:"#e5e7eb"},children:[jsx("span",{className:"font-semibold text-left transition-colors",style:{color:F?i.primary:void 0},children:m.name}),jsx(ChevronDown,{className:`w-4 h-4 transition-all ${F?"rotate-180":""}`,style:{color:F?i.primary:"#9ca3af"}})]}),F&&jsx("div",{className:`mt-4 ${d==="grid"?`grid ${S} gap-3`:"space-y-3"}`,children:M.map(A=>R(A,d))})]},m.id)})}):d==="grid"?jsx("div",{className:`grid ${S} gap-3`,children:I.map(m=>R(m,"grid"))}):jsx("div",{className:"space-y-3",children:I.map(m=>R(m,"list"))})]})}function oi(){let e=[],t=new Date;t.setHours(0,0,0,0);for(let r=0;r<3;r++){let a=new Date(t.getFullYear(),t.getMonth()+r,1),o=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();for(let i=1;i<=o;i++){if(new Date(a.getFullYear(),a.getMonth(),i)<t||Math.random()>.6)continue;let s=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`;e.push(s);}}return e}var ko={avoid:{bg:"#FEE2E2",text:"#991B1B",label:"Avoid"},caution:{bg:"#FEF3C7",text:"#92400E",label:"Caution"},optimal:{bg:"#D1FAE5",text:"#065F46",label:"Optimal"},neutral:{bg:"#F3F4F6",text:"#4B5563",label:"Neutral"}};function nr({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,cyclePhases:i,selectedService:n,addons:s=[],selectedAddons:l=[],onAddonsChange:c,addonPlacement:d="date_selection"}){console.log("[DateSelection] Addon Debug:",{addonsLength:s.length,hasOnAddonsChange:!!c,addonPlacement:d,showAddons:d!=="separate_step"&&s.length>0&&!!c,addons:s,selectedService:n});let u=a.calendarView||"month",p=a.headerContent?.value||"Select a Date",g=!e||e.length===0,b=useMemo(()=>g?oi():e,[g,e]),v=useMemo(()=>{let D=new Date;if(D.setHours(0,0,0,0),b.length>0){let T=b.find(P=>new Date(P)>=D);if(T){let P=new Date(T);return `${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}`}}return `${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`},[b]),[w,f]=useState(v),x=useMemo(()=>new Set(b),[b]),[y,N]=w.split("-").map(Number),h=["January","February","March","April","May","June","July","August","September","October","November","December"][N-1],k=useMemo(()=>{let D=new Date(y,N-1,1),T=new Date(y,N,0),P=D.getDay(),z=T.getDate(),K=[];for(let Y=0;Y<P;Y++)K.push(null);for(let Y=1;Y<=z;Y++){let Te=`${y}-${String(N).padStart(2,"0")}-${String(Y).padStart(2,"0")}`,U=new Date(Te),ie=new Date;ie.setHours(0,0,0,0),K.push({day:Y,dateStr:Te,isAvailable:x.has(Te)&&U>=ie});}return K},[y,N,x]),S=useMemo(()=>{let D=new Date(y,N-2,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),I=useMemo(()=>{let D=new Date(y,N,1),T=`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`;return b.some(P=>P.startsWith(T))},[b,y,N]),R=()=>{if(!S)return;let D=new Date(y,N-2,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},m=()=>{if(!I)return;let D=new Date(y,N,1);f(`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}`);},F=i&&Object.keys(i).length>0,M=()=>{let D=n?.price||0;return l.length>0&&s.length>0&&l.forEach(T=>{let P=s.find(z=>z.id===T);P&&(D+=P.addonPrice||P.price||0);}),D},A=D=>{if(!c)return;let T=l.includes(D);c(T?l.filter(P=>P!==D):[...l,D]);};return jsxs("div",{className:"space-y-6",children:[n&&jsx(motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:jsxs("div",{className:"flex items-start justify-between gap-4",children:[jsxs("div",{className:"flex-1",children:[jsx("div",{className:"flex items-center gap-2 mb-3",children:jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Your Selection"})}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.description&&jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:n.description}),n.duration&&jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxs("span",{children:[n.duration," minutes"]})]})]})]}),jsxs("div",{className:"text-right",children:[jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium",children:"Price"}),jsxs("div",{className:"text-2xl font-bold",style:{color:o.primary},children:["$",n.price]})]})]})}),d!=="separate_step"&&s.length>0&&c&&jsxs(motion.div,{...ge(.1),className:"bg-white rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsx("div",{className:"flex items-center gap-2 mb-4",children:jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:o.primary},children:"Enhance Your Experience"})}),jsx("div",{className:"space-y-3",children:s.map(D=>{let T=l.includes(D.id),P=D.addonPrice||D.price||0;return jsxs("label",{className:"flex items-start gap-4 p-4 rounded-xl border-2 cursor-pointer transition-all group",style:{borderColor:T?o.primary:"#E5E7EB",backgroundColor:T?`${o.primary}08`:"transparent",boxShadow:T?`0 0 0 3px ${o.primary}15`:"none"},children:[jsx("div",{className:"flex items-center pt-0.5",children:jsx("input",{type:"checkbox",checked:T,onChange:()=>A(D.id),className:"w-5 h-5 rounded border-2 border-gray-300 cursor-pointer",style:{accentColor:o.primary}})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-start justify-between gap-3 mb-1",children:[jsx("span",{className:"font-semibold text-base text-gray-900 group-hover:text-gray-700 transition-colors",children:D.name}),jsxs("span",{className:"text-base font-bold whitespace-nowrap flex-shrink-0",style:{color:o.primary},children:["+$",P]})]}),D.description&&jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:D.description})]})]},D.id)})}),l.length>0&&jsx("div",{className:"mt-6 pt-5 border-t-2 border-gray-100",children:jsxs("div",{className:"flex items-center justify-between px-2",children:[jsxs("div",{children:[jsx("div",{className:"text-xs text-gray-500 mb-1 font-medium uppercase tracking-wide",children:"New Total"}),jsxs("div",{className:"text-sm text-gray-600",children:["Service + ",l.length," add-on",l.length>1?"s":""]})]}),jsxs("div",{className:"text-3xl font-bold",style:{color:o.primary},children:["$",M()]})]})})]}),jsx(motion.h2,{...ge(.15),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:o.primary},children:p}),F&&jsx(motion.div,{...ge(.1),className:"bg-white rounded-lg border border-gray-200 px-4 py-3",children:jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 text-xs",children:[jsx("span",{className:"font-medium flex items-center",style:{color:o.primary},children:"Cycle Calendar:"}),jsx("div",{className:"flex items-center gap-3",children:Object.entries(ko).map(([D,T])=>jsxs("div",{className:"flex items-center space-x-1.5",children:[jsx("div",{className:"w-3 h-3 rounded border border-gray-300",style:{backgroundColor:T.bg}}),jsx("span",{children:T.label})]},D))})]})}),u==="month"?jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("button",{className:`p-2 rounded transition-colors ${S?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:R,disabled:!S,children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsxs("p",{className:"font-semibold",children:[h," ",y]}),jsx("button",{className:`p-2 rounded transition-colors ${I?"hover:bg-gray-100":"opacity-30 cursor-not-allowed"}`,onClick:m,disabled:!I,children:jsx(ChevronRight,{className:"w-4 h-4"})})]}),jsxs("div",{className:"grid grid-cols-7 gap-2",children:[["Su","Mo","Tu","We","Th","Fr","Sa"].map(D=>jsx("div",{className:"text-center text-xs font-medium py-2 opacity-60",children:D},D)),k.map((D,T)=>{if(!D)return jsx("div",{},`empty-${T}`);let{day:P,dateStr:z,isAvailable:K}=D,Y=t===z,Te=i?.[z],U=Te?ko[Te]:null;return jsx("button",{onClick:()=>K&&r(z),disabled:!K,className:`aspect-square rounded-lg text-sm transition-all ${Y?"text-white shadow-lg font-semibold":K?"hover:scale-105 cursor-pointer":"bg-gray-50 text-gray-300 cursor-not-allowed opacity-40"}`,style:{backgroundColor:Y?o.primary:U?.bg||void 0,color:Y?"white":U?.text||void 0},children:P},z)})]})]}):jsx("div",{className:"grid grid-cols-5 gap-3",children:b.slice(0,5).map(D=>{let T=new Date(D),P=T.getDate(),K=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][T.getDay()],Y=t===D;return jsxs("button",{onClick:()=>r(D),className:`p-4 rounded-lg border-2 transition-all text-center ${Y?"border-current text-white":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:Y?o.primary:void 0,backgroundColor:Y?o.primary:void 0},children:[jsx("p",{className:"text-xs mb-1 opacity-75",children:K}),jsx("p",{className:"text-2xl font-semibold",children:P})]},D)})})]})}function Hn({availableTimes:e,selectedTime:t,onTimeSelect:r,settings:a,serviceDuration:o,colors:i,selectedService:n,selectedDate:s,selectedAddons:l=[],addons:c=[]}){let d=a.timeFormat||"12h",u=a.showDuration!==false,p=a.headerContent?.value||"Pick a Time",g=a.columns||3,b=()=>{let x=n?.price||0;return l.length>0&&c.length>0&&l.forEach(y=>{let N=c.find(C=>C.id===y);N&&(x+=N.addonPrice||N.price||0);}),x},v=x=>new Date(x+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}),w=x=>{let y=x.trim().split(" "),[N,C]=y[0].split(":"),h=parseInt(N),k=C||"00";if(y.length>1){let S=y[1];return d==="24h"?(S==="PM"&&h!==12?h+=12:S==="AM"&&h===12&&(h=0),`${String(h).padStart(2,"0")}:${k}`):x}if(d==="12h"){let S=h>=12?"PM":"AM";return `${h===0?12:h>12?h-12:h}:${k} ${S}`}return `${String(h).padStart(2,"0")}:${k}`},f={2:"grid-cols-2",3:"grid-cols-2 sm:grid-cols-3",4:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-4"}[g]||"grid-cols-3";return jsxs("div",{className:"space-y-6",children:[n&&s&&jsxs(motion.div,{...ge(.05),className:"bg-gradient-to-br from-white to-gray-50/30 rounded-xl border border-gray-200/80 p-6 shadow-sm hover:shadow-md transition-shadow",children:[jsx("div",{className:"flex items-center gap-2 mb-4",children:jsx("h3",{className:"text-sm font-semibold tracking-wide uppercase",style:{color:i.primary},children:"Your Booking"})}),jsxs("div",{className:"mb-3",children:[jsx("p",{className:"font-bold text-lg text-gray-900",children:n.name}),n.duration&&jsxs("div",{className:"flex items-center gap-1.5 text-xs text-gray-500 mt-1",children:[jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),jsxs("span",{children:[n.duration," minutes"]})]})]}),l.length>0&&c.length>0&&jsxs("div",{className:"mb-4",children:[jsx("p",{className:"text-sm font-bold text-gray-900 mb-2",children:"Add-ons"}),jsx("div",{className:"space-y-2",children:l.map(x=>{let y=c.find(N=>N.id===x);return y?jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-sm text-gray-700 font-medium",children:y.name}),jsxs("span",{className:"text-sm font-semibold text-gray-900",children:["$",y.addonPrice||y.price||0]})]},x):null})})]}),jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsx("div",{className:"bg-gray-50/50 -mx-6 px-6 py-4 mb-4",children:jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("svg",{className:"w-5 h-5",style:{color:i.primary},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),jsx("span",{className:"font-bold text-base text-gray-900",children:v(s)})]})})}),jsx("div",{className:"border-t border-gray-200 -mx-6 mb-4"}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-base font-bold text-gray-900",children:"Total"}),jsxs("span",{className:"text-2xl font-bold",style:{color:i.primary},children:["$",b()]})]})]}),jsx(motion.h2,{...ge(n&&s?.15:.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:p}),jsx(motion.div,{className:`grid ${f} gap-3`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.3,delay:n&&s?.2:.1},children:e.map((x,y)=>{let N=t===x;return jsxs(motion.button,{onClick:()=>r(x),className:`p-3 rounded-lg border-2 transition-all text-center hover:scale-105 ${N?"border-current text-white shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:N?i.primary:void 0,backgroundColor:N?i.primary:void 0},initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.2,delay:.15+y*.03,ease:"easeOut"},children:[jsx("p",{className:"font-medium",children:w(x)}),u&&o&&jsxs("p",{className:"text-xs mt-1 opacity-75",children:[o," min"]})]},x)})})]})}function Wn({addons:e,selectedAddons:t,onAddonsChange:r,settings:a,colors:o}){let i=a.headerContent?.value||"Add Extras",n=a.subheaderContent?.value||"Enhance your experience with these optional add-ons",s=a.showPricing!==false,l=a.showDuration!==false,c=d=>{let u=t.includes(d)?t.filter(p=>p!==d):[...t,d];r(u);};return jsxs("div",{className:"space-y-4",children:[jsxs(motion.div,{...ge(.05),className:"text-center sm:text-left",children:[jsx("h2",{className:"text-xl sm:text-2xl font-bold mb-2",style:{color:o.primary},children:i}),jsx("p",{className:"text-sm opacity-70",children:n})]}),jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:e.map((d,u)=>{let p=t.includes(d.id);return jsxs(motion.button,{onClick:()=>c(d.id),className:`p-4 rounded-lg border-2 transition-all text-left relative ${p?"border-current shadow-lg":"border-gray-200 hover:border-gray-300"}`,style:{borderColor:p?o.primary:void 0,backgroundColor:p?`${o.primary}10`:void 0},initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1+u*.05},children:[p&&jsx("div",{className:"absolute top-3 right-3 w-6 h-6 rounded-full flex items-center justify-center text-white text-sm",style:{backgroundColor:o.primary},children:"\u2713"}),jsx("p",{className:"font-semibold mb-1 pr-8",children:d.name}),jsx("p",{className:"text-xs opacity-70 mb-3",children:d.description}),jsxs("div",{className:"flex justify-between items-center text-sm",children:[s&&jsxs("span",{className:"font-bold",style:{color:o.primary},children:["+$",d.price]}),l&&jsxs("span",{className:"opacity-60",children:["+",d.duration," min"]})]})]},d.id)})}),t.length>0&&jsxs(motion.div,{className:"bg-gray-50 rounded-lg p-4 mt-4",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},children:[jsx("p",{className:"text-sm font-medium mb-2",children:"Selected Add-ons:"}),jsx("div",{className:"space-y-1",children:t.map(d=>{let u=e.find(p=>p.id===d);return u?jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{children:u.name}),jsxs("span",{className:"font-medium",style:{color:o.primary},children:["+$",u.price]})]},d):null})})]})]})}function jn({isOpen:e,onClose:t,title:r,children:a,isRequired:o=false,maxHeight:i="80vh"}){return useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[e]),useEffect(()=>{if(!o&&e){let n=s=>{s.key==="Escape"&&t();};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)}},[e,o,t]),jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{...rr.backdrop,onClick:o?void 0:t,className:"fixed inset-0 bg-black/50 z-50",style:{backdropFilter:"blur(4px)"}}),jsxs(motion.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:rr.spring,className:"fixed bottom-0 left-0 right-0 bg-white rounded-t-2xl shadow-2xl z-50",style:{maxHeight:i},children:[jsx("div",{className:"flex justify-center pt-3 pb-2",children:jsx("div",{className:"w-12 h-1 bg-gray-300 rounded-full"})}),jsxs("div",{className:"flex items-center justify-between px-6 pb-4 border-b border-gray-200",children:[jsxs("div",{className:"flex items-center gap-2",children:[r&&jsx("h3",{className:"text-lg font-semibold",children:r}),o&&jsx("span",{className:"text-xs font-medium px-2 py-0.5 bg-amber-100 text-amber-800 rounded",children:"Required"})]}),!o&&jsx("button",{onClick:t,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors","aria-label":"Close",children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"overflow-y-auto",style:{maxHeight:`calc(${i} - 120px)`},children:jsx("div",{className:"px-6 py-6",children:a})})]})]})})}function Vn({contactInfo:e,onContactInfoChange:t,settings:r,optInModules:a=[],onOptInData:o,colors:i,isPreview:n=false}){let[s,l]=useState(false),[c,d]=useState(null),[u,p]=useState(()=>{let m={};return a.forEach(F=>{F.defaultChecked&&(m[F.id]=true);}),m}),[g,b]=useState({}),[v,w]=useState({}),f=useRef(false);useEffect(()=>{f.current||(f.current=true,a.forEach(m=>{m.defaultChecked&&m.renderCustomForm&&o&&m.renderCustomForm(()=>{},F=>o(m.id,F),i);}));},[]);let x=r.headerContent?.value||"Your Information",y=m=>m?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)?null:"Please enter a valid email address":"Email is required",N=m=>m?m.replace(/\D/g,"").length<10?"Please enter a valid phone number":null:"Phone number is required",C=m=>!m||m.trim().length===0?"Name is required":m.trim().length<2?"Name must be at least 2 characters":null,h=(m,F)=>{switch(m){case "email":return y(F);case "phone":return N(F);case "name":return C(F);default:return null}},k=[{label:"Name *",type:"text",placeholder:"Your full name",field:"name"},{label:"Email *",type:"email",placeholder:"your@email.com",field:"email"},{label:"Phone *",type:"tel",placeholder:"(555) 123-4567",field:"phone"},{label:"Notes (optional)",type:"textarea",placeholder:"Any special requests or notes...",field:"notes"}],S=(m,F)=>{if(t({...e,[m]:F}),!n&&v[m]){let M=h(m,F);b(A=>({...A,[m]:M||""}));}},I=m=>{if(n)return;w(A=>({...A,[m]:true}));let F=e[m]||"",M=h(m,F);b(A=>({...A,[m]:M||""}));},R=(m,F)=>{if(p(M=>({...M,[m.id]:F})),F){if(m.renderCustomForm){let M=false;if(m.renderCustomForm(()=>{},D=>{o&&o(m.id,D),M=true;},i)===null&&M)return}d(m),l(true);}else o&&o(m.id,null);};return jsxs(Fragment,{children:[jsxs("div",{className:"space-y-4",children:[jsx(motion.h2,{...ge(.05),className:"text-xl sm:text-2xl font-bold text-center sm:text-left",style:{color:i.primary},children:x}),jsxs("div",{className:"space-y-3",children:[k.map((m,F)=>jsxs(motion.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.3,delay:.1+F*.05,ease:"easeOut"},children:[jsx("label",{className:"block text-sm font-medium mb-1",children:m.label}),m.type==="textarea"?jsxs(Fragment,{children:[jsx("textarea",{className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent resize-none transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]}):jsxs(Fragment,{children:[jsx("input",{type:m.type,className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:border-transparent transition-all ${!n&&g[m.field]&&v[m.field]?"border-red-500":"border-gray-300"}`,style:{"--tw-ring-color":i.primary},placeholder:m.placeholder,value:e[m.field]||"",onChange:M=>S(m.field,M.target.value),onBlur:()=>I(m.field)}),!n&&g[m.field]&&v[m.field]&&jsx("p",{className:"text-red-500 text-xs mt-1",children:g[m.field]})]})]},m.label)),a.length>0&&jsx(motion.div,{className:"pt-3 border-t border-gray-200 space-y-3",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:a.map(m=>jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[jsx("input",{type:"checkbox",checked:u[m.id]||false,onChange:F=>R(m,F.target.checked),className:"mt-1 w-4 h-4 rounded border-gray-300",style:{accentColor:i.primary}}),jsxs("div",{children:[jsxs("span",{className:"text-sm font-medium",children:[m.label,m.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.description&&jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:m.description})]})]},m.id))})]})]}),c&&jsx(jn,{isOpen:s,onClose:()=>l(false),title:c.formTitle||"Additional Information",isRequired:c.required,children:c.renderCustomForm?c.renderCustomForm(()=>l(false),m=>{o&&o(c.id,m);},i):jsxs("div",{className:"space-y-4",children:[c.formFields?.map(m=>jsxs("div",{children:[jsxs("label",{className:"block text-sm font-medium mb-1",children:[m.label,m.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),m.type==="textarea"?jsx("textarea",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent resize-none",style:{"--tw-ring-color":i.primary},rows:3,placeholder:m.placeholder}):m.type==="select"&&m.options?jsx("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},children:m.options.map(F=>jsx("option",{value:F.value,children:F.label},F.value))}):jsx("input",{type:m.type,className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:border-transparent",style:{"--tw-ring-color":i.primary},placeholder:m.placeholder})]},m.id)),jsx("button",{onClick:()=>{o&&c&&o(c.id,{}),l(false);},className:"w-full py-3 rounded-lg text-white font-medium transition-all hover:opacity-90",style:{backgroundColor:i.primary},children:"Save & Continue"})]})})]})}function Yn({service:e,addons:t=[],selectedDate:r,selectedTime:a,paymentProvider:o,paymentConfig:i,onConfirm:n,colors:s,isPreview:l=false}){let c=e?.price||0,d=t.reduce((y,N)=>y+(N.addonPrice||N.price||0),0),u=c+d,p=e?.duration||0,g=t.reduce((y,N)=>y+(N.duration||0),0),b=p+g,v=i.depositPercentage||20,w=(u*(v/100)).toFixed(2),f=u.toFixed(2),x=(parseFloat(f)-parseFloat(w)).toFixed(2);return jsxs("div",{className:"space-y-4",children:[jsx(motion.h2,{...ge(.05),className:"text-xl font-bold text-center",style:{color:s.primary},children:"Confirm & Pay"}),jsx(motion.div,{className:"bg-gray-50 rounded-lg p-4",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1},children:jsxs("div",{className:"space-y-2",children:[e&&jsxs("div",{className:"flex justify-between items-center text-sm",children:[jsxs("div",{children:[jsx("p",{className:"font-medium",children:e.name}),jsxs("p",{className:"text-xs opacity-70",children:[b," min total"]})]}),jsxs("span",{className:"font-bold",style:{color:s.primary},children:["$",c]})]}),t.length>0&&jsx("div",{className:"space-y-1 text-xs",children:t.map(y=>jsxs("div",{className:"flex justify-between opacity-70",children:[jsxs("span",{children:["+ ",y.name]}),jsxs("span",{children:["+$",y.addonPrice||y.price||0]})]},y.id))}),r&&jsxs("div",{className:"flex justify-between items-center text-sm pt-2 border-t border-gray-200",children:[jsx("span",{className:"opacity-70",children:new Date(r+"T00:00:00").toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsx("span",{children:a})]}),jsxs("div",{className:"pt-2 mt-2 border-t border-gray-200 flex justify-between items-center",children:[jsx("span",{className:"text-sm font-medium",children:"Due Today"}),jsxs("span",{className:"text-lg font-bold",style:{color:s.primary},children:["$",w]})]})]})}),jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.2},children:l?jsxs("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:[jsxs("div",{className:"space-y-2",children:[jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsx("span",{className:"text-xs text-gray-400",children:"Card Number"})}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsx("span",{className:"text-xs text-gray-400",children:"MM/YY"})}),jsx("div",{className:"h-10 bg-gray-50 border border-gray-200 rounded flex items-center px-3",children:jsx("span",{className:"text-xs text-gray-400",children:"CVV"})})]})]}),jsxs("div",{className:"mt-3 flex items-center justify-center gap-1",children:[jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),jsxs("span",{className:"text-xs text-gray-400",children:["Powered by ",o==="square"?"Square":"Stripe"]})]})]}):jsx("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:jsxs("div",{className:"text-center py-8 text-sm text-gray-500",children:[jsxs("div",{className:"animate-pulse",children:["Initializing ",o==="square"?"Square":"Stripe"," payment..."]}),jsx("div",{className:"mt-4 text-xs text-gray-400",children:"Please wait while we securely load the payment form"})]})})}),jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3,delay:.3},children:jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxs("span",{className:"text-xs",children:["I agree to the ",jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"cancellation policy"})," and understand the $",x," balance is due at appointment."]})]}),jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",className:"mt-0.5 w-4 h-4 rounded border-gray-300",style:{accentColor:s.primary}}),jsxs("span",{className:"text-xs",children:["I agree to the ",jsx("a",{href:"#",className:"underline",style:{color:s.primary},children:"terms of service"}),"."]})]})]})})]})}var Io={avoid:{phase:"avoid",color:"#EF4444",bgColor:"#FEF2F2",label:"Avoid",icon:"\u{1F534}",description:"Period - avoid waxing"},caution:{phase:"caution",color:"#F59E0B",bgColor:"#FFFBEB",label:"Caution",icon:"\u{1F7E1}",description:"End of period - proceed with caution"},optimal:{phase:"optimal",color:"#10B981",bgColor:"#F0FDF4",label:"Optimal",icon:"\u{1F7E2}",description:"Best time for waxing"},neutral:{phase:"neutral",color:"#6B7280",bgColor:"#F9FAFB",label:"Neutral",icon:"\u26AA",description:"Okay but not optimal"},unknown:{phase:"unknown",color:"#9CA3AF",bgColor:"#F3F4F6",label:"Unknown",icon:"\u2753",description:"No cycle data available"}};function pi({availableDates:e,selectedDate:t,onDateSelect:r,settings:a,colors:o,fetchCycleData:i,selectedClient:n,onCycleWarning:s,cycleAwareEnabled:l}){let[c,d]=useState({}),[u,p]=useState(false),[g,b]=useState(null),v=useMemo(()=>l!==void 0?l:!!(n?.cycle_opt_in&&i),[l,n?.cycle_opt_in,i]);useEffect(()=>{if(!v||!i||!n){d({});return}e.length!==0&&(p(true),b(null),i(n,e).then(f=>{d(f);}).catch(f=>{console.error("[CycleAwareDateSelection] Error fetching cycle data:",f),b(f.message||"Failed to load cycle data"),d({});}).finally(()=>{p(false);}));},[v,i,n,e]);let w=useCallback(f=>{let x=c[f];x?.phase==="avoid"&&s&&s(x,f),r(f,x);},[c,r,s]);return jsxs("div",{className:"cycle-aware-date-selection space-y-4",children:[v&&Object.keys(c).length>0&&jsxs("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[jsxs("h4",{className:"font-medium mb-3 flex items-center",style:{color:o.primary},children:[jsx("span",{className:"mr-2",children:"\u{1F4C5}"}),"Your Cycle Calendar"]}),jsx("div",{className:"grid grid-cols-2 gap-3 text-sm",children:Object.entries(Io).map(([f,x])=>f!=="unknown"&&jsxs("div",{className:"flex items-center space-x-2",children:[jsx("div",{className:"w-3 h-3 rounded-full border border-gray-300",style:{backgroundColor:x.color}}),jsx("span",{children:x.label})]},f))}),jsx("p",{className:"text-xs opacity-70 mt-2",children:"Green dates are optimal for comfortable waxing appointments"})]}),v&&u&&jsx("div",{className:"text-center py-2 text-sm opacity-70",children:"Loading cycle predictions..."}),v&&g&&jsx("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3",children:jsxs("p",{className:"text-yellow-800 text-sm",children:["Unable to load cycle predictions: ",g]})}),jsx(nr,{availableDates:e,selectedDate:t,onDateSelect:w,settings:a,colors:o}),v&&t&&c[t]?.phase==="avoid"&&jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:jsxs("div",{className:"flex items-start space-x-3",children:[jsx("span",{className:"text-red-500 text-xl",children:"\u26A0\uFE0F"}),jsxs("div",{children:[jsx("h4",{className:"font-medium text-red-800 mb-1",children:"This date falls during your predicted period"}),jsx("p",{className:"text-red-700 text-sm mb-3",children:"Waxing during this time may be more uncomfortable than usual. Would you like to see better alternatives?"}),jsxs("div",{className:"flex space-x-2",children:[jsx("button",{className:"px-3 py-1 bg-red-100 text-red-700 rounded text-sm hover:bg-red-200 transition-colors",onClick:()=>{let f=e.filter(x=>c[x]?.phase==="optimal");f.length>0&&w(f[0]);},children:"Show optimal dates"}),jsx("button",{className:"px-3 py-1 text-red-600 text-sm hover:underline",children:"Continue anyway"})]})]})]})})]})}var gi={enabled:true,duration:6e5,warningThreshold:12e4,maxExtensions:2,extensionDuration:3e5,showActions:true,showWarning:true};function Tr({holdStatus:e,config:t,colors:r,onExtend:a,onRelease:o,onWarning:i,onExpired:n,className:s=""}){let[l,c]=useState(Date.now()),[d,u]=useState(false),[p,g]=useState(false),[b,v]=useState(false),w={...gi,...t};useEffect(()=>{if(!e)return;let F=setInterval(()=>{c(Date.now());},1e3);return ()=>clearInterval(F)},[e]);let f=e?Math.max(0,e.expiresAt-l):0,x=f===0&&e!==null,y=f<=w.warningThreshold&&f>0;useEffect(()=>{y&&!d&&i&&e&&(u(true),i(f));},[y,d,i,e,f]),useEffect(()=>{x&&e&&n&&n();},[x,e,n]),useEffect(()=>{u(false);},[e?.holdKey]);let N=useCallback(async()=>{if(!(!a||!e||p))try{g(!0),await a(),u(!1);}catch(F){console.error("[HoldTimer] Failed to extend hold:",F);}finally{g(false);}},[a,e,p]),C=useCallback(async()=>{if(!(!o||!e||b))try{v(!0),await o();}catch(F){console.error("[HoldTimer] Failed to release hold:",F);}finally{v(false);}},[o,e,b]);if(!e||!w.enabled)return null;let h=Math.floor(f/6e4),k=Math.floor(f%6e4/1e3),S=`${h}:${k.toString().padStart(2,"0")}`,I="rgba(139, 92, 246, 0.1)",R="rgba(139, 92, 246, 0.3)",m=r.primary;return x?(I="rgba(239, 68, 68, 0.1)",R="rgba(239, 68, 68, 0.3)",m="#EF4444"):y&&w.showWarning&&(I=`${r.secondary}1A`,R=`${r.secondary}4D`,m=r.secondary),jsx("div",{className:`rounded-lg p-4 text-center ${s}`,style:{backgroundColor:I,borderWidth:"1px",borderStyle:"solid",borderColor:R},children:jsxs("div",{className:"flex flex-col items-center justify-center",children:[jsx("div",{className:"flex flex-col items-center gap-2 mb-4",children:x?jsxs("div",{style:{color:m},className:"font-medium text-base",children:[jsx("span",{children:"Time expired - "}),jsx("button",{onClick:C,disabled:b,className:"underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 inline disabled:opacity-50",style:{color:m},children:b?"Releasing...":"select a new time"})]}):jsxs("div",{style:{color:m},className:"font-medium text-base",children:["Your time slot is reserved for ",S]})}),w.showActions&&!x&&jsxs("div",{className:"flex justify-center gap-2",children:[a&&e.canExtend&&jsxs("button",{onClick:N,disabled:!e.canExtend||p,className:"px-4 py-2 text-sm font-medium rounded transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed text-white",style:{backgroundColor:r.primary},"aria-label":`Extend hold (${e.maxExtensions-e.extensions} extensions remaining)`,children:[p?"Extending...":"Extend",!p&&e.maxExtensions-e.extensions>0&&jsxs("span",{className:"ml-1",children:["(",e.maxExtensions-e.extensions,")"]})]}),o&&jsx("button",{onClick:C,disabled:b,className:"px-4 py-2 text-sm font-medium rounded border transition-all active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",style:{borderColor:"rgba(255, 255, 255, 0.2)",color:r.text||"#000000"},"aria-label":"Release hold and return to time selection",children:b?"Releasing...":"Release"})]}),!x&&!e.canExtend&&e.extensions>=e.maxExtensions&&jsx("div",{className:"mt-3 pt-3 border-t border-white/10 text-center",children:jsxs("div",{className:"text-sm",style:{color:r.secondary},children:["Maximum extensions reached - complete booking now or"," ",jsx("button",{onClick:C,disabled:b,className:"hover:underline focus:outline-none focus:underline disabled:opacity-50",style:{color:r.primary},children:b?"releasing...":"select a different time"})]})})]})})}function Ro({config:e,colors:t,services:r=[],categories:a=[],dates:o=[],times:i=[],addons:n=[],paymentProvider:s,paymentConfig:l,isPreview:c=false,onComplete:d,onStepChange:u,onServiceSelect:p,onDateSelect:g,onContactInfoChange:b,validateStep:v,holdTimer:w,stepOrder:f,optInModules:x=[],onOptInData:y,customPaymentForm:N,cyclePhases:C}){let[h,k]=useState(0),[S,I]=useState("forward"),[R,m]=useState(null),[F,M]=useState(null),[A,D]=useState(null),[T,P]=useState([]),[z,K]=useState({}),[Y,Te]=useState({}),[U,ie]=useState(null),Xe=t.bookingText||t.text||"#000000",ot=e.transitions||{},ve=ot.style||"slide",At=ot.speed||"normal",je=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,fe=e.background||{type:"color",value:"#FFFFFF"},O={service:{id:"service",name:"Service",enabled:e.steps?.service_selection?.enabled!==false,settings:e.steps?.service_selection?.settings||{}},date:{id:"date",name:"Date",enabled:e.steps?.date_selection?.enabled!==false,settings:e.steps?.date_selection?.settings||{}},time:{id:"time",name:"Time",enabled:e.steps?.time_selection?.enabled!==false,settings:e.steps?.time_selection?.settings||{}},addons:{id:"addons",name:"Add-ons",enabled:e.steps?.addon_selection?.enabled===true,settings:e.steps?.addon_selection?.settings||{}},details:{id:"details",name:"Details",enabled:e.steps?.contact_form?.enabled!==false,settings:e.steps?.contact_form?.settings||{}},confirm:{id:"confirm",name:"Confirm",enabled:e.steps?.confirmation?.enabled===true,settings:e.steps?.confirmation?.settings||{}}},Ne=f||["service","date","time","addons","details","confirm"],J=Ne.map(E=>O[E]).filter(E=>E&&E.enabled);console.log("[BookingFlow] Step configuration:",{customStepOrder:f,orderedStepIds:Ne,allSteps:J.map(E=>E.id),currentStepIndex:h,currentStepId:J[h]?.id});let re=J[h],at=()=>fe.type==="gradient"?{background:fe.value}:fe.type==="image"?{backgroundImage:`url(${fe.value})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:fe.value},it=()=>{if(je)return .15;switch(At){case "fast":return .2;case "slow":return .5;default:return .3}},fr=()=>ve==="fade"?{enter:()=>({opacity:0,scale:.95}),center:{opacity:1,scale:1},exit:()=>({opacity:0,scale:.95})}:{enter:()=>({x:S==="forward"?50:-50,opacity:0}),center:{x:0,opacity:1},exit:()=>({x:S==="forward"?-50:50,opacity:0})},Kt=()=>{let E=re?.id;if(v)return v(E,{service:R,date:F,time:A,addons:T,contact:z});switch(E){case "service":return R!==null;case "date":return F!==null;case "time":return A!==null;case "details":if(c)return true;let W=z?.name&&z.name.trim().length>=2,_=z?.email&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z.email),ye=z?.phone&&z.phone.replace(/\D/g,"").length>=10;return W&&_&&ye;default:return true}},$t=E=>E<h,Ce=E=>{I(E>h?"forward":"backward"),k(E),u&&u(E,J[E]?.id);},bt=()=>{h<J.length-1&&Ce(h+1);},Lt=async()=>{if(h===0)return;let E=h-1;if(J[E]?.id==="time"&&U&&w?.releaseHold)try{await w.releaseHold(U.holdId),ie(null),D(null);}catch(_){console.error("[BookingFlow] Failed to release hold:",_);}Ce(E);},yr=async E=>{if(D(E),w?.enabled&&w.createHold&&F&&R)try{let W=r.find(ye=>ye.id===R),_=await w.createHold({date:F,time:E,serviceId:R,serviceDuration:W?.duration||60});ie(_);}catch(W){console.error("[BookingFlow] Failed to create hold:",W);return}bt();},br=()=>{ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);},Jt=async()=>{d&&d({service:R,date:F,time:A,addons:T,contact:z,optIn:Y});},Zr=()=>{if(!re)return null;let E={settings:re.settings,colors:t},W=r.find(_=>_.id===R);switch(re.id){case "service":return jsx(On,{...E,services:r,categories:a,selectedService:R,onServiceSelect:se=>{m(se),p&&p(se);}});case "date":return jsx(nr,{...E,availableDates:o,selectedDate:F,onDateSelect:se=>{M(se),g&&g(se);},cyclePhases:C,selectedService:W,addons:n,selectedAddons:T,onAddonsChange:P,addonPlacement:e.steps?.addon_selection?.settings?.placement||"date_selection"});case "time":return jsx(Hn,{...E,availableTimes:i,selectedTime:A,onTimeSelect:yr,serviceDuration:W?.duration||60,selectedService:W,selectedDate:F,selectedAddons:T,addons:n});case "addons":return jsx(Wn,{...E,addons:n,selectedAddons:T,onAddonsChange:P});case "details":return jsx(Vn,{...E,contactInfo:z,onContactInfoChange:se=>{K(se),b&&b(se);},optInModules:x,onOptInData:y});case "confirm":let _=n.filter(se=>T.includes(se.id)),ye=_.reduce((se,Pe)=>se+(Pe.addonPrice||Pe.price||0),0),hr=(W?.price||0)+ye,xr=_.reduce((se,Pe)=>Pe.affectsDuration&&Pe.additionalDuration?se+Pe.additionalDuration:se,W?.duration||60);return N?jsx(N,{bookingData:{service:R,serviceName:W?.name,date:F,time:A,addons:T,contact:z,amount:W?.price||0,duration:xr,clientName:z?.name,clientEmail:z?.email,clientPhone:z?.phone,pendingBooking:{customerClientId:null,serviceId:R,date:F,time:A,notes:z?.notes||"",selectedAddons:_,addonServices:T,addonTotalCost:ye,totalAmount:hr,duration:xr}},onPaymentSuccess:Jt,onPaymentError:Pe=>{console.error("[BookingFlow] Payment error:",Pe);}}):jsx(Yn,{...E,service:W,addons:_,selectedDate:F||"",selectedTime:A||"",paymentProvider:s||"square",paymentConfig:l||{depositPercentage:20},isPreview:c,onConfirm:Jt});default:return null}},st=()=>{let E=e.progressBar?.style||"dots";return E==="bar"?jsxs("div",{className:"mb-6",children:[jsxs("div",{className:"flex justify-between items-center mb-2",children:[jsxs("span",{className:"text-sm font-medium",children:["Step ",h+1," of ",J.length]}),jsx("span",{className:"text-xs opacity-60",children:re?.name})]}),jsx("div",{className:"w-full h-2 bg-gray-200 rounded-full overflow-hidden",children:jsx(motion.div,{className:"h-full rounded-full",style:{backgroundColor:t.primary},initial:{width:0},animate:{width:`${(h+1)/J.length*100}%`},transition:{duration:.3,ease:"easeOut"}})})]}):E==="minimal"?jsxs("div",{className:"mb-6 text-center",children:[jsx("p",{className:"text-sm font-medium",style:{color:t.primary},children:re?.name}),jsxs("p",{className:"text-xs opacity-60 mt-1",children:["Step ",h+1," of ",J.length]})]}):jsx("div",{className:"flex justify-center mb-4 overflow-x-auto py-2",children:jsx("div",{className:"flex items-center space-x-1.5 px-4 min-w-max",children:J.map((W,_)=>jsxs("div",{className:"flex items-center",children:[jsx(motion.div,{className:`w-6 h-6 rounded-full flex items-center justify-center font-medium text-xs transition-all flex-shrink-0 ${_===h?"text-white shadow-md":$t(_)?"text-white":"bg-gray-200 text-gray-500"}`,style:{backgroundColor:_<=h?t.primary:void 0},animate:{scale:_===h?1.05:1},transition:{duration:.2},children:$t(_)?"\u2713":_+1}),_<J.length-1&&jsx(motion.div,{className:`w-4 h-0.5 mx-1 transition-all flex-shrink-0 ${_<h?"":"bg-gray-200"}`,style:{backgroundColor:_<h?t.primary:void 0},initial:{scaleX:0},animate:{scaleX:1},transition:{duration:.3,delay:.1}})]},W.id))})})};return jsxs("div",{className:"w-full max-w-4xl mx-auto p-6 rounded-2xl shadow-xl",style:{...at(),color:Xe},children:[st(),w?.enabled&&U&&re?.id!=="time"&&jsx(Tr,{holdStatus:U,config:w.config,colors:t,onExtend:async()=>{if(w.extendHold&&U)try{let E=await w.extendHold(U.holdId);ie(E);}catch(E){console.error("[BookingFlow] Failed to extend hold:",E);}},onRelease:async()=>{if(w.releaseHold&&U)try{await w.releaseHold(U.holdId),ie(null),D(null);let E=J.findIndex(W=>W.id==="time");E>=0&&Ce(E);}catch(E){console.error("[BookingFlow] Failed to release hold:",E);}},onExpired:br,className:"mb-6"}),jsx("div",{className:"mb-6 min-h-[300px] relative overflow-hidden",children:jsx(AnimatePresence,{mode:"wait",custom:S,children:jsx(motion.div,{custom:S,variants:fr(),initial:"enter",animate:"center",exit:"exit",transition:{duration:it(),ease:[.4,0,.2,1]},children:Zr()},h)})}),!(re?.id==="confirm"&&N)&&jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-200",children:[jsx("button",{onClick:Lt,disabled:h===0,className:"px-4 py-2 rounded-lg border border-gray-300 disabled:opacity-30 disabled:cursor-not-allowed hover:bg-gray-50 transition-all text-sm font-medium",children:"Back"}),h<J.length-1?jsx("button",{onClick:bt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:"Next"}):jsx("button",{onClick:Jt,disabled:!Kt(),className:"px-6 py-2 rounded-lg text-white disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90 transition-all text-sm font-medium shadow-md",style:{backgroundColor:t.primary},children:re?.id==="confirm"?"Pay & Confirm":"Complete"})]})]})}function yi({section:e,theme:t,BookingFlowComponent:r,config:a,enableInlineEditing:o=false}){let{type:i,settings:n}=e,s=e.id;i==="video_section"&&console.log("\u{1F3AC} Rendering video_section:",{type:i,settings:n,sectionId:s});let l=t?.colors||{primary:"#BCB4FF",secondary:"#CAC426",text:"#000000"},c=t?.typography||{headingFont:"Geist Sans",bodyFont:"Inter",bodySize:"16px"};switch(i){case "logo":return jsx(tn,{logoUrl:n.logoUrl,fallbackText:n.fallbackText,size:n.size,alignment:n.alignment,colors:l,enableInlineEditing:o,sectionId:s});case "header":return jsx(nn,{name:n.name,title:n.title,bio:n.bio,showName:n.showName,showTitle:n.showTitle,showBio:n.showBio,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "featured_link":return jsx(on,{text:n.text,url:n.url,style:n.style,size:n.size,colors:l,enableInlineEditing:o,sectionId:s});case "link_list":return jsx(sn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "social_bar":return jsx(ln,{platforms:n.platforms||[],socialLinks:n.socialLinks,style:n.style,size:n.size,position:n.position,invertIcons:n.invertIcons,colors:l,enableInlineEditing:o,sectionId:s});case "instagram_feed":return jsx(Fn,{username:n.username,colors:l,enableInlineEditing:o,sectionId:s});case "minimal_header":return jsx(bn,{brandName:n.brandName,logoUrl:n.logoUrl,style:n.style,alignment:n.alignment,sticky:n.sticky,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_navigation":return jsx(xn,{links:n.links||[],style:n.style,colors:l,enableInlineEditing:o,sectionId:s});case "feature_content":return jsx(wn,{headline:n.headline,description:n.description,image:n.image,buttonText:n.buttonText,buttonUrl:n.buttonUrl,showButton:n.showButton,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "minimal_footer":return jsx(vn,{alignment:n.alignment,showSocial:n.showSocial,showContact:n.showContact,showLinks:n.showLinks,footerText:n.footerText,colors:l,enableInlineEditing:o,sectionId:s});case "hero":return jsx(cn,{headline:n.headline,subheadline:n.subheadline,heroImage:n.heroImage,ctaButton:n.ctaButton,layout:n.layout,imagePosition:n.imagePosition,contentDisplay:n.contentDisplay,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "about":return jsx(dn,{title:n.title,content:n.content,image:n.image,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "services_preview":return jsx(un,{title:n.title,services:n.services,layout:n.layout,columns:n.columns,showPrices:n.showPrices,showDuration:n.showDuration,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "gallery":return jsx(mn,{title:n.title,images:n.images||[],columns:n.columns,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "testimonials":return jsx(gn,{title:n.title,testimonials:n.testimonials,layout:n.layout,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "team":return jsx(fn,{title:n.title,members:n.members,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "contact":return jsx(yn,{title:n.title,showForm:n.showForm,email:n.email,phone:n.phone,address:n.address,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "before_after":return jsx(Cn,{title:n.title,comparisons:n.comparisons,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "pricing_table":return jsx(Sn,{title:n.title,plans:n.plans,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "booking":return jsx(En,{config:a||{},colors:l,BookingFlowComponent:r,enableInlineEditing:o,sectionId:s});case "fixed_info_card":return jsx(In,{name:n.name,subheading:n.subheading,bio:n.bio,links:n.links||[],bookingButtonText:n.bookingButtonText,bookingButtonUrl:n.bookingButtonUrl,showBookingButton:n.showBookingButton,position:n.position,cardWidth:n.cardWidth,cardColor:n.cardColor,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "video_section":return jsx(Rn,{videoUrl:n.videoUrl,aspectRatio:n.aspectRatio,autoplay:n.autoplay,loop:n.loop,muted:n.muted,controls:n.controls,allowFullScreen:n.allowFullScreen,coverImage:n.coverImage,maxWidth:n.maxWidth,alignment:n.alignment,borderRadius:n.borderRadius,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "scrolling_text_divider":return jsx(Pn,{text:n.text,scrollDirection:n.scrollDirection,scrollSpeed:n.scrollSpeed,orientation:n.orientation,dividerIcon:n.dividerIcon,customIcon:n.customIcon,textSize:n.textSize,textColor:n.textColor,fontWeight:n.fontWeight,backgroundColor:n.backgroundColor,backgroundGradient:n.backgroundGradient,pauseOnHover:n.pauseOnHover,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "location_map":return jsx(An,{address:n.address,displayType:n.displayType,mapHeight:n.mapHeight,mapStyle:n.mapStyle,zoom:n.zoom,showMarker:n.showMarker,borderRadius:n.borderRadius,directionsButtonText:n.directionsButtonText,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "image_section":return jsx(Mn,{imageUrl:n.imageUrl,altText:n.altText,caption:n.caption,maxWidth:n.maxWidth,alignment:n.alignment,aspectRatio:n.aspectRatio,borderRadius:n.borderRadius,linkUrl:n.linkUrl,openInNewTab:n.openInNewTab,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "faq_section":return jsx($n,{title:n.title,faqs:n.faqs,layout:n.layout,maxWidth:n.maxWidth,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "navbar":return jsx(Bn,{brandName:n.brandName,logoUrl:n.logoUrl,showLogo:n.showLogo,showBrandName:n.showBrandName,links:n.links,ctaText:n.ctaText,ctaUrl:n.ctaUrl,sticky:n.sticky,transparentOnTop:n.transparentOnTop,colors:l,typography:c,enableInlineEditing:o,sectionId:s});case "text_section":return jsx(zn,{title:n.title,content:n.content,alignment:n.alignment,maxWidth:n.maxWidth,textSize:n.textSize,backgroundColor:n.backgroundColor,textColor:n.textColor,paddingY:n.paddingY,colors:l,typography:c,enableInlineEditing:o,sectionId:s});default:return jsx("div",{className:"container mx-auto px-4 py-16",children:jsx("div",{className:"max-w-4xl mx-auto p-8 rounded-lg border-2 border-dashed text-center",style:{borderColor:l.primary,opacity:.5},children:jsxs("p",{className:"text-lg",style:{color:l.text},children:["Unknown section type: ",i]})})})}}var Xn=null;function xi(){if(!Xn){let e=import.meta,t=e.env?.VITE_SUPABASE_URL||process.env.NEXT_PUBLIC_SUPABASE_URL,r=e.env?.VITE_SUPABASE_ANON_KEY||process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!t||!r)throw new Error("Supabase URL and Anon Key must be provided");Xn=createClient(t,r);}return Xn}var nt={bucket:"form-uploads",limits:{maxSize:5*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp","image/jpg"]}};async function To(e,t,r){if(console.log("\u{1F4E6} uploadFormImage called:",{fileName:e.name,clientId:t,formId:r}),e.size>nt.limits.maxSize)throw new Error(`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`);if(!nt.limits.allowedTypes.includes(e.type))throw new Error(`File type ${e.type} not allowed. Accepted types: JPG, PNG, WebP`);console.log("\u{1F3A8} Starting image optimization...");let a=await vi(e);console.log("\u2705 Image optimized:",{originalSize:e.size,optimizedSize:a.size});let o=Date.now();e.name.split(".").pop()?.toLowerCase()||"jpg";let n=e.name.replace(/[^a-zA-Z0-9.-]/g,"_").substring(0,50),s=`${o}_${n}`,l=`${t}/${r}/${s}`;console.log("\u2601\uFE0F Uploading to Supabase:",{filePath:l,bucket:nt.bucket});let c=xi(),{data:d,error:u}=await c.storage.from(nt.bucket).upload(l,a,{cacheControl:"3600",upsert:false,contentType:a.type});if(console.log("\u{1F4E4} Upload result:",{data:d,error:u}),u)throw console.error("\u274C Supabase upload error:",u),new Error(`Upload failed: ${u.message}`);console.log("\u2705 Upload successful, getting public URL...");let{data:{publicUrl:p}}=c.storage.from(nt.bucket).getPublicUrl(l);return console.log("\u2705 Public URL obtained:",p),{url:p,path:l,filename:e.name,size:a.size,type:a.type}}async function vi(e,t=1920,r=.85){console.log("\u{1F5BC}\uFE0F optimizeImage: Starting optimization");let a=e.type==="image/png"||e.type==="image/webp",o=a?e.type:"image/jpeg";return console.log("\u{1F5BC}\uFE0F optimizeImage: Output type:",o,"Transparency:",a),new Promise((i,n)=>{let s=setTimeout(()=>{console.error("\u23F1\uFE0F optimizeImage: Timeout after 30 seconds"),n(new Error("Image optimization timed out"));},3e4),l=new Image,c=document.createElement("canvas"),d=c.getContext("2d",{alpha:a});if(!d){clearTimeout(s),console.error("\u274C optimizeImage: Canvas context not available"),n(new Error("Canvas context not available"));return}console.log("\u{1F5BC}\uFE0F optimizeImage: Created canvas and context"),l.onload=()=>{console.log("\u{1F5BC}\uFE0F optimizeImage: Image loaded",{width:l.width,height:l.height});try{let u=Math.min(t/l.width,1);c.width=l.width*u,c.height=l.height*u,console.log("\u{1F5BC}\uFE0F optimizeImage: Resizing to",{width:c.width,height:c.height}),a&&d.clearRect(0,0,c.width,c.height),d.drawImage(l,0,0,c.width,c.height),console.log("\u{1F5BC}\uFE0F optimizeImage: Image drawn, converting to blob..."),c.toBlob(p=>{if(clearTimeout(s),!p){console.error("\u274C optimizeImage: Blob conversion failed"),n(new Error("Image optimization failed"));return}console.log("\u2705 optimizeImage: Blob created",{size:p.size,type:o});let g=new File([p],e.name,{type:o,lastModified:Date.now()});console.log("\u2705 optimizeImage: Optimization complete"),i(g);},o,r);}catch(u){clearTimeout(s),console.error("\u274C optimizeImage: Error during processing",u),n(u);}},l.onerror=u=>{clearTimeout(s),console.error("\u274C optimizeImage: Failed to load image",u),n(new Error("Failed to load image"));},console.log("\u{1F5BC}\uFE0F optimizeImage: Creating object URL and loading image..."),l.src=URL.createObjectURL(e);})}function Po(e){return e.size>nt.limits.maxSize?{valid:false,error:`File size exceeds maximum of ${nt.limits.maxSize/1024/1024}MB`}:nt.limits.allowedTypes.includes(e.type)?{valid:true}:{valid:false,error:"File type not allowed. Accepted: JPG, PNG, WebP"}}function Ar({field:e,value:t,error:r,onChange:a,businessId:o,formId:i,styling:n}){let s=useRef(null),[l,c]=useState(false),[d,u]=useState(null),p=n?.labelColor||"#374151",g=n?.fieldStyle||"outlined",v=(()=>{let f="w-full px-4 py-2 transition-all focus:outline-none";if(r)return `${f} bg-red-50 border border-red-300 rounded-lg focus:ring-2 focus:ring-red-500`;switch(g){case "filled":return `${f} bg-gray-100 border border-transparent rounded-lg focus:bg-white focus:ring-2 focus:ring-gray-900 focus:border-transparent`;case "underlined":return `${f} bg-transparent border-0 border-b-2 border-gray-300 rounded-none focus:border-gray-900 focus:ring-0 px-0`;case "minimal":return `${f} bg-transparent border border-gray-200 rounded-lg focus:border-gray-400 focus:ring-1 focus:ring-gray-300`;case "outlined":default:return `${f} bg-white border-2 border-gray-300 rounded-lg focus:border-gray-900 focus:ring-2 focus:ring-gray-900`}})(),w="block text-sm font-medium mb-1";if(e.type==="text"||e.type==="email"||e.type==="tel")return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("input",{type:e.type,id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,className:v,style:{color:p}}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="textarea")return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("textarea",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),placeholder:e.placeholder,required:e.required,rows:4,className:v,style:{color:p}}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="date")return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("input",{type:"date",id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p}}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="select"&&e.options)return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxs("select",{id:e.id,name:e.id,value:t||"",onChange:f=>a(f.target.value),required:e.required,className:v,style:{color:p},children:[jsx("option",{value:"",children:"Select an option..."}),e.options.map(f=>jsx("option",{value:f.value,children:f.label},f.value))]}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="radio"&&e.options)return jsxs("div",{children:[jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("div",{className:"space-y-2 mt-2",children:e.options.map(f=>jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsx("input",{type:"radio",name:e.id,value:f.value,checked:t===f.value,onChange:x=>a(x.target.value),required:e.required,className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2"}),jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:f.label})]},f.value))}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]});if(e.type==="checkbox"&&e.options){let f=Array.isArray(t)?t:[],x=y=>{let N=f.includes(y)?f.filter(C=>C!==y):[...f,y];a(N);};return jsxs("div",{children:[jsxs("label",{className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsx("div",{className:"space-y-2 mt-2",children:e.options.map(y=>jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[jsx("input",{type:"checkbox",name:`${e.id}[]`,value:y.value,checked:f.includes(y.value),onChange:()=>x(y.value),className:"w-4 h-4 text-gray-900 focus:ring-gray-900 focus:ring-2 rounded"}),jsx("span",{className:"text-sm",style:{color:n?.labelColor||"#000000"},children:y.label})]},y.value))}),r&&jsx("p",{className:"mt-1 text-xs text-red-600",children:r})]})}if(e.type==="photo"){let f=async x=>{let y=x.target.files?.[0];if(!y)return;u(null);let N=Po(y);if(!N.valid){u(N.error||"Invalid file"),s.current&&(s.current.value="");return}if(!o||!i){u("Missing required configuration for file upload"),s.current&&(s.current.value="");return}c(true);try{let C=await To(y,o,i);a({url:C.url,filename:C.filename,size:C.size,type:C.type,uploadedAt:new Date().toISOString()}),u(null);}catch(C){console.error("Photo upload error:",C),u(C instanceof Error?C.message:"Upload failed"),s.current&&(s.current.value="");}finally{c(false);}};return jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:w,style:{color:p},children:[e.label,e.required&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),jsxs("div",{className:"mt-1",children:[jsx("input",{ref:s,type:"file",id:e.id,name:e.id,accept:"image/*",onChange:f,required:e.required,disabled:l,className:`block w-full text-sm text-gray-500
11
11
  file:mr-4 file:py-2 file:px-4
12
12
  file:rounded-lg file:border-0
13
13
  file:text-sm file:font-medium