@vertesia/ui 1.5.0-dev.20260826.064249Z → 1.5.0-dev.20260901.033115Z
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/lib/core/components/FormItem.d.ts.map +1 -1
- package/lib/core/components/FormItem.js +2 -3
- package/lib/core/components/FormItem.js.map +1 -1
- package/lib/core/components/InfoTip.d.ts +20 -0
- package/lib/core/components/InfoTip.d.ts.map +1 -0
- package/lib/core/components/InfoTip.js +18 -0
- package/lib/core/components/InfoTip.js.map +1 -0
- package/lib/core/components/index.d.ts +1 -0
- package/lib/core/components/index.d.ts.map +1 -1
- package/lib/core/components/index.js +1 -0
- package/lib/core/components/index.js.map +1 -1
- package/lib/core/components/shadcn/Panel.d.ts.map +1 -1
- package/lib/core/components/shadcn/Panel.js +3 -3
- package/lib/core/components/shadcn/Panel.js.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.d.ts +15 -0
- package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.js +45 -2
- package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
- package/lib/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -1
- package/lib/features/store/objects/selection/actions/DeleteObjectsAction.js +5 -0
- package/lib/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.js +1 -1
- package/lib/features/store/types/IntakePolicyEditor.js.map +1 -1
- package/lib/features/store/types/IntakePolicyForm.d.ts.map +1 -1
- package/lib/features/store/types/IntakePolicyForm.js +15 -15
- package/lib/features/store/types/IntakePolicyForm.js.map +1 -1
- package/lib/features/store/types/TypeRegistry.d.ts +10 -0
- package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +10 -0
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
- package/lib/i18n/locales/ar.json +35 -0
- package/lib/i18n/locales/de.json +35 -0
- package/lib/i18n/locales/en.json +35 -0
- package/lib/i18n/locales/es.json +35 -0
- package/lib/i18n/locales/fr.json +35 -0
- package/lib/i18n/locales/it.json +35 -0
- package/lib/i18n/locales/ja.json +35 -0
- package/lib/i18n/locales/ko.json +35 -0
- package/lib/i18n/locales/pt.json +35 -0
- package/lib/i18n/locales/ru.json +35 -0
- package/lib/i18n/locales/tr.json +35 -0
- package/lib/i18n/locales/zh-TW.json +35 -0
- package/lib/i18n/locales/zh.json +35 -0
- package/lib/router/RouteComponent.d.ts +8 -0
- package/lib/router/RouteComponent.d.ts.map +1 -1
- package/lib/router/RouteComponent.js +41 -9
- package/lib/router/RouteComponent.js.map +1 -1
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +12 -13
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/domainRouting.d.ts +11 -0
- package/lib/session/auth/domainRouting.d.ts.map +1 -1
- package/lib/session/auth/domainRouting.js +13 -0
- package/lib/session/auth/domainRouting.js.map +1 -1
- package/lib/session/useUXTracking.d.ts.map +1 -1
- package/lib/session/useUXTracking.js +6 -1
- package/lib/session/useUXTracking.js.map +1 -1
- package/lib/vertesia-ui-core.js +199 -4
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-features.js +975 -33
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.BJBGsq-8.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BJBGsq-8.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BY5YG5cX.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BY5YG5cX.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.Bd5_1BXO.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.Bd5_1BXO.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.Bvwej2HH.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.Bvwej2HH.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CMT3f4gf.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CMT3f4gf.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.D56DNPJW.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.D56DNPJW.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DDzKLNx6.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DDzKLNx6.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.D_Am1LpF.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.D_Am1LpF.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DrZizgGV.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DrZizgGV.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DwHsq86z.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DwHsq86z.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.PLpo0Bbz.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.PLpo0Bbz.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.js +2 -38
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-i18n.xVbXALqz.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.xVbXALqz.chunk.js.map +1 -0
- package/lib/vertesia-ui-layout.js +80 -1
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-rich-text.js +278 -4
- package/lib/vertesia-ui-rich-text.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +118 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +336 -20
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/package.json +7 -7
- package/src/core/components/FormItem.tsx +2 -5
- package/src/core/components/InfoTip.test.tsx +33 -0
- package/src/core/components/InfoTip.tsx +32 -0
- package/src/core/components/index.ts +1 -0
- package/src/core/components/shadcn/Panel.tsx +3 -7
- package/src/features/store/objects/search/DocumentSearchContext.test.ts +45 -0
- package/src/features/store/objects/search/DocumentSearchContext.ts +50 -2
- package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +5 -0
- package/src/features/store/types/IntakePolicyEditor.tsx +3 -4
- package/src/features/store/types/IntakePolicyForm.tsx +120 -20
- package/src/i18n/locales/ar.json +35 -0
- package/src/i18n/locales/de.json +35 -0
- package/src/i18n/locales/en.json +35 -0
- package/src/i18n/locales/es.json +35 -0
- package/src/i18n/locales/fr.json +35 -0
- package/src/i18n/locales/it.json +35 -0
- package/src/i18n/locales/ja.json +35 -0
- package/src/i18n/locales/ko.json +35 -0
- package/src/i18n/locales/pt.json +35 -0
- package/src/i18n/locales/ru.json +35 -0
- package/src/i18n/locales/tr.json +35 -0
- package/src/i18n/locales/zh-TW.json +35 -0
- package/src/i18n/locales/zh.json +35 -0
- package/src/router/RouteComponent.test.tsx +139 -0
- package/src/router/RouteComponent.tsx +54 -9
- package/src/session/UserSessionProvider.tsx +12 -11
- package/src/session/auth/domainRouting.test.ts +24 -1
- package/src/session/auth/domainRouting.ts +29 -0
- package/src/session/useUXTracking.tsx +6 -1
package/lib/vertesia-ui-shell.js
CHANGED
|
@@ -1,2 +1,119 @@
|
|
|
1
|
-
import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{createContext as r,useCallback as i,useContext as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{Avatar as u,Button as d,Center as f,ErrorBox as p,Input as m,MenuList as h,Modal as g,ModalBody as _,ModalFooter as v,ModalTitle as y,ModeToggle as b,Popover as x,PopoverContent as S,PopoverTrigger as C,RadioGroup as ee,SelectBox as w,Spinner as T,Tabs as te,TabsBar as E,TabsPanel as D,ThemeProvider as O,ToastProvider as ne,VTooltip as k,errorMessage as A,useFetch as j,useToast as re}from"@vertesia/ui/core";import{AuthenticationServiceError as ie,CredentialError as M,DevSessionProvider as ae,LastSelectedAccountId_KEY as N,LastSelectedProjectId_KEY as oe,NoAccessibleAccountError as P,RequestedScopeUnavailableError as F,RestrictedEnvironmentError as se,UserNotFoundError as ce,UserSessionProvider as I,fetchComposableTokenFromFirebaseToken as le,fetchComposableTokenFromVertesiaToken as ue,getCurrentVertesiaToken as de,getFirebaseAuth as L,setFirebaseTenant as fe,useUXTracking as pe,useUserSession as R}from"@vertesia/ui/session";import"@radix-ui/react-direction";import{LanguageBoundI18nProvider as me,LanguageProvider as he,useUITranslation as z}from"@vertesia/ui/i18n";import{AlertTriangle as ge,ArrowRight as _e,Check as ve,CopyIcon as ye,LockIcon as be,LockKeyhole as xe,Mail as Se,ShieldOff as Ce}from"lucide-react";import{Permission as we,REQUESTED_SCOPE_UNAVAILABLE_ERROR_CODE as Te,getTenantIdFromProject as Ee}from"@vertesia/common";import{Env as B}from"@vertesia/ui/env";import{RegionTag as De}from"@vertesia/ui/layout";import{GithubAuthProvider as Oe,GoogleAuthProvider as ke,OAuthProvider as Ae,signInWithRedirect as je,signOut as Me}from"firebase/auth";import{useLocation as Ne,useNavigate as Pe}from"@vertesia/ui/router";import{TypeRegistryProvider as Fe,UserPermissionProvider as Ie,useUserPermissions as Le}from"@vertesia/ui/features";import Re from"clsx";import{AnimatePresence as ze,motion as Be}from"framer-motion";const V=r(null);function Ve({installation:e,children:n}){return t(V.Provider,{value:e,children:n})}function He(){return a(V)}function Ue({app:e,onChange:r,placeholder:i}){let{client:a,project:o}=R(),{data:s,error:c}=j(()=>a.apps.getAppInstallationProjects(e),[e.id,e.name]);return c?n(`span`,{className:`text-red-600`,children:[`Error: failed to fetch projects: `,A(c)]}):t(We,{placeholder:i,initialValue:o?.id,projects:s||[],onChange:e=>{r&&!r(e)||(localStorage.setItem(N,e.account),localStorage.setItem(`${oe}-${e.account}`,e.id),window.location.reload())}})}function We({initialValue:e,projects:n,onChange:r,placeholder:i=`Select Project`}){let[a,o]=l(),s=e=>{o(e),r(e)},c=!a&&e?n.find(t=>t.id===e):a;return t(w,{by:`id`,value:c,options:n,optionLabel:e=>e.name,placeholder:i,onChange:s})}const Ge=r({theme:`system`,setTheme:()=>null}),Ke=()=>{let e=a(Ge);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e},qe=[`ar`,`de`,`en`,`es`,`fr`,`it`,`ja`,`ko`,`pt`,`ru`,`tr`,`zh`,`zh-TW`],Je=r({language:`en`,setLanguage:()=>null,isRTL:!1});function Ye(){let e=a(Je);if(e===void 0)throw Error(`useLanguage must be used within a LanguageProvider`);return e}const Xe=`vertesia:iframe-auth-request`,Ze=`vertesia:iframe-auth-response`,H=`vertesia:iframe-context-request`,Qe=`vertesia:iframe-context`,$e=`vertesia:iframe-navigate`,et=`vertesia:iframe-location-change`,tt=`__vertesia_slot`,U=`__vertesia_host_origin`,nt=`content`;function rt(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-auth-request`&&typeof t.requestId==`string`&&!!t.requestId}function it(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-auth-response`&&typeof t.requestId==`string`&&!!t.requestId&&(t.token===void 0||typeof t.token==`string`)}function at(e){return!e||typeof e!=`object`?!1:e.type===H}function ot(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-context`&&(t.theme===`dark`||t.theme===`light`||t.theme===`system`)&&typeof t.language==`string`&&qe.includes(t.language)}function st(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-navigate`&&typeof t.url==`string`&&!!t.url}function ct(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-location-change`&&typeof t.url==`string`&&!!t.url}const W=new Set([`localhost`,`127.0.0.1`,`[::1]`]);function lt(e){if(e)try{let t=new URL(e),n=W.has(t.hostname);return t.protocol===`https:`||t.protocol===`http:`&&n?t:void 0}catch{return}}function ut(e){if(!e)return!1;let t=e.trim(),n=t.indexOf(`://`);if(n<0)return!1;let r=n+3,i=t.slice(r),a=i.search(/[/?#]/);return(a<0?i:i.slice(0,a)).includes(`@`)}function dt(e){if(e===`studio.vertesia.io`)return!0;let t=e.split(`.`);if(t.at(-2)!==`vertesia`||t.at(-1)!==`io`)return!1;let n=t.slice(0,-2),r=n.lastIndexOf(`cloud`);if(r>=0&&n.length-r<=2)return!0;let i=n.lastIndexOf(`ui`);return i>=0&&n.length-i===2}function ft(e){if(ut(e))return;let t=lt(e);if(!t)return;let n=t.hostname,r=dt(n),i=W.has(n)&&W.has(window.location.hostname);return t.protocol===`https:`&&r||i?t.origin:void 0}function pt(){return window.parent===window?void 0:ft(new URL(window.location.href).searchParams.get(U))||ft(document.referrer)}function mt(e=5e3){let t=pt();if(!t)return Promise.resolve(void 0);let n=crypto.randomUUID();return new Promise(r=>{let i,a,o=250,s=e=>{window.removeEventListener(`message`,c),clearTimeout(i),clearTimeout(a),r(e)},c=e=>{e.source!==window.parent||e.origin!==t||!it(e.data)||e.data.requestId===n&&e.data.token&&s(e.data.token)},l={type:Xe,requestId:n},u=()=>{window.parent.postMessage(l,t),a=window.setTimeout(u,o),o=Math.min(o*2,1e3)};i=window.setTimeout(()=>s(),e),window.addEventListener(`message`,c),u()})}function ht(e){if(e==null)return e;let t=new URL(window.location.href).searchParams.get(U);if(!t)return e;try{let n=new URL(e,window.location.href);return n.origin===window.location.origin?(n.searchParams.set(U,t),n):e}catch{return e}}function gt(){let{setTheme:e}=Ke(),{setLanguage:t}=Ye();return o(()=>{let n=pt();if(!n)return;let r=()=>{let e={type:et,url:window.location.href};window.parent.postMessage(e,n)},i=window.history.pushState,a=window.history.replaceState,o=(e,t,n)=>{i.call(window.history,e,t,ht(n)),r()},s=(e,t,n)=>{a.call(window.history,e,t,ht(n)),r()};window.history.pushState=o,window.history.replaceState=s;let c=i=>{if(i.source===window.parent&&i.origin===n){if(ot(i.data)){let n=i.data;e(n.theme,{persist:!1}),t(n.language,{persist:!1});return}if(st(i.data)){let e;try{e=new URL(i.data.url,window.location.href)}catch{return}if(e.origin!==window.location.origin)return;if(e.href===window.location.href){r();return}window.history.replaceState(window.history.state,``,e),window.dispatchEvent(new PopStateEvent(`popstate`,{state:window.history.state}))}}},l={type:H};return window.addEventListener(`message`,c),window.addEventListener(`popstate`,r),window.addEventListener(`hashchange`,r),window.parent.postMessage(l,n),r(),()=>{window.removeEventListener(`message`,c),window.removeEventListener(`popstate`,r),window.removeEventListener(`hashchange`,r),window.history.pushState===o&&(window.history.pushState=i),window.history.replaceState===s&&(window.history.replaceState=a)}},[t,e]),null}function _t({name:e,AccessDenied:n=yt,children:r}){return e?t(vt,{name:e,AccessDenied:n,children:r}):t(bt,{})}function vt({name:e,AccessDenied:n=yt,children:r}){let{authToken:i,client:a}=R(),[s,c]=l(null),[u,d]=l(`loading`);if(o(()=>{i?i.apps.includes(e)?a.apps.getAppInstallationByName(e).then(t=>{t?(d(`loaded`),c(t)):(console.log(`App ${e} not found!`),d(`error`))}):d(`error`):d(`loading`)},[e,i,a.apps.getAppInstallationByName]),u===`loading`)return null;if(u===`error`)return t(n,{name:e});if(s)return t(Ve,{installation:s,children:r})}function yt({name:e}){let{project:r,accounts:i,client:a}=R(),{t:c}=z(),[u,d]=l(),{data:p}=j(()=>a.apps.getAppInstallationProjects({name:e}),[e]),{projectsByOrg:m,orgOptions:h}=s(()=>{if(!p||!i)return{projectsByOrg:{},orgOptions:[]};let e={};for(let t of p)e[t.account]||(e[t.account]=[]),e[t.account].push(t);return{projectsByOrg:e,orgOptions:i.filter(t=>e[t.id]?.length>0)}},[p,i]);o(()=>{!u&&h.length>0&&d(h[0].id)},[h,u]);let g=e=>{localStorage.setItem(N,e.account),localStorage.setItem(`${oe}-${e.account}`,e.id),window.location.reload()},_=u&&m[u]||[],v=h.find(e=>e.id===u);return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(be,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:c(`shell.accessDenied`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`You don't have permission to view the `,t(`span`,{className:`font-semibold`,children:e}),` app in project:`,` `,n(`span`,{className:`font-semibold`,children:[`«`,r?.name,`»`]}),`.`]}),h.length===0&&p!==void 0&&t(`div`,{className:`mt-4 text-sm text-gray-500`,children:`This app is not installed in any project you have access to.`}),h.length>0&&n(`div`,{className:`mt-4 flex flex-row gap-4 items-end`,children:[h.length>1&&n(`div`,{children:[t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`shell.organization`)}),t(w,{by:`id`,value:v,options:h,optionLabel:e=>e.name,placeholder:c(`shell.selectOrganization`),onChange:e=>d(e.id)})]}),n(`div`,{children:[h.length>1&&t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`login.terminal.project`)}),t(w,{by:`id`,value:void 0,options:_,optionLabel:e=>e.name,placeholder:c(`shell.selectProject`),onChange:g})]})]})]})}function bt(){let{t:e}=z();return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(be,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:e(`shell.applicationNotRegistered`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.`,t(`p`,{}),`Then use the created app name as a parameter to`,` `,t(`code`,{children:`<StandaloneApp name="your-app-name">`}),` in the `,t(`code`,{children:`src/main.tsx`}),` file.`]})]})}function xt(){let e=R(),{client:r}=e,{t:i}=z(),[a,s]=l(!1),[c,u]=l([]);o(()=>{r.account.listInvites().then(e=>{if(e.length>0){let t=e.filter(e=>e.data.account);if(t.length===0){console.log(`No valid invites found, closing modal`);return}console.log(`Found valid invites`,t.length),s(!0),u(t)}else console.log(`No invites found, closing modal`),s(!1)}).catch(e=>{console.error(`Error fetching invites`,e)})},[r.account.listInvites]);let f=()=>s(!1),p=async t=>{await r.account.acceptInvite(t.id),await e.authCallback,await e.fetchAccounts(),await e.fetchProjects(t.data.account.id);let n=c.filter(e=>e.id!==t.id).filter(e=>e.data.account);n.length>0?u(n):f()},m=async e=>{await r.account.rejectInvite(e.id);let t=c.filter(t=>t.id!==e.id);u(t),t.length===0&&f()},h=c.map(e=>e.data.account?n(`div`,{className:`flex flex-row w-full justify-between border rounded-sm px-2 py-2 `,children:[n(`div`,{className:`flex flex-col`,children:[t(`div`,{className:`w-full font-semibold`,children:e.data.account.name??e.data.account}),e.data.project&&n(`div`,{className:`w-full text-base`,children:[`- `,e.data.project.name]}),n(`div`,{className:`text-xs`,children:[`Role: `,e.data.role]}),e.data.invited_by&&n(`div`,{className:`text-xs`,children:[`by `,e.data.invited_by.name??e.data.invited_by]})]}),n(`div`,{className:`flex flex-col gap-4`,children:[t(d,{size:`xs`,onClick:()=>p(e),children:i(`login.accept`)}),` `,t(d,{size:`xs`,variant:`secondary`,onClick:()=>m(e),children:i(`login.reject`)})]})]},e.id):(console.warn(`Invite has no account data`,e),null));return t(`div`,{children:n(g,{isOpen:a,onClose:f,children:[t(y,{children:i(`login.reviewInvites`)}),n(_,{children:[t(`div`,{className:`text-sm pb-4`,children:`You have received the following invites to join other accounts. Please review and accept or declined them.`}),h]})]})})}function St(e){return n(`svg`,{viewBox:`0 0 48 48`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#FFC107`,d:`M43.6 20.5H42V20H24v8h11.3c-1.6 4.7-6.1 8-11.3 8a12 12 0 0 1 0-24c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 1 0 24 44c11 0 20-9 20-20 0-1.2-.1-2.3-.4-3.5z`}),t(`path`,{fill:`#FF3D00`,d:`M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z`}),t(`path`,{fill:`#4CAF50`,d:`M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28.5l-6.6 5.1A20 20 0 0 0 24 44z`}),t(`path`,{fill:`#1976D2`,d:`M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4 5.5l6.3 5.3C37.9 36.6 44 31 44 24c0-1.2-.1-2.3-.4-3.5z`})]})}function Ct(e){return t(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:t(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.48 2 2 6.58 2 12.25c0 4.54 2.87 8.39 6.84 9.75.5.09.68-.22.68-.49v-1.7c-2.78.62-3.37-1.36-3.37-1.36-.46-1.18-1.11-1.5-1.11-1.5-.91-.63.07-.62.07-.62 1 .07 1.53 1.05 1.53 1.05.89 1.57 2.34 1.12 2.91.86.09-.66.35-1.12.63-1.38-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.7 0 0 .84-.28 2.76 1.05A9.4 9.4 0 0 1 12 7.07c.85 0 1.71.12 2.51.34 1.91-1.33 2.75-1.05 2.75-1.05.55 1.4.2 2.44.1 2.7.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.81c0 .27.18.59.69.49C19.13 20.64 22 16.78 22 12.25 22 6.58 17.52 2 12 2z`})})}function wt(e){return n(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#F25022`,d:`M2 2h9.5v9.5H2z`}),t(`path`,{fill:`#7FBA00`,d:`M12.5 2H22v9.5h-9.5z`}),t(`path`,{fill:`#00A4EF`,d:`M2 12.5h9.5V22H2z`}),t(`path`,{fill:`#FFB900`,d:`M12.5 12.5H22V22h-9.5z`})]})}const Tt=xe,Et={google:St,github:Ct,microsoft:wt,oidc:Tt};function Dt(e){return e&&e in Et?Et[e]:Tt}function G({children:e,centered:n=!1}){return t(`div`,{className:n?`w-full max-w-[420px] flex flex-col gap-6 items-center text-center`:`w-full max-w-[420px] flex flex-col gap-6`,children:e})}function K({eyebrow:e,title:r,body:i,variant:a=`info`}){return n(`div`,{children:[e&&t(`div`,{className:`${a===`destructive`?`text-destructive`:`text-info`} text-[12.5px] font-medium mb-2`,children:e}),t(`h1`,{className:`text-foreground text-[22px] font-semibold tracking-tight leading-tight mb-1.5`,children:r}),i&&t(`p`,{className:`text-muted text-sm leading-relaxed`,children:i})]})}const Ot={primary:`h-[42px] gap-2.5 rounded-md bg-foreground text-background hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed`,loading:`h-[42px] gap-2.5 rounded-md bg-foreground text-background opacity-90`,ghost:`h-9 text-muted hover:text-foreground`};function q({variant:e=`primary`,className:n=``,type:r=`button`,disabled:i,...a}){return t(d,{variant:`unstyled`,size:`none`,type:r,disabled:e===`loading`||i,className:`cursor-pointer inline-flex items-center justify-center text-sm font-medium transition ${Ot[e]} ${n}`.trim(),...a})}function kt({size:e=`xs`,className:n=``,type:r=`button`,...i}){let a=`cursor-pointer ${e===`smaller`?`!text-[11px]`:`!text-xs`} text-muted hover:text-foreground !transition px-2 py-1 !rounded underline decoration-transparent hover:decoration-current underline-offset-[3px]`;return t(d,{variant:`unstyled`,size:`none`,type:r,className:n?`${a} ${n}`:a,...i})}const At={circle:`size-9 rounded-full text-sm ring-4 ring-background ring-offset-1 ring-offset-border`,square:`size-[30px] rounded-md text-[11px]`};function jt({initials:e,shape:n=`circle`}){return t(`span`,{className:`bg-info text-info-foreground grid place-items-center font-semibold shrink-0 ${At[n]}`,children:e})}function Mt({children:e}){return t(`div`,{className:`inline-grid place-items-center size-14 rounded-xl bg-info-background border border-info/15 mb-3.5`,children:e})}function Nt({title:e,subtitle:r,titleClass:i,subtitleClass:a}){return n(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:i,children:e}),t(`div`,{className:a,children:r})]})}const Pt={tenant:{topRow:`flex items-center gap-2.5 px-3 py-2.5`,title:`text-[13.5px] font-semibold text-foreground leading-tight`,subtitle:`text-[11.5px] text-muted leading-tight mt-0.5`,bottomRow:`flex items-center gap-2.5 px-3 py-1.5 border-t border-border bg-muted-background`,mailBox:`size-[30px] grid place-items-center shrink-0`,mailIcon:`size-4 text-muted`,email:`text-sm text-foreground/80 flex-1 truncate`,actionSize:`xs`},returning:{topRow:`flex items-center gap-3 px-3.5 py-2.5`,title:`text-sm font-semibold text-foreground truncate`,subtitle:`text-xs text-foreground/80 truncate`,bottomRow:`flex items-center gap-3 px-3.5 py-1 border-t border-border bg-muted-background`,mailBox:`w-9 h-6 grid place-items-center shrink-0`,mailIcon:`size-3.5 text-muted`,email:`text-xs text-foreground/80 flex-1 truncate`,actionSize:`smaller`}};function Ft({variant:e=`returning`,badge:r,title:i,subtitle:a,email:o,actionLabel:s,onAction:c}){let l=Pt[e];return n(`div`,{className:`rounded-md border border-border bg-background overflow-hidden`,children:[n(`div`,{className:l.topRow,children:[r,t(Nt,{title:i,subtitle:a,titleClass:l.title,subtitleClass:l.subtitle})]}),n(`div`,{className:l.bottomRow,children:[t(`div`,{className:l.mailBox,children:t(Se,{className:l.mailIcon})}),t(`span`,{className:l.email,children:o}),t(kt,{size:l.actionSize,onClick:c,children:s})]})]})}function It({badge:e,title:r,subtitle:i,actionLabel:a,onAction:o}){return n(`div`,{className:`flex items-center gap-3 px-3.5 py-2.5 rounded-md border border-border bg-muted-background`,children:[e,t(Nt,{title:r,subtitle:i,titleClass:`text-sm font-semibold text-foreground truncate`,subtitleClass:`text-xs text-muted truncate`}),t(kt,{onClick:o,children:a})]})}function Lt({email:e,actionLabel:r,onAction:i}){return n(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-border bg-muted-background`,children:[t(Se,{className:`size-4 text-muted shrink-0`}),t(`span`,{className:`text-sm text-foreground/80 flex-1 truncate`,children:e}),t(kt,{onClick:i,children:r})]})}function Rt({provider:e,label:r,onClick:i,variant:a=`outline`}){let o=Dt(e);return a===`arrow`?n(d,{variant:`unstyled`,size:`none`,onClick:i,className:`cursor-pointer group h-[42px] w-full inline-flex items-center gap-3 ps-3.5 pe-3 rounded-md border border-border bg-background text-sm font-medium text-foreground transition hover:bg-muted-background`,children:[t(o,{className:`!size-[18px] shrink-0`}),t(`span`,{className:`flex-1 text-start`,children:r}),t(_e,{className:`!size-3.5 text-muted opacity-0 group-hover:opacity-100 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 transition`})]}):n(d,{variant:`outline`,onClick:i,className:`w-full py-5 flex rounded-lg transition duration-150 text-center ${a===`filled`?`!bg-foreground text-background hover:!bg-foreground/90`:`hover:shadow-sm`}`,children:[t(o,{className:`!size-[18px]`}),t(`span`,{className:`text-sm font-medium`,children:r})]})}function zt({icon:e,title:r,meta:i}){return n(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5 rounded-md bg-destructive-background border border-destructive/20`,children:[t(e,{className:`size-5 text-destructive shrink-0`}),n(`div`,{className:`flex-1 min-w-0 text-sm`,children:[t(`div`,{className:`font-semibold text-destructive`,children:r}),t(`div`,{className:`text-xs text-destructive/80`,children:i})]})]})}function Bt({inputRef:e,label:r,placeholder:i,value:a,onChange:o,invalid:s=!1,error:c}){return n(`div`,{className:`flex flex-col gap-1.5`,children:[t(`label`,{htmlFor:`vt-login-email`,className:`text-xs font-medium text-foreground/80`,children:r}),t(`input`,{ref:e,id:`vt-login-email`,name:`vt-login-email`,type:`email`,className:`h-[42px] px-3.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none transition focus:border-info focus:ring-4 focus:ring-info/15 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/15`,placeholder:i,value:a,onChange:e=>o(e.target.value),"aria-invalid":s,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-form-type":`other`}),c&&t(`div`,{role:`alert`,className:`text-xs text-destructive`,children:c})]})}const Vt=`vt.lastSuccessfulLogin`,Ht=`vt.pendingSignin`;function Ut(){try{let e=localStorage.getItem(Vt);if(!e)return null;let t=JSON.parse(e);return!t?.email||!t?.lastProvider?null:t}catch{return null}}function Wt(e){try{localStorage.setItem(Vt,JSON.stringify(e))}catch{}}function Gt(){try{localStorage.removeItem(Vt)}catch{}}function Kt(){try{let e=sessionStorage.getItem(Ht);return e?JSON.parse(e):null}catch{return null}}function qt(e){try{sessionStorage.setItem(Ht,JSON.stringify(e))}catch{}}function J(){try{sessionStorage.removeItem(Ht)}catch{}}async function Jt(){Gt(),J();try{await Me(L())}catch{}}function Yt(e){let t=e||window.location.pathname||`/`;return t[0]!==`/`&&(t=`/${t}`),t}const Xt={google:(e,t)=>{let n=new ke;return n.addScope(`profile`),n.addScope(`email`),n.setCustomParameters({redirect_uri:window.location.origin+Yt(t),...e?{login_hint:e}:{prompt:`select_account`}}),n},github:e=>{let t=new Oe;return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login:e}),t},microsoft:e=>{let t=new Ae(`microsoft.com`);return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login_hint:e}),t},oidc:e=>{let t=new Ae(`oidc.main`);return e&&t.setCustomParameters({login_hint:e}),t}};function Zt(e,t,n){return Xt[e](t,n)}async function Qt(e,t,n){if(!t)return{ok:!1,reason:`no-email`};let r=await fe(t),i=L(),a=e,o;return r?(r.provider&&(a=r.provider),o=r.label||r.name||void 0,localStorage.setItem(`tenantName`,o??``)):(localStorage.removeItem(`tenantName`),i.tenantId&&=null),qt({email:t,provider:a,tenantName:o}),je(i,Zt(a,t,n)),{ok:!0}}function $t(e,t){let n=L();localStorage.removeItem(`tenantName`),n.tenantId&&=null,je(n,Zt(e,void 0,t))}function Y(e){return e===`google`?`Google`:e===`github`?`GitHub`:e===`microsoft`?`Microsoft`:`Sign In`}function en(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(0,t):e}function tn(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(t+1):``}function nn(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function rn(e){return(e||`?`).charAt(0).toUpperCase()}function an(e){let t=en(e).split(/[._-]+/).filter(Boolean)[0]||`friend`;return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function on(e){for(let t of e)if(t.trim()===``)return!0;return!1}function sn(e){let t=(e||``).trim(),n=t.indexOf(`@`);if(n<=0||n!==t.lastIndexOf(`@`))return!1;let r=t.slice(n+1),i=r.indexOf(`.`);return i>0&&i<r.length-1&&!on(t)}function cn(e){let t=e;for(let e=0;t!=null&&e<8;e++){if((t instanceof Error?t.message:String(t)).includes(`Customer-domain user requires an invite to join`))return!0;t=t instanceof Error?t.cause:void 0}return!1}function ln({provider:e,onCancel:r}){let{t:i}=z(),a=Dt(e),o=e===`oidc`?i(`auth.pending.genericProvider`):Y(e);return n(G,{centered:!0,children:[n(`div`,{children:[t(Mt,{children:t(a,{className:e===`oidc`?`size-6 text-info`:`size-6`})}),t(K,{title:i(`auth.pending.title`,{provider:o}),body:i(`auth.pending.body`)})]}),n(`div`,{className:`w-full flex flex-col gap-2`,children:[n(q,{variant:`loading`,children:[t(T,{}),t(`span`,{children:i(`auth.pending.authenticating`)})]}),r&&t(q,{variant:`ghost`,onClick:r,children:i(`auth.pending.cancel`)})]})]})}function un({initialEmail:r,onProceed:i}){let{t:a}=z(),[s,u]=l(r??``),[d,f]=l(!1),[p,m]=l(!1),h=c(null);return o(()=>{h.current?.focus()},[]),n(G,{children:[t(K,{eyebrow:a(`auth.email.eyebrow`),title:a(`auth.email.title`),body:a(`auth.email.body`)}),n(`form`,{onSubmit:async e=>{if(e.preventDefault(),!p){if(!sn(s)){f(!0);return}f(!1),m(!0);try{let e=await fe(s.trim().toLowerCase());i(s.trim().toLowerCase(),e??void 0)}catch{i(s.trim().toLowerCase(),void 0)}finally{m(!1)}}},noValidate:!0,className:`flex flex-col ${d?`gap-2`:`gap-6`}`,children:[t(Bt,{inputRef:h,label:a(`auth.email.label`),placeholder:a(`auth.email.placeholder`),value:s,onChange:e=>{u(e),d&&f(!1)},invalid:d,error:d?a(`auth.email.invalidError`):void 0}),t(q,{type:`submit`,disabled:p,children:p?t(T,{}):n(e,{children:[t(`span`,{children:a(`auth.continue`)}),t(_e,{className:`!size-3.5`})]})})]})]})}const dn=[`google`,`github`,`microsoft`];function fn({email:e,onBack:r,onProviderClicked:i,redirectTo:a}){let{t:o}=z(),s=async t=>{i(t),await Qt(t,e,a)};return n(G,{children:[t(K,{eyebrow:o(`auth.providers.eyebrow`),title:o(`auth.providers.title`),body:o(`auth.providers.bodyConsumer`)}),t(Lt,{email:e,actionLabel:o(`auth.change`),onAction:r}),t(`div`,{className:`flex flex-col gap-2`,children:dn.map(e=>t(Rt,{provider:e,label:o(`auth.continueWithProvider`,{provider:Y(e)}),onClick:()=>s(e),variant:`arrow`},e))})]})}function X({details:r,identity:i,kind:a,onContinue:s,onUseDifferentAccount:u}){let{t:d}=z(),[f,p]=l(!1),m=c(null);o(()=>{m.current?.focus()},[]);let h=a===`scopeProject`||a===`scopeAccount`,g;g=a===`scopeProject`?{eyebrow:d(`auth.recovery.scopeProject.eyebrow`),title:d(`auth.recovery.scopeProject.title`),body:d(`auth.recovery.scopeProject.body`)}:a===`scopeAccount`?{eyebrow:d(`auth.recovery.scopeAccount.eyebrow`),title:d(`auth.recovery.scopeAccount.title`),body:d(`auth.recovery.scopeAccount.body`)}:a===`noAccessibleAccount`?{eyebrow:d(`auth.recovery.noAccessibleAccount.eyebrow`),title:d(`auth.recovery.noAccessibleAccount.title`),body:d(`auth.recovery.noAccessibleAccount.body`)}:a===`credential`?{eyebrow:d(`auth.recovery.credential.eyebrow`),title:d(`auth.recovery.credential.title`),body:d(`auth.recovery.credential.body`)}:{eyebrow:d(`auth.recovery.service.eyebrow`),title:d(`auth.recovery.service.title`),body:d(`auth.recovery.service.body`)};let _=e=>{f||(p(!0),e())};return n(G,{children:[n(`div`,{role:`alert`,"aria-live":`assertive`,children:[t(Mt,{children:t(ge,{className:`size-7 text-attention`,"aria-hidden":`true`})}),t(K,{eyebrow:g.eyebrow,title:g.title,body:g.body})]}),i&&t(It,{badge:t(jt,{initials:rn(i.email)}),title:i.name||an(i.email),subtitle:i.email,actionLabel:d(`auth.returning.notYou`),onAction:u}),n(`div`,{className:`flex flex-col gap-2`,children:[s&&t(q,{ref:m,className:`w-full`,disabled:f,onClick:()=>_(s),children:d(h?`auth.recovery.continue`:`auth.recovery.tryAgain`)}),t(q,{ref:s?void 0:m,variant:s?`ghost`:`primary`,disabled:f,onClick:()=>_(u),children:d(`auth.recovery.useDifferentAccount`)}),(a===`noAccessibleAccount`||a===`service`)&&n(`p`,{className:`text-center text-xs text-muted`,children:[d(`auth.recovery.supportPrefix`),` `,t(`a`,{className:`text-info`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`})]})]}),r&&n(`details`,{className:`rounded-lg border border-mixer-muted/30 bg-mixer-muted/10 px-4 py-3 text-sm`,children:[t(`summary`,{className:`cursor-pointer font-medium text-muted marker:text-muted focus-visible:outline-2 focus-visible:outline-offset-2`,children:d(`auth.recovery.technicalDetails`)}),n(`dl`,{className:`mt-3 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-2 text-xs`,children:[r.errorCode&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.errorCode`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.errorCode})]}),r.status&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.httpStatus`)}),t(`dd`,{className:`font-mono`,children:r.status})]}),r.accountId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.requestedAccount`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.accountId})]}),r.projectId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:d(`auth.recovery.requestedProject`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.projectId})]}),t(`dt`,{className:`text-muted`,children:d(`auth.recovery.errorMessage`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.message})]})]})]})}const pn={dev1:`us1`};function mn(e){let t=e&&pn[e]||e;return t?`https://cloud.${t}.vertesia.io/`:`https://cloud.vertesia.io/`}function hn({onUseDifferentEmail:e}){let{t:r}=z(),i=mn(B.region),[a,s]=l(15);return o(()=>{Jt()},[]),o(()=>{let e=setTimeout(()=>{window.location.href=i},15e3),t=setInterval(()=>{s(e=>e>0?e-1:0)},1e3);return()=>{clearTimeout(e),clearInterval(t)}},[i]),n(G,{children:[t(K,{variant:`destructive`,eyebrow:r(`auth.restricted.eyebrow`),title:r(`auth.restricted.title`),body:r(`auth.restricted.body`)}),n(`div`,{className:`flex flex-col gap-2`,children:[t(zt,{icon:Ce,title:r(`auth.restricted.calloutTitle`),meta:r(`auth.restricted.calloutMeta`)}),t(q,{className:`w-full`,onClick:()=>{window.location.href=i},children:r(`auth.restricted.redirect`)}),t(q,{variant:`ghost`,onClick:e,children:r(`auth.restricted.useDifferent`)}),t(`p`,{className:`text-center text-xs text-muted`,children:r(`auth.restricted.autoRedirect`,{seconds:a})})]})]})}function gn({session:e,onNotYou:r,onProviderClicked:i,redirectTo:a}){let{t:o}=z(),s=e.name?e.name.split(` `)[0]||e.name:an(e.email),c=e.name||an(e.email),l=t(jt,{initials:rn(e.email)}),u=!!e.tenantName,d=e.lastProvider===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e.lastProvider)}),f=async t=>{i(t),await Qt(t,e.email,a)};return n(G,{children:[t(K,{eyebrow:o(`auth.returning.eyebrow`),title:o(`auth.returning.title`,{name:s}),body:o(`auth.returning.body`)}),u&&e.tenantName?t(Ft,{variant:`returning`,badge:l,title:c,subtitle:e.tenantName,email:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}):t(It,{badge:l,title:c,subtitle:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}),n(`div`,{className:`flex flex-col gap-2`,children:[t(Rt,{provider:e.lastProvider,label:d,onClick:()=>f(e.lastProvider),variant:`filled`}),t(q,{variant:`ghost`,onClick:r,children:o(`auth.returning.useDifferent`)})]})]})}function _n({email:e,tenantName:r,onBack:i}){let{t:a}=z(),o=r||a(`auth.blocked.tenantFallback`),s=tn(e),c=r||(s?a(`auth.blocked.teamFromDomain`,{domain:nn(s)}):a(`auth.blocked.tenantFallback`));return n(G,{children:[t(K,{variant:`destructive`,eyebrow:a(`auth.blocked.eyebrow`),title:a(`auth.blocked.title`),body:a(`auth.blocked.body`,{name:o,email:e})}),n(`div`,{className:`flex flex-col gap-2`,children:[t(zt,{icon:Ce,title:c,meta:a(`auth.blocked.tenantMeta`,{email:e})}),t(q,{variant:`ghost`,onClick:i,children:a(`auth.blocked.useDifferent`)})]})]})}function Z({provider:e,email:n,redirectTo:r,variant:i=`outline`,onClick:a}){let{t:o}=z(),s=e===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e)});return t(Rt,{provider:e,label:s,onClick:()=>{a?.(),n?Qt(e,n,r):$t(e,r)},variant:i})}function vn(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}function yn({email:e,tenant:r,onBack:i,onProviderClicked:a,redirectTo:o}){let{t:s}=z(),c=r.label||r.name||s(`auth.blocked.tenantFallback`),l=r.provider===`google`||r.provider===`github`||r.provider===`microsoft`?r.provider:`oidc`,u=l===`oidc`?s(`auth.tenant.viaIdpFallback`):Y(l);return n(G,{children:[t(K,{eyebrow:s(`auth.tenant.eyebrow`),title:s(`auth.tenant.title`,{name:c}),body:s(`auth.tenant.body`)}),t(Ft,{variant:`tenant`,badge:t(jt,{initials:vn(c),shape:`square`}),title:c,subtitle:s(`auth.tenant.viaIdp`,{idp:u}),email:e,actionLabel:s(`auth.change`),onAction:i}),n(`div`,{className:`flex flex-col gap-2`,children:[t(Z,{provider:l,email:e,redirectTo:o,variant:`filled`,onClick:a}),t(q,{variant:`ghost`,onClick:i,children:s(`auth.tenant.notPartOf`,{name:c})})]})]})}function bn({onSignup:r,goBack:i}){let{t:a}=z(),[s,c]=l(void 0),[u,f]=l(void 0),[p,h]=l(void 0),[g,_]=l(void 0),[v,y]=l(void 0),[b,x]=l(void 0),[S,C]=l(void 0),T=s===`company`,te=[{id:1,label:a(`signup.size1to10`)},{id:11,label:a(`signup.size11to100`)},{id:101,label:a(`signup.size101to1000`)},{id:1001,label:a(`signup.size1001to5000`)},{id:5001,label:a(`signup.size5000plus`)}],E=[{id:`personal`,label:a(`signup.personal`),description:a(`signup.personalDescription`)},{id:`company`,label:a(`signup.company`),description:a(`signup.companyDescription`)}],D=[{id:`testing`,label:a(`signup.justTesting`)},{id:`exploring`,label:a(`signup.activelyExploring`)},{id:`using`,label:a(`signup.alreadyUsing`)},{id:`migrating`,label:a(`signup.migratingLLMs`)},{id:`other`,label:a(`signup.other`)}];o(()=>{let e=L().currentUser;if(!e){console.error(`No user found`);return}x(e)},[]);let O=()=>s?T&&!p?(C(a(`signup.pleaseEnterOrgName`)),!1):T&&!u?(C(a(`signup.pleaseSelectCompanySize`)),!1):!0:(C(a(`signup.pleaseSelectAccountType`)),!1);return n(`div`,{className:`flex flex-col space-y-2`,children:[n(`div`,{className:`prose`,children:[t(`p`,{className:`prose text-sm text-muted pt-4`,children:a(`signup.welcomeMessage`,{name:b?.displayName,email:b?.email})}),S&&t(`div`,{className:`text-destructive`,children:S})]}),t(Q,{label:a(`signup.accountType`),children:t(ee,{options:E,selected:E.find(e=>e.id===s),onSelect:e=>c(e.id)})}),T&&n(e,{children:[t(Q,{label:a(`signup.companySize`),children:t(w,{className:`w-full border border-accent bg-muted`,value:u,options:te,onChange:f,optionLabel:e=>e?.label,placeholder:a(`signup.selectCompanySize`)})}),t(Q,{label:a(`signup.companyName`),children:t(m,{value:p,onChange:h,type:`text`,required:!0})}),t(Q,{label:a(`signup.companyWebsite`),children:t(m,{value:g,onChange:_,type:`text`})})]}),t(Q,{label:a(`signup.projectMaturity`),children:t(w,{className:`w-full border border-accent bg-muted`,options:D,value:D.find(e=>e.id===v),optionLabel:e=>e?.label,placeholder:a(`signup.selectProjectMaturity`),onChange:e=>y(e?.id)})}),n(`div`,{className:`pt-8 flex flex-col`,children:[t(d,{variant:`primary`,onClick:async()=>{if(!O()||!s)return;let e={accountType:s,companyName:p,companySize:u?.id,companyWebsite:g,maturity:v};window.localStorage.setItem(`composableSignupData`,JSON.stringify(e));let t=await L().currentUser?.getIdToken();if(console.log(`Got firebase token`,L(),t),!t){console.error(`No firebase token found`);return}r(e,t)},size:`xl`,children:t(`span`,{className:`text-lg`,children:a(`signup.signUp`)})}),t(d,{variant:`ghost`,size:`xl`,className:`mt-4`,onClick:i,children:t(`span`,{className:``,children:a(`signup.wrongAccountGoBack`)})})]})]})}function Q({label:e,children:r}){return n(`div`,{className:`flex flex-col space-y-2 pt-4`,children:[t(`div`,{className:`text-sm text-muted`,children:e}),r]})}function xn({allowedPrefix:e,isNested:n=!1,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthErrorPrefix:o}){let s=typeof window>`u`?``:window.location.pathname,c=Sn(s,e),l=Sn(s,o);return c?null:t(wn,{isNested:n,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthError:l})}function Sn(e,t){return(Array.isArray(t)?t:t?[t]:[]).some(t=>e===t||e.startsWith(t.endsWith(`/`)?t:`${t}/`))}function Cn(e){return e instanceof ce||e instanceof se||e instanceof F||e instanceof P||e instanceof M||e instanceof ie}function wn({isNested:e=!1,lightLogo:r,darkLogo:a,preservePath:s,suppressAuthError:c}){let{t:u}=z(),{isLoading:d,user:f,authError:p,signOut:m}=R(),{trackEvent:h}=pe(),[g,_]=l(()=>Ut()),[v,y]=l(()=>Ut()?`returning`:`email`),[b,x]=l(``),[S,C]=l(void 0),[ee,w]=l(null),T=p instanceof F||p instanceof P?p.identity:void 0,te=T&&g?.email.toLowerCase()===T.email.toLowerCase()?g:void 0,E=T?{email:T.email,name:T.name??te?.name}:void 0;o(()=>{if(!s&&!d&&!p){let e=new URL(document.baseURI).pathname||`/`;history.replaceState({},``,e)}},[p,d,s]),o(()=>{if(p){if(p instanceof ce)y(`signup`);else if(p instanceof se)y(`restricted`);else if(p instanceof F)y(`scopeUnavailable`);else if(p instanceof P)y(`noAccessibleAccount`);else if(p instanceof M)y(`credentialFailure`);else if(p instanceof ie)y(`serviceFailure`);else if(cn(p)){let e=Kt();e&&x(e.email),y(`blocked`)}}},[p]),o(()=>{if(!f)return;let e=Kt();e&&(Wt({email:e.email,lastProvider:e.provider,tenantName:e.tenantName,name:f.name||void 0}),J())},[f]);let D=i((e,t)=>{x(e),C(t),y(t?`tenant`:`providers`)},[]),O=i(()=>{y(`email`),C(void 0)},[]),ne=i(()=>{Gt(),J(),_(null),x(``),C(void 0),y(`email`),m()},[m]),k=i(e=>{(S||g?.tenantName)&&h(`enterprise_signin`,{provider:e}),w(e),y(`pending`)},[h,g?.tenantName,S]),A=i(()=>{_(null),x(``),C(void 0),y(`email`),Jt()},[]),j=i(()=>{B.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`use_different_account`}}),_(null),x(``),C(void 0),y(`email`),Jt().finally(()=>m())},[m]),re=i(()=>{p instanceof F&&(B.logger.info(`Authentication recovery action selected`,{vertesia:{error_code:Te,selector_source:p.selectorSource,requested_scope:p.requestedScope,recovery_action:`continue_sanitized`}}),window.location.replace(p.recoveryUrl??window.location.href))},[p]),ae=i(()=>{B.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`retry`}}),window.location.reload()},[]),N=(e,t)=>{let n={signupData:e,firebaseToken:t};fetch(`${B.endpoints.studio}/auth/signup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}).then(()=>{h(`sign_up`),window.location.href=`/`})},oe=c&&p!==void 0&&!Cn(p);if(d||f||oe)return null;let I=null;if(v===`pending`&&ee)I=t(ln,{provider:ee});else if(v===`blocked`)I=t(_n,{email:b||g?.email||``,tenantName:S?.label||S?.name||g?.tenantName||void 0,onBack:A});else if(v===`restricted`)I=t(hn,{onUseDifferentEmail:A});else if(v===`scopeUnavailable`&&p instanceof F){let e=p.requestedScope===`project`?`scopeProject`:`scopeAccount`;I=t(X,{details:{accountId:p.accountId,errorCode:p.errorCode,message:p.message,projectId:p.projectId,status:p.status},identity:E,kind:e,onContinue:re,onUseDifferentAccount:j})}else I=v===`noAccessibleAccount`&&p instanceof P?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},identity:E,kind:`noAccessibleAccount`,onUseDifferentAccount:j}):v===`credentialFailure`&&p instanceof M?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},kind:`credential`,onUseDifferentAccount:j}):v===`serviceFailure`&&p instanceof ie?t(X,{details:{errorCode:p.errorCode,message:p.message,status:p.status},kind:`service`,onContinue:ae,onUseDifferentAccount:j}):v===`signup`&&!localStorage.getItem(`tenantName`)?t(bn,{onSignup:N,goBack:A}):v===`tenant`&&S?t(yn,{email:b,tenant:S,onBack:O,onProviderClicked:()=>k(S.provider??`oidc`)}):v===`providers`?t(fn,{email:b,onBack:O,onProviderClicked:k}):v===`returning`&&g?t(gn,{session:g,onNotYou:ne,onProviderClicked:k}):t(un,{initialEmail:b,onProceed:D});return t(`div`,{style:{zIndex:999998},className:`${e?`absolute`:`fixed`} inset-0 overflow-y-auto bg-background`,children:t(`div`,{className:`min-h-full flex flex-col items-center justify-center py-12 px-4`,children:n(`div`,{className:`flex flex-col items-center w-full`,children:[(r||a)&&n(`div`,{className:`mb-7`,children:[r&&t(`img`,{src:r,alt:`Vertesia`,className:`h-10 block dark:hidden`}),a&&t(`img`,{src:a,alt:`Vertesia`,className:`h-10 hidden dark:block`})]}),I,p&&!Cn(p)&&!cn(p)&&t(`div`,{className:`mt-6 max-w-[420px] text-center text-sm text-muted`,children:n(`div`,{children:[u(`auth.signInError`),t(`br`,{}),u(`auth.signInErrorContact`),t(`a`,{className:`text-info mx-1`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`}),u(`auth.signInErrorPersists`)]})}),n(`div`,{className:`flex items-center gap-5 mt-10 text-xs text-muted-foreground`,children:[t(`a`,{href:`https://vertesiahq.com/privacy`,className:`hover:text-foreground transition`,children:u(`auth.privacyPolicy`)}),t(`span`,{className:`text-border`,children:`·`}),t(`a`,{href:`https://vertesiahq.com/terms`,className:`hover:text-foreground transition`,children:u(`auth.termsOfService`)}),t(`span`,{className:`text-border`,children:`·`}),t(De,{className:`cursor-default`})]})]})})})}const Tn=new Set([`127.0.0.1`,`localhost`]);function En(e){if(!e)return null;let t;try{t=decodeURIComponent(e)}catch{return null}let n;try{n=new URL(t)}catch{return null}return n.protocol!==`http:`||!n.port||n.username||n.password||!Tn.has(n.hostname)?null:n.toString()}function Dn(e){let t=new URLSearchParams(e.search),n=En(t.get(`redirect_uri`)),r=t.get(`code`);return!n||!r?null:{redirect:n,code:r,profile:t.get(`profile`)??`default`,project:t.get(`project`)??void 0,account:t.get(`account`)??void 0}}function On(){let[e,n]=l(),[r,i]=l(),a=Dn(Ne()),o=re(),{t:s}=z(),c=a?e?t(An,{payload:e,error:r}):t(kn,{clientInfo:a,onAccept:async e=>{if(!a)return;if(!e.profile){o({title:s(`login.terminal.profileRequired`),description:s(`login.terminal.profileRequiredDesc`),status:`error`,duration:2e3});return}if(!e.account){o({title:s(`login.terminal.accountRequired`),description:s(`login.terminal.accountRequiredDesc`),status:`error`,duration:2e3});return}if(!e.project){o({title:s(`login.terminal.projectRequired`),description:s(`login.terminal.projectRequiredDesc`),status:`error`,duration:2e3});return}let t;try{let r=de(),i=r?await ue(r,e.account,e.project,86400):await le(e.account,e.project,86400);i?(t={...e,studio_server_url:B.endpoints.studio,zeno_server_url:B.endpoints.zeno,token:i},await fetch(a.redirect,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),n(t)):o({title:s(`login.terminal.failedToGetToken`),status:`error`,duration:5e3})}catch(e){t?(i(e instanceof Error?e:Error(A(e))),n(t)):o({title:s(`login.terminal.errorAuthorizingClient`),description:A(e),status:`error`,duration:5e3})}}}):t(p,{title:s(`login.terminal.invalidRequest`),children:s(`login.terminal.invalidRequestDesc`)});return t(`div`,{className:`w-full flex flex-col items-center gap-4 mt-24`,children:c})}function kn({onAccept:r,clientInfo:i}){let{client:a,user:o}=R(),{data:s,error:c}=j(()=>o?a.projects.list():Promise.resolve([]),[o]),{t:l}=z();if(c)return t(p,{title:l(`login.terminal.errorLoadingProjects`),children:A(c)});let u=B.isLocalDev?l(`login.terminal.envLocalDev`):B.isDev?l(`login.terminal.envStaging`):l(`login.terminal.envProduction`);return o&&s?n(e,{children:[n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 text-xl font-semibold text-info`,children:[`Authorizing client on `,u,` environment.`]}),n(`div`,{className:`mb-2 text-md text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.clientWantsAuth`)}),n(`div`,{children:[`The client app code is `,t(`b`,{className:`text-foreground`,children:i.code}),`. You can check if the code is correct in the terminal.`]})]}),n(`div`,{className:`mb-2 text-sm text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.chooseAccountProject`)}),t(`div`,{children:l(`login.terminal.profileNameNote`)})]})]}),t(jn,{onAccept:r,allProjects:s,data:i})]}):t(T,{size:`lg`})}function An({payload:e,error:r}){let i=re(),{t:a}=z();return n(`div`,{children:[r?t(`div`,{children:t(p,{title:a(`login.terminal.failedToSendToken`),children:a(`login.terminal.failedToSendTokenDesc`,{error:r.message})})}):t(`div`,{children:a(`login.terminal.clientAuthenticated`)}),t(f,{className:`mt-4`,children:t(d,{variant:`secondary`,onClick:()=>{e&&(navigator.clipboard.writeText(JSON.stringify(e)),i({title:a(`login.terminal.authPayloadCopied`),description:r?a(`login.terminal.authPayloadCopiedWithError`,{error:r.message}):a(`login.terminal.authPayloadCopiedSuccess`),status:`success`,duration:5e3}))},children:a(`login.terminal.copyAuthPayload`)})})]})}function jn({allProjects:e,data:r,onAccept:i}){let{accounts:a,account:o,project:s}=R(),{t:c}=z(),[u,f]=l(()=>({profile:r.profile,account:r.account??o?.id,project:r.project??s?.id})),p=e=>{f({...u,profile:e})},h=e=>{f({...u,account:e.id,project:void 0})},g=e=>{f({...u,project:e.id})},_=e.filter(e=>e.account===u.account);return n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.profileName`)}),t(m,{type:`text`,value:u.profile,onChange:p})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.account`)}),t(Mn,{value:u.account,onChange:h,accounts:a||[]})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.project`)}),t(Nn,{value:u.project,onChange:g,projects:_})]}),t(`div`,{className:`mb-4 text-sm text-attention`,children:c(`login.terminal.browserPermissionNote`)}),t(`div`,{children:t(d,{size:`xl`,onClick:()=>i(u),children:c(`login.terminal.authorizeClient`)})})]})}function Mn({value:e,accounts:n,onChange:r}){let{t:i}=z();return t(w,{options:n,value:n?.find(t=>t.id===e),onChange:e=>{r(e)},by:`id`,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectAccount`)})}function Nn({value:e,projects:n,onChange:r}){let{t:i}=z();return t(w,{by:`id`,value:n.find(t=>t.id===e),options:n,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectProject`),onChange:e=>{r(e)}})}function Pn({isOpen:e,onClose:r}){return n(g,{isOpen:e,onClose:r,children:[t(y,{children:`Sign In`}),n(_,{className:`flex flex-col gap-2`,children:[t(Z,{provider:`google`}),t(Z,{provider:`github`}),t(Z,{provider:`microsoft`})]}),t(v,{align:`right`,children:t(d,{variant:`ghost`,onClick:r,children:`Cancel`})})]})}function $({title:e,value:r}){function i(e){navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}let[a,o]=l(!1);return n(`div`,{className:`w-full flex justify-between items-center mb-1`,children:[n(`div`,{className:`flex flex-col w-[calc(100%-3rem)]`,children:[t(`div`,{className:`text-sm px-2 dark:text-slate-200`,children:e}),t(k,{description:r,size:`xs`,placement:`left`,children:n(`div`,{className:`text-xs truncate text-muted w-full text-start px-2`,children:[r,` `]})})]}),a?t(ve,{className:`size-4 cursor-pointer text-success`}):t(ye,{className:`size-4 cursor-pointer text-gray-400 dark:text-slate-400`,onClick:()=>i(r)})]})}function Fn(){let{t:e}=z(),{account:r,project:i,client:a,authToken:o}=R(),s=a.baseUrl,c=a.store.baseUrl,l=c.replace(/\/+$/,``)!==s.replace(/\/+$/,``),u=B.endpoints.mcp??e(`user.unknown`),d=i?Ee(i):``,f=[{name:`user`,label:e(`user.user`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.organizationId`),value:r?.id??e(`user.unknown`)}),t($,{title:e(`user.projectId`),value:i?.id??e(`user.unknown`)}),t($,{title:e(`user.userId`),value:o?.sub??e(`user.unknown`)}),t($,{title:e(`user.organizationRoles`),value:o?.account_roles?.join(`,`)??e(`user.unknown`)}),t($,{title:e(`user.projectRoles`),value:o?.project_roles?.join(`,`)??e(`user.unknown`)})]})},{name:`environment`,label:e(`user.environment`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.tenantId`),value:d}),t($,{title:e(`user.environment`),value:B.type}),t($,{title:e(`user.server`),value:s}),l&&t($,{title:e(`user.store`),value:c}),t($,{title:e(`user.mcpServer`),value:u}),t($,{title:e(`user.appVersion`),value:B.version}),t($,{title:e(`user.sdkVersion`),value:B.sdkVersion||e(`user.unknown`)})]})}];return t(`div`,{className:`w-full`,children:n(te,{defaultValue:`user`,tabs:f,fullWidth:!0,updateHash:!1,children:[t(E,{}),t(D,{})]})})}function In(r){let{user:i,isLoading:a}=R(),[o,s]=l(!1);return a?t(T,{}):i?t(`div`,{className:`px-3`,children:t(Ln,{asMenuTrigger:!0})}):n(e,{children:[t(d,{onClick:()=>s(!0),children:`Sign In`}),t(Pn,{isOpen:o,onClose:()=>s(!1)})]})}function Ln({className:e,asMenuTrigger:r=!1}){let i=R(),a=Pe(),o=Le(),{user:s}=i;if(!i||!s)return null;let c=o.hasPermission(we.project_admin);return n(x,{click:!0,children:[t(C,{children:t(`div`,{className:Re(e,`flex items-center justify-start`,r&&`cursor-pointer`),children:t(u,{size:`sm`,color:`bg-amber-500`,shape:`circle`,name:s?.name})})}),t(S,{align:`start`,className:`w-[280px] mx-2 my-1 p-0`,children:n(`div`,{className:`divide-y divide-gray-200 dark:divide-slate-700`,children:[n(`div`,{className:`py-2 ps-2`,children:[t(`p`,{className:`px-4 dark:text-white mb-1`,children:s?.name??`Unknown`}),t(`p`,{className:`px-4 text-xs text-gray-500`,children:s?.email??``})]}),t(`div`,{className:`w-full p-1`,children:t(Fn,{})}),t(`div`,{className:`py-2 ps-2`,children:t(b,{})}),t(`div`,{className:`py-2`,children:n(h,{children:[c&&t(h.Item,{className:`px-2`,onClick:()=>a(`/settings`,{replace:!0}),children:`Settings`}),t(h.Item,{className:`px-2`,onClick:()=>i.logout(),children:`Sign out`})]})})]})})]})}function Rn(e){return e?e.endsWith(`@vertesiahq.com`)||e.endsWith(`@becomposable.com`)||e.endsWith(`@composableprompts.com`):!1}function zn({icon:e}){let{isLoading:n}=R(),[r,i]=l(!0);return o(()=>{n||i(!1)},[n]),t(ze,{children:r&&t(Be.div,{style:{zIndex:999999,position:`fixed`,inset:0},className:`fixed inset-x-0 inset-y-0`,initial:{opacity:1},exit:{opacity:0},transition:{ease:`easeIn`,duration:.5},children:t(`div`,{style:{display:`flex`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`},className:`flex w-full h-full items-center justify-center`,children:t(`div`,{className:`animate-[spin_4s_linear_infinite]`,children:t(`div`,{className:`animate-pulse rounded-full bg-transparent`,children:e||t(Bn,{})})})})})})}function Bn(){return n(`svg`,{width:`32`,height:`32`,className:`w-8 h-8 text-indigo-600`,viewBox:`0 0 50 50`,xmlns:`http://www.w3.org/2000/svg`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`defs`,{children:n(`linearGradient`,{id:`spinner-gradient`,x1:`1`,y1:`0`,x2:`0`,y2:`1`,children:[t(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`1`}),t(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0`})]})}),t(`circle`,{cx:`25`,cy:`25`,r:`20`,stroke:`url(#spinner-gradient)`,strokeWidth:`5`,fill:`none`,strokeLinecap:`round`})]})}function Vn({children:r,lightLogo:i,darkLogo:a,loadingIcon:o,loadOnboardingStatus:s,preserveSignInPath:c,suppressSignInErrorPrefixes:l,authToken:u,defaultLanguage:d}){let f=t(Fe,{children:t(O,{defaultTheme:`system`,storageKey:`vite-ui-theme`,children:t(he,{defaultLanguage:d,children:n(me,{children:[t(gt,{}),!u&&n(e,{children:[t(zn,{icon:o}),t(xn,{allowedPrefix:`/shared/`,darkLogo:a,lightLogo:i,preservePath:c,suppressAuthErrorPrefix:l})]}),t(Ie,{children:r})]})})})});return t(ne,{children:u?t(ae,{token:u,children:f}):t(I,{loadOnboardingStatus:s,children:f})})}export{V as AppInstallationContext,Ve as AppInstallationProvider,Ue as AppProjectSelector,nt as IFRAME_APP_CONTENT_SLOT,Qe as IFRAME_APP_CONTEXT,H as IFRAME_APP_CONTEXT_REQUEST,U as IFRAME_APP_HOST_ORIGIN_PARAM,et as IFRAME_APP_LOCATION_CHANGE,$e as IFRAME_APP_NAVIGATE,tt as IFRAME_APP_SLOT_PARAM,Xe as IFRAME_AUTH_REQUEST,Ze as IFRAME_AUTH_RESPONSE,gt as IframeAppContextSync,xt as InviteAcceptModal,xn as SigninScreen,_t as StandaloneApp,vt as StandaloneAppImpl,On as TerminalLogin,In as UserSessionMenu,Vn as VertesiaShell,ot as isIframeAppContext,at as isIframeAppContextRequest,ct as isIframeAppLocationChange,st as isIframeAppNavigate,rt as isIframeAuthRequest,it as isIframeAuthResponse,Rn as isVertesiaEmail,mt as requestIframeHostAuthToken,pt as resolveIframeHostOrigin,He as useAppInstallation};
|
|
1
|
+
import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import*as r from"react";import{Children as i,Component as a,Fragment as o,createContext as s,createElement as c,forwardRef as l,isValidElement as u,useCallback as d,useContext as f,useEffect as p,useId as m,useInsertionEffect as h,useLayoutEffect as g,useMemo as _,useRef as v,useState as y}from"react";import{Avatar as b,Button as x,Center as S,ErrorBox as C,Input as w,MenuList as T,Modal as E,ModalBody as D,ModalFooter as ee,ModalTitle as te,ModeToggle as ne,Popover as re,PopoverContent as ie,PopoverTrigger as ae,RadioGroup as oe,SelectBox as se,Spinner as ce,Tabs as le,TabsBar as ue,TabsPanel as de,ThemeProvider as fe,ToastProvider as pe,VTooltip as me,errorMessage as he,useFetch as ge,useToast as _e}from"@vertesia/ui/core";import{AuthenticationServiceError as ve,CredentialError as ye,DevSessionProvider as be,LastSelectedAccountId_KEY as xe,LastSelectedProjectId_KEY as Se,NoAccessibleAccountError as Ce,RequestedScopeUnavailableError as we,RestrictedEnvironmentError as Te,UserNotFoundError as Ee,UserSessionProvider as De,fetchComposableTokenFromFirebaseToken as Oe,fetchComposableTokenFromVertesiaToken as ke,getCurrentVertesiaToken as Ae,getFirebaseAuth as je,setFirebaseTenant as Me,useUXTracking as Ne,useUserSession as O}from"@vertesia/ui/session";import"@radix-ui/react-direction";import{LanguageBoundI18nProvider as Pe,LanguageProvider as Fe,useUITranslation as k}from"@vertesia/ui/i18n";import{Permission as Ie,REQUESTED_SCOPE_UNAVAILABLE_ERROR_CODE as Le,getTenantIdFromProject as Re}from"@vertesia/common";import{Env as A}from"@vertesia/ui/env";import{RegionTag as ze}from"@vertesia/ui/layout";import{GithubAuthProvider as Be,GoogleAuthProvider as Ve,OAuthProvider as He,signInWithRedirect as Ue,signOut as We}from"firebase/auth";import{useLocation as Ge,useNavigate as Ke}from"@vertesia/ui/router";import{TypeRegistryProvider as qe,UserPermissionProvider as Je,useUserPermissions as Ye}from"@vertesia/ui/features";import Xe from"clsx";var Ze=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});const Qe=s(null);function $e({installation:e,children:n}){return t(Qe.Provider,{value:e,children:n})}function et(){return f(Qe)}function tt({app:e,onChange:r,placeholder:i}){let{client:a,project:o}=O(),{data:s,error:c}=ge(()=>a.apps.getAppInstallationProjects(e),[e.id,e.name]);return c?n(`span`,{className:`text-red-600`,children:[`Error: failed to fetch projects: `,he(c)]}):t(nt,{placeholder:i,initialValue:o?.id,projects:s||[],onChange:e=>{r&&!r(e)||(localStorage.setItem(xe,e.account),localStorage.setItem(`${Se}-${e.account}`,e.id),window.location.reload())}})}function nt({initialValue:e,projects:n,onChange:r,placeholder:i=`Select Project`}){let[a,o]=y(),s=e=>{o(e),r(e)},c=!a&&e?n.find(t=>t.id===e):a;return t(se,{by:`id`,value:c,options:n,optionLabel:e=>e.name,placeholder:i,onChange:s})}const rt=s({theme:`system`,setTheme:()=>null}),it=()=>{let e=f(rt);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e},at=[`ar`,`de`,`en`,`es`,`fr`,`it`,`ja`,`ko`,`pt`,`ru`,`tr`,`zh`,`zh-TW`],ot=s({language:`en`,setLanguage:()=>null,isRTL:!1});function st(){let e=f(ot);if(e===void 0)throw Error(`useLanguage must be used within a LanguageProvider`);return e}const ct=`vertesia:iframe-auth-request`,lt=`vertesia:iframe-auth-response`,ut=`vertesia:iframe-context-request`,dt=`vertesia:iframe-context`,ft=`vertesia:iframe-navigate`,pt=`vertesia:iframe-location-change`,mt=`__vertesia_slot`,ht=`__vertesia_host_origin`,gt=`content`;function _t(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-auth-request`&&typeof t.requestId==`string`&&!!t.requestId}function vt(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-auth-response`&&typeof t.requestId==`string`&&!!t.requestId&&(t.token===void 0||typeof t.token==`string`)}function yt(e){return!e||typeof e!=`object`?!1:e.type===ut}function bt(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-context`&&(t.theme===`dark`||t.theme===`light`||t.theme===`system`)&&typeof t.language==`string`&&at.includes(t.language)}function xt(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-navigate`&&typeof t.url==`string`&&!!t.url}function St(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`vertesia:iframe-location-change`&&typeof t.url==`string`&&!!t.url}const Ct=new Set([`localhost`,`127.0.0.1`,`[::1]`]);function wt(e){if(e)try{let t=new URL(e),n=Ct.has(t.hostname);return t.protocol===`https:`||t.protocol===`http:`&&n?t:void 0}catch{return}}function Tt(e){if(!e)return!1;let t=e.trim(),n=t.indexOf(`://`);if(n<0)return!1;let r=n+3,i=t.slice(r),a=i.search(/[/?#]/);return(a<0?i:i.slice(0,a)).includes(`@`)}function Et(e){if(e===`studio.vertesia.io`)return!0;let t=e.split(`.`);if(t.at(-2)!==`vertesia`||t.at(-1)!==`io`)return!1;let n=t.slice(0,-2),r=n.lastIndexOf(`cloud`);if(r>=0&&n.length-r<=2)return!0;let i=n.lastIndexOf(`ui`);return i>=0&&n.length-i===2}function Dt(e){if(Tt(e))return;let t=wt(e);if(!t)return;let n=t.hostname,r=Et(n),i=Ct.has(n)&&Ct.has(window.location.hostname);return t.protocol===`https:`&&r||i?t.origin:void 0}function Ot(){return window.parent===window?void 0:Dt(new URL(window.location.href).searchParams.get(ht))||Dt(document.referrer)}function kt(e=5e3){let t=Ot();if(!t)return Promise.resolve(void 0);let n=crypto.randomUUID();return new Promise(r=>{let i,a,o=250,s=e=>{window.removeEventListener(`message`,c),clearTimeout(i),clearTimeout(a),r(e)},c=e=>{e.source!==window.parent||e.origin!==t||!vt(e.data)||e.data.requestId===n&&e.data.token&&s(e.data.token)},l={type:ct,requestId:n},u=()=>{window.parent.postMessage(l,t),a=window.setTimeout(u,o),o=Math.min(o*2,1e3)};i=window.setTimeout(()=>s(),e),window.addEventListener(`message`,c),u()})}function At(e){if(e==null)return e;let t=new URL(window.location.href).searchParams.get(ht);if(!t)return e;try{let n=new URL(e,window.location.href);return n.origin===window.location.origin?(n.searchParams.set(ht,t),n):e}catch{return e}}function jt(){let{setTheme:e}=it(),{setLanguage:t}=st();return p(()=>{let n=Ot();if(!n)return;let r=()=>{let e={type:pt,url:window.location.href};window.parent.postMessage(e,n)},i=window.history.pushState,a=window.history.replaceState,o=(e,t,n)=>{i.call(window.history,e,t,At(n)),r()},s=(e,t,n)=>{a.call(window.history,e,t,At(n)),r()};window.history.pushState=o,window.history.replaceState=s;let c=i=>{if(i.source===window.parent&&i.origin===n){if(bt(i.data)){let n=i.data;e(n.theme,{persist:!1}),t(n.language,{persist:!1});return}if(xt(i.data)){let e;try{e=new URL(i.data.url,window.location.href)}catch{return}if(e.origin!==window.location.origin)return;if(e.href===window.location.href){r();return}window.history.replaceState(window.history.state,``,e),window.dispatchEvent(new PopStateEvent(`popstate`,{state:window.history.state}))}}},l={type:ut};return window.addEventListener(`message`,c),window.addEventListener(`popstate`,r),window.addEventListener(`hashchange`,r),window.parent.postMessage(l,n),r(),()=>{window.removeEventListener(`message`,c),window.removeEventListener(`popstate`,r),window.removeEventListener(`hashchange`,r),window.history.pushState===o&&(window.history.pushState=i),window.history.replaceState===s&&(window.history.replaceState=a)}},[t,e]),null}
|
|
2
|
+
/**
|
|
3
|
+
* @license lucide-react v1.31.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
const Mt=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Nt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Pt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ft=e=>{
|
|
9
|
+
/**
|
|
10
|
+
* @license lucide-react v1.31.0 - ISC
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the ISC license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @license lucide-react v1.31.0 - ISC
|
|
17
|
+
*
|
|
18
|
+
* This source code is licensed under the ISC license.
|
|
19
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @license lucide-react v1.31.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/
|
|
27
|
+
let t=Pt(e);return t.charAt(0).toUpperCase()+t.slice(1)};
|
|
28
|
+
/**
|
|
29
|
+
* @license lucide-react v1.31.0 - ISC
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the ISC license.
|
|
32
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
var It={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`};
|
|
35
|
+
/**
|
|
36
|
+
* @license lucide-react v1.31.0 - ISC
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the ISC license.
|
|
39
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/
|
|
41
|
+
const Lt=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Rt=s({}),zt=()=>f(Rt),Bt=l(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},l)=>{
|
|
42
|
+
/**
|
|
43
|
+
* @license lucide-react v1.31.0 - ISC
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the ISC license.
|
|
46
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* @license lucide-react v1.31.0 - ISC
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the ISC license.
|
|
52
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
53
|
+
*/
|
|
54
|
+
let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=zt()??{},h=r??f?Number(n??d)*24/Number(t??u):n??d;return c(`svg`,{ref:l,...It,width:t??u??It.width,height:t??u??It.height,stroke:e??p,strokeWidth:h,className:Mt(`lucide`,m,i),...!a&&!Lt(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>c(e,t)),...Array.isArray(a)?a:[a]])}),Vt=(e,t)=>{
|
|
55
|
+
/**
|
|
56
|
+
* @license lucide-react v1.31.0 - ISC
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the ISC license.
|
|
59
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/
|
|
61
|
+
let n=l(({className:n,...r},i)=>c(Bt,{ref:i,iconNode:t,className:Mt(`lucide-${Nt(Ft(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ft(e),n},Ht=Vt(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ut=Vt(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Wt=Vt(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Gt=Vt(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Kt=Vt(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),qt=Vt(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Jt=Vt(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Yt=Vt(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]])
|
|
62
|
+
/**
|
|
63
|
+
* @license lucide-react v1.31.0 - ISC
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the ISC license.
|
|
66
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/
|
|
68
|
+
/**
|
|
69
|
+
* @license lucide-react v1.31.0 - ISC
|
|
70
|
+
*
|
|
71
|
+
* This source code is licensed under the ISC license.
|
|
72
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* @license lucide-react v1.31.0 - ISC
|
|
76
|
+
*
|
|
77
|
+
* This source code is licensed under the ISC license.
|
|
78
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* @license lucide-react v1.31.0 - ISC
|
|
82
|
+
*
|
|
83
|
+
* This source code is licensed under the ISC license.
|
|
84
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* @license lucide-react v1.31.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* @license lucide-react v1.31.0 - ISC
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the ISC license.
|
|
96
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/
|
|
98
|
+
/**
|
|
99
|
+
* @license lucide-react v1.31.0 - ISC
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the ISC license.
|
|
102
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* @license lucide-react v1.31.0 - ISC
|
|
106
|
+
*
|
|
107
|
+
* This source code is licensed under the ISC license.
|
|
108
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
+
*/
|
|
110
|
+
;function Xt({name:e,AccessDenied:n=Qt,children:r}){return e?t(Zt,{name:e,AccessDenied:n,children:r}):t($t,{})}function Zt({name:e,AccessDenied:n=Qt,children:r}){let{authToken:i,client:a}=O(),[o,s]=y(null),[c,l]=y(`loading`);if(p(()=>{i?i.apps.includes(e)?a.apps.getAppInstallationByName(e).then(t=>{t?(l(`loaded`),s(t)):(console.log(`App ${e} not found!`),l(`error`))}):l(`error`):l(`loading`)},[e,i,a.apps.getAppInstallationByName]),c===`loading`)return null;if(c===`error`)return t(n,{name:e});if(o)return t($e,{installation:o,children:r})}function Qt({name:e}){let{project:r,accounts:i,client:a}=O(),{t:o}=k(),[s,c]=y(),{data:l}=ge(()=>a.apps.getAppInstallationProjects({name:e}),[e]),{projectsByOrg:u,orgOptions:d}=_(()=>{if(!l||!i)return{projectsByOrg:{},orgOptions:[]};let e={};for(let t of l)e[t.account]||(e[t.account]=[]),e[t.account].push(t);return{projectsByOrg:e,orgOptions:i.filter(t=>e[t.id]?.length>0)}},[l,i]);p(()=>{!s&&d.length>0&&c(d[0].id)},[d,s]);let f=e=>{localStorage.setItem(xe,e.account),localStorage.setItem(`${Se}-${e.account}`,e.id),window.location.reload()},m=s&&u[s]||[],h=d.find(e=>e.id===s);return n(S,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(Kt,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:o(`shell.accessDenied`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`You don't have permission to view the `,t(`span`,{className:`font-semibold`,children:e}),` app in project:`,` `,n(`span`,{className:`font-semibold`,children:[`«`,r?.name,`»`]}),`.`]}),d.length===0&&l!==void 0&&t(`div`,{className:`mt-4 text-sm text-gray-500`,children:`This app is not installed in any project you have access to.`}),d.length>0&&n(`div`,{className:`mt-4 flex flex-row gap-4 items-end`,children:[d.length>1&&n(`div`,{children:[t(`div`,{className:`text-sm text-gray-500 mb-2`,children:o(`shell.organization`)}),t(se,{by:`id`,value:h,options:d,optionLabel:e=>e.name,placeholder:o(`shell.selectOrganization`),onChange:e=>c(e.id)})]}),n(`div`,{children:[d.length>1&&t(`div`,{className:`text-sm text-gray-500 mb-2`,children:o(`login.terminal.project`)}),t(se,{by:`id`,value:void 0,options:m,optionLabel:e=>e.name,placeholder:o(`shell.selectProject`),onChange:f})]})]})]})}function $t(){let{t:e}=k();return n(S,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(Kt,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:e(`shell.applicationNotRegistered`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.`,t(`p`,{}),`Then use the created app name as a parameter to`,` `,t(`code`,{children:`<StandaloneApp name="your-app-name">`}),` in the `,t(`code`,{children:`src/main.tsx`}),` file.`]})]})}function en(){let e=O(),{client:r}=e,{t:i}=k(),[a,o]=y(!1),[s,c]=y([]);p(()=>{r.account.listInvites().then(e=>{if(e.length>0){let t=e.filter(e=>e.data.account);if(t.length===0){console.log(`No valid invites found, closing modal`);return}console.log(`Found valid invites`,t.length),o(!0),c(t)}else console.log(`No invites found, closing modal`),o(!1)}).catch(e=>{console.error(`Error fetching invites`,e)})},[r.account.listInvites]);let l=()=>o(!1),u=async t=>{await r.account.acceptInvite(t.id),await e.authCallback,await e.fetchAccounts(),await e.fetchProjects(t.data.account.id);let n=s.filter(e=>e.id!==t.id).filter(e=>e.data.account);n.length>0?c(n):l()},d=async e=>{await r.account.rejectInvite(e.id);let t=s.filter(t=>t.id!==e.id);c(t),t.length===0&&l()},f=s.map(e=>e.data.account?n(`div`,{className:`flex flex-row w-full justify-between border rounded-sm px-2 py-2 `,children:[n(`div`,{className:`flex flex-col`,children:[t(`div`,{className:`w-full font-semibold`,children:e.data.account.name??e.data.account}),e.data.project&&n(`div`,{className:`w-full text-base`,children:[`- `,e.data.project.name]}),n(`div`,{className:`text-xs`,children:[`Role: `,e.data.role]}),e.data.invited_by&&n(`div`,{className:`text-xs`,children:[`by `,e.data.invited_by.name??e.data.invited_by]})]}),n(`div`,{className:`flex flex-col gap-4`,children:[t(x,{size:`xs`,onClick:()=>u(e),children:i(`login.accept`)}),` `,t(x,{size:`xs`,variant:`secondary`,onClick:()=>d(e),children:i(`login.reject`)})]})]},e.id):(console.warn(`Invite has no account data`,e),null));return t(`div`,{children:n(E,{isOpen:a,onClose:l,children:[t(te,{children:i(`login.reviewInvites`)}),n(D,{children:[t(`div`,{className:`text-sm pb-4`,children:`You have received the following invites to join other accounts. Please review and accept or declined them.`}),f]})]})})}function tn(e){return n(`svg`,{viewBox:`0 0 48 48`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#FFC107`,d:`M43.6 20.5H42V20H24v8h11.3c-1.6 4.7-6.1 8-11.3 8a12 12 0 0 1 0-24c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 1 0 24 44c11 0 20-9 20-20 0-1.2-.1-2.3-.4-3.5z`}),t(`path`,{fill:`#FF3D00`,d:`M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z`}),t(`path`,{fill:`#4CAF50`,d:`M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28.5l-6.6 5.1A20 20 0 0 0 24 44z`}),t(`path`,{fill:`#1976D2`,d:`M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4 5.5l6.3 5.3C37.9 36.6 44 31 44 24c0-1.2-.1-2.3-.4-3.5z`})]})}function nn(e){return t(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:t(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.48 2 2 6.58 2 12.25c0 4.54 2.87 8.39 6.84 9.75.5.09.68-.22.68-.49v-1.7c-2.78.62-3.37-1.36-3.37-1.36-.46-1.18-1.11-1.5-1.11-1.5-.91-.63.07-.62.07-.62 1 .07 1.53 1.05 1.53 1.05.89 1.57 2.34 1.12 2.91.86.09-.66.35-1.12.63-1.38-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.7 0 0 .84-.28 2.76 1.05A9.4 9.4 0 0 1 12 7.07c.85 0 1.71.12 2.51.34 1.91-1.33 2.75-1.05 2.75-1.05.55 1.4.2 2.44.1 2.7.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.81c0 .27.18.59.69.49C19.13 20.64 22 16.78 22 12.25 22 6.58 17.52 2 12 2z`})})}function rn(e){return n(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#F25022`,d:`M2 2h9.5v9.5H2z`}),t(`path`,{fill:`#7FBA00`,d:`M12.5 2H22v9.5h-9.5z`}),t(`path`,{fill:`#00A4EF`,d:`M2 12.5h9.5V22H2z`}),t(`path`,{fill:`#FFB900`,d:`M12.5 12.5H22V22h-9.5z`})]})}const an=Gt,on={google:tn,github:nn,microsoft:rn,oidc:an};function sn(e){return e&&e in on?on[e]:an}function cn({children:e,centered:n=!1}){return t(`div`,{className:n?`w-full max-w-[420px] flex flex-col gap-6 items-center text-center`:`w-full max-w-[420px] flex flex-col gap-6`,children:e})}function ln({eyebrow:e,title:r,body:i,variant:a=`info`}){return n(`div`,{children:[e&&t(`div`,{className:`${a===`destructive`?`text-destructive`:`text-info`} text-[12.5px] font-medium mb-2`,children:e}),t(`h1`,{className:`text-foreground text-[22px] font-semibold tracking-tight leading-tight mb-1.5`,children:r}),i&&t(`p`,{className:`text-muted text-sm leading-relaxed`,children:i})]})}const un={primary:`h-[42px] gap-2.5 rounded-md bg-foreground text-background hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed`,loading:`h-[42px] gap-2.5 rounded-md bg-foreground text-background opacity-90`,ghost:`h-9 text-muted hover:text-foreground`};function j({variant:e=`primary`,className:n=``,type:r=`button`,disabled:i,...a}){return t(x,{variant:`unstyled`,size:`none`,type:r,disabled:e===`loading`||i,className:`cursor-pointer inline-flex items-center justify-center text-sm font-medium transition ${un[e]} ${n}`.trim(),...a})}function dn({size:e=`xs`,className:n=``,type:r=`button`,...i}){let a=`cursor-pointer ${e===`smaller`?`!text-[11px]`:`!text-xs`} text-muted hover:text-foreground !transition px-2 py-1 !rounded underline decoration-transparent hover:decoration-current underline-offset-[3px]`;return t(x,{variant:`unstyled`,size:`none`,type:r,className:n?`${a} ${n}`:a,...i})}const fn={circle:`size-9 rounded-full text-sm ring-4 ring-background ring-offset-1 ring-offset-border`,square:`size-[30px] rounded-md text-[11px]`};function pn({initials:e,shape:n=`circle`}){return t(`span`,{className:`bg-info text-info-foreground grid place-items-center font-semibold shrink-0 ${fn[n]}`,children:e})}function mn({children:e}){return t(`div`,{className:`inline-grid place-items-center size-14 rounded-xl bg-info-background border border-info/15 mb-3.5`,children:e})}function hn({title:e,subtitle:r,titleClass:i,subtitleClass:a}){return n(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:i,children:e}),t(`div`,{className:a,children:r})]})}const gn={tenant:{topRow:`flex items-center gap-2.5 px-3 py-2.5`,title:`text-[13.5px] font-semibold text-foreground leading-tight`,subtitle:`text-[11.5px] text-muted leading-tight mt-0.5`,bottomRow:`flex items-center gap-2.5 px-3 py-1.5 border-t border-border bg-muted-background`,mailBox:`size-[30px] grid place-items-center shrink-0`,mailIcon:`size-4 text-muted`,email:`text-sm text-foreground/80 flex-1 truncate`,actionSize:`xs`},returning:{topRow:`flex items-center gap-3 px-3.5 py-2.5`,title:`text-sm font-semibold text-foreground truncate`,subtitle:`text-xs text-foreground/80 truncate`,bottomRow:`flex items-center gap-3 px-3.5 py-1 border-t border-border bg-muted-background`,mailBox:`w-9 h-6 grid place-items-center shrink-0`,mailIcon:`size-3.5 text-muted`,email:`text-xs text-foreground/80 flex-1 truncate`,actionSize:`smaller`}};function _n({variant:e=`returning`,badge:r,title:i,subtitle:a,email:o,actionLabel:s,onAction:c}){let l=gn[e];return n(`div`,{className:`rounded-md border border-border bg-background overflow-hidden`,children:[n(`div`,{className:l.topRow,children:[r,t(hn,{title:i,subtitle:a,titleClass:l.title,subtitleClass:l.subtitle})]}),n(`div`,{className:l.bottomRow,children:[t(`div`,{className:l.mailBox,children:t(qt,{className:l.mailIcon})}),t(`span`,{className:l.email,children:o}),t(dn,{size:l.actionSize,onClick:c,children:s})]})]})}function vn({badge:e,title:r,subtitle:i,actionLabel:a,onAction:o}){return n(`div`,{className:`flex items-center gap-3 px-3.5 py-2.5 rounded-md border border-border bg-muted-background`,children:[e,t(hn,{title:r,subtitle:i,titleClass:`text-sm font-semibold text-foreground truncate`,subtitleClass:`text-xs text-muted truncate`}),t(dn,{onClick:o,children:a})]})}function yn({email:e,actionLabel:r,onAction:i}){return n(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-border bg-muted-background`,children:[t(qt,{className:`size-4 text-muted shrink-0`}),t(`span`,{className:`text-sm text-foreground/80 flex-1 truncate`,children:e}),t(dn,{onClick:i,children:r})]})}function bn({provider:e,label:r,onClick:i,variant:a=`outline`}){let o=sn(e);return a===`arrow`?n(x,{variant:`unstyled`,size:`none`,onClick:i,className:`cursor-pointer group h-[42px] w-full inline-flex items-center gap-3 ps-3.5 pe-3 rounded-md border border-border bg-background text-sm font-medium text-foreground transition hover:bg-muted-background`,children:[t(o,{className:`!size-[18px] shrink-0`}),t(`span`,{className:`flex-1 text-start`,children:r}),t(Ht,{className:`!size-3.5 text-muted opacity-0 group-hover:opacity-100 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 transition`})]}):n(x,{variant:`outline`,onClick:i,className:`w-full py-5 flex rounded-lg transition duration-150 text-center ${a===`filled`?`!bg-foreground text-background hover:!bg-foreground/90`:`hover:shadow-sm`}`,children:[t(o,{className:`!size-[18px]`}),t(`span`,{className:`text-sm font-medium`,children:r})]})}function xn({icon:e,title:r,meta:i}){return n(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5 rounded-md bg-destructive-background border border-destructive/20`,children:[t(e,{className:`size-5 text-destructive shrink-0`}),n(`div`,{className:`flex-1 min-w-0 text-sm`,children:[t(`div`,{className:`font-semibold text-destructive`,children:r}),t(`div`,{className:`text-xs text-destructive/80`,children:i})]})]})}function Sn({inputRef:e,label:r,placeholder:i,value:a,onChange:o,invalid:s=!1,error:c}){return n(`div`,{className:`flex flex-col gap-1.5`,children:[t(`label`,{htmlFor:`vt-login-email`,className:`text-xs font-medium text-foreground/80`,children:r}),t(`input`,{ref:e,id:`vt-login-email`,name:`vt-login-email`,type:`email`,className:`h-[42px] px-3.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none transition focus:border-info focus:ring-4 focus:ring-info/15 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/15`,placeholder:i,value:a,onChange:e=>o(e.target.value),"aria-invalid":s,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-form-type":`other`}),c&&t(`div`,{role:`alert`,className:`text-xs text-destructive`,children:c})]})}const Cn=`vt.lastSuccessfulLogin`,wn=`vt.pendingSignin`;function Tn(){try{let e=localStorage.getItem(Cn);if(!e)return null;let t=JSON.parse(e);return!t?.email||!t?.lastProvider?null:t}catch{return null}}function En(e){try{localStorage.setItem(Cn,JSON.stringify(e))}catch{}}function Dn(){try{localStorage.removeItem(Cn)}catch{}}function On(){try{let e=sessionStorage.getItem(wn);return e?JSON.parse(e):null}catch{return null}}function kn(e){try{sessionStorage.setItem(wn,JSON.stringify(e))}catch{}}function An(){try{sessionStorage.removeItem(wn)}catch{}}async function jn(){Dn(),An();try{await We(je())}catch{}}function Mn(e){let t=e||window.location.pathname||`/`;return t[0]!==`/`&&(t=`/${t}`),t}const Nn={google:(e,t)=>{let n=new Ve;return n.addScope(`profile`),n.addScope(`email`),n.setCustomParameters({redirect_uri:window.location.origin+Mn(t),...e?{login_hint:e}:{prompt:`select_account`}}),n},github:e=>{let t=new Be;return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login:e}),t},microsoft:e=>{let t=new He(`microsoft.com`);return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login_hint:e}),t},oidc:e=>{let t=new He(`oidc.main`);return e&&t.setCustomParameters({login_hint:e}),t}};function Pn(e,t,n){return Nn[e](t,n)}async function Fn(e,t,n){if(!t)return{ok:!1,reason:`no-email`};let r=await Me(t),i=je(),a=e,o;return r?(r.provider&&(a=r.provider),o=r.label||r.name||void 0,localStorage.setItem(`tenantName`,o??``)):(localStorage.removeItem(`tenantName`),i.tenantId&&=null),kn({email:t,provider:a,tenantName:o}),Ue(i,Pn(a,t,n)),{ok:!0}}function In(e,t){let n=je();localStorage.removeItem(`tenantName`),n.tenantId&&=null,Ue(n,Pn(e,void 0,t))}function Ln(e){return e===`google`?`Google`:e===`github`?`GitHub`:e===`microsoft`?`Microsoft`:`Sign In`}function Rn(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(0,t):e}function zn(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(t+1):``}function Bn(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function Vn(e){return(e||`?`).charAt(0).toUpperCase()}function Hn(e){let t=Rn(e).split(/[._-]+/).filter(Boolean)[0]||`friend`;return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function Un(e){for(let t of e)if(t.trim()===``)return!0;return!1}function Wn(e){let t=(e||``).trim(),n=t.indexOf(`@`);if(n<=0||n!==t.lastIndexOf(`@`))return!1;let r=t.slice(n+1),i=r.indexOf(`.`);return i>0&&i<r.length-1&&!Un(t)}function Gn(e){let t=e;for(let e=0;t!=null&&e<8;e++){if((t instanceof Error?t.message:String(t)).includes(`Customer-domain user requires an invite to join`))return!0;t=t instanceof Error?t.cause:void 0}return!1}function Kn({provider:e,onCancel:r}){let{t:i}=k(),a=sn(e),o=e===`oidc`?i(`auth.pending.genericProvider`):Ln(e);return n(cn,{centered:!0,children:[n(`div`,{children:[t(mn,{children:t(a,{className:e===`oidc`?`size-6 text-info`:`size-6`})}),t(ln,{title:i(`auth.pending.title`,{provider:o}),body:i(`auth.pending.body`)})]}),n(`div`,{className:`w-full flex flex-col gap-2`,children:[n(j,{variant:`loading`,children:[t(ce,{}),t(`span`,{children:i(`auth.pending.authenticating`)})]}),r&&t(j,{variant:`ghost`,onClick:r,children:i(`auth.pending.cancel`)})]})]})}function qn({initialEmail:r,onProceed:i}){let{t:a}=k(),[o,s]=y(r??``),[c,l]=y(!1),[u,d]=y(!1),f=v(null);return p(()=>{f.current?.focus()},[]),n(cn,{children:[t(ln,{eyebrow:a(`auth.email.eyebrow`),title:a(`auth.email.title`),body:a(`auth.email.body`)}),n(`form`,{onSubmit:async e=>{if(e.preventDefault(),!u){if(!Wn(o)){l(!0);return}l(!1),d(!0);try{let e=await Me(o.trim().toLowerCase());i(o.trim().toLowerCase(),e??void 0)}catch{i(o.trim().toLowerCase(),void 0)}finally{d(!1)}}},noValidate:!0,className:`flex flex-col ${c?`gap-2`:`gap-6`}`,children:[t(Sn,{inputRef:f,label:a(`auth.email.label`),placeholder:a(`auth.email.placeholder`),value:o,onChange:e=>{s(e),c&&l(!1)},invalid:c,error:c?a(`auth.email.invalidError`):void 0}),t(j,{type:`submit`,disabled:u,children:u?t(ce,{}):n(e,{children:[t(`span`,{children:a(`auth.continue`)}),t(Ht,{className:`!size-3.5`})]})})]})]})}const Jn=[`google`,`github`,`microsoft`];function Yn({email:e,onBack:r,onProviderClicked:i,redirectTo:a}){let{t:o}=k(),s=async t=>{i(t),await Fn(t,e,a)};return n(cn,{children:[t(ln,{eyebrow:o(`auth.providers.eyebrow`),title:o(`auth.providers.title`),body:o(`auth.providers.bodyConsumer`)}),t(yn,{email:e,actionLabel:o(`auth.change`),onAction:r}),t(`div`,{className:`flex flex-col gap-2`,children:Jn.map(e=>t(bn,{provider:e,label:o(`auth.continueWithProvider`,{provider:Ln(e)}),onClick:()=>s(e),variant:`arrow`},e))})]})}function Xn({details:r,identity:i,kind:a,onContinue:o,onUseDifferentAccount:s}){let{t:c}=k(),[l,u]=y(!1),d=v(null);p(()=>{d.current?.focus()},[]);let f=a===`scopeProject`||a===`scopeAccount`,m;m=a===`scopeProject`?{eyebrow:c(`auth.recovery.scopeProject.eyebrow`),title:c(`auth.recovery.scopeProject.title`),body:c(`auth.recovery.scopeProject.body`)}:a===`scopeAccount`?{eyebrow:c(`auth.recovery.scopeAccount.eyebrow`),title:c(`auth.recovery.scopeAccount.title`),body:c(`auth.recovery.scopeAccount.body`)}:a===`noAccessibleAccount`?{eyebrow:c(`auth.recovery.noAccessibleAccount.eyebrow`),title:c(`auth.recovery.noAccessibleAccount.title`),body:c(`auth.recovery.noAccessibleAccount.body`)}:a===`credential`?{eyebrow:c(`auth.recovery.credential.eyebrow`),title:c(`auth.recovery.credential.title`),body:c(`auth.recovery.credential.body`)}:{eyebrow:c(`auth.recovery.service.eyebrow`),title:c(`auth.recovery.service.title`),body:c(`auth.recovery.service.body`)};let h=e=>{l||(u(!0),e())};return n(cn,{children:[n(`div`,{role:`alert`,"aria-live":`assertive`,children:[t(mn,{children:t(Yt,{className:`size-7 text-attention`,"aria-hidden":`true`})}),t(ln,{eyebrow:m.eyebrow,title:m.title,body:m.body})]}),i&&t(vn,{badge:t(pn,{initials:Vn(i.email)}),title:i.name||Hn(i.email),subtitle:i.email,actionLabel:c(`auth.returning.notYou`),onAction:s}),n(`div`,{className:`flex flex-col gap-2`,children:[o&&t(j,{ref:d,className:`w-full`,disabled:l,onClick:()=>h(o),children:c(f?`auth.recovery.continue`:`auth.recovery.tryAgain`)}),t(j,{ref:o?void 0:d,variant:o?`ghost`:`primary`,disabled:l,onClick:()=>h(s),children:c(`auth.recovery.useDifferentAccount`)}),(a===`noAccessibleAccount`||a===`service`)&&n(`p`,{className:`text-center text-xs text-muted`,children:[c(`auth.recovery.supportPrefix`),` `,t(`a`,{className:`text-info`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`})]})]}),r&&n(`details`,{className:`rounded-lg border border-mixer-muted/30 bg-mixer-muted/10 px-4 py-3 text-sm`,children:[t(`summary`,{className:`cursor-pointer font-medium text-muted marker:text-muted focus-visible:outline-2 focus-visible:outline-offset-2`,children:c(`auth.recovery.technicalDetails`)}),n(`dl`,{className:`mt-3 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-2 text-xs`,children:[r.errorCode&&n(e,{children:[t(`dt`,{className:`text-muted`,children:c(`auth.recovery.errorCode`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.errorCode})]}),r.status&&n(e,{children:[t(`dt`,{className:`text-muted`,children:c(`auth.recovery.httpStatus`)}),t(`dd`,{className:`font-mono`,children:r.status})]}),r.accountId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:c(`auth.recovery.requestedAccount`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.accountId})]}),r.projectId&&n(e,{children:[t(`dt`,{className:`text-muted`,children:c(`auth.recovery.requestedProject`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.projectId})]}),t(`dt`,{className:`text-muted`,children:c(`auth.recovery.errorMessage`)}),t(`dd`,{className:`wrap-break-word font-mono`,children:r.message})]})]})]})}const Zn={dev1:`us1`};function Qn(e){let t=e&&Zn[e]||e;return t?`https://cloud.${t}.vertesia.io/`:`https://cloud.vertesia.io/`}function $n({onUseDifferentEmail:e}){let{t:r}=k(),i=Qn(A.region),[a,o]=y(15);return p(()=>{jn()},[]),p(()=>{let e=setTimeout(()=>{window.location.href=i},15e3),t=setInterval(()=>{o(e=>e>0?e-1:0)},1e3);return()=>{clearTimeout(e),clearInterval(t)}},[i]),n(cn,{children:[t(ln,{variant:`destructive`,eyebrow:r(`auth.restricted.eyebrow`),title:r(`auth.restricted.title`),body:r(`auth.restricted.body`)}),n(`div`,{className:`flex flex-col gap-2`,children:[t(xn,{icon:Jt,title:r(`auth.restricted.calloutTitle`),meta:r(`auth.restricted.calloutMeta`)}),t(j,{className:`w-full`,onClick:()=>{window.location.href=i},children:r(`auth.restricted.redirect`)}),t(j,{variant:`ghost`,onClick:e,children:r(`auth.restricted.useDifferent`)}),t(`p`,{className:`text-center text-xs text-muted`,children:r(`auth.restricted.autoRedirect`,{seconds:a})})]})]})}function er({session:e,onNotYou:r,onProviderClicked:i,redirectTo:a}){let{t:o}=k(),s=e.name?e.name.split(` `)[0]||e.name:Hn(e.email),c=e.name||Hn(e.email),l=t(pn,{initials:Vn(e.email)}),u=!!e.tenantName,d=e.lastProvider===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Ln(e.lastProvider)}),f=async t=>{i(t),await Fn(t,e.email,a)};return n(cn,{children:[t(ln,{eyebrow:o(`auth.returning.eyebrow`),title:o(`auth.returning.title`,{name:s}),body:o(`auth.returning.body`)}),u&&e.tenantName?t(_n,{variant:`returning`,badge:l,title:c,subtitle:e.tenantName,email:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}):t(vn,{badge:l,title:c,subtitle:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}),n(`div`,{className:`flex flex-col gap-2`,children:[t(bn,{provider:e.lastProvider,label:d,onClick:()=>f(e.lastProvider),variant:`filled`}),t(j,{variant:`ghost`,onClick:r,children:o(`auth.returning.useDifferent`)})]})]})}function tr({email:e,tenantName:r,onBack:i}){let{t:a}=k(),o=r||a(`auth.blocked.tenantFallback`),s=zn(e),c=r||(s?a(`auth.blocked.teamFromDomain`,{domain:Bn(s)}):a(`auth.blocked.tenantFallback`));return n(cn,{children:[t(ln,{variant:`destructive`,eyebrow:a(`auth.blocked.eyebrow`),title:a(`auth.blocked.title`),body:a(`auth.blocked.body`,{name:o,email:e})}),n(`div`,{className:`flex flex-col gap-2`,children:[t(xn,{icon:Jt,title:c,meta:a(`auth.blocked.tenantMeta`,{email:e})}),t(j,{variant:`ghost`,onClick:i,children:a(`auth.blocked.useDifferent`)})]})]})}function nr({provider:e,email:n,redirectTo:r,variant:i=`outline`,onClick:a}){let{t:o}=k(),s=e===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Ln(e)});return t(bn,{provider:e,label:s,onClick:()=>{a?.(),n?Fn(e,n,r):In(e,r)},variant:i})}function rr(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}function ir({email:e,tenant:r,onBack:i,onProviderClicked:a,redirectTo:o}){let{t:s}=k(),c=r.label||r.name||s(`auth.blocked.tenantFallback`),l=r.provider===`google`||r.provider===`github`||r.provider===`microsoft`?r.provider:`oidc`,u=l===`oidc`?s(`auth.tenant.viaIdpFallback`):Ln(l);return n(cn,{children:[t(ln,{eyebrow:s(`auth.tenant.eyebrow`),title:s(`auth.tenant.title`,{name:c}),body:s(`auth.tenant.body`)}),t(_n,{variant:`tenant`,badge:t(pn,{initials:rr(c),shape:`square`}),title:c,subtitle:s(`auth.tenant.viaIdp`,{idp:u}),email:e,actionLabel:s(`auth.change`),onAction:i}),n(`div`,{className:`flex flex-col gap-2`,children:[t(nr,{provider:l,email:e,redirectTo:o,variant:`filled`,onClick:a}),t(j,{variant:`ghost`,onClick:i,children:s(`auth.tenant.notPartOf`,{name:c})})]})]})}function ar({onSignup:r,goBack:i}){let{t:a}=k(),[o,s]=y(void 0),[c,l]=y(void 0),[u,d]=y(void 0),[f,m]=y(void 0),[h,g]=y(void 0),[_,v]=y(void 0),[b,S]=y(void 0),C=o===`company`,T=[{id:1,label:a(`signup.size1to10`)},{id:11,label:a(`signup.size11to100`)},{id:101,label:a(`signup.size101to1000`)},{id:1001,label:a(`signup.size1001to5000`)},{id:5001,label:a(`signup.size5000plus`)}],E=[{id:`personal`,label:a(`signup.personal`),description:a(`signup.personalDescription`)},{id:`company`,label:a(`signup.company`),description:a(`signup.companyDescription`)}],D=[{id:`testing`,label:a(`signup.justTesting`)},{id:`exploring`,label:a(`signup.activelyExploring`)},{id:`using`,label:a(`signup.alreadyUsing`)},{id:`migrating`,label:a(`signup.migratingLLMs`)},{id:`other`,label:a(`signup.other`)}];p(()=>{let e=je().currentUser;if(!e){console.error(`No user found`);return}v(e)},[]);let ee=()=>o?C&&!u?(S(a(`signup.pleaseEnterOrgName`)),!1):C&&!c?(S(a(`signup.pleaseSelectCompanySize`)),!1):!0:(S(a(`signup.pleaseSelectAccountType`)),!1);return n(`div`,{className:`flex flex-col space-y-2`,children:[n(`div`,{className:`prose`,children:[t(`p`,{className:`prose text-sm text-muted pt-4`,children:a(`signup.welcomeMessage`,{name:_?.displayName,email:_?.email})}),b&&t(`div`,{className:`text-destructive`,children:b})]}),t(or,{label:a(`signup.accountType`),children:t(oe,{options:E,selected:E.find(e=>e.id===o),onSelect:e=>s(e.id)})}),C&&n(e,{children:[t(or,{label:a(`signup.companySize`),children:t(se,{className:`w-full border border-accent bg-muted`,value:c,options:T,onChange:l,optionLabel:e=>e?.label,placeholder:a(`signup.selectCompanySize`)})}),t(or,{label:a(`signup.companyName`),children:t(w,{value:u,onChange:d,type:`text`,required:!0})}),t(or,{label:a(`signup.companyWebsite`),children:t(w,{value:f,onChange:m,type:`text`})})]}),t(or,{label:a(`signup.projectMaturity`),children:t(se,{className:`w-full border border-accent bg-muted`,options:D,value:D.find(e=>e.id===h),optionLabel:e=>e?.label,placeholder:a(`signup.selectProjectMaturity`),onChange:e=>g(e?.id)})}),n(`div`,{className:`pt-8 flex flex-col`,children:[t(x,{variant:`primary`,onClick:async()=>{if(!ee()||!o)return;let e={accountType:o,companyName:u,companySize:c?.id,companyWebsite:f,maturity:h};window.localStorage.setItem(`composableSignupData`,JSON.stringify(e));let t=await je().currentUser?.getIdToken();if(console.log(`Got firebase token`,je(),t),!t){console.error(`No firebase token found`);return}r(e,t)},size:`xl`,children:t(`span`,{className:`text-lg`,children:a(`signup.signUp`)})}),t(x,{variant:`ghost`,size:`xl`,className:`mt-4`,onClick:i,children:t(`span`,{className:``,children:a(`signup.wrongAccountGoBack`)})})]})]})}function or({label:e,children:r}){return n(`div`,{className:`flex flex-col space-y-2 pt-4`,children:[t(`div`,{className:`text-sm text-muted`,children:e}),r]})}function sr({allowedPrefix:e,isNested:n=!1,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthErrorPrefix:o}){let s=typeof window>`u`?``:window.location.pathname,c=cr(s,e),l=cr(s,o);return c?null:t(ur,{isNested:n,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthError:l})}function cr(e,t){return(Array.isArray(t)?t:t?[t]:[]).some(t=>e===t||e.startsWith(t.endsWith(`/`)?t:`${t}/`))}function lr(e){return e instanceof Ee||e instanceof Te||e instanceof we||e instanceof Ce||e instanceof ye||e instanceof ve}function ur({isNested:e=!1,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthError:o}){let{t:s}=k(),{isLoading:c,user:l,authError:u,signOut:f}=O(),{trackEvent:m}=Ne(),[h,g]=y(()=>Tn()),[_,v]=y(()=>Tn()?`returning`:`email`),[b,x]=y(``),[S,C]=y(void 0),[w,T]=y(null),E=u instanceof we||u instanceof Ce?u.identity:void 0,D=E&&h?.email.toLowerCase()===E.email.toLowerCase()?h:void 0,ee=E?{email:E.email,name:E.name??D?.name}:void 0;p(()=>{if(!a&&!c&&!u){let e=new URL(document.baseURI).pathname||`/`;history.replaceState({},``,e)}},[u,c,a]),p(()=>{if(u){if(u instanceof Ee)v(`signup`);else if(u instanceof Te)v(`restricted`);else if(u instanceof we)v(`scopeUnavailable`);else if(u instanceof Ce)v(`noAccessibleAccount`);else if(u instanceof ye)v(`credentialFailure`);else if(u instanceof ve)v(`serviceFailure`);else if(Gn(u)){let e=On();e&&x(e.email),v(`blocked`)}}},[u]),p(()=>{if(!l)return;let e=On();e&&(En({email:e.email,lastProvider:e.provider,tenantName:e.tenantName,name:l.name||void 0}),An())},[l]);let te=d((e,t)=>{x(e),C(t),v(t?`tenant`:`providers`)},[]),ne=d(()=>{v(`email`),C(void 0)},[]),re=d(()=>{Dn(),An(),g(null),x(``),C(void 0),v(`email`),f()},[f]),ie=d(e=>{(S||h?.tenantName)&&m(`enterprise_signin`,{provider:e}),T(e),v(`pending`)},[m,h?.tenantName,S]),ae=d(()=>{g(null),x(``),C(void 0),v(`email`),jn()},[]),oe=d(()=>{A.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`use_different_account`}}),g(null),x(``),C(void 0),v(`email`),jn().finally(()=>f())},[f]),se=d(()=>{u instanceof we&&(A.logger.info(`Authentication recovery action selected`,{vertesia:{error_code:Le,selector_source:u.selectorSource,requested_scope:u.requestedScope,recovery_action:`continue_sanitized`}}),window.location.replace(u.recoveryUrl??window.location.href))},[u]),ce=d(()=>{A.logger.info(`Authentication recovery action selected`,{vertesia:{recovery_action:`retry`}}),window.location.reload()},[]),le=(e,t)=>{let n={signupData:e,firebaseToken:t};fetch(`${A.endpoints.studio}/auth/signup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}).then(()=>{m(`sign_up`),window.location.href=`/`})},ue=o&&u!==void 0&&!lr(u);if(c||l||ue)return null;let de=null;if(_===`pending`&&w)de=t(Kn,{provider:w});else if(_===`blocked`)de=t(tr,{email:b||h?.email||``,tenantName:S?.label||S?.name||h?.tenantName||void 0,onBack:ae});else if(_===`restricted`)de=t($n,{onUseDifferentEmail:ae});else if(_===`scopeUnavailable`&&u instanceof we){let e=u.requestedScope===`project`?`scopeProject`:`scopeAccount`;de=t(Xn,{details:{accountId:u.accountId,errorCode:u.errorCode,message:u.message,projectId:u.projectId,status:u.status},identity:ee,kind:e,onContinue:se,onUseDifferentAccount:oe})}else de=_===`noAccessibleAccount`&&u instanceof Ce?t(Xn,{details:{errorCode:u.errorCode,message:u.message,status:u.status},identity:ee,kind:`noAccessibleAccount`,onUseDifferentAccount:oe}):_===`credentialFailure`&&u instanceof ye?t(Xn,{details:{errorCode:u.errorCode,message:u.message,status:u.status},kind:`credential`,onUseDifferentAccount:oe}):_===`serviceFailure`&&u instanceof ve?t(Xn,{details:{errorCode:u.errorCode,message:u.message,status:u.status},kind:`service`,onContinue:ce,onUseDifferentAccount:oe}):_===`signup`&&!localStorage.getItem(`tenantName`)?t(ar,{onSignup:le,goBack:ae}):_===`tenant`&&S?t(ir,{email:b,tenant:S,onBack:ne,onProviderClicked:()=>ie(S.provider??`oidc`)}):_===`providers`?t(Yn,{email:b,onBack:ne,onProviderClicked:ie}):_===`returning`&&h?t(er,{session:h,onNotYou:re,onProviderClicked:ie}):t(qn,{initialEmail:b,onProceed:te});return t(`div`,{style:{zIndex:999998},className:`${e?`absolute`:`fixed`} inset-0 overflow-y-auto bg-background`,children:t(`div`,{className:`min-h-full flex flex-col items-center justify-center py-12 px-4`,children:n(`div`,{className:`flex flex-col items-center w-full`,children:[(r||i)&&n(`div`,{className:`mb-7`,children:[r&&t(`img`,{src:r,alt:`Vertesia`,className:`h-10 block dark:hidden`}),i&&t(`img`,{src:i,alt:`Vertesia`,className:`h-10 hidden dark:block`})]}),de,u&&!lr(u)&&!Gn(u)&&t(`div`,{className:`mt-6 max-w-[420px] text-center text-sm text-muted`,children:n(`div`,{children:[s(`auth.signInError`),t(`br`,{}),s(`auth.signInErrorContact`),t(`a`,{className:`text-info mx-1`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`}),s(`auth.signInErrorPersists`)]})}),n(`div`,{className:`flex items-center gap-5 mt-10 text-xs text-muted-foreground`,children:[t(`a`,{href:`https://vertesiahq.com/privacy`,className:`hover:text-foreground transition`,children:s(`auth.privacyPolicy`)}),t(`span`,{className:`text-border`,children:`·`}),t(`a`,{href:`https://vertesiahq.com/terms`,className:`hover:text-foreground transition`,children:s(`auth.termsOfService`)}),t(`span`,{className:`text-border`,children:`·`}),t(ze,{className:`cursor-default`})]})]})})})}const dr=new Set([`127.0.0.1`,`localhost`]);function fr(e){if(!e)return null;let t;try{t=decodeURIComponent(e)}catch{return null}let n;try{n=new URL(t)}catch{return null}return n.protocol!==`http:`||!n.port||n.username||n.password||!dr.has(n.hostname)?null:n.toString()}function pr(e){let t=new URLSearchParams(e.search),n=fr(t.get(`redirect_uri`)),r=t.get(`code`);return!n||!r?null:{redirect:n,code:r,profile:t.get(`profile`)??`default`,project:t.get(`project`)??void 0,account:t.get(`account`)??void 0}}function mr(){let[e,n]=y(),[r,i]=y(),a=pr(Ge()),o=_e(),{t:s}=k(),c=a?e?t(gr,{payload:e,error:r}):t(hr,{clientInfo:a,onAccept:async e=>{if(!a)return;if(!e.profile){o({title:s(`login.terminal.profileRequired`),description:s(`login.terminal.profileRequiredDesc`),status:`error`,duration:2e3});return}if(!e.account){o({title:s(`login.terminal.accountRequired`),description:s(`login.terminal.accountRequiredDesc`),status:`error`,duration:2e3});return}if(!e.project){o({title:s(`login.terminal.projectRequired`),description:s(`login.terminal.projectRequiredDesc`),status:`error`,duration:2e3});return}let t;try{let r=Ae(),i=r?await ke(r,e.account,e.project,86400):await Oe(e.account,e.project,86400);i?(t={...e,studio_server_url:A.endpoints.studio,zeno_server_url:A.endpoints.zeno,token:i},await fetch(a.redirect,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),n(t)):o({title:s(`login.terminal.failedToGetToken`),status:`error`,duration:5e3})}catch(e){t?(i(e instanceof Error?e:Error(he(e))),n(t)):o({title:s(`login.terminal.errorAuthorizingClient`),description:he(e),status:`error`,duration:5e3})}}}):t(C,{title:s(`login.terminal.invalidRequest`),children:s(`login.terminal.invalidRequestDesc`)});return t(`div`,{className:`w-full flex flex-col items-center gap-4 mt-24`,children:c})}function hr({onAccept:r,clientInfo:i}){let{client:a,user:o}=O(),{data:s,error:c}=ge(()=>o?a.projects.list():Promise.resolve([]),[o]),{t:l}=k();if(c)return t(C,{title:l(`login.terminal.errorLoadingProjects`),children:he(c)});let u=A.isLocalDev?l(`login.terminal.envLocalDev`):A.isDev?l(`login.terminal.envStaging`):l(`login.terminal.envProduction`);return o&&s?n(e,{children:[n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 text-xl font-semibold text-info`,children:[`Authorizing client on `,u,` environment.`]}),n(`div`,{className:`mb-2 text-md text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.clientWantsAuth`)}),n(`div`,{children:[`The client app code is `,t(`b`,{className:`text-foreground`,children:i.code}),`. You can check if the code is correct in the terminal.`]})]}),n(`div`,{className:`mb-2 text-sm text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.chooseAccountProject`)}),t(`div`,{children:l(`login.terminal.profileNameNote`)})]})]}),t(_r,{onAccept:r,allProjects:s,data:i})]}):t(ce,{size:`lg`})}function gr({payload:e,error:r}){let i=_e(),{t:a}=k();return n(`div`,{children:[r?t(`div`,{children:t(C,{title:a(`login.terminal.failedToSendToken`),children:a(`login.terminal.failedToSendTokenDesc`,{error:r.message})})}):t(`div`,{children:a(`login.terminal.clientAuthenticated`)}),t(S,{className:`mt-4`,children:t(x,{variant:`secondary`,onClick:()=>{e&&(navigator.clipboard.writeText(JSON.stringify(e)),i({title:a(`login.terminal.authPayloadCopied`),description:r?a(`login.terminal.authPayloadCopiedWithError`,{error:r.message}):a(`login.terminal.authPayloadCopiedSuccess`),status:`success`,duration:5e3}))},children:a(`login.terminal.copyAuthPayload`)})})]})}function _r({allProjects:e,data:r,onAccept:i}){let{accounts:a,account:o,project:s}=O(),{t:c}=k(),[l,u]=y(()=>({profile:r.profile,account:r.account??o?.id,project:r.project??s?.id})),d=e=>{u({...l,profile:e})},f=e=>{u({...l,account:e.id,project:void 0})},p=e=>{u({...l,project:e.id})},m=e.filter(e=>e.account===l.account);return n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.profileName`)}),t(w,{type:`text`,value:l.profile,onChange:d})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.account`)}),t(vr,{value:l.account,onChange:f,accounts:a||[]})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.project`)}),t(yr,{value:l.project,onChange:p,projects:m})]}),t(`div`,{className:`mb-4 text-sm text-attention`,children:c(`login.terminal.browserPermissionNote`)}),t(`div`,{children:t(x,{size:`xl`,onClick:()=>i(l),children:c(`login.terminal.authorizeClient`)})})]})}function vr({value:e,accounts:n,onChange:r}){let{t:i}=k();return t(se,{options:n,value:n?.find(t=>t.id===e),onChange:e=>{r(e)},by:`id`,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectAccount`)})}function yr({value:e,projects:n,onChange:r}){let{t:i}=k();return t(se,{by:`id`,value:n.find(t=>t.id===e),options:n,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectProject`),onChange:e=>{r(e)}})}function br({isOpen:e,onClose:r}){return n(E,{isOpen:e,onClose:r,children:[t(te,{children:`Sign In`}),n(D,{className:`flex flex-col gap-2`,children:[t(nr,{provider:`google`}),t(nr,{provider:`github`}),t(nr,{provider:`microsoft`})]}),t(ee,{align:`right`,children:t(x,{variant:`ghost`,onClick:r,children:`Cancel`})})]})}function M({title:e,value:r}){function i(e){navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}let[a,o]=y(!1);return n(`div`,{className:`w-full flex justify-between items-center mb-1`,children:[n(`div`,{className:`flex flex-col w-[calc(100%-3rem)]`,children:[t(`div`,{className:`text-sm px-2 dark:text-slate-200`,children:e}),t(me,{description:r,size:`xs`,placement:`left`,children:n(`div`,{className:`text-xs truncate text-muted w-full text-start px-2`,children:[r,` `]})})]}),a?t(Ut,{className:`size-4 cursor-pointer text-success`}):t(Wt,{className:`size-4 cursor-pointer text-gray-400 dark:text-slate-400`,onClick:()=>i(r)})]})}function xr(){let{t:e}=k(),{account:r,project:i,client:a,authToken:o}=O(),s=a.baseUrl,c=a.store.baseUrl,l=c.replace(/\/+$/,``)!==s.replace(/\/+$/,``),u=A.endpoints.mcp??e(`user.unknown`),d=i?Re(i):``,f=[{name:`user`,label:e(`user.user`),content:n(`div`,{className:`space-y-1 p-2`,children:[t(M,{title:e(`user.organizationId`),value:r?.id??e(`user.unknown`)}),t(M,{title:e(`user.projectId`),value:i?.id??e(`user.unknown`)}),t(M,{title:e(`user.userId`),value:o?.sub??e(`user.unknown`)}),t(M,{title:e(`user.organizationRoles`),value:o?.account_roles?.join(`,`)??e(`user.unknown`)}),t(M,{title:e(`user.projectRoles`),value:o?.project_roles?.join(`,`)??e(`user.unknown`)})]})},{name:`environment`,label:e(`user.environment`),content:n(`div`,{className:`space-y-1 p-2`,children:[t(M,{title:e(`user.tenantId`),value:d}),t(M,{title:e(`user.environment`),value:A.type}),t(M,{title:e(`user.server`),value:s}),l&&t(M,{title:e(`user.store`),value:c}),t(M,{title:e(`user.mcpServer`),value:u}),t(M,{title:e(`user.appVersion`),value:A.version}),t(M,{title:e(`user.sdkVersion`),value:A.sdkVersion||e(`user.unknown`)})]})}];return t(`div`,{className:`w-full`,children:n(le,{defaultValue:`user`,tabs:f,fullWidth:!0,updateHash:!1,children:[t(ue,{}),t(de,{})]})})}function Sr(r){let{user:i,isLoading:a}=O(),[o,s]=y(!1);return a?t(ce,{}):i?t(`div`,{className:`px-3`,children:t(Cr,{asMenuTrigger:!0})}):n(e,{children:[t(x,{onClick:()=>s(!0),children:`Sign In`}),t(br,{isOpen:o,onClose:()=>s(!1)})]})}function Cr({className:e,asMenuTrigger:r=!1}){let i=O(),a=Ke(),o=Ye(),{user:s}=i;if(!i||!s)return null;let c=o.hasPermission(Ie.project_admin);return n(re,{click:!0,children:[t(ae,{children:t(`div`,{className:Xe(e,`flex items-center justify-start`,r&&`cursor-pointer`),children:t(b,{size:`sm`,color:`bg-amber-500`,shape:`circle`,name:s?.name})})}),t(ie,{align:`start`,className:`w-[280px] mx-2 my-1 p-0`,children:n(`div`,{className:`divide-y divide-gray-200 dark:divide-slate-700`,children:[n(`div`,{className:`py-2 ps-2`,children:[t(`p`,{className:`px-4 dark:text-white mb-1`,children:s?.name??`Unknown`}),t(`p`,{className:`px-4 text-xs text-gray-500`,children:s?.email??``})]}),t(`div`,{className:`w-full p-1`,children:t(xr,{})}),t(`div`,{className:`py-2 ps-2`,children:t(ne,{})}),t(`div`,{className:`py-2`,children:n(T,{children:[c&&t(T.Item,{className:`px-2`,onClick:()=>a(`/settings`,{replace:!0}),children:`Settings`}),t(T.Item,{className:`px-2`,onClick:()=>i.logout(),children:`Sign out`})]})})]})})]})}function wr(e){return e?e.endsWith(`@vertesiahq.com`)||e.endsWith(`@becomposable.com`)||e.endsWith(`@composableprompts.com`):!1}const Tr=s({});function Er(e){let t=v(null);return t.current===null&&(t.current=e()),t.current}const Dr=typeof window<`u`?g:p,Or=s(null);function kr(e,t){e.indexOf(t)===-1&&e.push(t)}function Ar(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}const N=(e,t,n)=>n>t?t:n<e?e:n,jr={},Mr=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Nr=e=>typeof e==`object`&&!!e,Pr=e=>/^0[^.\s]+$/u.test(e);function Fr(e){let t;return()=>(t===void 0&&(t=e()),t)}const P=e=>e,Ir=(...e)=>e.reduce((e,t)=>n=>t(e(n))),Lr=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1};var Rr=class{constructor(){this.subscriptions=[]}add(e){return kr(this.subscriptions,e),()=>Ar(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}};const F=e=>e*1e3,I=e=>e/1e3,zr=(e,t)=>t?1e3/t*e:0,Br=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function Vr(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Br(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>1e-7&&++s<12);return o}function Hr(e,t,n,r){if(e===t&&n===r)return P;let i=t=>Vr(t,0,1,e,n);return e=>e===0||e===1?e:Br(i(e),t,r)}const Ur=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Wr=e=>t=>1-e(1-t),Gr=Hr(.33,1.53,.69,.99),Kr=Wr(Gr),qr=Ur(Kr),Jr=e=>e>=1?1:(e*=2)<1?.5*Kr(e):.5*(2-2**(-10*(e-1))),Yr=e=>1-Math.sin(Math.acos(e)),Xr=Wr(Yr),Zr=Ur(Yr),Qr=Hr(.42,0,1,1),$r=Hr(0,0,.58,1),ei=Hr(.42,0,.58,1),ti=e=>Array.isArray(e)&&typeof e[0]!=`number`,ni=e=>Array.isArray(e)&&typeof e[0]==`number`,ri={linear:P,easeIn:Qr,easeInOut:ei,easeOut:$r,circIn:Yr,circInOut:Zr,circOut:Xr,backIn:Kr,backInOut:qr,backOut:Gr,anticipate:Jr},ii=e=>typeof e==`string`,ai=e=>{if(ni(e)){e.length;let[t,n,r,i]=e;return Hr(t,n,r,i)}return ii(e)?(ri[e],`${e}`,ri[e]):e},oi=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function si(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}function ci(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=oi.reduce((e,t)=>(e[t]=si(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=jr.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,40),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:oi.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<oi.length;t++)o[oi[t]].cancel(e)},state:i,steps:o}}const{schedule:L,cancel:li,state:R,steps:ui}=ci(typeof requestAnimationFrame<`u`?requestAnimationFrame:P,!0);let di;function fi(){di=void 0}const z={now:()=>(di===void 0&&z.set(R.isProcessing||jr.useManualTiming?R.timestamp:performance.now()),di),set:e=>{di=e,queueMicrotask(fi)}},pi=e=>t=>typeof t==`string`&&t.startsWith(e),mi=pi(`--`),hi=pi(`var(--`),gi=e=>hi(e)?_i.test(e.split(`/*`)[0].trim()):!1,_i=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function vi(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}const yi={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},bi={...yi,transform:e=>N(0,1,e)},xi={...yi,default:1},Si=e=>Math.round(e*1e5)/1e5,Ci=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function wi(e){return e==null}const Ti=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ei=(e,t)=>n=>!!(typeof n==`string`&&Ti.test(n)&&n.startsWith(e)||t&&!wi(n)&&Object.prototype.hasOwnProperty.call(n,t)),Di=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Ci);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Oi=e=>N(0,255,e),ki={...yi,transform:e=>Math.round(Oi(e))},Ai={test:Ei(`rgb`,`red`),parse:Di(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+ki.transform(e)+`, `+ki.transform(t)+`, `+ki.transform(n)+`, `+Si(bi.transform(r))+`)`};function ji(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}}const Mi={test:Ei(`#`),parse:ji,transform:Ai.transform},Ni=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),B=Ni(`deg`),V=Ni(`%`),H=Ni(`px`),Pi=Ni(`vh`),Fi=Ni(`vw`),Ii={...V,parse:e=>V.parse(e)/100,transform:e=>V.transform(e*100)},Li={test:Ei(`hsl`,`hue`),parse:Di(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+V.transform(Si(t))+`, `+V.transform(Si(n))+`, `+Si(bi.transform(r))+`)`},U={test:e=>Ai.test(e)||Mi.test(e)||Li.test(e),parse:e=>Ai.test(e)?Ai.parse(e):Li.test(e)?Li.parse(e):Mi.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ai.transform(e):Li.transform(e),getAnimatableNone:e=>{let t=U.parse(e);return t.alpha=0,U.transform(t)}},Ri=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function zi(e){return isNaN(e)&&typeof e==`string`&&(e.match(Ci)?.length||0)+(e.match(Ri)?.length||0)>0}const Bi=`number`,Vi=`color`,Hi=/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 Ui(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Hi,e=>(U.test(e)?(r.color.push(a),i.push(Vi),n.push(U.parse(e))):e.startsWith(`var(`)?(r.var.push(a),i.push(`var`),n.push(e)):(r.number.push(a),i.push(Bi),n.push(parseFloat(e))),++a,"${}")).split("${}"),indexes:r,types:i}}function Wi(e){return Ui(e).values}function Gi({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];i+=e===Bi?Si(r[a]):e===Vi?U.transform(r[a]):r[a]}return i}}function Ki(e){return Gi(Ui(e))}const qi=e=>typeof e==`number`?0:U.test(e)?U.getAnimatableNone(e):e,Ji=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:qi(e);function Yi(e){let t=Ui(e);return Gi(t)(t.values.map((e,n)=>Ji(e,t.split[n])))}const W={test:zi,parse:Wi,createTransformer:Ki,getAnimatableNone:Yi};function Xi(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 Zi({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=Xi(s,r,e+1/3),a=Xi(s,r,e),o=Xi(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Qi(e,t){return n=>n>0?t:e}const G=(e,t,n)=>e+(t-e)*n,$i=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},ea=[Mi,Ai,Li],ta=e=>ea.find(t=>t.test(e));function na(e){let t=ta(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Li&&(n=Zi(n)),n}const ra=(e,t)=>{let n=na(e),r=na(t);if(!n||!r)return Qi(e,t);let i={...n};return e=>(i.red=$i(n.red,r.red,e),i.green=$i(n.green,r.green,e),i.blue=$i(n.blue,r.blue,e),i.alpha=G(n.alpha,r.alpha,e),Ai.transform(i))},ia=new Set([`none`,`hidden`]);function aa(e,t){return ia.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function oa(e,t){return n=>G(e,t,n)}function sa(e){return typeof e==`number`?oa:typeof e==`string`?gi(e)?Qi:U.test(e)?ra:da:Array.isArray(e)?ca:typeof e==`object`?U.test(e)?ra:la:Qi}function ca(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>sa(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function la(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=sa(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function ua(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]],s=e.values[o]??0;n[i]=s,r[a]++}return n}const da=(e,t)=>{let n=W.createTransformer(t),r=Ui(e),i=Ui(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?ia.has(e)&&!i.values.length||ia.has(t)&&!r.values.length?aa(e,t):Ir(ca(ua(r,i),i.values),n):(`${e}${t}`,Qi(e,t))};function fa(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?G(e,t,n):sa(e)(e,t)}const pa=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>L.update(t,e),stop:()=>li(t),now:()=>R.isProcessing?R.timestamp:z.now()}},ma=(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)})`},ha=2e4;function ga(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 _a(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(ga(r),ha);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:I(i)}}const K={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 va(e,t){return e*Math.sqrt(1-t*t)}function ya(e,t,n){let r=n;for(let n=1;n<12;n++)r-=e(r)/t(r);return r}const ba=.001;function xa({duration:e=K.duration,bounce:t=K.bounce,velocity:n=K.velocity,mass:r=K.mass}){let i,a;K.maxDuration;let o=1-t;o=N(K.minDamping,K.maxDamping,o),e=N(K.minDuration,K.maxDuration,I(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=va(t,o),c=Math.exp(-i);return ba-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=va(t**2,o);return(-i(t)+ba>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=ya(i,a,s);if(e=F(e),isNaN(c))return{stiffness:K.stiffness,damping:K.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}const Sa=[`duration`,`bounce`],Ca=[`stiffness`,`damping`,`mass`];function wa(e,t){return t.some(t=>e[t]!==void 0)}function Ta(e){let t={velocity:K.velocity,stiffness:K.stiffness,damping:K.damping,mass:K.mass,isResolvedFromDuration:!1,...e};if(!wa(e,Ca)&&wa(e,Sa)){if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*N(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:K.mass,stiffness:i,damping:a}}else{let n=xa({...e,velocity:0});t={...t,...n,mass:K.mass},t.isResolvedFromDuration=!0}}return t}function Ea(e=K.visualDuration,t=K.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}=Ta({...n,velocity:-I(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=I(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?K.restSpeed.granular:K.restSpeed.default,i||=v?K.restDelta.granular:K.restDelta.default;let y,b,x,S,C,w;if(h<1)x=va(_,h),S=(m+h*_*g)/x,y=e=>{let t=Math.exp(-h*_*e);return o-t*(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=>F(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=F(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=F(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(ga(T),ha),t=ma(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Ea.applyToOptions=e=>{let t=_a(e,100,Ea);return e.ease=t.ease,e.duration=F(t.duration),e.type=`keyframes`,e};function Da(e,t,n){let r=Math.max(t-5,0);return zr(n-e(r),t-r)}function Oa({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=Ea({keyframes:[f.value,m(f.value)],velocity:Da(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 ka(e,t,n){let r=[],i=n||jr.mix||fa,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);if(t){let e=Array.isArray(t)?t[n]||P:t;a=Ir(e,a)}r.push(a)}return r}function Aa(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.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=ka(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=Lr(e[r],e[r+1],n);return s[r](i)};return n?t=>l(N(e[0],e[a-1],t)):l}function ja(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Lr(0,t,r);e.push(G(n,1,i))}}function Ma(e){let t=[0];return ja(t,e.length-1),t}function Na(e,t){return e.map(e=>e*t)}function Pa(e,t){return e.map(()=>t||ei).splice(0,e.length-1)}function Fa({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=ti(r)?r.map(ai):ai(r),a={done:!1,value:t[0]},o=Aa(Na(n&&n.length===t.length?n:Ma(t),e),t,{ease:Array.isArray(i)?i:Pa(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}const Ia=e=>e!==null;function La(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Ia),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}const Ra={decay:Oa,inertia:Oa,tween:Fa,keyframes:Fa,spring:Ea};function za(e){typeof e.type==`string`&&(e.type=Ra[e.type])}var Ba=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)}};const Va=e=>e/100;var Ha=class extends Ba{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!==z.now()&&this.tick(z.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;za(e);let{type:t=Fa,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Fa;s!==Fa&&typeof o[0]!=`number`&&(this.mixKeyframes=Ir(Va,fa(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=ga(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.currentTime=this.holdTime===null?t: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=N(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!==Oa&&(b.value=La(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 I(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+I(e)}get time(){return I(this.currentTime)}set time(e){e=F(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 Da(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(z.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=I(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=pa,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(z.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}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 Ua(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Wa=e=>e*180/Math.PI,Ga=e=>{let t=Wa(Math.atan2(e[1],e[0]));return qa(t)},Ka={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Ga,rotateZ:Ga,skewX:e=>Wa(Math.atan(e[1])),skewY:e=>Wa(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qa=e=>(e%=360,e<0&&(e+=360),e),Ja=Ga,Ya=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Xa=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Za={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ya,scaleY:Xa,scale:e=>(Ya(e)+Xa(e))/2,rotateX:e=>qa(Wa(Math.atan2(e[6],e[5]))),rotateY:e=>qa(Wa(Math.atan2(-e[2],e[0]))),rotateZ:Ja,rotate:Ja,skewX:e=>Wa(Math.atan(e[4])),skewY:e=>Wa(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qa(e){return+!!e.includes(`scale`)}function $a(e,t){if(!e||e===`none`)return Qa(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Za,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Ka,i=t}if(!i)return Qa(t);let a=r[t],o=i[1].split(`,`).map(to);return typeof a==`function`?a(o):o[a]}const eo=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return $a(n,t)};function to(e){return parseFloat(e.trim())}const no=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],ro=new Set([...no,`pathRotation`]),io=e=>e===yi||e===H,ao=new Set([`x`,`y`,`z`]),oo=no.filter(e=>!ao.has(e));function so(e){let t=[];return oo.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}const co={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})=>$a(t,`x`),y:(e,{transform:t})=>$a(t,`y`)};co.translateX=co.x,co.translateY=co.y;const lo=new Set;let uo=!1,fo=!1,po=!1;function mo(){if(fo){let e=Array.from(lo).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=so(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)})}fo=!1,uo=!1,lo.forEach(e=>e.complete(po)),lo.clear()}function ho(){lo.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(fo=!0)})}function go(){po=!0,ho(),mo(),po=!1}var _o=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?(lo.add(this),uo||(uo=!0,L.read(ho),L.resolveKeyframes(mo))):(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])}Ua(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),lo.delete(this)}cancel(){this.state===`scheduled`&&(lo.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}};const vo=e=>e.startsWith(`--`);function yo(e,t,n){vo(t)?e.style.setProperty(t,n):e.style[t]=n}const bo={};function xo(e,t){let n=Fr(e);return()=>bo[t]??n()}const So=xo(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),Co=xo(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),wo=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,To={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:wo([0,.65,.55,1]),circOut:wo([.55,0,1,.45]),backIn:wo([.31,.01,.66,-.59]),backOut:wo([.33,1.53,.69,.99])};function Eo(e,t){if(e)return typeof e==`function`?Co()?ma(e,t):`ease-out`:ni(e)?wo(e):Array.isArray(e)?e.map(e=>Eo(e,t)||To.easeOut):To[e]}function Do(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=Eo(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function Oo(e){return typeof e==`function`&&`applyToOptions`in e}function ko({type:e,...t}){return Oo(e)&&Co()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var Ao=class extends Ba{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,e.type;let c=ko(e);this.animation=Do(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=La(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),yo(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 I(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+I(e)}get time(){return I(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=F(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&&So()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),P):r(this)}};const jo={anticipate:Jr,backInOut:qr,circInOut:Zr};function Mo(e){return e in jo}function No(e){typeof e.ease==`string`&&Mo(e.ease)&&(e.ease=jo[e.ease])}var Po=class extends Ao{constructor(e){No(e),za(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 Ha({...a,autoplay:!1}),s=Math.max(10,z.now()-this.startTime),c=N(0,10,s-10),l=o.sample(s).value,{name:u}=this.options;i&&u&&yo(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}};const Fo=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(W.test(e)||e===`0`)&&!e.startsWith(`url(`));function Io(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 Lo(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=Fo(i,t),s=Fo(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:Io(e)||(n===`spring`||Oo(n))&&r}function Ro(e){e.duration=0,e.type=`keyframes`}const zo=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),Bo=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function Vo(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&Bo.test(e[t]))return!0;return!1}const Ho=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),Uo=Fr(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Wo(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e,c=t?.owner?.current;if(!(c instanceof HTMLElement)&&!(c instanceof SVGElement))return!1;let{onUpdate:l,transformTemplate:u}=t.owner.getProps();return Uo()&&n&&(zo.has(n)||Ho.has(n)&&Vo(s))&&(n!==`transform`||!u)&&!l&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Go=class extends Ba{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=z.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||_o;this.keyframeResolver=new f(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=z.now();let u=!0;Lo(e,i,a,o)||(u=!1,(jr.instantAnimations||!s)&&l?.(La(e,n,t)),e[0]=e[e.length-1],Ro(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&Wo(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new Po({...d,element:p})}catch{m=new Ha(d)}else m=new Ha(d);m.finished.then(()=>{this.notifyFinished()}).catch(P),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(),go()),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}const qo=e=>!isNaN(parseFloat(e)),Jo={current:void 0};var Yo=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=z.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=z.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=qo(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Rr);let n=this.events[e].add(t);return e===`change`?()=>{n(),L.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 Jo.current&&Jo.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=z.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>30)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return zr(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 Xo(e,t){return new Yo(e,t)}function Zo(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function Qo(e,t){let n=e?.[t]??e?.default??e;return n===e?n:Zo(n,e)}const $o={type:`spring`,stiffness:500,damping:25,restSpeed:10},es=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ts={type:`keyframes`,duration:.8},ns={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},rs=(e,{keyframes:t})=>t.length>2?ts:ro.has(e)?e.startsWith(`scale`)?es(t[1]):$o:ns,is=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function as(e){for(let t in e)if(!is.has(t))return!0;return!1}const os=(e,t,n,r={},i,a)=>o=>{let s=Qo(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=F(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};as(s)||Object.assign(u,rs(e,u)),u.duration&&=F(u.duration),u.repeatDelay&&=F(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Ro(u),u.delay===0&&(d=!0)),(jr.instantAnimations||jr.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,Ro(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=La(u.keyframes,s);if(e!==void 0){L.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Ha(u):new Go(u)},ss=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cs(e){let t=ss.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function ls(e,t,n=1){`${e}`;let[r,i]=cs(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return Mr(e)?parseFloat(e):e}return gi(i)?ls(i,t,n+1):i}function us(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function ds(e,t,n,r){if(typeof t==`function`){let[i,a]=us(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]=us(r);t=t(n===void 0?e.custom:n,i,a)}return t}function fs(e,t,n){let r=e.getProps();return ds(r,t,n===void 0?r.custom:n,e)}const ps=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...no]),ms=e=>Array.isArray(e);function hs(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Xo(n))}function gs(e){return ms(e)?e[e.length-1]||0:e}function _s(e,t){let{transitionEnd:n={},transition:r={},...i}=fs(e,t)||{};i={...i,...n};for(let t in i)hs(e,t,gs(i[t]))}const q=e=>!!(e&&e.getVelocity);function vs(e){return!!(q(e)&&e.add)}function ys(e,t){let n=e.getValue(`willChange`);if(vs(n))return n.add(t);if(!n&&jr.WillChange){let n=new jr.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function bs(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const xs=`data-`+bs(`framerAppearId`);function Ss(e){return e.props[xs]}function Cs({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function ws(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,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&Cs(f,t))continue;let o={delay:n,...Qo(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){L.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=Ss(e);if(n){let e=window.MotionHandoffAnimation(n,t,L);e!==null&&(o.startTime=e,p=!0)}}ys(e,t);let m=l??e.shouldReduceMotion;r.start(os(t,r,i,m&&ps.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>L.update(()=>{o&&_s(e,o)});d.length?Promise.all(d).then(t):t()}return d}function Ts(e,t,n={}){let r=fs(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(ws(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Es(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())}return Promise.all([a(),o(n.delay)])}function Es(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(Ts(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 Ds(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Ts(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Ts(e,t,n);else{let i=typeof t==`function`?fs(e,t,n.custom):t;r=Promise.all(ws(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}const Os={test:e=>e===`auto`,parse:e=>e},ks=e=>t=>t.test(e),As=[yi,H,V,B,Fi,Pi,Os],js=e=>As.find(ks(e));function Ms(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||Pr(e)}const Ns=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Ps(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Ci)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Ns.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}const Fs=/\b([a-z-]*)\(.*?\)/gu,Is={...W,getAnimatableNone:e=>{let t=e.match(Fs);return t?t.map(Ps).join(` `):e}},Ls={...W,getAnimatableNone:e=>{let t=W.parse(e);return W.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Rs={...yi,transform:Math.round},zs={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:B,pathRotation:B,rotateX:B,rotateY:B,rotateZ:B,scale:xi,scaleX:xi,scaleY:xi,scaleZ:xi,skew:B,skewX:B,skewY:B,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:bi,originX:Ii,originY:Ii,originZ:H,zIndex:Rs,fillOpacity:bi,strokeOpacity:bi,numOctaves:Rs},Bs={...zs,color:U,backgroundColor:U,outlineColor:U,fill:U,stroke:U,borderColor:U,borderTopColor:U,borderRightColor:U,borderBottomColor:U,borderLeftColor:U,filter:Is,WebkitFilter:Is,mask:Ls,WebkitMask:Ls},Vs=e=>Bs[e],Hs=new Set([Is,Ls]);function Us(e,t){let n=Vs(e);return Hs.has(n)||(n=W),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Ws=new Set([`auto`,`none`,`0`]);function Gs(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Ws.has(t)&&Ui(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Us(n,i)}var Ks=class extends _o{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(),gi(r))){let i=ls(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ps.has(n)||e.length!==2)return;let[r,i]=e,a=js(r),o=js(i);if(vi(r)!==vi(i)&&co[n]){this.needsMeasurement=!0;return}if(a!==o){if(io(a)&&io(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else co[n]&&(this.needsMeasurement=!0)}}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Ms(e[t]))&&n.push(t);n.length&&Gs(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=co[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]=co[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()}};const qs=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Js(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)}const Ys=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Xs(e){return Nr(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}const{schedule:Zs,cancel:Qs}=ci(queueMicrotask,!1),J={x:!1,y:!1};function $s(){return J.x||J.y}function ec(e){return e===`x`||e===`y`?J[e]?null:(J[e]=!0,()=>{J[e]=!1}):J.x||J.y?null:(J.x=J.y=!0,()=>{J.x=J.y=!1})}function tc(e,t){let n=Js(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function nc(e){return!(e.pointerType===`touch`||$s())}function rc(e,t,n={}){let[r,i,a]=tc(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(!nc(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}const ic=(e,t)=>t?e===t||ic(e,t.parentElement):!1,ac=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,oc=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function sc(e){return oc.has(e.tagName)||e.isContentEditable===!0}const cc=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function lc(e){return cc.has(e.tagName)||e.isContentEditable===!0}const uc=new WeakSet;function dc(e){return t=>{t.key===`Enter`&&e(t)}}function fc(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}const pc=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=dc(()=>{if(uc.has(n))return;fc(n,`down`);let e=dc(()=>{fc(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>fc(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function mc(e){return ac(e)&&!$s()}const hc=new WeakSet;function gc(e,t,n={}){let[r,i,a]=tc(e,n),o=e=>{let r=e.currentTarget;if(!mc(e)||hc.has(e))return;uc.add(r),n.stopPropagation&&hc.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),uc.has(r)&&uc.delete(r),mc(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||ic(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Xs(e)&&(e.addEventListener(`focus`,e=>pc(e,i)),!sc(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function _c(e){return Nr(e)&&`ownerSVGElement`in e}const vc=new WeakMap;let yc;const bc=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:_c(r)&&`getBBox`in r?r.getBBox()[t]:r[n],xc=bc(`inline`,`width`,`offsetWidth`),Sc=bc(`block`,`height`,`offsetHeight`);function Cc({target:e,borderBoxSize:t}){vc.get(e)?.forEach(n=>{n(e,{get width(){return xc(e,t)},get height(){return Sc(e,t)}})})}function wc(e){e.forEach(Cc)}function Tc(){typeof ResizeObserver>`u`||(yc=new ResizeObserver(wc))}function Ec(e,t){yc||Tc();let n=Js(e);return n.forEach(e=>{let n=vc.get(e);n||(n=new Set,vc.set(e,n)),n.add(t),yc?.observe(e)}),()=>{n.forEach(e=>{let n=vc.get(e);n?.delete(t),n?.size||yc?.unobserve(e)})}}const Dc=new Set;let Oc;function kc(){Oc=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Dc.forEach(t=>t(e))},window.addEventListener(`resize`,Oc)}function Ac(e){return Dc.add(e),Oc||kc(),()=>{Dc.delete(e),!Dc.size&&typeof Oc==`function`&&(window.removeEventListener(`resize`,Oc),Oc=void 0)}}function jc(e,t){return typeof e==`function`?Ac(e):Ec(e,t)}const Mc={value:null,addProjectionMetrics:null};function Nc(e){return _c(e)&&e.tagName===`svg`}const Pc=[...As,U,W],Fc=e=>Pc.find(ks(e)),Ic=()=>({translate:0,scale:1,origin:0,originPoint:0}),Lc=()=>({x:Ic(),y:Ic()}),Rc=()=>({min:0,max:0}),Y=()=>({x:Rc(),y:Rc()}),zc=new WeakMap;function Bc(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Vc(e){return typeof e==`string`||Array.isArray(e)}const Hc=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Uc=[`initial`,...Hc];function Wc(e){return Bc(e.animate)||Uc.some(t=>Vc(e[t]))}function Gc(e){return!!(Wc(e)||e.variants)}function Kc(e,t,n){for(let r in t){let i=t[r],a=n[r];if(q(i))e.addValue(r,i);else if(q(a))e.addValue(r,Xo(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,Xo(t===void 0?i:t,{owner:e}))}}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}const qc={current:null},Jc={current:!1},Yc=typeof window<`u`;function Xc(){if(Jc.current=!0,Yc){if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>qc.current=e.matches;e.addEventListener(`change`,t),t()}else qc.current=!1}}const Zc=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`];let Qc={};function $c(e){Qc=e}function el(){return Qc}var tl=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=_o,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=z.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,L.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=Wc(t),this.isVariantNode=Gc(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&&q(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,zc.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:(Jc.current||Xc(),this.shouldReduceMotion=qc.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),li(this.notifyUpdate),li(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&&zo.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new Ao({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:F(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=ro.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&L.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()})}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 Qc){let t=Qc[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):Y()}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<Zc.length;t++){let n=Zc[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=Kc(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=Xo(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`&&(Mr(n)||Pr(n))?n=parseFloat(n):!Fc(n)&&W.test(t)&&(n=Us(e,t)),this.setBaseTarget(e,q(n)?n.get():n)),q(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=ds(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&&!q(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 Rr),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Zs.render(this.render)}},nl=class extends tl{constructor(){super(...arguments),this.KeyframeResolver=Ks}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;q(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},rl=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function il({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function al({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ol(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 sl(e){return e===void 0||e===1}function cl({scale:e,scaleX:t,scaleY:n}){return!sl(e)||!sl(t)||!sl(n)}function ll(e){return cl(e)||ul(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ul(e){return dl(e.x)||dl(e.y)}function dl(e){return e&&e!==`0%`}function fl(e,t,n){return n+t*(e-n)}function pl(e,t,n,r,i){return i!==void 0&&(e=fl(e,i,r)),fl(e,n,r)+t}function ml(e,t=0,n=1,r,i){e.min=pl(e.min,t,n,r,i),e.max=pl(e.max,t,n,r,i)}function hl(e,{x:t,y:n}){ml(e.x,t.translate,t.scale,t.originPoint),ml(e.y,n.translate,n.scale,n.originPoint)}const gl=.999999999999,_l=1.0000000000001;function vl(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&&(X(e.x,-a.scroll.offset.x),X(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,hl(e,o)),r&&ll(a.latestValues)&&xl(e,a.latestValues,a.layout?.layoutBox))}t.x<_l&&t.x>gl&&(t.x=1),t.y<_l&&t.y>gl&&(t.y=1)}function X(e,t){e.min+=t,e.max+=t}function yl(e,t,n,r,i=.5){ml(e,t,n,G(e.min,e.max,i),r)}function bl(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function xl(e,t,n){let r=n??e;yl(e.x,bl(t.x,r.x),t.scaleX,t.scale,t.originX),yl(e.y,bl(t.y,r.y),t.scaleY,t.scale,t.originY)}function Sl(e,t){return il(ol(e.getBoundingClientRect(),t))}function Cl(e,t,n){let r=Sl(e,n),{scroll:i}=t;return i&&(X(r.x,i.offset.x),X(r.y,i.offset.y)),r}const wl={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Tl=no.length;function El(e,t,n){let r=``,i=!0;for(let a=0;a<Tl;a++){let o=no[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=Ys(s,zs[o]);if(!c){i=!1;let t=wl[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${Ys(a,zs.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Dl(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(ro.has(e)){o=!0;continue}if(mi(e)){i[e]=n;continue}{let t=Ys(n,zs[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=El(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 Ol(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 kl(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Al={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`){if(H.test(e))e=parseFloat(e);else return e}return`${kl(e,t.target.x)}% ${kl(e,t.target.y)}%`}},jl={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=W.parse(e);if(i.length>5)return r;let a=W.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=G(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Ml={borderRadius:{...Al,applyTo:[...qs]},borderTopLeftRadius:Al,borderTopRightRadius:Al,borderBottomLeftRadius:Al,borderBottomRightRadius:Al,boxShadow:jl};function Nl(e,{layout:t,layoutId:n}){return ro.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ml[e]||e===`opacity`)}function Pl(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(q(r[t])||i&&q(i[t])||Nl(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Fl(e){return window.getComputedStyle(e)}var Il=class extends nl{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Ol}mount(e){e.style,super.mount(e)}readValueFromInstance(e,t){if(ro.has(t))return this.projection?.isProjecting?Qa(t):eo(e,t);{let n=Fl(e),r=(mi(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){Dl(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Pl(e,t,n)}};const Ll={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Rl={offset:`strokeDashoffset`,array:`strokeDasharray`};function zl(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Ll:Rl;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}const Bl=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Vl(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Dl(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 Bl)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&&zl(d,i,a,o,!1)}const Hl=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`]),Ul=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Wl(e,t,n,r){Ol(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Hl.has(n)?n:bs(n),t.attrs[n])}function Gl(e,t,n){let r=Pl(e,t,n);for(let n in e)if(q(e[n])||q(t[n])){let t=no.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Kl=class extends nl{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Y}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(ro.has(t)){let e=Vs(t);return e&&e.default||0}return t=Hl.has(t)?t:bs(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Gl(e,t,n)}build(e,t,n){Vl(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Wl(e,t,n,r)}mount(e){this.isSVGTag=Ul(e.tagName),super.mount(e)}};const ql=Uc.length;function Jl(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&Jl(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<ql;n++){let r=Uc[n],i=e.props[r];(Vc(i)||i===!1)&&(t[r]=i)}return t}function Yl(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}const Xl=[...Hc].reverse(),Zl=Hc.length;function Ql(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Ds(e,t,n)))}function $l(e){let t=Ql(e),n=nu(),r=!0,i=!1,a=t=>(n,r)=>{let i=fs(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=Jl(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<Zl;t++){let p=Xl[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Vc(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||Bc(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=eu(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=ms(t)&&ms(n)?!Yl(t,n)||y: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=fs(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=fs(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=nu(),i=!0}}}function eu(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Yl(t,e):!1}function tu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nu(){return{animate:tu(!0),whileInView:tu(),whileHover:tu(),whileTap:tu(),whileDrag:tu(),whileFocus:tu(),exit:tu()}}function ru(e,t){e.min=t.min,e.max=t.max}function Z(e,t){ru(e.x,t.x),ru(e.y,t.y)}function iu(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Q(e){return e.max-e.min}function au(e,t,n){return Math.abs(e-t)<=n}function ou(e,t,n,r=.5){e.origin=r,e.originPoint=G(t.min,t.max,e.origin),e.scale=Q(n)/Q(t),e.translate=G(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function su(e,t,n,r){ou(e.x,t.x,n.x,r?r.originX:void 0),ou(e.y,t.y,n.y,r?r.originY:void 0)}function cu(e,t,n,r=0){e.min=(r?G(n.min,n.max,r):n.min)+t.min,e.max=e.min+Q(t)}function lu(e,t,n,r){cu(e.x,t.x,n.x,r?.x),cu(e.y,t.y,n.y,r?.y)}function uu(e,t,n,r=0){let i=r?G(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Q(t)}function du(e,t,n,r){uu(e.x,t.x,n.x,r?.x),uu(e.y,t.y,n.y,r?.y)}function fu(e,t,n,r,i){return e-=t,e=fl(e,1/n,r),i!==void 0&&(e=fl(e,1/i,r)),e}function pu(e,t=0,n=1,r=.5,i,a=e,o=e){if(V.test(t)&&(t=parseFloat(t),t=G(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=G(a.min,a.max,r);e===a&&(s-=t),e.min=fu(e.min,t,n,s,i),e.max=fu(e.max,t,n,s,i)}function mu(e,t,[n,r,i],a,o){pu(e,t[n],t[r],t[i],t.scale,a,o)}const hu=[`x`,`scaleX`,`originX`],gu=[`y`,`scaleY`,`originY`];function _u(e,t,n,r){mu(e.x,t,hu,n?n.x:void 0,r?r.x:void 0),mu(e.y,t,gu,n?n.y:void 0,r?r.y:void 0)}function vu(e){return e.translate===0&&e.scale===1}function yu(e){return vu(e.x)&&vu(e.y)}function bu(e,t){return e.min===t.min&&e.max===t.max}function xu(e,t){return bu(e.x,t.x)&&bu(e.y,t.y)}function Su(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Cu(e,t){return Su(e.x,t.x)&&Su(e.y,t.y)}function wu(e){return Q(e.x)/Q(e.y)}function Tu(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function $(e){return[e(`x`),e(`y`)]}function Eu(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,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}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`}const Du=qs.length,Ou=e=>typeof e==`string`?parseFloat(e):e,ku=e=>typeof e==`number`||H.test(e);function Au(e,t,n,r,i,a){i?(e.opacity=G(0,n.opacity??1,Mu(r)),e.opacityExit=G(t.opacity??1,0,Nu(r))):a&&(e.opacity=G(t.opacity??1,n.opacity??1,r));for(let i=0;i<Du;i++){let a=qs[i],o=ju(t,a),s=ju(n,a);(o!==void 0||s!==void 0)&&(o||=0,s||=0,o===0||s===0||ku(o)===ku(s)?(e[a]=Math.max(G(Ou(o),Ou(s),r),0),(V.test(s)||V.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=G(t.rotate||0,n.rotate||0,r))}function ju(e,t){return e[t]===void 0?e.borderRadius:e[t]}const Mu=Pu(0,.5,Xr),Nu=Pu(.5,.95,P);function Pu(e,t,n){return r=>r<e?0:r>t?1:n(Lr(e,t,r))}function Fu(e,t,n){let r=q(e)?e:Xo(e);return r.start(os(``,r,t,n)),r.animation}function Iu(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}const Lu=(e,t)=>e.depth-t.depth;var Ru=class{constructor(){this.children=[],this.isDirty=!1}add(e){kr(this.children,e),this.isDirty=!0}remove(e){Ar(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Lu),this.isDirty=!1,this.children.forEach(e)}};function zu(e,t){let n=z.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(li(r),e(a-t))};return L.setup(r,!0),()=>li(r)}function Bu(e){return q(e)?e.get():e}var Vu=class{constructor(){this.members=[]}add(e){kr(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&&(Ar(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(Ar(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)}};const Hu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Uu={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},Wu=[``,`X`,`Y`,`Z`];let Gu=0;function Ku(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function qu(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`,L,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&qu(r)}function Ju({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=Gu++,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,Mc.value&&(Uu.nodes=Uu.calculatedTargetDeltas=Uu.calculatedProjections=0),this.nodes.forEach(Zu),this.nodes.forEach(od),this.nodes.forEach(sd),this.nodes.forEach(Qu),Mc.addProjectionMetrics&&Mc.addProjectionMetrics(Uu)},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 Ru)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Rr),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=_c(t)&&!Nc(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;L.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=zu(i,250),Hu.hasAnimatedSinceResize&&(Hu.hasAnimatedSinceResize=!1,this.nodes.forEach(ad)))})}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()||md,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Cu(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={...Qo(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||ad(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(),li(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(cd),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&&qu(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(td),this.nodes.forEach(ed);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(nd);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(rd),this.nodes.forEach(id),this.nodes.forEach(Yu),this.nodes.forEach(Xu)):this.nodes.forEach(nd),this.clearAllSnapshots();let e=z.now();R.delta=N(0,1e3/60,e-R.timestamp),R.timestamp=e,R.isProcessing=!0,ui.update.process(R),ui.preRender.process(R),ui.render.process(R),R.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Zs.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach($u),this.sharedNodes.forEach(ld)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,L.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){L.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Q(this.snapshot.measuredBox.x)&&!Q(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||=Y(),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&&!yu(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||ll(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)),vd(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Y();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(bd))){let{scroll:e}=this.root;e&&(X(t.x,e.offset.x),X(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Y();if(Z(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&&Z(t,e),X(t.x,i.offset.x),X(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Y();Z(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&&(X(r.x,-n.scroll.offset.x),X(r.y,-n.scroll.offset.y)),ll(n.latestValues)&&xl(r,n.latestValues,n.layout?.layoutBox)}return ll(this.latestValues)&&xl(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Y();Z(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!ll(n.latestValues))continue;let r;n.instance&&(cl(n.latestValues)&&n.updateSnapshot(),r=Y(),Z(r,n.measurePageBox())),_u(t,n.latestValues,n.snapshot?.layoutBox,r)}return ll(this.latestValues)&&_u(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||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!==R.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=R.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=Y(),this.targetWithTransforms=Y()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),lu(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Z(this.target,this.layout.layoutBox),hl(this.target,this.targetDelta)):Z(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),Mc.value&&Uu.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||cl(this.parent.latestValues)||ul(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=Y(),this.relativeTargetOrigin=Y(),du(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),Z(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===R.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;Z(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;vl(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=Y());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(iu(this.prevProjectionDelta.x,this.projectionDelta.x),iu(this.prevProjectionDelta.y,this.projectionDelta.y)),su(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Tu(this.projectionDelta.x,this.prevProjectionDelta.x)||!Tu(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Mc.value&&Uu.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=Lc(),this.projectionDelta=Lc(),this.projectionDeltaWithTransform=Lc()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Lc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=Y(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(pd));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=G(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=G(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(ud(o.x,e.x,n),ud(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(du(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),fd(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&xu(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Y(),Z(f,this.relativeTarget)),c&&(this.animationValues=a,Au(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),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&&=(li(this.pendingAnimation),void 0),this.pendingAnimation=L.update(()=>{Hu.hasAnimatedSinceResize=!0,this.motionValue||=Xo(0),this.motionValue.jump(0,!1),this.currentAnimation=Fu(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{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(1e3),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&&yd(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Y();let t=Q(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=Q(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}Z(t,n),xl(t,i),su(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new Vu),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}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&&Ku(`z`,e,r,this.animationValues);for(let t=0;t<Wu.length;t++)Ku(`rotate${Wu[t]}`,e,r,this.animationValues),Ku(`skew${Wu[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=Bu(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=Bu(t?.pointerEvents)||``),this.hasProjected&&!ll(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Eu(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`,e.opacity=r.animationValues?r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Ml){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Ml[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?Bu(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(ed),this.root.sharedNodes.clear()}}}function Yu(e){e.updateLayout()}function Xu(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`)$(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=Q(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;ru(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else yd(i,t.layoutBox,n)&&$(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=Q(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=Lc();su(o,n,t.layoutBox);let s=Lc();a?su(s,e.applyTransform(r,!0),t.measuredBox):su(s,n,t.layoutBox);let c=!yu(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=Y();du(s,t.layoutBox,i.layoutBox,o);let c=Y();du(c,n,a.layoutBox,o),Cu(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 Zu(e){Mc.value&&Uu.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 Qu(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function $u(e){e.clearSnapshot()}function ed(e){e.clearMeasurements()}function td(e){e.isLayoutDirty=!0,e.updateLayout()}function nd(e){e.isLayoutDirty=!1}function rd(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function id(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function ad(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function od(e){e.resolveTargetDelta()}function sd(e){e.calcProjection()}function cd(e){e.resetSkewAndRotation()}function ld(e){e.removeLeadSnapshot()}function ud(e,t,n){e.translate=G(t.translate,0,n),e.scale=G(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function dd(e,t,n,r){e.min=G(t.min,n.min,r),e.max=G(t.max,n.max,r)}function fd(e,t,n,r){dd(e.x,t.x,n.x,r),dd(e.y,t.y,n.y,r)}function pd(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const md={duration:.45,ease:[.4,0,.1,1]},hd=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),gd=hd(`applewebkit/`)&&!hd(`chrome/`)?Math.round:P;function _d(e){e.min=gd(e.min),e.max=gd(e.max)}function vd(e){_d(e.x),_d(e.y)}function yd(e,t,n){return e===`position`||e===`preserve-aspect`&&!au(wu(t),wu(n),.2)}function bd(e){return e!==e.root&&e.scroll?.wasRoot}const xd=Ju({attachResizeListener:(e,t)=>Iu(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Sd={current:void 0},Cd=Ju({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Sd.current){let e=new xd({});e.mount(window),e.setOptions({layoutScroll:!0}),Sd.current=e}return Sd.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),wd=s({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Td(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ed(...e){return t=>{let n=!1,r=e.map(e=>{let r=Td(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():Td(e[t],null)}}}}function Dd(...e){return r.useCallback(Ed(...e),e)}var Od=class extends r.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(Xs(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=Xs(e)&&e.offsetWidth||0,r=Xs(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,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function kd({children:e,isPresent:n,anchorX:i,anchorY:a,root:o,pop:s}){let c=m(),l=v(null),u=v({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:d}=f(wd),p=Dd(l,s===!1?void 0:e.props?.ref??e?.ref);return h(()=>{let{width:e,height:t,top:r,left:f,right:p,bottom:m,direction:h}=u.current;if(n||s===!1||!l.current||!e||!t)return;let g=h===`rtl`,_=i===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=a===`bottom`?`bottom: ${m}`:`top: ${r}`;l.current.dataset.motionPopId=c;let y=document.createElement(`style`);d&&(y.nonce=d);let b=o??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
111
|
+
[data-motion-pop-id="${c}"] {
|
|
112
|
+
position: absolute !important;
|
|
113
|
+
width: ${e}px !important;
|
|
114
|
+
height: ${t}px !important;
|
|
115
|
+
${_}px !important;
|
|
116
|
+
${v}px !important;
|
|
117
|
+
}
|
|
118
|
+
`),()=>{l.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[n]),t(Od,{isPresent:n,childRef:l,sizeRef:u,pop:s,children:s===!1?e:r.cloneElement(e,{ref:p})})}const Ad=({children:e,initial:n,isPresent:i,onExitComplete:a,custom:o,presenceAffectsLayout:s,mode:c,anchorX:l,anchorY:u,root:d})=>{let f=Er(jd),p=m(),h=v(i),g=v(a);Dr(()=>{h.current=i,g.current=a});let y=!0,b=_(()=>(y=!1,{id:p,initial:n,isPresent:i,custom:o,onExitComplete:e=>{f.set(e,!0);for(let e of f.values())if(!e)return;a&&a()},register:e=>(f.set(e,!1),()=>{f.delete(e),!h.current&&!f.size&&g.current?.()})}),[i,f,a]);return s&&y&&(b={...b}),_(()=>{f.forEach((e,t)=>f.set(t,!1))},[i]),r.useEffect(()=>{!i&&!f.size&&a&&a()},[i]),e=t(kd,{pop:c===`popLayout`,isPresent:i,anchorX:l,anchorY:u,root:d,children:e}),t(Or.Provider,{value:b,children:e})};function jd(){return new Map}function Md(e=!0){let t=f(Or);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=m();p(()=>{if(e)return i(a)},[e]);let o=d(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}const Nd=e=>e.key||``;function Pd(e){let t=[];return i.forEach(e,e=>{u(e)&&t.push(e)}),t}const Fd=({children:n,custom:r,initial:i=!0,onExitComplete:a,presenceAffectsLayout:o=!0,mode:s=`sync`,propagate:c=!1,anchorX:l=`left`,anchorY:u=`top`,root:d})=>{let[p,m]=Md(c),h=_(()=>Pd(n),[n]),g=c&&!p?[]:h.map(Nd),b=v(!0),x=v(h),S=Er(()=>new Map),C=v(new Set),[w,T]=y(h),[E,D]=y(h);Dr(()=>{b.current=!1,x.current=h;for(let e=0;e<E.length;e++){let t=Nd(E[e]);g.includes(t)?(S.delete(t),C.current.delete(t)):S.get(t)!==!0&&S.set(t,!1)}},[E,g.length,g.join(`-`)]);let ee=[];if(h!==w){let e=[...h];for(let t=0;t<E.length;t++){let n=E[t],r=Nd(n);g.includes(r)||(e.splice(t,0,n),ee.push(n))}return s===`wait`&&ee.length&&(e=ee),D(Pd(e)),T(h),null}let{forceRender:te}=f(Tr);return t(e,{children:E.map(e=>{let n=Nd(e),f=c&&!p?!1:h===E||g.includes(n);return t(Ad,{isPresent:f,initial:!b.current||i?void 0:!1,custom:r,presenceAffectsLayout:o,mode:s,root:d,onExitComplete:f?void 0:()=>{if(C.current.has(n))return;if(S.has(n))C.current.add(n),S.set(n,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(te?.(),D(x.current),c&&m?.(),a&&a())},anchorX:l,anchorY:u,children:e},n)})})},Id=s({strict:!1}),Ld={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]};let Rd=!1;function zd(){if(Rd)return;let e={};for(let t in Ld)e[t]={isEnabled:e=>Ld[t].some(t=>!!e[t])};$c(e),Rd=!0}function Bd(){return zd(),el()}function Vd(e){let t=Bd();for(let n in e)t[n]={...t[n],...e[n]};$c(t)}const Hd=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function Ud(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||Hd.has(e)}let Wd=e=>!Ud(e);function Gd(e){typeof e==`function`&&(Wd=t=>t.startsWith(`on`)?!Ud(t):e(t))}try{Gd(Ze(`@emotion/is-prop-valid`).default)}catch{}function Kd(e,t,n){let r={};for(let i in e)(i!==`values`||typeof e.values!=`object`)&&(q(e[i])||(Wd(i)||n===!0&&Ud(i)||!t&&!Ud(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]));return r}const qd=s({});function Jd(e,t){if(Wc(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Vc(t)?t:void 0,animate:Vc(n)?n:void 0}}return e.inherit===!1?{}:t}function Yd(e){let{initial:t,animate:n}=Jd(e,f(qd));return _(()=>({initial:t,animate:n}),[Xd(t),Xd(n)])}function Xd(e){return Array.isArray(e)?e.join(` `):e}const Zd=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Qd(e,t,n){for(let r in t)!q(t[r])&&!Nl(r,n)&&(e[r]=t[r])}function $d({transformTemplate:e},t){return _(()=>{let n=Zd();return Dl(n,t,e),Object.assign({},n.vars,n.style)},[t])}function ef(e,t){let n=e.style||{},r={};return Qd(r,n,e),Object.assign(r,$d(e,t)),r}function tf(e,t){let n={},r=ef(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const nf=()=>({...Zd(),attrs:{}});function rf(e,t,n,r){let i=_(()=>{let n=nf();return Vl(n,t,Ul(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};Qd(t,e.style,e),i.style={...t,...i.style}}return i}const af=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function of(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(af.indexOf(e)>-1||/[A-Z]/u.test(e))}function sf(e,t,n,{latestValues:r},i,a=!1,s){let l=(s??of(e)?rf:tf)(t,r,i,e),u=Kd(t,typeof e==`string`,a),d=e===o?{}:{...u,...l,ref:n},{children:f}=t,p=_(()=>q(f)?f.get():f,[f]);return c(e,{...d,children:p})}function cf({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:lf(n,r,i,e),renderState:t()}}function lf(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Bu(a[e]);let{initial:o,animate:s}=e,c=Wc(e),l=Gc(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Bc(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=ds(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}const uf=e=>(t,n)=>{let r=f(qd),i=f(Or),a=()=>cf(e,t,r,i);return n?a():Er(a)},df=uf({scrapeMotionValuesFromProps:Pl,createRenderState:Zd}),ff=uf({scrapeMotionValuesFromProps:Gl,createRenderState:nf}),pf=Symbol.for(`motionComponentSymbol`);function mf(e,t,n){let r=v(n);h(()=>{r.current=n});let i=v(null);return d(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`){if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n)}else a&&(a.current=n)},[t])}const hf=s({});function gf(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function _f(e,t,n,r,i,a){let{visualElement:o}=f(qd),s=f(Id),c=f(Or),l=f(wd),u=l.reducedMotion,d=l.skipAnimations,m=v(null),g=v(!1);r||=s.renderer,!m.current&&r&&(m.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),g.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));let _=m.current,y=f(hf);_&&!_.projection&&i&&(_.type===`html`||_.type===`svg`)&&vf(m.current,n,i,y);let b=v(!1);h(()=>{_&&b.current&&_.update(n,c)});let x=n[xs],S=v(!!x&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(x)&&window.MotionHasOptimisedAnimation?.(x));return Dr(()=>{g.current=!0,_&&(b.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),_.scheduleRenderMicrotask(),S.current&&_.animationState&&_.animationState.animateChanges())}),p(()=>{_&&(!S.current&&_.animationState&&_.animationState.animateChanges(),S.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(x)}),!1),_.enteringChildren=void 0)}),_}function vf(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:yf(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&gf(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function yf(e){if(e)return e.options.allowProjection===!1?yf(e.parent):e.projection}function bf(e,{forwardMotionProps:r=!1,type:i}={},a,o){a&&Vd(a);let s=i?i===`svg`:of(e),c=s?ff:df;function u(i,l){let u,d={...f(wd),...i,layoutId:xf(i)},{isStatic:p}=d,m=Yd(i),h=c(i,p);if(!p&&typeof window<`u`){Sf(d,a);let t=Cf(d);u=t.MeasureLayout,m.visualElement=_f(e,h,d,o,t.ProjectionNode,s)}return n(qd.Provider,{value:m,children:[u&&m.visualElement?t(u,{visualElement:m.visualElement,...d}):null,sf(e,i,mf(h,m.visualElement,l),h,p,r,s)]})}u.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let d=l(u);return d[pf]=e,d}function xf({layoutId:e}){let t=f(Tr).id;return t&&e!==void 0?t+`-`+e:e}function Sf(e,t){f(Id).strict}function Cf(e){let{drag:t,layout:n}=Bd();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function wf(e,t){if(typeof Proxy>`u`)return bf;let n=new Map,r=(n,r)=>bf(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,bf(a,void 0,e,t)),n.get(a))})}const Tf=(e,t)=>t.isSVG??of(e)?new Kl(t):new Il(t,{allowProjection:e!==o});var Ef=class extends rl{constructor(e){super(e),e.animationState||=$l(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Bc(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}};let Df=0;const Of={animation:{Feature:Ef},exit:{Feature:class extends rl{constructor(){super(...arguments),this.id=Df++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=fs(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function kf(e){return{point:{x:e.pageX,y:e.pageY}}}const Af=e=>t=>ac(t)&&e(t,kf(t));function jf(e,t,n,r){return Iu(e,t,Af(n),r)}const Mf=({current:e})=>e?e.ownerDocument.defaultView:null,Nf=(e,t)=>Math.abs(e-t);function Pf(e,t){let n=Nf(e.x,t.x),r=Nf(e.y,t.y);return Math.sqrt(n**2+r**2)}const Ff=new Set([`auto`,`scroll`]);var If=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Lf(this.lastRawMoveEventInfo,this.transformPagePoint));let e=zf(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=Pf(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=R;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=Lf(t,this.transformPagePoint),L.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=zf(e.type===`pointercancel`?this.lastMoveEventInfo:Lf(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!ac(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=Lf(kf(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=R;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,zf(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=Ir(jf(this.contextWindow,`pointermove`,this.handlePointerMove,d),jf(this.contextWindow,`pointerup`,this.handlePointerUp,d),jf(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(Ff.has(e.overflowX)||Ff.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};(i.x!==0||i.y!==0)&&(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),L.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),li(this.updatePoint)}};function Lf(e,t){return t?{point:t(e.point)}:e}function Rf(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zf({point:e},t){return{point:e,delta:Rf(e,Vf(t)),offset:Rf(e,Bf(t)),velocity:Hf(t,.1)}}function Bf(e){return e[0]}function Vf(e){return e[e.length-1]}function Hf(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=Vf(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>F(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>F(t)*2&&(r=e[1]);let a=I(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Uf(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?G(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?G(n,e,r.max):Math.min(e,n)),e}function Wf(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function Gf(e,{top:t,left:n,bottom:r,right:i}){return{x:Wf(e.x,n,i),y:Wf(e.y,t,r)}}function Kf(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function qf(e,t){return{x:Kf(e.x,t.x),y:Kf(e.y,t.y)}}function Jf(e,t){let n=.5,r=Q(e),i=Q(t);return i>r?n=Lr(t.min,t.max-r,e.min):r>i&&(n=Lr(e.min,e.max-i,t.min)),N(0,1,n)}function Yf(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const Xf=.35;function Zf(e=Xf){return e===!1?e=0:e===!0&&(e=Xf),{x:Qf(e,`left`,`right`),y:Qf(e,`top`,`bottom`)}}function Qf(e,t,n){return{min:$f(e,t),max:$f(e,n)}}function $f(e,t){return typeof e==`number`?e:e[t]||0}const ep=new WeakMap;var tp=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Y(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(kf(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ec(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),$(e=>{let t=this.getAxisMotionValue(e).get()||0;if(V.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=Q(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&L.update(()=>i(e,t),!1,!0),ys(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=ap(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&L.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new If(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:Mf(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&L.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!ip(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=Uf(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&gf(e)?this.constraints||=this.resolveRefConstraints():this.constraints=e&&n?Gf(n.layoutBox,e):!1,this.elastic=Zf(t),r!==this.constraints&&!gf(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&$(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=Yf(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!gf(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=Cl(n,r.root,this.visualElement.getTransformPagePoint()),a=qf(r.layout.layoutBox,i);if(t){let e=t(al(a));this.hasMutatedConstraints=!!e,e&&(a=il(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=$(o=>{if(!ip(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return ys(this.visualElement,e),n.start(os(e,n,0,t,this.visualElement,!1))}stopAnimation(){$(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){$(t=>{let{drag:n}=this.getProps();if(!ip(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-G(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!gf(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};$(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=Jf({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),$(t=>{if(!ip(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(G(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;ep.set(this.visualElement,this);let e=this.visualElement.current,t=jf(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&lc(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();gf(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=rp(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),L.read(r);let o=Iu(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&($(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=Xf,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function np(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function rp(e,t,n){let r=jc(e,np(n)),i=jc(t,np(n));return()=>{r(),i()}}function ip(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function ap(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var op=class extends rl{constructor(e){super(e),this.removeGroupControls=P,this.removeListeners=P,this.controls=new tp(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||P}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}};const sp=e=>(t,n)=>{e&&L.update(()=>e(t,n),!1,!0)};var cp=class extends rl{constructor(){super(...arguments),this.removePointerDownListener=P}onPointerDown(e){this.session=new If(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Mf(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:sp(e),onStart:sp(t),onMove:sp(n),onEnd:(e,t)=>{delete this.session,r&&L.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=jf(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}};let lp=!1;var up=class extends a{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),lp&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Hu.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),lp=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||L.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Zs.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;lp=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function dp(e){let[n,r]=Md(),i=f(Tr);return t(up,{...e,layoutGroup:i,switchLayoutGroup:f(hf),isPresent:n,safeToRemove:r})}const fp={pan:{Feature:cp},drag:{Feature:op,ProjectionNode:Cd,MeasureLayout:dp}};function pp(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&L.postRender(()=>i(t,kf(t)))}var mp=class extends rl{mount(){let{current:e}=this.node;e&&(this.unmount=rc(e,(e,t)=>(pp(this.node,t,`Start`),e=>pp(this.node,e,`End`))))}unmount(){}},hp=class extends rl{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=Ir(Iu(this.node.current,`focus`,()=>this.onFocus()),Iu(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function gp(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&L.postRender(()=>i(t,kf(t)))}var _p=class extends rl{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=gc(e,(e,t)=>(gp(this.node,t,`Start`),(e,{success:t})=>gp(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}};const vp=new WeakMap,yp=new WeakMap,bp=e=>{let t=vp.get(e.target);t&&t(e)},xp=e=>{e.forEach(bp)};function Sp({root:e,...t}){let n=e||document;yp.has(n)||yp.set(n,{});let r=yp.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(xp,{root:e,...t})),r[i]}function Cp(e,t,n){let r=Sp(t);return vp.set(e,n),r.observe(e),()=>{vp.delete(e),r.unobserve(e)}}const wp={some:0,all:1};var Tp=class extends rl{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:wp[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Cp(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Ep(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Ep({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Dp={inView:{Feature:Tp},tap:{Feature:_p},focus:{Feature:hp},hover:{Feature:mp}},Op={layout:{ProjectionNode:Cd,MeasureLayout:dp}},kp=wf({...Of,...Dp,...fp,...Op},Tf);function Ap({icon:e}){let{isLoading:n}=O(),[r,i]=y(!0);return p(()=>{n||i(!1)},[n]),t(Fd,{children:r&&t(kp.div,{style:{zIndex:999999,position:`fixed`,inset:0},className:`fixed inset-x-0 inset-y-0`,initial:{opacity:1},exit:{opacity:0},transition:{ease:`easeIn`,duration:.5},children:t(`div`,{style:{display:`flex`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`},className:`flex w-full h-full items-center justify-center`,children:t(`div`,{className:`animate-[spin_4s_linear_infinite]`,children:t(`div`,{className:`animate-pulse rounded-full bg-transparent`,children:e||t(jp,{})})})})})})}function jp(){return n(`svg`,{width:`32`,height:`32`,className:`w-8 h-8 text-indigo-600`,viewBox:`0 0 50 50`,xmlns:`http://www.w3.org/2000/svg`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`defs`,{children:n(`linearGradient`,{id:`spinner-gradient`,x1:`1`,y1:`0`,x2:`0`,y2:`1`,children:[t(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`1`}),t(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0`})]})}),t(`circle`,{cx:`25`,cy:`25`,r:`20`,stroke:`url(#spinner-gradient)`,strokeWidth:`5`,fill:`none`,strokeLinecap:`round`})]})}function Mp({children:r,lightLogo:i,darkLogo:a,loadingIcon:o,loadOnboardingStatus:s,preserveSignInPath:c,suppressSignInErrorPrefixes:l,authToken:u,defaultLanguage:d}){let f=t(qe,{children:t(fe,{defaultTheme:`system`,storageKey:`vite-ui-theme`,children:t(Fe,{defaultLanguage:d,children:n(Pe,{children:[t(jt,{}),!u&&n(e,{children:[t(Ap,{icon:o}),t(sr,{allowedPrefix:`/shared/`,darkLogo:a,lightLogo:i,preservePath:c,suppressAuthErrorPrefix:l})]}),t(Je,{children:r})]})})})});return t(pe,{children:u?t(be,{token:u,children:f}):t(De,{loadOnboardingStatus:s,children:f})})}export{Qe as AppInstallationContext,$e as AppInstallationProvider,tt as AppProjectSelector,gt as IFRAME_APP_CONTENT_SLOT,dt as IFRAME_APP_CONTEXT,ut as IFRAME_APP_CONTEXT_REQUEST,ht as IFRAME_APP_HOST_ORIGIN_PARAM,pt as IFRAME_APP_LOCATION_CHANGE,ft as IFRAME_APP_NAVIGATE,mt as IFRAME_APP_SLOT_PARAM,ct as IFRAME_AUTH_REQUEST,lt as IFRAME_AUTH_RESPONSE,jt as IframeAppContextSync,en as InviteAcceptModal,sr as SigninScreen,Xt as StandaloneApp,Zt as StandaloneAppImpl,mr as TerminalLogin,Sr as UserSessionMenu,Mp as VertesiaShell,bt as isIframeAppContext,yt as isIframeAppContextRequest,St as isIframeAppLocationChange,xt as isIframeAppNavigate,_t as isIframeAuthRequest,vt as isIframeAuthResponse,wr as isVertesiaEmail,kt as requestIframeHostAuthToken,Ot as resolveIframeHostOrigin,et as useAppInstallation};
|
|
2
119
|
//# sourceMappingURL=vertesia-ui-shell.js.map
|