cycls 0.0.2.61__tar.gz → 0.0.2.62__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycls
3
- Version: 0.0.2.61
3
+ Version: 0.0.2.62
4
4
  Summary: Cycls SDK
5
5
  Author: Mohammed J. AlRujayi
6
6
  Author-email: mj@cycls.com
@@ -380,7 +380,7 @@ Possible fixes:
380
380
  Learn more: https://clerk.com/docs/components/clerk-provider`.trim())}}const ij="billing-subscription",aj={SUBSCRIPTION_KEY:ij};function sj(e){return{queryKey:[e.stablePrefix,e.authenticated,e.tracked,e.untracked],invalidationKey:[e.stablePrefix,e.authenticated,e.tracked],stableKey:e.stablePrefix,authenticated:e.authenticated}}const lj=()=>(Jf("useClerk"),Zf());typeof window<"u"?fe.useLayoutEffect:fe.useEffect;const b6="useUser";function zx(){var t;Jf(b6);const e=Fx();return(t=Zf().telemetry)==null||t.record(Z2(b6)),e===void 0?{isLoaded:!1,isSignedIn:void 0,user:void 0}:e===null?{isLoaded:!0,isSignedIn:!1,user:null}:{isLoaded:!0,isSignedIn:!0,user:e}}const v6=s0;function oj(e){const{userId:t,orgId:n,for:r}=e;return H.useMemo(()=>{const i=r==="organization"?n:void 0;return sj({stablePrefix:aj.SUBSCRIPTION_KEY,authenticated:!0,tracked:{userId:t,orgId:i},untracked:{args:{orgId:i}}})},[t,n,r])}const y6="useSubscription";function uj(e){var m;Jf(y6);const t=Zf(),n=Fx(),{organization:r}=nj(),i=t.__unstable__environment;(m=t.telemetry)==null||m.record(Z2(y6));const s=(e==null?void 0:e.for)==="organization"?i==null?void 0:i.commerceSettings.billing.organization.enabled:i==null?void 0:i.commerceSettings.billing.user.enabled,o=((e==null?void 0:e.enabled)??!0)&&s,{queryKey:c}=oj({userId:n==null?void 0:n.id,orgId:r==null?void 0:r.id,for:e==null?void 0:e.for}),d=Vq(o?{queryKey:c}:null,({queryKey:p})=>{const v=p[3].args;return p[2].userId?t.billing.getSubscription(v):null},{dedupingInterval:1e3*60,keepPreviousData:e==null?void 0:e.keepPreviousData}),f=H.useCallback(()=>{d.mutate()},[d]);return{data:d.data,error:d.error,isLoading:d.isLoading,isFetching:d.isValidating,revalidate:f}}const cj=e=>{const t=H.useRef(e);return H.useEffect(()=>{t.current=e},[e]),t.current},mi=(e,t,n)=>{const r=!!n,i=H.useRef(n);H.useEffect(()=>{i.current=n},[n]),H.useEffect(()=>{if(!r||!e)return()=>{};const s=(...o)=>{i.current&&i.current(...o)};return e.on(t,s),()=>{e.off(t,s)}},[r,t,e,i])},Hx=fe.createContext(null);Hx.displayName="ElementsContext";const dj=(e,t)=>{if(!e)throw new Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an <Elements> provider.`);return e},hf=e=>e!==null&&typeof e=="object",hj=(e,t,n)=>hf(e)?Object.keys(e).reduce((r,i)=>{const s=!hf(t)||!qx(e[i],t[i]);return n.includes(i)?(s&&console.warn(`Unsupported prop change: options.${i} is not a mutable property.`),r):s?{...r||{},[i]:e[i]}:r},null):null,_6="[object Object]",qx=(e,t)=>{if(!hf(e)||!hf(t))return e===t;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;const r=Object.prototype.toString.call(e)===_6;if(r!==(Object.prototype.toString.call(t)===_6))return!1;if(!r&&!n)return e===t;const i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;const o={};for(let p=0;p<i.length;p+=1)o[i[p]]=!0;for(let p=0;p<s.length;p+=1)o[s[p]]=!0;const c=Object.keys(o);if(c.length!==i.length)return!1;const d=e,f=t,m=p=>qx(d[p],f[p]);return c.every(m)},E6=e=>dj(fe.useContext(Hx),e),fj=e=>e.charAt(0).toUpperCase()+e.slice(1),mj=(e,t)=>{const n=`${fj(e)}Element`,s=t?o=>{E6(`mounts <${n}>`);const{id:c,className:d}=o;return fe.createElement("div",{id:c,className:d})}:({id:o,className:c,fallback:d,options:f={},onBlur:m,onFocus:p,onReady:v,onChange:_,onEscape:S,onClick:x,onLoadError:C,onLoaderStart:w,onNetworksChange:O,onConfirm:D,onCancel:j,onShippingAddressChange:F,onShippingRateChange:B})=>{const ee=E6(`mounts <${n}>`),J="elements"in ee?ee.elements:null,[W,G]=fe.useState(null),se=fe.useRef(null),de=fe.useRef(null),[ye,Z]=H.useState(!1);mi(W,"blur",m),mi(W,"focus",p),mi(W,"escape",S),mi(W,"click",x),mi(W,"loaderror",C),mi(W,"loaderstart",w),mi(W,"networkschange",O),mi(W,"confirm",D),mi(W,"cancel",j),mi(W,"shippingaddresschange",F),mi(W,"shippingratechange",B),mi(W,"change",_);let ne;v&&(ne=()=>{Z(!0),v(W)}),mi(W,"ready",ne),fe.useLayoutEffect(()=>{if(se.current===null&&de.current!==null&&J){let ce=null;J&&(ce=J.create(e,f)),se.current=ce,G(ce),ce&&ce.mount(de.current)}},[J,f]);const X=cj(f);return fe.useEffect(()=>{if(!se.current)return;const ce=hj(f,X,["paymentRequest"]);ce&&"update"in se.current&&se.current.update(ce)},[f,X]),fe.useLayoutEffect(()=>()=>{if(se.current&&typeof se.current.destroy=="function")try{se.current.destroy(),se.current=null}catch{}},[]),fe.createElement(fe.Fragment,null,!ye&&d,fe.createElement("div",{id:o,style:{height:ye?"unset":"0px",visibility:ye?"visible":"hidden"},className:c,ref:de}))};return s.displayName=n,s.__elementType=e,s};mj("payment",typeof window>"u");cs("PaymentElementContext");cs("StripeUtilsContext");var Qi=Sx({packageName:"@clerk/clerk-react"});function pj(e){Qi.setMessages(e).setPackageName(e)}var[gj,bj]=cs("AuthContext"),vj=Ux,jx=Zf,yj="You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.",_j=e=>`You've passed multiple children components to <${e}/>. You can only pass a single child component or text.`,Ej="Invalid state. Feel free to submit a bug or reach out to support here: https://clerk.com/support",og="Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.",Tj="<UserProfile.Page /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",xj="<UserProfile.Link /> component needs to be a direct child of `<UserProfile />` or `<UserButton />`.",Sj="<OrganizationProfile.Page /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",wj="<OrganizationProfile.Link /> component needs to be a direct child of `<OrganizationProfile />` or `<OrganizationSwitcher />`.",Aj=e=>`<${e} /> can only accept <${e}.Page /> and <${e}.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.`,kj=e=>`Missing props. <${e}.Page /> component requires the following props: url, label, labelIcon, alongside with children to be rendered inside the page.`,Cj=e=>`Missing props. <${e}.Link /> component requires the following props: url, label and labelIcon.`,Nj="<UserButton /> can only accept <UserButton.UserProfilePage />, <UserButton.UserProfileLink /> and <UserButton.MenuItems /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",Oj="<UserButton.MenuItems /> component can only accept <UserButton.Action /> and <UserButton.Link /> as its children. Any other provided component will be ignored. Additionally, please ensure that the component is rendered in a client component.",Rj="<UserButton.MenuItems /> component needs to be a direct child of `<UserButton />`.",Mj="<UserButton.Action /> component needs to be a direct child of `<UserButton.MenuItems />`.",Ij="<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.",Dj="Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.",Lj="Missing props. <UserButton.Action /> component requires the following props: label.",em=e=>{Jf(()=>{Qi.throwMissingClerkProviderError({source:e})})},$x=e=>new Promise(t=>{const n=r=>{["ready","degraded"].includes(r)&&(t(),e.off("status",n))};e.on("status",n,{notify:!0})}),Pj=e=>async t=>(await $x(e),e.session?e.session.getToken(t):null),Bj=e=>async(...t)=>(await $x(e),e.signOut(...t)),B0=(e={})=>{var t;em("useAuth");const{treatPendingAsSignedOut:n,...r}=e??{},i=r;let o=bj();o.sessionId===void 0&&o.userId===void 0&&(o=i??{});const c=jx(),d=H.useCallback(Pj(c),[c]),f=H.useCallback(Bj(c),[c]);return(t=c.telemetry)==null||t.record(Z2("useAuth",{treatPendingAsSignedOut:n})),Uj({...o,getToken:d,signOut:f},{treatPendingAsSignedOut:n})};function Uj(e,{treatPendingAsSignedOut:t=!0}={}){const{userId:n,orgId:r,orgRole:i,has:s,signOut:o,getToken:c,orgPermissions:d,factorVerificationAge:f,sessionClaims:m}=e??{},p=H.useCallback(_=>s?s(_):cq({userId:n,orgId:r,orgRole:i,orgPermissions:d,factorVerificationAge:f,features:(m==null?void 0:m.fea)||"",plans:(m==null?void 0:m.pla)||""})(_),[s,n,r,i,d,f,m]),v=dq({authObject:{...e,getToken:c,signOut:o,has:p},options:{treatPendingAsSignedOut:t}});return v||Qi.throw(Ej)}var rn=(e,t)=>{const r=(typeof t=="string"?t:t==null?void 0:t.component)||e.displayName||e.name||"Component";e.displayName=r;const i=typeof t=="string"?void 0:t,s=o=>{em(r||"withClerk");const c=jx();return!c.loaded&&!(i!=null&&i.renderWhileLoading)?null:fe.createElement(e,{...o,component:r,clerk:c})};return s.displayName=`withClerk(${r})`,s};const Fj=()=>{try{return!1}catch{}return!1},zj=()=>{try{return!1}catch{}return!1},Hj=()=>{try{return!0}catch{}return!1},T6=new Set,nv=(e,t,n)=>{const r=zj()||Hj(),i=e;T6.has(i)||r||(T6.add(i),console.warn(`Clerk - DEPRECATION WARNING: "${e}" is deprecated and will be removed in the next major release.
