your-ai-workflow-firebase-os 1.14.39 → 1.14.41
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 +1 -1
- package/dist/{ContactPopup-DW_AZng8.js → ContactPopup-BBgHbtwd.js} +1 -1
- package/dist/{ContactPopup-DBdsDflP.cjs → ContactPopup-ss9U88BV.cjs} +1 -1
- package/dist/renderer.cjs.js +1 -1
- package/dist/renderer.es.js +1 -1
- package/dist/your-ai-workflow-firebase-os.cjs.js +35 -35
- package/dist/your-ai-workflow-firebase-os.css +1 -1
- package/dist/your-ai-workflow-firebase-os.es.js +2183 -2180
- package/package.json +1 -1
- package/scripts/postinstall.js +5 -0
- package/src/index.css +10 -0
package/README.md
CHANGED
|
@@ -116,7 +116,7 @@ for its own key, which this app never reads.
|
|
|
116
116
|
|
|
117
117
|
### What the build enforces
|
|
118
118
|
|
|
119
|
-
The package ships a Vite plugin, `yourAiFirebase()`, that puts the project's structure out of the assistant's reach. `src/App.tsx` and `src/main.tsx` are owned files: the plugin serves its own canonical source for both and rewrites them on disk whenever they differ, so an edit there has no effect. Pages, forms and content files are discovered from `src/your-ai-workflow-firebase-os/configs/` and `microcomponents/` through a virtual module, so a deleted registry import can no longer make a page vanish. And every discovered file is validated before the build: a config file with the wrong name, a `route` that is not one string starting with `/`, an address used twice, a `*Tab.config.ts` without a valid `pageType`, a missing `*Config` export, a `systemName` that does not match the file, or a content file with no default export fails the build with one sentence that names the fix. A hand-written `<form>` in a content file only warns — its entries would never reach the Inbox.
|
|
119
|
+
The package ships a Vite plugin, `yourAiFirebase()`, that puts the project's structure out of the assistant's reach. `src/App.tsx` and `src/main.tsx` are owned files: the plugin serves its own canonical source for both and rewrites them on disk whenever they differ, so an edit there has no effect. Pages, forms and content files are discovered from `src/your-ai-workflow-firebase-os/configs/` and `microcomponents/` through a virtual module, so a deleted registry import can no longer make a page vanish. And every discovered file is validated before the build: a config file with the wrong name, a `route` that is not one string starting with `/`, an address used twice, a `*Tab.config.ts` without a valid `pageType`, a missing `*Config` export, a `systemName` that does not match the file, or a content file with no default export fails the build with one sentence that names the fix. A bare `<img>` in a content file fails it too: pictures go through `<Picture>`, which holds its space before the picture lands, fetches the light copy written beside every upload, and crosses over when its `src` changes rather than blanking — the thing that made a product page's colour swatches flash. A hand-written `<form>` in a content file only warns — its entries would never reach the Inbox.
|
|
120
120
|
|
|
121
121
|
Manual-first recipe: the owner adds the page — and its form, if it needs one — on `/pages` and then asks the assistant for the content, which is a single `microcomponents/<PascalCaseName>Content.tsx` file — no config file, no second address.
|
|
122
122
|
|
|
@@ -115,7 +115,7 @@ function tt({ config: e, children: t }) {
|
|
|
115
115
|
children: t
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
var nt = () => j(et), rt = "1.14.
|
|
118
|
+
var nt = () => j(et), rt = "1.14.41", it = typeof window < "u" ? N : M, at = k(void 0), ot = (e) => {
|
|
119
119
|
let t = e?.defaultTheme;
|
|
120
120
|
return t !== "light" && t !== "dark" || e?.showThemeToggle ? null : t;
|
|
121
121
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./verifiedAccount-BqmmFNkc.cjs`),n=require(`./lucide-react-NE2zYbRL.cjs`),r=require(`./address-COc6hg_p.cjs`);let i=require(`react`);i=e.a(i,1);let a=require(`react/jsx-runtime`),o=require(`firebase/app`),s=require(`firebase/auth`),c=require(`firebase/firestore`),l=require(`firebase/storage`),u=require(`react-router-dom`),d=require(`react-dom`);var f=e.r({contactFormConfig:()=>p}),p={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}]},m=e.r({supportFormConfig:()=>h}),h={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}]},g={appName:`Your AI Firebase`,defaultTheme:`light`,showThemeToggle:!0,logoUrl:`https://firebasestorage.googleapis.com/v0/b/fir-os-47863.firebasestorage.app/o/pub_files%2F1776321238933_favicon_smaller.png?alt=media&token=efecb55c-2456-4cbe-a20a-b86db54a1e55`,faviconUrl:`https://firebasestorage.googleapis.com/v0/b/fir-os-47863.firebasestorage.app/o/pub_files%2F1776321238933_favicon_smaller.png?alt=media&token=efecb55c-2456-4cbe-a20a-b86db54a1e55`,colors:{dark:{background:`#07070f`,backgroundSecondary:`#0a0a18`,foreground:`#f0eeff`,accent:`#a78bfa`,buttonText:`#ffffff`},light:{background:`#fcfaff`,backgroundSecondary:`#f7f3ff`,foreground:`#1e1b4b`,accent:`#7c3aed`,buttonText:`#ffffff`}},cornerRounding:`default`,cornerRadii:{buttonRadius:.75,inputRadius:.75,cardRadius:1.5,modalRadius:2.5}},_=(0,i.createContext)({});function v({config:e,children:t}){return(0,a.jsx)(_.Provider,{value:e,children:t})}var y=()=>(0,i.useContext)(_),b=`1.14.39`,x=typeof window<`u`?i.useLayoutEffect:i.useEffect,S=(0,i.createContext)(void 0),C=e=>{let t=e?.defaultTheme;return t!==`light`&&t!==`dark`||e?.showThemeToggle?null:t};function w({children:e,scopeSelector:t}){let n=y(),r=(0,i.useMemo)(()=>n?.themeConfig||g,[n?.themeConfig]),o=C(r),s=!!r.showThemeToggle;(0,i.useEffect)(()=>{try{localStorage.removeItem(`theme_config_cache`),localStorage.removeItem(`theme_saved_cache`)}catch{}console.info(`Your AI Firebase ${b} · colours from theme.config.ts`)},[]);let[c,l]=(0,i.useState)(()=>{if(o)return o;if(typeof window>`u`)return r.defaultTheme||`system`;let e=localStorage.getItem(`theme-mode`),t=localStorage.getItem(`last-seen-default-theme`);return r.defaultTheme&&r.defaultTheme!==t?(localStorage.setItem(`last-seen-default-theme`,r.defaultTheme),localStorage.removeItem(`theme-mode`),r.defaultTheme):e||r.defaultTheme||`system`}),[u,d]=(0,i.useState)(()=>{if(o)return o;if(typeof window>`u`)return r.defaultTheme===`light`?`light`:`dark`;let e=localStorage.getItem(`theme-mode`),t=localStorage.getItem(`last-seen-default-theme`),n=e||r.defaultTheme||`system`;return r.defaultTheme&&r.defaultTheme!==t&&(n=r.defaultTheme),n===`system`?window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`:n});return(0,i.useEffect)(()=>{let e=r.defaultTheme;e&&(o&&l(o),e!==localStorage.getItem(`last-seen-default-theme`)&&(localStorage.setItem(`last-seen-default-theme`,e),localStorage.removeItem(`theme-mode`),l(e)))},[r.defaultTheme,o]),(0,i.useEffect)(()=>{let e=e=>{c===`system`&&d(e.matches?`light`:`dark`)},t=window.matchMedia(`(prefers-color-scheme: light)`);return c===`system`?(d(t.matches?`light`:`dark`),t.addEventListener(`change`,e)):d(c),()=>t.removeEventListener(`change`,e)},[c]),x(()=>{let e=(t?document.querySelector(t):document.documentElement)||document.documentElement,n=u===`dark`?r.colors.dark:r.colors.light;e.style.setProperty(`--bg-color`,n.background),e.style.setProperty(`--bg-secondary-color`,n.backgroundSecondary||n.background),e.style.setProperty(`--fg-color`,n.foreground),e.style.setProperty(`--accent-color`,n.accent);let i=u===`dark`;e.style.setProperty(`--panel-bg`,n.panelBg||`color-mix(in srgb, ${n.accent} ${i?`5%`:`4%`}, transparent)`),e.style.setProperty(`--panel-border`,n.panelBorder||`color-mix(in srgb, ${n.accent} 15%, transparent)`);let a=(e,t,n)=>{if(!e||e.length===0)return t||`transparent`;if(e.length===1)return e[0];let r=e.map((t,n)=>`${t} ${Math.round(n/(e.length-1)*100)}%`).join(`, `);return n===`conic`?`conic-gradient(from 180deg at 50% 100%, ${r})`:`linear-gradient(135deg, ${r})`},o=`linear-gradient(135deg, color-mix(in oklab, ${n.accent} ${i?`70%`:`78%`}, black) 0%, ${n.accent} 100%)`,s=`linear-gradient(135deg, color-mix(in oklab, ${n.accent} ${i?`80%`:`85%`}, black) 0%, color-mix(in oklab, ${n.accent} 72%, white) 100%)`;e.style.setProperty(`--button-bg`,a(n.buttonGradient,o,n.buttonGradientShape)),e.style.setProperty(`--button-fg`,n.buttonText||`#ffffff`),e.style.setProperty(`--button-hover-bg`,a(n.buttonHoverGradient||n.buttonGradient,s,n.buttonGradientShape)),e.style.setProperty(`--text-gradient`,a(n.textGradient,`linear-gradient(135deg, ${n.foreground} 0%, ${n.accent} 100%)`)),e.style.setProperty(`--glow-color`,n.glowColor||`color-mix(in srgb, ${n.accent} ${i?`40%`:`30%`}, transparent)`),e.style.setProperty(`--notification-icon-color`,n.notificationIconColor||n.accent);let l=n.secondaryButton?.bg||(u===`dark`?`rgba(255, 255, 255, 0.05)`:`rgba(0, 0, 0, 0.03)`),d=n.secondaryButton?.border||(u===`dark`?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.06)`),f=n.secondaryButton?.text||n.foreground;if(e.style.setProperty(`--btn-sec-bg`,l),e.style.setProperty(`--btn-sec-border`,d),e.style.setProperty(`--btn-sec-text`,f),e.style.setProperty(`--selection-bg`,n.selectionBg||`color-mix(in srgb, var(--accent-color) 40%, transparent)`),e.style.setProperty(`--selection-text`,n.selectionText||`#ffffff`),e.setAttribute(`data-theme`,u),localStorage.setItem(`theme-mode`,c),r.cornerRounding===`custom`&&r.cornerRadii?(e.style.setProperty(`--btn-radius`,`${parseFloat(String(r.cornerRadii.buttonRadius))||0}rem`),e.style.setProperty(`--card-radius`,`${parseFloat(String(r.cornerRadii.cardRadius))||0}rem`),e.style.setProperty(`--input-radius`,`${parseFloat(String(r.cornerRadii.inputRadius))||0}rem`),e.style.setProperty(`--modal-radius`,`${parseFloat(String(r.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 p=document.querySelector(`link[rel*='icon']`);p||(p=document.createElement(`link`),p.rel=`icon`,document.head.appendChild(p)),r.faviconUrl&&(p.href=r.faviconUrl),r.appName&&(document.title=r.appName)},[u,c,r]),(0,a.jsx)(S.Provider,{value:{theme:u,setTheme:e=>{o||l(e)},toggleTheme:()=>{o||l(u===`light`?`dark`:`light`)},isSystem:c===`system`,setIsSystem:e=>{o||l(e?`system`:u)},config:r,activeConfig:r,canSwitchTheme:s},children:e})}var T=()=>{let e=(0,i.useContext)(S);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e},E=null,D=null,O=null,k=null,ee=null;function te(e){let t=e.projectId||``;if((0,o.getApps)().length&&ee===t){E=(0,o.getApp)(),D=(0,s.getAuth)(E);try{O=(0,c.initializeFirestore)(E,{localCache:(0,c.persistentLocalCache)({tabManager:(0,c.persistentMultipleTabManager)()})})}catch{O=(0,c.getFirestore)(E)}k=(0,l.getStorage)(E);return}if((0,o.getApps)().length&&ee!==t)try{(0,o.deleteApp)((0,o.getApp)())}catch{}E=(0,o.initializeApp)(e),ee=t,D=(0,s.getAuth)(E);try{O=(0,c.initializeFirestore)(E,{localCache:(0,c.persistentLocalCache)({tabManager:(0,c.persistentMultipleTabManager)()})})}catch{O=(0,c.getFirestore)(E)}k=(0,l.getStorage)(E)}function A(e){try{return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_ADMIN_EMAILS:void 0,VITE_FIREBASE_API_KEY:void 0,VITE_FIREBASE_APP_ID:void 0,VITE_FIREBASE_AUTH_DOMAIN:void 0,VITE_FIREBASE_MESSAGING_SENDER_ID:void 0,VITE_FIREBASE_PROJECT_ID:void 0,VITE_FIREBASE_STORAGE_BUCKET:void 0}?.[e]||``}catch{return``}}var j=[`VITE_FIREBASE_API_KEY`,`VITE_FIREBASE_AUTH_DOMAIN`,`VITE_FIREBASE_PROJECT_ID`,`VITE_FIREBASE_STORAGE_BUCKET`,`VITE_FIREBASE_MESSAGING_SENDER_ID`,`VITE_FIREBASE_APP_ID`],ne={VITE_FIREBASE_API_KEY:`apiKey`,VITE_FIREBASE_AUTH_DOMAIN:`authDomain`,VITE_FIREBASE_PROJECT_ID:`projectId`,VITE_FIREBASE_STORAGE_BUCKET:`storageBucket`,VITE_FIREBASE_MESSAGING_SENDER_ID:`messagingSenderId`,VITE_FIREBASE_APP_ID:`appId`};function re(){let e={};for(let t of j){let n=A(t);if(!n)return null;e[ne[t]]=n}return e}var M=re();M&&!(0,o.getApps)().length&&te(M);var N=new Map;function P(e,t,n,r){let i=N.get(e);if(!i){let n={subscribers:new Set,stop:()=>{},last:null,refused:void 0};N.set(e,n),n.stop=(0,c.onSnapshot)(t(),e=>{n.last=e,n.refused=void 0,n.subscribers.forEach(t=>F(()=>t.next(e)))},e=>{n.refused=e,n.subscribers.forEach(t=>F(()=>t.fail(e)))}),i=n}let a={next:n,fail:r};return i.subscribers.add(a),i.last?F(()=>n(i.last)):i.refused!==void 0&&F(()=>r(i.refused)),()=>{let t=N.get(e);!t||!t.subscribers.delete(a)||t.subscribers.size===0&&(t.stop(),N.delete(e))}}function F(e){try{e()}catch(e){console.error(`A screen could not take a shared Firestore answer`,e)}}var ie=[`user`,`internal`,`admin`],I=e=>ie.includes(e),L={user:`Members`,internal:`Your team`,admin:`Admins`},ae={user:`user-round`,internal:`users`,admin:`shield`},oe=`id-card`,R=[],z={},se={},ce=e=>{R=e},le=()=>R,ue=e=>{z=e},de=e=>{se=e},fe=e=>I(e)&&String(se[e]||``).trim()||``,pe=e=>I(e)&&String(z[e]||``).trim()||``,me=(e,t=le())=>t.find(t=>t.id===e)?.name||pe(e)||(I(e)?L[e]:``)||e,he=(e=le())=>[...ie.map(t=>({id:t,name:me(t,e)})),...e.map(e=>({id:e.id,name:e.name}))],ge=`sys_payments`,_e=`_settings`,ve=()=>({on:!1,amount:``,priceId:``,livePriceId:``}),ye=()=>({name:``,description:``,monthly:{...ve(),on:!0},yearly:ve(),roleId:``}),be=()=>({name:``,amount:``}),xe=e=>({id:e,name:``,description:``,kind:``,amount:``,items:[],plans:[],how:``,emailReceipt:!0,notifyOwner:!0,pageIds:[],customNote:``,customPath:``,createdAt:Date.now()}),Se=e=>e.kind===`once`?e.items.length?e.items:e.name.trim()||e.amount.trim()?[{name:e.name,amount:e.amount}]:[]:[],Ce=e=>{let t=Number(String(e||``).trim().replace(/[^0-9.]/g,``));return Number.isFinite(t)&&t>0?t:null},we=e=>({on:!!e?.on,amount:String(e?.amount||``),priceId:String(e?.priceId||``),livePriceId:String(e?.livePriceId||``)}),Te=e=>/^(no|none|nothing|n\/?a|nothing needed|nothing else|-)[.!]*$/i.test(e.trim()),Ee=e=>/[.!?]$/.test(e)?e:`${e}.`,De=e=>{let t=[],n=String(e?.how||``),r=String(e?.collect||``).trim();r&&!Te(r)&&t.push(`Before paying, the buyer tells me: ${Ee(r)}`);let i=String(e?.after||``).trim();if(i&&t.push(`After they pay: ${Ee(i)}`),Array.isArray(e?.plans))for(let n of e.plans){let e=String(n?.name||``).trim()||`The plan`,r=String(n?.features||``).trim(),i=String(n?.sees||``).trim();r&&t.push(`${e} unlocks: ${Ee(r)}`),i&&t.push(`Someone on ${e} sees: ${Ee(i)}`)}return t.length?[...n.trim()?[Ee(n.trim())]:[],...t].join(` `):n},Oe=(e,n)=>{let r=n?.kind===`once`||n?.kind===`subscription`?n.kind:``,i=Array.isArray(n?.items)?n.items.map(e=>({name:String(e?.name||``),amount:String(e?.amount||``)})):[],a=String(n?.name||``),o=String(n?.amount||``);return r===`once`&&!i.length&&(a.trim()||o.trim())&&(i=[{name:a,amount:o}],a=``,o=``),{id:e,name:a,description:String(n?.description||``),kind:r,amount:o,items:i,plans:Array.isArray(n?.plans)?n.plans.map(e=>({name:String(e?.name||``),description:String(e?.description||``),monthly:we(e?.monthly),yearly:we(e?.yearly),roleId:t.h(e?.roleId)?String(e.roleId):``})):[],how:De(n),emailReceipt:n?.emailReceipt!==!1,notifyOwner:n?.notifyOwner!==!1,pageIds:Array.isArray(n?.pageIds)?n.pageIds.map(e=>String(e||``)).filter(Boolean):[],customNote:String(n?.customNote||``),customPath:String(n?.customPath||``),createdAt:typeof n?.createdAt==`number`?n.createdAt:void 0}},ke=e=>/^price_[A-Za-z0-9]+$/.test(e.trim()),Ae=(e,t=ct())=>t?e.livePriceId:e.priceId;function je(e,t=ct()){if(!e.kind)return`Say how it is paid — once, or a subscription.`;if(e.kind===`once`){let t=Se(e);if(!t.length)return`Add something to sell — a name and a price.`;for(let e of t){let t=e.name.trim();if(Ce(e.amount)===null)return`Give ${t||`it`} a price — just a number, like 25.`;if(!t)return`Give it a name, the way a buyer should read it.`}return``}if(!e.plans.length)return`Add at least one plan.`;for(let n of e.plans){let e=n.name.trim()||`each plan`;if(!n.name.trim())return`Give each plan a name.`;if(!n.monthly.on&&!n.yearly.on)return`Turn on monthly or yearly for ${e}.`;for(let[r,i]of[[`monthly`,n.monthly],[`yearly`,n.yearly]])if(i.on){if(Ce(i.amount)===null)return`Give ${e} its ${r} price — just a number.`;if(!ke(Ae(i,t)))return t?`Paste the live ${r} price id for ${e} — live mode is a fresh Stripe catalogue, so the price is made again there. Your test id is kept.`:`Paste the ${r} price id for ${e} — the steps above say where it comes from in Stripe.`}}return``}var Me=(e,t=ct())=>je(e,t)===``,Ne=e=>e.kind===`subscription`&&e.plans.length>0&&e.plans.every(e=>e.name.trim()!==``&&(e.monthly.on||e.yearly.on)&&(!e.monthly.on||Ce(e.monthly.amount)!==null)&&(!e.yearly.on||Ce(e.yearly.amount)!==null));function Pe(e){let t=e.name.trim();if(t)return t;let n=Se(e).map(e=>e.name.trim()).filter(Boolean);if(n.length===1)return n[0];if(n.length>1){let e=n.slice(0,3),t=n.length>3?`more`:e.pop();return`${e.join(`, `)} and ${t}`}return`this product`}function Fe(e){let t=e.name.trim();if(!e.kind)return t?`${t} — say how it is paid`:`A new product — say how it is paid`;if(e.kind===`once`){let n=Se(e);if(n.length<=1){let e=n[0],r=e?.name.trim()||t,i=e?.amount.trim();return`${r||`A new product`}${i?` — ${i}, paid once`:` — paid once`}`}return`${t||n.map(e=>e.name.trim()).filter(Boolean).slice(0,3).join(`, `)||`A new product`} — ${n.length} things, paid once`}let n=e.plans.length;return`${t||`A new subscription`} — a subscription${n?`, ${n} plan${n===1?``:`s`}`:``}`}function Ie(e,t,n=ct()){let r=e.name.trim(),i=`${t.name.trim()||`this plan`}${r?` — ${r}`:``}`,a=t.description.trim(),o=t.monthly.on&&t.yearly.on,s=t.monthly.on?t.monthly:t.yearly,c=t.monthly.on?`Monthly`:`Yearly`,l=[n?`In your Stripe dashboard, switch Test mode OFF — live mode is its own catalogue, so the plan is made once more there. Then open Product catalogue and click Add product.`:`In your Stripe dashboard, open Product catalogue and click Add product.`,`Name it "${i}"${a?` and paste your one-liner into the Description box: "${a}"`:``}.`,`On the same form, choose Recurring, type ${s.amount.trim()||`…`} as the amount, set the billing period to ${c}, and click Add product to save.`,o?`Click the product you just made, then click its ${c.toLowerCase()} price. The price id — it starts with price_ — sits in the top right corner: copy it and paste it into the ${c.toLowerCase()} box below.`:`Click the product you just made, then click the price inside it. The price id — it starts with price_ — sits in the top right corner: copy it and paste it into the box below.`];return o&&l.push(`Go back to the product. In its Pricing section click + to add a second price: Recurring, ${t.yearly.amount.trim()||`…`} as the amount, billing period Yearly — save it.`,`Click that yearly price, copy its id from the top right corner, and paste it into the yearly box below.`),l}var Le=e=>e.includes(`'`)?`"${e}"`:`'${e}'`,Re=`Every payment goes through the app's own <PayButton> — never build a checkout, a card form or Stripe code of your own. The button's words, colour and place on the page are yours to design.`,ze=(e,t=ct())=>{let n=e.name.trim()||`this product`,r=e.description.trim();if(e.kind===`once`){let t=Se(e),r=e=>`<PayButton amount={${Ce(e.amount)??0}} productName=${Le(e.name.trim())}>`;if(t.length<=1){let i=t[0]||{name:e.name,amount:e.amount};return[`It sells ${i.name.trim()||n} for ${i.amount.trim()}, paid once: ${r(i)}.`]}let i=e.name.trim();return[`It sells ${t.length} things${i?` under ${i}`:``}, each paid once with its own button:`,...t.map(e=>`${e.name.trim()||`Something`} for ${e.amount.trim()}: ${r(e)}.`)]}let i=[`It sells ${n}${r?` (${r})`:``} as a subscription. Lay its plans out as one pricing section — each plan is bought with its own button, and where a plan has monthly and yearly, offer a monthly/yearly switch:`];for(let n of e.plans){let e=n.name.trim()||`Plan`,r=n.description.trim(),a=[];n.monthly.on&&a.push(`${n.monthly.amount.trim()} per month: <PayButton priceId='${Ae(n.monthly,t).trim()}' mode='subscription'>`),n.yearly.on&&a.push(`${n.yearly.amount.trim()} per year: <PayButton priceId='${Ae(n.yearly,t).trim()}' mode='subscription'>`);let o=n.roleId?` Buying it makes the buyer my ${me(n.roleId)} role — userRole '${n.roleId}'.`:``;i.push(`${e}${r?` (${r})`:``} — ${a.join(`; `)}.${o}`)}return i},Be=`If my words ask the buyer for anything before paying — a phone number, a note, what they need — ask it with a form made the app's way: a *Form.config.ts whose fields are properly typed (tel for a phone number, email, date), shown with <ContactPopup formId='…' isInline onSubmitted={…} /> — never inputs you build by hand. onSubmitted hands you the answers as strings: put each one into the button's metadata as a plain string, and they read beside the order on my Payments screen. If my words ask for nothing, put no form in front of the button. Never ask for their email (Stripe collects it at checkout) and never build a backend of your own for this.`,Ve=`Show and hide what a plan unlocks with the app's own useMyPayments() — it returns { loading, active, subscriptions, payments } — and that is presentation, not protection: anything genuinely paid, like a file or a secret, must come from the server.`,He=`A plan's role is given the moment the buyer pays and taken back when the subscription ends — the app does both itself, so build neither. What that plan unlocks is what its role opens: a page kept for the role, and anything a page shows to it — read const { userRole } = useAuth() from 'your-ai-workflow-firebase-os' and compare it with the role's word above. Gate that by the role, never with useMyPayments().`;function Ue(e,t=``,n=ct()){let r=[...ze(e,n)],i=e.how.trim();return i&&r.push(`Here is how this payment should work, start to finish: ${i}`),r.push(Be),e.kind===`subscription`&&(e.plans.some(e=>e.roleId)&&r.push(He),e.plans.some(e=>!e.roleId)&&r.push(Ve)),r.push(...We(t,e)),r}function We(e,t){let n=[`Set each button's successPath to ${e||`the page the button is on`} so the buyer lands back where they paid and finds what my words say happens after.`],r=[];return t.emailReceipt&&r.push(`emailReceipt: 'yes'`),t.notifyOwner&&r.push(`notifyOwner: 'yes'`),r.length&&n.push(`Put ${r.join(` and `)} in the button's metadata — the app then sends ${r.length===2?`those emails`:`that email`} on its own.`),n}var Ge=e=>e===`internal`||e===`admin`,Ke=e=>Array.isArray(e?.links)?e.links.map(e=>({pageId:String(e?.pageId||``),how:String(e?.how||``)})):[],qe=(e,t)=>t.find(t=>t.id===e)||t.find(t=>String(t.config?.contentKey||``).trim()===e),Je=(e,t)=>e===t.id||e===String(t.config?.contentKey||``).trim();function Ye(e){return e.how.trim()?``:`Describe how this payment will work.`}var Xe=(e,t)=>e.pageIds.some(e=>Je(e,t)),Ze=(e,t)=>Xe(e,t)?e.pageIds.filter(e=>!Je(e,t)):[...e.pageIds,t.id],Qe=`What people paid is mine and my admins' alone: the app refuses everybody else the sales outright, so never call useSales() on this page and never put an amount on it. Show what an admin's own page has recorded about a sale — the name, what they bought, when — and if what I asked for cannot be built without the amounts, say so plainly in your reply: the page has to be kept for Admins for that. This page never sells — no <PayButton> on it.`,$e="Read the sales on it with the app's own useSales() from 'your-ai-workflow-firebase-os' — it returns { loading, charges, subscriptions, error } live from my Stripe account: who paid, for what, when, and each subscription's current status. Show `error` when it is set. Design the list however fits; never write Stripe code, a backend or an export of your own for it. This page never sells — no <PayButton> on it.",et=e=>`/payments?new=subscription&page=${encodeURIComponent(e)}`,tt=(e,t)=>`/payments?open=${encodeURIComponent(e)}&page=${encodeURIComponent(t)}`,nt=(e,t)=>`/pages/${encodeURIComponent(e)}?addPayment=${encodeURIComponent(t)}`,rt=[],it=!1,at=e=>{rt=e},ot=()=>rt,st=e=>{it=e},ct=()=>it;function lt(e){let t=[];for(let n of e)if(n.kind===`subscription`)for(let e of n.plans)for(let[r,i]of[[`monthly`,e.monthly],[`yearly`,e.yearly]]){if(!i.on)continue;let a=i.priceId.trim(),o=i.livePriceId.trim();ke(o)&&ke(a)&&a!==o&&t.push({product:n.name.trim()||`a subscription`,plan:e.name.trim()||`its plan`,word:r,from:a,to:o})}return t}function ut(e=ot()){let t=lt(e),n=[`My Stripe account has switched from test mode to live mode. I have already replaced the keys in Secrets — do not touch any keys or write any Stripe code of your own.`];return t.length?n.push(`In my pages, every <PayButton> with a priceId still carries a test price id. Swap each one for its live id and change nothing else about the button:`,...t.map(e=>`For ${e.product}, ${e.plan} (${e.word}): replace '${e.from}' with '${e.to}'.`),`Buttons that use amount={…} instead of a priceId need no change.`):n.push(`No price id in my pages needs to change — buttons that use amount={…} never had one.`),n.push(`Then rebuild the app so it runs with the live keys and ids.`),n.join(`
|
|
1
|
+
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./verifiedAccount-BqmmFNkc.cjs`),n=require(`./lucide-react-NE2zYbRL.cjs`),r=require(`./address-COc6hg_p.cjs`);let i=require(`react`);i=e.a(i,1);let a=require(`react/jsx-runtime`),o=require(`firebase/app`),s=require(`firebase/auth`),c=require(`firebase/firestore`),l=require(`firebase/storage`),u=require(`react-router-dom`),d=require(`react-dom`);var f=e.r({contactFormConfig:()=>p}),p={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}]},m=e.r({supportFormConfig:()=>h}),h={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}]},g={appName:`Your AI Firebase`,defaultTheme:`light`,showThemeToggle:!0,logoUrl:`https://firebasestorage.googleapis.com/v0/b/fir-os-47863.firebasestorage.app/o/pub_files%2F1776321238933_favicon_smaller.png?alt=media&token=efecb55c-2456-4cbe-a20a-b86db54a1e55`,faviconUrl:`https://firebasestorage.googleapis.com/v0/b/fir-os-47863.firebasestorage.app/o/pub_files%2F1776321238933_favicon_smaller.png?alt=media&token=efecb55c-2456-4cbe-a20a-b86db54a1e55`,colors:{dark:{background:`#07070f`,backgroundSecondary:`#0a0a18`,foreground:`#f0eeff`,accent:`#a78bfa`,buttonText:`#ffffff`},light:{background:`#fcfaff`,backgroundSecondary:`#f7f3ff`,foreground:`#1e1b4b`,accent:`#7c3aed`,buttonText:`#ffffff`}},cornerRounding:`default`,cornerRadii:{buttonRadius:.75,inputRadius:.75,cardRadius:1.5,modalRadius:2.5}},_=(0,i.createContext)({});function v({config:e,children:t}){return(0,a.jsx)(_.Provider,{value:e,children:t})}var y=()=>(0,i.useContext)(_),b=`1.14.41`,x=typeof window<`u`?i.useLayoutEffect:i.useEffect,S=(0,i.createContext)(void 0),C=e=>{let t=e?.defaultTheme;return t!==`light`&&t!==`dark`||e?.showThemeToggle?null:t};function w({children:e,scopeSelector:t}){let n=y(),r=(0,i.useMemo)(()=>n?.themeConfig||g,[n?.themeConfig]),o=C(r),s=!!r.showThemeToggle;(0,i.useEffect)(()=>{try{localStorage.removeItem(`theme_config_cache`),localStorage.removeItem(`theme_saved_cache`)}catch{}console.info(`Your AI Firebase ${b} · colours from theme.config.ts`)},[]);let[c,l]=(0,i.useState)(()=>{if(o)return o;if(typeof window>`u`)return r.defaultTheme||`system`;let e=localStorage.getItem(`theme-mode`),t=localStorage.getItem(`last-seen-default-theme`);return r.defaultTheme&&r.defaultTheme!==t?(localStorage.setItem(`last-seen-default-theme`,r.defaultTheme),localStorage.removeItem(`theme-mode`),r.defaultTheme):e||r.defaultTheme||`system`}),[u,d]=(0,i.useState)(()=>{if(o)return o;if(typeof window>`u`)return r.defaultTheme===`light`?`light`:`dark`;let e=localStorage.getItem(`theme-mode`),t=localStorage.getItem(`last-seen-default-theme`),n=e||r.defaultTheme||`system`;return r.defaultTheme&&r.defaultTheme!==t&&(n=r.defaultTheme),n===`system`?window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`:n});return(0,i.useEffect)(()=>{let e=r.defaultTheme;e&&(o&&l(o),e!==localStorage.getItem(`last-seen-default-theme`)&&(localStorage.setItem(`last-seen-default-theme`,e),localStorage.removeItem(`theme-mode`),l(e)))},[r.defaultTheme,o]),(0,i.useEffect)(()=>{let e=e=>{c===`system`&&d(e.matches?`light`:`dark`)},t=window.matchMedia(`(prefers-color-scheme: light)`);return c===`system`?(d(t.matches?`light`:`dark`),t.addEventListener(`change`,e)):d(c),()=>t.removeEventListener(`change`,e)},[c]),x(()=>{let e=(t?document.querySelector(t):document.documentElement)||document.documentElement,n=u===`dark`?r.colors.dark:r.colors.light;e.style.setProperty(`--bg-color`,n.background),e.style.setProperty(`--bg-secondary-color`,n.backgroundSecondary||n.background),e.style.setProperty(`--fg-color`,n.foreground),e.style.setProperty(`--accent-color`,n.accent);let i=u===`dark`;e.style.setProperty(`--panel-bg`,n.panelBg||`color-mix(in srgb, ${n.accent} ${i?`5%`:`4%`}, transparent)`),e.style.setProperty(`--panel-border`,n.panelBorder||`color-mix(in srgb, ${n.accent} 15%, transparent)`);let a=(e,t,n)=>{if(!e||e.length===0)return t||`transparent`;if(e.length===1)return e[0];let r=e.map((t,n)=>`${t} ${Math.round(n/(e.length-1)*100)}%`).join(`, `);return n===`conic`?`conic-gradient(from 180deg at 50% 100%, ${r})`:`linear-gradient(135deg, ${r})`},o=`linear-gradient(135deg, color-mix(in oklab, ${n.accent} ${i?`70%`:`78%`}, black) 0%, ${n.accent} 100%)`,s=`linear-gradient(135deg, color-mix(in oklab, ${n.accent} ${i?`80%`:`85%`}, black) 0%, color-mix(in oklab, ${n.accent} 72%, white) 100%)`;e.style.setProperty(`--button-bg`,a(n.buttonGradient,o,n.buttonGradientShape)),e.style.setProperty(`--button-fg`,n.buttonText||`#ffffff`),e.style.setProperty(`--button-hover-bg`,a(n.buttonHoverGradient||n.buttonGradient,s,n.buttonGradientShape)),e.style.setProperty(`--text-gradient`,a(n.textGradient,`linear-gradient(135deg, ${n.foreground} 0%, ${n.accent} 100%)`)),e.style.setProperty(`--glow-color`,n.glowColor||`color-mix(in srgb, ${n.accent} ${i?`40%`:`30%`}, transparent)`),e.style.setProperty(`--notification-icon-color`,n.notificationIconColor||n.accent);let l=n.secondaryButton?.bg||(u===`dark`?`rgba(255, 255, 255, 0.05)`:`rgba(0, 0, 0, 0.03)`),d=n.secondaryButton?.border||(u===`dark`?`rgba(255, 255, 255, 0.1)`:`rgba(0, 0, 0, 0.06)`),f=n.secondaryButton?.text||n.foreground;if(e.style.setProperty(`--btn-sec-bg`,l),e.style.setProperty(`--btn-sec-border`,d),e.style.setProperty(`--btn-sec-text`,f),e.style.setProperty(`--selection-bg`,n.selectionBg||`color-mix(in srgb, var(--accent-color) 40%, transparent)`),e.style.setProperty(`--selection-text`,n.selectionText||`#ffffff`),e.setAttribute(`data-theme`,u),localStorage.setItem(`theme-mode`,c),r.cornerRounding===`custom`&&r.cornerRadii?(e.style.setProperty(`--btn-radius`,`${parseFloat(String(r.cornerRadii.buttonRadius))||0}rem`),e.style.setProperty(`--card-radius`,`${parseFloat(String(r.cornerRadii.cardRadius))||0}rem`),e.style.setProperty(`--input-radius`,`${parseFloat(String(r.cornerRadii.inputRadius))||0}rem`),e.style.setProperty(`--modal-radius`,`${parseFloat(String(r.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 p=document.querySelector(`link[rel*='icon']`);p||(p=document.createElement(`link`),p.rel=`icon`,document.head.appendChild(p)),r.faviconUrl&&(p.href=r.faviconUrl),r.appName&&(document.title=r.appName)},[u,c,r]),(0,a.jsx)(S.Provider,{value:{theme:u,setTheme:e=>{o||l(e)},toggleTheme:()=>{o||l(u===`light`?`dark`:`light`)},isSystem:c===`system`,setIsSystem:e=>{o||l(e?`system`:u)},config:r,activeConfig:r,canSwitchTheme:s},children:e})}var T=()=>{let e=(0,i.useContext)(S);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e},E=null,D=null,O=null,k=null,ee=null;function te(e){let t=e.projectId||``;if((0,o.getApps)().length&&ee===t){E=(0,o.getApp)(),D=(0,s.getAuth)(E);try{O=(0,c.initializeFirestore)(E,{localCache:(0,c.persistentLocalCache)({tabManager:(0,c.persistentMultipleTabManager)()})})}catch{O=(0,c.getFirestore)(E)}k=(0,l.getStorage)(E);return}if((0,o.getApps)().length&&ee!==t)try{(0,o.deleteApp)((0,o.getApp)())}catch{}E=(0,o.initializeApp)(e),ee=t,D=(0,s.getAuth)(E);try{O=(0,c.initializeFirestore)(E,{localCache:(0,c.persistentLocalCache)({tabManager:(0,c.persistentMultipleTabManager)()})})}catch{O=(0,c.getFirestore)(E)}k=(0,l.getStorage)(E)}function A(e){try{return{BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_ADMIN_EMAILS:void 0,VITE_FIREBASE_API_KEY:void 0,VITE_FIREBASE_APP_ID:void 0,VITE_FIREBASE_AUTH_DOMAIN:void 0,VITE_FIREBASE_MESSAGING_SENDER_ID:void 0,VITE_FIREBASE_PROJECT_ID:void 0,VITE_FIREBASE_STORAGE_BUCKET:void 0}?.[e]||``}catch{return``}}var j=[`VITE_FIREBASE_API_KEY`,`VITE_FIREBASE_AUTH_DOMAIN`,`VITE_FIREBASE_PROJECT_ID`,`VITE_FIREBASE_STORAGE_BUCKET`,`VITE_FIREBASE_MESSAGING_SENDER_ID`,`VITE_FIREBASE_APP_ID`],ne={VITE_FIREBASE_API_KEY:`apiKey`,VITE_FIREBASE_AUTH_DOMAIN:`authDomain`,VITE_FIREBASE_PROJECT_ID:`projectId`,VITE_FIREBASE_STORAGE_BUCKET:`storageBucket`,VITE_FIREBASE_MESSAGING_SENDER_ID:`messagingSenderId`,VITE_FIREBASE_APP_ID:`appId`};function re(){let e={};for(let t of j){let n=A(t);if(!n)return null;e[ne[t]]=n}return e}var M=re();M&&!(0,o.getApps)().length&&te(M);var N=new Map;function P(e,t,n,r){let i=N.get(e);if(!i){let n={subscribers:new Set,stop:()=>{},last:null,refused:void 0};N.set(e,n),n.stop=(0,c.onSnapshot)(t(),e=>{n.last=e,n.refused=void 0,n.subscribers.forEach(t=>F(()=>t.next(e)))},e=>{n.refused=e,n.subscribers.forEach(t=>F(()=>t.fail(e)))}),i=n}let a={next:n,fail:r};return i.subscribers.add(a),i.last?F(()=>n(i.last)):i.refused!==void 0&&F(()=>r(i.refused)),()=>{let t=N.get(e);!t||!t.subscribers.delete(a)||t.subscribers.size===0&&(t.stop(),N.delete(e))}}function F(e){try{e()}catch(e){console.error(`A screen could not take a shared Firestore answer`,e)}}var ie=[`user`,`internal`,`admin`],I=e=>ie.includes(e),L={user:`Members`,internal:`Your team`,admin:`Admins`},ae={user:`user-round`,internal:`users`,admin:`shield`},oe=`id-card`,R=[],z={},se={},ce=e=>{R=e},le=()=>R,ue=e=>{z=e},de=e=>{se=e},fe=e=>I(e)&&String(se[e]||``).trim()||``,pe=e=>I(e)&&String(z[e]||``).trim()||``,me=(e,t=le())=>t.find(t=>t.id===e)?.name||pe(e)||(I(e)?L[e]:``)||e,he=(e=le())=>[...ie.map(t=>({id:t,name:me(t,e)})),...e.map(e=>({id:e.id,name:e.name}))],ge=`sys_payments`,_e=`_settings`,ve=()=>({on:!1,amount:``,priceId:``,livePriceId:``}),ye=()=>({name:``,description:``,monthly:{...ve(),on:!0},yearly:ve(),roleId:``}),be=()=>({name:``,amount:``}),xe=e=>({id:e,name:``,description:``,kind:``,amount:``,items:[],plans:[],how:``,emailReceipt:!0,notifyOwner:!0,pageIds:[],customNote:``,customPath:``,createdAt:Date.now()}),Se=e=>e.kind===`once`?e.items.length?e.items:e.name.trim()||e.amount.trim()?[{name:e.name,amount:e.amount}]:[]:[],Ce=e=>{let t=Number(String(e||``).trim().replace(/[^0-9.]/g,``));return Number.isFinite(t)&&t>0?t:null},we=e=>({on:!!e?.on,amount:String(e?.amount||``),priceId:String(e?.priceId||``),livePriceId:String(e?.livePriceId||``)}),Te=e=>/^(no|none|nothing|n\/?a|nothing needed|nothing else|-)[.!]*$/i.test(e.trim()),Ee=e=>/[.!?]$/.test(e)?e:`${e}.`,De=e=>{let t=[],n=String(e?.how||``),r=String(e?.collect||``).trim();r&&!Te(r)&&t.push(`Before paying, the buyer tells me: ${Ee(r)}`);let i=String(e?.after||``).trim();if(i&&t.push(`After they pay: ${Ee(i)}`),Array.isArray(e?.plans))for(let n of e.plans){let e=String(n?.name||``).trim()||`The plan`,r=String(n?.features||``).trim(),i=String(n?.sees||``).trim();r&&t.push(`${e} unlocks: ${Ee(r)}`),i&&t.push(`Someone on ${e} sees: ${Ee(i)}`)}return t.length?[...n.trim()?[Ee(n.trim())]:[],...t].join(` `):n},Oe=(e,n)=>{let r=n?.kind===`once`||n?.kind===`subscription`?n.kind:``,i=Array.isArray(n?.items)?n.items.map(e=>({name:String(e?.name||``),amount:String(e?.amount||``)})):[],a=String(n?.name||``),o=String(n?.amount||``);return r===`once`&&!i.length&&(a.trim()||o.trim())&&(i=[{name:a,amount:o}],a=``,o=``),{id:e,name:a,description:String(n?.description||``),kind:r,amount:o,items:i,plans:Array.isArray(n?.plans)?n.plans.map(e=>({name:String(e?.name||``),description:String(e?.description||``),monthly:we(e?.monthly),yearly:we(e?.yearly),roleId:t.h(e?.roleId)?String(e.roleId):``})):[],how:De(n),emailReceipt:n?.emailReceipt!==!1,notifyOwner:n?.notifyOwner!==!1,pageIds:Array.isArray(n?.pageIds)?n.pageIds.map(e=>String(e||``)).filter(Boolean):[],customNote:String(n?.customNote||``),customPath:String(n?.customPath||``),createdAt:typeof n?.createdAt==`number`?n.createdAt:void 0}},ke=e=>/^price_[A-Za-z0-9]+$/.test(e.trim()),Ae=(e,t=ct())=>t?e.livePriceId:e.priceId;function je(e,t=ct()){if(!e.kind)return`Say how it is paid — once, or a subscription.`;if(e.kind===`once`){let t=Se(e);if(!t.length)return`Add something to sell — a name and a price.`;for(let e of t){let t=e.name.trim();if(Ce(e.amount)===null)return`Give ${t||`it`} a price — just a number, like 25.`;if(!t)return`Give it a name, the way a buyer should read it.`}return``}if(!e.plans.length)return`Add at least one plan.`;for(let n of e.plans){let e=n.name.trim()||`each plan`;if(!n.name.trim())return`Give each plan a name.`;if(!n.monthly.on&&!n.yearly.on)return`Turn on monthly or yearly for ${e}.`;for(let[r,i]of[[`monthly`,n.monthly],[`yearly`,n.yearly]])if(i.on){if(Ce(i.amount)===null)return`Give ${e} its ${r} price — just a number.`;if(!ke(Ae(i,t)))return t?`Paste the live ${r} price id for ${e} — live mode is a fresh Stripe catalogue, so the price is made again there. Your test id is kept.`:`Paste the ${r} price id for ${e} — the steps above say where it comes from in Stripe.`}}return``}var Me=(e,t=ct())=>je(e,t)===``,Ne=e=>e.kind===`subscription`&&e.plans.length>0&&e.plans.every(e=>e.name.trim()!==``&&(e.monthly.on||e.yearly.on)&&(!e.monthly.on||Ce(e.monthly.amount)!==null)&&(!e.yearly.on||Ce(e.yearly.amount)!==null));function Pe(e){let t=e.name.trim();if(t)return t;let n=Se(e).map(e=>e.name.trim()).filter(Boolean);if(n.length===1)return n[0];if(n.length>1){let e=n.slice(0,3),t=n.length>3?`more`:e.pop();return`${e.join(`, `)} and ${t}`}return`this product`}function Fe(e){let t=e.name.trim();if(!e.kind)return t?`${t} — say how it is paid`:`A new product — say how it is paid`;if(e.kind===`once`){let n=Se(e);if(n.length<=1){let e=n[0],r=e?.name.trim()||t,i=e?.amount.trim();return`${r||`A new product`}${i?` — ${i}, paid once`:` — paid once`}`}return`${t||n.map(e=>e.name.trim()).filter(Boolean).slice(0,3).join(`, `)||`A new product`} — ${n.length} things, paid once`}let n=e.plans.length;return`${t||`A new subscription`} — a subscription${n?`, ${n} plan${n===1?``:`s`}`:``}`}function Ie(e,t,n=ct()){let r=e.name.trim(),i=`${t.name.trim()||`this plan`}${r?` — ${r}`:``}`,a=t.description.trim(),o=t.monthly.on&&t.yearly.on,s=t.monthly.on?t.monthly:t.yearly,c=t.monthly.on?`Monthly`:`Yearly`,l=[n?`In your Stripe dashboard, switch Test mode OFF — live mode is its own catalogue, so the plan is made once more there. Then open Product catalogue and click Add product.`:`In your Stripe dashboard, open Product catalogue and click Add product.`,`Name it "${i}"${a?` and paste your one-liner into the Description box: "${a}"`:``}.`,`On the same form, choose Recurring, type ${s.amount.trim()||`…`} as the amount, set the billing period to ${c}, and click Add product to save.`,o?`Click the product you just made, then click its ${c.toLowerCase()} price. The price id — it starts with price_ — sits in the top right corner: copy it and paste it into the ${c.toLowerCase()} box below.`:`Click the product you just made, then click the price inside it. The price id — it starts with price_ — sits in the top right corner: copy it and paste it into the box below.`];return o&&l.push(`Go back to the product. In its Pricing section click + to add a second price: Recurring, ${t.yearly.amount.trim()||`…`} as the amount, billing period Yearly — save it.`,`Click that yearly price, copy its id from the top right corner, and paste it into the yearly box below.`),l}var Le=e=>e.includes(`'`)?`"${e}"`:`'${e}'`,Re=`Every payment goes through the app's own <PayButton> — never build a checkout, a card form or Stripe code of your own. The button's words, colour and place on the page are yours to design.`,ze=(e,t=ct())=>{let n=e.name.trim()||`this product`,r=e.description.trim();if(e.kind===`once`){let t=Se(e),r=e=>`<PayButton amount={${Ce(e.amount)??0}} productName=${Le(e.name.trim())}>`;if(t.length<=1){let i=t[0]||{name:e.name,amount:e.amount};return[`It sells ${i.name.trim()||n} for ${i.amount.trim()}, paid once: ${r(i)}.`]}let i=e.name.trim();return[`It sells ${t.length} things${i?` under ${i}`:``}, each paid once with its own button:`,...t.map(e=>`${e.name.trim()||`Something`} for ${e.amount.trim()}: ${r(e)}.`)]}let i=[`It sells ${n}${r?` (${r})`:``} as a subscription. Lay its plans out as one pricing section — each plan is bought with its own button, and where a plan has monthly and yearly, offer a monthly/yearly switch:`];for(let n of e.plans){let e=n.name.trim()||`Plan`,r=n.description.trim(),a=[];n.monthly.on&&a.push(`${n.monthly.amount.trim()} per month: <PayButton priceId='${Ae(n.monthly,t).trim()}' mode='subscription'>`),n.yearly.on&&a.push(`${n.yearly.amount.trim()} per year: <PayButton priceId='${Ae(n.yearly,t).trim()}' mode='subscription'>`);let o=n.roleId?` Buying it makes the buyer my ${me(n.roleId)} role — userRole '${n.roleId}'.`:``;i.push(`${e}${r?` (${r})`:``} — ${a.join(`; `)}.${o}`)}return i},Be=`If my words ask the buyer for anything before paying — a phone number, a note, what they need — ask it with a form made the app's way: a *Form.config.ts whose fields are properly typed (tel for a phone number, email, date), shown with <ContactPopup formId='…' isInline onSubmitted={…} /> — never inputs you build by hand. onSubmitted hands you the answers as strings: put each one into the button's metadata as a plain string, and they read beside the order on my Payments screen. If my words ask for nothing, put no form in front of the button. Never ask for their email (Stripe collects it at checkout) and never build a backend of your own for this.`,Ve=`Show and hide what a plan unlocks with the app's own useMyPayments() — it returns { loading, active, subscriptions, payments } — and that is presentation, not protection: anything genuinely paid, like a file or a secret, must come from the server.`,He=`A plan's role is given the moment the buyer pays and taken back when the subscription ends — the app does both itself, so build neither. What that plan unlocks is what its role opens: a page kept for the role, and anything a page shows to it — read const { userRole } = useAuth() from 'your-ai-workflow-firebase-os' and compare it with the role's word above. Gate that by the role, never with useMyPayments().`;function Ue(e,t=``,n=ct()){let r=[...ze(e,n)],i=e.how.trim();return i&&r.push(`Here is how this payment should work, start to finish: ${i}`),r.push(Be),e.kind===`subscription`&&(e.plans.some(e=>e.roleId)&&r.push(He),e.plans.some(e=>!e.roleId)&&r.push(Ve)),r.push(...We(t,e)),r}function We(e,t){let n=[`Set each button's successPath to ${e||`the page the button is on`} so the buyer lands back where they paid and finds what my words say happens after.`],r=[];return t.emailReceipt&&r.push(`emailReceipt: 'yes'`),t.notifyOwner&&r.push(`notifyOwner: 'yes'`),r.length&&n.push(`Put ${r.join(` and `)} in the button's metadata — the app then sends ${r.length===2?`those emails`:`that email`} on its own.`),n}var Ge=e=>e===`internal`||e===`admin`,Ke=e=>Array.isArray(e?.links)?e.links.map(e=>({pageId:String(e?.pageId||``),how:String(e?.how||``)})):[],qe=(e,t)=>t.find(t=>t.id===e)||t.find(t=>String(t.config?.contentKey||``).trim()===e),Je=(e,t)=>e===t.id||e===String(t.config?.contentKey||``).trim();function Ye(e){return e.how.trim()?``:`Describe how this payment will work.`}var Xe=(e,t)=>e.pageIds.some(e=>Je(e,t)),Ze=(e,t)=>Xe(e,t)?e.pageIds.filter(e=>!Je(e,t)):[...e.pageIds,t.id],Qe=`What people paid is mine and my admins' alone: the app refuses everybody else the sales outright, so never call useSales() on this page and never put an amount on it. Show what an admin's own page has recorded about a sale — the name, what they bought, when — and if what I asked for cannot be built without the amounts, say so plainly in your reply: the page has to be kept for Admins for that. This page never sells — no <PayButton> on it.`,$e="Read the sales on it with the app's own useSales() from 'your-ai-workflow-firebase-os' — it returns { loading, charges, subscriptions, error } live from my Stripe account: who paid, for what, when, and each subscription's current status. Show `error` when it is set. Design the list however fits; never write Stripe code, a backend or an export of your own for it. This page never sells — no <PayButton> on it.",et=e=>`/payments?new=subscription&page=${encodeURIComponent(e)}`,tt=(e,t)=>`/payments?open=${encodeURIComponent(e)}&page=${encodeURIComponent(t)}`,nt=(e,t)=>`/pages/${encodeURIComponent(e)}?addPayment=${encodeURIComponent(t)}`,rt=[],it=!1,at=e=>{rt=e},ot=()=>rt,st=e=>{it=e},ct=()=>it;function lt(e){let t=[];for(let n of e)if(n.kind===`subscription`)for(let e of n.plans)for(let[r,i]of[[`monthly`,e.monthly],[`yearly`,e.yearly]]){if(!i.on)continue;let a=i.priceId.trim(),o=i.livePriceId.trim();ke(o)&&ke(a)&&a!==o&&t.push({product:n.name.trim()||`a subscription`,plan:e.name.trim()||`its plan`,word:r,from:a,to:o})}return t}function ut(e=ot()){let t=lt(e),n=[`My Stripe account has switched from test mode to live mode. I have already replaced the keys in Secrets — do not touch any keys or write any Stripe code of your own.`];return t.length?n.push(`In my pages, every <PayButton> with a priceId still carries a test price id. Swap each one for its live id and change nothing else about the button:`,...t.map(e=>`For ${e.product}, ${e.plan} (${e.word}): replace '${e.from}' with '${e.to}'.`),`Buttons that use amount={…} instead of a priceId need no change.`):n.push(`No price id in my pages needs to change — buttons that use amount={…} never had one.`),n.push(`Then rebuild the app so it runs with the live keys and ids.`),n.join(`
|
|
2
2
|
`)}var dt=`admin_keys`,ft=`plans`,pt=()=>({planUntil:(0,c.deleteField)(),planPass:(0,c.deleteField)()}),mt=e=>typeof e?.planUntil==`number`&&e.planUntil>0?e.planUntil:0,ht=e=>mt(e)>0,gt=e=>mt(e);function _t(e){if(!e)return!1;if(ht(e))return!0;let t=e.role;return t==null||t===`user`||t===`free`}function vt(e,t=Date.now()){let n=e?.role?String(e.role):`user`,r=mt(e);return r&&t>=r?`user`:n}function yt(e,n){if(!_t(e))return null;let r=String(n?.role||``);return r?!t.h(r)||typeof n?.until!=`number`||typeof n?.pass!=`string`||e.role===r&&e.planUntil===n.until?null:{role:r,planUntil:n.until,planPass:n.pass}:ht(e)?{role:`user`,...pt()}:null}async function bt(e,n){try{let r=D?.currentUser;if(!r||r.uid!==e||!t.t(r)||typeof fetch!=`function`)return;let i=(0,c.doc)(O,`user_profiles`,e),a=n??(await(0,c.getDoc)(i)).data();if(!_t(a))return;let o=await r.getIdToken(),s=await fetch(`/api/payments/plan-role`,{headers:{Authorization:`Bearer ${o}`}});if(!s.ok)return;let l=yt(a,await s.json());l&&await(0,c.updateDoc)(i,l)}catch{}}function xt(e){(0,i.useEffect)(()=>{let e=!1;return(async()=>{let t=D?.currentUser;if(!t||typeof fetch!=`function`)return;let n=await fetch(`/api/payments/plan-key`,{headers:{Authorization:`Bearer ${await t.getIdToken()}`}});if(!n.ok||e)return;let r=String((await n.json())?.key||``);if(!r)return;let i=(0,c.doc)(O,dt,ft),a=await(0,c.getDoc)(i);!e&&a.data()?.key!==r&&await(0,c.setDoc)(i,{key:r})})().catch(()=>{}),()=>{e=!0}},[e])}function St(e){let t={};for(let n of e)if(n.kind===`subscription`)for(let e of n.plans){if(!e.roleId)continue;let r=e.name.trim()||n.name.trim()||`A plan`,i=t[e.roleId]||=[];i.includes(r)||i.push(r)}return t}function Ct(){let[e,t]=(0,i.useState)({});return(0,i.useEffect)(()=>P(ge,()=>(0,c.collection)(O,ge),e=>{let n=[];e.forEach(e=>{e.id!==`_settings`&&n.push(Oe(e.id,e.data()))}),t(St(n))},()=>{}),[]),e}var wt=e=>`fbos_verify_sent_${e}`,Tt=e=>{if(!e)return!1;try{return localStorage.getItem(wt(e))===`1`}catch{return!1}},Et=e=>{if(e)try{localStorage.setItem(wt(e),`1`)}catch{}},Dt=e=>{if(e)try{localStorage.removeItem(wt(e))}catch{}};async function Ot(e){if(!e?.uid||!e.email)return`failed`;if(Tt(e.uid))return`already`;try{return await(0,s.sendEmailVerification)(e),Et(e.uid),`sent`}catch{return`failed`}}var kt={collection:`sys_configs`,doc:`auth_methods`},At=[`Open console.firebase.google.com and pick your project.`,`In the menu on the left open Authentication, then the Sign-in method tab.`],jt=`https://console.firebase.google.com/`;function Mt(){try{let e=D;return String(e?.app?.options?.authDomain||e?.config?.authDomain||``)}catch{return``}}var Nt=e=>e?`https://${e}/__/auth/handler`:``,Pt=()=>{try{let e=typeof window<`u`?String(window.location?.origin||``):``;return/^https?:\/\//.test(e)?e:``}catch{return``}},Ft=`This is where your app is running right now. When you publish it to your own domain, come back and change this to that address.`,It=`Open the Settings tab, find SMS region policy, and allow every country your people might be signing in from — not only your own. A country left off gets no text at all, and the person waiting for the code is told nothing.`,Lt=[{id:`password`,label:`Email and password`,description:`A password they choose when they register.`,inSentence:`a password`,kind:`signIn`,defaultOn:!0,needsSetup:!1,providerId:`password`,steps:[`Click Email/Password and switch it on.`]},{id:`emailLink`,label:`Email link, no password`,description:`You email them a link. Nothing to remember, nothing to reset.`,inSentence:`an emailed link`,kind:`signIn`,defaultOn:!1,needsSetup:!0,button:`Email me a link`,providerId:`emailLink`,setupTitle:`Set up passwordless sign-in`,steps:[`Click Email/Password, switch on Email link (passwordless sign-in), and save.`]},{id:`google`,label:`Google`,description:`One tap with a Google account.`,inSentence:`Google`,kind:`signIn`,defaultOn:!0,needsSetup:!1,button:`Continue with Google`,providerId:`google.com`,steps:[`Click Add new provider, choose Google, and follow the steps.`]},{id:`phone`,label:`Phone number`,description:`A code by text, and no email at all.`,inSentence:`a phone number`,kind:`signIn`,defaultOn:!1,needsSetup:!0,button:`Continue with a phone number`,providerId:`phone`,steps:[`Click Add new provider, choose Phone, and enable it.`,It,`While you are on the Phone provider, open "Phone numbers for testing" and add one: a number and a six-digit code you make up. Signing in with that pair never sends a text, so you can try the whole thing on your own, as often as you like, for nothing.`]},{id:`github`,label:`GitHub`,description:`A GitHub account — for an app your developers use.`,inSentence:`GitHub`,kind:`signIn`,defaultOn:!1,needsSetup:!0,button:`Continue with GitHub`,providerId:`github.com`,steps:[`Click Add new provider, choose GitHub, and paste in the two things below.`],setup:{where:`GitHub`,url:`https://github.com/settings/developers`,asksFor:[`Client ID`,`Client secret`],steps:[{text:`Sign in at github.com and open Settings → Developer settings → OAuth Apps, then click New OAuth App.`},{text:`Give it a name your people will recognise — it is what they see when GitHub asks them to allow it — and put your own app's address in Homepage URL.`,copy:{label:`Homepage URL`,address:`home`,note:Ft}},{text:`Paste the address below into Redirect URI, then click Register application.`,copy:{label:`Redirect URI`,address:`callback`,note:`Some GitHub screens call this same box Authorization callback URL.`}},{text:`Copy the Client ID off the page that comes back, then click Generate a new client secret and copy that too. GitHub shows a secret once.`},{text:`Back in Firebase, paste the Client ID and the Client secret into the GitHub panel and click Save.`}]}},{id:`twitter`,label:`X`,description:`An X account, the one that used to be called Twitter.`,inSentence:`X`,kind:`signIn`,defaultOn:!1,needsSetup:!0,button:`Continue with X`,providerId:`twitter.com`,steps:[`Click Add new provider and choose Twitter. Firebase still lists X under its old name, with the old blue bird beside it — that is the right one.`,`Paste in the two things below. Firebase calls them API key and API secret; X calls the same pair the Consumer Key and Consumer Secret, and the steps say where to find them.`],setup:{where:`the X developer portal`,url:`https://developer.x.com/en/portal/dashboard`,asksFor:[`API key`,`API secret`],steps:[{text:`Sign in at developer.x.com and open the developer portal.`},{text:`Click Create an app, give it a name, leave the project as the default one X offers, and create it.`},{text:`X throws a window of credentials at you the moment the app exists. Close it. None of what is in it is what Firebase wants, and the right pair is the last step here.`},{text:`Click the app's name and find User authentication settings, then click Set up. Leave every setting on that screen as X has set it, apart from the two addresses and the one tick below.`},{text:`Website URL is your own app's address.`,copy:{label:`Website URL`,address:`home`,note:Ft}},{text:`Callback URI / Redirect URL, on the same screen, is this.`,copy:{label:`Callback URI / Redirect URL`,address:`callback`}},{text:`Tick "Request email from users" before you leave that screen. Leave it off and everybody who signs in with X arrives with no email address at all — no way for you to write to them, and a verification screen that has nothing to send to. X asks for a Terms of service and a Privacy policy address before it will let you tick it.`},{text:`Click Save changes. X answers with a Client ID and a Client Secret. Close that one too — still not the pair Firebase is asking for.`},{text:`Back on the app, open Keys and tokens. Under OAuth 1.0, press Regenerate beside Consumer Key — which X also calls the API Key and API Key Secret. Copy both halves while they are on the screen: X shows them once. Leave the access tokens alone while you are on that page: the Generate button under Access Token is for reading X from your own account, and this app never does that.`},{text:`Back in Firebase, paste the Consumer Key into API key and the Consumer Secret into API secret, then click Save.`}],warning:`X hands you a Client ID and a Client Secret twice before it hands you the right pair — once when the app is made, and again when you save the authentication screen. Both of those are X's newer OAuth 2.0 pair, which Firebase does not use: paste them in and the sign-in fails with "invalid credential" the first time somebody presses the button. The pair Firebase wants is the Consumer Key and Consumer Secret, on Keys and tokens, under OAuth 1.0.`}},{id:`sms2fa`,label:`Two-step sign-in`,description:`After the password, a code by text before they are let in.`,inSentence:`a text code`,kind:`security`,defaultOn:!1,needsSetup:!0,steps:[`In the Advanced section below the providers, find SMS Multi-factor Authentication and click Enable.`,It]}],Rt=e=>Lt.find(t=>t.id===e),zt=Lt.filter(e=>e.kind===`signIn`),Bt=e=>e===`internal`||t.h(e);function Vt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=String(n??``).trim();Bt(e)&&!t.includes(e)&&t.push(e)}return t}var Ht=()=>{let e={};for(let t of Lt)e[t.id]=t.defaultOn;return{on:e,registerAs:{on:!1,roles:[]},twoStepOptional:!1,finishRegistration:{skippable:!0,perRole:!1}}};function Ut(e){let t=Ht(),n=e?.methods&&typeof e.methods==`object`?e.methods:{};for(let e of Lt)typeof n[e.id]==`boolean`&&(t.on[e.id]=n[e.id]);let r=e?.registerAs&&typeof e.registerAs==`object`?e.registerAs:{};t.registerAs={on:r.on===!0,roles:Vt(r.roles)},t.twoStepOptional=e?.twoStepOptional===!0;let i=e?.finishRegistration&&typeof e.finishRegistration==`object`?e.finishRegistration:{};return t.finishRegistration={skippable:i.required!==!0,perRole:i.perRole===!0},t}function Wt(e,t){if(!e.registerAs.on)return[];let n=e.registerAs.roles.includes(`internal`)?[{id:`internal`,name:me(`internal`,t)}]:[],r=e.registerAs.roles.map(e=>t.find(t=>t.id===e)).filter(e=>!!e).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({id:e.id,name:e.name}));return[...n,...r]}var Gt=(e,t,n)=>Wt(e,n).find(e=>e.id===String(t??``))??null;function Kt(e,t){let n=String(t||e).trim()||e;return e===`internal`?n===L.internal?`one of our team`:`one of ${n}`:`${/^[aeiou]/i.test(n)?`an`:`a`} ${n}`}function qt(e){let t=e.map(e=>Kt(e.id,e.name).replace(`one of our team`,`one of your team`));return t.length?`People can register as ${t.length===1?t[0]:`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]}`}.`:``}function Jt(e){let t=zt.filter(t=>e.on[t.id]);return t.length>0?t:zt.filter(e=>e.id===`password`)}var Yt=e=>Jt(e).some(e=>e.id===`password`);function Xt(e){let t=Jt(e).map(e=>e.inSentence);return t.length===1?t[0]:`${t.slice(0,-1).join(`, `)} and ${t[t.length-1]}`}function Zt(e,t){let n=Rt(t);return!n||n.kind!==`signIn`||zt.filter(n=>n.id!==t&&e.on[n.id]).length>0?``:`Keep at least one way to sign in — switch another one on first, then this one off.`}var Qt=e=>`${Rt(e)?.label??`This way of signing in`} is not switched on in your Firebase project yet. An admin can switch it on there, on the Sign in screen's own instructions.`,$t=null,en=null,tn=null,nn=null;function rn(e){tn=e,$t?.forEach(t=>t(e))}var an=6e3,on=null;function sn(e){on&&=(clearTimeout(on),null),nn=e,rn(e)}function cn(e){let t=!$t;return $t||=new Set,$t.add(e),t?(nn||(on=setTimeout(()=>{on=null,nn||sn(Ht())},an)),en=(0,c.onSnapshot)((0,c.doc)(O,kt.collection,kt.doc),e=>sn(Ut(e.exists()?e.data():null)),()=>{nn||sn(Ht())})):tn&&e(tn),()=>{$t?.delete(e),!$t?.size&&(on&&=(clearTimeout(on),null),en?.(),$t=null,en=null)}}function ln(){let[e,t]=(0,i.useState)(()=>tn?{loading:!1,settings:tn}:{loading:!0,settings:Ht()});(0,i.useEffect)(()=>cn(e=>t({loading:!1,settings:e})),[]);let n=()=>tn??e.settings,r=e=>(0,c.setDoc)((0,c.doc)(O,kt.collection,kt.doc),e,{merge:!0}),a=`That could not be saved — check you are still signed in as an admin, then try again.`,o=async(e,t)=>{if(!t){let t=Zt(n(),e);if(t)return t}let i=n().on[e];rn({...n(),on:{...n().on,[e]:t}});try{return await r({methods:{[e]:t}}),null}catch{let t=n(),r=nn?nn.on[e]:i;return rn({...t,on:{...t.on,[e]:r}}),a}},s=async e=>{let t=n().registerAs,i={on:e.on??t.on,roles:Vt(e.roles??t.roles)};rn({...n(),registerAs:i});try{return await r({registerAs:i}),null}catch{return rn({...n(),registerAs:nn?nn.registerAs:t}),a}},l=async e=>{let t=n().twoStepOptional;rn({...n(),twoStepOptional:e});try{return await r({twoStepOptional:e}),null}catch{return rn({...n(),twoStepOptional:nn?nn.twoStepOptional:t}),a}},u=async e=>{let t=n().finishRegistration,i={skippable:e.skippable??t.skippable,perRole:e.perRole??t.perRole};rn({...n(),finishRegistration:i});try{return await r({finishRegistration:{required:!i.skippable,perRole:i.perRole}}),null}catch{return rn({...n(),finishRegistration:nn?nn.finishRegistration:t}),a}};return{...e.settings,loading:e.loading,set:o,setRegisterAs:s,setTwoStepOptional:l,setFinishRegistration:u}}var un=`fbos_register_as`,dn=[`/register`,`/login`],fn=()=>{try{return typeof window<`u`?window.sessionStorage:null}catch{return null}};function pn(e,t=Date.now()){if(Bt(e))try{fn()?.setItem(un,JSON.stringify({id:e,at:t}))}catch{}}function mn(){try{fn()?.removeItem(un)}catch{}}function hn(e,t=Date.now()){let n=fn();if(!n)return``;let r=null;try{r=n.getItem(un),r!==null&&n.removeItem(un)}catch{return``}if(!r||!dn.includes(String(e||``).replace(/\/+$/,``)||`/`))return``;try{let{id:e,at:n}=JSON.parse(r);return typeof n!=`number`||t-n>36e5||t<n?``:Bt(e)?String(e):``}catch{return``}}function gn(e,t,n=Date.now()){if(!t||!Bt(t)||e?.removed===!0)return null;let r=e?.role;return r&&r!==`user`&&r!==`free`||e?.requestedRole===t?null:{requestedRole:t,requestedRoleAt:new Date(n).toISOString()}}var _n=()=>({requestedRole:(0,c.deleteField)(),requestedRoleAt:(0,c.deleteField)()});function vn(e){let t=e?.requestedRole;return Bt(t)?{role:String(t),at:typeof e?.requestedRoleAt==`string`?e.requestedRoleAt:``}:null}var yn=(e,t)=>`Register as ${Kt(e,t)}`,bn=(e,t)=>`Asked to be ${Kt(e,t)}`,xn=`Your registration goes to an admin for approval. Until then everything works as usual.`,Sn=`Your registration is pending approval`,Cn=`We'll let you know as soon as it's approved. Everything else works as usual.`,wn=()=>({title:`Your registration has been approved`,body:`Everything that was waiting on it is open to you now.`,link:`/dashboard`}),Tn=()=>({title:`Your registration was not approved`,body:`You still have your account, and everything works as usual.`,link:`/dashboard`}),En=(0,i.createContext)({user:null,userRole:null,accessLevel:`free`,isInternal:!1,isAdmin:!1,loading:!0,signOut:async()=>{},registerUser:async()=>{},refreshUser:async()=>{},userInactive:!1,roleResolved:!1,roleConfirmed:!1,requestedRole:null,profile:null,profileReady:!1,activeOrg:null,activeWorkspace:null,checkOrg:async()=>{},workspaceAccess:{},userWorkspaces:[],switchWorkspace:async()=>{},createWorkspace:async()=>{},createOrg:async()=>{}});async function Dn(e){try{return await(0,s.deleteUser)(e),`deleted`}catch{}try{return await(0,s.signOut)(D),`signed-out`}catch{return`failed`}}var On=e=>`fbos_role2_${e}`,kn=e=>{try{return localStorage.getItem(On(e))}catch{return null}},An=(e,t)=>{try{localStorage.setItem(On(e),t)}catch{}},jn=e=>{try{localStorage.removeItem(On(e))}catch{}},Mn=e=>{try{localStorage.removeItem(`fbos_role_${e}`)}catch{}};function Nn(e,t,n=Date.now()){if(e?.removed===!0)return null;let r=e||{},i=Date.parse(String(r.lastLoginAt||``)),a=Number.isFinite(i)&&n-i<36e5&&i<=n,o=t.email||r.email||null;if(e&&r.uid===t.uid&&r.email===o&&r.createdAt&&(!t.displayName||r.displayName===t.displayName)&&a)return null;let s=new Date(n).toISOString();return{uid:t.uid,email:o,displayName:t.displayName||r.displayName||``,lastLoginAt:s,createdAt:r.createdAt||s}}function Pn({children:e,onSignedOut:n,onRemoved:r}){let[o,l]=(0,i.useState)(null),[u,d]=(0,i.useState)(null),[f,p]=(0,i.useState)(!1),[m,h]=(0,i.useState)(!0),[g,_]=(0,i.useState)(!1),[v,y]=(0,i.useState)(!1),[b,x]=(0,i.useState)(null),[S,C]=(0,i.useState)(null),[w,T]=(0,i.useState)(!1),E=i.default.useRef(null),k=i.default.useRef(null),ee=i.default.useRef(null),te=i.default.useRef(``),A=i.default.useRef(null),j=i.default.useRef(n);j.current=n;let ne=i.default.useRef(r);ne.current=r;let re=i.default.useRef(null),M=i.default.useRef(null),N=i.default.useRef(null),P=i.default.useRef(null),F=i.default.useRef(null),ie=i.default.useRef(new Set),I=e=>(0,c.updateDoc)((0,c.doc)(O,`user_profiles`,e),{role:`admin`}),L=async(e,{again:t=!1}={})=>{if(!(ie.current.has(e)&&!t)){ie.current.add(e);try{await I(e)}catch(t){if(t?.code!==`permission-denied`){console.error(`Error claiming the admin role:`,t);return}try{if(!D.currentUser)return;await D.currentUser.getIdToken(!0),await I(e)}catch(e){e?.code!==`permission-denied`&&console.error(`Error claiming the admin role:`,e)}}}};return(0,i.useEffect)(()=>{let e;if(!D){h(!1),_(!0),T(!0);return}(0,s.getRedirectResult)(D).catch(()=>{});let n=(0,s.onAuthStateChanged)(D,async n=>{if(n?.uid===A.current&&g){l(n);return}let r=A.current;if(A.current=n?.uid||null,n){te.current=hn(typeof window<`u`?window.location.pathname:``),y(!1),n.uid!==r&&(N.current=null),r!==n.uid&&T(!1),Mn(n.uid);let i=kn(n.uid);i?(d(i),_(!0),h(!1)):_(!1),console.log(`[AuthContext] 1. onAuthStateChanged fired for user:`,n.uid),l(n);try{let r=(0,c.doc)(O,`user_profiles`,n.uid);e&&e();let i=e=>{console.error(`[AuthContext] the profile could not be read to the end:`,e),F.current=null,_(!0),y(!0),T(!0),h(!1)};e=(0,c.onSnapshot)(r,{includeMetadataChanges:!0},e=>{try{let i=e.exists()?e.data():null,a=e.metadata?.hasPendingWrites===!0;if(i?.removed===!0){re.current=n.uid,M.current!==n.uid&&(M.current=n.uid,Dn(n).then(e=>{e!==`deleted`&&(M.current=null)})),d(null),N.current=null,jn(n.uid),p(!0),x(null),C(i),_(!0),y(!0),T(!0),h(!1);return}if(ee.current!==n.uid){ee.current=n.uid;let e=Nn(i,{uid:n.uid,email:n.email,displayName:n.displayName}),t=gn(i,te.current);te.current=``,(e||t)&&(i||(F.current=n.uid),(0,c.setDoc)(r,{...e||{},...t||{}},{merge:!0}).catch(e=>{e?.code===`permission-denied`?console.warn(`This account may not update its own profile — it has been deactivated, or its address is not verified yet.`):console.error(`Failed to sync profile:`,e)}).finally(()=>{F.current===n.uid&&(F.current=null,T(!0))}))}if(i){let e=vt(i);a?e=N.current??`user`:N.current=e,!a&&k.current!==n.uid&&_t(i)&&t.t(D.currentUser)&&(k.current=n.uid,bt(n.uid,i)),!a&&!i.role&&!i.removed&&D.currentUser?.emailVerified&&L(n.uid),E.current===null&&(E.current=e),d(e),An(n.uid,e),p(i.inactive===!0),x(vn(i)?.role??null),C(i)}else d(null),a||(N.current=null),jn(n.uid),p(!1),x(null),C(null);_(!0),y(!0),(i||F.current!==n.uid)&&T(!0),h(!1)}catch(e){i(e)}},e=>{console.warn(`[AuthContext] user_profiles snapshot error (safe to ignore during auth transition):`,e),_(!0),F.current=null,T(!0),h(!1)})}catch(e){console.error(`[AuthContext] ERROR in auth resolution:`,e),_(!0),F.current=null,T(!0),h(!1)}}else{if(console.log(`[AuthContext] No user currently signed in.`),r){let e=re.current===r;e&&(re.current=null),(e&&ne.current||j.current)?.()}l(null),d(null),p(!1),x(null),C(null),_(!0),y(!1),T(!1),h(!1),E.current=null,N.current=null,P.current=null,te.current=``,k.current=null,ee.current=null,F.current=null,e&&e()}});return()=>{n(),e&&e()}},[]),(0,i.useEffect)(()=>{let e=o?.uid??null,t=o?.emailVerified===!0,n=P.current,r=!!e&&!!n&&n.uid===e&&!n.verified&&t;if(P.current=e?{uid:e,verified:t}:null,!r||u===`admin`)return;let i=!1;return(0,c.getDoc)((0,c.doc)(O,`user_profiles`,o.uid)).then(e=>{!i&&e.exists()&&!e.data().role&&!e.data().removed&&L(o.uid,{again:!0})}).catch(()=>{}),()=>{i=!0}},[o?.uid,o?.emailVerified,u]),(0,a.jsx)(En.Provider,{value:{user:o,userRole:u,accessLevel:t.g(u),isInternal:t.f(u),isAdmin:t.p(u),loading:m,signOut:async()=>{await(0,s.signOut)(D),l(null)},registerUser:async(e,t,n,r)=>{let{createUserWithEmailAndPassword:i}=await import(`firebase/auth`),{user:a}=await i(D,e,t),o=`${n} ${r}`.trim();await(0,s.updateProfile)(a,{displayName:o});try{await a.getIdToken(!0),await(0,c.setDoc)((0,c.doc)(O,`user_profiles`,a.uid),{uid:a.uid,email:a.email,displayName:o,createdAt:new Date().toISOString()},{merge:!0})}catch(e){console.warn(`Could not write public profile on registration.`,e)}await(0,s.sendEmailVerification)(a),Et(a.uid)},refreshUser:async()=>{D.currentUser&&(await D.currentUser.reload(),l(Object.assign(Object.create(D.currentUser),{photoURL:D.currentUser.photoURL,displayName:D.currentUser.displayName,email:D.currentUser.email,emailVerified:D.currentUser.emailVerified})))},userInactive:f,roleResolved:g,roleConfirmed:v,requestedRole:b,profile:S,profileReady:w},children:e})}var Fn=()=>(0,i.useContext)(En),In=(0,i.createContext)({});function Ln(e){let t=(0,i.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Rn=typeof window<`u`?i.useLayoutEffect:i.useEffect,zn=(0,i.createContext)(null);function Bn(e,t){e.indexOf(t)===-1&&e.push(t)}function Vn(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Hn=(e,t,n)=>n>t?t:n<e?e:n;function Un(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}var Wn=()=>{},Gn=()=>{};typeof process<`u`&&process.env.NODE_ENV!==`production`&&(Wn=(e,t,n)=>{!e&&typeof console<`u`&&console.warn(Un(t,n))},Gn=(e,t,n)=>{if(!e)throw Error(Un(t,n))});var Kn={},qn=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Jn(e){return typeof e==`object`&&!!e}var Yn=e=>/^0[^.\s]+$/u.test(e);function Xn(e){let t;return()=>(t===void 0&&(t=e()),t)}var Zn=e=>e,Qn=(e,t)=>n=>t(e(n)),$n=(...e)=>e.reduce(Qn),er=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},tr=class{constructor(){this.subscriptions=[]}add(e){return Bn(this.subscriptions,e),()=>Vn(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},nr=e=>e*1e3,rr=e=>e/1e3;function ir(e,t){return t?1e3/t*e:0}var ar=new Set;function or(e,t,n){e||ar.has(t)||(console.warn(Un(t,n)),ar.add(t))}var sr=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,cr=1e-7,lr=12;function ur(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=sr(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>cr&&++s<lr);return o}function dr(e,t,n,r){if(e===t&&n===r)return Zn;let i=t=>ur(t,0,1,e,n);return e=>e===0||e===1?e:sr(i(e),t,r)}var fr=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,pr=e=>t=>1-e(1-t),mr=dr(.33,1.53,.69,.99),hr=pr(mr),gr=fr(hr),_r=e=>e>=1?1:(e*=2)<1?.5*hr(e):.5*(2-2**(-10*(e-1))),vr=e=>1-Math.sin(Math.acos(e)),yr=pr(vr),br=fr(vr),xr=dr(.42,0,1,1),Sr=dr(0,0,.58,1),Cr=dr(.42,0,.58,1),wr=e=>Array.isArray(e)&&typeof e[0]!=`number`,Tr=e=>Array.isArray(e)&&typeof e[0]==`number`,Er={linear:Zn,easeIn:xr,easeInOut:Cr,easeOut:Sr,circIn:vr,circInOut:br,circOut:yr,backIn:hr,backInOut:gr,backOut:mr,anticipate:_r},Dr=e=>typeof e==`string`,Or=e=>{if(Tr(e)){Gn(e.length===4,`Cubic bezier arrays must contain four numerical values.`,`cubic-bezier-length`);let[t,n,r,i]=e;return dr(t,n,r,i)}else if(Dr(e))return Gn(Er[e]!==void 0,`Invalid easing type '${e}'`,`invalid-easing-type`),Er[e];return e},kr=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Ar={value:null,addProjectionMetrics:null};function jr(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0;let o=n;n=r,r=o,n.forEach(l),t&&Ar.value&&Ar.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var Mr=40;function Nr(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=kr.reduce((e,n)=>(e[n]=jr(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Kn.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Mr),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:kr.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<kr.length;t++)o[kr[t]].cancel(e)},state:i,steps:o}}var{schedule:B,cancel:Pr,state:V,steps:Fr}=Nr(typeof requestAnimationFrame<`u`?requestAnimationFrame:Zn,!0),Ir;function Lr(){Ir=void 0}var Rr={now:()=>(Ir===void 0&&Rr.set(V.isProcessing||Kn.useManualTiming?V.timestamp:performance.now()),Ir),set:e=>{Ir=e,queueMicrotask(Lr)}},zr={layout:0,mainThread:0,waapi:0},Br=e=>t=>typeof t==`string`&&t.startsWith(e),Vr=Br(`--`),Hr=Br(`var(--`),Ur=e=>Hr(e)?Wr.test(e.split(`/*`)[0].trim()):!1,Wr=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Gr(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var Kr={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},qr={...Kr,transform:e=>Hn(0,1,e)},Jr={...Kr,default:1},Yr=e=>Math.round(e*1e5)/1e5,Xr=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Zr(e){return e==null}var Qr=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,$r=(e,t)=>n=>!!(typeof n==`string`&&Qr.test(n)&&n.startsWith(e)||t&&!Zr(n)&&Object.prototype.hasOwnProperty.call(n,t)),ei=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Xr);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},ti=e=>Hn(0,255,e),ni={...Kr,transform:e=>Math.round(ti(e))},ri={test:$r(`rgb`,`red`),parse:ei(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+ni.transform(e)+`, `+ni.transform(t)+`, `+ni.transform(n)+`, `+Yr(qr.transform(r))+`)`};function ii(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var ai={test:$r(`#`),parse:ii,transform:ri.transform},oi=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),si=oi(`deg`),ci=oi(`%`),H=oi(`px`),li=oi(`vh`),ui=oi(`vw`),di={...ci,parse:e=>ci.parse(e)/100,transform:e=>ci.transform(e*100)},fi={test:$r(`hsl`,`hue`),parse:ei(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+ci.transform(Yr(t))+`, `+ci.transform(Yr(n))+`, `+Yr(qr.transform(r))+`)`},U={test:e=>ri.test(e)||ai.test(e)||fi.test(e),parse:e=>ri.test(e)?ri.parse(e):fi.test(e)?fi.parse(e):ai.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?ri.transform(e):fi.transform(e),getAnimatableNone:e=>{let t=U.parse(e);return t.alpha=0,U.transform(t)}},pi=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function mi(e){return isNaN(e)&&typeof e==`string`&&(e.match(Xr)?.length||0)+(e.match(pi)?.length||0)>0}var hi=`number`,gi=`color`,_i=`var`,vi=`var(`,yi="${}",bi=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function xi(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(bi,e=>(U.test(e)?(r.color.push(a),i.push(gi),n.push(U.parse(e))):e.startsWith(vi)?(r.var.push(a),i.push(_i),n.push(e)):(r.number.push(a),i.push(hi),n.push(parseFloat(e))),++a,yi)).split(yi),indexes:r,types:i}}function Si(e){return xi(e).values}function Ci({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===hi?i+=Yr(r[a]):e===gi?i+=U.transform(r[a]):i+=r[a]}return i}}function wi(e){return Ci(xi(e))}var Ti=e=>typeof e==`number`?0:U.test(e)?U.getAnimatableNone(e):e,Ei=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Ti(e);function Di(e){let t=xi(e);return Ci(t)(t.values.map((e,n)=>Ei(e,t.split[n])))}var Oi={test:mi,parse:Si,createTransformer:wi,getAnimatableNone:Di};function ki(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ai({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=ki(s,r,e+1/3),a=ki(s,r,e),o=ki(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function ji(e,t){return n=>n>0?t:e}var W=(e,t,n)=>e+(t-e)*n,Mi=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Ni=[ai,ri,fi],Pi=e=>Ni.find(t=>t.test(e));function Fi(e){let t=Pi(e);if(Wn(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,`color-not-animatable`),!t)return!1;let n=t.parse(e);return t===fi&&(n=Ai(n)),n}var Ii=(e,t)=>{let n=Fi(e),r=Fi(t);if(!n||!r)return ji(e,t);let i={...n};return e=>(i.red=Mi(n.red,r.red,e),i.green=Mi(n.green,r.green,e),i.blue=Mi(n.blue,r.blue,e),i.alpha=W(n.alpha,r.alpha,e),ri.transform(i))},Li=new Set([`none`,`hidden`]);function Ri(e,t){return Li.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function zi(e,t){return n=>W(e,t,n)}function Bi(e){return typeof e==`number`?zi:typeof e==`string`?Ur(e)?ji:U.test(e)?Ii:Wi:Array.isArray(e)?Vi:typeof e==`object`?U.test(e)?Ii:Hi:ji}function Vi(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Bi(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Hi(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Bi(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Ui(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Wi=(e,t)=>{let n=Oi.createTransformer(t),r=xi(e),i=xi(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Li.has(e)&&!i.values.length||Li.has(t)&&!r.values.length?Ri(e,t):$n(Vi(Ui(r,i),i.values),n):(Wn(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,`complex-values-different`),ji(e,t))};function Gi(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?W(e,t,n):Bi(e)(e,t)}var Ki=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>B.update(t,e),stop:()=>Pr(t),now:()=>V.isProcessing?V.timestamp:Rr.now()}},qi=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Ji=2e4;function Yi(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Xi(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(Yi(r),Ji);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:rr(i)}}var G={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Zi(e,t){return e*Math.sqrt(1-t*t)}var Qi=12;function $i(e,t,n){let r=n;for(let n=1;n<Qi;n++)r-=e(r)/t(r);return r}var ea=.001;function ta({duration:e=G.duration,bounce:t=G.bounce,velocity:n=G.velocity,mass:r=G.mass}){let i,a;Wn(e<=nr(G.maxDuration),`Spring duration must be 10 seconds or less`,`spring-duration-limit`);let o=1-t;o=Hn(G.minDamping,G.maxDamping,o),e=Hn(G.minDuration,G.maxDuration,rr(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Zi(t,o),c=Math.exp(-i);return ea-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Zi(t**2,o);return(-i(t)+ea>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-ea+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=$i(i,a,s);if(e=nr(e),isNaN(c))return{stiffness:G.stiffness,damping:G.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var na=[`duration`,`bounce`],ra=[`stiffness`,`damping`,`mass`];function ia(e,t){return t.some(t=>e[t]!==void 0)}function aa(e){let t={velocity:G.velocity,stiffness:G.stiffness,damping:G.damping,mass:G.mass,isResolvedFromDuration:!1,...e};if(!ia(e,ra)&&ia(e,na))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Hn(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:G.mass,stiffness:i,damping:a}}else{let n=ta({...e,velocity:0});t={...t,...n,mass:G.mass},t.isResolvedFromDuration=!0}return t}function oa(e=G.visualDuration,t=G.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=aa({...n,velocity:-rr(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=rr(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?G.restSpeed.granular:G.restSpeed.default,i||=v?G.restDelta.granular:G.restDelta.default;let y,b,x,S,C,w;if(h<1)x=Zi(_,h),S=(m+h*_*g)/x,y=e=>o-Math.exp(-h*_*e)*(S*Math.sin(x*e)+g*Math.cos(x*e)),C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>nr(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=nr(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=nr(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(Yi(T),Ji),t=qi(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}oa.applyToOptions=e=>{let t=Xi(e,100,oa);return e.ease=t.ease,e.duration=nr(t.duration),e.type=`keyframes`,e};var sa=5;function ca(e,t,n){let r=Math.max(t-sa,0);return ir(n-e(r),t-r)}function la({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=oa({keyframes:[f.value,m(f.value)],velocity:ca(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function ua(e,t,n){let r=[],i=n||Kn.mix||Gi,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=$n(Array.isArray(t)?t[n]||Zn:t,a)),r.push(a)}return r}function da(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(Gn(a===t.length,`Both input and output ranges must be the same length`,`range-length`),a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=ua(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=er(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Hn(e[0],e[a-1],t)):l}function fa(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=er(0,t,r);e.push(W(n,1,i))}}function pa(e){let t=[0];return fa(t,e.length-1),t}function ma(e,t){return e.map(e=>e*t)}function ha(e,t){return e.map(()=>t||Cr).splice(0,e.length-1)}function ga({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=wr(r)?r.map(Or):Or(r),a={done:!1,value:t[0]},o=da(ma(n&&n.length===t.length?n:pa(t),e),t,{ease:Array.isArray(i)?i:ha(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var _a=e=>e!==null;function va(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(_a),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ya={decay:la,inertia:la,tween:ga,keyframes:ga,spring:oa};function ba(e){typeof e.type==`string`&&(e.type=ya[e.type])}var xa=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Sa=e=>e/100,Ca=class extends xa{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==Rr.now()&&this.tick(Rr.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},zr.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;ba(e);let{type:t=ga,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||ga;process.env.NODE_ENV!==`production`&&s!==ga&&Gn(o.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`,`spring-two-frames`),s!==ga&&typeof o[0]!=`number`&&(this.mixKeyframes=$n(Sa,Gi(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=Yi(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Hn(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==la&&(b.value=va(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return rr(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+rr(e)}get time(){return rr(this.currentTime)}set time(e){e=nr(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return ca(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(Rr.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=rr(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Ki,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(Rr.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,zr.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function wa(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Ta=e=>e*180/Math.PI,Ea=e=>Oa(Ta(Math.atan2(e[1],e[0]))),Da={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ea,rotateZ:Ea,skewX:e=>Ta(Math.atan(e[1])),skewY:e=>Ta(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Oa=e=>(e%=360,e<0&&(e+=360),e),ka=Ea,Aa=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),ja=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ma={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Aa,scaleY:ja,scale:e=>(Aa(e)+ja(e))/2,rotateX:e=>Oa(Ta(Math.atan2(e[6],e[5]))),rotateY:e=>Oa(Ta(Math.atan2(-e[2],e[0]))),rotateZ:ka,rotate:ka,skewX:e=>Ta(Math.atan(e[4])),skewY:e=>Ta(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Na(e){return+!!e.includes(`scale`)}function Pa(e,t){if(!e||e===`none`)return Na(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Ma,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Da,i=t}if(!i)return Na(t);let a=r[t],o=i[1].split(`,`).map(Ia);return typeof a==`function`?a(o):o[a]}var Fa=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Pa(n,t)};function Ia(e){return parseFloat(e.trim())}var La=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],Ra=new Set(La),za=e=>e===Kr||e===H,Ba=new Set([`x`,`y`,`z`]),Va=La.filter(e=>!Ba.has(e));function Ha(e){let t=[];return Va.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var Ua={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Pa(t,`x`),y:(e,{transform:t})=>Pa(t,`y`)};Ua.translateX=Ua.x,Ua.translateY=Ua.y;var Wa=new Set,Ga=!1,Ka=!1,qa=!1;function Ja(){if(Ka){let e=Array.from(Wa).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Ha(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Ka=!1,Ga=!1,Wa.forEach(e=>e.complete(qa)),Wa.clear()}function Ya(){Wa.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Ka=!0)})}function Xa(){qa=!0,Ya(),Ja(),qa=!1}var Za=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Wa.add(this),Ga||(Ga=!0,B.read(Ya),B.resolveKeyframes(Ja))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}wa(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Wa.delete(this)}cancel(){this.state===`scheduled`&&(Wa.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Qa=e=>e.startsWith(`--`);function $a(e,t,n){Qa(t)?e.style.setProperty(t,n):e.style[t]=n}var eo={};function to(e,t){let n=Xn(e);return()=>eo[t]??n()}var no=to(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),ro=to(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),io=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,ao={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:io([0,.65,.55,1]),circOut:io([.55,0,1,.45]),backIn:io([.31,.01,.66,-.59]),backOut:io([.33,1.53,.69,.99])};function oo(e,t){if(e)return typeof e==`function`?ro()?qi(e,t):`ease-out`:Tr(e)?io(e):Array.isArray(e)?e.map(e=>oo(e,t)||ao.easeOut):ao[e]}function so(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=oo(s,i);Array.isArray(d)&&(u.easing=d),Ar.value&&zr.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Ar.value&&p.finished.finally(()=>{zr.waapi--}),p}function co(e){return typeof e==`function`&&`applyToOptions`in e}function lo({type:e,...t}){return co(e)&&ro()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var uo=class extends xa{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,Gn(typeof e.type!=`string`,`Mini animate() doesn't support "type" as a string.`,`mini-spring`);let c=lo(e);this.animation=so(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=va(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),$a(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return rr(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+rr(e)}get time(){return rr(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=nr(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&no()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),Zn):r(this)}},fo={anticipate:_r,backInOut:gr,circInOut:br};function po(e){return e in fo}function mo(e){typeof e.ease==`string`&&po(e.ease)&&(e.ease=fo[e.ease])}var ho=10,go=class extends uo{constructor(e){mo(e),ba(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Ca({...a,autoplay:!1}),s=Math.max(ho,Rr.now()-this.startTime),c=Hn(0,ho,s-ho),l=o.sample(s).value,{name:u}=this.options;i&&u&&$a(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},_o=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Oi.test(e)||e===`0`)&&!e.startsWith(`url(`));function vo(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function yo(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=_o(i,t),s=_o(a,t);return Wn(o===s,`You are trying to animate ${t} from "${i}" to "${a}". "${o?a:i}" is not an animatable value.`,`value-not-animatable`),!o||!s?!1:vo(e)||(n===`spring`||co(n))&&r}function bo(e){e.duration=0,e.type=`keyframes`}var xo=new Set([`opacity`,`clipPath`,`filter`,`transform`]),So=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Co(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&So.test(e[t]))return!0;return!1}var wo=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),To=Xn(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Eo(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return To()&&n&&(xo.has(n)||wo.has(n)&&Co(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Do=40,Oo=class extends xa{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Rr.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Za)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=Rr.now();let u=!0;yo(e,i,a,o)||(u=!1,(Kn.instantAnimations||!s)&&l?.(va(e,n,t)),e[0]=e[e.length-1],bo(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Do?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Eo(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new go({...d,element:p})}catch{m=new Ca(d)}else m=new Ca(d);m.finished.then(()=>{this.notifyFinished()}).catch(Zn),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Xa()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function ko(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var Ao=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function jo(e){let t=Ao.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}var Mo=4;function No(e,t,n=1){Gn(n<=Mo,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,`max-css-var-depth`);let[r,i]=jo(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return qn(e)?parseFloat(e):e}return Ur(i)?No(i,t,n+1):i}var Po={type:`spring`,stiffness:500,damping:25,restSpeed:10},Fo=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Io={type:`keyframes`,duration:.8},Lo={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Ro=(e,{keyframes:t})=>t.length>2?Io:Ra.has(e)?e.startsWith(`scale`)?Fo(t[1]):Po:Lo;function zo(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Bo(e,t){let n=e?.[t]??e?.default??e;return n===e?n:zo(n,e)}var Vo=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function Ho(e){for(let t in e)if(!Vo.has(t))return!0;return!1}var Uo=(e,t,n,r={},i,a)=>o=>{let s=Bo(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=nr(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};Ho(s)||Object.assign(u,Ro(e,u)),u.duration&&=nr(u.duration),u.repeatDelay&&=nr(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(bo(u),u.delay===0&&(d=!0)),(Kn.instantAnimations||Kn.skipAnimations||i?.shouldSkipAnimations)&&(d=!0,bo(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=va(u.keyframes,s);if(e!==void 0){B.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Ca(u):new Oo(u)};function Wo(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Go(e,t,n,r){if(typeof t==`function`){let[i,a]=Wo(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=Wo(r);t=t(n===void 0?e.custom:n,i,a)}return t}function Ko(e,t,n){let r=e.getProps();return Go(r,t,n===void 0?r.custom:n,e)}var qo=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...La]),Jo=30,Yo=e=>!isNaN(parseFloat(e)),Xo={current:void 0},Zo=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=Rr.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Rr.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Yo(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!==`production`&&or(!1,`value.onChange(callback) is deprecated. Switch to value.on("change", callback).`),this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new tr);let n=this.events[e].add(t);return e===`change`?()=>{n(),B.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Xo.current&&Xo.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=Rr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Jo)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Jo);return ir(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Qo(e,t){return new Zo(e,t)}var $o=e=>Array.isArray(e);function es(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Qo(n))}function ts(e){return $o(e)?e[e.length-1]||0:e}function ns(e,t){let{transitionEnd:n={},transition:r={},...i}=Ko(e,t)||{};i={...i,...n};for(let t in i)es(e,t,ts(i[t]))}var K=e=>!!(e&&e.getVelocity);function rs(e){return!!(K(e)&&e.add)}function is(e,t){let n=e.getValue(`willChange`);if(rs(n))return n.add(t);if(!n&&Kn.WillChange){let n=new Kn.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function as(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var os=`data-`+as(`framerAppearId`);function ss(e){return e.props[os]}function cs({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ls(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?zo(a,c):c;let l=a?.reduceMotion;r&&(a=r);let u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||d&&cs(d,t))continue;let o={delay:n,...Bo(a||{},t)},c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){B.update(()=>r.set(i));continue}let f=!1;if(window.MotionHandoffAnimation){let n=ss(e);if(n){let e=window.MotionHandoffAnimation(n,t,B);e!==null&&(o.startTime=e,f=!0)}}is(e,t);let p=l??e.shouldReduceMotion;r.start(Uo(t,r,i,p&&qo.has(t)?{type:!1}:o,e,f));let m=r.animation;m&&u.push(m)}if(o){let t=()=>B.update(()=>{o&&ns(e,o)});u.length?Promise.all(u).then(t):t()}return u}function us(e,t,n={}){let r=Ko(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(ls(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return ds(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function ds(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(us(c,t,{...o,delay:n+(typeof r==`function`?0:r)+ko(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function fs(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>us(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=us(e,t,n);else{let i=typeof t==`function`?Ko(e,t,n.custom):t;r=Promise.all(ls(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var ps={test:e=>e===`auto`,parse:e=>e},ms=e=>t=>t.test(e),hs=[Kr,H,ci,si,ui,li,ps],gs=e=>hs.find(ms(e));function _s(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Yn(e)}var vs=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function ys(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Xr)||[];if(!r)return e;let i=n.replace(r,``),a=+!!vs.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var bs=/\b([a-z-]*)\(.*?\)/gu,xs={...Oi,getAnimatableNone:e=>{let t=e.match(bs);return t?t.map(ys).join(` `):e}},Ss={...Oi,getAnimatableNone:e=>{let t=Oi.parse(e);return Oi.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Cs={...Kr,transform:Math.round},ws={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,rotate:si,rotateX:si,rotateY:si,rotateZ:si,scale:Jr,scaleX:Jr,scaleY:Jr,scaleZ:Jr,skew:si,skewX:si,skewY:si,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:qr,originX:di,originY:di,originZ:H,zIndex:Cs,fillOpacity:qr,strokeOpacity:qr,numOctaves:Cs},Ts={...ws,color:U,backgroundColor:U,outlineColor:U,fill:U,stroke:U,borderColor:U,borderTopColor:U,borderRightColor:U,borderBottomColor:U,borderLeftColor:U,filter:xs,WebkitFilter:xs,mask:Ss,WebkitMask:Ss},Es=e=>Ts[e],Ds=new Set([xs,Ss]);function Os(e,t){let n=Es(e);return Ds.has(n)||(n=Oi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var ks=new Set([`auto`,`none`,`0`]);function As(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!ks.has(t)&&xi(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Os(n,i)}var js=class extends Za{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Ur(r))){let i=No(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!qo.has(n)||e.length!==2)return;let[r,i]=e,a=gs(r),o=gs(i);if(Gr(r)!==Gr(i)&&Ua[n]){this.needsMeasurement=!0;return}if(a!==o)if(za(a)&&za(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Ua[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||_s(e[t]))&&n.push(t);n.length&&As(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ua[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Ua[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function Ms(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var Ns=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ps(e){return Jn(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:Fs,cancel:Is}=Nr(queueMicrotask,!1),Ls={x:!1,y:!1};function Rs(){return Ls.x||Ls.y}function zs(e){return e===`x`||e===`y`?Ls[e]?null:(Ls[e]=!0,()=>{Ls[e]=!1}):Ls.x||Ls.y?null:(Ls.x=Ls.y=!0,()=>{Ls.x=Ls.y=!1})}function Bs(e,t){let n=Ms(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Vs(e){return!(e.pointerType===`touch`||Rs())}function Hs(e,t,n={}){let[r,i,a]=Bs(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!Vs(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var Us=(e,t)=>t?e===t?!0:Us(e,t.parentElement):!1,Ws=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Gs=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function Ks(e){return Gs.has(e.tagName)||e.isContentEditable===!0}var qs=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function Js(e){return qs.has(e.tagName)||e.isContentEditable===!0}var Ys=new WeakSet;function Xs(e){return t=>{t.key===`Enter`&&e(t)}}function Zs(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Qs=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Xs(()=>{if(Ys.has(n))return;Zs(n,`down`);let e=Xs(()=>{Zs(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Zs(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function $s(e){return Ws(e)&&!Rs()}var ec=new WeakSet;function tc(e,t,n={}){let[r,i,a]=Bs(e,n),o=e=>{let r=e.currentTarget;if(!$s(e)||ec.has(e))return;Ys.add(r),n.stopPropagation&&ec.add(e);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Ys.has(r)&&Ys.delete(r),$s(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||Us(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ps(e)&&(e.addEventListener(`focus`,e=>Qs(e,i)),!Ks(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function nc(e){return Jn(e)&&`ownerSVGElement`in e}var rc=new WeakMap,ic,ac=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:nc(r)&&`getBBox`in r?r.getBBox()[t]:r[n],oc=ac(`inline`,`width`,`offsetWidth`),sc=ac(`block`,`height`,`offsetHeight`);function cc({target:e,borderBoxSize:t}){rc.get(e)?.forEach(n=>{n(e,{get width(){return oc(e,t)},get height(){return sc(e,t)}})})}function lc(e){e.forEach(cc)}function uc(){typeof ResizeObserver>`u`||(ic=new ResizeObserver(lc))}function dc(e,t){ic||uc();let n=Ms(e);return n.forEach(e=>{let n=rc.get(e);n||(n=new Set,rc.set(e,n)),n.add(t),ic?.observe(e)}),()=>{n.forEach(e=>{let n=rc.get(e);n?.delete(t),n?.size||ic?.unobserve(e)})}}var fc=new Set,pc;function mc(){pc=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};fc.forEach(t=>t(e))},window.addEventListener(`resize`,pc)}function hc(e){return fc.add(e),pc||mc(),()=>{fc.delete(e),!fc.size&&typeof pc==`function`&&(window.removeEventListener(`resize`,pc),pc=void 0)}}function gc(e,t){return typeof e==`function`?hc(e):dc(e,t)}function _c(e){return nc(e)&&e.tagName===`svg`}var vc=[...hs,U,Oi],yc=e=>vc.find(ms(e)),bc=()=>({translate:0,scale:1,origin:0,originPoint:0}),xc=()=>({x:bc(),y:bc()}),Sc=()=>({min:0,max:0}),q=()=>({x:Sc(),y:Sc()}),Cc=new WeakMap;function wc(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Tc(e){return typeof e==`string`||Array.isArray(e)}var Ec=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Dc=[`initial`,...Ec];function Oc(e){return wc(e.animate)||Dc.some(t=>Tc(e[t]))}function kc(e){return!!(Oc(e)||e.variants)}function Ac(e,t,n){for(let r in t){let i=t[r],a=n[r];if(K(i))e.addValue(r,i);else if(K(a))e.addValue(r,Qo(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Qo(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var jc={current:null},Mc={current:!1},Nc=typeof window<`u`;function Pc(){if(Mc.current=!0,Nc)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>jc.current=e.matches;e.addEventListener(`change`,t),t()}else jc.current=!1}var Fc=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],Ic={};function Lc(e){Ic=e}function Rc(){return Ic}var zc=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Za,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=Rr.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,B.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=Oc(t),this.isVariantNode=kc(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&K(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,Cc.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:(Mc.current||Pc(),this.shouldReduceMotion=jc.current),process.env.NODE_ENV!==`production`&&or(this.shouldReduceMotion!==!0,`You have Reduced Motion enabled on your device. Animations may not appear as expected.`,`reduced-motion-disabled`),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Pr(this.notifyUpdate),Pr(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&xo.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new uo({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:nr(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=Ra.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&B.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in Ic){let t=Ic[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):q()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<Fc.length;t++){let n=Fc[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Ac(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Qo(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(qn(n)||Yn(n))?n=parseFloat(n):!yc(n)&&Oi.test(t)&&(n=Os(e,t)),this.setBaseTarget(e,K(n)?n.get():n)),K(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=Go(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!K(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new tr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Fs.render(this.render)}},Bc=class extends zc{constructor(){super(...arguments),this.KeyframeResolver=js}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;K(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},Vc=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Hc({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Uc({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Wc(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Gc(e){return e===void 0||e===1}function Kc({scale:e,scaleX:t,scaleY:n}){return!Gc(e)||!Gc(t)||!Gc(n)}function qc(e){return Kc(e)||Jc(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Jc(e){return Yc(e.x)||Yc(e.y)}function Yc(e){return e&&e!==`0%`}function Xc(e,t,n){return n+t*(e-n)}function Zc(e,t,n,r,i){return i!==void 0&&(e=Xc(e,i,r)),Xc(e,n,r)+t}function Qc(e,t=0,n=1,r,i){e.min=Zc(e.min,t,n,r,i),e.max=Zc(e.max,t,n,r,i)}function $c(e,{x:t,y:n}){Qc(e.x,t.translate,t.scale,t.originPoint),Qc(e.y,n.translate,n.scale,n.originPoint)}var el=.999999999999,tl=1.0000000000001;function nl(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(rl(e.x,-a.scroll.offset.x),rl(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,$c(e,o)),r&&qc(a.latestValues)&&ol(e,a.latestValues,a.layout?.layoutBox))}t.x<tl&&t.x>el&&(t.x=1),t.y<tl&&t.y>el&&(t.y=1)}function rl(e,t){e.min+=t,e.max+=t}function il(e,t,n,r,i=.5){Qc(e,t,n,W(e.min,e.max,i),r)}function al(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function ol(e,t,n){let r=n??e;il(e.x,al(t.x,r.x),t.scaleX,t.scale,t.originX),il(e.y,al(t.y,r.y),t.scaleY,t.scale,t.originY)}function sl(e,t){return Hc(Wc(e.getBoundingClientRect(),t))}function cl(e,t,n){let r=sl(e,n),{scroll:i}=t;return i&&(rl(r.x,i.offset.x),rl(r.y,i.offset.y)),r}var ll={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},ul=La.length;function dl(e,t,n){let r=``,i=!0;for(let a=0;a<ul;a++){let o=La[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=Ns(s,ws[o]);if(!c){i=!1;let t=ll[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function fl(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(Ra.has(e)){o=!0;continue}else if(Vr(e)){i[e]=n;continue}else{let t=Ns(n,ws[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=dl(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function pl(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function ml(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var hl={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(H.test(e))e=parseFloat(e);else return e;return`${ml(e,t.target.x)}% ${ml(e,t.target.y)}%`}},gl={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Oi.parse(e);if(i.length>5)return r;let a=Oi.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=W(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},_l={borderRadius:{...hl,applyTo:[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`]},borderTopLeftRadius:hl,borderTopRightRadius:hl,borderBottomLeftRadius:hl,borderBottomRightRadius:hl,boxShadow:gl};function vl(e,{layout:t,layoutId:n}){return Ra.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!_l[e]||e===`opacity`)}function yl(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(K(r[t])||i&&K(i[t])||vl(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function bl(e){return window.getComputedStyle(e)}var xl=class extends Bc{constructor(){super(...arguments),this.type=`html`,this.renderInstance=pl}readValueFromInstance(e,t){if(Ra.has(t))return this.projection?.isProjecting?Na(t):Fa(e,t);{let n=bl(e),r=(Vr(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return sl(e,t)}build(e,t,n){fl(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return yl(e,t,n)}},Sl={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Cl={offset:`strokeDashoffset`,array:`strokeDasharray`};function wl(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Sl:Cl;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Tl=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function El(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(fl(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Tl)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&wl(d,i,a,o,!1)}var Dl=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Ol=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function kl(e,t,n,r){pl(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Dl.has(n)?n:as(n),t.attrs[n])}function Al(e,t,n){let r=yl(e,t,n);for(let n in e)if(K(e[n])||K(t[n])){let t=La.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var jl=class extends Bc{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=q}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Ra.has(t)){let e=Es(t);return e&&e.default||0}return t=Dl.has(t)?t:as(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Al(e,t,n)}build(e,t,n){El(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){kl(e,t,n,r)}mount(e){this.isSVGTag=Ol(e.tagName),super.mount(e)}},Ml=Dc.length;function Nl(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Nl(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<Ml;n++){let r=Dc[n],i=e.props[r];(Tc(i)||i===!1)&&(t[r]=i)}return t}function Pl(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var Fl=[...Ec].reverse(),Il=Ec.length;function Ll(e){return t=>Promise.all(t.map(({animation:t,options:n})=>fs(e,t,n)))}function Rl(e){let t=Ll(e),n=Vl(),r=!0,i=!1,a=t=>(n,r)=>{let i=Ko(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=Nl(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<Il;t++){let p=Fl[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Tc(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||wc(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=zl(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},E=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=$o(t)&&$o(n)?!Pl(t,n):t!==n,r?t==null?u.add(e):E(e):t!==void 0&&u.has(e)?E(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let D=v&&y;b&&(!D||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!D&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=Ko(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=ko(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=Ko(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=Vl(),i=!0}}}function zl(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Pl(t,e):!1}function Bl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Vl(){return{animate:Bl(!0),whileInView:Bl(),whileHover:Bl(),whileTap:Bl(),whileDrag:Bl(),whileFocus:Bl(),exit:Bl()}}function Hl(e,t){e.min=t.min,e.max=t.max}function Ul(e,t){Hl(e.x,t.x),Hl(e.y,t.y)}function Wl(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var Gl=1e-4,Kl=1-Gl,ql=1+Gl,Jl=.01,Yl=0-Jl,Xl=0+Jl;function Zl(e){return e.max-e.min}function Ql(e,t,n){return Math.abs(e-t)<=n}function $l(e,t,n,r=.5){e.origin=r,e.originPoint=W(t.min,t.max,e.origin),e.scale=Zl(n)/Zl(t),e.translate=W(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Kl&&e.scale<=ql||isNaN(e.scale))&&(e.scale=1),(e.translate>=Yl&&e.translate<=Xl||isNaN(e.translate))&&(e.translate=0)}function eu(e,t,n,r){$l(e.x,t.x,n.x,r?r.originX:void 0),$l(e.y,t.y,n.y,r?r.originY:void 0)}function tu(e,t,n,r=0){e.min=(r?W(n.min,n.max,r):n.min)+t.min,e.max=e.min+Zl(t)}function nu(e,t,n,r){tu(e.x,t.x,n.x,r?.x),tu(e.y,t.y,n.y,r?.y)}function ru(e,t,n,r=0){let i=r?W(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Zl(t)}function iu(e,t,n,r){ru(e.x,t.x,n.x,r?.x),ru(e.y,t.y,n.y,r?.y)}function au(e,t,n,r,i){return e-=t,e=Xc(e,1/n,r),i!==void 0&&(e=Xc(e,1/i,r)),e}function ou(e,t=0,n=1,r=.5,i,a=e,o=e){if(ci.test(t)&&(t=parseFloat(t),t=W(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=W(a.min,a.max,r);e===a&&(s-=t),e.min=au(e.min,t,n,s,i),e.max=au(e.max,t,n,s,i)}function su(e,t,[n,r,i],a,o){ou(e,t[n],t[r],t[i],t.scale,a,o)}var cu=[`x`,`scaleX`,`originX`],lu=[`y`,`scaleY`,`originY`];function uu(e,t,n,r){su(e.x,t,cu,n?n.x:void 0,r?r.x:void 0),su(e.y,t,lu,n?n.y:void 0,r?r.y:void 0)}function du(e){return e.translate===0&&e.scale===1}function fu(e){return du(e.x)&&du(e.y)}function pu(e,t){return e.min===t.min&&e.max===t.max}function mu(e,t){return pu(e.x,t.x)&&pu(e.y,t.y)}function hu(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function gu(e,t){return hu(e.x,t.x)&&hu(e.y,t.y)}function _u(e){return Zl(e.x)/Zl(e.y)}function vu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function yu(e){return[e(`x`),e(`y`)]}function bu(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:a,skewX:o,skewY:s}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),a&&(r+=`rotateY(${a}deg) `),o&&(r+=`skewX(${o}deg) `),s&&(r+=`skewY(${s}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var xu=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomLeftRadius`,`borderBottomRightRadius`],Su=xu.length,Cu=e=>typeof e==`string`?parseFloat(e):e,wu=e=>typeof e==`number`||H.test(e);function Tu(e,t,n,r,i,a){i?(e.opacity=W(0,n.opacity??1,Du(r)),e.opacityExit=W(t.opacity??1,0,Ou(r))):a&&(e.opacity=W(t.opacity??1,n.opacity??1,r));for(let i=0;i<Su;i++){let a=xu[i],o=Eu(t,a),s=Eu(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||wu(o)===wu(s)?(e[a]=Math.max(W(Cu(o),Cu(s),r),0),(ci.test(s)||ci.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=W(t.rotate||0,n.rotate||0,r))}function Eu(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Du=ku(0,.5,yr),Ou=ku(.5,.95,Zn);function ku(e,t,n){return r=>r<e?0:r>t?1:n(er(e,t,r))}function Au(e,t,n){let r=K(e)?e:Qo(e);return r.start(Uo(``,r,t,n)),r.animation}function ju(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var Mu=(e,t)=>e.depth-t.depth,Nu=class{constructor(){this.children=[],this.isDirty=!1}add(e){Bn(this.children,e),this.isDirty=!0}remove(e){Vn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Mu),this.isDirty=!1,this.children.forEach(e)}};function Pu(e,t){let n=Rr.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(Pr(r),e(a-t))};return B.setup(r,!0),()=>Pr(r)}function Fu(e){return K(e)?e.get():e}var Iu=class{constructor(){this.members=[]}add(e){Bn(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(Vn(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Vn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Lu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Ru={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},zu=[``,`X`,`Y`,`Z`],Bu=1e3,Vu=0;function Hu(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Uu(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=ss(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,B,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Uu(r)}function Wu({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Vu++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Ar.value&&(Ru.nodes=Ru.calculatedTargetDeltas=Ru.calculatedProjections=0),this.nodes.forEach(qu),this.nodes.forEach(nd),this.nodes.forEach(rd),this.nodes.forEach(Ju),Ar.addProjectionMetrics&&Ar.addProjectionMetrics(Ru)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Nu)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new tr),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=nc(t)&&!_c(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;B.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Pu(i,250),Lu.hasAnimatedSinceResize&&(Lu.hasAnimatedSinceResize=!1,this.nodes.forEach(td)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||ud,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!gu(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...Bo(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l)}else t||td(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Pr(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(id),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Uu(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(Zu),this.nodes.forEach(Xu);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Qu);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach($u),this.nodes.forEach(ed),this.nodes.forEach(Gu),this.nodes.forEach(Ku)):this.nodes.forEach(Qu),this.clearAllSnapshots();let e=Rr.now();V.delta=Hn(0,1e3/60,e-V.timestamp),V.timestamp=e,V.isProcessing=!0,Fr.update.process(V),Fr.preRender.process(V),Fr.render.process(V),V.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Fs.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Yu),this.sharedNodes.forEach(ad)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,B.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){B.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Zl(this.snapshot.measuredBox.x)&&!Zl(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=q(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!fu(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||qc(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),md(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return q();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(gd))){let{scroll:e}=this.root;e&&(rl(t.x,e.offset.x),rl(t.y,e.offset.y))}return t}removeElementScroll(e){let t=q();if(Ul(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&Ul(t,e),rl(t.x,i.offset.x),rl(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||q();Ul(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(rl(r.x,-n.scroll.offset.x),rl(r.y,-n.scroll.offset.y)),qc(n.latestValues)&&ol(r,n.latestValues,n.layout?.layoutBox)}return qc(this.latestValues)&&ol(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=q();Ul(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!qc(n.latestValues))continue;let r;n.instance&&(Kc(n.latestValues)&&n.updateSnapshot(),r=q(),Ul(r,n.measurePageBox())),uu(t,n.latestValues,n.snapshot?.layoutBox,r)}return qc(this.latestValues)&&uu(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0?!0:e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==V.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=V.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=q(),this.targetWithTransforms=q()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),nu(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Ul(this.target,this.layout.layoutBox),$c(this.target,this.targetDelta)):Ul(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Ar.value&&Ru.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Kc(this.parent.latestValues)||Jc(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=q(),this.relativeTargetOrigin=q(),iu(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),Ul(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===V.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;Ul(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;nl(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=q());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Wl(this.prevProjectionDelta.x,this.projectionDelta.x),Wl(this.prevProjectionDelta.y,this.projectionDelta.y)),eu(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!vu(this.projectionDelta.x,this.prevProjectionDelta.x)||!vu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Ar.value&&Ru.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=xc(),this.projectionDelta=xc(),this.projectionDeltaWithTransform=xc()}setAnimationOrigin(e,t=!1){let n=this.snapshot,r=n?n.latestValues:{},i={...this.latestValues},a=xc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=q(),s=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),l=!c||c.members.length<=1,u=!!(s&&!l&&this.options.crossfade===!0&&!this.path.some(ld));this.animationProgress=0;let d;this.mixTargetDelta=t=>{let n=t/1e3;od(a.x,e.x,n),od(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(iu(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),cd(this.relativeTarget,this.relativeTargetOrigin,o,n),d&&mu(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||=q(),Ul(d,this.relativeTarget)),s&&(this.animationValues=i,Tu(i,r,this.latestValues,n,u,l)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(Pr(this.pendingAnimation),void 0),this.pendingAnimation=B.update(()=>{Lu.hasAnimatedSinceResize=!0,zr.layout++,this.motionValue||=Qo(0),this.motionValue.jump(0,!1),this.currentAnimation=Au(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{zr.layout--},onComplete:()=>{zr.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Bu),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&hd(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||q();let t=Zl(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Zl(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Ul(t,n),ol(t,i),eu(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Iu),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return e?e.lead===this:!0}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&Hu(`z`,e,r,this.animationValues);for(let t=0;t<zu.length;t++)Hu(`rotate${zu[t]}`,e,r,this.animationValues),Hu(`skew${zu[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=Fu(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=Fu(t?.pointerEvents)||``),this.hasProjected&&!qc(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=bu(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in _l){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=_l[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?Fu(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(Xu),this.root.sharedNodes.clear()}}}function Gu(e){e.updateLayout()}function Ku(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)yu(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Zl(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;Hl(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else hd(i,t.layoutBox,n)&&yu(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Zl(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=xc();eu(o,n,t.layoutBox);let s=xc();a?eu(s,e.applyTransform(r,!0),t.measuredBox):eu(s,n,t.layoutBox);let c=!fu(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=q();iu(s,t.layoutBox,i.layoutBox,o);let c=q();iu(c,n,a.layoutBox,o),gu(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function qu(e){Ar.value&&Ru.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function Ju(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Yu(e){e.clearSnapshot()}function Xu(e){e.clearMeasurements()}function Zu(e){e.isLayoutDirty=!0,e.updateLayout()}function Qu(e){e.isLayoutDirty=!1}function $u(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function ed(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function td(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function nd(e){e.resolveTargetDelta()}function rd(e){e.calcProjection()}function id(e){e.resetSkewAndRotation()}function ad(e){e.removeLeadSnapshot()}function od(e,t,n){e.translate=W(t.translate,0,n),e.scale=W(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function sd(e,t,n,r){e.min=W(t.min,n.min,r),e.max=W(t.max,n.max,r)}function cd(e,t,n,r){sd(e.x,t.x,n.x,r),sd(e.y,t.y,n.y,r)}function ld(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var ud={duration:.45,ease:[.4,0,.1,1]},dd=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),fd=dd(`applewebkit/`)&&!dd(`chrome/`)?Math.round:Zn;function pd(e){e.min=fd(e.min),e.max=fd(e.max)}function md(e){pd(e.x),pd(e.y)}function hd(e,t,n){return e===`position`||e===`preserve-aspect`&&!Ql(_u(t),_u(n),.2)}function gd(e){return e!==e.root&&e.scroll?.wasRoot}var _d=Wu({attachResizeListener:(e,t)=>ju(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),vd={current:void 0},yd=Wu({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!vd.current){let e=new _d({});e.mount(window),e.setOptions({layoutScroll:!0}),vd.current=e}return vd.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),bd=(0,i.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function xd(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Sd(...e){return t=>{let n=!1,r=e.map(e=>{let r=xd(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():xd(e[t],null)}}}}function Cd(...e){return i.useCallback(Sd(...e),e)}var wd=class extends i.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Ps(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Ps(e)&&e.offsetWidth||0,r=Ps(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}};function Td({children:e,isPresent:t,anchorX:n,anchorY:r,root:o,pop:s}){let c=(0,i.useId)(),l=(0,i.useRef)(null),u=(0,i.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:d}=(0,i.useContext)(bd),f=Cd(l,e.props?.ref??e?.ref);return(0,i.useInsertionEffect)(()=>{let{width:e,height:i,top:a,left:f,right:p,bottom:m}=u.current;if(t||s===!1||!l.current||!e||!i)return;let h=n===`left`?`left: ${f}`:`right: ${p}`,g=r===`bottom`?`bottom: ${m}`:`top: ${a}`;l.current.dataset.motionPopId=c;let _=document.createElement(`style`);d&&(_.nonce=d);let v=o??document.head;return v.appendChild(_),_.sheet&&_.sheet.insertRule(`
|
|
3
3
|
[data-motion-pop-id="${c}"] {
|
|
4
4
|
position: absolute !important;
|
package/dist/renderer.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-CiTBaPhY.cjs`);const e=require(`./ContactPopup-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-CiTBaPhY.cjs`);const e=require(`./ContactPopup-ss9U88BV.cjs`);exports.ContactPopup=e.t;
|
package/dist/renderer.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./ContactPopup-
|
|
1
|
+
import { t as e } from "./ContactPopup-BBgHbtwd.js";
|
|
2
2
|
export { e as ContactPopup };
|