your-ai-workflow-firebase-os 1.8.0 → 1.11.1

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/README.md CHANGED
@@ -33,8 +33,9 @@ That's it. **One component. Zero configuration files.**
33
33
  | 📁 **File Storage** | An admin-only Assets screen for public images, plus a drive preset any page can be built on |
34
34
  | 📬 **Forms** | Created with their pages on `/pages` — say what a form should ask and the AI builds it with the page; see and hand-edit every form afterwards on `/forms`. Questions can ask for a file — a CV, a photo, a receipt — and the upload works signed out |
35
35
  | 📥 **Inbox** | Every form entry in one list at `/inbox`, filtered "From anyone" or "From signed-in users"; an attached file opens from the entry by its own name |
36
- | 💳 **Payments** | Stripe checkout in one line — the owner describes what they sell on `/payments`, picks the pages that sell it (or creates one on the spot), says what should happen on each, and pastes ONE generated prompt; the assistant builds those pages with `<PayButton>` for one-off payments and subscriptions, asking any before-paying questions through the app's own forms. The same card can hand the owner's TEAM an internal sales page — built around `useSales()`, who paid for what and when, live from Stripe. A Go live switch walks the test→live change (live price ids collected, test ids kept, and the id-swap prompt for the assistant generated), buyers get a built-in `/billing` page that appears after their first purchase, and every cancel/switch/invoice screen is Stripe's own billing portal |
37
- | ✉️ **Email** | Resend in one line — `emailOwner()` and `emailPerson()` send from a closed set of templates (never an address a page typed), receipts and sale alerts send themselves off a Pay button's settings, and `/email` shows what the app can send and where owner mail goes |
36
+ | 💳 **Payments** | Stripe checkout in one line — the owner configures what they sell under What you sell on `/payments` (a price and a name, or plans and their Stripe ids), then answers How your payments work: how the payment works, what a buyer says first, what happens after. Pages are wired on `/pages`: a page ticks the payment under Payments on this page and says what should happen there — public and signed-in pages sell with `<PayButton>`, internal and admin pages show the team the sales through `useSales()`, and a page linked to either asks the same question from its side. The page's own sentence builds it, asking any before-paying questions through the app's own forms. A Go live switch walks the test→live change (live price ids collected, test ids kept, and the id-swap prompt for the assistant generated), buyers get a built-in `/billing` page that appears after their first purchase, and every cancel/switch/invoice screen is Stripe's own billing portal |
37
+ | 📅 **Schedule** | Bookings in one form question — on `/schedule` each team member sets their bookable hours in their own time zone (days, from–to, how long a booking lasts, how far ahead, how much notice); the owner attaches it on `/pages` under Booking on this page or as a Pick-a-time question on `/forms`, and the page's own sentence asks the assistant for ONE `schedule` field in a `*Form.config.ts`. The built-in form draws the picker — a full calendar or a compact day-and-time list — in every visitor's own time zone, claims the time so two people can never take the same minute, saves the booking as a form entry in the Inbox (one readable line, with the time on the owner's own clock under it), and lists it on `/schedule` where it can be cancelled; a team page reads them with `useBookings()`. The assistant never builds a calendar, a time picker or a bookings collection |
38
+ | ✉️ **Email** | Resend in one line — every page can send email once it is connected: `emailOwner()` tells the owner what happened, `emailPerson()` confirms to the person a record names, `emailAnyone()` lets a team page write to any address (a signed-in admin or team member only), receipts and sale alerts send themselves off a Pay button's settings, and `/email` says what the app can do with email and where owner mail goes |
38
39
  | 📖 **Guide** | A walkthrough at `/guide` with the sentences to paste into your assistant |
39
40
  | 📊 **Dashboard** | Personalised user dashboard |
40
41
 
@@ -0,0 +1 @@
1
+ const e=require(`./chunk-DYteiM-1.cjs`),t=require(`./TimeZoneField-DgZkxTbz.cjs`);let n=require(`react`);n=e.i(n,1);let r=require(`firebase/firestore`),i=require(`react/jsx-runtime`),a=require(`react-router-dom`),o=require(`react-dom`);var s=e.n({contactFormConfig:()=>c}),c={systemName:`contact`,formType:`public`,redirectTo:`/`,title:`Get in Touch`,buttonName:`Contact Us`,submitText:`Send Message`,fields:[{name:`name`,type:`text`,label:`Full Name`,placeholder:`John Doe`,required:!0},{name:`email`,type:`email`,label:`Email Address`,placeholder:`john@example.com`,required:!0},{name:`phone`,type:`tel`,label:`Phone Number`,placeholder:`+1 (555) 000-0000`,required:!1},{name:`questions`,type:`textarea`,label:`Your Questions`,placeholder:`How can we help you?`,required:!0}]},l=e.n({supportFormConfig:()=>u}),u={systemName:`support`,formType:`private`,redirectTo:`/dashboard`,title:`Request Assistance`,buttonName:`Get Assistance`,submitText:`Submit Request`,fields:[{name:`topic`,type:`text`,label:`Topic`,placeholder:`E.g. Password reset issue`,required:!0},{name:`contactEmail`,type:`email`,label:`Contact Email`,placeholder:`your@email.com`,required:!0},{name:`description`,type:`textarea`,label:`Description`,placeholder:`Please describe your issue in detail...`,required:!0}]};function d(e,t){if(typeof t!=`object`||!t)return t;let n={...e};for(let r of Object.keys(t))t[r]instanceof Object&&r in e&&e[r]instanceof Object&&!Array.isArray(t[r])?n[r]=d(e[r],t[r]):n[r]=t[r];return n}var f=typeof window<`u`?n.useLayoutEffect:n.useEffect,p=(0,n.createContext)(void 0);function m({children:e,scopeSelector:a}){let o=t.Qn(),s=(0,n.useMemo)(()=>o?.themeConfig||t.rr,[o?.themeConfig]),[c,l]=(0,n.useState)(()=>{if(typeof window>`u`)return s.defaultTheme||`system`;let e=localStorage.getItem(`theme-mode`),t=localStorage.getItem(`last-seen-default-theme`);return s.defaultTheme&&s.defaultTheme!==t?(localStorage.setItem(`last-seen-default-theme`,s.defaultTheme),localStorage.removeItem(`theme-mode`),s.defaultTheme):e||s.defaultTheme||`system`}),[u,m]=(0,n.useState)(()=>{if(typeof window>`u`)return s.defaultTheme===`light`?`light`:`dark`;let e=localStorage.getItem(`theme-mode`),t=localStorage.getItem(`last-seen-default-theme`),n=e||s.defaultTheme||`system`;return s.defaultTheme&&s.defaultTheme!==t&&(n=s.defaultTheme),n===`system`?window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`:n}),[h,g]=(0,n.useState)(()=>{try{let e=localStorage.getItem(`theme_config_cache`);if(e)return JSON.parse(e)}catch{}return s}),[_,v]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{if(!localStorage.getItem(`theme_config_cache`)){g(s);let e=localStorage.getItem(`last-seen-default-theme`);s.defaultTheme&&s.defaultTheme!==e&&(localStorage.setItem(`last-seen-default-theme`,s.defaultTheme),localStorage.removeItem(`theme-mode`),l(s.defaultTheme))}},[s]),(0,n.useEffect)(()=>{if(!t.er){g(s);return}let e=(0,r.onSnapshot)((0,r.doc)(t.er,`sys_configs`,`theme`),e=>{if(e.exists()){let t=e.data();delete t.fontStyles,delete t.fontCustomization,delete t.fontFamily;let n=d(s,t);g(n),localStorage.setItem(`theme_config_cache`,JSON.stringify(n));let r=localStorage.getItem(`last-seen-default-theme`);n.defaultTheme&&n.defaultTheme!==r&&(localStorage.setItem(`last-seen-default-theme`,n.defaultTheme),l(n.defaultTheme))}else g(s),localStorage.removeItem(`theme_config_cache`),localStorage.removeItem(`theme-mode`),s.defaultTheme&&(localStorage.setItem(`last-seen-default-theme`,s.defaultTheme),l(s.defaultTheme))});return()=>e()},[s]),(0,n.useEffect)(()=>{let e=e=>{c===`system`&&m(e.matches?`light`:`dark`)},t=window.matchMedia(`(prefers-color-scheme: light)`);return c===`system`?(m(t.matches?`light`:`dark`),t.addEventListener(`change`,e)):m(c),()=>t.removeEventListener(`change`,e)},[c]),f(()=>{let e=(a?document.querySelector(a):document.documentElement)||document.documentElement,t=u===`dark`?h.colors.dark:h.colors.light;e.style.setProperty(`--bg-color`,t.background),e.style.setProperty(`--bg-secondary-color`,t.backgroundSecondary||t.background),e.style.setProperty(`--fg-color`,t.foreground),e.style.setProperty(`--accent-color`,t.accent);let n=u===`dark`;e.style.setProperty(`--panel-bg`,t.panelBg||`color-mix(in srgb, ${t.accent} ${n?`5%`:`4%`}, transparent)`),e.style.setProperty(`--panel-border`,t.panelBorder||`color-mix(in srgb, ${t.accent} 15%, transparent)`);let r=(e,t)=>!e||e.length===0?t||`transparent`:e.length===1?e[0]:`linear-gradient(135deg, ${e.map((t,n)=>`${t} ${Math.round(n/(e.length-1)*100)}%`).join(`, `)})`,i=`linear-gradient(135deg, color-mix(in oklab, ${t.accent} ${n?`70%`:`78%`}, black) 0%, ${t.accent} 100%)`,o=`linear-gradient(135deg, color-mix(in oklab, ${t.accent} ${n?`80%`:`85%`}, black) 0%, color-mix(in oklab, ${t.accent} 72%, white) 100%)`;e.style.setProperty(`--button-bg`,r(t.buttonGradient,i)),e.style.setProperty(`--button-fg`,t.buttonText||`#ffffff`),e.style.setProperty(`--button-hover-bg`,r(t.buttonHoverGradient||t.buttonGradient,o)),e.style.setProperty(`--text-gradient`,r(t.textGradient,`linear-gradient(135deg, ${t.foreground} 0%, ${t.accent} 100%)`)),e.style.setProperty(`--glow-color`,t.glowColor||`color-mix(in srgb, ${t.accent} ${n?`40%`:`30%`}, transparent)`),e.style.setProperty(`--notification-icon-color`,t.notificationIconColor||t.accent);let s=t.secondaryButton?.bg||(u===`dark`?`rgba(255, 255, 255, 0.05)`:`rgba(0, 0, 0, 0.03)`),l=t.secondaryButton?.border||(u===`dark`?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.06)`),d=t.secondaryButton?.text||t.foreground;if(e.style.setProperty(`--btn-sec-bg`,s),e.style.setProperty(`--btn-sec-border`,l),e.style.setProperty(`--btn-sec-text`,d),e.style.setProperty(`--selection-bg`,t.selectionBg||`color-mix(in srgb, var(--accent-color) 40%, transparent)`),e.style.setProperty(`--selection-text`,t.selectionText||`#ffffff`),e.setAttribute(`data-theme`,u),localStorage.setItem(`theme-mode`,c),h.cornerRounding===`custom`&&h.cornerRadii?(e.style.setProperty(`--btn-radius`,`${parseFloat(String(h.cornerRadii.buttonRadius))||0}rem`),e.style.setProperty(`--card-radius`,`${parseFloat(String(h.cornerRadii.cardRadius))||0}rem`),e.style.setProperty(`--input-radius`,`${parseFloat(String(h.cornerRadii.inputRadius))||0}rem`),e.style.setProperty(`--modal-radius`,`${parseFloat(String(h.cornerRadii.modalRadius))||0}rem`)):(e.style.setProperty(`--btn-radius`,`0.75rem`),e.style.setProperty(`--card-radius`,`1.5rem`),e.style.setProperty(`--input-radius`,`0.75rem`),e.style.setProperty(`--modal-radius`,`1.5rem`)),!document.getElementById(`inter-font`)){let e=document.createElement(`link`);e.id=`inter-font`,e.rel=`stylesheet`,e.href=`https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap`,document.head.appendChild(e)}e.style.fontSize=`16px`,e.style.setProperty(`--weight-h1`,`800`),e.style.setProperty(`--weight-h2`,`700`),e.style.setProperty(`--weight-h3`,`700`),e.style.setProperty(`--leading-normal`,`1.5`);let f=document.querySelector(`link[rel*='icon']`);f||(f=document.createElement(`link`),f.rel=`icon`,document.head.appendChild(f)),h.faviconUrl&&(f.href=h.faviconUrl),h.appName&&(document.title=h.appName)},[u,c,h]),(0,i.jsx)(p.Provider,{value:{theme:u,setTheme:e=>l(e),toggleTheme:()=>{l(u===`light`?`dark`:`light`)},isSystem:c===`system`,setIsSystem:e=>l(e?`system`:u),config:h,activeConfig:h},children:_?e:null})}var h=()=>{let e=(0,n.useContext)(p);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e},g=e=>e?.formType===`private`||e?.submitPage===`requests`?`user_requests`:`user_submissions`,_={contact:c,support:u};function v(...e){return t.lt(t.ut(e))}var y=n.default.forwardRef(({className:e,label:n,error:r,currencySymbol:a,type:o,...s},c)=>{let l=o===`currency`;return(0,i.jsxs)(`div`,{className:`flex flex-col w-full relative`,children:[n&&(0,i.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1`,children:n}),(0,i.jsxs)(`div`,{className:`relative flex items-center`,children:[l&&a&&(0,i.jsx)(`span`,{className:`absolute left-4 font-bold text-foreground/70 z-10 pointer-events-none text-[15px]`,children:a}),(0,i.jsx)(`input`,{ref:c,type:l?`number`:o,className:v(`block h-12 w-full text-[15px] text-foreground py-2`,l&&a?`pl-8 pr-4`:`px-4`,`transition-all duration-300 placeholder:text-foreground/40`,`focus:outline-none focus:border-accent glow-focus`,`disabled:cursor-not-allowed disabled:opacity-50 glass-panel`,r&&`border-red-500/50 focus:border-red-500/50`,e),style:{borderRadius:`var(--input-radius, 0.75rem)`},...s})]}),r&&(0,i.jsx)(t.dt.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:`text-xs text-red-500 font-medium`,children:r})]})});y.displayName=`Input`;function b(...e){return t.lt(t.ut(e))}var x=n.default.forwardRef(({className:e,variant:n=`primary`,isLoading:r,children:a,...o},s)=>(0,i.jsxs)(t.dt.button,{ref:s,whileHover:{scale:1.02,y:-2},whileTap:{scale:.98},className:b(`relative inline-flex items-center justify-center px-5 py-2 text-sm font-medium transition-all duration-300 overflow-hidden group`,{primary:`btn-primary !border-none`,secondary:`btn-secondary !border-none`,ghost:`bg-transparent hover:bg-black/5 dark:hover:bg-white/5 text-foreground/60 hover:text-foreground transition-all duration-300 !border-none`}[n],e),style:{borderRadius:`var(--btn-radius, 0.75rem)`},disabled:r||o.disabled,...o,children:[r?(0,i.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,i.jsxs)(`svg`,{className:`w-5 h-5 animate-spin text-current`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,i.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,i.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}):null,(0,i.jsx)(`span`,{className:b(`inline-flex items-center justify-center gap-2`,r&&`opacity-0`),children:a})]}));x.displayName=`Button`;function S({timeZone:e,onTimeZone:r}){let[a,o]=(0,n.useState)(!1);return(0,i.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,i.jsxs)(`p`,{className:`text-[12px] font-medium text-foreground/50`,children:[`Times in `,t.Z(e),` · `,(0,i.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`text-accent font-semibold hover:underline cursor-pointer`,children:a?`Done`:`Change`})]}),a&&(0,i.jsx)(t.t,{compact:!0,value:e,onChange:e=>{r(e),o(!1)}})]})}var C=(e,t)=>!!e&&e.memberId===t.memberId&&e.start===t.start;function w({slots:e,value:n,onChange:r,timeZone:a,members:o}){let s=o.length>1,c=e=>o.find(t=>t.id===e)?.name.trim()||``;return e.length?(0,i.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`listbox`,"aria-label":`Free times`,children:e.map(e=>{let o=C(n,e),l=t.B(new Date(e.start),a),u=s?c(e.memberId):``;return(0,i.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":o,"aria-label":u?`${l} with ${u}`:l,onClick:()=>r(o?null:e),className:`flex flex-col items-center justify-center min-w-[76px] px-3 py-2 rounded-xl text-[14px] font-semibold transition-all cursor-pointer glass-panel ${o?`bg-accent text-[var(--button-fg,#fff)] border-accent shadow-lg shadow-accent/20`:`text-foreground/80 hover:border-accent hover:text-foreground`}`,style:{borderRadius:`var(--input-radius, 0.75rem)`},children:[(0,i.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[o&&(0,i.jsx)(t.In,{className:`w-3.5 h-3.5`}),l]}),u&&(0,i.jsx)(`span`,{className:`text-[11px] font-medium leading-tight ${o?`opacity-90`:`text-foreground/50`}`,children:u})]},t.Y(e.memberId,e.start))})}):null}function T(e,r,i,a){return{days:(0,n.useMemo)(()=>t.V(t.O(e,{now:a?a():new Date,taken:r}),i),[e,r,i,a]),horizon:e.reduce((e,t)=>Math.max(e,t.horizonDays),0)}}var E=(e,n)=>e?t.$(new Date(e.start),n).dateKey:``;function D({horizon:e}){return(0,i.jsx)(`p`,{className:`text-[13px] font-medium text-foreground/50 py-2`,children:e?`No free times in the next ${e} days.`:`No free times at the moment.`})}function O({members:e,value:t,onChange:r,taken:a,timeZone:o,onTimeZone:s,now:c}){let{days:l,horizon:u}=T(e,a,o,c),[d,f]=(0,n.useState)(``),p=(l.some(e=>e.dateKey===d)?d:``)||E(t,o)||l[0]?.dateKey||``,m=l.find(e=>e.dateKey===p)||l[0];return(0,i.jsxs)(`div`,{className:`flex flex-col gap-3 w-full`,children:[l.length===0?(0,i.jsx)(D,{horizon:u}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`flex gap-2 overflow-x-auto no-scrollbar pb-1 -mx-1 px-1`,role:`tablist`,"aria-label":`Days with free times`,children:l.map(e=>{let t=e.dateKey===m?.dateKey;return(0,i.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,onClick:()=>f(e.dateKey),className:`shrink-0 px-3.5 py-2 rounded-xl text-[13px] font-semibold whitespace-nowrap transition-all cursor-pointer glass-panel ${t?`bg-accent text-[var(--button-fg,#fff)] border-accent shadow-lg shadow-accent/20`:`text-foreground/70 hover:text-foreground hover:border-accent`}`,style:{borderRadius:`var(--input-radius, 0.75rem)`},children:e.label},e.dateKey)})}),m&&(0,i.jsx)(w,{slots:m.slots,value:t,onChange:r,timeZone:o,members:e})]}),(0,i.jsx)(S,{timeZone:o,onTimeZone:s})]})}var k=[`M`,`T`,`W`,`T`,`F`,`S`,`S`],A=e=>e.slice(0,7),j=(e,t)=>{let[n,r]=e.split(`-`).map(Number);return new Intl.DateTimeFormat(t,{month:`long`,year:`numeric`,timeZone:`UTC`}).format(new Date(Date.UTC(n,r-1,1)))},M=(e,t)=>{let[n,r]=e.split(`-`).map(Number),i=new Date(Date.UTC(n,r-1+t,1));return`${i.getUTCFullYear()}-${String(i.getUTCMonth()+1).padStart(2,`0`)}`};function N(e){let n=`${e}-01`,r=t.y.indexOf(t.Q(n)),i=Array.from({length:r},()=>null);for(let r=0;;r++){let a=t.D(n,r);if(A(a)!==e)break;i.push(a)}return i}function P({members:e,value:r,onChange:a,taken:o,timeZone:s,onTimeZone:c,now:l}){let{days:u,horizon:d}=T(e,o,s,l),f=t.$(l?l():new Date,s).dateKey,p=new Map(u.map(e=>[e.dateKey,e])),[m,h]=(0,n.useState)(()=>A(E(r,s)||u[0]?.dateKey||f)),[g,_]=(0,n.useState)(()=>E(r,s)||``),v=g?p.get(g):void 0,y=N(m);return(0,i.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[u.length===0&&(0,i.jsx)(D,{horizon:d}),(0,i.jsxs)(`div`,{className:`flex flex-col md:flex-row gap-4 md:gap-6 w-full`,children:[(0,i.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-3`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,i.jsx)(`h4`,{className:`text-[15px] sm:text-[17px] font-bold text-foreground tracking-tight truncate`,children:j(m)}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>h(A(f)),className:`px-3 py-1.5 text-[12.5px] font-bold border border-[var(--panel-border)] rounded-xl mr-1 hover:bg-foreground/5 transition-colors cursor-pointer`,children:`Today`}),(0,i.jsx)(`button`,{type:`button`,"aria-label":`Previous month`,onClick:()=>h(e=>M(e,-1)),className:`p-1.5 rounded-xl text-foreground/50 hover:text-foreground hover:bg-foreground/5 transition-colors border border-transparent hover:border-[var(--panel-border)] cursor-pointer`,children:(0,i.jsx)(t.Pn,{className:`w-4 h-4`})}),(0,i.jsx)(`button`,{type:`button`,"aria-label":`Next month`,onClick:()=>h(e=>M(e,1)),className:`p-1.5 rounded-xl text-foreground/50 hover:text-foreground hover:bg-foreground/5 transition-colors border border-transparent hover:border-[var(--panel-border)] cursor-pointer`,children:(0,i.jsx)(t.Nn,{className:`w-4 h-4`})})]})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-7 gap-1`,role:`grid`,"aria-label":j(m),children:[k.map((e,t)=>(0,i.jsx)(`div`,{className:`text-center text-[11px] font-bold uppercase tracking-wider text-foreground/40 py-1`,children:e},t)),y.map((e,t)=>{if(!e)return(0,i.jsx)(`div`,{"aria-hidden":!0},`blank-${t}`);let n=p.has(e),r=e===g,a=e===f,o=Number(e.slice(8,10));return(0,i.jsxs)(`button`,{type:`button`,role:`gridcell`,"aria-label":p.get(e)?.label||e,"aria-selected":r,"aria-disabled":!n,disabled:!n,onClick:()=>_(e),className:`relative flex flex-col items-center justify-center aspect-square rounded-xl text-[14px] font-semibold transition-all ${r?`bg-accent text-[var(--button-fg,#fff)] shadow-lg shadow-accent/20 cursor-pointer`:n?`text-foreground hover:bg-foreground/[0.06] cursor-pointer`:`text-foreground/25 cursor-default`} ${a&&!r?`ring-1 ring-accent/50`:``}`,children:[o,n&&(0,i.jsx)(`span`,{"aria-hidden":!0,className:`absolute bottom-1.5 w-1.5 h-1.5 rounded-full ${r?`bg-[var(--button-fg,#fff)]`:`bg-accent`}`})]},e)})]})]}),(0,i.jsx)(`div`,{className:`md:w-[260px] shrink-0 flex flex-col gap-2`,children:v?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`p`,{className:`text-[13px] font-bold text-foreground`,children:v.label}),(0,i.jsx)(w,{slots:v.slots,value:r,onChange:a,timeZone:s,members:e})]}):u.length>0?(0,i.jsx)(`p`,{className:`text-[13px] font-medium text-foreground/50`,children:`Pick a day with a dot to see its times.`}):null})]}),(0,i.jsx)(S,{timeZone:s,onTimeZone:c})]})}function F(){let[e,i]=(0,n.useState)({loading:!0,schedules:[]});return(0,n.useEffect)(()=>{let e=(0,r.onSnapshot)((0,r.collection)(t.er,t.w),e=>{let n=[];e.forEach(e=>n.push(t.G(e.id,e.data()))),n.sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id)),t.J(n),i({loading:!1,schedules:n})},()=>i({loading:!1,schedules:[]}));return()=>e()},[]),e}async function I(e){try{let{id:n,...i}=e;return await(0,r.setDoc)((0,r.doc)(t.er,t.w,n),{...i,updatedAt:Date.now()}),null}catch(e){return console.error(`Could not save the schedule`,e),`The hours could not be saved — make sure you are signed in as an admin and try again.`}}async function L(e){try{return await(0,r.deleteDoc)((0,r.doc)(t.er,t.w,e)),null}catch(e){return console.error(`Could not remove the schedule`,e),`It could not be removed — make sure you are signed in as an admin and try again.`}}function R(){let[e,i]=(0,n.useState)({loading:!0,members:[]});return(0,n.useEffect)(()=>{let e=(0,r.onSnapshot)((0,r.collection)(t.er,`user_profiles`),e=>{let t=[];e.forEach(e=>{let n=e.data()||{},r=n.role===`admin`||n.role===`internal`?n.role:null;!r||n.inactive===!0||t.push({id:e.id,name:String(n.displayName||``),email:String(n.email||``),role:r})}),t.sort((e,t)=>(e.name||e.email).localeCompare(t.name||t.email)),i({loading:!1,members:t})},()=>i({loading:!1,members:[]}));return()=>e()},[]),e}function z(e,i){let[a,o]=(0,n.useState)(()=>new Set),s=e.slice().sort().join(`,`),c=i.toISOString();return(0,n.useEffect)(()=>{if(!s)return;let e=new Set(s.split(`,`)),n=(0,r.onSnapshot)((0,r.query)((0,r.collection)(t.er,t.E),(0,r.where)(`start`,`>=`,c)),t=>{let n=new Set;t.forEach(t=>{let r=t.data()||{};e.has(String(r.memberId||``))&&n.add(t.id)}),o(n)},()=>o(new Set));return()=>n()},[s,c]),s?a:B}var B=new Set,V=`taken`,H=`That time was just taken — pick another.`;async function U(e){let n=t.Y(e.memberId,e.start);try{return await(0,r.runTransaction)(t.er,async i=>{let a=(0,r.doc)(t.er,t.E,n);if((await i.get(a)).exists())throw Error(V);i.set(a,{memberId:e.memberId,start:e.start,end:e.end,createdAt:Date.now()})}),null}catch(e){return e?.message===V?H:(console.error(`Could not claim the time`,e),`The time could not be saved — check your connection and try again.`)}}async function W(e){try{await(0,r.deleteDoc)((0,r.doc)(t.er,t.E,t.Y(e.memberId,e.start)))}catch{}}async function G(e,n){try{return await(0,r.setDoc)((0,r.doc)(t.er,t._,t.Y(e.memberId,e.start)),{memberId:e.memberId,memberName:n.memberName,start:e.start,end:e.end,timeZone:n.timeZone,name:n.name,email:n.email,answers:n.answers,formId:n.formId,entryId:n.entryId,uid:t.$n.currentUser?.uid||`guest`,createdAt:Date.now()}),null}catch(e){return console.error(`Could not write the booking for the team`,e),`The booking was taken but its details could not be saved.`}}var K=(e,t)=>({id:e,memberId:String(t?.memberId||``),start:String(t?.start||``),end:String(t?.end||``),memberName:String(t?.memberName||``),timeZone:String(t?.timeZone||``),name:String(t?.name||``),email:String(t?.email||``),answers:t?.answers&&typeof t.answers==`object`?Object.fromEntries(Object.entries(t.answers).map(([e,t])=>[e,String(t??``)])):{},formId:String(t?.formId||``),entryId:String(t?.entryId||``),uid:String(t?.uid||``),createdAt:typeof t?.createdAt==`number`?t.createdAt:0});function q(e={}){let[i,a]=(0,n.useState)({loading:!0,bookings:[],error:null}),o=(e.members||[]).slice().sort().join(`,`),s=!!e.includePast,c=e.now;return(0,n.useEffect)(()=>{let e=o?new Set(o.split(`,`)):null,n=(0,r.onSnapshot)((0,r.collection)(t.er,t._),t=>{let n=(c?c():new Date).toISOString(),r=[];t.forEach(t=>{let n=K(t.id,t.data());e&&!e.has(n.memberId)||r.push(n)});let i=r.filter(e=>e.end>=n).sort((e,t)=>e.start.localeCompare(t.start)),o=s?r.filter(e=>e.end<n).sort((e,t)=>t.start.localeCompare(e.start)):[];a({loading:!1,bookings:[...i,...o],error:null})},e=>{a({loading:!1,bookings:[],error:String(e?.code||``).includes(`permission`)?`This is for the team — sign in as a team member or admin to see the bookings.`:`The bookings could not be loaded.`})});return()=>n()},[o,s,c]),i}async function J(e){try{return await(0,r.deleteDoc)((0,r.doc)(t.er,t._,e)),await(0,r.deleteDoc)((0,r.doc)(t.er,t.E,e)),null}catch(e){return console.error(`Could not cancel the booking`,e),`It could not be cancelled — make sure you are signed in as a team member and try again.`}}var Y=n.default.lazy(()=>Promise.resolve().then(()=>require(`./PhoneInputField-BdzUG4Wx.cjs`)).then(e=>e.n)),X=/^[^\s@,;]+@[^\s@,;.]+(\.[^\s@,;.]+)*\.[a-z]{2,}$/i;function Z({field:e,value:r,error:a,timeZone:o,onTimeZone:s,onChange:c}){let{schedules:l}=F(),u=Array.isArray(e.members)?e.members.map(String):[],d=l.filter(e=>u.includes(e.id)&&t.A(e)),[f]=(0,n.useState)(()=>new Date),p=z(u,f),m=t.L(r),h=e.look===`calendar`?P:O;return(0,i.jsxs)(`div`,{className:`flex flex-col w-full`,children:[(0,i.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1`,children:e.label}),(0,i.jsx)(h,{members:d,value:m,onChange:e=>c(e?t.z(e):``),taken:p,timeZone:o,onTimeZone:s}),a&&(0,i.jsx)(`span`,{className:`text-xs text-red-500 font-medium mt-1.5 ml-1`,children:a})]})}var Q=(e,n)=>{let r=e.find(e=>e.type===`text`&&/name/i.test(String(e.name||``)))||e.find(e=>e.type===`text`);return String(r&&n[r.name]||t.$n.currentUser?.displayName||``).trim()},$=(e,n)=>{let r=e.find(e=>e.type===`email`);return String(r&&n[r.name]||t.$n.currentUser?.email||``).trim()},ee=(e,t)=>Object.fromEntries(e.filter(e=>e.type!==`schedule`&&e.name&&t[e.name]!==void 0&&t[e.name]!==``).map(e=>[e.name,String(t[e.name])]));function te({field:e,value:r,error:a,onChange:o}){let[s,c]=(0,n.useState)(0),[l,u]=(0,n.useState)(``),d=(0,n.useRef)(null),f=s>0,p=t.nt(r),m=async e=>{let n=Array.from(e||[]);d.current&&(d.current.value=``),n.length&&(u(``),c(e=>e+n.length),await Promise.all(n.map(async e=>{try{let n=await t.at(e,t.$n.currentUser);o(e=>t.rt([...t.nt(e),n]))}catch(e){u(e?.code===`storage/unauthorized`?`That kind of file is not accepted. Try a PDF, a document or a picture.`:t.it(e))}finally{c(e=>e-1)}})))},h=e=>{u(``),o(n=>t.rt(t.nt(n).filter(t=>t!==e)))},g=a||l;return(0,i.jsxs)(`div`,{className:`flex flex-col w-full relative`,children:[(0,i.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1`,children:e.label}),p.length>0&&(0,i.jsx)(`ul`,{className:`flex flex-col gap-1.5 mb-2`,children:p.map(e=>(0,i.jsxs)(`li`,{className:`flex items-center gap-3 w-full rounded-xl px-4 py-2.5 glass-panel`,style:{borderRadius:`var(--input-radius, 0.75rem)`},children:[(0,i.jsx)(t.Gt,{className:`w-4 h-4 shrink-0 text-accent`}),(0,i.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-[15px] text-foreground`,children:t.tt(e)}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>h(e),"aria-label":`Remove ${t.tt(e)}`,title:`Remove`,className:`p-1 rounded-lg text-foreground/40 hover:text-red-500 hover:bg-red-500/10 transition-colors cursor-pointer shrink-0`,children:(0,i.jsx)(t.gt,{className:`w-3.5 h-3.5`})})]},e))}),(0,i.jsxs)(`label`,{className:`flex items-center gap-3 w-full rounded-xl px-4 py-3 glass-panel transition-all duration-300 cursor-pointer hover:border-accent ${f?`opacity-60 pointer-events-none`:``}`,style:{borderRadius:`var(--input-radius, 0.75rem)`},children:[f?(0,i.jsx)(t.$t,{className:`w-4 h-4 animate-spin text-accent shrink-0`}):(0,i.jsx)(t.Tn,{className:`w-4 h-4 shrink-0 text-foreground/40`}),(0,i.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-[15px] text-foreground/40`,children:f?s>1?`Uploading ${s} files...`:`Uploading...`:p.length?`Add another file`:e.placeholder||`Attach files`}),!f&&(0,i.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12.5px] font-bold text-foreground/60 shrink-0`,children:[(0,i.jsx)(t.Tn,{className:`w-3.5 h-3.5`}),(0,i.jsx)(`span`,{className:`max-sm:hidden`,children:`Upload`})]}),(0,i.jsx)(`input`,{ref:d,type:`file`,multiple:!0,accept:e.accept,"aria-label":e.label,disabled:f,onChange:e=>m(e.target.files),className:`hidden`})]}),g&&(0,i.jsx)(`span`,{className:`text-xs text-red-500 font-medium mt-1.5 ml-1`,children:g})]})}function ne({onClose:e,formId:s,formConfig:l,isInline:d,onSubmitted:f}){let[p,m]=(0,n.useState)({}),[h,_]=(0,n.useState)(`idle`),[v,b]=(0,n.useState)(``),[S,C]=(0,n.useState)({}),[w,T]=(0,n.useState)(()=>t.R()),[E,D]=(0,n.useState)(``),O=(0,n.useRef)(null),[k,A]=(0,n.useState)(l||null),[j,M]=(0,n.useState)(!l),N=(0,a.useNavigate)(),P=t.Qn(),F=e=>{let t=(typeof window<`u`?window.__FBOS_FORMS__:null)||{};return P?.defaultConfigs?.[e]||P?.defaultConfigs?.[`${e}Form`]||t[e]||(e===`contact`?c:e===`support`?u:null)};(0,n.useEffect)(()=>{if(l){A(l),M(!1);return}if(!s){A(F(`contact`)),M(!1);return}if(!localStorage.getItem(`fbos_custom_form_${s}`)){let e=F(s);if(e){A(e),M(!1);return}}try{let e=localStorage.getItem(`fbos_form_${s}`);e&&(A(JSON.parse(e)),M(!1))}catch{}(async()=>{try{let e=await(0,r.getDoc)((0,r.doc)(t.er,`sys_forms`,s));if(e.exists()){let t={...e.data(),id:e.id};A(t),localStorage.setItem(`fbos_form_${s}`,JSON.stringify(t))}else{let e=F(s);e&&(A(e),localStorage.removeItem(`fbos_custom_form_${s}`))}}catch(e){console.error(`Failed to load form config:`,e);let t=F(s);t&&A(t)}finally{M(!1)}})()},[s,l]),(0,n.useEffect)(()=>{k&&k.fields&&m(e=>{let n={...e},r=!1;return k.fields.forEach(e=>{(e.name===`contactEmail`||e.type===`email`)&&!n[e.name]&&t.$n.currentUser?.email&&(n[e.name]=t.$n.currentUser.email,r=!0)}),r?n:e})},[k]),(0,n.useEffect)(()=>{function t(t){O.current&&!O.current.contains(t.target)&&e?.()}return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e]),(0,n.useEffect)(()=>{if(d)return;let t=t=>{t.key===`Escape`&&e?.()};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,d]),(0,n.useEffect)(()=>{if(!d)return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=`unset`}},[d]);let I=async n=>{n.preventDefault();let i=(k?.fields||[]).filter(e=>e.type===`email`),a={},o={};i.forEach(e=>{let t=String(p[e.name]??``).trim();t&&(o[e.name]=t,X.test(t)||(a[e.name]=`That does not look like an email address — check for a typo, e.g. jane@example.com`))}),(k?.fields||[]).filter(e=>e.type===`file`&&e.required&&!p[e.name]).forEach(e=>{a[e.name]=`Please attach a file before sending.`});let c=(k?.fields||[]).filter(e=>e.type===`schedule`);if(c.filter(e=>e.required&&!t.L(p[e.name])).forEach(e=>{a[e.name]=`Pick a time before sending.`}),Object.keys(a).length>0){C(a);return}C({}),_(`loading`),b(``);try{let n=g(k),i=s||k?.systemName||k?.title||`unknown`,a=[];for(let e of c){let n=t.L(p[e.name]);if(!n)continue;let r=await U(n);if(r){for(let e of a)await W(e.slot);C({[e.name]:r}),_(`idle`);return}let i=t.U().find(e=>e.id===n.memberId)?.name||``;a.push({field:e,slot:n,memberName:i})}let u={...p,...o};for(let e of a)delete u[e.field.name],Object.assign(u,t.M(e.field.name,e.slot,e.memberName,w));let d=t.$n.currentUser?{uid:t.$n.currentUser.uid,submitterName:t.$n.currentUser.displayName||``,submitterEmail:t.$n.currentUser.email||``,submitterAvatar:t.$n.currentUser.photoURL||``}:{uid:`guest`},h;try{h=await(0,r.addDoc)((0,r.collection)(t.er,n),{...u,...d,formId:i,submittedAt:(0,r.serverTimestamp)()})}catch(e){for(let e of a)await W(e.slot);throw e}let v=k?.fields||[];for(let e of a)await G(e.slot,{memberName:e.memberName,timeZone:w,name:Q(v,u),email:$(v,u),answers:ee(v,u),formId:i,entryId:h.id});a.length&&D(a.map(e=>t.I(e.slot,e.memberName,w)).join(`; `)),_(`success`);try{f?.(Object.fromEntries(Object.entries(u).map(([e,t])=>[e,String(t??``)])),{collection:n,id:h.id})}catch{}setTimeout(()=>{k?.redirectTo&&!l&&(k.redirectTo.startsWith(`/`)?N(k.redirectTo):window.location.href=k.redirectTo),e?.(),_(`idle`),m({}),D(``)},3e3)}catch(e){console.error(`Submission error:`,e),_(`error`),b(`We could not send your message right now. Please try again.`)}},[L,R]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{let e;return j||!k&&!l?e=setTimeout(()=>R(!0),150):R(!1),()=>clearTimeout(e)},[j,k,l]),j||!k)return L?d?(0,i.jsx)(`div`,{className:`w-full flex items-center justify-center py-[10vh]`,children:(0,i.jsxs)(`div`,{className:`p-4 rounded-2xl glass-panel border border-[var(--panel-border)]/40 bg-background/80 shadow-md flex items-center gap-3`,children:[(0,i.jsx)(t.$t,{className:`w-4 h-4 animate-spin text-accent`}),(0,i.jsx)(`span`,{className:`text-[12px] font-medium text-foreground/60 tracking-wide`,children:`Loading form...`})]})}):(0,o.createPortal)((0,i.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/10 backdrop-blur-sm`,children:(0,i.jsxs)(`div`,{className:`p-4 rounded-2xl glass-panel border border-[var(--panel-border)]/40 bg-background/80 shadow-xl flex items-center gap-3`,children:[(0,i.jsx)(t.$t,{className:`w-4 h-4 animate-spin text-accent`}),(0,i.jsx)(`span`,{className:`text-[12px] font-medium text-foreground/60 tracking-wide`,children:`Loading form...`})]})}),document.body):null;let z=(k.fields||[]).find(e=>e.type===`schedule`&&e.look===`calendar`),B=z?t.L(p[z.name]):null,V=!!z&&!B,H=z?`max-w-[880px]`:`max-w-[500px]`,K=(0,i.jsx)(`div`,{className:`relative z-10 w-full`,children:h===`success`?(0,i.jsxs)(t.dt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex flex-col items-center justify-center py-8 text-center`,children:[(0,i.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-green-500/10 border border-green-500/20 flex items-center justify-center text-green-500 mb-4`,children:(0,i.jsx)(t.An,{className:`w-8 h-8`})}),(0,i.jsx)(`h4`,{className:`text-lg font-bold text-foreground mb-2`,children:`Message Sent!`}),(0,i.jsx)(`p`,{className:`text-[14px] text-foreground/60 leading-relaxed`,children:`Thank you for your interest. We'll get back to you shortly.`}),E&&(0,i.jsxs)(`p`,{className:`text-[14px] font-semibold text-foreground mt-3`,children:[`Booked: `,E]})]}):h===`loading`?(0,i.jsxs)(t.dt.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,i.jsx)(t.$t,{className:`w-10 h-10 animate-spin text-accent mb-4`}),(0,i.jsx)(`h4`,{className:`text-lg font-bold text-foreground tracking-tight`,children:`Processing`}),(0,i.jsx)(`p`,{className:`text-[13px] text-foreground/50 mt-1`,children:`Please wait a moment...`})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`mb-6 text-center`,children:[(0,i.jsx)(`h3`,{className:`text-2xl sm:text-3xl font-extrabold mb-2 text-foreground tracking-tight break-words`,children:k.title}),k.description&&(0,i.jsx)(`p`,{className:`text-[14px] md:text-[15px] font-medium text-foreground/60 tracking-wide leading-relaxed`,children:k.description})]}),h===`error`&&(0,i.jsxs)(t.dt.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:`mb-4 p-3 sm:p-4 rounded-xl bg-red-500/10 border border-red-500/20 flex items-start gap-3`,children:[(0,i.jsx)(t.jn,{className:`w-5 h-5 text-red-500 shrink-0 mt-0.5`}),(0,i.jsx)(`p`,{className:`text-[14px] font-medium text-red-500/90`,children:v})]}),(0,i.jsxs)(`form`,{onSubmit:I,className:`flex flex-col gap-4 sm:gap-5 w-full`,children:[z&&(B?(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl px-4 py-3 glass-panel`,style:{borderRadius:`var(--input-radius, 0.75rem)`},children:[(0,i.jsx)(`span`,{className:`text-[14px] font-semibold text-foreground truncate`,children:t.I(B,t.U().find(e=>e.id===B.memberId)?.name||``,w)}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>m(e=>({...e,[z.name]:``})),className:`text-[12.5px] font-bold text-accent hover:underline shrink-0 cursor-pointer`,children:`Change`})]}):(0,i.jsx)(Z,{field:z,value:p[z.name]||``,error:S[z.name],timeZone:w,onTimeZone:T,onChange:e=>m(t=>({...t,[z.name]:e}))})),!V&&[...k.fields||[]].filter(e=>e!==z).sort((e,t)=>{let n=e.type===`checkbox`,r=t.type===`checkbox`;return n&&!r?1:!n&&r?-1:0}).map((e,r)=>{if(e.type===`schedule`)return(0,i.jsx)(Z,{field:e,value:p[e.name]||``,error:S[e.name],timeZone:w,onTimeZone:T,onChange:t=>{m(n=>({...n,[e.name]:t})),S[e.name]&&C(t=>{let n={...t};return delete n[e.name],n})}},r);if(e.type===`tel`)return(0,i.jsx)(n.Suspense,{fallback:(0,i.jsx)(`div`,{className:`h-12 w-full glass-panel animate-pulse rounded-xl`}),children:(0,i.jsx)(Y,{field:e,value:p[e.name]||``,onChange:t=>m(n=>({...n,[e.name]:t}))})},r);if(e.type===`file`)return(0,i.jsx)(te,{field:e,value:p[e.name]||``,error:S[e.name],onChange:t=>{m(n=>({...n,[e.name]:t(n[e.name]||``)})),S[e.name]&&C(t=>{let n={...t};return delete n[e.name],n})}},r);if(e.type===`textarea`)return(0,i.jsxs)(`div`,{className:`flex flex-col w-full relative`,children:[(0,i.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1`,children:e.label}),(0,i.jsx)(`textarea`,{required:e.required,rows:3,placeholder:e.placeholder,value:p[e.name]||``,onChange:t=>m(n=>({...n,[e.name]:t.target.value})),className:`flex w-full rounded-xl text-[15px] text-foreground px-4 py-3 transition-all duration-300 placeholder:text-foreground/40 focus:outline-none focus:border-accent glow-focus disabled:cursor-not-allowed disabled:opacity-50 glass-panel min-h-[100px] resize-none`})]},r);if(e.type===`select`)return(0,i.jsx)(`div`,{className:`w-full`,children:(0,i.jsx)(t.ct,{label:e.label,direction:`auto`,value:p[e.name]||``,options:[{value:``,label:(0,i.jsx)(`span`,{className:`text-foreground/40`,children:`Select an option...`})},...(e.options||[]).map(e=>({value:e,label:e}))],onChange:t=>m(n=>({...n,[e.name]:t}))})},r);if(e.type===`checkbox`)return(0,i.jsxs)(`label`,{className:`flex items-center gap-3 w-full cursor-pointer group py-2`,children:[(0,i.jsxs)(`div`,{className:`relative flex items-center justify-center w-5 h-5 rounded border border-foreground/20 bg-background/50 group-hover:border-accent transition-colors`,children:[(0,i.jsx)(`input`,{type:`checkbox`,required:e.required,checked:!!p[e.name],onChange:t=>m(n=>({...n,[e.name]:t.target.checked})),className:`absolute opacity-0 w-full h-full cursor-pointer`}),p[e.name]&&(0,i.jsx)(`span`,{className:`w-2.5 h-2.5 bg-accent rounded-sm shrink-0`})]}),(0,i.jsx)(`span`,{className:`text-[14px] font-medium text-foreground/80 leading-snug group-hover:text-foreground transition-colors`,children:e.label})]},r);if(e.type===`date`){let n=p[e.name]||``;return(0,i.jsxs)(`div`,{className:`flex flex-col w-full relative`,children:[(0,i.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1`,children:e.label}),(0,i.jsxs)(`div`,{className:`relative flex items-center`,children:[(0,i.jsx)(`input`,{type:`date`,required:e.required,value:n,onChange:t=>m(n=>({...n,[e.name]:t.target.value})),className:`date-field block h-12 w-full text-[15px] pl-4 pr-11 py-2 transition-all duration-300 focus:outline-none focus:border-accent glow-focus disabled:cursor-not-allowed disabled:opacity-50 glass-panel ${n?`text-foreground`:`text-foreground/40`}`,style:{borderRadius:`var(--input-radius, 0.75rem)`}}),(0,i.jsx)(t.Rn,{className:`w-4 h-4 text-foreground/50 absolute right-4 pointer-events-none`})]})]},r)}return e.type===`age`?(0,i.jsx)(y,{label:e.label,required:e.required,type:`number`,min:0,max:120,placeholder:e.placeholder||`Age (Max 120)`,value:p[e.name]||``,onChange:t=>{let n=t.target.value;if(n===``)m(t=>({...t,[e.name]:``}));else{let t=Math.max(0,Math.min(120,parseInt(n,10)));m(n=>({...n,[e.name]:isNaN(t)?``:String(t)}))}}},r):e.type===`currency`||e.type===`number`&&e.name===`budget`?(0,i.jsxs)(`div`,{className:`flex flex-col w-full relative`,children:[(0,i.jsx)(`label`,{className:`text-[13px] font-medium text-foreground/50 select-none mb-1.5 ml-1`,children:e.label}),(0,i.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,i.jsx)(`span`,{className:`absolute left-4 text-foreground/70 font-bold flex items-center h-full z-10 pointer-events-none text-[15px]`,children:e.currencySymbol||`$`}),(0,i.jsx)(`input`,{required:e.required,type:`number`,placeholder:e.placeholder,value:p[e.name]||``,onChange:t=>m(n=>({...n,[e.name]:t.target.value})),className:`block h-12 w-full text-[15px] text-foreground pl-8 pr-4 py-2 transition-all duration-300 placeholder:text-foreground/40 focus:outline-none focus:border-accent glow-focus disabled:cursor-not-allowed disabled:opacity-50 glass-panel`,style:{borderRadius:`var(--input-radius, 0.75rem)`}})]})]},r):(0,i.jsx)(y,{label:e.label,required:e.required,type:e.type,placeholder:e.placeholder,currencySymbol:e.currencySymbol,error:S[e.name],value:p[e.name]||``,onChange:t=>{m(n=>({...n,[e.name]:t.target.value})),S[e.name]&&C(t=>{let n={...t};return delete n[e.name],n})}},r)}),!V&&(0,i.jsx)(`div`,{className:`pt-2`,children:(0,i.jsx)(x,{type:`submit`,className:`w-full px-6 md:px-8 py-3 md:py-3.5 rounded-xl font-semibold tracking-wide btn-primary text-[15px] shadow-xl transition-all duration-300 hover:-translate-y-1 active:scale-95 flex items-center justify-center`,isLoading:!1,children:k.submitText||k.buttonName||`Submit`})})]})]})});return d?(0,i.jsxs)(`div`,{className:`w-full flex justify-center flex-col items-center`,children:[(0,i.jsx)(`div`,{className:`w-full ${H} mb-6 px-2`,children:(0,i.jsxs)(`button`,{onClick:()=>window.history.back(),className:`flex items-center gap-2 text-foreground/40 hover:text-foreground font-medium transition-colors w-fit group`,children:[(0,i.jsx)(t.Kn,{className:`w-4 h-4 group-hover:-translate-x-1 transition-transform`}),`Go Back`]})}),(0,i.jsxs)(t.dt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`w-full ${H} p-6 sm:p-8 lg:p-10 rounded-3xl md:rounded-3xl glass-form relative glow-hover shadow-[0_8px_32px_rgba(0,0,0,0.08)] z-10 mx-auto`,children:[(0,i.jsx)(`div`,{className:`absolute -inset-[1px] bg-gradient-to-br from-[var(--primary-glow)] to-transparent opacity-30 blur-[20px] rounded-3xl md:rounded-3xl -z-10`}),K]})]}):(0,o.createPortal)((0,i.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex items-start justify-center p-4 py-20 md:py-10 h-[-webkit-fill-available] md:h-screen w-screen overflow-y-auto no-scrollbar`,children:[(0,i.jsx)(t.dt.div,{onClick:e,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:`fixed inset-0 bg-background/60 backdrop-blur-xl cursor-pointer`}),(0,i.jsxs)(t.dt.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},ref:O,className:`w-full ${H} p-6 sm:p-8 lg:p-10 rounded-3xl md:rounded-3xl glass-popover relative shadow-[0_8px_32px_rgba(0,0,0,0.08)] z-10 mx-auto my-auto border border-[var(--panel-border)] shrink-0`,children:[(0,i.jsx)(`div`,{className:`absolute -inset-[1px] bg-gradient-to-br from-[var(--primary-glow)] to-transparent opacity-30 blur-[20px] rounded-3xl md:rounded-3xl -z-10`}),K]})]}),document.body)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return _}});