381
381
  ${t}`))};var qj=({children:e,treatPendingAsSignedOut:t})=>{em("SignedIn");const{userId:n}=B0({treatPendingAsSignedOut:t});return n?e:null},jj=({children:e,treatPendingAsSignedOut:t})=>{em("SignedOut");const{userId:n}=B0({treatPendingAsSignedOut:t});return n===null?e:null};rn(({clerk:e,...t})=>{const{client:n,session:r}=e,i=n.signedInSessions?n.signedInSessions.length>0:n.activeSessions&&n.activeSessions.length>0;return fe.useEffect(()=>{r===null&&i?e.redirectToAfterSignOut():e.redirectToSignIn(t)},[]),null},"RedirectToSignIn");rn(({clerk:e,...t})=>(fe.useEffect(()=>{e.redirectToSignUp(t)},[]),null),"RedirectToSignUp");rn(({clerk:e,...t})=>(fe.useEffect(()=>{e.redirectToTasks(t)},[]),null),"RedirectToTasks");rn(({clerk:e})=>(fe.useEffect(()=>{nv("RedirectToUserProfile","Use the `redirectToUserProfile()` method instead."),e.redirectToUserProfile()},[]),null),"RedirectToUserProfile");rn(({clerk:e})=>(fe.useEffect(()=>{nv("RedirectToOrganizationProfile","Use the `redirectToOrganizationProfile()` method instead."),e.redirectToOrganizationProfile()},[]),null),"RedirectToOrganizationProfile");rn(({clerk:e})=>(fe.useEffect(()=>{nv("RedirectToCreateOrganization","Use the `redirectToCreateOrganization()` method instead."),e.redirectToCreateOrganization()},[]),null),"RedirectToCreateOrganization");rn(({clerk:e,...t})=>(fe.useEffect(()=>{e.handleRedirectCallback(t)},[]),null),"AuthenticateWithRedirectCallback");function ug(e,t,n){if(typeof e=="function")return e(t);if(typeof e<"u")return e;if(typeof n<"u")return n}const Hr=e=>{Fj()&&console.error(`Clerk: ${e}`)};var $j=q5();const x6=(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n};var Jl=e=>t=>{try{return fe.Children.only(e)}catch{return Qi.throw(_j(t))}},eo=(e,t)=>(e||(e=t),typeof e=="string"&&(e=fe.createElement("button",null,e)),e),to=e=>(...t)=>{if(e&&typeof e=="function")return e(...t)};function Yj(e){return typeof e=="function"}var xh=new Map;function Gj(e,t,n=1){fe.useEffect(()=>{const r=xh.get(e)||0;return r==n?Qi.throw(t):(xh.set(e,r+1),()=>{xh.set(e,(xh.get(e)||1)-1)})},[])}function Vj(e,t,n){const r=e.displayName||e.name||t||"Component",i=s=>(Gj(t,n),fe.createElement(e,{...s}));return i.displayName=`withMaxAllowedInstancesGuard(${r})`,i}var l0=e=>{const[t,n]=H.useState(new Map);return e.map(r=>({id:r.id,mount:i=>n(s=>new Map(s).set(String(r.id),i)),unmount:()=>n(i=>{const s=new Map(i);return s.set(String(r.id),null),s}),portal:()=>{const i=t.get(String(r.id));return i?$j.createPortal(r.component,i):null}}))},Fr=(e,t)=>!!e&&fe.isValidElement(e)&&(e==null?void 0:e.type)===t,Yx=(e,t)=>Kx({children:e,reorderItemsLabels:["account","security","billing","apiKeys"],LinkComponent:F0,PageComponent:U0,MenuItemsComponent:nm,componentName:"UserProfile"},t),Gx=(e,t)=>Kx({children:e,reorderItemsLabels:["general","members","billing","apiKeys"],LinkComponent:im,PageComponent:rm,componentName:"OrganizationProfile"},t),Vx=e=>{const t=[],n=[im,rm,nm,U0,F0];return fe.Children.forEach(e,r=>{n.some(i=>Fr(r,i))||t.push(r)}),t},Kx=(e,t)=>{const{children:n,LinkComponent:r,PageComponent:i,MenuItemsComponent:s,reorderItemsLabels:o,componentName:c}=e,{allowForAnyChildren:d=!1}=t||{},f=[];fe.Children.forEach(n,O=>{if(!Fr(O,i)&&!Fr(O,r)&&!Fr(O,s)){O&&!d&&Hr(Aj(c));return}const{props:D}=O,{children:j,label:F,url:B,labelIcon:ee}=D;if(Fr(O,i))if(S6(D,o))f.push({label:F});else if(cg(D))f.push({label:F,labelIcon:ee,children:j,url:B});else{Hr(kj(c));return}if(Fr(O,r))if(dg(D))f.push({label:F,labelIcon:ee,url:B});else{Hr(Cj(c));return}});const m=[],p=[],v=[];f.forEach((O,D)=>{if(cg(O)){m.push({component:O.children,id:D}),p.push({component:O.labelIcon,id:D});return}dg(O)&&v.push({component:O.labelIcon,id:D})});const _=l0(m),S=l0(p),x=l0(v),C=[],w=[];return f.forEach((O,D)=>{if(S6(O,o)){C.push({label:O.label});return}if(cg(O)){const{portal:j,mount:F,unmount:B}=_.find(G=>G.id===D),{portal:ee,mount:J,unmount:W}=S.find(G=>G.id===D);C.push({label:O.label,url:O.url,mount:F,unmount:B,mountIcon:J,unmountIcon:W}),w.push(j),w.push(ee);return}if(dg(O)){const{portal:j,mount:F,unmount:B}=x.find(ee=>ee.id===D);C.push({label:O.label,url:O.url,mountIcon:F,unmountIcon:B}),w.push(j);return}}),{customPages:C,customPagesPortals:w}},S6=(e,t)=>{const{children:n,label:r,url:i,labelIcon:s}=e;return!n&&!i&&!s&&t.some(o=>o===r)},cg=e=>{const{children:t,label:n,url:r,labelIcon:i}=e;return!!t&&!!r&&!!i&&!!n},dg=e=>{const{children:t,label:n,url:r,labelIcon:i}=e;return!t&&!!r&&!!i&&!!n},Kj=(e,t)=>{var n;return Wj({children:e,reorderItemsLabels:["manageAccount","signOut"],MenuItemsComponent:nm,MenuActionComponent:Xx,MenuLinkComponent:Qx,UserProfileLinkComponent:F0,UserProfilePageComponent:U0,allowForAnyChildren:(n=t==null?void 0:t.allowForAnyChildren)!=null?n:!1})},Wj=({children:e,MenuItemsComponent:t,MenuActionComponent:n,MenuLinkComponent:r,UserProfileLinkComponent:i,UserProfilePageComponent:s,reorderItemsLabels:o,allowForAnyChildren:c=!1})=>{const d=[],f=[],m=[];fe.Children.forEach(e,x=>{if(!Fr(x,t)&&!Fr(x,i)&&!Fr(x,s)){x&&!c&&Hr(Nj);return}if(Fr(x,i)||Fr(x,s))return;const{props:C}=x;fe.Children.forEach(C.children,w=>{if(!Fr(w,n)&&!Fr(w,r)){w&&Hr(Oj);return}const{props:O}=w,{label:D,labelIcon:j,href:F,onClick:B,open:ee}=O;if(Fr(w,n))if(w6(O,o))d.push({label:D});else if(hg(O)){const J={label:D,labelIcon:j};if(B!==void 0)d.push({...J,onClick:B});else if(ee!==void 0)d.push({...J,open:ee.startsWith("/")?ee:`/${ee}`});else{Hr("Custom menu item must have either onClick or open property");return}}else{Hr(Lj);return}if(Fr(w,r))if(fg(O))d.push({label:D,labelIcon:j,href:F});else{Hr(Dj);return}})});const p=[],v=[];d.forEach((x,C)=>{hg(x)&&p.push({component:x.labelIcon,id:C}),fg(x)&&v.push({component:x.labelIcon,id:C})});const _=l0(p),S=l0(v);return d.forEach((x,C)=>{if(w6(x,o)&&f.push({label:x.label}),hg(x)){const{portal:w,mount:O,unmount:D}=_.find(F=>F.id===C),j={label:x.label,mountIcon:O,unmountIcon:D};"onClick"in x?j.onClick=x.onClick:"open"in x&&(j.open=x.open),f.push(j),m.push(w)}if(fg(x)){const{portal:w,mount:O,unmount:D}=S.find(j=>j.id===C);f.push({label:x.label,href:x.href,mountIcon:O,unmountIcon:D}),m.push(w)}}),{customMenuItems:f,customMenuItemsPortals:m}},w6=(e,t)=>{const{children:n,label:r,onClick:i,labelIcon:s}=e;return!n&&!i&&!s&&t.some(o=>o===r)},hg=e=>{const{label:t,labelIcon:n,onClick:r,open:i}=e;return!!n&&!!t&&(typeof r=="function"||typeof i=="string")},fg=e=>{const{label:t,href:n,labelIcon:r}=e;return!!n&&!!r&&!!t},Xj=e=>{const t=e==null?void 0:e.isReady;return n=>new Promise((r,i)=>{const{root:s=document==null?void 0:document.body,selector:o,timeout:c=0}=n;if(!s){i(new Error("No root element provided"));return}let d=s;if(o&&(d=s==null?void 0:s.querySelector(o)),t(d,o)){r();return}const f=new MutationObserver(m=>{for(const p of m)if(!d&&o&&(d=s==null?void 0:s.querySelector(o)),(e.childList&&p.type==="childList"||e.attributes&&p.type==="attributes")&&t(d,o)){f.disconnect(),r();return}});f.observe(s,e),c>0&&setTimeout(()=>{f.disconnect(),i(new Error(`Timeout waiting for ${o}`))},c)})},Qj=Xj({childList:!0,subtree:!0,isReady:(e,t)=>{var n;return!!(e!=null&&e.childElementCount)&&((n=e==null?void 0:e.matches)==null?void 0:n.call(e,t))&&e.childElementCount>0}});function $r(e,t){const n=H.useRef(),[r,i]=H.useState("rendering");return H.useEffect(()=>{if(!e)throw new Error("Clerk: no component name provided, unable to detect mount.");if(typeof window<"u"&&!n.current){const s=`[data-clerk-component="${e}"]`,o=t==null?void 0:t.selector;n.current=Qj({selector:o?s+o:s}).then(()=>{i("rendered")}).catch(()=>{i("error")})}},[e,t==null?void 0:t.selector]),r}var Sh=e=>"mount"in e,A6=e=>"open"in e,k6=e=>e==null?void 0:e.map(({mountIcon:t,unmountIcon:n,...r})=>r),xr=class extends fe.PureComponent{constructor(){super(...arguments),this.rootRef=fe.createRef()}componentDidUpdate(e){var t,n,r,i;if(!Sh(e)||!Sh(this.props))return;const s=x6(e.props,"customPages","customMenuItems","children"),o=x6(this.props.props,"customPages","customMenuItems","children"),c=((t=s.customPages)==null?void 0:t.length)!==((n=o.customPages)==null?void 0:n.length),d=((r=s.customMenuItems)==null?void 0:r.length)!==((i=o.customMenuItems)==null?void 0:i.length),f=k6(e.props.customMenuItems),m=k6(this.props.props.customMenuItems);(!v6(s,o)||!v6(f,m)||c||d)&&this.rootRef.current&&this.props.updateProps({node:this.rootRef.current,props:this.props.props})}componentDidMount(){this.rootRef.current&&(Sh(this.props)&&this.props.mount(this.rootRef.current,this.props.props),A6(this.props)&&this.props.open(this.props.props))}componentWillUnmount(){this.rootRef.current&&(Sh(this.props)&&this.props.unmount(this.rootRef.current),A6(this.props)&&this.props.close())}render(){const{hideRootHtmlElement:e=!1}=this.props,t={ref:this.rootRef,...this.props.rootProps,...this.props.component&&{"data-clerk-component":this.props.component}};return fe.createElement(fe.Fragment,null,!e&&fe.createElement("div",{...t}),this.props.children)}},tm=e=>{var t,n;return fe.createElement(fe.Fragment,null,(t=e==null?void 0:e.customPagesPortals)==null?void 0:t.map((r,i)=>H.createElement(r,{key:i})),(n=e==null?void 0:e.customMenuItemsPortals)==null?void 0:n.map((r,i)=>H.createElement(r,{key:i})))},Zj=rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountSignIn,unmount:e.unmountSignIn,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"SignIn",renderWhileLoading:!0}),Jj=rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountSignUp,unmount:e.unmountSignUp,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"SignUp",renderWhileLoading:!0});function U0({children:e}){return Hr(Tj),fe.createElement(fe.Fragment,null,e)}function F0({children:e}){return Hr(xj),fe.createElement(fe.Fragment,null,e)}var e$=rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:d}=Yx(r.children);return fe.createElement(fe.Fragment,null,s&&n,fe.createElement(xr,{component:t,mount:e.mountUserProfile,unmount:e.unmountUserProfile,updateProps:e.__unstable__updateProps,props:{...r,customPages:c},rootProps:o},fe.createElement(tm,{customPagesPortals:d})))},{component:"UserProfile",renderWhileLoading:!0});Object.assign(e$,{Page:U0,Link:F0});var Wx=H.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),t$=rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:d}=Yx(r.children,{allowForAnyChildren:!!r.__experimental_asProvider}),f={...r.userProfileProps,customPages:c},{customMenuItems:m,customMenuItemsPortals:p}=Kj(r.children,{allowForAnyChildren:!!r.__experimental_asProvider}),v=Vx(r.children),_={mount:e.mountUserButton,unmount:e.unmountUserButton,updateProps:e.__unstable__updateProps,props:{...r,userProfileProps:f,customMenuItems:m}},S={customPagesPortals:d,customMenuItemsPortals:p};return fe.createElement(Wx.Provider,{value:_},s&&n,e.loaded&&fe.createElement(xr,{component:t,..._,hideRootHtmlElement:!!r.__experimental_asProvider,rootProps:o},r.__experimental_asProvider?v:null,fe.createElement(tm,{...S})))},{component:"UserButton",renderWhileLoading:!0});function nm({children:e}){return Hr(Rj),fe.createElement(fe.Fragment,null,e)}function Xx({children:e}){return Hr(Mj),fe.createElement(fe.Fragment,null,e)}function Qx({children:e}){return Hr(Ij),fe.createElement(fe.Fragment,null,e)}function n$(e){const t=H.useContext(Wx),n={...t,props:{...t.props,...e}};return fe.createElement(xr,{...n})}var r$=Object.assign(t$,{UserProfilePage:U0,UserProfileLink:F0,MenuItems:nm,Action:Xx,Link:Qx,__experimental_Outlet:n$});function rm({children:e}){return Hr(Sj),fe.createElement(fe.Fragment,null,e)}function im({children:e}){return Hr(wj),fe.createElement(fe.Fragment,null,e)}var i$=rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:d}=Gx(r.children);return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountOrganizationProfile,unmount:e.unmountOrganizationProfile,updateProps:e.__unstable__updateProps,props:{...r,customPages:c},rootProps:o},fe.createElement(tm,{customPagesPortals:d})))},{component:"OrganizationProfile",renderWhileLoading:!0});Object.assign(i$,{Page:rm,Link:im});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountCreateOrganization,unmount:e.unmountCreateOrganization,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"CreateOrganization",renderWhileLoading:!0});var Zx=H.createContext({mount:()=>{},unmount:()=>{},updateProps:()=>{}}),a$=rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}},{customPages:c,customPagesPortals:d}=Gx(r.children,{allowForAnyChildren:!!r.__experimental_asProvider}),f={...r.organizationProfileProps,customPages:c},m=Vx(r.children),p={mount:e.mountOrganizationSwitcher,unmount:e.unmountOrganizationSwitcher,updateProps:e.__unstable__updateProps,props:{...r,organizationProfileProps:f},rootProps:o,component:t};return e.__experimental_prefetchOrganizationSwitcher(),fe.createElement(Zx.Provider,{value:p},fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{...p,hideRootHtmlElement:!!r.__experimental_asProvider},r.__experimental_asProvider?m:null,fe.createElement(tm,{customPagesPortals:d}))))},{component:"OrganizationSwitcher",renderWhileLoading:!0});function s$(e){const t=H.useContext(Zx),n={...t,props:{...t.props,...e}};return fe.createElement(xr,{...n})}Object.assign(a$,{OrganizationProfilePage:rm,OrganizationProfileLink:im,__experimental_Outlet:s$});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountOrganizationList,unmount:e.unmountOrganizationList,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"OrganizationList",renderWhileLoading:!0});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,open:e.openGoogleOneTap,close:e.closeGoogleOneTap,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"GoogleOneTap",renderWhileLoading:!0});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountWaitlist,unmount:e.unmountWaitlist,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"Waitlist",renderWhileLoading:!0});var l$=rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t,{selector:'[data-component-status="ready"]'})==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountPricingTable,unmount:e.unmountPricingTable,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"PricingTable",renderWhileLoading:!0});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountAPIKeys,unmount:e.unmountAPIKeys,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"ApiKeys",renderWhileLoading:!0});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountUserAvatar,unmount:e.unmountUserAvatar,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"UserAvatar",renderWhileLoading:!0});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountTaskChooseOrganization,unmount:e.unmountTaskChooseOrganization,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"TaskChooseOrganization",renderWhileLoading:!0});rn(({clerk:e,component:t,fallback:n,...r})=>{const s=$r(t)==="rendering"||!e.loaded,o={...s&&n&&{style:{display:"none"}}};return fe.createElement(fe.Fragment,null,s&&n,e.loaded&&fe.createElement(xr,{component:t,mount:e.mountTaskResetPassword,unmount:e.unmountTaskResetPassword,updateProps:e.__unstable__updateProps,props:r,rootProps:o}))},{component:"TaskResetPassword",renderWhileLoading:!0});var Jx=e=>{throw TypeError(e)},rv=(e,t,n)=>t.has(e)||Jx("Cannot "+n),xn=(e,t,n)=>(rv(e,t,"read from private field"),n?n.call(e):t.get(e)),Vs=(e,t,n)=>t.has(e)?Jx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Bl=(e,t,n,r)=>(rv(e,t,"write to private field"),t.set(e,n),n),mg=(e,t,n)=>(rv(e,t,"access private method"),n);const o$={initialDelay:125,maxDelayBetweenRetries:0,factor:2,shouldRetry:(e,t)=>t<5,retryImmediately:!1,jitter:!0},u$=100,eS=async e=>new Promise(t=>setTimeout(t,e)),tS=(e,t)=>t?e*(1+Math.random()):e,c$=e=>{let t=0;const n=()=>{const r=e.initialDelay,i=e.factor;let s=r*Math.pow(i,t);return s=tS(s,e.jitter),Math.min(e.maxDelayBetweenRetries||s,s)};return async()=>{await eS(n()),t++}},d$=async(e,t={})=>{let n=0;const{shouldRetry:r,initialDelay:i,maxDelayBetweenRetries:s,factor:o,retryImmediately:c,jitter:d,onBeforeRetry:f}={...o$,...t},m=c$({initialDelay:i,maxDelayBetweenRetries:s,factor:o,jitter:d});for(;;)try{return await e()}catch(p){if(n++,!r(p,n))throw p;f&&await f(n),c&&n===1?await eS(tS(u$,d)):await m()}},h$="loadScript cannot be called when document does not exist",f$="loadScript cannot be called without a src";async function m$(e="",t){const{async:n,defer:r,beforeLoad:i,crossOrigin:s,nonce:o}=t||{};return d$(()=>new Promise((d,f)=>{e||f(new Error(f$)),(!document||!document.body)&&f(new Error(h$));const m=document.createElement("script");s&&m.setAttribute("crossorigin",s),m.async=n||!1,m.defer=r||!1,m.addEventListener("load",()=>{m.remove(),d(m)}),m.addEventListener("error",p=>{m.remove(),f(p.error??new Error(`failed to load script: ${e}`))}),m.src=e,m.nonce=o,i==null||i(m),document.body.appendChild(m)}),{shouldRetry:(d,f)=>f<=5})}function p$(e){return e?g$(e)||nS(e):!0}function g$(e){return/^http(s)?:\/\//.test(e||"")}function nS(e){return e.startsWith("/")}function b$(e){return e?nS(e)?new URL(e,window.location.origin).toString():e:""}function v$(e){if(!e)return"";let t;if(e.match(/^(clerk\.)+\w*$/))t=/(clerk\.)*(?=clerk\.)/;else{if(e.match(/\.clerk.accounts/))return e;t=/^(clerk\.)*/gi}return`clerk.${e.replace(t,"")}`}const y$=(e,t="5.114.0")=>{if(e)return e;const n=_$(t);return n?n==="snapshot"?"5.114.0":n:E$(t)},_$=e=>{var t;return(t=e.trim().replace(/^v/,"").match(/-(.+?)(\.|$)/))==null?void 0:t[1]},E$=e=>e.trim().replace(/^v/,"").split(".")[0],rS="failed_to_load_clerk_js",T$="failed_to_load_clerk_js_timeout",_b="Failed to load Clerk",{isDevOrStagingUrl:x$}=mq(),iS=Sx({packageName:"@clerk/shared"});function S$(e){iS.setPackageName({packageName:e})}function Eb(){if(typeof window>"u"||!window.Clerk)return!1;const e=window.Clerk;return typeof e=="object"&&typeof e.load=="function"}function w$(e){if(typeof window>"u"||!window.performance)return!1;const t=performance.getEntriesByName(e,"resource");if(t.length===0)return!1;const n=t[t.length-1];return n.transferSize===0&&n.decodedBodySize===0&&(n.responseEnd===0||n.responseEnd>0&&n.responseStart>0||"responseStatus"in n&&(n.responseStatus>=400||n.responseStatus===0))}function C6(e,t){return new Promise((n,r)=>{let i=!1;const s=(m,p)=>{clearTimeout(m),clearInterval(p)};t==null||t.addEventListener("error",()=>{s(d,f),r(new cb(_b,{code:rS}))});const o=()=>{i||Eb()&&(i=!0,s(d,f),n(null))},d=setTimeout(()=>{i||(i=!0,s(d,f),Eb()?n(null):r(new cb(_b,{code:T$})))},e);o();const f=setInterval(()=>{if(i){clearInterval(f);return}o()},100)})}const A$=async e=>{const t=(e==null?void 0:e.scriptLoadTimeout)??15e3;if(Eb())return null;if(!(e!=null&&e.publishableKey))return iS.throwMissingPublishableKeyError(),null;const n=k$(e),r=document.querySelector("script[data-clerk-js-script]");if(r)if(w$(n))r.remove();else try{return await C6(t,r),null}catch{r.remove()}const i=C6(t);return m$(n,{async:!0,crossOrigin:"anonymous",nonce:e.nonce,beforeLoad:N$(e)}).catch(s=>{throw new cb(_b+(s.message?`, ${s.message}`:""),{code:rS,cause:s})}),i},k$=e=>{var m,p;const{clerkJSUrl:t,clerkJSVariant:n,clerkJSVersion:r,proxyUrl:i,domain:s,publishableKey:o}=e;if(t)return t;let c="";i&&p$(i)?c=b$(i).replace(/http(s)?:\/\//,""):s&&!x$(((m=l6(o))==null?void 0:m.frontendApi)||"")?c=v$(s):c=((p=l6(o))==null?void 0:p.frontendApi)||"";const d=n?`${n.replace(/\.+$/,"")}.`:"",f=y$(r);return`https://${c}/npm/@clerk/clerk-js@${f}/dist/clerk.${d}browser.js`},C$=e=>{const t={};return e.publishableKey&&(t["data-clerk-publishable-key"]=e.publishableKey),e.proxyUrl&&(t["data-clerk-proxy-url"]=e.proxyUrl),e.domain&&(t["data-clerk-domain"]=e.domain),e.nonce&&(t.nonce=e.nonce),t},N$=e=>t=>{const n=C$(e);for(const r in n)t.setAttribute(r,n[r])},O$=(e,t,n)=>!e&&n?R$(n):M$(t),R$=e=>{const t=e.userId,n=e.user,r=e.sessionId,i=e.sessionStatus,s=e.sessionClaims;return{userId:t,user:n,sessionId:r,session:e.session,sessionStatus:i,sessionClaims:s,organization:e.organization,orgId:e.orgId,orgRole:e.orgRole,orgPermissions:e.orgPermissions,orgSlug:e.orgSlug,actor:e.actor,factorVerificationAge:e.factorVerificationAge}},M$=e=>{var S,x,C,w;const t=e.user?e.user.id:e.user,n=e.user,r=e.session?e.session.id:e.session,i=e.session,s=(S=e.session)==null?void 0:S.status,o=e.session?(C=(x=e.session.lastActiveToken)==null?void 0:x.jwt)==null?void 0:C.claims:null,c=e.session?e.session.factorVerificationAge:null,d=i==null?void 0:i.actor,f=e.organization,m=e.organization?e.organization.id:e.organization,p=f==null?void 0:f.slug,v=f&&((w=n==null?void 0:n.organizationMemberships)==null?void 0:w.find(O=>O.organization.id===m)),_=v&&v.permissions;return{userId:t,user:n,sessionId:r,session:i,sessionStatus:s,sessionClaims:o,organization:f,orgId:m,orgRole:v&&v.role,orgSlug:p,orgPermissions:_,actor:d,factorVerificationAge:c}};function ff(){return typeof window<"u"}const N6=(e,t,n,r,i)=>{const{notify:s}=i||{};let o=e.get(n);o||(o=[],e.set(n,o)),o.push(r),s&&t.has(n)&&r(t.get(n))},O6=(e,t,n)=>(e.get(t)||[]).map(r=>r(n)),R6=(e,t,n)=>{const r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},I$=()=>{const e=new Map,t=new Map,n=new Map;return{on:(...i)=>N6(e,t,...i),prioritizedOn:(...i)=>N6(n,t,...i),emit:(i,s)=>{t.set(i,s),O6(n,i,s),O6(e,i,s)},off:(...i)=>R6(e,...i),prioritizedOff:(...i)=>R6(n,...i),internal:{retrieveListeners:i=>e.get(i)||[]}}},wh={Status:"status"},D$=()=>I$();typeof window<"u"&&!window.global&&(window.global=typeof global>"u"?window:global);rn(({clerk:e,children:t,...n})=>{const{signUpFallbackRedirectUrl:r,forceRedirectUrl:i,fallbackRedirectUrl:s,signUpForceRedirectUrl:o,mode:c,initialValues:d,withSignUp:f,oauthFlow:m,...p}=n;t=eo(t,"Sign in");const v=Jl(t)("SignInButton"),_=()=>{const C={forceRedirectUrl:i,fallbackRedirectUrl:s,signUpFallbackRedirectUrl:r,signUpForceRedirectUrl:o,initialValues:d,withSignUp:f,oauthFlow:m};return c==="modal"?e.openSignIn({...C,appearance:n.appearance}):e.redirectToSignIn({...C,signInFallbackRedirectUrl:s,signInForceRedirectUrl:i})},x={...p,onClick:async C=>(v&&typeof v=="object"&&"props"in v&&await to(v.props.onClick)(C),_())};return fe.cloneElement(v,x)},{component:"SignInButton",renderWhileLoading:!0});rn(({clerk:e,children:t,...n})=>{const{redirectUrl:r,...i}=n;t=eo(t,"Sign in with Metamask");const s=Jl(t)("SignInWithMetamaskButton"),o=async()=>{async function f(){await e.authenticateWithMetamask({redirectUrl:r||void 0})}f()},d={...i,onClick:async f=>(await to(s.props.onClick)(f),o())};return fe.cloneElement(s,d)},{component:"SignInWithMetamask",renderWhileLoading:!0});rn(({clerk:e,children:t,...n})=>{const{redirectUrl:r="/",signOutOptions:i,...s}=n;t=eo(t,"Sign out");const o=Jl(t)("SignOutButton"),c=()=>e.signOut({redirectUrl:r,...i}),f={...s,onClick:async m=>(await to(o.props.onClick)(m),c())};return fe.cloneElement(o,f)},{component:"SignOutButton",renderWhileLoading:!0});rn(({clerk:e,children:t,...n})=>{const{fallbackRedirectUrl:r,forceRedirectUrl:i,signInFallbackRedirectUrl:s,signInForceRedirectUrl:o,mode:c,initialValues:d,oauthFlow:f,...m}=n;t=eo(t,"Sign up");const p=Jl(t)("SignUpButton"),v=()=>{const x={fallbackRedirectUrl:r,forceRedirectUrl:i,signInFallbackRedirectUrl:s,signInForceRedirectUrl:o,initialValues:d,oauthFlow:f};return c==="modal"?e.openSignUp({...x,appearance:n.appearance,unsafeMetadata:n.unsafeMetadata}):e.redirectToSignUp({...x,signUpFallbackRedirectUrl:r,signUpForceRedirectUrl:i})},S={...m,onClick:async x=>(p&&typeof p=="object"&&"props"in p&&await to(p.props.onClick)(x),v())};return fe.cloneElement(p,S)},{component:"SignUpButton",renderWhileLoading:!0});var L$=()=>({fields:{identifier:null,password:null,code:null},raw:null,global:null}),P$=()=>({fields:{firstName:null,lastName:null,emailAddress:null,phoneNumber:null,password:null,username:null,code:null,captcha:null,legalAccepted:null},raw:null,global:null}),B$=class{constructor(e){this.isomorphicClerk=e,this.signInSignalProxy=this.buildSignInProxy(),this.signUpSignalProxy=this.buildSignUpProxy()}signInSignal(){return this.signInSignalProxy}signUpSignal(){return this.signUpSignalProxy}buildSignInProxy(){const e=this.gateProperty.bind(this),t=()=>this.client.signIn.__internal_future;return{errors:L$(),fetchStatus:"idle",signIn:{status:"needs_identifier",availableStrategies:[],isTransferable:!1,get id(){return e(t,"id",void 0)},get supportedFirstFactors(){return e(t,"supportedFirstFactors",[])},get supportedSecondFactors(){return e(t,"supportedSecondFactors",[])},get secondFactorVerification(){return e(t,"secondFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},get identifier(){return e(t,"identifier",null)},get createdSessionId(){return e(t,"createdSessionId",null)},get userData(){return e(t,"userData",{})},get firstFactorVerification(){return e(t,"firstFactorVerification",{status:null,error:null,expireAt:null,externalVerificationRedirectURL:null,nonce:null,attempts:null,message:null,strategy:null,verifiedAtClient:null,verifiedFromTheSameClient:()=>!1,__internal_toSnapshot:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")},pathRoot:"",reload:()=>{throw new Error("__internal_toSnapshot called before Clerk is loaded")}})},create:this.gateMethod(t,"create"),password:this.gateMethod(t,"password"),sso:this.gateMethod(t,"sso"),finalize:this.gateMethod(t,"finalize"),emailCode:this.wrapMethods(()=>t().emailCode,["sendCode","verifyCode"]),emailLink:this.wrapStruct(()=>t().emailLink,["sendLink","waitForVerification"],["verification"],{verification:null}),resetPasswordEmailCode:this.wrapMethods(()=>t().resetPasswordEmailCode,["sendCode","verifyCode","submitPassword"]),phoneCode:this.wrapMethods(()=>t().phoneCode,["sendCode","verifyCode"]),mfa:this.wrapMethods(()=>t().mfa,["sendPhoneCode","verifyPhoneCode","verifyTOTP","verifyBackupCode"]),ticket:this.gateMethod(t,"ticket"),passkey:this.gateMethod(t,"passkey"),web3:this.gateMethod(t,"web3")}}}buildSignUpProxy(){const e=this.gateProperty.bind(this),t=this.gateMethod.bind(this),n=this.wrapMethods.bind(this),r=()=>this.client.signUp.__internal_future;return{errors:P$(),fetchStatus:"idle",signUp:{get id(){return e(r,"id",void 0)},get requiredFields(){return e(r,"requiredFields",[])},get optionalFields(){return e(r,"optionalFields",[])},get missingFields(){return e(r,"missingFields",[])},get username(){return e(r,"username",null)},get firstName(){return e(r,"firstName",null)},get lastName(){return e(r,"lastName",null)},get emailAddress(){return e(r,"emailAddress",null)},get phoneNumber(){return e(r,"phoneNumber",null)},get web3Wallet(){return e(r,"web3Wallet",null)},get hasPassword(){return e(r,"hasPassword",!1)},get unsafeMetadata(){return e(r,"unsafeMetadata",{})},get createdSessionId(){return e(r,"createdSessionId",null)},get createdUserId(){return e(r,"createdUserId",null)},get abandonAt(){return e(r,"abandonAt",null)},get legalAcceptedAt(){return e(r,"legalAcceptedAt",null)},get locale(){return e(r,"locale",null)},get status(){return e(r,"status","missing_requirements")},get unverifiedFields(){return e(r,"unverifiedFields",[])},get isTransferable(){return e(r,"isTransferable",!1)},create:t(r,"create"),update:t(r,"update"),sso:t(r,"sso"),password:t(r,"password"),ticket:t(r,"ticket"),web3:t(r,"web3"),finalize:t(r,"finalize"),verifications:n(()=>r().verifications,["sendEmailCode","verifyEmailCode","sendPhoneCode","verifyPhoneCode"])}}}__internal_effect(e){throw new Error("__internal_effect called before Clerk is loaded")}__internal_computed(e){throw new Error("__internal_computed called before Clerk is loaded")}get client(){const e=this.isomorphicClerk.client;if(!e)throw new Error("Clerk client not ready");return e}gateProperty(e,t,n){return!ff()||!this.isomorphicClerk.loaded?n:e()[t]}gateMethod(e,t){return async(...n)=>{if(!ff())return Qi.throw(`Attempted to call a method (${t}) that is not supported on the server.`);this.isomorphicClerk.loaded||await new Promise(i=>this.isomorphicClerk.addOnLoaded(i));const r=e();return r[t].apply(r,n)}}wrapMethods(e,t){return Object.fromEntries(t.map(n=>[n,this.gateMethod(e,n)]))}wrapStruct(e,t,n,r){const i={};for(const s of t)i[s]=this.gateMethod(e,s);for(const s of n)Object.defineProperty(i,s,{get:()=>this.gateProperty(e,s,r[s]),enumerable:!0});return i}};typeof globalThis.__BUILD_DISABLE_RHC__>"u"&&(globalThis.__BUILD_DISABLE_RHC__=!1);var U$={name:"@clerk/clerk-react",version:"5.58.1",environment:"production"},jh,jo,$o,Ks,la,$h,Xs,jc,Yh,aS=class sS{constructor(t){Vs(this,jc),this.clerkjs=null,this.preopenOneTap=null,this.preopenUserVerification=null,this.preopenEnableOrganizationsPrompt=null,this.preopenSignIn=null,this.preopenCheckout=null,this.preopenPlanDetails=null,this.preopenSubscriptionDetails=null,this.preopenSignUp=null,this.preopenUserProfile=null,this.preopenOrganizationProfile=null,this.preopenCreateOrganization=null,this.preOpenWaitlist=null,this.premountSignInNodes=new Map,this.premountSignUpNodes=new Map,this.premountUserAvatarNodes=new Map,this.premountUserProfileNodes=new Map,this.premountUserButtonNodes=new Map,this.premountOrganizationProfileNodes=new Map,this.premountCreateOrganizationNodes=new Map,this.premountOrganizationSwitcherNodes=new Map,this.premountOrganizationListNodes=new Map,this.premountMethodCalls=new Map,this.premountWaitlistNodes=new Map,this.premountPricingTableNodes=new Map,this.premountAPIKeysNodes=new Map,this.premountOAuthConsentNodes=new Map,this.premountTaskChooseOrganizationNodes=new Map,this.premountTaskResetPasswordNodes=new Map,this.premountAddListenerCalls=new Map,this.loadedListeners=[],Vs(this,jh,"loading"),Vs(this,jo),Vs(this,$o),Vs(this,Ks),Vs(this,la,D$()),Vs(this,$h),this.buildSignInUrl=i=>{const s=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildSignInUrl(i))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildSignInUrl",s)},this.buildSignUpUrl=i=>{const s=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildSignUpUrl(i))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildSignUpUrl",s)},this.buildAfterSignInUrl=(...i)=>{const s=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildAfterSignInUrl(...i))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildAfterSignInUrl",s)},this.buildAfterSignUpUrl=(...i)=>{const s=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildAfterSignUpUrl(...i))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildAfterSignUpUrl",s)},this.buildAfterSignOutUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildAfterSignOutUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildAfterSignOutUrl",i)},this.buildNewSubscriptionRedirectUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildNewSubscriptionRedirectUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildNewSubscriptionRedirectUrl",i)},this.buildAfterMultiSessionSingleSignOutUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildAfterMultiSessionSingleSignOutUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildAfterMultiSessionSingleSignOutUrl",i)},this.buildUserProfileUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildUserProfileUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildUserProfileUrl",i)},this.buildCreateOrganizationUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildCreateOrganizationUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildCreateOrganizationUrl",i)},this.buildOrganizationProfileUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildOrganizationProfileUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildOrganizationProfileUrl",i)},this.buildWaitlistUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildWaitlistUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildWaitlistUrl",i)},this.buildTasksUrl=()=>{const i=()=>{var s;return((s=this.clerkjs)==null?void 0:s.buildTasksUrl())||""};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("buildTasksUrl",i)},this.buildUrlWithAuth=i=>{const s=()=>{var o;return((o=this.clerkjs)==null?void 0:o.buildUrlWithAuth(i))||""};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("buildUrlWithAuth",s)},this.handleUnauthenticated=async()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.handleUnauthenticated()};this.clerkjs&&this.loaded?i():this.premountMethodCalls.set("handleUnauthenticated",i)},this.on=(...i)=>{var s;if((s=this.clerkjs)!=null&&s.on)return this.clerkjs.on(...i);xn(this,la).on(...i)},this.off=(...i)=>{var s;if((s=this.clerkjs)!=null&&s.off)return this.clerkjs.off(...i);xn(this,la).off(...i)},this.addOnLoaded=i=>{this.loadedListeners.push(i),this.loaded&&this.emitLoaded()},this.emitLoaded=()=>{this.loadedListeners.forEach(i=>i()),this.loadedListeners=[]},this.beforeLoad=i=>{if(!i)throw new Error("Failed to hydrate latest Clerk JS")},this.hydrateClerkJS=i=>{var s,o;if(!i)throw new Error("Failed to hydrate latest Clerk JS");return this.clerkjs=i,this.premountMethodCalls.forEach(c=>c()),this.premountAddListenerCalls.forEach((c,d)=>{c.nativeUnsubscribe=i.addListener(d)}),(s=xn(this,la).internal.retrieveListeners("status"))==null||s.forEach(c=>{this.on("status",c,{notify:!0})}),(o=xn(this,la).internal.retrieveListeners("queryClientStatus"))==null||o.forEach(c=>{this.on("queryClientStatus",c,{notify:!0})}),this.preopenSignIn!==null&&i.openSignIn(this.preopenSignIn),this.preopenCheckout!==null&&i.__internal_openCheckout(this.preopenCheckout),this.preopenPlanDetails!==null&&i.__internal_openPlanDetails(this.preopenPlanDetails),this.preopenSubscriptionDetails!==null&&i.__internal_openSubscriptionDetails(this.preopenSubscriptionDetails),this.preopenSignUp!==null&&i.openSignUp(this.preopenSignUp),this.preopenUserProfile!==null&&i.openUserProfile(this.preopenUserProfile),this.preopenUserVerification!==null&&i.__internal_openReverification(this.preopenUserVerification),this.preopenOneTap!==null&&i.openGoogleOneTap(this.preopenOneTap),this.preopenOrganizationProfile!==null&&i.openOrganizationProfile(this.preopenOrganizationProfile),this.preopenCreateOrganization!==null&&i.openCreateOrganization(this.preopenCreateOrganization),this.preOpenWaitlist!==null&&i.openWaitlist(this.preOpenWaitlist),this.preopenEnableOrganizationsPrompt&&i.__internal_openEnableOrganizationsPrompt(this.preopenEnableOrganizationsPrompt),this.premountSignInNodes.forEach((c,d)=>{i.mountSignIn(d,c)}),this.premountSignUpNodes.forEach((c,d)=>{i.mountSignUp(d,c)}),this.premountUserProfileNodes.forEach((c,d)=>{i.mountUserProfile(d,c)}),this.premountUserAvatarNodes.forEach((c,d)=>{i.mountUserAvatar(d,c)}),this.premountUserButtonNodes.forEach((c,d)=>{i.mountUserButton(d,c)}),this.premountOrganizationListNodes.forEach((c,d)=>{i.mountOrganizationList(d,c)}),this.premountWaitlistNodes.forEach((c,d)=>{i.mountWaitlist(d,c)}),this.premountPricingTableNodes.forEach((c,d)=>{i.mountPricingTable(d,c)}),this.premountAPIKeysNodes.forEach((c,d)=>{i.mountAPIKeys(d,c)}),this.premountOAuthConsentNodes.forEach((c,d)=>{i.__internal_mountOAuthConsent(d,c)}),this.premountTaskChooseOrganizationNodes.forEach((c,d)=>{i.mountTaskChooseOrganization(d,c)}),this.premountTaskResetPasswordNodes.forEach((c,d)=>{i.mountTaskResetPassword(d,c)}),typeof this.clerkjs.status>"u"&&xn(this,la).emit(wh.Status,"ready"),this.emitLoaded(),this.clerkjs},this.__experimental_checkout=(...i)=>{var s;return(s=this.clerkjs)==null?void 0:s.__experimental_checkout(...i)},this.__unstable__updateProps=async i=>{const s=await mg(this,jc,Yh).call(this);if(s&&"__unstable__updateProps"in s)return s.__unstable__updateProps(i)},this.setActive=i=>this.clerkjs?this.clerkjs.setActive(i):Promise.reject(),this.openSignIn=i=>{this.clerkjs&&this.loaded?this.clerkjs.openSignIn(i):this.preopenSignIn=i},this.closeSignIn=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignIn():this.preopenSignIn=null},this.__internal_openCheckout=i=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openCheckout(i):this.preopenCheckout=i},this.__internal_closeCheckout=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeCheckout():this.preopenCheckout=null},this.__internal_openPlanDetails=i=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openPlanDetails(i):this.preopenPlanDetails=i},this.__internal_closePlanDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closePlanDetails():this.preopenPlanDetails=null},this.__internal_openSubscriptionDetails=i=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openSubscriptionDetails(i):this.preopenSubscriptionDetails=i??null},this.__internal_closeSubscriptionDetails=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeSubscriptionDetails():this.preopenSubscriptionDetails=null},this.__internal_openReverification=i=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openReverification(i):this.preopenUserVerification=i},this.__internal_closeReverification=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeReverification():this.preopenUserVerification=null},this.__internal_openEnableOrganizationsPrompt=i=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_openEnableOrganizationsPrompt(i):this.preopenEnableOrganizationsPrompt=i},this.__internal_closeEnableOrganizationsPrompt=()=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_closeEnableOrganizationsPrompt():this.preopenEnableOrganizationsPrompt=null},this.openGoogleOneTap=i=>{this.clerkjs&&this.loaded?this.clerkjs.openGoogleOneTap(i):this.preopenOneTap=i},this.closeGoogleOneTap=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeGoogleOneTap():this.preopenOneTap=null},this.openUserProfile=i=>{this.clerkjs&&this.loaded?this.clerkjs.openUserProfile(i):this.preopenUserProfile=i},this.closeUserProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeUserProfile():this.preopenUserProfile=null},this.openOrganizationProfile=i=>{this.clerkjs&&this.loaded?this.clerkjs.openOrganizationProfile(i):this.preopenOrganizationProfile=i},this.closeOrganizationProfile=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeOrganizationProfile():this.preopenOrganizationProfile=null},this.openCreateOrganization=i=>{this.clerkjs&&this.loaded?this.clerkjs.openCreateOrganization(i):this.preopenCreateOrganization=i},this.closeCreateOrganization=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeCreateOrganization():this.preopenCreateOrganization=null},this.openWaitlist=i=>{this.clerkjs&&this.loaded?this.clerkjs.openWaitlist(i):this.preOpenWaitlist=i},this.closeWaitlist=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeWaitlist():this.preOpenWaitlist=null},this.openSignUp=i=>{this.clerkjs&&this.loaded?this.clerkjs.openSignUp(i):this.preopenSignUp=i},this.closeSignUp=()=>{this.clerkjs&&this.loaded?this.clerkjs.closeSignUp():this.preopenSignUp=null},this.mountSignIn=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignIn(i,s):this.premountSignInNodes.set(i,s)},this.unmountSignIn=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignIn(i):this.premountSignInNodes.delete(i)},this.mountSignUp=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountSignUp(i,s):this.premountSignUpNodes.set(i,s)},this.unmountSignUp=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountSignUp(i):this.premountSignUpNodes.delete(i)},this.mountUserAvatar=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserAvatar(i,s):this.premountUserAvatarNodes.set(i,s)},this.unmountUserAvatar=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserAvatar(i):this.premountUserAvatarNodes.delete(i)},this.mountUserProfile=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserProfile(i,s):this.premountUserProfileNodes.set(i,s)},this.unmountUserProfile=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserProfile(i):this.premountUserProfileNodes.delete(i)},this.mountOrganizationProfile=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationProfile(i,s):this.premountOrganizationProfileNodes.set(i,s)},this.unmountOrganizationProfile=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationProfile(i):this.premountOrganizationProfileNodes.delete(i)},this.mountCreateOrganization=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountCreateOrganization(i,s):this.premountCreateOrganizationNodes.set(i,s)},this.unmountCreateOrganization=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountCreateOrganization(i):this.premountCreateOrganizationNodes.delete(i)},this.mountOrganizationSwitcher=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationSwitcher(i,s):this.premountOrganizationSwitcherNodes.set(i,s)},this.unmountOrganizationSwitcher=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationSwitcher(i):this.premountOrganizationSwitcherNodes.delete(i)},this.__experimental_prefetchOrganizationSwitcher=()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.__experimental_prefetchOrganizationSwitcher()};this.clerkjs&&this.loaded?i():this.premountMethodCalls.set("__experimental_prefetchOrganizationSwitcher",i)},this.mountOrganizationList=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountOrganizationList(i,s):this.premountOrganizationListNodes.set(i,s)},this.unmountOrganizationList=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountOrganizationList(i):this.premountOrganizationListNodes.delete(i)},this.mountUserButton=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountUserButton(i,s):this.premountUserButtonNodes.set(i,s)},this.unmountUserButton=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountUserButton(i):this.premountUserButtonNodes.delete(i)},this.mountWaitlist=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountWaitlist(i,s):this.premountWaitlistNodes.set(i,s)},this.unmountWaitlist=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountWaitlist(i):this.premountWaitlistNodes.delete(i)},this.mountPricingTable=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountPricingTable(i,s):this.premountPricingTableNodes.set(i,s)},this.unmountPricingTable=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountPricingTable(i):this.premountPricingTableNodes.delete(i)},this.mountAPIKeys=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountAPIKeys(i,s):this.premountAPIKeysNodes.set(i,s)},this.unmountAPIKeys=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountAPIKeys(i):this.premountAPIKeysNodes.delete(i)},this.__internal_mountOAuthConsent=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_mountOAuthConsent(i,s):this.premountOAuthConsentNodes.set(i,s)},this.__internal_unmountOAuthConsent=i=>{this.clerkjs&&this.loaded?this.clerkjs.__internal_unmountOAuthConsent(i):this.premountOAuthConsentNodes.delete(i)},this.mountTaskChooseOrganization=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskChooseOrganization(i,s):this.premountTaskChooseOrganizationNodes.set(i,s)},this.unmountTaskChooseOrganization=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskChooseOrganization(i):this.premountTaskChooseOrganizationNodes.delete(i)},this.mountTaskResetPassword=(i,s)=>{this.clerkjs&&this.loaded?this.clerkjs.mountTaskResetPassword(i,s):this.premountTaskResetPasswordNodes.set(i,s)},this.unmountTaskResetPassword=i=>{this.clerkjs&&this.loaded?this.clerkjs.unmountTaskResetPassword(i):this.premountTaskResetPasswordNodes.delete(i)},this.addListener=i=>{if(this.clerkjs)return this.clerkjs.addListener(i);{const s=()=>{var o;const c=this.premountAddListenerCalls.get(i);c&&((o=c.nativeUnsubscribe)==null||o.call(c),this.premountAddListenerCalls.delete(i))};return this.premountAddListenerCalls.set(i,{unsubscribe:s,nativeUnsubscribe:void 0}),s}},this.navigate=i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.navigate(i)};this.clerkjs&&this.loaded?s():this.premountMethodCalls.set("navigate",s)},this.redirectWithAuth=async(...i)=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectWithAuth(...i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectWithAuth",s)},this.redirectToSignIn=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToSignIn(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectToSignIn",s)},this.redirectToSignUp=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToSignUp(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectToSignUp",s)},this.redirectToUserProfile=async()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToUserProfile()};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToUserProfile",i)},this.redirectToAfterSignUp=()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToAfterSignUp()};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToAfterSignUp",i)},this.redirectToAfterSignIn=()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToAfterSignIn()};this.clerkjs&&this.loaded?i():this.premountMethodCalls.set("redirectToAfterSignIn",i)},this.redirectToAfterSignOut=()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToAfterSignOut()};this.clerkjs&&this.loaded?i():this.premountMethodCalls.set("redirectToAfterSignOut",i)},this.redirectToOrganizationProfile=async()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToOrganizationProfile()};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToOrganizationProfile",i)},this.redirectToCreateOrganization=async()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToCreateOrganization()};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToCreateOrganization",i)},this.redirectToWaitlist=async()=>{const i=()=>{var s;return(s=this.clerkjs)==null?void 0:s.redirectToWaitlist()};if(this.clerkjs&&this.loaded)return i();this.premountMethodCalls.set("redirectToWaitlist",i)},this.redirectToTasks=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.redirectToTasks(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("redirectToTasks",s)},this.handleRedirectCallback=async i=>{var s;const o=()=>{var c;return(c=this.clerkjs)==null?void 0:c.handleRedirectCallback(i)};this.clerkjs&&this.loaded?(s=o())==null||s.catch(()=>{}):this.premountMethodCalls.set("handleRedirectCallback",o)},this.handleGoogleOneTapCallback=async(i,s)=>{var o;const c=()=>{var d;return(d=this.clerkjs)==null?void 0:d.handleGoogleOneTapCallback(i,s)};this.clerkjs&&this.loaded?(o=c())==null||o.catch(()=>{}):this.premountMethodCalls.set("handleGoogleOneTapCallback",c)},this.handleEmailLinkVerification=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.handleEmailLinkVerification(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("handleEmailLinkVerification",s)},this.authenticateWithMetamask=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.authenticateWithMetamask(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithMetamask",s)},this.authenticateWithCoinbaseWallet=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.authenticateWithCoinbaseWallet(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithCoinbaseWallet",s)},this.authenticateWithBase=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.authenticateWithBase(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithBase",s)},this.authenticateWithOKXWallet=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.authenticateWithOKXWallet(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithOKXWallet",s)},this.authenticateWithWeb3=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.authenticateWithWeb3(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("authenticateWithWeb3",s)},this.authenticateWithGoogleOneTap=async i=>(await mg(this,jc,Yh).call(this)).authenticateWithGoogleOneTap(i),this.__internal_loadStripeJs=async()=>(await mg(this,jc,Yh).call(this)).__internal_loadStripeJs(),this.createOrganization=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.createOrganization(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("createOrganization",s)},this.getOrganization=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.getOrganization(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("getOrganization",s)},this.joinWaitlist=async i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.joinWaitlist(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("joinWaitlist",s)},this.signOut=async(...i)=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.signOut(...i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("signOut",s)},this.__internal_attemptToEnableEnvironmentSetting=i=>{const s=()=>{var o;return(o=this.clerkjs)==null?void 0:o.__internal_attemptToEnableEnvironmentSetting(i)};if(this.clerkjs&&this.loaded)return s();this.premountMethodCalls.set("__internal_attemptToEnableEnvironmentSetting",s)};const{Clerk:n=null,publishableKey:r}=t||{};Bl(this,Ks,r),Bl(this,$o,t==null?void 0:t.proxyUrl),Bl(this,jo,t==null?void 0:t.domain),this.options=t,this.Clerk=n,this.mode=ff()?"browser":"server",Bl(this,$h,new B$(this)),this.options.sdkMetadata||(this.options.sdkMetadata=U$),xn(this,la).emit(wh.Status,"loading"),xn(this,la).prioritizedOn(wh.Status,i=>Bl(this,jh,i)),xn(this,Ks)&&this.loadClerkJS()}get publishableKey(){return xn(this,Ks)}get loaded(){var t;return((t=this.clerkjs)==null?void 0:t.loaded)||!1}get status(){var t;return this.clerkjs?((t=this.clerkjs)==null?void 0:t.status)||(this.clerkjs.loaded?"ready":"loading"):xn(this,jh)}static getOrCreateInstance(t){return(!ff()||!xn(this,Xs)||t.Clerk&&xn(this,Xs).Clerk!==t.Clerk||xn(this,Xs).publishableKey!==t.publishableKey)&&Bl(this,Xs,new sS(t)),xn(this,Xs)}static clearInstance(){Bl(this,Xs,null)}get domain(){return typeof window<"u"&&window.location?ug(xn(this,jo),new URL(window.location.href),""):typeof xn(this,jo)=="function"?Qi.throw(og):xn(this,jo)||""}get proxyUrl(){return typeof window<"u"&&window.location?ug(xn(this,$o),new URL(window.location.href),""):typeof xn(this,$o)=="function"?Qi.throw(og):xn(this,$o)||""}__internal_getOption(t){var n,r;return(n=this.clerkjs)!=null&&n.__internal_getOption?(r=this.clerkjs)==null?void 0:r.__internal_getOption(t):this.options[t]}get sdkMetadata(){var t;return((t=this.clerkjs)==null?void 0:t.sdkMetadata)||this.options.sdkMetadata||void 0}get instanceType(){var t;return(t=this.clerkjs)==null?void 0:t.instanceType}get frontendApi(){var t;return((t=this.clerkjs)==null?void 0:t.frontendApi)||""}get isStandardBrowser(){var t;return((t=this.clerkjs)==null?void 0:t.isStandardBrowser)||this.options.standardBrowser||!1}get __internal_queryClient(){var t;return(t=this.clerkjs)==null?void 0:t.__internal_queryClient}get isSatellite(){return typeof window<"u"&&window.location?ug(this.options.isSatellite,new URL(window.location.href),!1):typeof this.options.isSatellite=="function"?Qi.throw(og):!1}async loadClerkJS(){var t;if(!(this.mode!=="browser"||this.loaded)){typeof window<"u"&&(window.__clerk_publishable_key=xn(this,Ks),window.__clerk_proxy_url=this.proxyUrl,window.__clerk_domain=this.domain);try{if(this.Clerk){let n;Yj(this.Clerk)?(n=new this.Clerk(xn(this,Ks),{proxyUrl:this.proxyUrl,domain:this.domain}),this.beforeLoad(n),await n.load(this.options)):(n=this.Clerk,n.loaded||(this.beforeLoad(n),await n.load(this.options))),global.Clerk=n}else if(!__BUILD_DISABLE_RHC__){if(global.Clerk||await A$({...this.options,publishableKey:xn(this,Ks),proxyUrl:this.proxyUrl,domain:this.domain,nonce:this.options.nonce}),!global.Clerk)throw new Error("Failed to download latest ClerkJS. Contact support@clerk.com.");this.beforeLoad(global.Clerk),await global.Clerk.load(this.options)}return(t=global.Clerk)!=null&&t.loaded?this.hydrateClerkJS(global.Clerk):void 0}catch(n){const r=n;xn(this,la).emit(wh.Status,"error"),console.error(r.stack||r.message||r);return}}}get version(){var t;return(t=this.clerkjs)==null?void 0:t.version}get client(){if(this.clerkjs)return this.clerkjs.client}get session(){if(this.clerkjs)return this.clerkjs.session}get user(){if(this.clerkjs)return this.clerkjs.user}get organization(){if(this.clerkjs)return this.clerkjs.organization}get telemetry(){if(this.clerkjs)return this.clerkjs.telemetry}get __unstable__environment(){if(this.clerkjs)return this.clerkjs.__unstable__environment}get isSignedIn(){return this.clerkjs?this.clerkjs.isSignedIn:!1}get billing(){var t;return(t=this.clerkjs)==null?void 0:t.billing}get __internal_state(){return this.loaded&&this.clerkjs?this.clerkjs.__internal_state:xn(this,$h)}get apiKeys(){var t;return(t=this.clerkjs)==null?void 0:t.apiKeys}__unstable__setEnvironment(...t){if(this.clerkjs&&"__unstable__setEnvironment"in this.clerkjs)this.clerkjs.__unstable__setEnvironment(t);else return}};jh=new WeakMap;jo=new WeakMap;$o=new WeakMap;Ks=new WeakMap;la=new WeakMap;$h=new WeakMap;Xs=new WeakMap;jc=new WeakSet;Yh=function(){return new Promise(e=>{this.addOnLoaded(()=>e(this.clerkjs))})};Vs(aS,Xs);var M6=aS;function F$(e){const{isomorphicClerkOptions:t,initialState:n,children:r}=e,{isomorphicClerk:i,clerkStatus:s}=z$(t),[o,c]=fe.useState({client:i.client,session:i.session,user:i.user,organization:i.organization});fe.useEffect(()=>i.addListener(de=>c({...de})),[]);const d=O$(i.loaded,o,n),f=fe.useMemo(()=>({value:i}),[s]),m=fe.useMemo(()=>({value:o.client}),[o.client]),{sessionId:p,sessionStatus:v,sessionClaims:_,session:S,userId:x,user:C,orgId:w,actor:O,organization:D,orgRole:j,orgSlug:F,orgPermissions:B,factorVerificationAge:ee}=d,J=fe.useMemo(()=>({value:{sessionId:p,sessionStatus:v,sessionClaims:_,userId:x,actor:O,orgId:w,orgRole:j,orgSlug:F,orgPermissions:B,factorVerificationAge:ee}}),[p,v,x,O,w,j,F,ee,_==null?void 0:_.__raw]),W=fe.useMemo(()=>({value:S}),[p,S]),G=fe.useMemo(()=>({value:C}),[x,C]),se=fe.useMemo(()=>({value:{organization:D}}),[w,D]);return fe.createElement(vj.Provider,{value:f},fe.createElement(Qq.Provider,{value:m},fe.createElement(Zq.Provider,{value:W},fe.createElement(rj,{...se.value},fe.createElement(gj.Provider,{value:J},fe.createElement(Xq.Provider,{value:G},fe.createElement(ej,{value:void 0},r)))))))}var z$=e=>{const t=fe.useRef(M6.getOrCreateInstance(e)),[n,r]=fe.useState(t.current.status);return fe.useEffect(()=>{t.current.__unstable__updateProps({appearance:e.appearance})},[e.appearance]),fe.useEffect(()=>{t.current.__unstable__updateProps({options:e})},[e.localization]),fe.useEffect(()=>(t.current.on("status",r),()=>{t.current&&t.current.off("status",r),M6.clearInstance()}),[]),{isomorphicClerk:t.current,clerkStatus:n}};function H$(e){const{initialState:t,children:n,__internal_bypassMissingPublishableKey:r,...i}=e,{publishableKey:s="",Clerk:o}=i;return!o&&!r&&(s?s&&!db(s)&&Qi.throwInvalidPublishableKeyError({key:s}):Qi.throwMissingPublishableKeyError()),fe.createElement(F$,{initialState:t,isomorphicClerkOptions:i},n)}var lS=Vj(H$,"ClerkProvider",yj);lS.displayName="ClerkProvider";pj({packageName:"@clerk/clerk-react"});S$("@clerk/clerk-react");const Za={MAX_FILE_BYTES:10*1024*1024,ALLOWED_MIME:new Set(["image/jpeg","image/png","image/webp","application/pdf","text/plain","text/markdown","text/csv","video/mp4","video/webm","video/ogg","video/quicktime"]),MAX_CHATS:15};function iu(e){const t=/<!--\s*cycls:attachments\s*([\s\S]*?)\s*cycls:attachments\s*-->/m,n=e.match(t);if(!n)return{clean:e,attachments:[]};let r=[];try{r=JSON.parse(n[1])}catch{r=[]}return{clean:e.replace(t,"").trimEnd(),attachments:r}}function q$(e){return e?e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/csv"?"csv":e==="text/markdown"?"md":e==="text/plain"?"txt":"file":"file"}async function j$(e,t="anon",n="anon"){if(e.size>Za.MAX_FILE_BYTES)throw new Error("File too large (max 10MB)");if(!Za.ALLOWED_MIME.has(e.type))throw new Error(`Type not allowed: ${e.type}`);const r=new FormData;r.append("file",e),r.append("orgId",t),r.append("userId",n);const i=await fetch("https://cfywthfcvbajcekvwajz.supabase.co/functions/v1/upload",{method:"POST",body:r});if(!i.ok)throw new Error(`Upload failed (${i.status})`);return await i.json()}const mf=e=>e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(2)}kB`:`${(e/(1024*1024)).toFixed(2)}MB`,$$=e=>{if(e.size>Za.MAX_FILE_BYTES)return{valid:!1,error:`File "${e.name}" is too large (${mf(e.size)}). Maximum size is ${mf(Za.MAX_FILE_BYTES)}.`};if(!Za.ALLOWED_MIME.has(e.type)){const t=Array.from(Za.ALLOWED_MIME).map(n=>n.split("/")[1]).join(", ");return{valid:!1,error:`File type "${e.type}" is not supported. Allowed types: ${t}`}}return{valid:!0}};async function Tb(e,t,{signal:n}={}){var m,p,v,_,S,x;const r=e.body.getReader(),i=new TextDecoder,s=e.headers.get("content-type")||"",o=s.includes("text/event-stream")||s.includes("stream");let c="",d="",f=null;for(;;){if(n!=null&&n.aborted)throw new DOMException("Aborted","AbortError");const{value:C,done:w}=await r.read();if(w)break;if(C){const O=i.decode(C,{stream:!0});if(c+=O,f===null&&c.length>0&&(f=c.trimStart().startsWith("data: ")),o||f){let D;for(;(D=c.indexOf(`
382
382
  `))!==-1;){const j=c.slice(0,D).trim();if(c=c.slice(D+1),!!j&&j.startsWith("data: ")){const F=j.slice(6);if(F==="[DONE]")return t(d),d;try{const B=JSON.parse(F),ee=((v=(p=(m=B==null?void 0:B.choices)==null?void 0:m[0])==null?void 0:p.delta)==null?void 0:v.content)||"";ee&&(d+=ee,t(d))}catch(B){console.error("Failed to parse SSE data:",B,F)}}}}else d+=O,t(d),c=""}}if((o||f)&&c.trim()){const C=c.trim();if(C.startsWith("data: ")){const w=C.slice(6);if(w!=="[DONE]")try{const O=JSON.parse(w),D=((x=(S=(_=O==null?void 0:O.choices)==null?void 0:_[0])==null?void 0:S.delta)==null?void 0:x.content)||"";D&&(d+=D)}catch(O){console.error("Failed to parse final SSE data:",O,w)}}}return t(d),d}function xb(e){return e.replace(/<think>[\s\S]*?<\/think>/g,"")}const Y$=({children:e,className:t,node:n,inline:r,...i})=>{const[s,o]=H.useState(!1),c=H.useRef(null),d=async()=>{var v;try{const _=((v=c.current)==null?void 0:v.textContent)||"";await navigator.clipboard.writeText(_),o(!0),setTimeout(()=>o(!1),2e3)}catch(_){console.error("Failed to copy code:",_)}},f=v=>{var _;return typeof v=="string"?v:Array.isArray(v)?v.map(f).join(""):(_=v==null?void 0:v.props)!=null&&_.children?f(v.props.children):""},m=f(e);return r||!m.includes(`
383
- `)?I.jsx("code",{className:t,...i,children:e}):I.jsxs("div",{className:"relative group",children:[I.jsx("button",{onClick:d,className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-gray-600 hover:text-gray-900 bg-white hover:bg-gray-50 border border-gray-200 rounded-md shadow-sm z-10",title:"Copy code",children:s?I.jsxs(I.Fragment,{children:[I.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:I.jsx("polyline",{points:"20 6 9 17 4 12"})}),I.jsx("span",{children:"Copied!"})]}):I.jsx(I.Fragment,{children:I.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),I.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})}),I.jsx("code",{ref:c,className:t,...i,children:e})]})},G$=({attachments:e=[]})=>e.length?I.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((t,n)=>{const r=q$(t.mime);if(r==="image")return I.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"group relative overflow-hidden rounded-lg shadow-sm transition-all duration-200 theme-transition",style:{border:"1px solid var(--border-primary)"},children:I.jsx("img",{src:t.url,alt:"",loading:"lazy",className:"mb-1 w-40 rounded-md"})},n);const i={pdf:"📄",csv:"📊",md:"📝",txt:"📝"}[r]||"📎";return I.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2.5 rounded-xl backdrop-blur-sm px-4 py-2.5 text-sm transition-all shadow-sm hover:bg-[var(--bg-hover)] theme-transition",style:{border:"1px solid var(--border-primary)",backgroundColor:"var(--bg-primary)"},children:[I.jsx("span",{className:"text-xl",children:i}),I.jsx("span",{className:"text-xs uppercase font-semibold tracking-wide",style:{color:"var(--text-tertiary)"},children:r||"file"})]},n)})}):null,V$=({error:e,onRetry:t,isRetrying:n})=>{const r=i=>i?i.type==="network"?"Network error. Please check your connection and try again.":i.type==="timeout"?"Request timed out. The server took too long to respond.":i.type==="rate_limit"?i.message||"Too many requests. Please wait a moment and try again.":i.type==="server"?`Server error (${i.status||"unknown"}). Please try again later.`:i.type==="abort"?"Request was cancelled.":i.message||"An error occurred while processing your request.":"An unexpected error occurred";return I.jsx("div",{className:"rounded-lg p-4 my-2 theme-transition",style:{backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)"},children:I.jsxs("div",{className:"flex items-start gap-3",children:[I.jsx("div",{className:"flex-shrink-0 mt-0.5",children:I.jsxs("svg",{className:"h-5 w-5 text-red-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[I.jsx("circle",{cx:"12",cy:"12",r:"10"}),I.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),I.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),I.jsxs("div",{className:"flex-1 min-w-0",children:[I.jsx("p",{className:"text-sm font-medium text-red-500",children:"Error"}),I.jsx("p",{className:"text-sm mt-1",style:{color:"var(--text-secondary)"},children:r(e)}),t&&e.type!=="abort"&&I.jsx("button",{onClick:t,disabled:n,className:"mt-3 inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-red-500 hover:text-red-400 border border-red-500/30 hover:border-red-500/50 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed theme-transition",style:{backgroundColor:"var(--bg-primary)"},children:n?I.jsxs(I.Fragment,{children:[I.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[I.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),I.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),I.jsx("span",{children:"Retrying..."})]}):I.jsxs(I.Fragment,{children:[I.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("polyline",{points:"23 4 23 10 17 10"}),I.jsx("polyline",{points:"1 20 1 14 7 14"}),I.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),I.jsx("span",{children:"Retry"})]})})]})]})})},K$=({message:e,onCopy:t,onRegenerate:n,isLastAssistant:r})=>{const[i,s]=H.useState(!1),o=async()=>{try{const{clean:c}=iu(e.content);await navigator.clipboard.writeText(c),s(!0),setTimeout(()=>s(!1),2e3)}catch(c){console.error("Failed to copy:",c)}};return I.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[I.jsx("button",{onClick:o,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors hover:bg-[var(--bg-hover)] theme-transition",style:{color:"var(--text-tertiary)"},title:"Copy message",children:i?I.jsxs(I.Fragment,{children:[I.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:I.jsx("polyline",{points:"20 6 9 17 4 12"})}),I.jsx("span",{children:"Copied!"})]}):I.jsxs(I.Fragment,{children:[I.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),I.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),I.jsx("span",{children:"Copy"})]})}),r&&I.jsxs("button",{onClick:n,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors hover:bg-[var(--bg-hover)] theme-transition",style:{color:"var(--text-tertiary)"},title:"Regenerate response",children:[I.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("polyline",{points:"23 4 23 10 17 10"}),I.jsx("polyline",{points:"1 20 1 14 7 14"}),I.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),I.jsx("span",{children:"Regenerate"})]})]})},W$=fe.memo(({messages:e,onSend:t,onRegenerate:n,isGenerating:r,onRetry:i,retryingIndex:s})=>{const o=H.useMemo(()=>e.map((c,d)=>{if(c.type==="request"){const{clean:m,attachments:p}=iu(c.content),v=/[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/.test(m);return I.jsx("div",{className:`flex mb-4 ${v?"justify-start":"justify-end"}`,children:I.jsxs("div",{className:"max-w-[85%] md:max-w-[75%]",children:[p.length>0&&I.jsx("div",{className:"mb-1",children:I.jsx(G$,{attachments:p})}),m&&I.jsx("div",{className:"px-4 py-2 rounded-3xl shadow-sm theme-transition",style:{backgroundColor:"var(--msg-user-bg)",color:"var(--text-primary)"},children:I.jsx("div",{dir:"auto",className:"text-[15px] leading-relaxed whitespace-pre-wrap",children:m})})]})},d)}const f=c.type==="response"&&d===e.length-1&&!r;return I.jsx("div",{className:"flex mb-4 justify-start group",children:I.jsx("div",{className:"w-full",children:c.error?I.jsx(V$,{error:c.error,onRetry:()=>i(d),isRetrying:s===d}):I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"prose prose-sm max-w-none",children:[I.jsx(Zb,{markdown:c.content,onSend:t}),c.content===""&&I.jsx("div",{className:"h-4 w-32 rounded animate-pulse",style:{backgroundColor:"var(--bg-tertiary)"}})]}),c.content&&c.content!==""&&I.jsx(K$,{message:c,onRegenerate:()=>n(d),isLastAssistant:f})]})})},d)}),[e,t,n,r,i,s]);return I.jsx("div",{className:"space-y-1",children:o})}),X$=({file:e,onRemove:t})=>{const[n,r]=H.useState(null),i=e.type.startsWith("image/");return H.useEffect(()=>{if(!i)return;const s=new FileReader;s.onloadend=()=>r(String(s.result)),s.readAsDataURL(e)},[e,i]),I.jsxs("div",{className:"group inline-flex items-start gap-2 rounded-xl shadow-sm px-2.5 py-1 theme-transition",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-primary)"},title:e.name,children:[I.jsx("div",{className:"w-10 h-10 rounded-md overflow-hidden flex items-center justify-center",style:{backgroundColor:"var(--bg-tertiary)"},children:i&&n?I.jsx("img",{src:n,alt:e.name,className:"w-full h-full object-cover"}):I.jsx("span",{className:"text-xs",children:"📄"})}),I.jsxs("div",{className:"min-w-0 leading-tight",children:[I.jsx("div",{className:"text-xs font-medium truncate max-w-[100px]",style:{color:"var(--text-primary)"},children:e.name}),I.jsx("div",{className:"text-xs text-left",style:{color:"var(--text-tertiary)"},children:mf(e.size)})]}),I.jsx("button",{onClick:t,className:"ml-1 h-5 w-5 rounded-full grid place-items-center hover:bg-[var(--bg-hover)] theme-transition",style:{backgroundColor:"var(--bg-tertiary)",color:"var(--text-secondary)"},"aria-label":"Remove attachment",children:I.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:I.jsx("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})},Q$=({error:e,onDismiss:t})=>(H.useEffect(()=>{const n=setTimeout(t,5e3);return()=>clearTimeout(n)},[t]),I.jsx("div",{className:"fixed bottom-40 left-1/2 transform -translate-x-1/2 bg-red-50 border border-red-200 rounded-xl shadow-lg px-4 py-3 min-w-[320px] max-w-[90vw] z-50 animate-in slide-in-from-bottom-2 duration-300",children:I.jsxs("div",{className:"flex items-start gap-3",children:[I.jsx("div",{className:"flex-shrink-0 mt-0.5",children:I.jsxs("svg",{className:"h-5 w-5 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[I.jsx("circle",{cx:"12",cy:"12",r:"10"}),I.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),I.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),I.jsxs("div",{className:"flex-1 min-w-0",children:[I.jsx("p",{className:"text-sm font-medium text-red-900",children:"Upload Error"}),I.jsx("p",{className:"text-sm text-red-700 mt-1",children:e})]}),I.jsx("button",{onClick:t,className:"flex-shrink-0 text-red-400 hover:text-red-600 transition-colors","aria-label":"Dismiss",children:I.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",children:I.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})),Z$=({onSend:e,isLoading:t=!1,onStop:n,disabled:r=!1,onUpgradeClick:i,sidebarWidth:s=0})=>{const[o,c]=H.useState(""),[d,f]=H.useState([]),[m,p]=H.useState(!1),[v,_]=H.useState(null),[S,x]=H.useState(!1),C=H.useRef(null),w=H.useRef(null),O=H.useRef(0);H.useEffect(()=>{const W=()=>p(window.innerWidth<=768);return W(),window.addEventListener("resize",W),()=>window.removeEventListener("resize",W)},[]);const D=H.useCallback(W=>{if(r)return;const G=[];for(const se of W){const de=$$(se);if(de.valid)G.push(se);else{_(de.error);break}}G.length>0&&f(se=>[...se,...G])},[r]);H.useEffect(()=>{const W=ye=>{ye.preventDefault(),ye.stopPropagation(),!r&&(O.current++,ye.dataTransfer.types.includes("Files")&&x(!0))},G=ye=>{ye.preventDefault(),ye.stopPropagation(),O.current--,O.current===0&&x(!1)},se=ye=>{ye.preventDefault(),ye.stopPropagation()},de=ye=>{if(ye.preventDefault(),ye.stopPropagation(),x(!1),O.current=0,r)return;const Z=Array.from(ye.dataTransfer.files||[]);Z.length>0&&D(Z)};return document.addEventListener("dragenter",W),document.addEventListener("dragleave",G),document.addEventListener("dragover",se),document.addEventListener("drop",de),()=>{document.removeEventListener("dragenter",W),document.removeEventListener("dragleave",G),document.removeEventListener("dragover",se),document.removeEventListener("drop",de)}},[D,r]),H.useEffect(()=>{const W=G=>{var Z;if(r||!(document.activeElement===w.current))return;const ye=Array.from(((Z=G.clipboardData)==null?void 0:Z.items)||[]).filter(ne=>ne.type.startsWith("image/"));if(ye.length>0){G.preventDefault();const ne=ye.map(X=>X.getAsFile()).filter(X=>X!==null);ne.length>0&&D(ne)}};return document.addEventListener("paste",W),()=>document.removeEventListener("paste",W)},[D,r]);const j=()=>{var W;r||(W=C.current)==null||W.click()},F=W=>{if(r)return;const G=Array.from(W.target.files||[]);D(G),W.target.value=""},B=W=>f(G=>G.filter((se,de)=>de!==W)),ee=async()=>{t||r||(e({text:o,files:d}),c(""),f([]))},J=W=>{W.key==="Enter"&&!W.shiftKey&&!m&&!t&&!r&&(W.preventDefault(),ee())};return I.jsxs(I.Fragment,{children:[v&&I.jsx(Q$,{error:v,onDismiss:()=>_(null)}),S&&!r&&I.jsx("div",{className:"fixed inset-0 z-50 backdrop-blur-sm flex items-center justify-center pointer-events-none",style:{backgroundColor:"var(--bg-overlay)"},children:I.jsx("div",{className:"rounded-2xl shadow-2xl p-8 max-w-md mx-4 border-2 border-dashed theme-transition",style:{backgroundColor:"var(--bg-primary)",borderColor:"var(--text-primary)"},children:I.jsxs("div",{className:"text-center",children:[I.jsx("div",{className:"mx-auto w-16 h-16 rounded-full flex items-center justify-center mb-4",style:{backgroundColor:"var(--bg-tertiary)"},children:I.jsx("svg",{className:"w-8 h-8",style:{color:"var(--text-primary)"},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})})}),I.jsx("h3",{className:"text-lg font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Drop files to upload"}),I.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Images, PDFs, and text files supported"}),I.jsxs("p",{className:"text-xs mt-2",style:{color:"var(--text-tertiary)"},children:["Max ",mf(Za.MAX_FILE_BYTES)," per file"]})]})})}),I.jsx("div",{className:"fixed right-0 z-40 transition-all duration-300 ease-in-out bottom-[max(0.75rem,env(safe-area-inset-bottom))] md:bottom-[max(1rem,env(safe-area-inset-bottom))]",style:{left:m?"0px":`${s}px`},children:I.jsxs("div",{className:"mx-auto max-w-3xl px-3 md:px-4",children:[I.jsxs("div",{className:`cursor-text rounded-3xl relative p-0 pt-1 backdrop-blur-xl w-full theme-transition ${r?"opacity-75":""}`,style:{backgroundColor:"var(--input-bg)",border:"1px solid var(--border-primary)",boxShadow:"var(--shadow-md)"},children:[d.length>0&&I.jsx("div",{className:"px-3 pt-3",children:I.jsx("div",{className:"flex flex-wrap gap-2",children:d.map((W,G)=>I.jsx(X$,{file:W,onRemove:()=>B(G)},G))})}),I.jsxs("div",{className:"px-3 pb-3 pt-2",children:[I.jsx("textarea",{ref:w,className:`w-full resize-none border-0 bg-transparent focus:ring-0 focus:outline-none text-[15px] leading-6 max-h-40 mb-2 disabled:opacity-50 disabled:cursor-not-allowed ${r?"cursor-not-allowed":""}`,style:{color:"var(--text-primary)",caretColor:"var(--accent-primary)"},dir:"auto",autoFocus:!r,tabIndex:0,rows:Math.max(1,Math.min(6,o.split(`
383
+ `)?I.jsx("code",{className:t,...i,children:e}):I.jsxs("div",{className:"relative group",children:[I.jsx("button",{onClick:d,className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-gray-600 hover:text-gray-900 bg-white hover:bg-gray-50 border border-gray-200 rounded-md shadow-sm z-10",title:"Copy code",children:s?I.jsxs(I.Fragment,{children:[I.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:I.jsx("polyline",{points:"20 6 9 17 4 12"})}),I.jsx("span",{children:"Copied!"})]}):I.jsx(I.Fragment,{children:I.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),I.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})}),I.jsx("code",{ref:c,className:t,...i,children:e})]})},G$=({attachments:e=[]})=>e.length?I.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((t,n)=>{const r=q$(t.mime);if(r==="image")return I.jsx("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"group relative overflow-hidden rounded-lg shadow-sm transition-all duration-200 theme-transition",style:{border:"1px solid var(--border-primary)"},children:I.jsx("img",{src:t.url,alt:"",loading:"lazy",className:"mb-1 w-40 rounded-md"})},n);const i={pdf:"📄",csv:"📊",md:"📝",txt:"📝"}[r]||"📎";return I.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2.5 rounded-xl backdrop-blur-sm px-4 py-2.5 text-sm transition-all shadow-sm hover:bg-[var(--bg-hover)] theme-transition",style:{border:"1px solid var(--border-primary)",backgroundColor:"var(--bg-primary)"},children:[I.jsx("span",{className:"text-xl",children:i}),I.jsx("span",{className:"text-xs uppercase font-semibold tracking-wide",style:{color:"var(--text-tertiary)"},children:r||"file"})]},n)})}):null,V$=({error:e,onRetry:t,isRetrying:n})=>{const r=i=>i?i.type==="network"?"Network error. Please check your connection and try again.":i.type==="timeout"?"Request timed out. The server took too long to respond.":i.type==="rate_limit"?i.message||"Too many requests. Please wait a moment and try again.":i.type==="server"?`Server error (${i.status||"unknown"}). Please try again later.`:i.type==="abort"?"Request was cancelled.":i.message||"An error occurred while processing your request.":"An unexpected error occurred";return I.jsx("div",{className:"rounded-lg p-4 my-2 theme-transition",style:{backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)"},children:I.jsxs("div",{className:"flex items-start gap-3",children:[I.jsx("div",{className:"flex-shrink-0 mt-0.5",children:I.jsxs("svg",{className:"h-5 w-5 text-red-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[I.jsx("circle",{cx:"12",cy:"12",r:"10"}),I.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),I.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),I.jsxs("div",{className:"flex-1 min-w-0",children:[I.jsx("p",{className:"text-sm font-medium text-red-500",children:"Error"}),I.jsx("p",{className:"text-sm mt-1",style:{color:"var(--text-secondary)"},children:r(e)}),t&&e.type!=="abort"&&I.jsx("button",{onClick:t,disabled:n,className:"mt-3 inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-red-500 hover:text-red-400 border border-red-500/30 hover:border-red-500/50 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed theme-transition",style:{backgroundColor:"var(--bg-primary)"},children:n?I.jsxs(I.Fragment,{children:[I.jsxs("svg",{className:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[I.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),I.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),I.jsx("span",{children:"Retrying..."})]}):I.jsxs(I.Fragment,{children:[I.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("polyline",{points:"23 4 23 10 17 10"}),I.jsx("polyline",{points:"1 20 1 14 7 14"}),I.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),I.jsx("span",{children:"Retry"})]})})]})]})})},K$=({message:e,onCopy:t,onRegenerate:n,isLastAssistant:r})=>{const[i,s]=H.useState(!1),o=async()=>{try{const{clean:c}=iu(e.content);await navigator.clipboard.writeText(c),s(!0),setTimeout(()=>s(!1),2e3)}catch(c){console.error("Failed to copy:",c)}};return I.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[I.jsx("button",{onClick:o,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors hover:bg-[var(--bg-hover)] theme-transition",style:{color:"var(--text-tertiary)"},title:"Copy message",children:i?I.jsxs(I.Fragment,{children:[I.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:I.jsx("polyline",{points:"20 6 9 17 4 12"})}),I.jsx("span",{children:"Copied!"})]}):I.jsxs(I.Fragment,{children:[I.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),I.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),I.jsx("span",{children:"Copy"})]})}),r&&I.jsxs("button",{onClick:n,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors hover:bg-[var(--bg-hover)] theme-transition",style:{color:"var(--text-tertiary)"},title:"Regenerate response",children:[I.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[I.jsx("polyline",{points:"23 4 23 10 17 10"}),I.jsx("polyline",{points:"1 20 1 14 7 14"}),I.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]}),I.jsx("span",{children:"Regenerate"})]})]})},W$=fe.memo(({messages:e,onSend:t,onRegenerate:n,isGenerating:r,onRetry:i,retryingIndex:s})=>{const o=H.useMemo(()=>e.map((c,d)=>{if(c.type==="request"){const{clean:m,attachments:p}=iu(c.content),v=/[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/.test(m);return I.jsx("div",{className:`flex mb-4 ${v?"justify-start":"justify-end"}`,children:I.jsxs("div",{className:"max-w-[85%] md:max-w-[75%]",children:[p.length>0&&I.jsx("div",{className:"mb-1",children:I.jsx(G$,{attachments:p})}),m&&I.jsx("div",{className:"px-4 py-2 rounded-3xl shadow-sm theme-transition",style:{backgroundColor:"var(--msg-user-bg)",color:"var(--text-primary)"},children:I.jsx("div",{dir:"auto",className:"text-[15px] leading-relaxed whitespace-pre-wrap",children:m})})]})},d)}const f=c.type==="response"&&d===e.length-1&&!r;return I.jsx("div",{className:"flex mb-4 justify-start group",children:I.jsx("div",{className:"w-full",children:c.error?I.jsx(V$,{error:c.error,onRetry:()=>i(d),isRetrying:s===d}):I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"prose prose-sm max-w-none",children:[I.jsx(Zb,{markdown:c.content,onSend:t}),c.content===""&&I.jsx("div",{className:"h-4 w-32 rounded animate-pulse",style:{backgroundColor:"var(--bg-tertiary)"}})]}),c.content&&c.content!==""&&I.jsx(K$,{message:c,onRegenerate:()=>n(d),isLastAssistant:f})]})})},d)}),[e,t,n,r,i,s]);return I.jsx("div",{className:"space-y-1",children:o})}),X$=({file:e,onRemove:t})=>{const[n,r]=H.useState(null),i=e.type.startsWith("image/");return H.useEffect(()=>{if(!i)return;const s=new FileReader;s.onloadend=()=>r(String(s.result)),s.readAsDataURL(e)},[e,i]),I.jsxs("div",{className:"group inline-flex items-start gap-2 rounded-xl shadow-sm px-2.5 py-1 theme-transition",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-primary)"},title:e.name,children:[I.jsx("div",{className:"w-10 h-10 rounded-md overflow-hidden flex items-center justify-center",style:{backgroundColor:"var(--bg-tertiary)"},children:i&&n?I.jsx("img",{src:n,alt:e.name,className:"w-full h-full object-cover"}):I.jsx("span",{className:"text-xs",children:"📄"})}),I.jsxs("div",{className:"min-w-0 leading-tight",children:[I.jsx("div",{className:"text-xs font-medium truncate max-w-[100px]",style:{color:"var(--text-primary)"},children:e.name}),I.jsx("div",{className:"text-xs text-left",style:{color:"var(--text-tertiary)"},children:mf(e.size)})]}),I.jsx("button",{onClick:t,className:"ml-1 h-5 w-5 rounded-full grid place-items-center hover:bg-[var(--bg-hover)] theme-transition",style:{backgroundColor:"var(--bg-tertiary)",color:"var(--text-secondary)"},"aria-label":"Remove attachment",children:I.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:I.jsx("path",{d:"M9 3L3 9M3 3L9 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})},Q$=({error:e,onDismiss:t})=>(H.useEffect(()=>{const n=setTimeout(t,5e3);return()=>clearTimeout(n)},[t]),I.jsx("div",{className:"fixed bottom-40 left-1/2 transform -translate-x-1/2 bg-red-50 border border-red-200 rounded-xl shadow-lg px-4 py-3 min-w-[320px] max-w-[90vw] z-50 animate-in slide-in-from-bottom-2 duration-300",children:I.jsxs("div",{className:"flex items-start gap-3",children:[I.jsx("div",{className:"flex-shrink-0 mt-0.5",children:I.jsxs("svg",{className:"h-5 w-5 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[I.jsx("circle",{cx:"12",cy:"12",r:"10"}),I.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),I.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),I.jsxs("div",{className:"flex-1 min-w-0",children:[I.jsx("p",{className:"text-sm font-medium text-red-900",children:"Upload Error"}),I.jsx("p",{className:"text-sm text-red-700 mt-1",children:e})]}),I.jsx("button",{onClick:t,className:"flex-shrink-0 text-red-400 hover:text-red-600 transition-colors","aria-label":"Dismiss",children:I.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",children:I.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})),Z$=({onSend:e,isLoading:t=!1,onStop:n,disabled:r=!1,onUpgradeClick:i,sidebarWidth:s=0})=>{const[o,c]=H.useState(""),[d,f]=H.useState([]),[m,p]=H.useState(!1),[v,_]=H.useState(null),[S,x]=H.useState(!1),C=H.useRef(null),w=H.useRef(null),O=H.useRef(0);H.useEffect(()=>{const W=()=>p(window.innerWidth<=768);return W(),window.addEventListener("resize",W),()=>window.removeEventListener("resize",W)},[]);const D=H.useCallback(W=>{if(r)return;const G=[];for(const se of W){const de=$$(se);if(de.valid)G.push(se);else{_(de.error);break}}G.length>0&&f(se=>[...se,...G])},[r]);H.useEffect(()=>{const W=ye=>{ye.preventDefault(),ye.stopPropagation(),!r&&(O.current++,ye.dataTransfer.types.includes("Files")&&x(!0))},G=ye=>{ye.preventDefault(),ye.stopPropagation(),O.current--,O.current===0&&x(!1)},se=ye=>{ye.preventDefault(),ye.stopPropagation()},de=ye=>{if(ye.preventDefault(),ye.stopPropagation(),x(!1),O.current=0,r)return;const Z=Array.from(ye.dataTransfer.files||[]);Z.length>0&&D(Z)};return document.addEventListener("dragenter",W),document.addEventListener("dragleave",G),document.addEventListener("dragover",se),document.addEventListener("drop",de),()=>{document.removeEventListener("dragenter",W),document.removeEventListener("dragleave",G),document.removeEventListener("dragover",se),document.removeEventListener("drop",de)}},[D,r]),H.useEffect(()=>{const W=G=>{var Z;if(r||!(document.activeElement===w.current))return;const ye=Array.from(((Z=G.clipboardData)==null?void 0:Z.items)||[]).filter(ne=>ne.type.startsWith("image/"));if(ye.length>0){G.preventDefault();const ne=ye.map(X=>X.getAsFile()).filter(X=>X!==null);ne.length>0&&D(ne)}};return document.addEventListener("paste",W),()=>document.removeEventListener("paste",W)},[D,r]);const j=()=>{var W;r||(W=C.current)==null||W.click()},F=W=>{if(r)return;const G=Array.from(W.target.files||[]);D(G),W.target.value=""},B=W=>f(G=>G.filter((se,de)=>de!==W)),ee=async()=>{t||r||(e({text:o,files:d}),c(""),f([]))},J=W=>{W.key==="Enter"&&!W.shiftKey&&!m&&!t&&!r&&(W.preventDefault(),ee())};return I.jsxs(I.Fragment,{children:[v&&I.jsx(Q$,{error:v,onDismiss:()=>_(null)}),S&&!r&&I.jsx("div",{className:"fixed inset-0 z-50 backdrop-blur-sm flex items-center justify-center pointer-events-none",style:{backgroundColor:"var(--bg-overlay)"},children:I.jsx("div",{className:"rounded-2xl shadow-2xl p-8 max-w-md mx-4 border-2 border-dashed theme-transition",style:{backgroundColor:"var(--bg-primary)",borderColor:"var(--text-primary)"},children:I.jsxs("div",{className:"text-center",children:[I.jsx("div",{className:"mx-auto w-16 h-16 rounded-full flex items-center justify-center mb-4",style:{backgroundColor:"var(--bg-tertiary)"},children:I.jsx("svg",{className:"w-8 h-8",style:{color:"var(--text-primary)"},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:I.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})})}),I.jsx("h3",{className:"text-lg font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Drop files to upload"}),I.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:"Images, PDFs, and text files supported"}),I.jsxs("p",{className:"text-xs mt-2",style:{color:"var(--text-tertiary)"},children:["Max ",mf(Za.MAX_FILE_BYTES)," per file"]})]})})}),I.jsx("div",{className:"fixed right-0 z-40 transition-all duration-300 ease-in-out bottom-[max(0.75rem,env(safe-area-inset-bottom))] md:bottom-[max(1rem,env(safe-area-inset-bottom))]",style:{left:m?"0px":`${s}px`},children:I.jsxs("div",{className:"mx-auto max-w-3xl px-3 md:px-4",children:[I.jsxs("div",{className:`cursor-text rounded-3xl relative p-0 pt-1 backdrop-blur-xl w-full theme-transition ${r?"opacity-75":""}`,style:{backgroundColor:"var(--input-bg)",border:"1px solid var(--border-primary)"},children:[d.length>0&&I.jsx("div",{className:"px-3 pt-3",children:I.jsx("div",{className:"flex flex-wrap gap-2",children:d.map((W,G)=>I.jsx(X$,{file:W,onRemove:()=>B(G)},G))})}),I.jsxs("div",{className:"px-3 pb-3 pt-2",children:[I.jsx("textarea",{ref:w,className:`w-full resize-none border-0 bg-transparent focus:ring-0 focus:outline-none text-base leading-6 max-h-40 mb-2 disabled:opacity-50 disabled:cursor-not-allowed ${r?"cursor-not-allowed":""}`,style:{color:"var(--text-primary)",caretColor:"var(--accent-primary)"},dir:"auto",autoFocus:!r,tabIndex:0,rows:Math.max(1,Math.min(6,o.split(`
384
384
  `).length)),placeholder:r?"Upgrade to continue chatting...":t?"Waiting for response...":"What's on your mind?",onChange:W=>c(W.target.value),onKeyDown:J,value:o,disabled:t||r}),I.jsxs("div",{className:"flex items-center gap-2",children:[I.jsx("button",{onClick:j,disabled:r,className:`rounded-full w-8 h-8 inline-flex items-center justify-center p-1 theme-transition ${r?"opacity-50 cursor-not-allowed":"hover:bg-[var(--bg-hover)] active:scale-[0.98]"}`,style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-primary)",color:"var(--text-primary)"},"aria-label":"Attach file",title:r?"Upgrade to attach files":"Attach files",children:I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:I.jsx("path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"})})}),I.jsx("input",{ref:C,type:"file",multiple:!0,className:"hidden",onChange:F,accept:".jpg,.jpeg,.png,.webp,.pdf,.txt,.md,.csv",disabled:r}),I.jsx("div",{className:"flex-1"}),t&&!r&&I.jsx("button",{onClick:n,className:"rounded-full hover:bg-[var(--bg-hover)] active:scale-95 transition-all inline-flex items-center justify-center w-8 h-8 flex-shrink-0 theme-transition",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border-primary)",color:"var(--text-primary)",boxShadow:"var(--shadow-sm)"},"aria-label":"Stop generating",title:"Stop",children:I.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:I.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),r&&I.jsxs("button",{onClick:i,className:"rounded-full bg-gradient-to-r from-blue-600 to-indigo-600 text-white hover:from-blue-700 hover:to-indigo-700 active:scale-[0.98] transition-all inline-flex items-center justify-center gap-1.5 px-4 h-9 flex-shrink-0 shadow-md font-medium text-sm","aria-label":"Upgrade to continue",title:"Upgrade",children:[I.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:I.jsx("path",{fillRule:"evenodd",d:"M11.3 1.046A1 1 0 0112 2v5h4a1 1 0 01.82 1.573l-7 10A1 1 0 018 18v-5H4a1 1 0 01-.82-1.573l7-10a1 1 0 011.12-.38z",clipRule:"evenodd"})}),"Upgrade"]}),!t&&!r&&I.jsx("button",{onClick:ee,disabled:t,className:"rounded-full hover:opacity-90 active:scale-[0.98] inline-flex items-center justify-center w-9 h-9 flex-shrink-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100 theme-transition",style:{backgroundColor:"var(--btn-primary-bg)",color:"var(--btn-primary-text)"},"aria-label":"Send message",title:"Send",children:I.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:I.jsx("path",{d:"M8.99992 16V6.41407L5.70696 9.70704C5.31643 10.0976 4.68342 10.0976 4.29289 9.70704C3.90237 9.31652 3.90237 8.6835 4.29289 8.29298L9.29289 3.29298L9.36907 3.22462C9.76184 2.90427 10.3408 2.92686 10.707 3.29298L15.707 8.29298L15.7753 8.36915C16.0957 8.76192 16.0731 9.34092 15.707 9.70704C15.3408 10.0732 14.7618 10.0958 14.3691 9.7754L14.2929 9.70704L10.9999 6.41407V16C10.9999 16.5523 10.5522 17 9.99992 17C9.44764 17 8.99992 16.5523 8.99992 16Z"})})})]})]})]}),r&&I.jsx("p",{className:"text-xs text-center mt-2",style:{color:"var(--text-tertiary)"},children:"You've reached your free message limit"})]})}),I.jsx("style",{children:`
385
385
  textarea::placeholder {
386
386
  color: var(--text-muted);
@@ -13,10 +13,16 @@
13
13
  rel="stylesheet"
14
14
  href="https://esm.sh/katex@0.16.8/dist/katex.min.css"
15
15
  />
16
- <script type="module" crossorigin src="/assets/index-Dmj4n8HV.js"></script>
16
+ <script type="module" crossorigin src="/assets/index-qVg4Gbap.js"></script>
17
17
  <link rel="stylesheet" crossorigin href="/assets/index-DWGS8zpa.css">
18
18
  </head>
19
19
  <body style="overflow-x: hidden">
20
20
  <div id="root"></div>
21
+
22
+ <script>
23
+ tailwind.config = {
24
+ darkMode: "class",
25
+ };
26
+ </script>
21
27
  </body>
22
28
  </html>
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycls"
3
- version = "0.0.2.61"
3
+ version = "0.0.2.62"
4
4
 
5
5
  packages = [{ include = "cycls" }]
6
6
  include = ["cycls/theme/**/*"]
File without changes
File without changes
File without changes
File without changes
File without changes