@alook/app 0.1.50 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{30qoc1hjiiq3k.js → 1jx9uko6o9coe.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{1axh15n8g62z0.js → 429glkc3c1-9s.js} +1 -1
- package/bundled/web/.open-next/assets/sw.js +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/1ac71fc16c24600253696ffa2528949094f971f5409b0b353b2b775b5e1ba07d/$/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/1bed1e66296c30f872c79a9d7a9f1e3d0c64330487b6a2bc0b0a70a1cb9db209/$/pricing-concept.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/262c312bb5d1afefa398e2fcec0b194edf7d1699350d9ddc0854afd32c80fac4/$/privacy.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/40dbf01fd0ea61688c1722eb63c7f79a732cb4edb713c7f704d9d90a28905f65/$/pricing.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/41da0ef926a63354a29f601d8e8d0a5951196c45ebcd28b7d4708fb7f56f3bf1/$/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/9f6673da828d5ea3f28468b92951f9b0cf3d882ef027b96881eec8180df19274/$/contact.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/d8a5a23e7fdfb7e80b702b0046a134a514b8cc7e36ca2d7c3e46409f998defa8/$/onboarding-preview.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_PAGE/ef3c10e78c664127cb53564ae0fbe189780ae84d395dedddfc5e4e2794dcd5bf/$/device.cache +1 -1
- package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_ROUTE/b6ae7108b9aee28c54a722040ebed7e5dadc9c10505798ef8e5b6bc2418ded3b/$/serwist/sw.js.cache +1 -1
- package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
- package/bundled/web/.open-next/cloudflare/init.js +1 -1
- package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
- package/bundled/web/.open-next/middleware/handler.mjs +4 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +41 -41
- package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/required-server-files.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/channels/[serverId]/[channelId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/channels/[serverId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/channels/[serverId]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/me/[dmId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/me/bots/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/me/friends/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/me/machines/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/me/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/messages/[messageId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/onboarding-preview/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/@sidebar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/channels/[serverId]/[channelId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/channels/[serverId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/channels/[serverId]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/[dmId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/bots/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/friends/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/machines/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/me/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/messages/[messageId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/onboarding-preview/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/c/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0_yml06_9jkq8._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0o6wy7fmlfj85._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0sksyrwxprmz8._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0sqen1ofvh6kf._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0tiehlvavpqdx._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0uaa0i577fau8._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +41 -41
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/preview-props.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +8 -8
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +62 -62
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +4 -4
- package/dist/daemon/index.js +507 -23
- package/package.json +1 -1
- /package/bundled/web/.open-next/assets/_next/static/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_ROUTE/adb2ea089a587cf57dd95fa5b11714bc555600b8777692e029801fce568a54ac/$/favicon.ico.cache +0 -0
- /package/bundled/web/.open-next/cache/{jeHai-9i1Q5xfGAQC4eaI → HJ8-qam47X4qCtSN6LGen}/route-cache/APP_ROUTE/b31ae3d9b9e8ea6feaa1c6f14779da7794807da6a349f9246abaa4e2d2a615c7/$/robots.txt.cache +0 -0
package/bundled/web/.open-next/assets/_next/static/chunks/{30qoc1hjiiq3k.js → 1jx9uko6o9coe.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,[520332,e=>{var t=e.i(885373);let n={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};n.node;let a=(0,t.f)(n);e.s(["f",0,a])},299668,31163,e=>{var t=e.i(885373);let n={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],299668);var r=e.i(742547),i=e.i(18745),s=e.i(378369),o=e.i(183899),l=e.i(622435),c=e.i(919391),u=e.i(975210);let d="inboxThreadOpener",f=0;e.s(["H",0,d,"x",0,function(e,t){let n="u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():(f+=1,`opener-${f}`);(0,u.U)(e,{...t,nonce:n});let a=(0,l.O)(t.serverId,t.childChannelId);return`${a}?${d}=${encodeURIComponent(n)}`},"W",0,function(e){(0,u.g)(e)},"u",0,function(e){let t=(0,s.d)(),n=(0,o.$)(),a=(0,i.useRouter)(),f=(0,i.useSearchParams)(),m=(0,r.useRef)(null),h=(0,r.useRef)(null),p=(0,r.useRef)(0);(0,r.useLayoutEffect)(()=>{if(!e||h.current===e.nonce)return;m.current&&((0,c.I)(m.current),m.current=null,h.current=null);let r=(0,u.L)(t,e.nonce);if(!r||r.serverId!==e.serverId||r.parentChannelId!==e.parentChannelId||r.childChannelId!==e.childChannelId||r.openerMessageId!==e.openerMessageId||r.openerSeq!==e.openerSeq)return void(0,u.m)(t,e.nonce);let i=(0,c.i)(t,n.id,{kind:"timeline",channelId:r.parentChannelId},0,"cancel-uncommitted"),s=(0,c.M)(i,{kind:"timeline",channelId:r.parentChannelId,messageId:r.openerMessageId,seq:r.openerSeq});if(null===s){(0,c.I)(i),(0,u.m)(t,r.nonce);return}m.current=i,h.current=r.nonce,(0,u.A)(t,r.nonce,s);let o=f.toString(),p=`${(0,l.O)(r.serverId,r.childChannelId)}${o?`?${o}`:""}`;a.replace((0,l.r)(p,d),{scroll:!1})},[n.id,t,a,f,e]),(0,r.useLayoutEffect)(()=>(p.current+=1,()=>{let e=++p.current,t=m.current;t&&queueMicrotask(()=>{p.current===e&&m.current===t&&(m.current=null,h.current=null,(0,c.I)(t))})}),[t])},"Z",0,function({serverId:e,childChannelId:t,parentChannelId:n,openerMessageId:a,lifecycle:o}){let c=(0,s.d)(),f=(0,i.useRouter)(),m=(0,i.usePathname)(),h=(0,i.useSearchParams)(),p=h.get(d),g=p?(0,u.L)(c,p):null,v=(0,r.useCallback)(()=>{if(!p)return;let n=h.toString(),a=`${(0,l.O)(e,t)}${n?`?${n}`:""}`;f.replace((0,l.r)(a,d),{scroll:!1})},[t,p,f,h,e]),y=!!g&&g.serverId===e&&g.childChannelId===t,b=m===(0,l.O)(e,t),x=y&&"ready"===o&&g.parentChannelId===n&&g.openerMessageId===a;return(0,r.useLayoutEffect)(()=>{if(!p||!b)return;let n=(0,u.r)(c,p,e,t);return()=>(0,u.y)(n)},[t,p,c,b,e]),(0,r.useLayoutEffect)(()=>{if(p&&b&&(!y||"terminal-error"===o||"ready"===o&&!x)){(0,u.m)(c,p),v();return}},[x,v,o,p,c,b,y]),b&&x&&g?g:null}],31163)},925535,e=>{var t=e.i(885373);let n={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],925535)},672750,391490,e=>{var t=e.i(885373);let n={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],672750);let r={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};r.node;let i=(0,t.f)(r);e.s(["f",0,i],391490)},856347,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0});var a={bindSnapshot:function(){return u},createAsyncLocalStorage:function(){return l},createSnapshot:function(){return d},getOrCreateGlobalAsyncLocalStorage:function(){return c}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let i=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class s{disable(){throw i}getStore(){}run(){throw i}exit(){throw i}enterWith(){throw i}static bind(e){return e}}let o="u">typeof globalThis&&globalThis.AsyncLocalStorage;function l(){return o?new o:new s}function c(e){let t=Symbol.for(`@next/${e}@16.4.0`),n=globalThis;return n[t]??=l()}function u(e){return o?o.bind(e):s.bind(e)}function d(){return o?o.snapshot():function(e,...t){return e(...t)}}},951088,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,e.r(856347).getOrCreateGlobalAsyncLocalStorage)("work-async-storage")},121974,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=e.r(951088)},288423,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return r}});let a=e.r(836437)._(e.r(120252));function r(e,t){let n={};"function"==typeof e&&(n.loader=e);let r={...n,...t};return(0,a.default)({...r,modules:r.loadableGenerated?.modules})}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},877472,(e,t,n)=>{function a(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"encodeURIPath",{enumerable:!0,get:function(){return a}})},659660,(e,t,n)=>{e.i(648378),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BailoutToCSRForNextDynamic",{enumerable:!0,get:function(){return s}});let a=e.r(742547),r=e.r(727854);e.r(768694);let i=e.r(326327).createReactBrowserBailoutReason.bind(null,"next/dynamic");function s({children:e}){return(0,a.use)((0,r.browser)(i)),e}},120252,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return c}});let a=e.r(895231),r=e.r(742547),i=e.r(659660),s=e.r(112435);function o(e){return{default:e&&"default"in e?e.default:e}}let l={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},c=function(e){let t={...l,...e},n=(0,r.lazy)(()=>t.loader().then(o)),c=t.loading;function u(e){let o=c?(0,a.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,l=!t.ssr||!!t.loading,u=l?r.Suspense:r.Fragment,d=t.ssr?(0,a.jsxs)(a.Fragment,{children:["u"<typeof window?(0,a.jsx)(s.PreloadChunks,{moduleIds:t.modules}):null,(0,a.jsx)(n,{...e})]}):(0,a.jsx)(i.BailoutToCSRForNextDynamic,{children:(0,a.jsx)(n,{...e})});return(0,a.jsx)(u,{...l?{fallback:o}:{},children:d})}return u.displayName="LoadableComponent",u}},112435,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"PreloadChunks",{enumerable:!0,get:function(){return l}});let a=e.r(895231),r=e.r(727854),i=e.r(121974),s=e.r(877472),o=e.r(535150);function l({moduleIds:e}){if("u">typeof window)return null;let t=i.workAsyncStorage.getStore();if(void 0===t)return null;let n=[];if(t.reactLoadableManifest&&e){let a=t.reactLoadableManifest;for(let t of e){if(!a[t])continue;let e=a[t].files;n.push(...e)}}if(0===n.length)return null;let c=(0,o.getAssetTokenQuery)();return(0,a.jsx)(a.Fragment,{children:n.map(e=>{let n=`${t.assetPrefix}/_next/${(0,s.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,a.jsx)("link",{precedence:"dynamic",href:n,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,r.preload)(n,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},326327,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0});var a={createReactBrowserBailoutReason:function(){return s},getReactBrowserBailoutReason:function(){return o},isNextBrowserBailoutError:function(){return l}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let i=Symbol.for("next.browser-bailout-reason");function s(e){return{$$typeof:i,reason:e}}function o(e){let t=e?.cause;return t?.$$typeof===i?t.reason:void 0}function l(e){return void 0!==o(e)}},200069,e=>{var t=e.i(895231),n=e.i(742547),a=e.i(18745),r=e.i(695230),i=e.i(282371),s=e.i(378369),o=e.i(777104),l=e.i(561261),c=e.i(374402),u=e.i(474707),d=e.i(152845),f=e.i(18291),m=e.i(581971);function h(e){return e.state.isPaused}function p(e){return"success"===e.state.status}let g=["added","removed","updated"];function v(e){return g.includes(e)}async function y({queryClient:e,persister:t,maxAge:n=864e5,buster:a="",hydrateOptions:r}){try{let s=await t.restoreClient();if(s)if(!s.timestamp)return t.removeClient();else{var i;let o,l,c,u=Date.now()-s.timestamp>n,d=s.buster!==a;if(u||d)return t.removeClient();i=s.clientState,o=e.getMutationCache(),l=e.getQueryCache(),c=r?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData,i.mutations?.forEach(({state:t,...n})=>{o.build(e,{...e.getDefaultOptions().hydrate?.mutations,...r?.defaultOptions?.mutations,...n},t)}),i.queries?.forEach(({queryKey:t,state:n,queryHash:a,meta:i,promise:s,dehydratedAt:o,queryType:u})=>{let d=s?function(e){let t;if(e.then(e=>(t=e,e),m.z)?.catch?.(m.z),void 0!==t)return{data:t}}(s):void 0,f=void 0===n.data?d?.data:n.data,h=void 0===f?f:c?c(f):f,p=l.get(a),g=p?.state.status==="pending",v=p?.state.fetchStatus==="fetching";if(p){let e=d&&o>p.state.dataUpdatedAt;if(n.dataUpdatedAt>p.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=n;p.setState({...t,data:h,..."pending"===n.status&&void 0!==h&&{status:"success",dataUpdatedAt:o,...!v&&{fetchStatus:"idle"}}})}}else p=l.build(e,{...e.getDefaultOptions().hydrate?.queries,...r?.defaultOptions?.queries,queryKey:t,queryHash:a,meta:i,_type:u},{...n,data:h,fetchStatus:"idle",status:"pending"===n.status&&void 0!==h?"success":n.status,..."pending"===n.status&&void 0!==h&&{dataUpdatedAt:o}});!s||d||g||v||!(o>p.state.dataUpdatedAt)||p.fetch(void 0,{initialPromise:Promise.resolve(s).then(c)}).catch(m.z)})}}catch(e){throw await t.removeClient(),e}}async function b({queryClient:e,persister:t,buster:n="",dehydrateOptions:a}){let r={buster:n,timestamp:Date.now(),clientState:function(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??h,a=e.getMutationCache().getAll().flatMap(e=>n(e)?[{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}]:[]),r=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??p,i=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors,s=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData;return{mutations:a,queries:e.getQueryCache().getAll().flatMap(e=>{let t;return r(e)?[{dehydratedAt:Date.now(),state:{...e.state,...void 0!==e.state.data&&{data:s?s(e.state.data):e.state.data}},queryKey:e.queryKey,queryHash:e.queryHash,..."pending"===e.state.status&&{promise:(t=e.promise?.then(s).catch(e=>i?.(e)===!1?Promise.reject(e):Promise.reject(Error("redacted"))),t?.catch(m.z),t)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}]:[]})}}(e,a)};await t.persistClient(r)}let x=({children:e,persistOptions:a,onSuccess:r,onError:i,...o})=>{let[l,c]=n.useState(!0),u=n.useRef({persistOptions:a,onSuccess:r,onError:i}),d=n.useRef(!1);return n.useEffect(()=>{u.current={persistOptions:a,onSuccess:r,onError:i}}),n.useEffect(()=>{let e,t,n={...u.current.persistOptions,queryClient:o.client};return d.current||(d.current=!0,y(n).then(()=>u.current.onSuccess?.()).catch(()=>u.current.onError?.()).finally(()=>{c(!1)})),l?void 0:(e=n.queryClient.getQueryCache().subscribe(e=>{v(e.type)&&b(n)}),t=n.queryClient.getMutationCache().subscribe(e=>{v(e.type)&&b(n)}),()=>{e(),t()})},[o.client,l]),(0,t.jsx)(s.P,{...o,children:(0,t.jsx)(f.o,{value:l,children:e})})};var w=e.i(583262),k=e.i(636557),j=e.i(423360),C=e.i(526822),I=e.i(919391),S=e.i(177519),N=e.i(152961),P=e.i(23055),E=e.i(556125),M=e.i(204779),A=e.i(86694),O=e.i(323512),R=e.i(279389),D=e.i(280958),L=e.i(334016),z=e.i(645980);function T(){let e;return{ready:new Promise(t=>{e=t}),release:e}}function q({children:e,onRestoreComplete:a,queryClient:i,registry:s}){let o=(0,f.B)(),l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{null!==l.current&&(clearTimeout(l.current),l.current=null);let e=(0,r.r)(s);return()=>{l.current=setTimeout(()=>{l.current=null,e(),i.cancelQueries().catch(e=>{(0,k.c)(e)||console.error("Community query cancellation failed",e)}),(0,I.z)(i),(0,C.m)(i),(0,S.n)(i),s.cleanup().finally(()=>i.clear()).catch(e=>{(0,k.c)(e)||console.error("Community collection cleanup failed",e)})},0)}},[i,s]),(0,n.useLayoutEffect)(()=>{if(!o)return a(),(0,O.vI)(i,s)},[o,a,i,s]),(0,t.jsx)(A.s,{registry:s,children:e})}function K(e){let n=(0,P.U)();return(0,t.jsx)($,{...e,session:n,sessionViewer:P.b},e.userId??"anon")}function $({children:e,userId:i,initialUser:s,session:o,sessionViewer:l}){let[u]=(0,n.useState)(()=>{let e=(0,w.f)();return s&&s.id===i&&e.setQueryData(c.f.communityDbCollection(i,"profiles"),[R.S.parse({id:i,name:s.name,discriminator:s.discriminator||null,...s.avatar===(0,D.f)(s.name)?{}:{avatar:s.avatar},avatarVersion:s.avatarVersion,identityComplete:!!s.discriminator&&s.avatar!==(0,D.f)(s.name)&&void 0!==s.avatarVersion,aboutMe:s.aboutMe,statusEmoji:s.statusEmoji,statusText:s.statusText})],{updatedAt:0}),e}),[d]=(0,n.useState)(T),[f]=(0,n.useState)(()=>(0,r.M)(u,i,{waitForRestore:d.ready})),m=(0,n.useMemo)(()=>i?(0,S.z)(u,i):null,[u,i]);(0,n.useEffect)(()=>{if(m)return m.setReconcileScheduler(()=>{u.invalidateQueries({queryKey:c.f.inboxUnreads(),exact:!0}),u.invalidateQueries({queryKey:c.f.inboxMentions(),exact:!0}),u.invalidateQueries({queryKey:c.f.dms(),exact:!0}),u.invalidateQueries({queryKey:c.f.servers(),exact:!0}),u.invalidateQueries({predicate:({queryKey:e})=>(0,c.I)(e)})}),()=>m.setReconcileScheduler(null)},[u,m]);let[h]=(0,n.useState)(()=>(0,j.h)(i)),p=(0,N.f)(f.runtime.lifecycle,e=>e.active),g=(0,a.useRouter)();(0,n.useLayoutEffect)(()=>{f.bindAuthentication(l,h.retireAccount,h.retireChannels)},[f,l,h]);let v=(0,n.useRef)(()=>void 0);(0,n.useLayoutEffect)(()=>{(0,z.Z)(i),v.current=(0,z.Y)()},[i]);let y=(0,n.useRef)(!1),b=!o.isPending&&!o.error&&o.data?.user.id!==i;(0,n.useLayoutEffect)(()=>(f.authenticationView.setState(e=>({...e,active:!0})),()=>{f.authenticationView.setState(e=>({active:!1,generation:e.generation+1}));let e=f.sessionViewer();void 0!==e&&e!==f.accountId&&((0,M.d)(f),d.release(),f.retireDisk().catch(()=>void 0))}),[f,d]),(0,n.useLayoutEffect)(()=>{!b||(o.data?.user.id||l?.()!==null||v.current(),y.current||(y.current=!0,d.release(),(0,M.d)(f),f.retireDisk().catch(()=>void 0),o.data?.user.id?g.refresh():g.replace("/sign-in")))},[f,b,d,g,o.data?.user.id,l,i]);let k=(0,n.useCallback)(()=>{f.runtime.lifecycle.get().active&&((0,M.d)(f),window.location.reload())},[f]);(0,E.f)(h,k);let C=()=>{(d.release(),f.runtime.lifecycle.get().active)?(f.captureRestoredCollections(),f.runtime.ws.get().profileViewerId!==i&&f.runtime.ws.actions.activateProfileAccount(i)):u.clear()};return(0,t.jsx)(x,{client:u,onSuccess:()=>{f.runtime.lifecycle.get().active?(0,L.F)(h):(0,L.l)(h),C(),f.runtime.lifecycle.get().active&&Promise.all([u.invalidateQueries({queryKey:c.f.servers(),exact:!0,refetchType:"active"}),u.invalidateQueries({queryKey:c.f.folders(),exact:!0,refetchType:"active"}),u.invalidateQueries({queryKey:c.f.dms(),exact:!0,refetchType:"active"}),u.invalidateQueries({predicate:({queryKey:e})=>(0,c.I)(e),refetchType:"active"})])},onError:()=>{(0,L.l)(h),C()},persistOptions:{persister:h,maxAge:j.j,buster:j.M,dehydrateOptions:{shouldDehydrateQuery:e=>"success"===e.state.status&&(0,j.i)(e.queryKey,e.state.data)}},children:p&&!b?(0,t.jsxs)(q,{onRestoreComplete:d.release,queryClient:u,registry:f,children:[e,null]}):null})}var F=e.i(183899),U=e.i(956832),_=e.i(718877),B=e.i(50271),V=e.i(115870),W=e.i(239706);function H(){return(0,n.useEffect)(()=>{(0,V.f)()&&(0,W.f)().catch(()=>{})},[]),null}var Y=e.i(950262),Q=e.i(443178),G=e.i(10209),X=e.i(193497),J=e.i(51201),Z=e.i(344920),ee=e.i(366020),et=e.i(597574),en=e.i(885373);let ea={name:"briefcase-business",size:24,node:[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]};ea.node;let er=(0,en.f)(ea),ei={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};ei.node;let es=(0,en.f)(ei);var eo=e.i(520332),eo=eo;let el={name:"rocket",size:24,node:[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]};el.node;let ec=(0,en.f)(el),eu=[{value:"claude",label:"Claude Code",provider:"claude"},{value:"codex",label:"Codex",provider:"codex"},{value:"grok",label:"Grok Build",provider:"grok"},{value:"cursor",label:"Cursor",provider:"cursor"},{value:"opencode",label:"OpenCode",provider:"opencode"},{value:"pi",label:"Pi",provider:"pi"}],ed=[{value:"office",label:"Work",icon:er,accentKey:"work"},{value:"developer",label:"Software development",icon:es,accentKey:"code"},{value:"founder",label:"Building a company",icon:ec,accentKey:"rocket"},{value:"home",label:"Home and family",icon:eo.f,accentKey:"coral"}];var ef=e.i(643680),em=e.i(174629),eh=e.i(381153),ep=e.i(60115),eg=e.i(490367);e.i(954194);var ev=e.i(168614),ey=e.i(617527),eb=e.i(186339),ex=e.i(855372),ew=e.i(779646),ek=e.i(609510),ej=e.i(411312);function eC({runtime:e,model:n,onModelChange:a,onContinue:r}){let i=(0,ej.a)(n,e.id),s=eu.find(t=>t.value===e.id)?.label??e.id;return(0,t.jsx)(ew.N,{open:!0,children:(0,t.jsx)(ew.d,{showCloseButton:!1,overlayClassName:"bg-black/20 supports-backdrop-filter:backdrop-blur-sm",className:"max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto border-0 p-0 shadow-(--e2) ring-0 thin-scrollbar sm:max-w-md",children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i||r()},children:[(0,t.jsxs)(ew.s,{className:"gap-4 px-4 pt-4 pb-4 sm:px-6 sm:pt-6 sm:pb-6",children:[(0,t.jsx)("div",{className:"flex gap-1.5","aria-label":"Step 3 of 4",children:[1,2,3,4].map(e=>(0,t.jsx)("span",{className:e<=3?"h-1.5 flex-1 rounded-full bg-primary":"h-1.5 flex-1 rounded-full bg-muted"},e))}),(0,t.jsxs)(ew.F,{className:"flex flex-wrap items-center gap-x-2 text-2xl leading-tight font-semibold tracking-tight",children:[(0,t.jsx)("span",{children:"Choose a model for your"}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[(0,t.jsx)(ex.z,{provider:e.id,className:"size-5"}),s]})]}),(0,t.jsx)(ew.C,{children:"Your team’s bots will use this model. You can change it for each bot later."})]}),(0,t.jsx)("div",{className:"px-4 pb-4 sm:px-6 sm:pb-6",children:(0,t.jsx)(ek.f,{runtime:e,value:n,onChange:a,error:n?i:void 0})}),(0,t.jsx)(ew.c,{className:"m-0 rounded-none border-0 bg-transparent px-4 py-4 sm:px-6",children:(0,t.jsx)(eb.K,{type:"submit",className:"h-11 min-h-11 w-full sm:h-9 sm:min-h-9 sm:w-auto",disabled:!!i,children:"Continue"})})]})})})}function eI(){let e=(0,u.F)(),r=(0,a.usePathname)(),i=(0,F.$)(),f=(0,ee.E)(),m=(0,s.d)(),h=(0,X.f)(),p=JSON.stringify([f?.machineId,f?.harness,f?.identity,f?.model]),g=(0,J.f)(`onboarding:${p}`,f?.stage==="initializing"),[v,y]=(0,o.f)((0,l.f)("")),[b,x]=(0,o.f)((0,l.f)("")),[w,k]=(0,o.f)((0,l.f)("")),[j,C]=(0,o.f)((0,l.f)(null)),I=(0,ev.G)(f?.harness),S=I?4:3,{machines:N}=(0,ey.t)({enabled:f?.stage==="model"}),P=N.find(e=>e.id===f?.machineId)?.availableRuntimes.find(e=>e.id===f?.harness);(0,n.useEffect)(()=>{C(null)},[f?.machineId,f?.harness,C]);let E=["community","onboarding-initialization",p],M=(0,G.Z)({filters:{mutationKey:E,status:"pending"},select:e=>e.mutationId}),A=(0,Q.f)({meta:{observabilityAction:"community.onboarding.initialize"},mutationKey:E,scope:{id:JSON.stringify(E)},mutationFn:async({token:t,profileSnapshot:n,assert:a,input:r})=>{a();let i=(0,ee.O)(e),s=await (0,em.l)({...r,checkpoint:i?.initialization?.checkpoint,onCheckpoint:t=>{a(),(0,ee.t)(e,e=>({...e,checkpoint:t}))},onProgress:t=>{a(),(0,ee.t)(e,e=>({...e,step:t}))},services:{assert:a,request:(e,n)=>h.request(t,e,{...n,signal:a.signal,assertActive:a}),publishBot:(e,t)=>{a(),(0,d.h)([{id:e.id,identityAbout:{name:e.name??t.name,discriminator:e.discriminator,kind:"bot"},avatar:{avatar:e.image??t.image,avatarVersion:e.avatarVersion}}],h.registry,{snapshot:n})},resolveBot:e=>{let t=h.registry?.collections.profiles.get(e);return t?.name===void 0?void 0:{name:t.name,discriminator:t.discriminator??void 0}},readChannels:async e=>{a(),await m.invalidateQueries({queryKey:c.f.servers(),exact:!0}),a();let t={queryKey:c.f.server(e),queryFn:({signal:t})=>(0,Z.Q)(m,e,t)(),staleTime:0},n=new Y.f(m,{...t,enabled:!1}).subscribe(()=>void 0);a.signal.addEventListener("abort",n,{once:!0});try{return a(),await m.query({...t,select:void 0}),a(),[...h.registry.collections.channels.values()].filter(t=>t.serverId===e&&!t.parentChannelId).map(({id:e,name:t,type:n,categoryId:a})=>({id:e,name:t??"",type:n,categoryId:a??null}))}finally{a.signal.removeEventListener("abort",n),n()}}}});return a(),(0,ee.t)(e,e=>({...e,result:s})),await m.invalidateQueries({queryKey:c.f.bots(),exact:!0}),h.assert(t),s}}),O=f?.initialization,R=O?.checkpoint??{},D=O?.step??"creating-bots",L=O?.result??null,z=A.variables?.assert.signal===g.signal?A.error:null,T=z instanceof Error?z.message:"We couldn’t finish setting up your room.",q=L?"success":M.length?"loading":z&&!(z instanceof DOMException&&"AbortError"===z.name)?"error":"idle";(0,n.useEffect)(()=>{let t=O?.pendingDestination;t&&r===t&&(0,ee.L)(e)},[r,O?.pendingDestination,e]);let K=A.mutateAsync,$=(0,n.useCallback)(async()=>{if(M.length||f?.stage!=="initializing"||!f.machineId||!f.harness||!f.identity)return;let e=h.begin(),t=g.capture();t();try{await K({...e,assert:t,input:{machineId:f.machineId,runtime:f.harness,model:f.model,identity:f.identity,userName:i.name,userDiscriminator:i.discriminator}})}catch{}},[M.length,f,h,g,K,i.name,i.discriminator]);if((0,n.useEffect)(()=>{f?.stage==="initializing"&&"idle"===q&&$()},[q,p,f?.stage,g.signal,$]),!f)return null;if("harness"===f.stage)return(0,t.jsx)(ep.f,{open:!0,onOpenChange:()=>void 0,step:{current:1,total:S},stepLabel:"Your harness",title:"Which harness do you already use?",description:"Pick the setup that already runs your bots.",options:[...eu],value:v,onValueChange:y,submitLabel:"Continue",onSubmit:t=>{(0,ee.N)(e,"harness","machine",{harness:t})},testId:eh.f.onboardingHarnessDialog,optionTestId:eh.f.onboardingHarnessOption});if("machine"===f.stage){var U;return(0,t.jsx)(et.f,{open:!0,harness:f.harness??"",harnessLabel:(U=f.harness,eu.find(e=>e.value===U)?.label??"your harness"),totalSteps:S,onConnected:t=>{(0,ee.N)(e,"machine",I?"model":"identity",{machineId:t,model:null})},onChooseAnotherHarness:()=>{y(""),(0,ee.f)(e)},onManageMachines:()=>{(0,ee.M)(e)}})}return"model"===f.stage?(0,t.jsx)(eC,{runtime:P??{id:f.harness},model:j,onModelChange:C,onContinue:()=>(0,ee.N)(e,"model","identity",{model:j})}):"identity"===f.stage?(0,t.jsx)(ep.f,{open:!0,onOpenChange:()=>void 0,step:{current:S,total:S},stepLabel:"About you",title:"Which best describes you?",description:"We’ll shape the room around your work.",options:[...ed],value:b,onValueChange:x,customOption:{value:"custom",label:"Something else",placeholder:"Your role"},customValue:w,onCustomValueChange:k,submitLabel:"Finish setup",onSubmit:t=>{(0,ee.N)(e,"identity","initializing",{identity:t})},testId:eh.f.onboardingIdentityDialog,optionTestId:eh.f.onboardingIdentityOption}):"initializing"===f.stage?(0,t.jsx)(eg.f,{totalSteps:S,status:"idle"===q?"loading":q,currentStep:D,checkpoint:R,detail:"error"===q?T:"success"===q?`${L?.bots.length??0} bots are in your room and ready to work.`:"Follow along as your room comes together.",onRetry:()=>void $(),onContinue:async()=>{if(!L)return;let t=`/c/channels/${L.serverId}/${L.publicChannelId}`,n=g.capture();if(n(),(0,ef.q)(i.id,L.serverId),!e.lifecycle.get().active)return;try{n()}catch{return}let a=e.ui.get().uiHandlers.navigate;a&&((0,ee.t)(e,e=>({...e,pendingDestination:t})),a(L.serverId,L.publicChannelId))}}):null}let eS={name:"wifi-off",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};eS.node;let eN=(0,en.f)(eS);var eP=e.i(381338);function eE({children:e}){let n=(0,eP.f)(e=>e.connectionStatus),a=(0,eP.f)(e=>e.reconnectNow);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"contents",children:e}),"failed"===n&&(0,t.jsxs)("div",{role:"status","aria-live":"polite","aria-atomic":"true","data-testid":eh.f.wsReconnectOverlay,"data-ws-status":n,className:"fixed bottom-4 right-4 z-50 flex max-w-xs items-center gap-3 rounded-lg border bg-popover p-3 text-popover-foreground shadow-(--e2)",children:[(0,t.jsx)("div",{"aria-hidden":"true",className:"grid size-9 shrink-0 place-items-center rounded-md bg-warning/10 text-warning",children:(0,t.jsx)(eN,{className:"size-4"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"font-heading text-sm font-medium",children:"Connection lost"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Cached content is still available."})]}),(0,t.jsx)(eb.K,{type:"button",variant:"secondary","data-testid":eh.f.wsRetry,onClick:a,className:"h-11 shrink-0 sm:h-9",children:"Retry"})]})]})}var eM=e.i(506607),eA=e.i(622435),eO=e.i(636686),eR=e.i(312462);function eD(){let e=(0,a.usePathname)(),t=(0,a.useRouter)(),r=(0,F.$)(),i=(0,s.d)(),o=(0,Z.N)(),l=(0,eA.B)(e),c=(0,N.f)((0,u.A)(i).serverEject,e=>!!l&&e.flushedServerIds.has(l));return(0,n.useEffect)(()=>{l&&c&&(0,eO.X)({serverId:l,servers:o.servers,isSuccess:o.isSuccess,isFetching:o.isFetching,consumeVoluntaryLeave:e=>(0,eO.j)(i,e),clearLastChannel:eR.d,toast:eM.toast,accountId:r.id,routeHref:e,replace:e=>t.replace(e)})},[c,r.id,e,i,t,l,o.servers,o.isSuccess,o.isFetching]),null}function eL({children:e}){let t=(0,f.B)(),a=(0,A.O)(),r=(0,n.useRef)(!1);return(0,n.useLayoutEffect)(()=>{if(t&&!r.current){r.current=!0,performance.mark("alook:restore:start");return}if(t||!r.current)return;performance.mark("alook:restore:complete"),a?.hasRestoredData()===!0&&performance.mark("alook:restore:first-cached-paint");let e=requestAnimationFrame(()=>performance.mark("alook:restore:stable"));return()=>cancelAnimationFrame(e)},[a,t]),e}var ez=e.i(215932);function eT({currentUser:e,children:n}){return(0,t.jsx)(K,{userId:e.id,initialUser:e,children:(0,t.jsx)(eL,{children:(0,t.jsx)(eq,{viewerId:e.id,children:(0,t.jsx)(F.N,{initialUser:e,children:(0,t.jsx)(eK,{children:n})})})})})}function eq({children:e,viewerId:r}){let i=(0,u.F)(),[s,c]=(0,o.f)((0,l.f)(!1)),d=(0,eP.f)(e=>e.profileViewerId),f=(0,a.usePathname)();return(0,n.useLayoutEffect)(()=>{d!==r&&i.ws.actions.activateProfileAccount(r),c(!0)},[d,i.ws.actions,c,r]),s&&d===r?e:(0,t.jsx)(ez.f,{pathname:f})}function eK({children:e}){let n=(0,s.d)(),a=(0,F.$)();(0,_.J)(),(0,B.s)(),(0,U.B)({viewerUserId:a.id});let o=(0,r.D)(n);return(0,i.f)({queryKey:c.f.selfProfile(),queryFn:async({signal:e})=>({id:(await (0,d.x)("/api/community/users/me/profile",e=>[{id:e.id,identityAbout:{name:e.name,discriminator:e.discriminator,aboutMe:e.aboutMe},avatar:{avatar:e.avatar,avatarVersion:e.avatarVersion},status:{statusEmoji:e.statusEmoji,statusText:e.statusText}}],{signal:e},o)).id}),enabled:o?.accountId===a.id,staleTime:3e5}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{}),(0,t.jsxs)(eE,{children:[(0,t.jsx)(eD,{}),(0,t.jsx)(eI,{}),e]})]})}var e$=e.i(932135),eF=e.i(996718),eU=e.i(130826);e.i(563932);var e_=e.i(341604),eB=e.i(8497),eV=e.i(250569),eW=e.i(800989),eH=e.i(274762),eY=e.i(804),eQ=e.i(294656),eG=e.i(392965),eX=e.i(328076),eJ=e.i(849050);let eZ={name:"user",size:24,node:[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]};eZ.node;let e0=(0,en.f)(eZ);var e1=e.i(299668);let e2={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};e2.node;let e4=(0,en.f)(e2);var e5=e.i(672750),e3=e.i(391490),e8=e.i(102503);let e7={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};e7.node;let e9=(0,en.f)(e7);var e6=e.i(149434),te=e.i(925535);let tt={name:"credit-card",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}],["path",{d:"M6 14h2",key:"mk7k0u"}]]};tt.node;let tn=(0,en.f)(tt);var ta=e.i(518071),tr=e.i(520582),ti=e.i(393153),ts=e.i(613349),to=e.i(58231);let tl="October 10, 2026",tc="underline decoration-foreground/30 underline-offset-3 transition-colors hover:decoration-foreground/60";function tu({className:e,showAnalyticsChoices:n=!1}){return(0,t.jsxs)("div",{className:(0,ts.c)(e),"data-privacy-policy":tl,children:[(0,t.jsxs)("p",{className:"mb-12 text-sm text-muted-foreground",children:["Last updated: ",tl]}),(0,t.jsxs)("div",{className:"prose prose-neutral max-w-none space-y-8 text-[1.0625rem] leading-relaxed dark:prose-invert",children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Interpretation and Definitions"}),(0,t.jsxs)("p",{className:"text-foreground/80",children:['In this Privacy Policy, "Company" (referred to as "We", "Us", or "Our") refers to Alook AI. "Service" refers to the Alook platform accessible at'," ",(0,t.jsx)("a",{href:"https://alook.ai",className:tc,children:"alook.ai"}),'. "You" means the individual accessing or using our Service. "Personal Data" is any information that relates to an identified or identifiable individual.']})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Collecting and Using Your Personal Data"}),(0,t.jsx)("h3",{className:"mt-8 mb-3 text-lg font-medium",children:"Types of Data Collected"}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"While using Our Service, We may ask You to provide Us with certain personally identifiable information that can be used to contact or identify You, including but not limited to:"}),(0,t.jsxs)("ul",{className:"mt-3 list-disc space-y-2 pl-6 text-foreground/80",children:[(0,t.jsx)("li",{children:"Email address"}),(0,t.jsx)("li",{children:"Name"}),(0,t.jsx)("li",{children:"Usage data"})]}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Usage Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"Necessary diagnostic data may be processed to keep the Service secure and reliable. Google receives page and feature signals when You use our public website and Blog, even without analytics cookies. Allowing analytics enables analytics cookies and other optional analytics. We do not use ad tracking."}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Information from Third-Party Social Login"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"Alook allows You to create an account and log in through third-party services including Google and GitHub. If You decide to register through or grant us access to a third-party service, We may collect Personal Data already associated with Your account, such as Your name and email address."}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Tracking Technologies and Cookies"}),(0,t.jsxs)("p",{className:"text-foreground/80",children:["We use necessary cookies to provide sign-in, security, and saved preferences. We use optional analytics cookies by default. Your analytics choice is saved in a first-party cookie for 180 days and can be changed using the preference control on the"," ",(0,t.jsx)("a",{href:"/privacy#analytics-choices",className:tc,children:"Privacy page"})," at any time. Choosing only necessary cookies denies analytics cookies; Google still receives signals without analytics cookies on our public website and Blog. Other optional analytics follow the same choice."]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Use of Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"We may use Your Personal Data for the following purposes:"}),(0,t.jsxs)("ul",{className:"mt-3 list-disc space-y-2 pl-6 text-foreground/80",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To provide and maintain our Service"}),", including processing and delivering AI agent tasks on your behalf."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To manage Your Account"})," and provide You with access to functionalities of the Service available to registered users."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To contact You"})," by email or other equivalent forms of electronic communication regarding updates or informative communications related to the Service."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To manage Your requests"})," and attend to any requests You make to Us."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"For business transfers"})," in connection with any merger, sale of company assets, financing, or acquisition of all or a portion of Our business."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"For other purposes"})," such as data analysis, identifying usage trends, and improving our Service."]})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Sharing Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"We may share Your personal information in the following situations:"}),(0,t.jsxs)("ul",{className:"mt-3 list-disc space-y-2 pl-6 text-foreground/80",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"With Service Providers:"})," We share data with third-party AI model providers to power agent capabilities. Data sent to these providers is governed by their respective privacy policies. We minimize the data shared and only send what is necessary to fulfill Your requests."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"For business transfers:"})," In connection with a merger, acquisition, or asset sale, Your Personal Data may be transferred."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"With Your consent:"})," We may disclose Your personal information for any other purpose with Your consent."]})]}),(0,t.jsx)("p",{className:"mt-4 text-foreground/80",children:"We do not sell Your Personal Data to third parties."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Retention of Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"We will retain Your Personal Data only for as long as is necessary for the purposes set out in this Privacy Policy. We will retain and use Your data to the extent necessary to comply with our legal obligations, resolve disputes, and enforce our agreements."}),(0,t.jsx)("p",{className:"mt-4 text-foreground/80",children:"Usage Data is generally retained for a shorter period of time, except when it is used to strengthen security or improve the functionality of Our Service."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Security of Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"The security of Your Personal Data is important to Us. Your data is stored securely using industry-standard encryption. Agent workspaces are isolated per user. However, no method of transmission over the Internet or method of electronic storage is 100% secure. While We strive to use commercially acceptable means to protect Your Personal Data, We cannot guarantee its absolute security."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Children's Privacy"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"Our Service does not address anyone under the age of 13. We do not knowingly collect personally identifiable information from anyone under the age of 13. If You are a parent or guardian and You are aware that Your child has provided Us with Personal Data, please contact Us. If We become aware that We have collected Personal Data from anyone under the age of 13 without verification of parental consent, We will take steps to remove that information."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Your Data Rights"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"You have the right to access, update, or delete Your Personal Data at any time. You can manage certain information through Your Account settings, or contact Us directly to request assistance with these actions."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Changes to This Privacy Policy"}),(0,t.jsx)("p",{className:"text-foreground/80",children:'We may update Our Privacy Policy from time to time. We will notify You of any changes by posting the new Privacy Policy on this page and updating the "Last updated" date at the top. You are advised to review this Privacy Policy periodically for any changes.'})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Contact Us"}),(0,t.jsxs)("p",{className:"text-foreground/80",children:["If you have any questions about this Privacy Policy, You can contact us at"," ",(0,t.jsx)("a",{href:"mailto:support@alook.ai",className:tc,children:"support@alook.ai"}),"."]})]})]}),n?(0,t.jsx)("div",{className:"mt-12",children:(0,t.jsx)(to.AnalyticsPreferenceControl,{})}):null]})}var td=e.i(531342);function tf({label:e,children:n}){return(0,t.jsxs)("fieldset",{className:"min-w-0",children:[(0,t.jsx)("legend",{className:"mb-1.5 text-xs text-muted-foreground",children:e}),n]})}var tm=e.i(751041),th=e.i(228918),tp=e.i(527668),tg=e.i(109762),tv=e.i(690887),ty=e.i(791978);let tb={name:"mail-warning",size:24,node:[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]};tb.node;let tx=(0,en.f)(tb);var tw=e.i(212319),tk=e.i(182149),tj=e.i(577992);async function tC(e){try{switch((await e.json()).error){case"INVALID_OTP":return"That code is incorrect. Try again.";case"OTP_EXPIRED":return"That code expired. Send a new code.";case"TOO_MANY_ATTEMPTS":return"Too many incorrect attempts. Send a new code.";case"RATE_LIMITED":return"Too many requests. Try again when the timer ends.";case"CODE_SEND_FAILED":return"We couldn’t send the code. Try again.";case"ACCOUNT_DELETION_FAILED":return"Your account wasn’t deleted. Try again."}}catch{}return"Something went wrong. Try again."}function tI({email:e,onCancel:a,onDeleted:i}){let[c,u]=(0,o.f)((0,l.f)("notice")),[d,f]=(0,o.f)((0,l.f)("")),[m,h]=(0,o.f)((0,l.f)(0)),[p,g]=(0,o.f)((0,l.f)("")),v=(0,n.useRef)(null),y=(0,n.useRef)(null),b=(0,n.useRef)(null);(0,n.useEffect)(()=>{"code"===c?y.current?.focus():v.current?.focus()},[c]),(0,n.useEffect)(()=>{p&&("code"===c?y.current?.focus():b.current?.focus())},[p,c]),(0,n.useEffect)(()=>{if(m<=0)return;let e=window.setTimeout(()=>{h(e=>Math.max(0,e-1))},1e3);return()=>window.clearTimeout(e)},[m,h]);let x=(0,s.d)(),w=(0,r.D)(x),C=(0,eX.f)({active:!0,generation:0}),I=(0,n.useRef)(!1),S=(0,n.useRef)(void 0);(0,n.useLayoutEffect)(()=>(C.setState(e=>({...e,active:!0})),()=>{C.setState(e=>({active:!1,generation:e.generation+1})),!I.current&&S.current&&(0,eJ.r)(S.current)}),[C]);let N=()=>{if(!w)throw new DOMException("Missing deletion account","AbortError");let e=(0,O.TV)(x),t=C.get().generation,n=new AbortController,a=()=>{(0,O.ot)(x,e,n.signal);let a=C.get();if(!a.active||a.generation!==t)throw new DOMException("Retired deletion view","AbortError")};a();let r=()=>{try{a()}catch{n.abort()}},i=C.subscribe(r),s=w.runtime.lifecycle.subscribe(r);return{registry:w,generation:t,controller:n,assertActive:a,options:(0,M.L)(x,e,n.signal,a),release:()=>{i.unsubscribe(),s.unsubscribe()}}},P=(0,Q.f)({meta:{observabilityAction:"account.deletion.command"},mutationFn:async({action:e,body:t,source:n})=>{n.assertActive();let a=await fetch(`/api/community/users/me/account-deletion${"code"===e?"/code":""}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:t,signal:n.controller.signal});return"code"!==e&&a.ok||n.assertActive(),a}}),E=P.isPending&&P.variables?.action==="code",A=P.isPending&&P.variables?.action==="delete",R=async()=>{let e=N();g("");try{let t=await P.mutateAsync({action:"code",body:"{}",source:e});if(e.assertActive(),401===t.status){await e.options.onUnauthorized?.()&&(0,eJ.y)(e.registry.accountId);return}if(!t.ok){let n=429===t.status?(0,tj.f)(t.headers):null,a=await tC(t);e.assertActive(),n&&h(n),g(a);return}let n=await t.json();e.assertActive(),f(""),h(n.resend_after),u("code")}catch(t){if((0,k.c)(t))return;try{e.assertActive()}catch{return}g("We couldn’t send the code. Check your connection and try again.")}finally{e.release()}},D=async()=>{if(!/^\d{6}$/u.test(d))return;let e=N(),t=e.registry.authenticationView.get().generation,n=()=>{let n=e.registry.sessionViewer();return e.registry.authenticationView.get().active&&e.registry.authenticationView.get().generation===t&&(null==n||n===e.registry.accountId)};g("");let a=(0,eJ.q)(e.registry.accountId);S.current=a;try{let t=await P.mutateAsync({action:"delete",body:JSON.stringify({otp:d}),source:e});if(!t.ok){let n=await tC(t);e.assertActive(),(0,eJ.r)(a),S.current=void 0,f(""),g(n);return}let r=!0;try{e.assertActive()}catch{r=!1}if(I.current=!0,(0,M.d)(e.registry),await (0,j.G)(e.registry.accountId).catch(()=>void 0),!r||!n()){(0,eJ.r)(a),S.current=void 0;return}try{await i()}catch{}n()&&globalThis.location.replace(eJ.e)}catch(t){if((0,eJ.r)(a),S.current=void 0,(0,k.c)(t))return;try{e.assertActive()}catch{return}f(""),g("Your account wasn’t deleted. Check your connection and try again.")}finally{e.release()}};return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md animate-in fade-in duration-150 motion-reduce:animate-none","data-testid":eh.f.accountDeletionFlow,children:"notice"===c?(0,t.jsxs)("section",{className:"space-y-8",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-full bg-destructive/10 text-destructive",children:(0,t.jsx)(tw.f,{className:"size-5"})}),(0,t.jsx)("h2",{ref:v,tabIndex:-1,className:"text-xl font-medium tracking-tight outline-none",children:"Delete your account?"}),(0,t.jsx)("p",{className:"text-sm leading-6 text-muted-foreground",children:"Your profile, messages, agents, and account data will be permanently removed."}),(0,t.jsx)("p",{className:"text-sm font-medium",children:"This can’t be undone."})]}),(0,t.jsxs)("div",{className:"rounded-xl bg-muted/60 p-4",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Deletion code will be sent to"}),(0,t.jsx)("div",{className:"mt-1 break-all text-sm font-medium",children:e})]}),p?(0,t.jsx)("p",{ref:b,tabIndex:-1,role:"alert",className:"text-sm text-destructive outline-none",children:p}):null,(0,t.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[(0,t.jsx)(eb.K,{variant:"ghost",className:"h-11 sm:h-9",onClick:a,disabled:E,children:"Cancel"}),(0,t.jsx)(eb.K,{className:"h-11 sm:h-9",onClick:R,disabled:E||m>0,"data-testid":eh.f.accountDeletionSendCode,children:E?"Sending code…":m>0?`Send deletion code in ${m}s`:"Send deletion code"})]})]}):(0,t.jsxs)("section",{className:"space-y-8",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-full bg-destructive/10 text-destructive",children:(0,t.jsx)(tx,{className:"size-5"})}),(0,t.jsx)("h2",{ref:v,tabIndex:-1,className:"text-xl font-medium tracking-tight outline-none",children:"Enter deletion code"}),(0,t.jsxs)("p",{className:"text-sm leading-6 text-muted-foreground",children:["We sent a 6-digit code to ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:e}),"."]})]}),(0,t.jsx)(tk.J,{ref:y,value:d,onChange:e=>{f(e),g("")},maxLength:6,autoFocus:!0,disabled:A,"aria-label":"Deletion code","aria-invalid":!!p,containerClassName:"justify-center sm:justify-start","data-testid":eh.f.accountDeletionOtp,children:(0,t.jsx)(tk.o,{children:Array.from({length:6},(e,n)=>(0,t.jsx)(tk.L,{index:n,className:"size-11 text-base"},n))})}),p?(0,t.jsx)("p",{ref:b,tabIndex:-1,role:"alert",className:"text-sm text-destructive outline-none",children:p}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 sm:flex-row",children:[(0,t.jsx)(eb.K,{variant:"ghost",className:"h-11 sm:h-9",onClick:()=>{g(""),u("notice")},disabled:A,children:"Back"}),(0,t.jsx)(eb.K,{variant:"ghost",className:"h-11 sm:h-9",onClick:R,disabled:A||E||m>0,children:E?"Sending…":m>0?`Resend code in ${m}s`:"Resend code"})]}),(0,t.jsx)(eb.K,{variant:"destructive",className:"h-11 sm:h-9",onClick:D,disabled:A||6!==d.length,"data-testid":eh.f.accountDeletionSubmit,children:A?"Deleting account…":"Delete account"})]})]})})}let tS=[{value:"light",label:"Light",icon:e5.f},{value:"dark",label:"Dark",icon:e3.f},{value:"system",label:"System",icon:e8.f}],tN=[{value:"profile",label:"My Profile",icon:e0},{value:"billing",label:"Subscription & billing",icon:tn},{value:"appearance",label:"Appearance",icon:e4},{value:"advanced",label:"Advanced",icon:e9},{value:"privacy",label:"Privacy",icon:te.f}];function tP(){let{theme:e,setTheme:a}=(0,ta.i)(),[r,i]=(0,o.f)((0,l.f)(!1));(0,n.useEffect)(()=>i(!0),[i]);let s=r?e??"system":void 0;return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md space-y-4",children:(0,t.jsx)(tf,{label:"Theme",children:(0,t.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-xl bg-muted/60 p-1",children:tS.map(({value:e,label:n,icon:r})=>{let i=s===e;return(0,t.jsxs)("button",{onClick:()=>a(e),"aria-pressed":i,className:["flex min-h-16 flex-col items-center justify-center gap-2 rounded-lg px-2 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",i?"bg-background text-foreground shadow-(--e1)":"text-muted-foreground hover:bg-background/60 hover:text-foreground"].join(" "),children:[(0,t.jsx)(r,{className:"size-5"}),n]},e)})})})})}let tE=["device","cache","size"];function tM(){let[e,a]=(0,o.f)((0,l.f)(!1)),[r,c]=(0,o.f)((0,l.f)(null)),u=(0,s.d)(),d=(0,i.f)({queryKey:tE,queryFn:({signal:e})=>(0,j.P)(e),retry:!1,staleTime:0}),f=(0,Q.f)({meta:{observabilityAction:"cache.clear"},mutationFn:j.t}),m=f.isPending;(0,eG.useObservedRegion)("settings",!d.isPending&&void 0!==d.data,1);let h=d.isPending?"loading":d.isError?"unavailable":d.data,p=(0,eX.f)({active:!0,generation:0});return(0,n.useLayoutEffect)(()=>(p.setState(e=>({...e,active:!0})),()=>p.setState(e=>({active:!1,generation:e.generation+1}))),[p]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ti.f,{open:e,onOpenChange:e=>{e||a(!1)},title:"Clear local cache?",description:"This removes locally cached messages and public files for every account used on this device. The next channel or DM you open will refetch from the server. Nothing on the server is deleted.",confirmLabel:"Clear cache",loadingLabel:"Clearing...",loading:m,onConfirm:async()=>{c(null);let e=p.get().generation,t=u.getQueryCache().find({queryKey:tE,exact:!0}),n=()=>{let t=p.get();if(!t.active||t.generation!==e)throw new DOMException("Retired cache settings view","AbortError")};try{await u.cancelQueries({queryKey:tE,exact:!0}),n(),await f.mutateAsync(),n(),t&&u.getQueryCache().find({queryKey:tE,exact:!0})===t&&await u.refetchQueries({queryKey:tE,exact:!0}),n(),a(!1)}catch(e){try{n()}catch{return}c(e instanceof Error?e.message:"Device cache has not been fully cleared. Please try again."),(0,eJ.w)(e,"Failed to clear cache",n),a(!1)}}}),(0,t.jsxs)("div",{className:"mx-auto flex min-h-full w-full max-w-md flex-col",children:[(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h2",{className:"text-base font-medium tracking-tight",children:"Clear local cache"}),r&&(0,t.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:r}),(0,t.jsxs)("p",{className:"flex items-baseline justify-between gap-4 text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Cached messages and public files"}),(0,t.jsx)("span",{"data-testid":eh.f.settingsCacheSize,className:"font-mono tabular-nums text-foreground",children:"loading"===h?"Calculating…":"unavailable"===h?"Unavailable":(0,j.L)(h)})]}),(0,t.jsx)("p",{className:"max-w-[65ch] text-sm leading-6 text-muted-foreground",children:"Removes locally cached messages and public files for every account used on this device. The next channel or DM you open will refetch from the server. Nothing on the server is deleted."}),(0,t.jsx)(eb.K,{variant:"destructive",size:"sm",className:"mt-2 h-11 sm:h-8",onClick:()=>a(!0),children:"Clear local cache"})]}),(0,t.jsxs)("footer",{"data-testid":eh.f.settingsWebVersion,className:"mt-auto pt-8 font-mono text-xs tabular-nums text-muted-foreground",children:["Web v","0.1.50"]})]})]})}function tA({initialTab:e="profile",billingReturn:a=null,onClose:r,userId:i,userName:s,userEmail:c,aboutMe:u,avatar:d,statusEmoji:f,statusText:m,onSave:h,onLogout:p,onAccountDeleted:g,onUploadAvatar:v}){let[y,b]=(0,o.f)((0,l.f)(s)),[x,w]=(0,o.f)((0,l.f)(u)),[k,j]=(0,o.f)((0,l.f)({emoji:f??null,text:m??null})),[C,I]=(0,o.f)((0,l.f)({name:s,aboutMe:u,emoji:f??null,text:m??null})),[S,N]=(0,o.f)((0,l.f)(e));(0,n.useEffect)(()=>{N(e)},[e,N]);let P=(0,ty.q)(a,"billing"===S),[E,M]=(0,o.f)((0,l.f)(!1));(0,eG.useObservedRegion)("settings","billing"!==S&&"advanced"!==S,1);let A=y!==C.name||x!==C.aboutMe||k.emoji!==C.emoji||k.text!==C.text;return(0,t.jsx)(tg.I,{value:S,onValueChange:N,label:"User Settings",title:"billing"===S?"Subscription & billing":E?"Delete account":"appearance"===S?"Appearance":"advanced"===S?"Advanced":"privacy"===S?"Privacy Policy":"My Profile",tabs:tN,onClose:r,disabled:E,navFooter:(0,t.jsxs)(eb.K,{variant:"ghost",className:tp.n,size:"sm",onClick:p,"aria-label":"Log out",disabled:E,children:[(0,t.jsx)(e1.f,{className:"size-4"})," ",(0,t.jsx)("span",{className:"sr-only sm:not-sr-only",children:"Log Out"})]}),children:E?(0,t.jsx)(tI,{email:c,onCancel:()=>M(!1),onDeleted:g}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tg.s,{value:"billing",children:(0,t.jsx)("div",{className:"mx-auto w-full max-w-xl",children:(0,t.jsx)(tv.X,{billing:P})})}),(0,t.jsx)(tg.s,{value:"profile",children:(0,t.jsxs)("div",{className:"mx-auto w-full max-w-md space-y-8",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsx)("span",{className:"block size-24 overflow-hidden rounded-full ring-1 ring-border/50",children:(0,t.jsx)(td.f,{label:d,seed:i??void 0,size:96})}),(0,t.jsxs)("button",{type:"button",onClick:v,className:"flex min-h-11 items-center gap-2 rounded-full border border-border/50 px-3 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:min-h-8",children:[(0,t.jsx)(e6.f,{className:"size-3.5"})," Change photo"]})]}),(0,t.jsx)("input",{value:y,onChange:e=>b(e.target.value),placeholder:"Your name","aria-label":"Display name",className:"min-h-11 w-full rounded-sm border-0 bg-transparent px-0 py-1 text-xl font-medium leading-[1.2] tracking-tight shadow-none outline-none placeholder:font-normal placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-4 focus-visible:ring-offset-background sm:text-2xl"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"About"}),(0,t.jsx)(tr.f,{value:x,onChange:e=>w(e.target.value),placeholder:"Add a bit about yourself…",className:"min-h-11 w-full rounded-sm border-0 bg-transparent px-0 py-1 text-sm leading-6 text-foreground shadow-none outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-4 focus-visible:ring-offset-background"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Status"}),(0,t.jsx)(tm.f,{emoji:k.emoji,text:k.text,onChange:(e,t)=>j({emoji:e,text:t}),children:(0,t.jsx)("button",{className:"inline-flex min-h-11 items-center gap-2 rounded-full border border-border/50 px-3 text-sm transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:min-h-8",children:(0,th.b)(k.emoji,k.text)?(0,t.jsxs)("span",{children:[k.emoji," ",k.text]}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"Set a status"})})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)(eb.K,{variant:"ghost",size:"sm",className:"h-11 shrink-0 px-3 text-destructive hover:text-destructive sm:h-8",onClick:()=>M(!0),"aria-label":"Delete account","data-testid":eh.f.accountDeletionOpen,children:"Delete account"}),(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[(0,t.jsx)(eb.K,{variant:"ghost",size:"sm",className:"h-11 sm:h-8",onClick:()=>{b(C.name),w(C.aboutMe),j({emoji:C.emoji,text:C.text})},disabled:!A,children:"Cancel"}),(0,t.jsx)(eb.K,{size:"sm",className:"h-11 sm:h-8",onClick:()=>{if(!A)return;let e=y.trim(),t=x.trim();h({name:e,aboutMe:t,statusEmoji:k.emoji,statusText:k.text}),I({name:e,aboutMe:t,emoji:k.emoji,text:k.text}),b(e),w(t)},disabled:!A,children:"Save changes"})]})]})]})}),(0,t.jsx)(tg.s,{value:"appearance",children:(0,t.jsx)(tP,{})}),(0,t.jsx)(tg.s,{value:"advanced",className:"h-full",children:(0,t.jsx)(tM,{})}),(0,t.jsx)(tg.s,{value:"privacy",children:(0,t.jsx)("div",{className:"mx-auto w-full max-w-2xl pb-8",children:(0,t.jsx)(tu,{})})})]})})}var tO=e.i(393085),tR=e.i(254578),tD=e.i(590834),tD=tD,tL=e.i(157080),tL=tL,tz=e.i(272553);function tT(e){return Number(e.toFixed(6)).toString()}function tq(e,t){if(void 0!==e&&void 0!==t&&Number.isFinite(e)&&Number.isFinite(t)&&!(e<=0)&&!(t<=0))return{width:e,height:t}}var tK=e.i(677204);let t$={scale:1,x:0,y:0};function tF(e,t){let n=Math.max(1,Math.min(8,e.scale)),a=t.width*(n-1)/2,r=t.height*(n-1)/2;return{scale:n,x:Math.max(-a,Math.min(a,e.x)),y:Math.max(-r,Math.min(r,e.y))}}function tU(e,t,n,a){let r=Math.max(1,Math.min(8,t)),i=r/e.scale;return tF({scale:r,x:n.x-(n.x-e.x)*i,y:n.y-(n.y-e.y)*i},a)}function t_(e){return 1===e.length?e[0]:{x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2}}function tB(e){return Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y)}function tV({image:e,onClose:a}){let r=(0,n.useMemo)(()=>tq(e.width,e.height),[e.height,e.width]),[i,s]=(0,o.f)((0,l.f)(r)),[c,u,,d,f,m]=(0,tK.f)({source:e.thumbnailUrl}),[h,p,g,v,y,b,x]=(0,tK.f)({source:e.originalUrl}),w=function(e){if(!e)return{width:"min(200px, 90vw, 85vh, max(1px, calc(100vh - 144px)))",aspectRatio:"1 / 1"};let t=85*(e.width/e.height);return{width:`min(${tT(e.width)}px, 90vw, ${tT(t)}vh, calc(max(1px, calc(100vh - 144px)) * ${tT(e.width/e.height)}))`,aspectRatio:`${tT(e.width)} / ${tT(e.height)}`}}(i),k=!!e.thumbnailUrl&&"ready"===c,j="ready"===h,{frameRef:C,view:I,reset:S,zoomIn:N,zoomOut:P,handlers:E}=function(e){let t=(0,n.useRef)(null),a=(0,n.useRef)(new Map),[r,i]=(0,o.f)((0,l.f)(t$)),s=(0,n.useRef)(t$),c=(0,n.useCallback)(e=>{let n=t.current?.getBoundingClientRect(),a=n?tF(e,n):t$;s.current=a,i(a)},[i]),u=(0,n.useCallback)(()=>{a.current.clear(),c(t$)},[c]),d=(0,n.useCallback)((e,n)=>{let a=t.current?.getBoundingClientRect();if(!a)return;let r=n?{x:n.x-a.left-a.width/2,y:n.y-a.top-a.height/2}:{x:0,y:0};c(tU(s.current,e,r,a))},[c]);(0,n.useEffect)(()=>{if(!e)return void u();let n=t.current;if(!n)return;let r=e=>{e.preventDefault();let t=1===e.deltaMode?16:2===e.deltaMode?n.clientHeight:1,a=e.ctrlKey?.005:.002;d(s.current.scale*Math.exp(-e.deltaY*t*a),{x:e.clientX,y:e.clientY})},i=a.current;n.addEventListener("wheel",r,{passive:!1});let o="function"==typeof ResizeObserver?new ResizeObserver(()=>{a.current.clear(),c(s.current)}):void 0;return o?.observe(n),()=>{n.removeEventListener("wheel",r),o?.disconnect(),i.clear()}},[c,e,u,d]);let f=e=>{a.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)};return{frameRef:t,view:r,reset:u,zoomIn:()=>d(1.5*s.current.scale),zoomOut:()=>d(s.current.scale/1.5),handlers:{onPointerDown:t=>{e&&0===t.button&&!(a.current.size>=2)&&(a.current.set(t.pointerId,{x:t.clientX,y:t.clientY}),t.currentTarget.setPointerCapture?.(t.pointerId))},onPointerMove:e=>{if(!a.current.has(e.pointerId))return;let t=[...a.current.values()];a.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let n=[...a.current.values()],r=t_(t),i=t_(n),o=e.currentTarget.getBoundingClientRect(),l={x:r.x-o.left-o.width/2,y:r.y-o.top-o.height/2},u=2===t.length?tB(n)/Math.max(1,tB(t)):1,d=tU(s.current,s.current.scale*u,l,o);c({...d,x:d.x+i.x-r.x,y:d.y+i.y-r.y})},onPointerUp:f,onPointerCancel:f,onLostPointerCapture:f,onKeyDown:t=>{if(e&&!t.ctrlKey&&!t.metaKey&&!t.altKey){if("+"===t.key||"="===t.key)d(1.5*s.current.scale);else if("-"===t.key)d(s.current.scale/1.5);else if("0"===t.key)u();else{if(!t.key.startsWith("Arrow"))return;let e=s.current;c({...e,x:e.x+("ArrowLeft"===t.key?40:"ArrowRight"===t.key?-40:0),y:e.y+("ArrowUp"===t.key?40:"ArrowDown"===t.key?-40:0)})}t.preventDefault()}},onDoubleClick:t=>{e&&d(s.current.scale>1?1:2,{x:t.clientX,y:t.clientY})}}}}(j),M={transform:`translate(${I.x}px, ${I.y}px) scale(${I.scale})`};return(0,n.useLayoutEffect)(()=>{if("ready"!==h||!g)return;let e=tq(g.naturalWidth,g.naturalHeight);s(r??e)},[r,g,h,s]),(0,t.jsxs)("div",{className:"relative w-fit",children:[(0,t.jsxs)("div",{ref:C,"data-testid":eh.f.imageLightbox,"data-zoom-scale":I.scale,"data-native-context-menu":"true",role:"region","aria-label":"Image preview. Use plus and minus to zoom, arrow keys to pan, and zero to fit.",tabIndex:j?0:-1,className:`relative select-none overflow-hidden rounded-lg bg-background ${I.scale>1?"cursor-grab active:cursor-grabbing":"cursor-default"}`,style:{...w,touchAction:j?"none":void 0},...E,children:[e.thumbnailUrl&&(0,t.jsx)("img",{ref:d,"data-testid":eh.f.imageLightboxThumbnail,"data-remote-image-kind":"content","data-remote-image-state":c,src:e.thumbnailUrl,alt:e.name,draggable:!1,style:M,onLoad:f,onError:m,className:`absolute inset-0 size-full rounded-lg object-contain ${k&&!j?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"}`},`thumbnail-${u}`),!k&&!j&&"pending"===h&&(0,t.jsx)("div",{"data-testid":eh.f.imageLightboxLoading,role:"status",className:"absolute inset-0 flex animate-pulse items-center justify-center bg-muted/70 px-4 text-sm text-muted-foreground motion-reduce:animate-none",children:"Loading original image"}),"error"!==h&&(0,t.jsx)("img",{ref:v,"data-testid":eh.f.imageLightboxOriginal,"data-remote-image-kind":"content","data-remote-image-state":h,src:e.originalUrl,alt:e.name,draggable:!1,style:M,onLoad:y,onError:b,className:`absolute inset-0 size-full rounded-lg object-contain ${j?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"}`},`original-${p}`)]}),(0,t.jsxs)("div",{role:"toolbar","aria-label":"Image controls",className:"absolute left-1/2 z-20 flex -translate-x-1/2 items-center gap-1 rounded-lg border border-border bg-background p-1",style:{top:"calc(50% - 50vh + 12px)"},children:[(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Zoom out",title:"Zoom out",disabled:!j||I.scale<=1,onClick:P,children:(0,t.jsx)(tR.f,{})}),(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Fit image",title:"Fit image",disabled:!j||1===I.scale,onClick:S,children:(0,t.jsx)(tL.f,{})}),(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Zoom in",title:"Zoom in",disabled:!j||I.scale>=8,onClick:N,children:(0,t.jsx)(tD.f,{})}),(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Close image preview",title:"Close",onClick:a,children:(0,t.jsx)(tz.f,{})})]}),"error"===h&&(0,t.jsxs)("div",{"data-testid":eh.f.imageLightboxError,role:"status",className:"absolute bottom-3 left-1/2 z-10 flex min-h-11 w-max max-w-[min(90vw,24rem)] -translate-x-1/2 items-center justify-between gap-2 rounded-md border border-border bg-background px-3 py-2 text-sm shadow-sm",children:[(0,t.jsx)("span",{children:"Failed to load original image"}),(0,t.jsx)("button",{type:"button","data-testid":eh.f.imageLightboxRetry,onClick:x,className:"h-12 min-w-12 rounded-md px-3 font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:h-9 sm:min-w-0",children:"Retry"})]})]})}function tW({image:e,onClose:n}){return(0,t.jsx)(ew.N,{open:!0,onOpenChange:e=>{e||n()},children:(0,t.jsx)(ew.d,{"aria-label":e.name,className:"flex max-h-[90vh] w-auto items-center justify-center border-none bg-transparent p-0 shadow-none sm:max-w-none",showCloseButton:!1,children:(0,t.jsx)(tV,{image:e,onClose:n},`${e.originalUrl}\0${e.thumbnailUrl??""}\0${e.width??""}\0${e.height??""}`)})})}var tH=e.i(549712),tY=e.i(288423),tQ=e.i(955233),tG=e.i(863576),tX=e.i(521314),tJ=e.i(565464),tZ=e.i(972525),t0=e.i(655041),t1=e.i(986087);e.i(43729);var t2=e.i(786637),t4=e.i(43345);let t5=(0,tY.default)(()=>e.A(762162).then(e=>e.CodePreview),{loadableGenerated:{modules:[145142]},ssr:!1,loading:()=>(0,t.jsxs)("div",{"data-testid":eh.f.codePreview,role:"status",className:"flex min-h-40 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(tX.f,{className:"size-4 animate-spin"}),"Loading syntax highlighter…"]})}),t3=(0,tY.default)(()=>e.A(911974).then(e=>e.PdfPreview),{loadableGenerated:{modules:[144402]},ssr:!1,loading:()=>(0,t.jsxs)("div",{"data-testid":eh.f.pdfPreviewStatus,role:"status",className:"flex min-h-40 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(tX.f,{className:"size-4 animate-spin motion-reduce:animate-none"}),"Loading PDF renderer…"]})}),t8={status:"idle",content:null,error:null};function t7({attachment:e}){let n=(0,t4.f)(e),a=(0,t2.f)(n.state),r="downloading"===n.state.status?tX.f:"saved"===n.state.status||"started"===n.state.status?tQ.f:"error"===n.state.status?tJ.f:tG.f;return(0,t.jsxs)("button",{type:"button","data-testid":eh.f.attachmentPreviewDownload,onClick:()=>"downloading"===n.state.status?n.cancel():void n.start(),"aria-busy":"downloading"===n.state.status,className:(0,eb.i)({variant:"outline",size:"sm",className:"h-11 disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground sm:h-7"}),children:[(0,t.jsx)(r,{className:`size-3.5 ${"downloading"===n.state.status?"animate-spin motion-reduce:animate-none":""}`}),"downloading"===n.state.status?"Cancel download":a??"Download"]})}async function t9(e,t=t1.w,n){return new TextDecoder().decode(await t6(e,t,n))}async function t6(e,t,n){if(!e.ok)throw Error(`Couldn’t load this attachment (${e.status})`);let a=Number(e.headers.get("content-length"));if(Number.isFinite(a)&&a>t)throw Error("This file is too large to preview");if(!e.body){let a=new Uint8Array(await e.arrayBuffer());if(n?.aborted)throw new DOMException("Aborted","AbortError");if(a.byteLength>t)throw Error("This file is too large to preview");return a}let r=e.body.getReader(),i=0,s=[];try{for(;;){if(n?.aborted)throw new DOMException("Aborted","AbortError");let{done:e,value:a}=await r.read();if(n?.aborted)throw new DOMException("Aborted","AbortError");if(e)break;if((i+=a.byteLength)>t)throw await r.cancel(),Error("This file is too large to preview");s.push(a)}let e=new Uint8Array(i),a=0;for(let t of s)e.set(t,a),a+=t.byteLength;return e}finally{n?.aborted&&await r.cancel().catch(()=>void 0),r.releaseLock()}}function ne({attachment:e,open:n,onOpenChange:a}){let r=(0,tH.f)(),s=e?(0,t1.Y)(e.name,e.contentType):null,o=s?.previewKind==="pdf"?t1.a:t1.w,l=s?.previewKind?e?.sizeBytes!==void 0&&e.sizeBytes>o?"This file is too large to preview":null:"This file type can’t be previewed",c=(0,i.f)({queryKey:(0,tH.v)(r,"attachment-preview",n?e?.url??null:null,s?.previewKind??null,o),enabled:n&&null!==e&&null===l,gcTime:0,staleTime:1/0,retry:!1,queryFn:async({signal:t})=>{let n=(0,tH.L)(r),a=()=>(0,tH.k)(n,t);if(a(),!e||!s?.previewKind)throw Error("No attachment selected");try{let n=await fetch(e.url,{credentials:"same-origin",signal:t});a();let r="pdf"===s.previewKind?{status:"ready",kind:"pdf",content:await t6(n,o,t),error:null}:{status:"ready",kind:"text",content:await t9(n,o,t),error:null};return a(),r}catch(e){throw a(),e}}},r.queryClient),u=n&&e?l?{status:"error",content:null,error:l}:c.isError?{status:"error",content:null,error:c.error instanceof Error?c.error.message:"Couldn’t load this attachment"}:c.data??{status:"loading",content:null,error:null}:t8,d=e?(0,t1.E)(e.sizeBytes)||e.size:"";return(0,t.jsxs)(tZ.f,{open:n,onOpenChange:a,title:e?.name??"Attachment",description:[e?.contentType||s?.category,d].filter(Boolean).join(" · "),footer:e&&(0,t.jsx)(t7,{attachment:e}),resizable:!0,closeLabel:"Close attachment preview",contentTestId:eh.f.attachmentPreviewSheet,bodyTestId:eh.f.attachmentPreviewContent,bodyClassName:(0,ts.c)("flex min-h-0 flex-col",s?.previewKind==="pdf"&&"overflow-hidden",(s?.previewKind==="code"||s?.previewKind==="text"||s?.previewKind==="pdf")&&"p-0 sm:p-0"),children:["loading"===u.status&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-8 text-sm text-muted-foreground",children:[(0,t.jsx)(tX.f,{className:"size-4 animate-spin"}),"Loading preview…"]}),"error"===u.status&&(0,t.jsxs)("div",{className:"flex min-h-40 flex-col items-center justify-center gap-2 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Preview unavailable"}),(0,t.jsx)("p",{className:"max-w-72 text-sm text-muted-foreground",children:u.error})]}),"ready"===u.status&&"text"===u.kind&&s?.previewKind==="markdown"&&(0,t.jsx)(t0.f,{text:u.content}),"ready"===u.status&&"text"===u.kind&&s?.previewKind!=="markdown"&&(0,t.jsx)(t5,{content:u.content,language:s?.shikiLanguage??null}),"ready"===u.status&&"pdf"===u.kind&&(0,t.jsx)(t3,{data:u.content})]})}var nt=e.i(369546);function nn({controller:e,breakpoint:n,extraDialogs:a,suppressProfileCard:r=!1}){let{profile:i,currentUser:s}=e,o=e.pendingAvatarCrop;return(0,t.jsxs)(t.Fragment,{children:[i&&!r&&(0,t.jsx)(tO.f,{data:i.data,x:i.x,y:i.y,bp:n,onClose:e.closeProfile,onMessage:e.profileMessage,canMessage:e.canMessage,isSelf:!!i.data.userId&&i.data.userId===s.id,onUpdateStatus:e.updateOwnStatus,onOpenOwnerProfile:e.openOwnerProfile,onOpenBotAudit:e.openBotAudit},`${i.data.userId??i.data.name}:${i.x}:${i.y}`),e.preview&&(0,t.jsx)(tW,{image:e.preview,onClose:e.closePreview}),(0,t.jsx)(ne,{attachment:e.attachmentPreview,open:!!e.attachmentPreview,onOpenChange:e.onAttachmentPreviewOpenChange}),(0,t.jsx)(ew.N,{open:e.editingProfile,onOpenChange:e.onUserSettingsOpenChange,children:(0,t.jsx)(ew.d,{className:"flex h-dvh max-h-dvh w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none p-0 sm:h-[calc(100vh-4rem)] sm:max-h-180 sm:w-[calc(100vw-4rem)] sm:max-w-4xl sm:rounded-xl",showCloseButton:!1,children:(0,t.jsx)(tA,{...e.userSettingsProps})})}),o&&(0,t.jsx)(nt.f,{...o,maskShape:"circle"}),a]})}var na=e.i(52622);let nr={active:"none",update:null};function ni(e){return[...new Set(e)]}function ns(e,t){return e.filter(e=>!t.has(e))}function no(e,t){return e.filter(e=>t.has(e))}function nl(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function nc(e,t){if(!e.update)return e;let n=new Set(t),a=ni(t);if(0===a.length)return{active:"update"===e.active?"none":e.active,update:null};let r=no(e.update.acceptedMachineIds,n),i=no(e.update.failedMachineIds,n),s=no(e.update.pendingMachineIds,n),o=i.length>0?"retry":r.length>0||s.length>0?"updating":"update"===e.active?"expanded":"collapsedBadge";return o===e.update.phase&&nl(a,e.update.targetMachineIds)&&nl(r,e.update.acceptedMachineIds)&&nl(i,e.update.failedMachineIds)&&nl(s,e.update.pendingMachineIds)?e:{...e,update:{phase:o,targetMachineIds:a,acceptedMachineIds:r,failedMachineIds:i,pendingMachineIds:s}}}var nu=e.i(692462),nd=e.i(708717);function nf({breakpoint:e,checkpoint:n,sidebar:a,children:r,extraDialogs:i,rail:s,profile:o,inbox:l,userBarExtension:c,daemonUpdate:u,onUserBarInboxOpenChange:d,onUserBarOpenProfile:f,onUserBarOpenUpdate:m,dismissUserBarExtension:h}){let{surface:p}=n,{runningBots:g}=(0,nu.f)(),v=(0,t.jsx)(eQ.f,{...l.popoverProps,surface:"extension"}),y={id:o.currentUser.id,name:o.currentUser.name,avatar:o.currentUser.avatar,runningBotCount:g.length},b="unknown"===e,x="profile"===c.active&&o.profile?.data.userId===o.currentUser.id,w=x&&o.profile?(0,t.jsx)(tO.f,{data:o.profile.data,x:o.profile.x,y:o.profile.y,bp:e,onClose:o.closeProfile,onMessage:o.profileMessage,isSelf:!0,onUpdateStatus:o.updateOwnStatus,onOpenOwnerProfile:o.openOwnerProfile,onOpenBotAudit:o.openBotAudit,extension:!0}):null,k=x&&g.length>0?(0,t.jsx)(nd.f,{onOpenBotAudit:o.openBotAudit,showShadow:"mobile"!==e}):null;return(0,t.jsx)(na.f,{breakpoint:e,surface:p,rail:(0,t.jsx)(eH.w,{...s.railProps,bottomInset:60}),preserveHiddenMobileModules:!0,sidebar:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{hidden:"keep"!==n.sidebar.kind,inert:"keep"!==n.sidebar.kind,"aria-hidden":"keep"!==n.sidebar.kind||void 0,className:"flex min-h-0 flex-1 flex-col",children:"desktop"===e?a():a({noHeader:!1})}),"server-skeleton"===n.sidebar.kind?(0,t.jsx)(eB.m,{targetServerId:n.sidebar.serverId}):"me-skeleton"===n.sidebar.kind?(0,t.jsx)(eV.h,{}):null]}),main:"keep"===n.main.kind||"server-route"===n.main.kind?r:(0,t.jsx)(eW.CommunityPendingFrame,{href:n.targetHref,reserveBackSlot:"detail"===p,conversationSubtype:n.main.conversationSubtype}),userBar:(0,t.jsx)(eY.Y,{breakpoint:e,user:y,onOpenProfile:f,onEditProfile:o.openUserSettings,inbox:v,hasUnread:l.hasUnread,unreadCount:l.unreadCount,unreadCountPartial:l.unreadCountPartial,inboxOpen:"inbox"===c.active,onInboxOpenChange:d,extension:{active:c.active,inbox:v,profile:w,profileCompanion:k,update:u.update,updateBadgePhase:c.update&&"update"!==c.active?"expanded"===c.update.phase?"collapsedBadge":c.update.phase:null,eligibleMachines:u.eligibleMachines,onOpenUpdate:m,onRequestUpdate:u.request,onDismiss:h}}),overlays:!b&&(0,t.jsx)(nn,{controller:o,breakpoint:e,extraDialogs:i,suppressProfileCard:x})})}var nm=e.i(876986);let nh=Object.freeze([]),np=async(e={})=>{let t=(0,O.TV)(e.client);return{folders:(await (0,eJ.i)("/api/community/users/me/server-folders",(0,M.L)(e.client,t,e.signal))).folders.map(e=>({id:e.id,name:e.name,position:e.position??0,servers:e.servers.map(e=>({id:e.id,name:e.name,initial:(0,D.f)(e.name),icon:e.icon??null}))}))}};e.i(384302);var ng=e.i(462553),nv=e.i(333671);function ny({targetServerId:e,activeServerId:t,overlay:n,hasActiveOpener:a,publishedHref:r}){if(e===t&&a)return{kind:"open-active"};if(e===t&&r&&(0,eA.B)(r)===e){let e=new URL(r,"https://alook.local");return e.searchParams.set(n,"1"),{kind:"navigate",href:`${e.pathname}${e.search}${e.hash}`}}return{kind:"navigate",href:`/c/channels/${e}?${n}=1`}}var nb=e.i(138906);function nx(e,t,n,a,r){let i=e?.collections.servers.get(t)?.detailComplete===!0,s=e&&i?r??Array.from(e.collections.channels.values()).filter(e=>e.serverId===t&&"thread"!==e.type&&!e.pending).map(e=>e.id):[];return(0,eR.e)({serverId:t,channelIds:s,last:n,breakpoint:a})}var nw=e.i(686988),nk=e.i(354139),nj=e.i(217372);function nC(e,t){if(e&&t&&"role"in t)return t.role.charAt(0).toUpperCase()+t.role.slice(1)}var nI=e.i(47749),nS=e.i(725521),nN=e.i(776152),nP=e.i(939098),nE=e.i(459663);e.i(463690);var nM=e.i(251829),nA=e.i(4674),nO=e.i(248933),nR=e.i(975210);let nD=new WeakMap;function nL(e,t){e.value.setState(e=>({...e,lease:t}))}function nz(e,t){if(e===t)return!0;if(!e)return!1;let n=e=>{let[t,n=""]=e.split("?"),a=new URLSearchParams(n);a.delete("inboxThreadOpener");let r=a.toString();return`${t}${r?`?${r}`:""}`};return n(e)===n(t)}var nT=e.i(387170),nq=e.i(797473),nK=e.i(588732),n$=e.i(595072),nF=e.i(31163),nU=e.i(171738),n_=e.i(214997),nB=e.i(850441),nV=e.i(874697),nW=e.i(42420);function nH(e,t,n,a=0){(0,u.A)(e).ws.actions.isChannelAccessRevoked(t.channelId,t.serverId??null)&&(0,nA.f)(e,t.serverId??null,t.channelId).catch(()=>void 0);let{epoch:r,signal:i}=(0,nW.f)(e,t,n,a);(0,nW.x)(e,r,(n,a)=>{nH(e,t,n,a)});let s=t.anchorMessageId?{mode:"anchor",anchor:t.anchorMessageId}:{mode:"newest"},o=c.f.channelMessages(t.channelId),l="dm"===t.scopeKind?(0,nB.W)(t.channelId,{queryClient:e,onSurfaceReceipt:t=>{(0,nW.Y)(e,t,n,r)}}):(0,nB.$)(t.channelId,null,{queryClient:e,onSurfaceReceipt:t=>{(0,nW.Y)(e,t,n,r)}});e.cancelQueries({queryKey:o,exact:!0}),e.setQueryData(o,e=>e?{...e,pageParams:[s,...e.pageParams.slice(1)]}:e);let d={queryKey:o,queryFn:l,initialPageParam:s,pages:1,getNextPageParam:()=>void 0,retry:(0,n_.g)(e.defaultQueryOptions({queryKey:o}).retry),networkMode:"always",staleTime:0},f=new nU.f(e,{...d,enabled:!1}).subscribe(()=>void 0);e.infiniteQuery({...d,select:void 0}).then(()=>{(0,nW.G)(e,r,n)&&((0,nW.Z)(e,t.channelId,n),(0,nW.S)(e)?.status==="warming"&&(0,nW.m)(e,r,n,!1,!0))}).catch(a=>{let s,o;if(i.aborted||!(0,nW.G)(e,r,n))return;let l=a instanceof k.a&&(403===a.status||404===a.status);l&&(s=c.f.channelMessages(t.channelId),o=c.f.channelReadStateSnapshot(t.channelId),e.removeQueries({queryKey:s}),e.removeQueries({queryKey:o}),e.removeQueries({queryKey:c.f.channelMeta(t.serverId??null,t.channelId)}),(0,u.A)(e).messageStream.actions.removeScope("dm"===t.scopeKind?{kind:"dm",id:t.channelId}:{kind:"channel",id:t.channelId,serverId:t.serverId})),(0,nW.m)(e,r,n,l,!0)}).finally(f);let m=c.f.channelReadStateSnapshot(t.channelId);if(e.query({queryKey:m,staleTime:0,retry:!1,networkMode:"always",queryFn:(0,nV.r)(t.channelId,t.scopeKind,{waitForRegistryReady:!0,assertNavigationCurrent:()=>{if(!(0,nW.G)(e,r,n))throw new DOMException("Retired conversation warmup","AbortError")}}),select:void 0}).catch(()=>void 0),t.serverId){let n=t.serverId,a=c.f.server(n),r={queryKey:a,queryFn:({signal:t})=>(0,Z.Q)(e,n,t)(),staleTime:1/0,networkMode:"always",retry:(0,n_.g)(e.defaultQueryOptions({queryKey:a}).retry)},i=new Y.f(e,{...r,enabled:!1}).subscribe(()=>void 0);e.query({...r,select:void 0}).finally(i).catch(()=>void 0)}return r}var nY=e.i(418558),nQ=e.i(727854);function nG(e){e.revision+=1}async function nX(e,t,n){let a=++e.revision,r=await t();return a===e.revision&&(n(r),!0)}var nJ=e.i(907903),nZ=e.i(908967),n0=e.i(846367);e.i(678523);var n1=e.i(840429);async function n2(e,t){await (0,eJ.i)(`/api/community/machines/${e}/update`,{...t,method:"POST"})}function n4(e,t){return`alook:daemon-update-collapsed:${e}:${t}`}function n5(e,t,n){try{let a=n4(e,t);n?window.localStorage.setItem(a,"1"):window.localStorage.removeItem(a)}catch{}}async function n3(e,t){let n=await Promise.allSettled(e.map(async e=>(await t(e),e))),a=[],r=[];return n.forEach((t,n)=>{let i=e[n];"fulfilled"===t.status?a.push(i):r.push(i)}),{acceptedMachineIds:a,failedMachineIds:r}}var n8=e.i(251535);let n7="alook:native-back";function n9(e){let{view:d,activeServerId:f,frameHref:m,sidebar:h,children:p,extraDialogs:g,onOpenActiveServerSettings:v,onOpenActiveServerInvite:y,ownerDeleteRouteScope:b}=e,x=(0,n.useRef)(null),w=(0,s.d)(),k=(0,F.$)(),j=(0,eP.f)(e=>e.accessEpoch),S=(0,eF.$)(),E=(0,ee.E)(),R={...(0,eA.s)(m),revision:0},D=(0,n.useRef)(R),[L,z]=(0,o.f)((0,l.f)(R)),T=(0,n.useCallback)(e=>{let t=D.current,n=(0,eA.L)(t,e);n!==t&&(D.current=n,z(n))},[z]);(0,n.useLayoutEffect)(()=>{T(m),(0,e$.P)(m),b&&(0,eO.L)(w,b.serverId,b.token),(0,eO.t)(w,m)},[T,m,b,w]),(0,n.useEffect)(()=>{(0,n8.u)(w)},[m,w]);let q=function(e){let t=(0,a.useRouter)(),r=(0,a.usePathname)(),i=(0,a.useSearchParams)().toString(),c=i?`${r}?${i}`:r,u=(0,s.d)(),d=(0,n.useRef)({revision:0}),f=(0,n.useRef)(!1);(0,n.useLayoutEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let m=(0,n.useRef)(e);(0,n.useLayoutEffect)(()=>{m.current=e},[e]);let h=(0,n.useRef)(null),p=(0,n.useCallback)(e=>{let t=d.current.revision+ +!!e,n=m.current.revision,a=e?(0,eA.s)(e.nextCommitHref).href:null,r=n+ +(null!==a&&(0,eA.s)(a).leafKey!==m.current.leafKey);return()=>{if(!f.current)return!1;if(t===d.current.revision&&n===m.current.revision)return!0;let e=h.current;return null!==a&&null!==e&&e.revision===t&&d.current.revision===t+1&&e.frameRevision===r&&e.frameRevision===m.current.revision&&e.href===a&&m.current.href===a}},[]),g=(0,n.useRef)(e.revision),v=(0,n.useRef)(e.leafKey),[y,b]=(0,o.f)((0,l.f)(!1)),[x,w]=(0,o.f)((0,l.f)(null)),k=(0,n.useCallback)(()=>{nG(d.current),(0,nW.B)(u),b(!1),w(null)},[u,b,w]);(0,n.useEffect)(()=>{if(null===x)return;let t=(0,eA.s)(x);(t.leafKey===v.current?(0,eA.E)(e,c,x):(0,eA.F)({committedFrame:e,targetHref:x,baselineRevision:g.current}))&&(h.current={revision:d.current.revision,frameRevision:e.revision,href:t.href},nG(d.current),b(!1),w(null))},[e,x,c,b,w]),(0,n.useEffect)(()=>{let e=()=>k();return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[k]);let j=(0,n.useCallback)(e=>{let t=d.current.revision;try{e()}catch(e){throw t===d.current.revision&&k(),e}},[k]),C=(0,n.useCallback)((...n)=>{let[a]=n;if(a===c&&!y){h.current=null,(0,e$._)(a);return}(0,e$.A)(a),(0,nY.f)(u,a,"foreground"),nG(d.current),(0,nW.B)(u),g.current=e.revision,v.current=e.leafKey,(0,nQ.flushSync)(()=>{b(!0),w(a)}),j(()=>t.push(...n))},[e.leafKey,e.revision,y,c,u,t,b,w,j]),I=(0,n.useCallback)(n=>{if(n===c&&!y){h.current=null,(0,e$._)(n);return}(0,e$.A)(n),(0,nY.f)(u,n,"foreground"),nG(d.current),g.current=e.revision,v.current=e.leafKey,(0,nQ.flushSync)(()=>{b(!0),w(n)}),j(()=>t.push(n))},[e.leafKey,e.revision,y,c,u,t,b,w,j]),S=(0,n.useCallback)(n=>{if(n===c&&!y){h.current=null,(0,e$._)(n);return}(0,e$.A)(n),(0,nY.f)(u,n,"foreground"),nG(d.current),(0,nW.B)(u),g.current=e.revision,v.current=e.leafKey,b(!0),w(n),j(()=>t.replace(n))},[e.leafKey,e.revision,y,c,u,t,b,w,j]),N=(0,n.useCallback)(async n=>{(0,nW.B)(u),g.current=e.revision,v.current=e.leafKey,b(!0),w(null);let a=nX(d.current,n,e=>{if(e===c){(0,e$._)(e),b(!1),w(null);return}(0,e$.A)(e),(0,nY.f)(u,e,"foreground"),w(e),t.push(e)}),r=d.current.revision;try{return await a}catch(e){throw d.current.revision===r&&(b(!1),w(null)),e}},[e.leafKey,e.revision,c,u,t,b,w]);return{captureIntent:p,publishedHref:c,navigationPending:y,pendingHref:x,push:C,pushImmediate:I,replace:S,resolveAndPush:N,cancelPendingNavigation:k}}(L),K=q.replace,$=(0,eA.M)(L.pathname),U=q.pendingHref?(0,eA.s)(q.pendingHref):null,_=U?.scope.kind==="server"?U.scope.serverId:null,B=q.pendingHref?(0,eA.P)(q.pendingHref):null,V=B?.main.kind==="server-conversation"?B.main.leafId:null,W=(0,A.t)(_),H=(0,A.U)(V),Y=W?.categories?.flatMap(e=>e.channels).find(e=>e.id===V)??H,G=Y?.type==="text"||Y?.type==="forum"||Y?.type==="thread"?Y.type:void 0,et=_?void 0!==w.getQueryData(c.f.server(_))||void 0!==W:U?.scope.kind==="me"&&void 0!==w.getQueryData(c.f.dms()),en=(0,eA.t)({committedFrame:L,targetHref:q.pendingHref,pending:q.navigationPending,targetReady:et,targetConversationSubtype:G}),ea="target"===en.rail.kind?en.rail.view:d,er="target"===en.rail.kind?en.rail.activeServerId:f,ei=function({navigation:e,queryClient:t,breakpoint:a,view:o,projectedView:u=o,activeServerId:d,projectedActiveServerId:f,onOpenActiveServerSettings:m,onOpenActiveServerInvite:h,accountId:p}){let g,v,y,b,x,w,k,j=(0,A.O)(),C=(0,X.f)(),I=(0,Z.N)(),S=(g=(0,A.E)(),v=(0,s.d)(),{...(0,i.f)({queryKey:c.f.folders(),queryFn:async(e={})=>{let t=(0,O.TV)(v),n=await np(e);return(0,O.lp)(v,{snapshot:{kind:"folders",data:n},proof:{kind:"structural",token:t,signal:e.signal}}),n.folders.map(e=>e.id)}}),folders:g?.folders??nh}),N=I.servers,P=S.folders,E=N.length>0||void 0!==I.data||!p,M=(0,l.f)({active:!1,generation:0,navigation:null});(0,n.useLayoutEffect)(()=>(M.set(e=>({...e,active:!0,generation:e.generation+1})),()=>M.set(e=>({...e,active:!1,generation:e.generation+1}))),[j,M]),(0,n.useLayoutEffect)(()=>{M.set(t=>({...t,navigation:e}))},[e,M]);let R=(0,n.useCallback)(e=>M.get().active&&M.get().generation===e&&!!j?.runtime.lifecycle.get().active&&(0,r.D)(t)===j,[j,t,M]),D=(0,n.useCallback)(()=>{let t=M.get().generation,n=C.begin().token,a=j.authenticationView.get(),r=e.captureIntent(),i=()=>{C.assertOwner(n);let e=j.authenticationView.get();if(!R(t)||!e.active||e.generation!==a.generation)throw new DOMException("Retired rail account","AbortError")};return{assertAccount:i,assertUi:()=>{if(i(),!r())throw new DOMException("Retired rail intent","AbortError")}}},[j,e,C,R,M]),{mutateAsync:L}=(0,ng.f)(),{mutate:z}=(0,ng.p)(),{mutate:T}=(0,ng.v)(),q=(0,n.useMemo)(()=>N.map(e=>({...e,active:e.id===f})),[f,N]),{homeHref:K,serverHrefs:$}=(y=(0,A.O)(),b=(0,n.useCallback)(e=>{let t=(0,nb.d)(e),n=y?.collections.servers.subscribeChanges(e),a=y?.collections.channels.subscribeChanges(e);return()=>{t(),n?.unsubscribe(),a?.unsubscribe()}},[y]),x=(0,n.useCallback)(()=>{let e=new Map;for(let t of y?.collections.channels.values()??[]){if(!t.serverId||"thread"===t.type||t.pending)continue;let n=e.get(t.serverId)??[];n.push(t.id),e.set(t.serverId,n)}return JSON.stringify({homeHref:(0,eR.e)({serverId:null,last:(0,nb.C)((0,nv.Y)()),breakpoint:a}),serverHrefs:Object.fromEntries(N.map(({id:t})=>[t,nx(y,t,(0,nb.C)((0,eR.n)(t)),a,e.get(t)??[])]))})},[y,N,a]),w=(0,n.useCallback)(()=>JSON.stringify({homeHref:(0,eR.e)({serverId:null,last:null,breakpoint:a}),serverHrefs:Object.fromEntries(N.map(({id:e})=>[e,(0,eR.e)({serverId:e,last:null,breakpoint:a})]))}),[N,a]),k=(0,n.useSyncExternalStore)(b,x,w),(0,n.useMemo)(()=>JSON.parse(k),[k])),F=(0,n.useCallback)(e=>nx(j,e,(0,eR.N)(e),a),[a,j]),U=(0,n.useCallback)(t=>{(0,nm.f)("server",t),e.push(F(t))},[e,F]),_=(0,n.useCallback)(()=>(0,eR.e)({serverId:null,last:(0,nv.A)(),breakpoint:a}),[a]),B=(0,n.useCallback)(()=>{e.push(_())},[_,e]),V=(0,n.useCallback)(async(t,n)=>{if(!R(M.get().generation))return;let{assertAccount:a,assertUi:r}=D();try{a();let i=await L({name:t});r();let s=i.server.id;(0,eM.toast)(`Server "${t}" created`),n&&T({serverId:s,file:n},{onError:e=>(0,eJ.w)(e,"Server created, but the icon failed to upload",r)}),e.push(`/c/channels/${s}`)}catch(e){(0,eJ.w)(e,"Failed to create server",r)}},[D,L,e,T,M,R]),W=(0,n.useCallback)(e=>{if(!R(M.get().generation))return;let{assertAccount:n,assertUi:a}=D();try{n()}catch{return}(0,eO.e)(t,e),z({serverId:e},{onSuccess:()=>{try{n()}catch{return}try{a(),(0,eM.toast)("Left server")}catch{}let t=M.get().navigation;if(t&&(0,eA.B)(t.navigationPending?t.pendingHref??"":t.publishedHref)===e){let n=new Set([...j.collections.serverMemberships.values()].filter(e=>e.viewer&&e.userId===j.accountId).map(e=>e.serverId)),a=[...j.collections.servers.values()].filter(e=>n.has(e.id)).sort((e,t)=>(e.position??0)-(t.position??0));t.replace((0,eO.D)(a,e))}},onError:e=>(0,eJ.w)(e,"Failed to leave server",a)})},[D,j,z,t,R,M]),H=(0,n.useCallback)(t=>{if(!t)return;let n=ny({targetServerId:t,activeServerId:d,overlay:"settings",hasActiveOpener:!!m,publishedHref:e.publishedHref});"open-active"===n.kind?m?.():e.push(n.href)},[d,e,m]),Y=(0,n.useCallback)(t=>{if(!t)return;let n=ny({targetServerId:t,activeServerId:d,overlay:"invite",hasActiveOpener:!!h,publishedHref:e.publishedHref});"open-active"===n.kind?h?.():e.push(n.href)},[d,e,h]),Q=(0,n.useCallback)((t,n)=>{((0,nm.f)(n?"channel":"server",n??t),n)?e.push(`/c/channels/${t}/${n}`):e.push(F(t))},[e,F]);return{railProps:{servers:q,homeHref:K,serverHrefs:$,folders:P,activeServerId:f,serversLoading:I.isPending&&0===N.length,view:u,onHome:B,onServerNavigate:U,onCreateServer:V,onLeaveServer:E?W:void 0,onOpenSettings:E?H:void 0,onOpenInvitePopover:E?Y:void 0},navigate:Q}}({navigation:q,queryClient:w,breakpoint:S,view:d,activeServerId:f,projectedView:ea,projectedActiveServerId:er,onOpenActiveServerSettings:v,onOpenActiveServerInvite:y,accountId:k.id}),es=function({router:e,queryClient:t,cancelPendingNavigation:d,view:f,activeServerId:m}){let h,p,g,v,y,b,x,w,k,j=(0,u.F)(),S=(0,J.f)(JSON.stringify(["shell-profile",f,m])),N=(0,a.usePathname)(),E=(0,a.useSearchParams)(),R=(0,ty.N)(E.get("billing")),D="billing"===E.get("settings")||!!R,L=()=>{if(Y(!1),D){let e=new URLSearchParams(E.toString());e.delete("settings"),e.delete("billing"),window.history.replaceState(null,"",`${N}${e.size?`?${e}`:""}${window.location.hash}`)}},z=(0,F.$)(),T=(0,nI.z)(),{friends:q,blocked:K}=T,$="server"===f?m??null:null,{members:U}=(0,nS.h)($),_=(0,nN.f)(),{accept:B}=(0,nE.f)(),V=(0,nP.a)(),W=(0,nP.s)(),[H,Y]=(0,o.f)((0,l.f)(!1)),[G,X]=(0,o.f)((0,l.f)(null)),[Z,ee]=(0,o.f)((0,l.f)(null)),[et,en]=(0,o.f)((0,l.f)(null)),ea=(0,l.f)(null),[er,ei]=(0,o.f)(ea),es=(0,n.useCallback)(e=>{e.release(),ei(t=>t===e?null:t)},[ei]);(0,n.useLayoutEffect)(()=>{if(!er)return;let e=()=>es(er);return er.assertActive.signal.aborted?e():er.assertActive.signal.addEventListener("abort",e,{once:!0}),()=>{er.assertActive.signal.removeEventListener("abort",e),er.release()}},[es,er]);let eo=G?.data.userId,el=!!eo&&eo!==z.id&&void 0!==T.data&&!K.some(e=>e.userId===eo)&&q.some(e=>e.userId===eo),ec=(0,A.$)(eo);(0,i.f)({queryKey:c.f.profile(eo??"__none__"),enabled:!!eo&&eo!==z.id,queryFn:(0,nk.j)(eo??""),staleTime:nk.y});let eu=(0,n.useMemo)(()=>G?{...G,data:{...G.data,contextLabel:nC($,U.find(e=>e.userId===eo)),mutual:ec?.mutualServers??0,identity:ec?.kind==="bot"&&ec.ownerUserId&&ec.ownerHandle?{kind:"bot",ownerProfile:{id:ec.ownerUserId,handle:ec.ownerHandle},ownedByViewer:ec.ownedByViewer??!1}:ec?.kind==="human"||eo===z.id?{kind:"human"}:void 0}}:null,[G,$,U,eo,ec,z.id]),ed=(0,n.useCallback)((e,t,n,a,r)=>{if(r&&r===z.id){let e=$?U.find(e=>e.userId===z.id):void 0;X({data:{userId:z.id,contextLabel:nC($,e),mutual:0,identity:{kind:"human"}},x:t,y:n});return}let i=function(e,t,n){let{name:a,discriminator:r,userId:i}=n;return(i?(e??[]).find(e=>e.userId===i)??(t??[]).find(e=>e.userId===i):void 0)??(r?(e??[]).find(e=>e.name===a&&e.discriminator===r)??(t??[]).find(e=>e.name===a&&e.discriminator===r):void 0)??(e??[]).find(e=>e.name===a)??(t??[]).find(e=>e.name===a)}(U,q,{name:e,discriminator:a,userId:r}),s=i?.userId??r;X({data:{...s?{userId:s}:{name:e,discriminator:a},contextLabel:nC($,i),mutual:0},x:t,y:n})},[z.id,q,U,$,X]),ef=(0,n.useCallback)((e,t,n,a)=>{ed(e,t.clientX,t.clientY,n,a)},[ed]),em=(0,n.useCallback)(e=>{if(!eu)return;let t=(0,nw.r)(e.handle);t&&ed(t.name,eu.x,eu.y,t.discriminator,e.id)},[ed,eu]),eh=(0,n.useCallback)(t=>{d(),e.push(`/c/me/bots?audit=${encodeURIComponent(t)}`),X(null)},[d,e,X]),ep=(0,n.useCallback)(e=>ee(e),[ee]),eg=(0,n.useCallback)(e=>en(e),[en]),ev=async(e,t)=>{let n=S.capture();try{await V.mutateAsync({statusEmoji:e,statusText:t,assertActive:n}),n()}catch(e){(0,eJ.w)(e,"Failed to update status",n)}},ey=async(t,n)=>{let a,r=S.capture();if(r(),!t)return void(0,eM.toast)("Could not find user");d();let i=e.captureIntent?.()??(()=>!0),s=()=>{if(r(),!i())throw new DOMException("Retired profile navigation","AbortError")};try{let e=await _.mutateAsync({userId:t,assertActive:r});s(),a=e.conversation.id}catch(e){(0,eJ.w)(e,"Failed to open DM",s);return}let o=n.trim();if(o){let e=B({assertActive:r,dmId:a,content:o,author:{id:z.id,name:z.name,avatar:z.avatar}});if(!e.accepted)return void(0,eM.toast)("Failed to send message");e.committed}e.push(`/c/me/${a}`)},eb=async e=>{let t=S.capture();try{await V.mutateAsync({...e,assertActive:t}),t()}catch(e){(0,eJ.w)(e,"Failed to save profile",t)}},ex=(h=(0,s.d)(),p=(0,r.D)(h),g=(0,n.useCallback)(()=>{if(!p)throw new DOMException("Missing sign-out account","AbortError");if((0,r.D)(h)!==p)throw new DOMException("Retired sign-out account","AbortError");let e=(0,O.TV)(h);return(0,O.ot)(h,e,void 0),{registry:p,token:e,authenticationGeneration:p.authenticationView.get().generation}},[h,p]),v=(0,Q.f)({meta:{observabilityAction:"account.sign_out"},mutationKey:["community","sign-out"],scope:{id:"account-sign-out"},gcTime:0,mutationFn:async({registry:e,token:t})=>{let n=()=>(0,O.ot)(h,t,void 0);n();let a=e.authenticationView.get().generation,r=new AbortController,i=e.runtime.lifecycle.subscribe(()=>{try{n()}catch{r.abort()}});try{let t=await (0,P.Q)(n,{fetchOptions:{signal:r.signal,onRequest:n,onSuccess:n}});if(t?.error)throw n(),Error(t.error.message||"Failed to log out");(0,M.d)(e),await e.retireDisk().catch(e=>{console.error("Account disk cache retirement failed",e)});let i=e.sessionViewer();return e.authenticationView.get().active&&e.authenticationView.get().generation===a&&(null==i||i===e.accountId)}catch(e){throw n(),e}finally{i.unsubscribe()}}}),y=(0,n.useCallback)(e=>{if(!e)return;let t=e=>{let t=e.registry.authenticationView.get(),n=e.registry.sessionViewer();return(0,r.D)(h)===e.registry&&t.active&&t.generation===e.authenticationGeneration&&(null==n||n===e.registry.accountId)},n=e=>{try{return(0,O.ot)(h,e.token,void 0),!0}catch{return!1}};return{onSuccess:(n,a,r,i)=>{n&&t(a)&&e.onSuccess?.(n,void 0,r,i)},onError:(t,a,r,i)=>{n(a)&&e.onError?.(t,void 0,r,i)},onSettled:(a,r,i,s,o)=>{(r?n(i):a&&t(i))&&e.onSettled?.(a,r,void 0,s,o)}}},[h]),b=v.mutate,x=v.mutateAsync,w=(0,n.useCallback)((e,t)=>b(g(),y(t)),[b,g,y]),k=(0,n.useCallback)((e,t)=>x(g(),y(t)),[x,g,y]),{...v,mutate:w,mutateAsync:k}),ew=async()=>{let e=(0,O.TV)(t);try{await ex.mutateAsync()&&globalThis.location.replace("/sign-in")}catch(n){(0,eJ.w)(n,"Failed to log out",()=>(0,O.ot)(t,e,void 0))}},ek=async()=>{d(),j.ui.actions.reset(),j.ws.actions.reset(),j.messageStream.actions.resetAll(),(0,I.z)(t),(0,C.m)(t),t.clear(),Y(!1)},ej={onClose:L,initialTab:D?"billing":"profile",billingReturn:R,userId:z.id,userName:z.name,userEmail:z.email,aboutMe:z.aboutMe??"",avatar:z.avatar,statusEmoji:z.statusEmoji,statusText:z.statusText,onUploadAvatar:()=>{let e=S.capture(),t=document.createElement("input");t.type="file",t.accept="image/png,image/jpeg,image/webp",t.onchange=()=>{try{e()}catch{return}let n=t.files?.[0];if(!n)return;let a=(0,nj.b)(n);if(!a.ok)return void(0,eM.toast)(a.error);let r=URL.createObjectURL(n),i=!1;ea.get()?.release(),ei({src:r,fileName:n.name,assertActive:e,release:()=>{i||(i=!0,URL.revokeObjectURL(r))}})},t.click()},onSave:eb,onLogout:ew,onAccountDeleted:ek},eC=null;return er&&(eC={imageSrc:er.src,originalFileName:er.fileName,onCropped:e=>{let t=er.assertActive;if(ea.get()!==er)return void er.release();try{t()}catch{es(er);return}W.mutate({file:e,assertActive:t},{onSuccess:()=>{try{t()}catch{return}(0,eM.toast)("Avatar updated")},onError:e=>(0,eJ.w)(e,"Failed to upload avatar",t)}),es(er)},onCancel:()=>{es(er)}}),{currentUser:z,openProfile:ef,openOwnerProfile:em,openBotAudit:eh,previewImage:ep,previewAttachment:eg,profile:eu,canMessage:el,closeProfile:()=>X(null),profileMessage:ey,updateOwnStatus:ev,preview:Z,closePreview:()=>ee(null),attachmentPreview:et,onAttachmentPreviewOpenChange:e=>{e||en(null)},editingProfile:H||D,openUserSettings:()=>Y(!0),onUserSettingsOpenChange:e=>{e||L()},userSettingsProps:ej,pendingAvatarCrop:eC}}({router:q,queryClient:w,cancelPendingNavigation:q.cancelPendingNavigation,view:d,activeServerId:f}),eo=function({router:e,queryClient:t,cancelPendingNavigation:a,publishedHref:r,navigationPending:i,pendingHref:s,viewerId:c,accessEpoch:u}){let d=(0,n.useCallback)(t=>{e.pushImmediate?e.pushImmediate(t):e.push(t)},[e]),f=(0,nM.b)(),m=f.servers,h=f.dms,p=f.mentions,g=f.isLoading,[v,y]=(0,o.f)((0,l.f)(!1)),[b,x]=(0,o.f)((0,l.f)("unreads")),w=(0,n.useRef)({unreads:0,mentions:0,marked:0}),k=(0,nM.D)(v),{mutate:j}=(0,nK.Y)(),C=(0,nT.b)(),I=(0,nT.H)(),S=(0,nq.t)(),P=(0,nq.e)(),E=function({queryClient:e,publishedHref:t,navigationPending:a,pendingHref:r}){let i,s=(0,l.f)(!1),[c,u]=(0,o.f)(s),d=((i=nD.get(e))||(i={value:(0,nO.f)({lease:null,nextEpoch:0})},nD.set(e,i)),i),f=(0,N.f)(d.value,e=>e.lease),m=f?.target??null,h=(0,l.f)(t),p=(0,n.useCallback)(e=>{d.value.get().lease?.epoch!==e.epoch||(nL(d,{...e,phase:"committed"}),(0,nR.z)(e.ticket))},[d]),g=(0,n.useCallback)((e,t=!1)=>{let n=d.value.get().lease;return!!n&&n.epoch===e&&((0,nR.w)(n.ticket),nL(d,null),t&&u(n.previousOpen),!0)},[d,u]),v=(0,n.useCallback)((n,a)=>{let r=d.value.get().lease;r&&(0,nR.w)(r.ticket);let i=(d.value.setState(e=>({...e,nextEpoch:e.nextEpoch+1})),d.value.get().nextEpoch),o=s.get(),l=(0,nR.x)(e,i,n,e=>{let t=d.value.get().lease;t&&t.epoch===e.epoch&&nL(d,null)});return nL(d,{epoch:i,target:n,destinationHref:a,originHref:t,previousOpen:o,phase:"submitting",submitted:!1,navigationObserved:!1,ticket:l}),u(!1),i},[d,s,e,t,u]),y=(0,n.useCallback)(e=>{let n=d.value.get().lease;if(!n||n.epoch!==e)return!1;let a={...n,submitted:!0};return nL(d,a),nz(t,n.destinationHref)&&p(a),!0},[p,t,d]),b=(0,n.useCallback)(()=>{let e=d.value.get().lease;e&&(0,nR.w)(e.ticket),nL(d,null);let t=s.get();return u(!1),t},[d,s,u]),x=(0,n.useCallback)(e=>{u(e)},[u]),w=(0,n.useCallback)(e=>!!e&&!!m&&m.identity===e.identity&&m.fingerprint===e.fingerprint,[m]),k=(0,n.useCallback)(e=>d.value.get().lease?.epoch===e,[d]);return(0,n.useEffect)(()=>{let e=d.value.get().lease;if(e&&e.submitted&&"submitting"===e.phase){if(nz(t,e.destinationHref))return void p(e);if(a&&nz(r,e.destinationHref)){e.navigationObserved||nL(d,{...e,navigationObserved:!0});return}(e.navigationObserved||t!==e.originHref||a&&null!==r)&&g(e.epoch)}},[p,a,r,f,t,g,d]),(0,n.useEffect)(()=>{let e=h.get();h.set(t),!nz(e,t)&&s.get()&&u(!1)},[t,h,s,u]),{open:c,projectionTarget:m,onOpenChange:x,beginProjection:v,markProjectionSubmitted:y,rollbackProjection:g,closeWithoutProjection:b,isProjected:w,isLatestProjection:k}}({queryClient:t,publishedHref:r,navigationPending:i,pendingHref:s}),M=(0,n.useCallback)(e=>{x(e),"marked"===e&&y(!0)},[x,y]),A=(0,n.useCallback)(e=>w.current[e],[]),R=(0,n.useCallback)((e,t)=>{w.current[e]=t},[]),D=(0,n.useCallback)(e=>S.mutateAsync({friendshipId:e}),[S]),L=(0,n.useCallback)(e=>P.mutateAsync({friendshipId:e}),[P]),z=(0,n$.f)({rows:f.friendRequests,onAccept:D,onReject:L,surface:"inbox"}),T=(0,n.useCallback)((e,n,r,i,s)=>{let o=E.beginProjection(e,n);a(),(0,nF.W)(t);let l=nH(t,{...r,href:n,viewerId:c},u),f=n;try{f=i?.()??n,d(f),E.markProjectionSubmitted(o)&&s?.()}catch(n){(0,nW.n)(t,l);let e=new URLSearchParams(f.split("?")[1]??"").get("inboxThreadOpener");throw e&&(0,nR.m)(t,e),E.isLatestProjection(o)&&(a(),E.rollbackProjection(o,!0)),n}},[u,a,E,d,t,c]),q=(0,n.useCallback)((e,n,r)=>{let i=(0,eA.O)(e.serverId,n.channelId),s=r?(0,nR._)(e,n):null;if(!s){let r=E.closeWithoutProjection();a(),(0,nF.W)(t);let s=nH(t,{href:i,viewerId:c,channelId:n.channelId,serverId:e.serverId,scopeKind:"channel",expectedSurfaceKind:"forum"===n.type?"forum":"channel"},u);try{d(i)}catch(e){throw(0,nW.n)(t,s),a(),E.onOpenChange(r),e}return}T(s,i,{channelId:n.channelId,serverId:e.serverId,scopeKind:"channel",expectedSurfaceKind:"forum"===n.type?"forum":"channel"})},[u,a,E,d,T,t,c]),K=(0,n.useCallback)((e,n,a)=>{let r=(0,nR.V)(e,n,a),i=(0,eA.O)(e.serverId,a.channelId);T(r,i,{channelId:a.channelId,serverId:e.serverId,scopeKind:"channel",expectedSurfaceKind:"thread"},()=>a.openerMessageId&&!0===a.openerUnread&&void 0!==a.openerSeq?(0,nF.x)(t,{serverId:e.serverId,parentChannelId:a.parentChannelId??n.channelId,childChannelId:a.channelId,openerMessageId:a.openerMessageId,openerSeq:a.openerSeq}):i)},[T,t]),$=(0,n.useCallback)(e=>{let n=E.closeWithoutProjection();a(),(0,nF.W)(t);let r=null!=e.m.seq?`?seq=${e.m.seq}`:"",i=e.serverId?`${(0,eA.O)(e.serverId,e.channelId)}${r}`:`/c/me/${e.channelId}${r}`,s=nH(t,{href:i,viewerId:c,channelId:e.channelId,...e.serverId?{serverId:e.serverId}:{},scopeKind:e.serverId?"channel":"dm",...e.serverId?{anchorMessageId:e.m.id}:{},...!e.serverId?{expectedSurfaceKind:"dm"}:{}},u);try{d(i)}catch(e){throw(0,nW.n)(t,s),a(),E.onOpenChange(n),e}},[u,a,E,d,t,c]),F=(0,n.useCallback)(e=>{let n=e.channelId;T((0,nR.d)(e),`/c/me/${n}`,{channelId:n,scopeKind:"dm",expectedSurfaceKind:"dm"},()=>{let n={id:e.channelId,userId:e.otherUserId,name:e.otherUserName,discriminator:e.otherUserDiscriminator,avatar:e.otherUserAvatar,avatarVersion:e.otherUserAvatarVersion,status:"offline",preview:"",activityAt:e.lastMessageAt,unread:!1};(0,O.R8)(t,n)},()=>{(0,nA.f)(t,null,n).catch(()=>void 0)})},[T,t]),U=(0,n.useCallback)(e=>{let t=(0,nR.C)(e);t&&e.serverId&&e.channelId&&T(t,`${(0,eA.O)(e.serverId,e.channelId)}?msg=${e.m.id}`,{channelId:e.channelId,serverId:e.serverId,scopeKind:"channel",anchorMessageId:e.m.id})},[T]),_=(0,n.useCallback)(()=>{let e=E.closeWithoutProjection();a();try{d("/c/me/friends?tab=new")}catch(t){throw a(),E.onOpenChange(e),t}},[a,E,d]),B={friendRequests:z.items,unreads:m,unreadDms:h,mentions:p,marked:k.marked,markedLoading:k.isLoading,loading:g,attentionError:f.isInitialError,onRetryAttention:()=>{f.refetch()},hasProjectedUnreads:f.hasUnread,hasProjectedMentions:f.hasMention,onOpenChannel:q,onOpenThread:K,onOpenDm:F,onOpenMention:U,onOpenMarked:$,onOpenFriendRequests:_,onAcceptFriendRequest:e=>{z.act(e,"accept")},onRejectFriendRequest:e=>{z.act(e,"reject")},onRetryFriendRequest:e=>{z.retry(e)},activeTab:b,onActiveTabChange:M,onMarkedTabSelected:()=>y(!0),getScrollOffset:A,onScrollOffsetChange:R,onMarkAllRead:()=>{C.mutate()},onDeleteMention:e=>I.mutate({mentionId:e}),onUnmark:e=>j({messageId:e})},V=f.exactAttentionCount;return{popoverProps:B,unreadCount:V,unreadCountPartial:!1,hasUnread:V>0,open:E.open,onOpenChange:E.onOpenChange}}({router:q,queryClient:w,cancelPendingNavigation:q.cancelPendingNavigation,publishedHref:q.publishedHref,navigationPending:q.navigationPending,pendingHref:q.pendingHref,viewerId:k.id,accessEpoch:j}),[el,ec]=(0,o.f)((0,l.f)(nr)),eu=(0,n.useCallback)(e=>{ec(t=>(function(e,t){switch(t.type){case"update.sync":{if(e.update)return nc(e,t.eligibleMachineIds);if(0===t.eligibleMachineIds.length)return e;let n=t.collapsed||"none"!==e.active;return{active:n?e.active:"update",update:{phase:n?"collapsedBadge":"expanded",targetMachineIds:ni(t.eligibleMachineIds),acceptedMachineIds:[],failedMachineIds:[],pendingMachineIds:[]}}}case"update.eligibility":return nc(e,t.eligibleMachineIds);case"update.clear":return{active:"update"===e.active?"none":e.active,update:null};case"update.open":if(!e.update)return e;return{active:"update",update:{...e.update,phase:"collapsedBadge"===e.update.phase?"expanded":e.update.phase}};case"update.collapse":if(!e.update)return"update"===e.active?{...e,active:"none"}:e;return{active:"update"===e.active?"none":e.active,update:{...e.update,phase:"expanded"===e.update.phase?"collapsedBadge":e.update.phase}};case"update.dispatch":{if(!e.update)return e;let n=new Set(t.machineIds);return{active:"update",update:{...e.update,phase:"updating",failedMachineIds:ns(e.update.failedMachineIds,n),pendingMachineIds:ni([...e.update.pendingMachineIds,...t.machineIds])}}}case"update.settle":{if(!e.update)return e;let n=new Set(e.update.targetMachineIds),a=t.acceptedMachineIds.filter(e=>n.has(e)),r=t.failedMachineIds.filter(e=>n.has(e)),i=new Set(a),s=new Set(r),o=new Set([...i,...s]),l=ni([...ns(e.update.acceptedMachineIds,s),...a]),c=ni([...ns(e.update.failedMachineIds,i),...r]);return{active:e.active,update:{...e.update,phase:c.length>0?"retry":"updating",acceptedMachineIds:l,failedMachineIds:c,pendingMachineIds:ns(e.update.pendingMachineIds,o)}}}case"extension.open":return{active:t.extension,update:e.update?.phase==="expanded"?{...e.update,phase:"collapsedBadge"}:e.update};case"extension.close":if(t.extension&&e.active!==t.extension)return e;return{active:"none",update:e.update?.phase==="expanded"?{...e.update,phase:"collapsedBadge"}:e.update}}})(t,e))},[ec]),ed=function({userId:e,extensionState:t,dispatch:a,latestDaemonVersion:r="0.1.50",requestUpdate:i=n2}){let s=(0,X.f)(),o=(0,n.useRef)(null);(0,n.useLayoutEffect)(()=>()=>{o.current=null},[s.registry,e,r]);let l=(0,ey.t)(),c=(0,n.useMemo)(()=>{var e;return r?(e=l.machines,(0,nJ.n)(r)?e.filter(e=>{let t=e.daemonVersion;return!!(0,n0.d)(e.status)&&!!t&&!!(0,nJ.n)(t)&&(0,nJ.T)(t,nZ.W)&&!(0,nJ.T)(t,r)}):[]):[]},[r,l.machines]),u=(0,n.useMemo)(()=>c.map(e=>e.id),[c]);(0,n.useLayoutEffect)(()=>{let e=new Set(u);for(let t of o.current?.machineIds??[])e.has(t)||o.current?.machineIds.delete(t)},[u]);let d=(0,n.useMemo)(()=>({registry:s.registry,userId:e,latestDaemonVersion:r}),[s.registry,e,r]),f=(0,n.useRef)(d);(0,n.useEffect)(()=>{f.current!==d&&(f.current=d,a({type:"update.clear"}))},[a,d]);let m=t.update;(0,n.useEffect)(()=>{if(r&&(0,nJ.n)(r)&&l.isSuccess){if(0===u.length){n5(e,r,!1),a({type:"update.clear"});return}if(!m)return void a({type:"update.sync",collapsed:function(e,t){try{return"1"===window.localStorage.getItem(n4(e,t))}catch{return!1}}(e,r),eligibleMachineIds:u});a({type:"update.eligibility",eligibleMachineIds:u})}},[a,u,r,l.isSuccess,m,e]);let h=(0,n.useCallback)(()=>{r&&t.update&&(n5(e,r,!0),a({type:"update.collapse"}))},[a,t.update,r,e]),p=(0,n.useCallback)(()=>{r&&t.update&&(n5(e,r,!1),a({type:"update.open"}))},[a,t.update,r,e]),g=(0,n.useCallback)(async()=>{let e=t.update;if(!e||e.pendingMachineIds.length>0)return;let n=function(e,t){let n=new Set(t);if("retry"===e.phase)return e.failedMachineIds.filter(e=>n.has(e));let a=new Set(e.acceptedMachineIds),r=new Set(e.pendingMachineIds);return e.targetMachineIds.filter(e=>n.has(e)&&!a.has(e)&&!r.has(e))}(e,u);if(0===n.length)return;let r=s.begin().token,l=s.registry.authenticationView.get();s.assertOwner(r);let c={machineIds:new Set(n)};o.current=c,a({type:"update.dispatch",machineIds:n});let d=await n3(n,i);try{s.assertOwner(r)}catch{return}let f=s.registry.authenticationView.get();if(!f.active||f.generation!==l.generation||o.current!==c)return;let m=c.machineIds;for(let e of(d.acceptedMachineIds=d.acceptedMachineIds.filter(e=>m.has(e)),d.failedMachineIds=d.failedMachineIds.filter(e=>m.has(e)),d.failedMachineIds))n1.f.warn("daemon update request failed",{machineId:e});a({type:"update.settle",...d})},[a,u,t.update,i,s]);return{eligibleMachines:c,eligibleMachineIds:u,update:m,collapse:h,open:p,request:g}}({userId:k.id,extensionState:el,dispatch:eu}),ef=(0,n.useCallback)(e=>{if(!e){eo.onOpenChange(!1),eu({type:"extension.close",extension:"inbox"});return}"profile"===el.active&&es.closeProfile(),"update"===el.active&&ed.collapse(),eo.onOpenChange(!0),eu({type:"extension.open",extension:"inbox"})},[ed,eu,eo,es,el.active]),[em,eh]=(0,o.f)((0,l.f)(null)),ep=(0,n.useCallback)(()=>{if(eh(null),"mobile"!==S||"detail"!==L.surface&&"detail"!==en.surface)return void ef(!0);let e={viewerId:k.id,isCurrent:q.captureIntent({nextCommitHref:"/c/me"})};q.push("/c/me"),eh(e)},[S,en.surface,L.surface,k.id,q,ef,eh]);(0,n.useEffect)(()=>{!em||(em.viewerId===k.id&&em.isCurrent()?q.navigationPending||null!==q.pendingHref||"/c/me"!==q.publishedHref||"/c/me"!==L.href||"list"!==en.surface||(eh(null),ef(!0)):eh(null))},[en.surface,L.href,k.id,em,q.navigationPending,q.pendingHref,q.publishedHref,ef,eh]),(0,eU.m)(k.id,L,q,x);let eg=(0,n.useCallback)((e,t,n,a)=>{if("profile"===el.active){es.closeProfile(),eu({type:"extension.close",extension:"profile"});return}"inbox"===el.active&&eo.onOpenChange(!1),"update"===el.active&&ed.collapse(),es.openProfile(e,t,n,a),eu({type:"extension.open",extension:"profile"})},[ed,eu,eo,es,el.active]),ev=(0,n.useCallback)(()=>{"inbox"===el.active&&eo.onOpenChange(!1),"profile"===el.active&&es.closeProfile(),ed.open()},[ed,eo,es,el.active]),eb=(0,n.useCallback)(()=>{"inbox"===el.active&&eo.onOpenChange(!1),"profile"===el.active&&es.closeProfile(),"update"===el.active&&ed.collapse(),eu({type:"extension.close",extension:el.active})},[ed,eu,eo,es,el.active]);(0,n.useEffect)(()=>{"mobile"===S&&"detail"===en.surface&&"none"!==el.active&&eb()},[S,en.surface,eb,el.active]);let ex=(0,n.useCallback)(()=>("mobile"!==S||"detail"!==en.surface)&&"none"!==el.active&&(eb(),!0),[S,en.surface,eb,el.active]),ew=(0,n.useCallback)(()=>{$.parentPath&&q.replace($.parentPath)},[q,$.parentPath]);return!function({dismissShellOverlay:e,parentPath:t,replacePath:a}){(0,n.useEffect)(()=>{let n=n=>{!n.cancelable||(0!==document.querySelectorAll('[data-slot="dialog-content"],[data-slot="alert-dialog-content"],[data-slot="sheet-content"]').length&&(document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",code:"Escape",bubbles:!0,cancelable:!0})),1)||e()?n.preventDefault():t&&(n.preventDefault(),a(t)))};return window.addEventListener(n7,n),()=>window.removeEventListener(n7,n)},[e,t,a])}({dismissShellOverlay:ex,parentPath:$.parentPath,replacePath:K}),(0,n.useEffect)(()=>{"inbox"!==el.active||eo.open||eu({type:"extension.close",extension:"inbox"})},[eu,eo.open,el.active]),(0,n.useEffect)(()=>{"profile"!==el.active||es.profile?.data.userId!==k.id&&eu({type:"extension.close",extension:"profile"})},[k.id,eu,es.profile,el.active]),(0,n.useEffect)(()=>{"mobile"===S&&E?.status==="active"&&"server"===E.stage&&"detail"===$.surface&&$.parentPath&&K($.parentPath)},[S,E,K,$.parentPath,$.surface]),(0,n.useEffect)(()=>{(0,u.A)(w).ui.actions.registerUiHandlers({previewImage:es.previewImage,previewAttachment:es.previewAttachment,openProfile:es.openProfile,goBackMobile:ew,navigatePath:q.push,replacePath:q.replace,navigate:ei.navigate,cancelPendingNavigation:q.cancelPendingNavigation})},[ew,es.openProfile,es.previewAttachment,es.previewImage,ei.navigate,q.cancelPendingNavigation,q.push,q.replace,w]),(0,t.jsx)(e_.W,{value:{breakpoint:S,frame:L,navigation:q,ownerDeleteRouteScope:b,openInbox:ep,notificationConsumer:x},children:(0,t.jsx)(nf,{breakpoint:S,checkpoint:en,sidebar:h,extraDialogs:g,rail:ei,profile:es,inbox:eo,userBarExtension:el,daemonUpdate:ed,onUserBarInboxOpenChange:ef,onUserBarOpenProfile:eg,onUserBarOpenUpdate:ev,dismissUserBarExtension:eb,children:p})})}function n6({sidebar:e,children:r}){let i=(0,a.useSelectedLayoutSegments)(),o=i.length?`/c/${i.join("/")}`:"/c",l=(0,eA.B)(o),c=(0,s.d)(),d=(0,F.$)(),f=(0,n.useMemo)(()=>l?{serverId:l,token:(0,eO.C)(c)}:void 0,[c,l]),m=(0,n.useCallback)(()=>e,[e]);return(0,n.useLayoutEffect)(()=>{(0,u.A)(c).ui.actions.setCurrentServerId(l)},[c,l]),(0,t.jsx)(n9,{view:l?"server":"dm",activeServerId:l??void 0,frameHref:o,sidebar:m,ownerDeleteRouteScope:f,children:r},d.id)}function ae({redirectTo:e}={}){let t=(0,a.useRouter)(),r=(0,eF.$)(),i=(0,A.O)();return(0,n.useEffect)(()=>{if("unknown"===r)return;let n=document.cookie.match(/(?:^|; )is_sign_in=([^;]*)/);n&&(document.cookie="is_sign_in=; max-age=0; path=/",(0,ef.r)({event:"sign_in_success",method:n[1]}));let a=document.cookie.match(/(?:^|; )is_new_signup=([^;]*)/);if(a&&(document.cookie="is_new_signup=; max-age=0; path=/",(0,ef.r)({event:"sign_up",method:a[1]}),"mobile"!==r&&e)){if(e.startsWith("/c/")){if(!i?.runtime.lifecycle.get().active)return;(0,ee.$)(i.runtime),t.replace(e);return}window.location.replace(e)}},[r,e,t,i]),null}var at=e.i(181402),an=e.i(824863),aa=e.i(88723),ar=e.i(395207);let ai={isDesktopTauri:()=>(0,an.m)()&&(0,an.y)(),invoke:an.Y,postCancel:e=>fetch("/api/auth/native/cancel",{method:"POST",credentials:"same-origin",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(15e3)})};async function as(e=ai){if(!e.isDesktopTauri())return;let t=ar.f.nullable().parse(await e.invoke("native_oauth_snapshot"));if(!t)return;let n=aa.f.nullable().parse(await e.invoke("native_oauth_cancel",{attemptId:t.attemptId}));n&&await e.postCancel(n).catch(()=>{})}function ao(){return(0,n.useEffect)(()=>{as().catch(()=>{})},[]),null}var al=e.i(455393);e.s(["CommunityLayoutClient",0,function({children:e,sidebar:r,currentUser:i}){let s=(0,a.useRouter)(),o=(0,a.usePathname)(),l="public-invite"===(0,eA.P)(o).route;return((0,n.useEffect)(()=>{l||i||s.replace("/sign-in")},[i,l,s]),(0,n.useEffect)(()=>{i?(0,al.j)(i.id,o):(0,al.k)()},[i,o]),l)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ae,{}),e]}):i?(0,t.jsxs)(at.N,{children:[(0,t.jsx)(ao,{}),(0,t.jsxs)(eT,{currentUser:i,children:[(0,t.jsx)(ae,{redirectTo:"/c/me/machines"}),(0,t.jsx)(n6,{sidebar:r,children:e})]})]}):(0,t.jsx)(ez.f,{pathname:o})}],200069)},401462,e=>{var t=e.i(895231),n=e.i(18745),a=e.i(215932);e.s(["CommunitySessionFallback",0,function(){let e=(0,n.usePathname)();return(0,t.jsx)(a.f,{pathname:e})}])},109762,527668,e=>{var t=e.i(895231),n=e.i(315116),a=e.i(974802),r=e.i(186339),i=e.i(255334),s=e.i(996718),o=e.i(381153);let l="col-start-1 row-start-2 flex min-w-0 items-center gap-1 px-2 thin-scrollbar sm:row-span-2 sm:row-start-1 sm:flex-col sm:items-stretch sm:gap-2 sm:overflow-y-auto sm:p-4",c="h-11 min-w-0 flex-1 flex-row justify-start gap-1 overflow-hidden p-0 group-data-horizontal/tabs:h-11 sm:h-auto sm:w-full sm:flex-none sm:flex-col",u="size-11 justify-center gap-2 px-0 sm:h-9 sm:w-full sm:justify-start sm:px-2",d="sr-only sm:not-sr-only sm:min-w-0 sm:truncate sm:px-2 sm:pt-1 sm:text-xs sm:font-medium sm:text-muted-foreground",f="flex shrink-0 gap-1 sm:mt-auto sm:w-full sm:flex-col sm:border-t sm:border-border/60 sm:pt-2";e.s(["n",0,"size-11 shrink-0 justify-center text-destructive hover:text-destructive sm:h-9 sm:w-full sm:justify-start","M",0,l,"o",0,f,"R",0,d,"j",0,c,"b",0,u],527668),e.s(["I",0,function({value:e,onValueChange:m,label:h,title:p,tabs:g,onClose:v,navFooter:y,disabled:b=!1,children:x}){let w=(0,s.$)();return(0,t.jsxs)(i.i,{orientation:"mobile"===w?"horizontal":"vertical",value:e,onValueChange:e=>m(e),className:`grid min-h-0 w-full flex-1 gap-0 ${a.default.shell}`,"data-testid":o.f.settingsShell,children:[(0,t.jsxs)("header",{className:"col-start-1 row-start-1 flex h-16 min-w-0 items-center px-4 sm:col-start-2 sm:px-8",children:[(0,t.jsx)("h1",{className:"min-w-0 flex-1 truncate text-lg font-medium tracking-tight",children:p}),(0,t.jsx)(r.K,{variant:"ghost",size:"icon-sm",className:"size-11 sm:size-8",onClick:v,disabled:b,"aria-label":"Close settings","data-testid":o.f.settingsClose,children:(0,t.jsx)(n.X,{className:"size-4"})})]}),(0,t.jsxs)("nav",{className:l,style:{background:"var(--d-rail)"},"data-testid":o.f.settingsNav,children:[(0,t.jsx)("div",{className:d,"data-testid":o.f.settingsLabel,children:h}),(0,t.jsx)(i.U,{variant:"line",className:c,children:g.map(({value:e,label:n,icon:a})=>(0,t.jsxs)(i.k,{value:e,disabled:b,className:u,"data-testid":o.f.settingsTab(e),children:[(0,t.jsx)(a,{className:"size-4"}),(0,t.jsx)("span",{className:"sr-only whitespace-nowrap sm:not-sr-only",children:n})]},e))}),y?(0,t.jsx)("div",{className:f,children:y}):null]}),(0,t.jsx)("div",{className:"col-start-1 row-start-3 min-h-0 min-w-0 overflow-y-auto rounded-tl-xl bg-background px-4 pt-6 pb-4 thin-scrollbar sm:col-start-2 sm:row-start-2 sm:p-8 sm:pt-4","data-testid":o.f.settingsContent,children:x})]})},"s",0,function(e){return(0,t.jsx)(i.S,{...e,keepMounted:!0})}],109762)},563932,e=>{e.i(341604),e.s([])},215932,52622,e=>{var t=e.i(895231),n=e.i(8497),a=e.i(250569),r=e.i(708884),i=e.i(996718),s=e.i(622435),o=e.i(381153),l=e.i(800989),c=e.i(742547),u=e.i(727854),d=e.i(551970),f=e.i(888917),m=e.i(613349),h=e.i(259728),p=e.i(190209);let g=()=>()=>{},v="(min-width: 640px)",y={getItem:e=>"u"<typeof localStorage?null:localStorage.getItem(e),setItem:(e,t)=>{"u">typeof localStorage&&localStorage.setItem(e,t)}},b=1+1/64;function x(e){let t=document.documentElement;"number"==typeof e&&(t.style.setProperty(h.t,`${e}px`),t.style.setProperty(h.S,`${(0,h.s)(e)}px`)),t.setAttribute(h.I,"")}function w(){document.documentElement.removeAttribute(h.I)}function k({breakpoint:e,surface:n,rail:a,sidebar:i,main:s,userBar:o,overlays:l,busy:j,label:C,routeKind:I,testId:S,preserveHiddenMobileModules:N=!1}){let{defaultLayout:P,onLayoutChanged:E}=(0,d.G)({id:"community-shell",onlySaveAfterUserInteractions:!0,storage:y}),M=(0,c.useSyncExternalStore)(g,()=>!0,()=>!1),A=M?P?.sidebar:void 0,O=(0,c.useRef)(null),R=(0,c.useRef)(null),D=(0,c.useRef)(null),L=(0,c.useRef)(null),z=(0,c.useRef)(null),T=(0,c.useRef)(e),q=(0,c.useRef)(e),K=(0,c.useRef)(void 0),$=(0,c.useRef)(null),F=(0,c.useRef)(!1);(0,c.useInsertionEffect)(()=>{if(q.current=e,"mobile"===e&&null!==$.current){let{animationFrame:e}=$.current;null!==e&&cancelAnimationFrame(e),$.current=null,w()}"mobile"===T.current&&"desktop"===e&&null===$.current&&($.current={target:(0,h.c)(K.current,A),animationFrame:null},x($.current.target))},[e,A]);let U=(0,c.useCallback)(e=>{z.current?.style.setProperty("--community-desktop-user-bar-width",`${(0,h.s)(e)}px`)},[]),_=(0,c.useCallback)(e=>{if("desktop"!==q.current||null!==$.current)return;let t=O.current?.getBoundingClientRect().width,n=t&&t>0?t:e.inPixels;K.current=n,U(n)},[U]),B=(0,c.useCallback)(()=>{let e=D.current;e&&(e.resize(h.U),queueMicrotask(()=>{let e=R.current?.getLayout();e&&0!==Object.keys(e).length&&E(e,{isUserInteraction:!0})}))},[E]);(0,c.useLayoutEffect)(()=>{let e=e=>{let t=L.current;if(!t)return;let n=t.getBoundingClientRect();e.clientX>=n.left-10&&e.clientX<=n.right+10&&e.clientY>=n.top&&e.clientY<=n.bottom&&B()};return document.addEventListener("dblclick",e,!0),()=>document.removeEventListener("dblclick",e,!0)},[B]),(0,c.useLayoutEffect)(()=>{if(void 0===P||F.current)return;let t=R.current;if(!t)return;let n=document.documentElement.hasAttribute(h.I)&&window.matchMedia(v).matches?O.current?.getBoundingClientRect().width:void 0,a="desktop"===e?O.current?.closest('[data-slot="resizable-panel-group"]')?.getBoundingClientRect().width:void 0,r=a&&a>h.h?Math.min(h.a,Math.max(h.V,P.sidebar/100*(a-h.h))):n;F.current=!0,t.setLayout(P),r&&r>0?(D.current?.resize(r),K.current=r,U(r)):z.current?.style.setProperty("--community-desktop-user-bar-width",(0,h.n)(P.sidebar))},[e,P,U]),(0,c.useLayoutEffect)(()=>{!j&&void 0!==P&&F.current&&null===$.current&&window.matchMedia(v).matches&&requestAnimationFrame(()=>{w()})},[e,j,P]),(0,c.useLayoutEffect)(()=>{T.current=e;let t=$.current;if("desktop"!==e||null===t)return;let n=D.current;if(!n)return;let a=!1,r=()=>{if(a||$.current!==t||"desktop"!==q.current)return;let e=O.current?.closest('[data-slot="resizable-panel-group"]')?.getBoundingClientRect().width,i=e&&e>h.h?e-h.h:void 0,s="string"==typeof t.target?Number.parseFloat(t.target):i?t.target/i*100:void 0;(0,u.flushSync)(()=>{if(w(),void 0!==s){let e=R.current,t=Object.keys(e?.getLayout()??{});for(let n of 2===t.length?[t,t.toReversed()]:[["main","sidebar"],["sidebar","main"]]){let t=Object.fromEntries(n.map(e=>[e,"sidebar"===e?s:100-s])),a=e?.setLayout(t);if(a?.sidebar!==void 0&&.01>=Math.abs(a.sidebar-s))break}}else n.resize(t.target)});let o=n.getSize(),l="number"==typeof t.target?t.target:i&&void 0!==s?Math.min(h.a,Math.max(h.V,s/100*i)):void 0,c=R.current?.getLayout()?.sidebar??o.asPercentage;if(!(void 0===s?void 0!==l&&Math.abs(o.inPixels-l)<=b:.01>=Math.abs(c-s))){x(t.target),t.animationFrame=requestAnimationFrame(r);return}let d=O.current?.getBoundingClientRect().width,f=d&&d>0?d:o.inPixels;if(void 0!==l&&Math.abs(f-l)>b){x(t.target),t.animationFrame=requestAnimationFrame(r);return}K.current=f,U(f),$.current=null};return queueMicrotask(r),()=>{a=!0,null!==t.animationFrame&&cancelAnimationFrame(t.animationFrame),$.current===t&&($.current=null,w())}},[e,P,U]);let V="desktop"===e,W="mobile"===e&&"list"===n,H="mobile"===e&&"detail"===n,Y="unknown"===e,Q=Y&&"detail"===n,G=W||Y&&"list"===n,X=H||Q,J=H||Q,Z=W||Y&&"list"===n,ee=V||W||Y||N,et={"--community-desktop-user-bar-width":(0,h.n)(A),marginLeft:-h.i};return(0,t.jsxs)(p.f,{"aria-busy":j?"true":void 0,"aria-label":C,"data-community-route-kind":I,"data-testid":S,"data-slot":"community-shell-root",children:[(!H||N)&&(0,t.jsx)("div",{inert:H,"aria-hidden":H||void 0,className:(0,m.c)("flex min-h-0",Q&&"hidden sm:contents",H&&N&&"hidden"),children:a}),(0,t.jsxs)("div",{className:(0,m.c)("relative flex min-h-0 min-w-0 flex-1 flex-col",!H&&!Q&&"pt-2",Q&&"pt-0 sm:pt-2"),children:[(0,t.jsx)(r.K,{"data-slot":"community-app-surface",className:(0,m.c)("rounded-tl-xl rounded-tr-none rounded-br-none rounded-bl-none ring-0 border-l border-t border-border/40 shadow-none",H&&"rounded-none border-0 bg-background shadow-none ring-0",Q&&"max-sm:rounded-none max-sm:border-0 max-sm:bg-background max-sm:shadow-none max-sm:ring-0"),children:(0,t.jsxs)(f.C,{id:"community-shell",groupRef:R,orientation:"horizontal",disabled:!V,className:(0,m.c)("min-h-0 flex-1",!V&&["max-sm:*:data-[mobile-active=true]:flex-1!","max-sm:*:data-[mobile-hidden=true]:flex-none!","max-sm:*:data-[mobile-hidden=true]:w-0!","max-sm:*:data-[mobile-hidden=true]:min-w-0!","max-sm:*:data-[mobile-hidden=true]:max-w-0!","max-sm:*:data-[mobile-hidden=true]:overflow-hidden!"]),defaultLayout:M?P:void 0,onLayoutChanged:E,children:[(0,t.jsx)(f.y,{id:"sidebar",panelRef:D,defaultSize:h.U,minSize:h.V,maxSize:h.a,groupResizeBehavior:"preserve-pixel-size",onResize:_,disabled:!V,"data-mobile-active":G||void 0,"data-mobile-hidden":X||void 0,className:(0,m.c)("flex flex-col bg-sidebar",(V||W||Y)&&"pb-[calc(3.75rem+var(--app-safe-area-bottom))] sm:pb-15"),children:(0,t.jsx)("div",{ref:O,"data-slot":"community-sidebar-panel-content","data-community-mobile-surface":W?"list":void 0,hidden:H,inert:H,"aria-hidden":H||void 0,className:(0,m.c)("flex min-h-0 min-w-0 flex-1 flex-col",Q&&"max-sm:hidden"),children:i})}),(0,t.jsx)(f.U,{disabled:!V,className:(0,m.c)("bg-transparent",!V&&"max-sm:w-0! max-sm:min-w-0! max-sm:max-w-0! max-sm:overflow-hidden"),disableDoubleClick:!0,elementRef:L}),(0,t.jsx)(f.y,{id:"main",groupResizeBehavior:"preserve-relative-size",disabled:!V,"data-mobile-active":J||void 0,"data-mobile-hidden":Z||void 0,className:"flex min-w-0 flex-col bg-background",children:(0,t.jsx)("div",{"data-slot":"community-main-panel-content","data-community-mobile-surface":H?"detail":void 0,hidden:W,inert:W,"aria-hidden":W||void 0,className:(0,m.c)("flex min-h-0 flex-1 flex-col",Y&&"list"===n&&"max-sm:hidden"),children:s})})]})}),ee&&(0,t.jsxs)("div",{ref:z,"data-slot":"community-user-bar-overlay",inert:H,"aria-hidden":H||void 0,className:(0,m.c)("absolute bottom-0 left-0 z-10",V&&"w-(--community-desktop-user-bar-width)",Y&&"w-[calc(100%+3.5rem)] sm:w-(--community-desktop-user-bar-width)",Q&&"max-sm:hidden",H&&N&&"hidden"),style:W?{width:`calc(100% + ${h.i}px)`,marginLeft:-h.i}:et,children:[(0,t.jsx)("div",{"data-slot":"community-user-bar-underlay","aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 -z-10 bg-linear-to-t from-(--app-bg) to-transparent",style:{height:h.q}}),o]})]}),l]})}e.s(["f",0,k],52622);var j=e.i(274762),C=e.i(804);e.s(["f",0,function({pathname:e}){let c=(0,i.$)(),u=(0,s.P)(e);return"community"!==u.rail?(0,t.jsx)(p.f,{"data-testid":o.f.initialFrame,"data-community-route-kind":u.route,"aria-busy":"true","aria-label":"Loading community",children:(0,t.jsx)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:(0,t.jsx)(r.K,{className:"rounded-none border-0 bg-background",children:"none"!==u.main.kind&&(0,t.jsx)(l.CommunityPendingFrame,{href:e,plan:u})})})}):(0,t.jsx)(k,{breakpoint:c,surface:"list"===u.surface?"list":"detail",rail:(0,t.jsx)(j.X,{bottomInset:60}),sidebar:"server"===u.sidebar.kind?(0,t.jsx)(n.m,{targetServerId:u.sidebar.serverId}):(0,t.jsx)(a.h,{}),main:(0,t.jsx)(l.CommunityPendingFrame,{href:e,plan:u,reserveBackSlot:"detail"===u.surface}),userBar:(0,t.jsx)(C.x,{}),testId:o.f.initialFrame,routeKind:u.route,busy:!0,label:"Loading community",preserveHiddenMobileModules:!0})}],215932)},875061,e=>{var t=e.i(644452),n=e.i(32042),a=e.i(294237),r=e.i(613349);let i=(0,a.f)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-1 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});e.s(["t",0,function({className:e,variant:a="default",render:s,...o}){var l;return l={defaultTagName:"span",props:(0,t.w)({className:(0,r.c)(i({variant:a}),e)},o),render:s,state:{slot:"badge",variant:a}},(0,n.a)(l.defaultTagName??"div",l,l)},"y",0,i],875061)},410763,e=>{var t=e.i(895231),n=e.i(742547),a=e.i(294237),r=e.i(613349),i=e.i(473131),s=e.i(434433);let o=(0,a.f)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["N",0,function({className:e,orientation:n="vertical",...a}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":n,className:(0,r.c)(o({orientation:n}),e),...a})},"v",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,r.c)("group/field-content flex flex-1 flex-col gap-1 leading-snug",e),...n})},"H",0,function({className:e,...n}){return(0,t.jsx)("p",{"data-slot":"field-description",className:(0,r.c)("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-2","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...n})},"E",0,function({className:e,children:a,errors:i,...s}){let o=(0,n.useMemo)(()=>{if(a)return a;if(!i?.length)return null;let e=[...new Map(i.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,t.jsx)("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:e.map((e,n)=>e?.message&&(0,t.jsx)("li",{children:e.message},n))})},[a,i]);return o?(0,t.jsx)("div",{role:"alert","data-slot":"field-error",className:(0,r.c)("text-sm font-normal text-destructive",e),...s,children:o}):null},"e",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-group",className:(0,r.c)("group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...n})},"u",0,function({className:e,...n}){return(0,t.jsx)(i.f,{"data-slot":"field-label",className:(0,r.c)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...n})},"f",0,function({children:e,className:n,...a}){return(0,t.jsxs)("div",{"data-slot":"field-separator","data-content":!!e,className:(0,r.c)("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",n),...a,children:[(0,t.jsx)(s.f,{className:"absolute inset-0 top-1/2"}),e&&(0,t.jsx)("span",{className:"relative mx-auto block w-fit bg-background px-2 text-muted-foreground","data-slot":"field-separator-content",children:e})]})},"G",0,function({className:e,...n}){return(0,t.jsx)("fieldset",{"data-slot":"field-set",className:(0,r.c)("flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",e),...n})},"t",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-label",className:(0,r.c)("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",e),...n})}])},182149,254578,e=>{var t=e.i(895231),n=e.i(742547),a=Object.defineProperty,r=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,c=(e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function u(e){let t=e.getBoundingClientRect().right,n=e;for(;n;){if("visible"!==getComputedStyle(n).overflowX)return n.getBoundingClientRect().left+n.clientLeft+n.clientWidth-t;n=n.parentElement}return document.documentElement.clientWidth-t}var d=n.createContext({}),f=n.forwardRef((e,t)=>{let a;var f,p,g,v,y,{value:b,onChange:x,maxLength:w,textAlign:k="left",pattern:j,placeholder:C,inputMode:I="numeric",onComplete:S,pushPasswordManagerStrategy:N="increase-width",pasteTransformer:P,containerClassName:E,noScriptCSSFallback:M=h,nonce:A,render:O,children:R}=e,D=((e,t)=>{var n={};for(var a in e)o.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&s)for(var a of s(e))0>t.indexOf(a)&&l.call(e,a)&&(n[a]=e[a]);return n})(e,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","nonce","render","children"]);let[L,z]=n.useState("string"==typeof D.defaultValue?D.defaultValue:""),T=null!=b?b:L,q=(a=n.useRef(),n.useEffect(()=>{a.current=T}),a.current),K=n.useCallback(e=>{null==x||x(e),z(e)},[x]),$=n.useMemo(()=>j?"string"==typeof j?new RegExp(j):j:null,[j]),F=n.useRef(null),U=n.useRef(null),_=n.useRef({value:T,onChange:K,isIOS:"u">typeof window&&(null==(p=null==(f=null==window?void 0:window.CSS)?void 0:f.supports)?void 0:p.call(f,"-webkit-touch-callout","none"))}),B=n.useRef({prev:[null==(g=F.current)?void 0:g.selectionStart,null==(v=F.current)?void 0:v.selectionEnd,null==(y=F.current)?void 0:y.selectionDirection]});n.useImperativeHandle(t,()=>F.current,[]),n.useEffect(()=>{let e=F.current,t=U.current;if(!e||!t)return;function n(){if(document.activeElement!==e){G(null),J(null);return}let t=e.selectionStart,n=e.selectionEnd,a=e.selectionDirection,r=e.maxLength,i=e.value,s=B.current.prev,o=-1,l=-1,c;if(0!==i.length&&null!==t&&null!==n){let a=t===n,u=t===i.length&&i.length<r;if(a&&!u){if(0===t)o=0,l=1,c="forward";else if(t===r)o=t-1,l=t,c="backward";else if(r>1&&i.length>1){let e=0;if(null!==s[0]&&null!==s[1]){c=t<s[1]?"backward":"forward";let n=s[0]===s[1]&&s[0]<r;"backward"!==c||n||(e=-1)}o=e+t,l=e+t+1}}-1!==o&&-1!==l&&o!==l&&e.setSelectionRange(o,l,c)}let u=-1!==o?o:t,d=-1!==l?l:n,f=null!=c?c:a;G(u),J(d),B.current.prev=[u,d,f]}if(_.current.value!==e.value&&_.current.onChange(e.value),B.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection],document.addEventListener("selectionchange",n,{capture:!0}),n(),document.activeElement===e&&Y(!0),!document.getElementById("input-otp-style")){let e=document.createElement("style");if(e.id="input-otp-style",A&&e.setAttribute("nonce",A),document.head.appendChild(e),e.sheet){let t="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";m(e.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),m(e.sheet,`[data-input-otp]:autofill { ${t} }`),m(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),m(e.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),m(e.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let a=()=>{t&&t.style.setProperty("--root-height",`${e.clientHeight}px`)};a();let r="u"<typeof ResizeObserver?null:new ResizeObserver(a);return null==r||r.observe(e),()=>{document.removeEventListener("selectionchange",n,{capture:!0}),null==r||r.disconnect()}},[]);let[V,W]=n.useState(!1),[H,Y]=n.useState(!1),[Q,G]=n.useState(null),[X,J]=n.useState(null);n.useEffect(()=>{var e;let t=[setTimeout(e=()=>{var e,t,n,a;null==(e=F.current)||e.dispatchEvent(new Event("input"));let r=null==(t=F.current)?void 0:t.selectionStart,i=null==(n=F.current)?void 0:n.selectionEnd,s=null==(a=F.current)?void 0:a.selectionDirection;null!==r&&null!==i&&(G(r),J(i),B.current.prev=[r,i,s])},0),setTimeout(e,10),setTimeout(e,50)];return()=>{t.forEach(e=>clearTimeout(e))}},[T,H]),n.useEffect(()=>{void 0!==q&&T!==q&&q.length<w&&T.length===w&&(null==S||S(T))},[w,S,q,T]);let Z=function({containerRef:e,inputRef:t,pushPasswordManagerStrategy:a,isFocused:r}){let[i,s]=n.useState(!1),[o,l]=n.useState(!1),[c,d]=n.useState(!1),f=n.useMemo(()=>"none"!==a&&("increase-width"===a||"experimental-no-flickering"===a)&&i&&o,[i,o,a]),m=n.useCallback(()=>{let n=e.current,r=t.current;if(!n||!r||c||"none"===a)return;let i=n.getBoundingClientRect().left+n.offsetWidth,o=n.getBoundingClientRect().top+n.offsetHeight/2;0===document.querySelectorAll('[data-lastpass-icon-root],com-1password-button,[data-dashlanecreated],[style$="2147483647 !important;"]').length&&document.elementFromPoint(i-18,o)===n||(l(u(n)>=40),s(!0),d(!0))},[e,t,c,a]);return n.useEffect(()=>{let t=e.current;if(!t||"none"===a)return;function n(){l(u(t)>=40)}n();let r=setInterval(n,1e3);return()=>{clearInterval(r)}},[e,a]),n.useEffect(()=>{let e=r||document.activeElement===t.current;if("none"===a||!e)return;let n=setTimeout(m,0),i=setTimeout(m,2e3),s=setTimeout(m,5e3),o=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(n),clearTimeout(i),clearTimeout(s),clearTimeout(o)}},[t,r,a,m]),{hasPWMBadge:i,willPushPWMBadge:f,PWM_BADGE_SPACE_WIDTH:"40px"}}({containerRef:U,inputRef:F,pushPasswordManagerStrategy:N,isFocused:H}),ee=n.useCallback(e=>{let t=e.currentTarget.value.slice(0,w);t.length>0&&$&&!$.test(t)?e.preventDefault():("string"==typeof q&&t.length<q.length&&document.dispatchEvent(new Event("selectionchange")),K(t))},[w,K,q,$]),et=n.useCallback(()=>{var e;if(F.current){let t=Math.min(F.current.value.length,w-1),n=F.current.value.length;null==(e=F.current)||e.setSelectionRange(t,n),G(t),J(n)}Y(!0)},[w]),en=n.useCallback(e=>{var t,n;let a=F.current;if(!P&&(!_.current.isIOS||!e.clipboardData||!a))return;let r=e.clipboardData.getData("text/plain"),i=P?P(r):r;e.preventDefault();let s=null==(t=F.current)?void 0:t.selectionStart,o=null==(n=F.current)?void 0:n.selectionEnd,l=(s!==o?T.slice(0,s)+i+T.slice(o):T.slice(0,s)+i+T.slice(s)).slice(0,w);if(l.length>0&&$&&!$.test(l))return;a.value=l,K(l);let c=Math.min(l.length,w-1),u=l.length;a.setSelectionRange(c,u),G(c),J(u)},[w,K,P,$,T]),ea=n.useMemo(()=>({position:"relative",cursor:D.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[D.disabled]),er=n.useMemo(()=>({position:"absolute",inset:0,width:Z.willPushPWMBadge?`calc(100% + ${Z.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:Z.willPushPWMBadge?`inset(0 ${Z.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:k,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height, 16px)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[Z.PWM_BADGE_SPACE_WIDTH,Z.willPushPWMBadge,k]),ei=n.useMemo(()=>{var e;return n.createElement("input",r(((e,t)=>{for(var n in t||(t={}))o.call(t,n)&&c(e,n,t[n]);if(s)for(var n of s(t))l.call(t,n)&&c(e,n,t[n]);return e})({autoComplete:D.autoComplete||"one-time-code"},D),i({"data-input-otp":!0,"data-input-otp-placeholder-shown":0===T.length||void 0,"data-input-otp-mss":Q,"data-input-otp-mse":X,inputMode:I,pattern:null==$?void 0:$.source,"aria-placeholder":C,style:er,maxLength:w,value:T,ref:F,spellCheck:null!=(e=D.spellCheck)&&e,onPaste:e=>{var t;en(e),null==(t=D.onPaste)||t.call(D,e)},onChange:ee,onMouseOver:e=>{var t;W(!0),null==(t=D.onMouseOver)||t.call(D,e)},onMouseLeave:e=>{var t;W(!1),null==(t=D.onMouseLeave)||t.call(D,e)},onFocus:e=>{var t;et(),null==(t=D.onFocus)||t.call(D,e)},onBlur:e=>{var t;Y(!1),null==(t=D.onBlur)||t.call(D,e)}})))},[ee,et,en,I,er,w,X,Q,C,D,null==$?void 0:$.source,T]),es=n.useMemo(()=>({slots:Array.from({length:w}).map((e,t)=>{var n;let a=H&&null!==Q&&null!==X&&(Q===X&&t===Q||t>=Q&&t<X),r=void 0!==T[t]?T[t]:null;return{char:r,placeholderChar:void 0!==T[0]?null:null!=(n=null==C?void 0:C[t])?n:null,isActive:a,hasFakeCaret:a&&null===r}}),isFocused:H,isHovering:!D.disabled&&V}),[H,V,w,X,Q,C,D.disabled,T]),eo=n.useMemo(()=>O?O(es):n.createElement(d.Provider,{value:es},R),[R,es,O]);return n.createElement(n.Fragment,null,null!==M&&n.createElement("noscript",null,n.createElement("style",null,M)),n.createElement("div",{ref:U,"data-input-otp-container":!0,translate:"no",style:ea,className:E},eo,n.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},ei)))});function m(e,t){try{e.insertRule(t)}catch(e){console.warn("input-otp could not insert CSS rule:",t)}}f.displayName="Input";var h=`
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,[520332,e=>{var t=e.i(885373);let n={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};n.node;let a=(0,t.f)(n);e.s(["f",0,a])},299668,31163,e=>{var t=e.i(885373);let n={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],299668);var r=e.i(742547),i=e.i(18745),s=e.i(378369),o=e.i(183899),l=e.i(622435),c=e.i(919391),u=e.i(975210);let d="inboxThreadOpener",f=0;e.s(["H",0,d,"x",0,function(e,t){let n="u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():(f+=1,`opener-${f}`);(0,u.U)(e,{...t,nonce:n});let a=(0,l.O)(t.serverId,t.childChannelId);return`${a}?${d}=${encodeURIComponent(n)}`},"W",0,function(e){(0,u.g)(e)},"u",0,function(e){let t=(0,s.d)(),n=(0,o.$)(),a=(0,i.useRouter)(),f=(0,i.useSearchParams)(),m=(0,r.useRef)(null),h=(0,r.useRef)(null),p=(0,r.useRef)(0);(0,r.useLayoutEffect)(()=>{if(!e||h.current===e.nonce)return;m.current&&((0,c.I)(m.current),m.current=null,h.current=null);let r=(0,u.L)(t,e.nonce);if(!r||r.serverId!==e.serverId||r.parentChannelId!==e.parentChannelId||r.childChannelId!==e.childChannelId||r.openerMessageId!==e.openerMessageId||r.openerSeq!==e.openerSeq)return void(0,u.m)(t,e.nonce);let i=(0,c.i)(t,n.id,{kind:"timeline",channelId:r.parentChannelId},0,"cancel-uncommitted"),s=(0,c.M)(i,{kind:"timeline",channelId:r.parentChannelId,messageId:r.openerMessageId,seq:r.openerSeq});if(null===s){(0,c.I)(i),(0,u.m)(t,r.nonce);return}m.current=i,h.current=r.nonce,(0,u.A)(t,r.nonce,s);let o=f.toString(),p=`${(0,l.O)(r.serverId,r.childChannelId)}${o?`?${o}`:""}`;a.replace((0,l.r)(p,d),{scroll:!1})},[n.id,t,a,f,e]),(0,r.useLayoutEffect)(()=>(p.current+=1,()=>{let e=++p.current,t=m.current;t&&queueMicrotask(()=>{p.current===e&&m.current===t&&(m.current=null,h.current=null,(0,c.I)(t))})}),[t])},"Z",0,function({serverId:e,childChannelId:t,parentChannelId:n,openerMessageId:a,lifecycle:o}){let c=(0,s.d)(),f=(0,i.useRouter)(),m=(0,i.usePathname)(),h=(0,i.useSearchParams)(),p=h.get(d),g=p?(0,u.L)(c,p):null,v=(0,r.useCallback)(()=>{if(!p)return;let n=h.toString(),a=`${(0,l.O)(e,t)}${n?`?${n}`:""}`;f.replace((0,l.r)(a,d),{scroll:!1})},[t,p,f,h,e]),y=!!g&&g.serverId===e&&g.childChannelId===t,b=m===(0,l.O)(e,t),x=y&&"ready"===o&&g.parentChannelId===n&&g.openerMessageId===a;return(0,r.useLayoutEffect)(()=>{if(!p||!b)return;let n=(0,u.r)(c,p,e,t);return()=>(0,u.y)(n)},[t,p,c,b,e]),(0,r.useLayoutEffect)(()=>{if(p&&b&&(!y||"terminal-error"===o||"ready"===o&&!x)){(0,u.m)(c,p),v();return}},[x,v,o,p,c,b,y]),b&&x&&g?g:null}],31163)},925535,e=>{var t=e.i(885373);let n={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],925535)},672750,391490,e=>{var t=e.i(885373);let n={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],672750);let r={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};r.node;let i=(0,t.f)(r);e.s(["f",0,i],391490)},856347,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0});var a={bindSnapshot:function(){return u},createAsyncLocalStorage:function(){return l},createSnapshot:function(){return d},getOrCreateGlobalAsyncLocalStorage:function(){return c}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let i=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class s{disable(){throw i}getStore(){}run(){throw i}exit(){throw i}enterWith(){throw i}static bind(e){return e}}let o="u">typeof globalThis&&globalThis.AsyncLocalStorage;function l(){return o?new o:new s}function c(e){let t=Symbol.for(`@next/${e}@16.4.0`),n=globalThis;return n[t]??=l()}function u(e){return o?o.bind(e):s.bind(e)}function d(){return o?o.snapshot():function(e,...t){return e(...t)}}},951088,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,e.r(856347).getOrCreateGlobalAsyncLocalStorage)("work-async-storage")},121974,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=e.r(951088)},288423,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return r}});let a=e.r(836437)._(e.r(120252));function r(e,t){let n={};"function"==typeof e&&(n.loader=e);let r={...n,...t};return(0,a.default)({...r,modules:r.loadableGenerated?.modules})}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},877472,(e,t,n)=>{function a(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"encodeURIPath",{enumerable:!0,get:function(){return a}})},659660,(e,t,n)=>{e.i(648378),Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BailoutToCSRForNextDynamic",{enumerable:!0,get:function(){return s}});let a=e.r(742547),r=e.r(727854);e.r(768694);let i=e.r(326327).createReactBrowserBailoutReason.bind(null,"next/dynamic");function s({children:e}){return(0,a.use)((0,r.browser)(i)),e}},120252,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return c}});let a=e.r(895231),r=e.r(742547),i=e.r(659660),s=e.r(112435);function o(e){return{default:e&&"default"in e?e.default:e}}let l={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},c=function(e){let t={...l,...e},n=(0,r.lazy)(()=>t.loader().then(o)),c=t.loading;function u(e){let o=c?(0,a.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,l=!t.ssr||!!t.loading,u=l?r.Suspense:r.Fragment,d=t.ssr?(0,a.jsxs)(a.Fragment,{children:["u"<typeof window?(0,a.jsx)(s.PreloadChunks,{moduleIds:t.modules}):null,(0,a.jsx)(n,{...e})]}):(0,a.jsx)(i.BailoutToCSRForNextDynamic,{children:(0,a.jsx)(n,{...e})});return(0,a.jsx)(u,{...l?{fallback:o}:{},children:d})}return u.displayName="LoadableComponent",u}},112435,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"PreloadChunks",{enumerable:!0,get:function(){return l}});let a=e.r(895231),r=e.r(727854),i=e.r(121974),s=e.r(877472),o=e.r(535150);function l({moduleIds:e}){if("u">typeof window)return null;let t=i.workAsyncStorage.getStore();if(void 0===t)return null;let n=[];if(t.reactLoadableManifest&&e){let a=t.reactLoadableManifest;for(let t of e){if(!a[t])continue;let e=a[t].files;n.push(...e)}}if(0===n.length)return null;let c=(0,o.getAssetTokenQuery)();return(0,a.jsx)(a.Fragment,{children:n.map(e=>{let n=`${t.assetPrefix}/_next/${(0,s.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,a.jsx)("link",{precedence:"dynamic",href:n,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,r.preload)(n,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},326327,(e,t,n)=>{Object.defineProperty(n,"__esModule",{value:!0});var a={createReactBrowserBailoutReason:function(){return s},getReactBrowserBailoutReason:function(){return o},isNextBrowserBailoutError:function(){return l}};for(var r in a)Object.defineProperty(n,r,{enumerable:!0,get:a[r]});let i=Symbol.for("next.browser-bailout-reason");function s(e){return{$$typeof:i,reason:e}}function o(e){let t=e?.cause;return t?.$$typeof===i?t.reason:void 0}function l(e){return void 0!==o(e)}},200069,e=>{var t=e.i(895231),n=e.i(742547),a=e.i(18745),r=e.i(695230),i=e.i(282371),s=e.i(378369),o=e.i(777104),l=e.i(561261),c=e.i(374402),u=e.i(474707),d=e.i(152845),f=e.i(18291),m=e.i(581971);function h(e){return e.state.isPaused}function p(e){return"success"===e.state.status}let g=["added","removed","updated"];function v(e){return g.includes(e)}async function y({queryClient:e,persister:t,maxAge:n=864e5,buster:a="",hydrateOptions:r}){try{let s=await t.restoreClient();if(s)if(!s.timestamp)return t.removeClient();else{var i;let o,l,c,u=Date.now()-s.timestamp>n,d=s.buster!==a;if(u||d)return t.removeClient();i=s.clientState,o=e.getMutationCache(),l=e.getQueryCache(),c=r?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData,i.mutations?.forEach(({state:t,...n})=>{o.build(e,{...e.getDefaultOptions().hydrate?.mutations,...r?.defaultOptions?.mutations,...n},t)}),i.queries?.forEach(({queryKey:t,state:n,queryHash:a,meta:i,promise:s,dehydratedAt:o,queryType:u})=>{let d=s?function(e){let t;if(e.then(e=>(t=e,e),m.z)?.catch?.(m.z),void 0!==t)return{data:t}}(s):void 0,f=void 0===n.data?d?.data:n.data,h=void 0===f?f:c?c(f):f,p=l.get(a),g=p?.state.status==="pending",v=p?.state.fetchStatus==="fetching";if(p){let e=d&&o>p.state.dataUpdatedAt;if(n.dataUpdatedAt>p.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=n;p.setState({...t,data:h,..."pending"===n.status&&void 0!==h&&{status:"success",dataUpdatedAt:o,...!v&&{fetchStatus:"idle"}}})}}else p=l.build(e,{...e.getDefaultOptions().hydrate?.queries,...r?.defaultOptions?.queries,queryKey:t,queryHash:a,meta:i,_type:u},{...n,data:h,fetchStatus:"idle",status:"pending"===n.status&&void 0!==h?"success":n.status,..."pending"===n.status&&void 0!==h&&{dataUpdatedAt:o}});!s||d||g||v||!(o>p.state.dataUpdatedAt)||p.fetch(void 0,{initialPromise:Promise.resolve(s).then(c)}).catch(m.z)})}}catch(e){throw await t.removeClient(),e}}async function b({queryClient:e,persister:t,buster:n="",dehydrateOptions:a}){let r={buster:n,timestamp:Date.now(),clientState:function(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??h,a=e.getMutationCache().getAll().flatMap(e=>n(e)?[{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}]:[]),r=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??p,i=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors,s=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData;return{mutations:a,queries:e.getQueryCache().getAll().flatMap(e=>{let t;return r(e)?[{dehydratedAt:Date.now(),state:{...e.state,...void 0!==e.state.data&&{data:s?s(e.state.data):e.state.data}},queryKey:e.queryKey,queryHash:e.queryHash,..."pending"===e.state.status&&{promise:(t=e.promise?.then(s).catch(e=>i?.(e)===!1?Promise.reject(e):Promise.reject(Error("redacted"))),t?.catch(m.z),t)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}]:[]})}}(e,a)};await t.persistClient(r)}let x=({children:e,persistOptions:a,onSuccess:r,onError:i,...o})=>{let[l,c]=n.useState(!0),u=n.useRef({persistOptions:a,onSuccess:r,onError:i}),d=n.useRef(!1);return n.useEffect(()=>{u.current={persistOptions:a,onSuccess:r,onError:i}}),n.useEffect(()=>{let e,t,n={...u.current.persistOptions,queryClient:o.client};return d.current||(d.current=!0,y(n).then(()=>u.current.onSuccess?.()).catch(()=>u.current.onError?.()).finally(()=>{c(!1)})),l?void 0:(e=n.queryClient.getQueryCache().subscribe(e=>{v(e.type)&&b(n)}),t=n.queryClient.getMutationCache().subscribe(e=>{v(e.type)&&b(n)}),()=>{e(),t()})},[o.client,l]),(0,t.jsx)(s.P,{...o,children:(0,t.jsx)(f.o,{value:l,children:e})})};var w=e.i(583262),k=e.i(636557),j=e.i(423360),C=e.i(526822),I=e.i(919391),S=e.i(177519),N=e.i(152961),P=e.i(23055),E=e.i(556125),M=e.i(204779),A=e.i(86694),O=e.i(323512),R=e.i(279389),D=e.i(280958),L=e.i(334016),z=e.i(645980);function T(){let e;return{ready:new Promise(t=>{e=t}),release:e}}function q({children:e,onRestoreComplete:a,queryClient:i,registry:s}){let o=(0,f.B)(),l=(0,n.useRef)(null);return(0,n.useEffect)(()=>{null!==l.current&&(clearTimeout(l.current),l.current=null);let e=(0,r.r)(s);return()=>{l.current=setTimeout(()=>{l.current=null,e(),i.cancelQueries().catch(e=>{(0,k.c)(e)||console.error("Community query cancellation failed",e)}),(0,I.z)(i),(0,C.m)(i),(0,S.n)(i),s.cleanup().finally(()=>i.clear()).catch(e=>{(0,k.c)(e)||console.error("Community collection cleanup failed",e)})},0)}},[i,s]),(0,n.useLayoutEffect)(()=>{if(!o)return a(),(0,O.vI)(i,s)},[o,a,i,s]),(0,t.jsx)(A.s,{registry:s,children:e})}function K(e){let n=(0,P.U)();return(0,t.jsx)($,{...e,session:n,sessionViewer:P.b},e.userId??"anon")}function $({children:e,userId:i,initialUser:s,session:o,sessionViewer:l}){let[u]=(0,n.useState)(()=>{let e=(0,w.f)();return s&&s.id===i&&e.setQueryData(c.f.communityDbCollection(i,"profiles"),[R.S.parse({id:i,name:s.name,discriminator:s.discriminator||null,...s.avatar===(0,D.f)(s.name)?{}:{avatar:s.avatar},avatarVersion:s.avatarVersion,identityComplete:!!s.discriminator&&s.avatar!==(0,D.f)(s.name)&&void 0!==s.avatarVersion,aboutMe:s.aboutMe,statusEmoji:s.statusEmoji,statusText:s.statusText})],{updatedAt:0}),e}),[d]=(0,n.useState)(T),[f]=(0,n.useState)(()=>(0,r.M)(u,i,{waitForRestore:d.ready})),m=(0,n.useMemo)(()=>i?(0,S.z)(u,i):null,[u,i]);(0,n.useEffect)(()=>{if(m)return m.setReconcileScheduler(()=>{u.invalidateQueries({queryKey:c.f.inboxUnreads(),exact:!0}),u.invalidateQueries({queryKey:c.f.inboxMentions(),exact:!0}),u.invalidateQueries({queryKey:c.f.dms(),exact:!0}),u.invalidateQueries({queryKey:c.f.servers(),exact:!0}),u.invalidateQueries({predicate:({queryKey:e})=>(0,c.I)(e)})}),()=>m.setReconcileScheduler(null)},[u,m]);let[h]=(0,n.useState)(()=>(0,j.h)(i)),p=(0,N.f)(f.runtime.lifecycle,e=>e.active),g=(0,a.useRouter)();(0,n.useLayoutEffect)(()=>{f.bindAuthentication(l,h.retireAccount,h.retireChannels)},[f,l,h]);let v=(0,n.useRef)(()=>void 0);(0,n.useLayoutEffect)(()=>{(0,z.Z)(i),v.current=(0,z.Y)()},[i]);let y=(0,n.useRef)(!1),b=!o.isPending&&!o.error&&o.data?.user.id!==i;(0,n.useLayoutEffect)(()=>(f.authenticationView.setState(e=>({...e,active:!0})),()=>{f.authenticationView.setState(e=>({active:!1,generation:e.generation+1}));let e=f.sessionViewer();void 0!==e&&e!==f.accountId&&((0,M.d)(f),d.release(),f.retireDisk().catch(()=>void 0))}),[f,d]),(0,n.useLayoutEffect)(()=>{!b||(o.data?.user.id||l?.()!==null||v.current(),y.current||(y.current=!0,d.release(),(0,M.d)(f),f.retireDisk().catch(()=>void 0),o.data?.user.id?g.refresh():g.replace("/sign-in")))},[f,b,d,g,o.data?.user.id,l,i]);let k=(0,n.useCallback)(()=>{f.runtime.lifecycle.get().active&&((0,M.d)(f),window.location.reload())},[f]);(0,E.f)(h,k);let C=()=>{(d.release(),f.runtime.lifecycle.get().active)?(f.captureRestoredCollections(),f.runtime.ws.get().profileViewerId!==i&&f.runtime.ws.actions.activateProfileAccount(i)):u.clear()};return(0,t.jsx)(x,{client:u,onSuccess:()=>{f.runtime.lifecycle.get().active?(0,L.F)(h):(0,L.l)(h),C(),f.runtime.lifecycle.get().active&&Promise.all([u.invalidateQueries({queryKey:c.f.servers(),exact:!0,refetchType:"active"}),u.invalidateQueries({queryKey:c.f.folders(),exact:!0,refetchType:"active"}),u.invalidateQueries({queryKey:c.f.dms(),exact:!0,refetchType:"active"}),u.invalidateQueries({predicate:({queryKey:e})=>(0,c.I)(e),refetchType:"active"})])},onError:()=>{(0,L.l)(h),C()},persistOptions:{persister:h,maxAge:j.j,buster:j.M,dehydrateOptions:{shouldDehydrateQuery:e=>"success"===e.state.status&&(0,j.i)(e.queryKey,e.state.data)}},children:p&&!b?(0,t.jsxs)(q,{onRestoreComplete:d.release,queryClient:u,registry:f,children:[e,null]}):null})}var F=e.i(183899),U=e.i(956832),_=e.i(718877),B=e.i(50271),V=e.i(115870),W=e.i(239706);function H(){return(0,n.useEffect)(()=>{(0,V.f)()&&(0,W.f)().catch(()=>{})},[]),null}var Y=e.i(950262),Q=e.i(443178),G=e.i(10209),X=e.i(193497),J=e.i(51201),Z=e.i(344920),ee=e.i(366020),et=e.i(597574),en=e.i(885373);let ea={name:"briefcase-business",size:24,node:[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]};ea.node;let er=(0,en.f)(ea),ei={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};ei.node;let es=(0,en.f)(ei);var eo=e.i(520332),eo=eo;let el={name:"rocket",size:24,node:[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]};el.node;let ec=(0,en.f)(el),eu=[{value:"claude",label:"Claude Code",provider:"claude"},{value:"codex",label:"Codex",provider:"codex"},{value:"grok",label:"Grok Build",provider:"grok"},{value:"cursor",label:"Cursor",provider:"cursor"},{value:"opencode",label:"OpenCode",provider:"opencode"},{value:"pi",label:"Pi",provider:"pi"}],ed=[{value:"office",label:"Work",icon:er,accentKey:"work"},{value:"developer",label:"Software development",icon:es,accentKey:"code"},{value:"founder",label:"Building a company",icon:ec,accentKey:"rocket"},{value:"home",label:"Home and family",icon:eo.f,accentKey:"coral"}];var ef=e.i(643680),em=e.i(174629),eh=e.i(381153),ep=e.i(60115),eg=e.i(490367);e.i(954194);var ev=e.i(168614),ey=e.i(617527),eb=e.i(186339),ex=e.i(855372),ew=e.i(779646),ek=e.i(609510),ej=e.i(411312);function eC({runtime:e,model:n,onModelChange:a,onContinue:r}){let i=(0,ej.a)(n,e.id),s=eu.find(t=>t.value===e.id)?.label??e.id;return(0,t.jsx)(ew.N,{open:!0,children:(0,t.jsx)(ew.d,{showCloseButton:!1,overlayClassName:"bg-black/20 supports-backdrop-filter:backdrop-blur-sm",className:"max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto border-0 p-0 shadow-(--e2) ring-0 thin-scrollbar sm:max-w-md",children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),i||r()},children:[(0,t.jsxs)(ew.s,{className:"gap-4 px-4 pt-4 pb-4 sm:px-6 sm:pt-6 sm:pb-6",children:[(0,t.jsx)("div",{className:"flex gap-1.5","aria-label":"Step 3 of 4",children:[1,2,3,4].map(e=>(0,t.jsx)("span",{className:e<=3?"h-1.5 flex-1 rounded-full bg-primary":"h-1.5 flex-1 rounded-full bg-muted"},e))}),(0,t.jsxs)(ew.F,{className:"flex flex-wrap items-center gap-x-2 text-2xl leading-tight font-semibold tracking-tight",children:[(0,t.jsx)("span",{children:"Choose a model for your"}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[(0,t.jsx)(ex.z,{provider:e.id,className:"size-5"}),s]})]}),(0,t.jsx)(ew.C,{children:"Your team’s bots will use this model. You can change it for each bot later."})]}),(0,t.jsx)("div",{className:"px-4 pb-4 sm:px-6 sm:pb-6",children:(0,t.jsx)(ek.f,{runtime:e,value:n,onChange:a,error:n?i:void 0})}),(0,t.jsx)(ew.c,{className:"m-0 rounded-none border-0 bg-transparent px-4 py-4 sm:px-6",children:(0,t.jsx)(eb.K,{type:"submit",className:"h-11 min-h-11 w-full sm:h-9 sm:min-h-9 sm:w-auto",disabled:!!i,children:"Continue"})})]})})})}function eI(){let e=(0,u.F)(),r=(0,a.usePathname)(),i=(0,F.$)(),f=(0,ee.E)(),m=(0,s.d)(),h=(0,X.f)(),p=JSON.stringify([f?.machineId,f?.harness,f?.identity,f?.model]),g=(0,J.f)(`onboarding:${p}`,f?.stage==="initializing"),[v,y]=(0,o.f)((0,l.f)("")),[b,x]=(0,o.f)((0,l.f)("")),[w,k]=(0,o.f)((0,l.f)("")),[j,C]=(0,o.f)((0,l.f)(null)),I=(0,ev.G)(f?.harness),S=I?4:3,{machines:N}=(0,ey.t)({enabled:f?.stage==="model"}),P=N.find(e=>e.id===f?.machineId)?.availableRuntimes.find(e=>e.id===f?.harness);(0,n.useEffect)(()=>{C(null)},[f?.machineId,f?.harness,C]);let E=["community","onboarding-initialization",p],M=(0,G.Z)({filters:{mutationKey:E,status:"pending"},select:e=>e.mutationId}),A=(0,Q.f)({meta:{observabilityAction:"community.onboarding.initialize"},mutationKey:E,scope:{id:JSON.stringify(E)},mutationFn:async({token:t,profileSnapshot:n,assert:a,input:r})=>{a();let i=(0,ee.O)(e),s=await (0,em.l)({...r,checkpoint:i?.initialization?.checkpoint,onCheckpoint:t=>{a(),(0,ee.t)(e,e=>({...e,checkpoint:t}))},onProgress:t=>{a(),(0,ee.t)(e,e=>({...e,step:t}))},services:{assert:a,request:(e,n)=>h.request(t,e,{...n,signal:a.signal,assertActive:a}),publishBot:(e,t)=>{a(),(0,d.h)([{id:e.id,identityAbout:{name:e.name??t.name,discriminator:e.discriminator,kind:"bot"},avatar:{avatar:e.image??t.image,avatarVersion:e.avatarVersion}}],h.registry,{snapshot:n})},resolveBot:e=>{let t=h.registry?.collections.profiles.get(e);return t?.name===void 0?void 0:{name:t.name,discriminator:t.discriminator??void 0}},readChannels:async e=>{a(),await m.invalidateQueries({queryKey:c.f.servers(),exact:!0}),a();let t={queryKey:c.f.server(e),queryFn:({signal:t})=>(0,Z.Q)(m,e,t)(),staleTime:0},n=new Y.f(m,{...t,enabled:!1}).subscribe(()=>void 0);a.signal.addEventListener("abort",n,{once:!0});try{return a(),await m.query({...t,select:void 0}),a(),[...h.registry.collections.channels.values()].filter(t=>t.serverId===e&&!t.parentChannelId).map(({id:e,name:t,type:n,categoryId:a})=>({id:e,name:t??"",type:n,categoryId:a??null}))}finally{a.signal.removeEventListener("abort",n),n()}}}});return a(),(0,ee.t)(e,e=>({...e,result:s})),await m.invalidateQueries({queryKey:c.f.bots(),exact:!0}),h.assert(t),s}}),O=f?.initialization,R=O?.checkpoint??{},D=O?.step??"creating-bots",L=O?.result??null,z=A.variables?.assert.signal===g.signal?A.error:null,T=z instanceof Error?z.message:"We couldn’t finish setting up your room.",q=L?"success":M.length?"loading":z&&!(z instanceof DOMException&&"AbortError"===z.name)?"error":"idle";(0,n.useEffect)(()=>{let t=O?.pendingDestination;t&&r===t&&(0,ee.L)(e)},[r,O?.pendingDestination,e]);let K=A.mutateAsync,$=(0,n.useCallback)(async()=>{if(M.length||f?.stage!=="initializing"||!f.machineId||!f.harness||!f.identity)return;let e=h.begin(),t=g.capture();t();try{await K({...e,assert:t,input:{machineId:f.machineId,runtime:f.harness,model:f.model,identity:f.identity,userName:i.name,userDiscriminator:i.discriminator}})}catch{}},[M.length,f,h,g,K,i.name,i.discriminator]);if((0,n.useEffect)(()=>{f?.stage==="initializing"&&"idle"===q&&$()},[q,p,f?.stage,g.signal,$]),!f)return null;if("harness"===f.stage)return(0,t.jsx)(ep.f,{open:!0,onOpenChange:()=>void 0,step:{current:1,total:S},stepLabel:"Your harness",title:"Which harness do you already use?",description:"Pick the setup that already runs your bots.",options:[...eu],value:v,onValueChange:y,submitLabel:"Continue",onSubmit:t=>{(0,ee.N)(e,"harness","machine",{harness:t})},testId:eh.f.onboardingHarnessDialog,optionTestId:eh.f.onboardingHarnessOption});if("machine"===f.stage){var U;return(0,t.jsx)(et.f,{open:!0,harness:f.harness??"",harnessLabel:(U=f.harness,eu.find(e=>e.value===U)?.label??"your harness"),totalSteps:S,onConnected:t=>{(0,ee.N)(e,"machine",I?"model":"identity",{machineId:t,model:null})},onChooseAnotherHarness:()=>{y(""),(0,ee.f)(e)},onManageMachines:()=>{(0,ee.M)(e)}})}return"model"===f.stage?(0,t.jsx)(eC,{runtime:P??{id:f.harness},model:j,onModelChange:C,onContinue:()=>(0,ee.N)(e,"model","identity",{model:j})}):"identity"===f.stage?(0,t.jsx)(ep.f,{open:!0,onOpenChange:()=>void 0,step:{current:S,total:S},stepLabel:"About you",title:"Which best describes you?",description:"We’ll shape the room around your work.",options:[...ed],value:b,onValueChange:x,customOption:{value:"custom",label:"Something else",placeholder:"Your role"},customValue:w,onCustomValueChange:k,submitLabel:"Finish setup",onSubmit:t=>{(0,ee.N)(e,"identity","initializing",{identity:t})},testId:eh.f.onboardingIdentityDialog,optionTestId:eh.f.onboardingIdentityOption}):"initializing"===f.stage?(0,t.jsx)(eg.f,{totalSteps:S,status:"idle"===q?"loading":q,currentStep:D,checkpoint:R,detail:"error"===q?T:"success"===q?`${L?.bots.length??0} bots are in your room and ready to work.`:"Follow along as your room comes together.",onRetry:()=>void $(),onContinue:async()=>{if(!L)return;let t=`/c/channels/${L.serverId}/${L.publicChannelId}`,n=g.capture();if(n(),(0,ef.q)(i.id,L.serverId),!e.lifecycle.get().active)return;try{n()}catch{return}let a=e.ui.get().uiHandlers.navigate;a&&((0,ee.t)(e,e=>({...e,pendingDestination:t})),a(L.serverId,L.publicChannelId))}}):null}let eS={name:"wifi-off",size:24,node:[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};eS.node;let eN=(0,en.f)(eS);var eP=e.i(381338);function eE({children:e}){let n=(0,eP.f)(e=>e.connectionStatus),a=(0,eP.f)(e=>e.reconnectNow);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"contents",children:e}),"failed"===n&&(0,t.jsxs)("div",{role:"status","aria-live":"polite","aria-atomic":"true","data-testid":eh.f.wsReconnectOverlay,"data-ws-status":n,className:"fixed bottom-4 right-4 z-50 flex max-w-xs items-center gap-3 rounded-lg border bg-popover p-3 text-popover-foreground shadow-(--e2)",children:[(0,t.jsx)("div",{"aria-hidden":"true",className:"grid size-9 shrink-0 place-items-center rounded-md bg-warning/10 text-warning",children:(0,t.jsx)(eN,{className:"size-4"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"font-heading text-sm font-medium",children:"Connection lost"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Cached content is still available."})]}),(0,t.jsx)(eb.K,{type:"button",variant:"secondary","data-testid":eh.f.wsRetry,onClick:a,className:"h-11 shrink-0 sm:h-9",children:"Retry"})]})]})}var eM=e.i(506607),eA=e.i(622435),eO=e.i(636686),eR=e.i(312462);function eD(){let e=(0,a.usePathname)(),t=(0,a.useRouter)(),r=(0,F.$)(),i=(0,s.d)(),o=(0,Z.N)(),l=(0,eA.B)(e),c=(0,N.f)((0,u.A)(i).serverEject,e=>!!l&&e.flushedServerIds.has(l));return(0,n.useEffect)(()=>{l&&c&&(0,eO.X)({serverId:l,servers:o.servers,isSuccess:o.isSuccess,isFetching:o.isFetching,consumeVoluntaryLeave:e=>(0,eO.j)(i,e),clearLastChannel:eR.d,toast:eM.toast,accountId:r.id,routeHref:e,replace:e=>t.replace(e)})},[c,r.id,e,i,t,l,o.servers,o.isSuccess,o.isFetching]),null}function eL({children:e}){let t=(0,f.B)(),a=(0,A.O)(),r=(0,n.useRef)(!1);return(0,n.useLayoutEffect)(()=>{if(t&&!r.current){r.current=!0,performance.mark("alook:restore:start");return}if(t||!r.current)return;performance.mark("alook:restore:complete"),a?.hasRestoredData()===!0&&performance.mark("alook:restore:first-cached-paint");let e=requestAnimationFrame(()=>performance.mark("alook:restore:stable"));return()=>cancelAnimationFrame(e)},[a,t]),e}var ez=e.i(215932);function eT({currentUser:e,children:n}){return(0,t.jsx)(K,{userId:e.id,initialUser:e,children:(0,t.jsx)(eL,{children:(0,t.jsx)(eq,{viewerId:e.id,children:(0,t.jsx)(F.N,{initialUser:e,children:(0,t.jsx)(eK,{children:n})})})})})}function eq({children:e,viewerId:r}){let i=(0,u.F)(),[s,c]=(0,o.f)((0,l.f)(!1)),d=(0,eP.f)(e=>e.profileViewerId),f=(0,a.usePathname)();return(0,n.useLayoutEffect)(()=>{d!==r&&i.ws.actions.activateProfileAccount(r),c(!0)},[d,i.ws.actions,c,r]),s&&d===r?e:(0,t.jsx)(ez.f,{pathname:f})}function eK({children:e}){let n=(0,s.d)(),a=(0,F.$)();(0,_.J)(),(0,B.s)(),(0,U.B)({viewerUserId:a.id});let o=(0,r.D)(n);return(0,i.f)({queryKey:c.f.selfProfile(),queryFn:async({signal:e})=>({id:(await (0,d.x)("/api/community/users/me/profile",e=>[{id:e.id,identityAbout:{name:e.name,discriminator:e.discriminator,aboutMe:e.aboutMe},avatar:{avatar:e.avatar,avatarVersion:e.avatarVersion},status:{statusEmoji:e.statusEmoji,statusText:e.statusText}}],{signal:e},o)).id}),enabled:o?.accountId===a.id,staleTime:3e5}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{}),(0,t.jsxs)(eE,{children:[(0,t.jsx)(eD,{}),(0,t.jsx)(eI,{}),e]})]})}var e$=e.i(932135),eF=e.i(996718),eU=e.i(130826);e.i(563932);var e_=e.i(341604),eB=e.i(8497),eV=e.i(250569),eW=e.i(800989),eH=e.i(274762),eY=e.i(804),eQ=e.i(294656),eG=e.i(392965),eX=e.i(328076),eJ=e.i(849050);let eZ={name:"user",size:24,node:[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]};eZ.node;let e0=(0,en.f)(eZ);var e1=e.i(299668);let e2={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};e2.node;let e4=(0,en.f)(e2);var e5=e.i(672750),e3=e.i(391490),e8=e.i(102503);let e7={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};e7.node;let e9=(0,en.f)(e7);var e6=e.i(149434),te=e.i(925535);let tt={name:"credit-card",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}],["path",{d:"M6 14h2",key:"mk7k0u"}]]};tt.node;let tn=(0,en.f)(tt);var ta=e.i(518071),tr=e.i(520582),ti=e.i(393153),ts=e.i(613349),to=e.i(58231);let tl="October 10, 2026",tc="underline decoration-foreground/30 underline-offset-3 transition-colors hover:decoration-foreground/60";function tu({className:e,showAnalyticsChoices:n=!1}){return(0,t.jsxs)("div",{className:(0,ts.c)(e),"data-privacy-policy":tl,children:[(0,t.jsxs)("p",{className:"mb-12 text-sm text-muted-foreground",children:["Last updated: ",tl]}),(0,t.jsxs)("div",{className:"prose prose-neutral max-w-none space-y-8 text-[1.0625rem] leading-relaxed dark:prose-invert",children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Interpretation and Definitions"}),(0,t.jsxs)("p",{className:"text-foreground/80",children:['In this Privacy Policy, "Company" (referred to as "We", "Us", or "Our") refers to Alook AI. "Service" refers to the Alook platform accessible at'," ",(0,t.jsx)("a",{href:"https://alook.ai",className:tc,children:"alook.ai"}),'. "You" means the individual accessing or using our Service. "Personal Data" is any information that relates to an identified or identifiable individual.']})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Collecting and Using Your Personal Data"}),(0,t.jsx)("h3",{className:"mt-8 mb-3 text-lg font-medium",children:"Types of Data Collected"}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"While using Our Service, We may ask You to provide Us with certain personally identifiable information that can be used to contact or identify You, including but not limited to:"}),(0,t.jsxs)("ul",{className:"mt-3 list-disc space-y-2 pl-6 text-foreground/80",children:[(0,t.jsx)("li",{children:"Email address"}),(0,t.jsx)("li",{children:"Name"}),(0,t.jsx)("li",{children:"Usage data"})]}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Usage Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"Necessary diagnostic data may be processed to keep the Service secure and reliable. Google receives page and feature signals when You use our public website and Blog, even without analytics cookies. Allowing analytics enables analytics cookies and other optional analytics. We do not use ad tracking."}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Information from Third-Party Social Login"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"Alook allows You to create an account and log in through third-party services including Google and GitHub. If You decide to register through or grant us access to a third-party service, We may collect Personal Data already associated with Your account, such as Your name and email address."}),(0,t.jsx)("h4",{className:"mt-6 mb-2 text-base font-medium",children:"Tracking Technologies and Cookies"}),(0,t.jsxs)("p",{className:"text-foreground/80",children:["We use necessary cookies to provide sign-in, security, and saved preferences. We use optional analytics cookies by default. Your analytics choice is saved in a first-party cookie for 180 days and can be changed using the preference control on the"," ",(0,t.jsx)("a",{href:"/privacy#analytics-choices",className:tc,children:"Privacy page"})," at any time. Choosing only necessary cookies denies analytics cookies; Google still receives signals without analytics cookies on our public website and Blog. Other optional analytics follow the same choice."]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Use of Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"We may use Your Personal Data for the following purposes:"}),(0,t.jsxs)("ul",{className:"mt-3 list-disc space-y-2 pl-6 text-foreground/80",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To provide and maintain our Service"}),", including processing and delivering AI agent tasks on your behalf."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To manage Your Account"})," and provide You with access to functionalities of the Service available to registered users."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To contact You"})," by email or other equivalent forms of electronic communication regarding updates or informative communications related to the Service."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"To manage Your requests"})," and attend to any requests You make to Us."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"For business transfers"})," in connection with any merger, sale of company assets, financing, or acquisition of all or a portion of Our business."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"For other purposes"})," such as data analysis, identifying usage trends, and improving our Service."]})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Sharing Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"We may share Your personal information in the following situations:"}),(0,t.jsxs)("ul",{className:"mt-3 list-disc space-y-2 pl-6 text-foreground/80",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"With Service Providers:"})," We share data with third-party AI model providers to power agent capabilities. Data sent to these providers is governed by their respective privacy policies. We minimize the data shared and only send what is necessary to fulfill Your requests."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"For business transfers:"})," In connection with a merger, acquisition, or asset sale, Your Personal Data may be transferred."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("strong",{children:"With Your consent:"})," We may disclose Your personal information for any other purpose with Your consent."]})]}),(0,t.jsx)("p",{className:"mt-4 text-foreground/80",children:"We do not sell Your Personal Data to third parties."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Retention of Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"We will retain Your Personal Data only for as long as is necessary for the purposes set out in this Privacy Policy. We will retain and use Your data to the extent necessary to comply with our legal obligations, resolve disputes, and enforce our agreements."}),(0,t.jsx)("p",{className:"mt-4 text-foreground/80",children:"Usage Data is generally retained for a shorter period of time, except when it is used to strengthen security or improve the functionality of Our Service."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Security of Your Personal Data"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"The security of Your Personal Data is important to Us. Your data is stored securely using industry-standard encryption. Agent workspaces are isolated per user. However, no method of transmission over the Internet or method of electronic storage is 100% secure. While We strive to use commercially acceptable means to protect Your Personal Data, We cannot guarantee its absolute security."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Children's Privacy"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"Our Service does not address anyone under the age of 13. We do not knowingly collect personally identifiable information from anyone under the age of 13. If You are a parent or guardian and You are aware that Your child has provided Us with Personal Data, please contact Us. If We become aware that We have collected Personal Data from anyone under the age of 13 without verification of parental consent, We will take steps to remove that information."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Your Data Rights"}),(0,t.jsx)("p",{className:"text-foreground/80",children:"You have the right to access, update, or delete Your Personal Data at any time. You can manage certain information through Your Account settings, or contact Us directly to request assistance with these actions."})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Changes to This Privacy Policy"}),(0,t.jsx)("p",{className:"text-foreground/80",children:'We may update Our Privacy Policy from time to time. We will notify You of any changes by posting the new Privacy Policy on this page and updating the "Last updated" date at the top. You are advised to review this Privacy Policy periodically for any changes.'})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:"mt-10 mb-4 text-xl font-semibold",children:"Contact Us"}),(0,t.jsxs)("p",{className:"text-foreground/80",children:["If you have any questions about this Privacy Policy, You can contact us at"," ",(0,t.jsx)("a",{href:"mailto:support@alook.ai",className:tc,children:"support@alook.ai"}),"."]})]})]}),n?(0,t.jsx)("div",{className:"mt-12",children:(0,t.jsx)(to.AnalyticsPreferenceControl,{})}):null]})}var td=e.i(531342);function tf({label:e,children:n}){return(0,t.jsxs)("fieldset",{className:"min-w-0",children:[(0,t.jsx)("legend",{className:"mb-1.5 text-xs text-muted-foreground",children:e}),n]})}var tm=e.i(751041),th=e.i(228918),tp=e.i(527668),tg=e.i(109762),tv=e.i(690887),ty=e.i(791978);let tb={name:"mail-warning",size:24,node:[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]};tb.node;let tx=(0,en.f)(tb);var tw=e.i(212319),tk=e.i(182149),tj=e.i(577992);async function tC(e){try{switch((await e.json()).error){case"INVALID_OTP":return"That code is incorrect. Try again.";case"OTP_EXPIRED":return"That code expired. Send a new code.";case"TOO_MANY_ATTEMPTS":return"Too many incorrect attempts. Send a new code.";case"RATE_LIMITED":return"Too many requests. Try again when the timer ends.";case"CODE_SEND_FAILED":return"We couldn’t send the code. Try again.";case"ACCOUNT_DELETION_FAILED":return"Your account wasn’t deleted. Try again."}}catch{}return"Something went wrong. Try again."}function tI({email:e,onCancel:a,onDeleted:i}){let[c,u]=(0,o.f)((0,l.f)("notice")),[d,f]=(0,o.f)((0,l.f)("")),[m,h]=(0,o.f)((0,l.f)(0)),[p,g]=(0,o.f)((0,l.f)("")),v=(0,n.useRef)(null),y=(0,n.useRef)(null),b=(0,n.useRef)(null);(0,n.useEffect)(()=>{"code"===c?y.current?.focus():v.current?.focus()},[c]),(0,n.useEffect)(()=>{p&&("code"===c?y.current?.focus():b.current?.focus())},[p,c]),(0,n.useEffect)(()=>{if(m<=0)return;let e=window.setTimeout(()=>{h(e=>Math.max(0,e-1))},1e3);return()=>window.clearTimeout(e)},[m,h]);let x=(0,s.d)(),w=(0,r.D)(x),C=(0,eX.f)({active:!0,generation:0}),I=(0,n.useRef)(!1),S=(0,n.useRef)(void 0);(0,n.useLayoutEffect)(()=>(C.setState(e=>({...e,active:!0})),()=>{C.setState(e=>({active:!1,generation:e.generation+1})),!I.current&&S.current&&(0,eJ.r)(S.current)}),[C]);let N=()=>{if(!w)throw new DOMException("Missing deletion account","AbortError");let e=(0,O.TV)(x),t=C.get().generation,n=new AbortController,a=()=>{(0,O.ot)(x,e,n.signal);let a=C.get();if(!a.active||a.generation!==t)throw new DOMException("Retired deletion view","AbortError")};a();let r=()=>{try{a()}catch{n.abort()}},i=C.subscribe(r),s=w.runtime.lifecycle.subscribe(r);return{registry:w,generation:t,controller:n,assertActive:a,options:(0,M.L)(x,e,n.signal,a),release:()=>{i.unsubscribe(),s.unsubscribe()}}},P=(0,Q.f)({meta:{observabilityAction:"account.deletion.command"},mutationFn:async({action:e,body:t,source:n})=>{n.assertActive();let a=await fetch(`/api/community/users/me/account-deletion${"code"===e?"/code":""}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:t,signal:n.controller.signal});return"code"!==e&&a.ok||n.assertActive(),a}}),E=P.isPending&&P.variables?.action==="code",A=P.isPending&&P.variables?.action==="delete",R=async()=>{let e=N();g("");try{let t=await P.mutateAsync({action:"code",body:"{}",source:e});if(e.assertActive(),401===t.status){await e.options.onUnauthorized?.()&&(0,eJ.y)(e.registry.accountId);return}if(!t.ok){let n=429===t.status?(0,tj.f)(t.headers):null,a=await tC(t);e.assertActive(),n&&h(n),g(a);return}let n=await t.json();e.assertActive(),f(""),h(n.resend_after),u("code")}catch(t){if((0,k.c)(t))return;try{e.assertActive()}catch{return}g("We couldn’t send the code. Check your connection and try again.")}finally{e.release()}},D=async()=>{if(!/^\d{6}$/u.test(d))return;let e=N(),t=e.registry.authenticationView.get().generation,n=()=>{let n=e.registry.sessionViewer();return e.registry.authenticationView.get().active&&e.registry.authenticationView.get().generation===t&&(null==n||n===e.registry.accountId)};g("");let a=(0,eJ.q)(e.registry.accountId);S.current=a;try{let t=await P.mutateAsync({action:"delete",body:JSON.stringify({otp:d}),source:e});if(!t.ok){let n=await tC(t);e.assertActive(),(0,eJ.r)(a),S.current=void 0,f(""),g(n);return}let r=!0;try{e.assertActive()}catch{r=!1}if(I.current=!0,(0,M.d)(e.registry),await (0,j.G)(e.registry.accountId).catch(()=>void 0),!r||!n()){(0,eJ.r)(a),S.current=void 0;return}try{await i()}catch{}n()&&globalThis.location.replace(eJ.e)}catch(t){if((0,eJ.r)(a),S.current=void 0,(0,k.c)(t))return;try{e.assertActive()}catch{return}f(""),g("Your account wasn’t deleted. Check your connection and try again.")}finally{e.release()}};return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md animate-in fade-in duration-150 motion-reduce:animate-none","data-testid":eh.f.accountDeletionFlow,children:"notice"===c?(0,t.jsxs)("section",{className:"space-y-8",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-full bg-destructive/10 text-destructive",children:(0,t.jsx)(tw.f,{className:"size-5"})}),(0,t.jsx)("h2",{ref:v,tabIndex:-1,className:"text-xl font-medium tracking-tight outline-none",children:"Delete your account?"}),(0,t.jsx)("p",{className:"text-sm leading-6 text-muted-foreground",children:"Your profile, messages, agents, and account data will be permanently removed."}),(0,t.jsx)("p",{className:"text-sm font-medium",children:"This can’t be undone."})]}),(0,t.jsxs)("div",{className:"rounded-xl bg-muted/60 p-4",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Deletion code will be sent to"}),(0,t.jsx)("div",{className:"mt-1 break-all text-sm font-medium",children:e})]}),p?(0,t.jsx)("p",{ref:b,tabIndex:-1,role:"alert",className:"text-sm text-destructive outline-none",children:p}):null,(0,t.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[(0,t.jsx)(eb.K,{variant:"ghost",className:"h-11 sm:h-9",onClick:a,disabled:E,children:"Cancel"}),(0,t.jsx)(eb.K,{className:"h-11 sm:h-9",onClick:R,disabled:E||m>0,"data-testid":eh.f.accountDeletionSendCode,children:E?"Sending code…":m>0?`Send deletion code in ${m}s`:"Send deletion code"})]})]}):(0,t.jsxs)("section",{className:"space-y-8",children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-full bg-destructive/10 text-destructive",children:(0,t.jsx)(tx,{className:"size-5"})}),(0,t.jsx)("h2",{ref:v,tabIndex:-1,className:"text-xl font-medium tracking-tight outline-none",children:"Enter deletion code"}),(0,t.jsxs)("p",{className:"text-sm leading-6 text-muted-foreground",children:["We sent a 6-digit code to ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:e}),"."]})]}),(0,t.jsx)(tk.J,{ref:y,value:d,onChange:e=>{f(e),g("")},maxLength:6,autoFocus:!0,disabled:A,"aria-label":"Deletion code","aria-invalid":!!p,containerClassName:"justify-center sm:justify-start","data-testid":eh.f.accountDeletionOtp,children:(0,t.jsx)(tk.o,{children:Array.from({length:6},(e,n)=>(0,t.jsx)(tk.L,{index:n,className:"size-11 text-base"},n))})}),p?(0,t.jsx)("p",{ref:b,tabIndex:-1,role:"alert",className:"text-sm text-destructive outline-none",children:p}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 sm:flex-row",children:[(0,t.jsx)(eb.K,{variant:"ghost",className:"h-11 sm:h-9",onClick:()=>{g(""),u("notice")},disabled:A,children:"Back"}),(0,t.jsx)(eb.K,{variant:"ghost",className:"h-11 sm:h-9",onClick:R,disabled:A||E||m>0,children:E?"Sending…":m>0?`Resend code in ${m}s`:"Resend code"})]}),(0,t.jsx)(eb.K,{variant:"destructive",className:"h-11 sm:h-9",onClick:D,disabled:A||6!==d.length,"data-testid":eh.f.accountDeletionSubmit,children:A?"Deleting account…":"Delete account"})]})]})})}let tS=[{value:"light",label:"Light",icon:e5.f},{value:"dark",label:"Dark",icon:e3.f},{value:"system",label:"System",icon:e8.f}],tN=[{value:"profile",label:"My Profile",icon:e0},{value:"billing",label:"Subscription & billing",icon:tn},{value:"appearance",label:"Appearance",icon:e4},{value:"advanced",label:"Advanced",icon:e9},{value:"privacy",label:"Privacy",icon:te.f}];function tP(){let{theme:e,setTheme:a}=(0,ta.i)(),[r,i]=(0,o.f)((0,l.f)(!1));(0,n.useEffect)(()=>i(!0),[i]);let s=r?e??"system":void 0;return(0,t.jsx)("div",{className:"mx-auto w-full max-w-md space-y-4",children:(0,t.jsx)(tf,{label:"Theme",children:(0,t.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-xl bg-muted/60 p-1",children:tS.map(({value:e,label:n,icon:r})=>{let i=s===e;return(0,t.jsxs)("button",{onClick:()=>a(e),"aria-pressed":i,className:["flex min-h-16 flex-col items-center justify-center gap-2 rounded-lg px-2 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",i?"bg-background text-foreground shadow-(--e1)":"text-muted-foreground hover:bg-background/60 hover:text-foreground"].join(" "),children:[(0,t.jsx)(r,{className:"size-5"}),n]},e)})})})})}let tE=["device","cache","size"];function tM(){let[e,a]=(0,o.f)((0,l.f)(!1)),[r,c]=(0,o.f)((0,l.f)(null)),u=(0,s.d)(),d=(0,i.f)({queryKey:tE,queryFn:({signal:e})=>(0,j.P)(e),retry:!1,staleTime:0}),f=(0,Q.f)({meta:{observabilityAction:"cache.clear"},mutationFn:j.t}),m=f.isPending;(0,eG.useObservedRegion)("settings",!d.isPending&&void 0!==d.data,1);let h=d.isPending?"loading":d.isError?"unavailable":d.data,p=(0,eX.f)({active:!0,generation:0});return(0,n.useLayoutEffect)(()=>(p.setState(e=>({...e,active:!0})),()=>p.setState(e=>({active:!1,generation:e.generation+1}))),[p]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ti.f,{open:e,onOpenChange:e=>{e||a(!1)},title:"Clear local cache?",description:"This removes locally cached messages and public files for every account used on this device. The next channel or DM you open will refetch from the server. Nothing on the server is deleted.",confirmLabel:"Clear cache",loadingLabel:"Clearing...",loading:m,onConfirm:async()=>{c(null);let e=p.get().generation,t=u.getQueryCache().find({queryKey:tE,exact:!0}),n=()=>{let t=p.get();if(!t.active||t.generation!==e)throw new DOMException("Retired cache settings view","AbortError")};try{await u.cancelQueries({queryKey:tE,exact:!0}),n(),await f.mutateAsync(),n(),t&&u.getQueryCache().find({queryKey:tE,exact:!0})===t&&await u.refetchQueries({queryKey:tE,exact:!0}),n(),a(!1)}catch(e){try{n()}catch{return}c(e instanceof Error?e.message:"Device cache has not been fully cleared. Please try again."),(0,eJ.w)(e,"Failed to clear cache",n),a(!1)}}}),(0,t.jsxs)("div",{className:"mx-auto flex min-h-full w-full max-w-md flex-col",children:[(0,t.jsxs)("section",{className:"space-y-2",children:[(0,t.jsx)("h2",{className:"text-base font-medium tracking-tight",children:"Clear local cache"}),r&&(0,t.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:r}),(0,t.jsxs)("p",{className:"flex items-baseline justify-between gap-4 text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Cached messages and public files"}),(0,t.jsx)("span",{"data-testid":eh.f.settingsCacheSize,className:"font-mono tabular-nums text-foreground",children:"loading"===h?"Calculating…":"unavailable"===h?"Unavailable":(0,j.L)(h)})]}),(0,t.jsx)("p",{className:"max-w-[65ch] text-sm leading-6 text-muted-foreground",children:"Removes locally cached messages and public files for every account used on this device. The next channel or DM you open will refetch from the server. Nothing on the server is deleted."}),(0,t.jsx)(eb.K,{variant:"destructive",size:"sm",className:"mt-2 h-11 sm:h-8",onClick:()=>a(!0),children:"Clear local cache"})]}),(0,t.jsxs)("footer",{"data-testid":eh.f.settingsWebVersion,className:"mt-auto pt-8 font-mono text-xs tabular-nums text-muted-foreground",children:["Web v","0.1.51"]})]})]})}function tA({initialTab:e="profile",billingReturn:a=null,onClose:r,userId:i,userName:s,userEmail:c,aboutMe:u,avatar:d,statusEmoji:f,statusText:m,onSave:h,onLogout:p,onAccountDeleted:g,onUploadAvatar:v}){let[y,b]=(0,o.f)((0,l.f)(s)),[x,w]=(0,o.f)((0,l.f)(u)),[k,j]=(0,o.f)((0,l.f)({emoji:f??null,text:m??null})),[C,I]=(0,o.f)((0,l.f)({name:s,aboutMe:u,emoji:f??null,text:m??null})),[S,N]=(0,o.f)((0,l.f)(e));(0,n.useEffect)(()=>{N(e)},[e,N]);let P=(0,ty.q)(a,"billing"===S),[E,M]=(0,o.f)((0,l.f)(!1));(0,eG.useObservedRegion)("settings","billing"!==S&&"advanced"!==S,1);let A=y!==C.name||x!==C.aboutMe||k.emoji!==C.emoji||k.text!==C.text;return(0,t.jsx)(tg.I,{value:S,onValueChange:N,label:"User Settings",title:"billing"===S?"Subscription & billing":E?"Delete account":"appearance"===S?"Appearance":"advanced"===S?"Advanced":"privacy"===S?"Privacy Policy":"My Profile",tabs:tN,onClose:r,disabled:E,navFooter:(0,t.jsxs)(eb.K,{variant:"ghost",className:tp.n,size:"sm",onClick:p,"aria-label":"Log out",disabled:E,children:[(0,t.jsx)(e1.f,{className:"size-4"})," ",(0,t.jsx)("span",{className:"sr-only sm:not-sr-only",children:"Log Out"})]}),children:E?(0,t.jsx)(tI,{email:c,onCancel:()=>M(!1),onDeleted:g}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tg.s,{value:"billing",children:(0,t.jsx)("div",{className:"mx-auto w-full max-w-xl",children:(0,t.jsx)(tv.X,{billing:P})})}),(0,t.jsx)(tg.s,{value:"profile",children:(0,t.jsxs)("div",{className:"mx-auto w-full max-w-md space-y-8",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsx)("span",{className:"block size-24 overflow-hidden rounded-full ring-1 ring-border/50",children:(0,t.jsx)(td.f,{label:d,seed:i??void 0,size:96})}),(0,t.jsxs)("button",{type:"button",onClick:v,className:"flex min-h-11 items-center gap-2 rounded-full border border-border/50 px-3 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:min-h-8",children:[(0,t.jsx)(e6.f,{className:"size-3.5"})," Change photo"]})]}),(0,t.jsx)("input",{value:y,onChange:e=>b(e.target.value),placeholder:"Your name","aria-label":"Display name",className:"min-h-11 w-full rounded-sm border-0 bg-transparent px-0 py-1 text-xl font-medium leading-[1.2] tracking-tight shadow-none outline-none placeholder:font-normal placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-4 focus-visible:ring-offset-background sm:text-2xl"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"About"}),(0,t.jsx)(tr.f,{value:x,onChange:e=>w(e.target.value),placeholder:"Add a bit about yourself…",className:"min-h-11 w-full rounded-sm border-0 bg-transparent px-0 py-1 text-sm leading-6 text-foreground shadow-none outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-4 focus-visible:ring-offset-background"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:"Status"}),(0,t.jsx)(tm.f,{emoji:k.emoji,text:k.text,onChange:(e,t)=>j({emoji:e,text:t}),children:(0,t.jsx)("button",{className:"inline-flex min-h-11 items-center gap-2 rounded-full border border-border/50 px-3 text-sm transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:min-h-8",children:(0,th.b)(k.emoji,k.text)?(0,t.jsxs)("span",{children:[k.emoji," ",k.text]}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"Set a status"})})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)(eb.K,{variant:"ghost",size:"sm",className:"h-11 shrink-0 px-3 text-destructive hover:text-destructive sm:h-8",onClick:()=>M(!0),"aria-label":"Delete account","data-testid":eh.f.accountDeletionOpen,children:"Delete account"}),(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[(0,t.jsx)(eb.K,{variant:"ghost",size:"sm",className:"h-11 sm:h-8",onClick:()=>{b(C.name),w(C.aboutMe),j({emoji:C.emoji,text:C.text})},disabled:!A,children:"Cancel"}),(0,t.jsx)(eb.K,{size:"sm",className:"h-11 sm:h-8",onClick:()=>{if(!A)return;let e=y.trim(),t=x.trim();h({name:e,aboutMe:t,statusEmoji:k.emoji,statusText:k.text}),I({name:e,aboutMe:t,emoji:k.emoji,text:k.text}),b(e),w(t)},disabled:!A,children:"Save changes"})]})]})]})}),(0,t.jsx)(tg.s,{value:"appearance",children:(0,t.jsx)(tP,{})}),(0,t.jsx)(tg.s,{value:"advanced",className:"h-full",children:(0,t.jsx)(tM,{})}),(0,t.jsx)(tg.s,{value:"privacy",children:(0,t.jsx)("div",{className:"mx-auto w-full max-w-2xl pb-8",children:(0,t.jsx)(tu,{})})})]})})}var tO=e.i(393085),tR=e.i(254578),tD=e.i(590834),tD=tD,tL=e.i(157080),tL=tL,tz=e.i(272553);function tT(e){return Number(e.toFixed(6)).toString()}function tq(e,t){if(void 0!==e&&void 0!==t&&Number.isFinite(e)&&Number.isFinite(t)&&!(e<=0)&&!(t<=0))return{width:e,height:t}}var tK=e.i(677204);let t$={scale:1,x:0,y:0};function tF(e,t){let n=Math.max(1,Math.min(8,e.scale)),a=t.width*(n-1)/2,r=t.height*(n-1)/2;return{scale:n,x:Math.max(-a,Math.min(a,e.x)),y:Math.max(-r,Math.min(r,e.y))}}function tU(e,t,n,a){let r=Math.max(1,Math.min(8,t)),i=r/e.scale;return tF({scale:r,x:n.x-(n.x-e.x)*i,y:n.y-(n.y-e.y)*i},a)}function t_(e){return 1===e.length?e[0]:{x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2}}function tB(e){return Math.hypot(e[1].x-e[0].x,e[1].y-e[0].y)}function tV({image:e,onClose:a}){let r=(0,n.useMemo)(()=>tq(e.width,e.height),[e.height,e.width]),[i,s]=(0,o.f)((0,l.f)(r)),[c,u,,d,f,m]=(0,tK.f)({source:e.thumbnailUrl}),[h,p,g,v,y,b,x]=(0,tK.f)({source:e.originalUrl}),w=function(e){if(!e)return{width:"min(200px, 90vw, 85vh, max(1px, calc(100vh - 144px)))",aspectRatio:"1 / 1"};let t=85*(e.width/e.height);return{width:`min(${tT(e.width)}px, 90vw, ${tT(t)}vh, calc(max(1px, calc(100vh - 144px)) * ${tT(e.width/e.height)}))`,aspectRatio:`${tT(e.width)} / ${tT(e.height)}`}}(i),k=!!e.thumbnailUrl&&"ready"===c,j="ready"===h,{frameRef:C,view:I,reset:S,zoomIn:N,zoomOut:P,handlers:E}=function(e){let t=(0,n.useRef)(null),a=(0,n.useRef)(new Map),[r,i]=(0,o.f)((0,l.f)(t$)),s=(0,n.useRef)(t$),c=(0,n.useCallback)(e=>{let n=t.current?.getBoundingClientRect(),a=n?tF(e,n):t$;s.current=a,i(a)},[i]),u=(0,n.useCallback)(()=>{a.current.clear(),c(t$)},[c]),d=(0,n.useCallback)((e,n)=>{let a=t.current?.getBoundingClientRect();if(!a)return;let r=n?{x:n.x-a.left-a.width/2,y:n.y-a.top-a.height/2}:{x:0,y:0};c(tU(s.current,e,r,a))},[c]);(0,n.useEffect)(()=>{if(!e)return void u();let n=t.current;if(!n)return;let r=e=>{e.preventDefault();let t=1===e.deltaMode?16:2===e.deltaMode?n.clientHeight:1,a=e.ctrlKey?.005:.002;d(s.current.scale*Math.exp(-e.deltaY*t*a),{x:e.clientX,y:e.clientY})},i=a.current;n.addEventListener("wheel",r,{passive:!1});let o="function"==typeof ResizeObserver?new ResizeObserver(()=>{a.current.clear(),c(s.current)}):void 0;return o?.observe(n),()=>{n.removeEventListener("wheel",r),o?.disconnect(),i.clear()}},[c,e,u,d]);let f=e=>{a.current.delete(e.pointerId),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)};return{frameRef:t,view:r,reset:u,zoomIn:()=>d(1.5*s.current.scale),zoomOut:()=>d(s.current.scale/1.5),handlers:{onPointerDown:t=>{e&&0===t.button&&!(a.current.size>=2)&&(a.current.set(t.pointerId,{x:t.clientX,y:t.clientY}),t.currentTarget.setPointerCapture?.(t.pointerId))},onPointerMove:e=>{if(!a.current.has(e.pointerId))return;let t=[...a.current.values()];a.current.set(e.pointerId,{x:e.clientX,y:e.clientY});let n=[...a.current.values()],r=t_(t),i=t_(n),o=e.currentTarget.getBoundingClientRect(),l={x:r.x-o.left-o.width/2,y:r.y-o.top-o.height/2},u=2===t.length?tB(n)/Math.max(1,tB(t)):1,d=tU(s.current,s.current.scale*u,l,o);c({...d,x:d.x+i.x-r.x,y:d.y+i.y-r.y})},onPointerUp:f,onPointerCancel:f,onLostPointerCapture:f,onKeyDown:t=>{if(e&&!t.ctrlKey&&!t.metaKey&&!t.altKey){if("+"===t.key||"="===t.key)d(1.5*s.current.scale);else if("-"===t.key)d(s.current.scale/1.5);else if("0"===t.key)u();else{if(!t.key.startsWith("Arrow"))return;let e=s.current;c({...e,x:e.x+("ArrowLeft"===t.key?40:"ArrowRight"===t.key?-40:0),y:e.y+("ArrowUp"===t.key?40:"ArrowDown"===t.key?-40:0)})}t.preventDefault()}},onDoubleClick:t=>{e&&d(s.current.scale>1?1:2,{x:t.clientX,y:t.clientY})}}}}(j),M={transform:`translate(${I.x}px, ${I.y}px) scale(${I.scale})`};return(0,n.useLayoutEffect)(()=>{if("ready"!==h||!g)return;let e=tq(g.naturalWidth,g.naturalHeight);s(r??e)},[r,g,h,s]),(0,t.jsxs)("div",{className:"relative w-fit",children:[(0,t.jsxs)("div",{ref:C,"data-testid":eh.f.imageLightbox,"data-zoom-scale":I.scale,"data-native-context-menu":"true",role:"region","aria-label":"Image preview. Use plus and minus to zoom, arrow keys to pan, and zero to fit.",tabIndex:j?0:-1,className:`relative select-none overflow-hidden rounded-lg bg-background ${I.scale>1?"cursor-grab active:cursor-grabbing":"cursor-default"}`,style:{...w,touchAction:j?"none":void 0},...E,children:[e.thumbnailUrl&&(0,t.jsx)("img",{ref:d,"data-testid":eh.f.imageLightboxThumbnail,"data-remote-image-kind":"content","data-remote-image-state":c,src:e.thumbnailUrl,alt:e.name,draggable:!1,style:M,onLoad:f,onError:m,className:`absolute inset-0 size-full rounded-lg object-contain ${k&&!j?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"}`},`thumbnail-${u}`),!k&&!j&&"pending"===h&&(0,t.jsx)("div",{"data-testid":eh.f.imageLightboxLoading,role:"status",className:"absolute inset-0 flex animate-pulse items-center justify-center bg-muted/70 px-4 text-sm text-muted-foreground motion-reduce:animate-none",children:"Loading original image"}),"error"!==h&&(0,t.jsx)("img",{ref:v,"data-testid":eh.f.imageLightboxOriginal,"data-remote-image-kind":"content","data-remote-image-state":h,src:e.originalUrl,alt:e.name,draggable:!1,style:M,onLoad:y,onError:b,className:`absolute inset-0 size-full rounded-lg object-contain ${j?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"}`},`original-${p}`)]}),(0,t.jsxs)("div",{role:"toolbar","aria-label":"Image controls",className:"absolute left-1/2 z-20 flex -translate-x-1/2 items-center gap-1 rounded-lg border border-border bg-background p-1",style:{top:"calc(50% - 50vh + 12px)"},children:[(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Zoom out",title:"Zoom out",disabled:!j||I.scale<=1,onClick:P,children:(0,t.jsx)(tR.f,{})}),(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Fit image",title:"Fit image",disabled:!j||1===I.scale,onClick:S,children:(0,t.jsx)(tL.f,{})}),(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Zoom in",title:"Zoom in",disabled:!j||I.scale>=8,onClick:N,children:(0,t.jsx)(tD.f,{})}),(0,t.jsx)(eb.K,{variant:"ghost",size:"icon",className:"size-11 sm:size-9","aria-label":"Close image preview",title:"Close",onClick:a,children:(0,t.jsx)(tz.f,{})})]}),"error"===h&&(0,t.jsxs)("div",{"data-testid":eh.f.imageLightboxError,role:"status",className:"absolute bottom-3 left-1/2 z-10 flex min-h-11 w-max max-w-[min(90vw,24rem)] -translate-x-1/2 items-center justify-between gap-2 rounded-md border border-border bg-background px-3 py-2 text-sm shadow-sm",children:[(0,t.jsx)("span",{children:"Failed to load original image"}),(0,t.jsx)("button",{type:"button","data-testid":eh.f.imageLightboxRetry,onClick:x,className:"h-12 min-w-12 rounded-md px-3 font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:h-9 sm:min-w-0",children:"Retry"})]})]})}function tW({image:e,onClose:n}){return(0,t.jsx)(ew.N,{open:!0,onOpenChange:e=>{e||n()},children:(0,t.jsx)(ew.d,{"aria-label":e.name,className:"flex max-h-[90vh] w-auto items-center justify-center border-none bg-transparent p-0 shadow-none sm:max-w-none",showCloseButton:!1,children:(0,t.jsx)(tV,{image:e,onClose:n},`${e.originalUrl}\0${e.thumbnailUrl??""}\0${e.width??""}\0${e.height??""}`)})})}var tH=e.i(549712),tY=e.i(288423),tQ=e.i(955233),tG=e.i(863576),tX=e.i(521314),tJ=e.i(565464),tZ=e.i(972525),t0=e.i(655041),t1=e.i(986087);e.i(43729);var t2=e.i(786637),t4=e.i(43345);let t5=(0,tY.default)(()=>e.A(762162).then(e=>e.CodePreview),{loadableGenerated:{modules:[145142]},ssr:!1,loading:()=>(0,t.jsxs)("div",{"data-testid":eh.f.codePreview,role:"status",className:"flex min-h-40 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(tX.f,{className:"size-4 animate-spin"}),"Loading syntax highlighter…"]})}),t3=(0,tY.default)(()=>e.A(911974).then(e=>e.PdfPreview),{loadableGenerated:{modules:[144402]},ssr:!1,loading:()=>(0,t.jsxs)("div",{"data-testid":eh.f.pdfPreviewStatus,role:"status",className:"flex min-h-40 items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(tX.f,{className:"size-4 animate-spin motion-reduce:animate-none"}),"Loading PDF renderer…"]})}),t8={status:"idle",content:null,error:null};function t7({attachment:e}){let n=(0,t4.f)(e),a=(0,t2.f)(n.state),r="downloading"===n.state.status?tX.f:"saved"===n.state.status||"started"===n.state.status?tQ.f:"error"===n.state.status?tJ.f:tG.f;return(0,t.jsxs)("button",{type:"button","data-testid":eh.f.attachmentPreviewDownload,onClick:()=>"downloading"===n.state.status?n.cancel():void n.start(),"aria-busy":"downloading"===n.state.status,className:(0,eb.i)({variant:"outline",size:"sm",className:"h-11 disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground sm:h-7"}),children:[(0,t.jsx)(r,{className:`size-3.5 ${"downloading"===n.state.status?"animate-spin motion-reduce:animate-none":""}`}),"downloading"===n.state.status?"Cancel download":a??"Download"]})}async function t9(e,t=t1.w,n){return new TextDecoder().decode(await t6(e,t,n))}async function t6(e,t,n){if(!e.ok)throw Error(`Couldn’t load this attachment (${e.status})`);let a=Number(e.headers.get("content-length"));if(Number.isFinite(a)&&a>t)throw Error("This file is too large to preview");if(!e.body){let a=new Uint8Array(await e.arrayBuffer());if(n?.aborted)throw new DOMException("Aborted","AbortError");if(a.byteLength>t)throw Error("This file is too large to preview");return a}let r=e.body.getReader(),i=0,s=[];try{for(;;){if(n?.aborted)throw new DOMException("Aborted","AbortError");let{done:e,value:a}=await r.read();if(n?.aborted)throw new DOMException("Aborted","AbortError");if(e)break;if((i+=a.byteLength)>t)throw await r.cancel(),Error("This file is too large to preview");s.push(a)}let e=new Uint8Array(i),a=0;for(let t of s)e.set(t,a),a+=t.byteLength;return e}finally{n?.aborted&&await r.cancel().catch(()=>void 0),r.releaseLock()}}function ne({attachment:e,open:n,onOpenChange:a}){let r=(0,tH.f)(),s=e?(0,t1.Y)(e.name,e.contentType):null,o=s?.previewKind==="pdf"?t1.a:t1.w,l=s?.previewKind?e?.sizeBytes!==void 0&&e.sizeBytes>o?"This file is too large to preview":null:"This file type can’t be previewed",c=(0,i.f)({queryKey:(0,tH.v)(r,"attachment-preview",n?e?.url??null:null,s?.previewKind??null,o),enabled:n&&null!==e&&null===l,gcTime:0,staleTime:1/0,retry:!1,queryFn:async({signal:t})=>{let n=(0,tH.L)(r),a=()=>(0,tH.k)(n,t);if(a(),!e||!s?.previewKind)throw Error("No attachment selected");try{let n=await fetch(e.url,{credentials:"same-origin",signal:t});a();let r="pdf"===s.previewKind?{status:"ready",kind:"pdf",content:await t6(n,o,t),error:null}:{status:"ready",kind:"text",content:await t9(n,o,t),error:null};return a(),r}catch(e){throw a(),e}}},r.queryClient),u=n&&e?l?{status:"error",content:null,error:l}:c.isError?{status:"error",content:null,error:c.error instanceof Error?c.error.message:"Couldn’t load this attachment"}:c.data??{status:"loading",content:null,error:null}:t8,d=e?(0,t1.E)(e.sizeBytes)||e.size:"";return(0,t.jsxs)(tZ.f,{open:n,onOpenChange:a,title:e?.name??"Attachment",description:[e?.contentType||s?.category,d].filter(Boolean).join(" · "),footer:e&&(0,t.jsx)(t7,{attachment:e}),resizable:!0,closeLabel:"Close attachment preview",contentTestId:eh.f.attachmentPreviewSheet,bodyTestId:eh.f.attachmentPreviewContent,bodyClassName:(0,ts.c)("flex min-h-0 flex-col",s?.previewKind==="pdf"&&"overflow-hidden",(s?.previewKind==="code"||s?.previewKind==="text"||s?.previewKind==="pdf")&&"p-0 sm:p-0"),children:["loading"===u.status&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-8 text-sm text-muted-foreground",children:[(0,t.jsx)(tX.f,{className:"size-4 animate-spin"}),"Loading preview…"]}),"error"===u.status&&(0,t.jsxs)("div",{className:"flex min-h-40 flex-col items-center justify-center gap-2 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Preview unavailable"}),(0,t.jsx)("p",{className:"max-w-72 text-sm text-muted-foreground",children:u.error})]}),"ready"===u.status&&"text"===u.kind&&s?.previewKind==="markdown"&&(0,t.jsx)(t0.f,{text:u.content}),"ready"===u.status&&"text"===u.kind&&s?.previewKind!=="markdown"&&(0,t.jsx)(t5,{content:u.content,language:s?.shikiLanguage??null}),"ready"===u.status&&"pdf"===u.kind&&(0,t.jsx)(t3,{data:u.content})]})}var nt=e.i(369546);function nn({controller:e,breakpoint:n,extraDialogs:a,suppressProfileCard:r=!1}){let{profile:i,currentUser:s}=e,o=e.pendingAvatarCrop;return(0,t.jsxs)(t.Fragment,{children:[i&&!r&&(0,t.jsx)(tO.f,{data:i.data,x:i.x,y:i.y,bp:n,onClose:e.closeProfile,onMessage:e.profileMessage,canMessage:e.canMessage,isSelf:!!i.data.userId&&i.data.userId===s.id,onUpdateStatus:e.updateOwnStatus,onOpenOwnerProfile:e.openOwnerProfile,onOpenBotAudit:e.openBotAudit},`${i.data.userId??i.data.name}:${i.x}:${i.y}`),e.preview&&(0,t.jsx)(tW,{image:e.preview,onClose:e.closePreview}),(0,t.jsx)(ne,{attachment:e.attachmentPreview,open:!!e.attachmentPreview,onOpenChange:e.onAttachmentPreviewOpenChange}),(0,t.jsx)(ew.N,{open:e.editingProfile,onOpenChange:e.onUserSettingsOpenChange,children:(0,t.jsx)(ew.d,{className:"flex h-dvh max-h-dvh w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none p-0 sm:h-[calc(100vh-4rem)] sm:max-h-180 sm:w-[calc(100vw-4rem)] sm:max-w-4xl sm:rounded-xl",showCloseButton:!1,children:(0,t.jsx)(tA,{...e.userSettingsProps})})}),o&&(0,t.jsx)(nt.f,{...o,maskShape:"circle"}),a]})}var na=e.i(52622);let nr={active:"none",update:null};function ni(e){return[...new Set(e)]}function ns(e,t){return e.filter(e=>!t.has(e))}function no(e,t){return e.filter(e=>t.has(e))}function nl(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function nc(e,t){if(!e.update)return e;let n=new Set(t),a=ni(t);if(0===a.length)return{active:"update"===e.active?"none":e.active,update:null};let r=no(e.update.acceptedMachineIds,n),i=no(e.update.failedMachineIds,n),s=no(e.update.pendingMachineIds,n),o=i.length>0?"retry":r.length>0||s.length>0?"updating":"update"===e.active?"expanded":"collapsedBadge";return o===e.update.phase&&nl(a,e.update.targetMachineIds)&&nl(r,e.update.acceptedMachineIds)&&nl(i,e.update.failedMachineIds)&&nl(s,e.update.pendingMachineIds)?e:{...e,update:{phase:o,targetMachineIds:a,acceptedMachineIds:r,failedMachineIds:i,pendingMachineIds:s}}}var nu=e.i(692462),nd=e.i(708717);function nf({breakpoint:e,checkpoint:n,sidebar:a,children:r,extraDialogs:i,rail:s,profile:o,inbox:l,userBarExtension:c,daemonUpdate:u,onUserBarInboxOpenChange:d,onUserBarOpenProfile:f,onUserBarOpenUpdate:m,dismissUserBarExtension:h}){let{surface:p}=n,{runningBots:g}=(0,nu.f)(),v=(0,t.jsx)(eQ.f,{...l.popoverProps,surface:"extension"}),y={id:o.currentUser.id,name:o.currentUser.name,avatar:o.currentUser.avatar,runningBotCount:g.length},b="unknown"===e,x="profile"===c.active&&o.profile?.data.userId===o.currentUser.id,w=x&&o.profile?(0,t.jsx)(tO.f,{data:o.profile.data,x:o.profile.x,y:o.profile.y,bp:e,onClose:o.closeProfile,onMessage:o.profileMessage,isSelf:!0,onUpdateStatus:o.updateOwnStatus,onOpenOwnerProfile:o.openOwnerProfile,onOpenBotAudit:o.openBotAudit,extension:!0}):null,k=x&&g.length>0?(0,t.jsx)(nd.f,{onOpenBotAudit:o.openBotAudit,showShadow:"mobile"!==e}):null;return(0,t.jsx)(na.f,{breakpoint:e,surface:p,rail:(0,t.jsx)(eH.w,{...s.railProps,bottomInset:60}),preserveHiddenMobileModules:!0,sidebar:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{hidden:"keep"!==n.sidebar.kind,inert:"keep"!==n.sidebar.kind,"aria-hidden":"keep"!==n.sidebar.kind||void 0,className:"flex min-h-0 flex-1 flex-col",children:"desktop"===e?a():a({noHeader:!1})}),"server-skeleton"===n.sidebar.kind?(0,t.jsx)(eB.m,{targetServerId:n.sidebar.serverId}):"me-skeleton"===n.sidebar.kind?(0,t.jsx)(eV.h,{}):null]}),main:"keep"===n.main.kind||"server-route"===n.main.kind?r:(0,t.jsx)(eW.CommunityPendingFrame,{href:n.targetHref,reserveBackSlot:"detail"===p,conversationSubtype:n.main.conversationSubtype}),userBar:(0,t.jsx)(eY.Y,{breakpoint:e,user:y,onOpenProfile:f,onEditProfile:o.openUserSettings,inbox:v,hasUnread:l.hasUnread,unreadCount:l.unreadCount,unreadCountPartial:l.unreadCountPartial,inboxOpen:"inbox"===c.active,onInboxOpenChange:d,extension:{active:c.active,inbox:v,profile:w,profileCompanion:k,update:u.update,updateBadgePhase:c.update&&"update"!==c.active?"expanded"===c.update.phase?"collapsedBadge":c.update.phase:null,eligibleMachines:u.eligibleMachines,onOpenUpdate:m,onRequestUpdate:u.request,onDismiss:h}}),overlays:!b&&(0,t.jsx)(nn,{controller:o,breakpoint:e,extraDialogs:i,suppressProfileCard:x})})}var nm=e.i(876986);let nh=Object.freeze([]),np=async(e={})=>{let t=(0,O.TV)(e.client);return{folders:(await (0,eJ.i)("/api/community/users/me/server-folders",(0,M.L)(e.client,t,e.signal))).folders.map(e=>({id:e.id,name:e.name,position:e.position??0,servers:e.servers.map(e=>({id:e.id,name:e.name,initial:(0,D.f)(e.name),icon:e.icon??null}))}))}};e.i(384302);var ng=e.i(462553),nv=e.i(333671);function ny({targetServerId:e,activeServerId:t,overlay:n,hasActiveOpener:a,publishedHref:r}){if(e===t&&a)return{kind:"open-active"};if(e===t&&r&&(0,eA.B)(r)===e){let e=new URL(r,"https://alook.local");return e.searchParams.set(n,"1"),{kind:"navigate",href:`${e.pathname}${e.search}${e.hash}`}}return{kind:"navigate",href:`/c/channels/${e}?${n}=1`}}var nb=e.i(138906);function nx(e,t,n,a,r){let i=e?.collections.servers.get(t)?.detailComplete===!0,s=e&&i?r??Array.from(e.collections.channels.values()).filter(e=>e.serverId===t&&"thread"!==e.type&&!e.pending).map(e=>e.id):[];return(0,eR.e)({serverId:t,channelIds:s,last:n,breakpoint:a})}var nw=e.i(686988),nk=e.i(354139),nj=e.i(217372);function nC(e,t){if(e&&t&&"role"in t)return t.role.charAt(0).toUpperCase()+t.role.slice(1)}var nI=e.i(47749),nS=e.i(725521),nN=e.i(776152),nP=e.i(939098),nE=e.i(459663);e.i(463690);var nM=e.i(251829),nA=e.i(4674),nO=e.i(248933),nR=e.i(975210);let nD=new WeakMap;function nL(e,t){e.value.setState(e=>({...e,lease:t}))}function nz(e,t){if(e===t)return!0;if(!e)return!1;let n=e=>{let[t,n=""]=e.split("?"),a=new URLSearchParams(n);a.delete("inboxThreadOpener");let r=a.toString();return`${t}${r?`?${r}`:""}`};return n(e)===n(t)}var nT=e.i(387170),nq=e.i(797473),nK=e.i(588732),n$=e.i(595072),nF=e.i(31163),nU=e.i(171738),n_=e.i(214997),nB=e.i(850441),nV=e.i(874697),nW=e.i(42420);function nH(e,t,n,a=0){(0,u.A)(e).ws.actions.isChannelAccessRevoked(t.channelId,t.serverId??null)&&(0,nA.f)(e,t.serverId??null,t.channelId).catch(()=>void 0);let{epoch:r,signal:i}=(0,nW.f)(e,t,n,a);(0,nW.x)(e,r,(n,a)=>{nH(e,t,n,a)});let s=t.anchorMessageId?{mode:"anchor",anchor:t.anchorMessageId}:{mode:"newest"},o=c.f.channelMessages(t.channelId),l="dm"===t.scopeKind?(0,nB.W)(t.channelId,{queryClient:e,onSurfaceReceipt:t=>{(0,nW.Y)(e,t,n,r)}}):(0,nB.$)(t.channelId,null,{queryClient:e,onSurfaceReceipt:t=>{(0,nW.Y)(e,t,n,r)}});e.cancelQueries({queryKey:o,exact:!0}),e.setQueryData(o,e=>e?{...e,pageParams:[s,...e.pageParams.slice(1)]}:e);let d={queryKey:o,queryFn:l,initialPageParam:s,pages:1,getNextPageParam:()=>void 0,retry:(0,n_.g)(e.defaultQueryOptions({queryKey:o}).retry),networkMode:"always",staleTime:0},f=new nU.f(e,{...d,enabled:!1}).subscribe(()=>void 0);e.infiniteQuery({...d,select:void 0}).then(()=>{(0,nW.G)(e,r,n)&&((0,nW.Z)(e,t.channelId,n),(0,nW.S)(e)?.status==="warming"&&(0,nW.m)(e,r,n,!1,!0))}).catch(a=>{let s,o;if(i.aborted||!(0,nW.G)(e,r,n))return;let l=a instanceof k.a&&(403===a.status||404===a.status);l&&(s=c.f.channelMessages(t.channelId),o=c.f.channelReadStateSnapshot(t.channelId),e.removeQueries({queryKey:s}),e.removeQueries({queryKey:o}),e.removeQueries({queryKey:c.f.channelMeta(t.serverId??null,t.channelId)}),(0,u.A)(e).messageStream.actions.removeScope("dm"===t.scopeKind?{kind:"dm",id:t.channelId}:{kind:"channel",id:t.channelId,serverId:t.serverId})),(0,nW.m)(e,r,n,l,!0)}).finally(f);let m=c.f.channelReadStateSnapshot(t.channelId);if(e.query({queryKey:m,staleTime:0,retry:!1,networkMode:"always",queryFn:(0,nV.r)(t.channelId,t.scopeKind,{waitForRegistryReady:!0,assertNavigationCurrent:()=>{if(!(0,nW.G)(e,r,n))throw new DOMException("Retired conversation warmup","AbortError")}}),select:void 0}).catch(()=>void 0),t.serverId){let n=t.serverId,a=c.f.server(n),r={queryKey:a,queryFn:({signal:t})=>(0,Z.Q)(e,n,t)(),staleTime:1/0,networkMode:"always",retry:(0,n_.g)(e.defaultQueryOptions({queryKey:a}).retry)},i=new Y.f(e,{...r,enabled:!1}).subscribe(()=>void 0);e.query({...r,select:void 0}).finally(i).catch(()=>void 0)}return r}var nY=e.i(418558),nQ=e.i(727854);function nG(e){e.revision+=1}async function nX(e,t,n){let a=++e.revision,r=await t();return a===e.revision&&(n(r),!0)}var nJ=e.i(907903),nZ=e.i(908967),n0=e.i(846367);e.i(678523);var n1=e.i(840429);async function n2(e,t){await (0,eJ.i)(`/api/community/machines/${e}/update`,{...t,method:"POST"})}function n4(e,t){return`alook:daemon-update-collapsed:${e}:${t}`}function n5(e,t,n){try{let a=n4(e,t);n?window.localStorage.setItem(a,"1"):window.localStorage.removeItem(a)}catch{}}async function n3(e,t){let n=await Promise.allSettled(e.map(async e=>(await t(e),e))),a=[],r=[];return n.forEach((t,n)=>{let i=e[n];"fulfilled"===t.status?a.push(i):r.push(i)}),{acceptedMachineIds:a,failedMachineIds:r}}var n8=e.i(251535);let n7="alook:native-back";function n9(e){let{view:d,activeServerId:f,frameHref:m,sidebar:h,children:p,extraDialogs:g,onOpenActiveServerSettings:v,onOpenActiveServerInvite:y,ownerDeleteRouteScope:b}=e,x=(0,n.useRef)(null),w=(0,s.d)(),k=(0,F.$)(),j=(0,eP.f)(e=>e.accessEpoch),S=(0,eF.$)(),E=(0,ee.E)(),R={...(0,eA.s)(m),revision:0},D=(0,n.useRef)(R),[L,z]=(0,o.f)((0,l.f)(R)),T=(0,n.useCallback)(e=>{let t=D.current,n=(0,eA.L)(t,e);n!==t&&(D.current=n,z(n))},[z]);(0,n.useLayoutEffect)(()=>{T(m),(0,e$.P)(m),b&&(0,eO.L)(w,b.serverId,b.token),(0,eO.t)(w,m)},[T,m,b,w]),(0,n.useEffect)(()=>{(0,n8.u)(w)},[m,w]);let q=function(e){let t=(0,a.useRouter)(),r=(0,a.usePathname)(),i=(0,a.useSearchParams)().toString(),c=i?`${r}?${i}`:r,u=(0,s.d)(),d=(0,n.useRef)({revision:0}),f=(0,n.useRef)(!1);(0,n.useLayoutEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);let m=(0,n.useRef)(e);(0,n.useLayoutEffect)(()=>{m.current=e},[e]);let h=(0,n.useRef)(null),p=(0,n.useCallback)(e=>{let t=d.current.revision+ +!!e,n=m.current.revision,a=e?(0,eA.s)(e.nextCommitHref).href:null,r=n+ +(null!==a&&(0,eA.s)(a).leafKey!==m.current.leafKey);return()=>{if(!f.current)return!1;if(t===d.current.revision&&n===m.current.revision)return!0;let e=h.current;return null!==a&&null!==e&&e.revision===t&&d.current.revision===t+1&&e.frameRevision===r&&e.frameRevision===m.current.revision&&e.href===a&&m.current.href===a}},[]),g=(0,n.useRef)(e.revision),v=(0,n.useRef)(e.leafKey),[y,b]=(0,o.f)((0,l.f)(!1)),[x,w]=(0,o.f)((0,l.f)(null)),k=(0,n.useCallback)(()=>{nG(d.current),(0,nW.B)(u),b(!1),w(null)},[u,b,w]);(0,n.useEffect)(()=>{if(null===x)return;let t=(0,eA.s)(x);(t.leafKey===v.current?(0,eA.E)(e,c,x):(0,eA.F)({committedFrame:e,targetHref:x,baselineRevision:g.current}))&&(h.current={revision:d.current.revision,frameRevision:e.revision,href:t.href},nG(d.current),b(!1),w(null))},[e,x,c,b,w]),(0,n.useEffect)(()=>{let e=()=>k();return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[k]);let j=(0,n.useCallback)(e=>{let t=d.current.revision;try{e()}catch(e){throw t===d.current.revision&&k(),e}},[k]),C=(0,n.useCallback)((...n)=>{let[a]=n;if(a===c&&!y){h.current=null,(0,e$._)(a);return}(0,e$.A)(a),(0,nY.f)(u,a,"foreground"),nG(d.current),(0,nW.B)(u),g.current=e.revision,v.current=e.leafKey,(0,nQ.flushSync)(()=>{b(!0),w(a)}),j(()=>t.push(...n))},[e.leafKey,e.revision,y,c,u,t,b,w,j]),I=(0,n.useCallback)(n=>{if(n===c&&!y){h.current=null,(0,e$._)(n);return}(0,e$.A)(n),(0,nY.f)(u,n,"foreground"),nG(d.current),g.current=e.revision,v.current=e.leafKey,(0,nQ.flushSync)(()=>{b(!0),w(n)}),j(()=>t.push(n))},[e.leafKey,e.revision,y,c,u,t,b,w,j]),S=(0,n.useCallback)(n=>{if(n===c&&!y){h.current=null,(0,e$._)(n);return}(0,e$.A)(n),(0,nY.f)(u,n,"foreground"),nG(d.current),(0,nW.B)(u),g.current=e.revision,v.current=e.leafKey,b(!0),w(n),j(()=>t.replace(n))},[e.leafKey,e.revision,y,c,u,t,b,w,j]),N=(0,n.useCallback)(async n=>{(0,nW.B)(u),g.current=e.revision,v.current=e.leafKey,b(!0),w(null);let a=nX(d.current,n,e=>{if(e===c){(0,e$._)(e),b(!1),w(null);return}(0,e$.A)(e),(0,nY.f)(u,e,"foreground"),w(e),t.push(e)}),r=d.current.revision;try{return await a}catch(e){throw d.current.revision===r&&(b(!1),w(null)),e}},[e.leafKey,e.revision,c,u,t,b,w]);return{captureIntent:p,publishedHref:c,navigationPending:y,pendingHref:x,push:C,pushImmediate:I,replace:S,resolveAndPush:N,cancelPendingNavigation:k}}(L),K=q.replace,$=(0,eA.M)(L.pathname),U=q.pendingHref?(0,eA.s)(q.pendingHref):null,_=U?.scope.kind==="server"?U.scope.serverId:null,B=q.pendingHref?(0,eA.P)(q.pendingHref):null,V=B?.main.kind==="server-conversation"?B.main.leafId:null,W=(0,A.t)(_),H=(0,A.U)(V),Y=W?.categories?.flatMap(e=>e.channels).find(e=>e.id===V)??H,G=Y?.type==="text"||Y?.type==="forum"||Y?.type==="thread"?Y.type:void 0,et=_?void 0!==w.getQueryData(c.f.server(_))||void 0!==W:U?.scope.kind==="me"&&void 0!==w.getQueryData(c.f.dms()),en=(0,eA.t)({committedFrame:L,targetHref:q.pendingHref,pending:q.navigationPending,targetReady:et,targetConversationSubtype:G}),ea="target"===en.rail.kind?en.rail.view:d,er="target"===en.rail.kind?en.rail.activeServerId:f,ei=function({navigation:e,queryClient:t,breakpoint:a,view:o,projectedView:u=o,activeServerId:d,projectedActiveServerId:f,onOpenActiveServerSettings:m,onOpenActiveServerInvite:h,accountId:p}){let g,v,y,b,x,w,k,j=(0,A.O)(),C=(0,X.f)(),I=(0,Z.N)(),S=(g=(0,A.E)(),v=(0,s.d)(),{...(0,i.f)({queryKey:c.f.folders(),queryFn:async(e={})=>{let t=(0,O.TV)(v),n=await np(e);return(0,O.lp)(v,{snapshot:{kind:"folders",data:n},proof:{kind:"structural",token:t,signal:e.signal}}),n.folders.map(e=>e.id)}}),folders:g?.folders??nh}),N=I.servers,P=S.folders,E=N.length>0||void 0!==I.data||!p,M=(0,l.f)({active:!1,generation:0,navigation:null});(0,n.useLayoutEffect)(()=>(M.set(e=>({...e,active:!0,generation:e.generation+1})),()=>M.set(e=>({...e,active:!1,generation:e.generation+1}))),[j,M]),(0,n.useLayoutEffect)(()=>{M.set(t=>({...t,navigation:e}))},[e,M]);let R=(0,n.useCallback)(e=>M.get().active&&M.get().generation===e&&!!j?.runtime.lifecycle.get().active&&(0,r.D)(t)===j,[j,t,M]),D=(0,n.useCallback)(()=>{let t=M.get().generation,n=C.begin().token,a=j.authenticationView.get(),r=e.captureIntent(),i=()=>{C.assertOwner(n);let e=j.authenticationView.get();if(!R(t)||!e.active||e.generation!==a.generation)throw new DOMException("Retired rail account","AbortError")};return{assertAccount:i,assertUi:()=>{if(i(),!r())throw new DOMException("Retired rail intent","AbortError")}}},[j,e,C,R,M]),{mutateAsync:L}=(0,ng.f)(),{mutate:z}=(0,ng.p)(),{mutate:T}=(0,ng.v)(),q=(0,n.useMemo)(()=>N.map(e=>({...e,active:e.id===f})),[f,N]),{homeHref:K,serverHrefs:$}=(y=(0,A.O)(),b=(0,n.useCallback)(e=>{let t=(0,nb.d)(e),n=y?.collections.servers.subscribeChanges(e),a=y?.collections.channels.subscribeChanges(e);return()=>{t(),n?.unsubscribe(),a?.unsubscribe()}},[y]),x=(0,n.useCallback)(()=>{let e=new Map;for(let t of y?.collections.channels.values()??[]){if(!t.serverId||"thread"===t.type||t.pending)continue;let n=e.get(t.serverId)??[];n.push(t.id),e.set(t.serverId,n)}return JSON.stringify({homeHref:(0,eR.e)({serverId:null,last:(0,nb.C)((0,nv.Y)()),breakpoint:a}),serverHrefs:Object.fromEntries(N.map(({id:t})=>[t,nx(y,t,(0,nb.C)((0,eR.n)(t)),a,e.get(t)??[])]))})},[y,N,a]),w=(0,n.useCallback)(()=>JSON.stringify({homeHref:(0,eR.e)({serverId:null,last:null,breakpoint:a}),serverHrefs:Object.fromEntries(N.map(({id:e})=>[e,(0,eR.e)({serverId:e,last:null,breakpoint:a})]))}),[N,a]),k=(0,n.useSyncExternalStore)(b,x,w),(0,n.useMemo)(()=>JSON.parse(k),[k])),F=(0,n.useCallback)(e=>nx(j,e,(0,eR.N)(e),a),[a,j]),U=(0,n.useCallback)(t=>{(0,nm.f)("server",t),e.push(F(t))},[e,F]),_=(0,n.useCallback)(()=>(0,eR.e)({serverId:null,last:(0,nv.A)(),breakpoint:a}),[a]),B=(0,n.useCallback)(()=>{e.push(_())},[_,e]),V=(0,n.useCallback)(async(t,n)=>{if(!R(M.get().generation))return;let{assertAccount:a,assertUi:r}=D();try{a();let i=await L({name:t});r();let s=i.server.id;(0,eM.toast)(`Server "${t}" created`),n&&T({serverId:s,file:n},{onError:e=>(0,eJ.w)(e,"Server created, but the icon failed to upload",r)}),e.push(`/c/channels/${s}`)}catch(e){(0,eJ.w)(e,"Failed to create server",r)}},[D,L,e,T,M,R]),W=(0,n.useCallback)(e=>{if(!R(M.get().generation))return;let{assertAccount:n,assertUi:a}=D();try{n()}catch{return}(0,eO.e)(t,e),z({serverId:e},{onSuccess:()=>{try{n()}catch{return}try{a(),(0,eM.toast)("Left server")}catch{}let t=M.get().navigation;if(t&&(0,eA.B)(t.navigationPending?t.pendingHref??"":t.publishedHref)===e){let n=new Set([...j.collections.serverMemberships.values()].filter(e=>e.viewer&&e.userId===j.accountId).map(e=>e.serverId)),a=[...j.collections.servers.values()].filter(e=>n.has(e.id)).sort((e,t)=>(e.position??0)-(t.position??0));t.replace((0,eO.D)(a,e))}},onError:e=>(0,eJ.w)(e,"Failed to leave server",a)})},[D,j,z,t,R,M]),H=(0,n.useCallback)(t=>{if(!t)return;let n=ny({targetServerId:t,activeServerId:d,overlay:"settings",hasActiveOpener:!!m,publishedHref:e.publishedHref});"open-active"===n.kind?m?.():e.push(n.href)},[d,e,m]),Y=(0,n.useCallback)(t=>{if(!t)return;let n=ny({targetServerId:t,activeServerId:d,overlay:"invite",hasActiveOpener:!!h,publishedHref:e.publishedHref});"open-active"===n.kind?h?.():e.push(n.href)},[d,e,h]),Q=(0,n.useCallback)((t,n)=>{((0,nm.f)(n?"channel":"server",n??t),n)?e.push(`/c/channels/${t}/${n}`):e.push(F(t))},[e,F]);return{railProps:{servers:q,homeHref:K,serverHrefs:$,folders:P,activeServerId:f,serversLoading:I.isPending&&0===N.length,view:u,onHome:B,onServerNavigate:U,onCreateServer:V,onLeaveServer:E?W:void 0,onOpenSettings:E?H:void 0,onOpenInvitePopover:E?Y:void 0},navigate:Q}}({navigation:q,queryClient:w,breakpoint:S,view:d,activeServerId:f,projectedView:ea,projectedActiveServerId:er,onOpenActiveServerSettings:v,onOpenActiveServerInvite:y,accountId:k.id}),es=function({router:e,queryClient:t,cancelPendingNavigation:d,view:f,activeServerId:m}){let h,p,g,v,y,b,x,w,k,j=(0,u.F)(),S=(0,J.f)(JSON.stringify(["shell-profile",f,m])),N=(0,a.usePathname)(),E=(0,a.useSearchParams)(),R=(0,ty.N)(E.get("billing")),D="billing"===E.get("settings")||!!R,L=()=>{if(Y(!1),D){let e=new URLSearchParams(E.toString());e.delete("settings"),e.delete("billing"),window.history.replaceState(null,"",`${N}${e.size?`?${e}`:""}${window.location.hash}`)}},z=(0,F.$)(),T=(0,nI.z)(),{friends:q,blocked:K}=T,$="server"===f?m??null:null,{members:U}=(0,nS.h)($),_=(0,nN.f)(),{accept:B}=(0,nE.f)(),V=(0,nP.a)(),W=(0,nP.s)(),[H,Y]=(0,o.f)((0,l.f)(!1)),[G,X]=(0,o.f)((0,l.f)(null)),[Z,ee]=(0,o.f)((0,l.f)(null)),[et,en]=(0,o.f)((0,l.f)(null)),ea=(0,l.f)(null),[er,ei]=(0,o.f)(ea),es=(0,n.useCallback)(e=>{e.release(),ei(t=>t===e?null:t)},[ei]);(0,n.useLayoutEffect)(()=>{if(!er)return;let e=()=>es(er);return er.assertActive.signal.aborted?e():er.assertActive.signal.addEventListener("abort",e,{once:!0}),()=>{er.assertActive.signal.removeEventListener("abort",e),er.release()}},[es,er]);let eo=G?.data.userId,el=!!eo&&eo!==z.id&&void 0!==T.data&&!K.some(e=>e.userId===eo)&&q.some(e=>e.userId===eo),ec=(0,A.$)(eo);(0,i.f)({queryKey:c.f.profile(eo??"__none__"),enabled:!!eo&&eo!==z.id,queryFn:(0,nk.j)(eo??""),staleTime:nk.y});let eu=(0,n.useMemo)(()=>G?{...G,data:{...G.data,contextLabel:nC($,U.find(e=>e.userId===eo)),mutual:ec?.mutualServers??0,identity:ec?.kind==="bot"&&ec.ownerUserId&&ec.ownerHandle?{kind:"bot",ownerProfile:{id:ec.ownerUserId,handle:ec.ownerHandle},ownedByViewer:ec.ownedByViewer??!1}:ec?.kind==="human"||eo===z.id?{kind:"human"}:void 0}}:null,[G,$,U,eo,ec,z.id]),ed=(0,n.useCallback)((e,t,n,a,r)=>{if(r&&r===z.id){let e=$?U.find(e=>e.userId===z.id):void 0;X({data:{userId:z.id,contextLabel:nC($,e),mutual:0,identity:{kind:"human"}},x:t,y:n});return}let i=function(e,t,n){let{name:a,discriminator:r,userId:i}=n;return(i?(e??[]).find(e=>e.userId===i)??(t??[]).find(e=>e.userId===i):void 0)??(r?(e??[]).find(e=>e.name===a&&e.discriminator===r)??(t??[]).find(e=>e.name===a&&e.discriminator===r):void 0)??(e??[]).find(e=>e.name===a)??(t??[]).find(e=>e.name===a)}(U,q,{name:e,discriminator:a,userId:r}),s=i?.userId??r;X({data:{...s?{userId:s}:{name:e,discriminator:a},contextLabel:nC($,i),mutual:0},x:t,y:n})},[z.id,q,U,$,X]),ef=(0,n.useCallback)((e,t,n,a)=>{ed(e,t.clientX,t.clientY,n,a)},[ed]),em=(0,n.useCallback)(e=>{if(!eu)return;let t=(0,nw.r)(e.handle);t&&ed(t.name,eu.x,eu.y,t.discriminator,e.id)},[ed,eu]),eh=(0,n.useCallback)(t=>{d(),e.push(`/c/me/bots?audit=${encodeURIComponent(t)}`),X(null)},[d,e,X]),ep=(0,n.useCallback)(e=>ee(e),[ee]),eg=(0,n.useCallback)(e=>en(e),[en]),ev=async(e,t)=>{let n=S.capture();try{await V.mutateAsync({statusEmoji:e,statusText:t,assertActive:n}),n()}catch(e){(0,eJ.w)(e,"Failed to update status",n)}},ey=async(t,n)=>{let a,r=S.capture();if(r(),!t)return void(0,eM.toast)("Could not find user");d();let i=e.captureIntent?.()??(()=>!0),s=()=>{if(r(),!i())throw new DOMException("Retired profile navigation","AbortError")};try{let e=await _.mutateAsync({userId:t,assertActive:r});s(),a=e.conversation.id}catch(e){(0,eJ.w)(e,"Failed to open DM",s);return}let o=n.trim();if(o){let e=B({assertActive:r,dmId:a,content:o,author:{id:z.id,name:z.name,avatar:z.avatar}});if(!e.accepted)return void(0,eM.toast)("Failed to send message");e.committed}e.push(`/c/me/${a}`)},eb=async e=>{let t=S.capture();try{await V.mutateAsync({...e,assertActive:t}),t()}catch(e){(0,eJ.w)(e,"Failed to save profile",t)}},ex=(h=(0,s.d)(),p=(0,r.D)(h),g=(0,n.useCallback)(()=>{if(!p)throw new DOMException("Missing sign-out account","AbortError");if((0,r.D)(h)!==p)throw new DOMException("Retired sign-out account","AbortError");let e=(0,O.TV)(h);return(0,O.ot)(h,e,void 0),{registry:p,token:e,authenticationGeneration:p.authenticationView.get().generation}},[h,p]),v=(0,Q.f)({meta:{observabilityAction:"account.sign_out"},mutationKey:["community","sign-out"],scope:{id:"account-sign-out"},gcTime:0,mutationFn:async({registry:e,token:t})=>{let n=()=>(0,O.ot)(h,t,void 0);n();let a=e.authenticationView.get().generation,r=new AbortController,i=e.runtime.lifecycle.subscribe(()=>{try{n()}catch{r.abort()}});try{let t=await (0,P.Q)(n,{fetchOptions:{signal:r.signal,onRequest:n,onSuccess:n}});if(t?.error)throw n(),Error(t.error.message||"Failed to log out");(0,M.d)(e),await e.retireDisk().catch(e=>{console.error("Account disk cache retirement failed",e)});let i=e.sessionViewer();return e.authenticationView.get().active&&e.authenticationView.get().generation===a&&(null==i||i===e.accountId)}catch(e){throw n(),e}finally{i.unsubscribe()}}}),y=(0,n.useCallback)(e=>{if(!e)return;let t=e=>{let t=e.registry.authenticationView.get(),n=e.registry.sessionViewer();return(0,r.D)(h)===e.registry&&t.active&&t.generation===e.authenticationGeneration&&(null==n||n===e.registry.accountId)},n=e=>{try{return(0,O.ot)(h,e.token,void 0),!0}catch{return!1}};return{onSuccess:(n,a,r,i)=>{n&&t(a)&&e.onSuccess?.(n,void 0,r,i)},onError:(t,a,r,i)=>{n(a)&&e.onError?.(t,void 0,r,i)},onSettled:(a,r,i,s,o)=>{(r?n(i):a&&t(i))&&e.onSettled?.(a,r,void 0,s,o)}}},[h]),b=v.mutate,x=v.mutateAsync,w=(0,n.useCallback)((e,t)=>b(g(),y(t)),[b,g,y]),k=(0,n.useCallback)((e,t)=>x(g(),y(t)),[x,g,y]),{...v,mutate:w,mutateAsync:k}),ew=async()=>{let e=(0,O.TV)(t);try{await ex.mutateAsync()&&globalThis.location.replace("/sign-in")}catch(n){(0,eJ.w)(n,"Failed to log out",()=>(0,O.ot)(t,e,void 0))}},ek=async()=>{d(),j.ui.actions.reset(),j.ws.actions.reset(),j.messageStream.actions.resetAll(),(0,I.z)(t),(0,C.m)(t),t.clear(),Y(!1)},ej={onClose:L,initialTab:D?"billing":"profile",billingReturn:R,userId:z.id,userName:z.name,userEmail:z.email,aboutMe:z.aboutMe??"",avatar:z.avatar,statusEmoji:z.statusEmoji,statusText:z.statusText,onUploadAvatar:()=>{let e=S.capture(),t=document.createElement("input");t.type="file",t.accept="image/png,image/jpeg,image/webp",t.onchange=()=>{try{e()}catch{return}let n=t.files?.[0];if(!n)return;let a=(0,nj.b)(n);if(!a.ok)return void(0,eM.toast)(a.error);let r=URL.createObjectURL(n),i=!1;ea.get()?.release(),ei({src:r,fileName:n.name,assertActive:e,release:()=>{i||(i=!0,URL.revokeObjectURL(r))}})},t.click()},onSave:eb,onLogout:ew,onAccountDeleted:ek},eC=null;return er&&(eC={imageSrc:er.src,originalFileName:er.fileName,onCropped:e=>{let t=er.assertActive;if(ea.get()!==er)return void er.release();try{t()}catch{es(er);return}W.mutate({file:e,assertActive:t},{onSuccess:()=>{try{t()}catch{return}(0,eM.toast)("Avatar updated")},onError:e=>(0,eJ.w)(e,"Failed to upload avatar",t)}),es(er)},onCancel:()=>{es(er)}}),{currentUser:z,openProfile:ef,openOwnerProfile:em,openBotAudit:eh,previewImage:ep,previewAttachment:eg,profile:eu,canMessage:el,closeProfile:()=>X(null),profileMessage:ey,updateOwnStatus:ev,preview:Z,closePreview:()=>ee(null),attachmentPreview:et,onAttachmentPreviewOpenChange:e=>{e||en(null)},editingProfile:H||D,openUserSettings:()=>Y(!0),onUserSettingsOpenChange:e=>{e||L()},userSettingsProps:ej,pendingAvatarCrop:eC}}({router:q,queryClient:w,cancelPendingNavigation:q.cancelPendingNavigation,view:d,activeServerId:f}),eo=function({router:e,queryClient:t,cancelPendingNavigation:a,publishedHref:r,navigationPending:i,pendingHref:s,viewerId:c,accessEpoch:u}){let d=(0,n.useCallback)(t=>{e.pushImmediate?e.pushImmediate(t):e.push(t)},[e]),f=(0,nM.b)(),m=f.servers,h=f.dms,p=f.mentions,g=f.isLoading,[v,y]=(0,o.f)((0,l.f)(!1)),[b,x]=(0,o.f)((0,l.f)("unreads")),w=(0,n.useRef)({unreads:0,mentions:0,marked:0}),k=(0,nM.D)(v),{mutate:j}=(0,nK.Y)(),C=(0,nT.b)(),I=(0,nT.H)(),S=(0,nq.t)(),P=(0,nq.e)(),E=function({queryClient:e,publishedHref:t,navigationPending:a,pendingHref:r}){let i,s=(0,l.f)(!1),[c,u]=(0,o.f)(s),d=((i=nD.get(e))||(i={value:(0,nO.f)({lease:null,nextEpoch:0})},nD.set(e,i)),i),f=(0,N.f)(d.value,e=>e.lease),m=f?.target??null,h=(0,l.f)(t),p=(0,n.useCallback)(e=>{d.value.get().lease?.epoch!==e.epoch||(nL(d,{...e,phase:"committed"}),(0,nR.z)(e.ticket))},[d]),g=(0,n.useCallback)((e,t=!1)=>{let n=d.value.get().lease;return!!n&&n.epoch===e&&((0,nR.w)(n.ticket),nL(d,null),t&&u(n.previousOpen),!0)},[d,u]),v=(0,n.useCallback)((n,a)=>{let r=d.value.get().lease;r&&(0,nR.w)(r.ticket);let i=(d.value.setState(e=>({...e,nextEpoch:e.nextEpoch+1})),d.value.get().nextEpoch),o=s.get(),l=(0,nR.x)(e,i,n,e=>{let t=d.value.get().lease;t&&t.epoch===e.epoch&&nL(d,null)});return nL(d,{epoch:i,target:n,destinationHref:a,originHref:t,previousOpen:o,phase:"submitting",submitted:!1,navigationObserved:!1,ticket:l}),u(!1),i},[d,s,e,t,u]),y=(0,n.useCallback)(e=>{let n=d.value.get().lease;if(!n||n.epoch!==e)return!1;let a={...n,submitted:!0};return nL(d,a),nz(t,n.destinationHref)&&p(a),!0},[p,t,d]),b=(0,n.useCallback)(()=>{let e=d.value.get().lease;e&&(0,nR.w)(e.ticket),nL(d,null);let t=s.get();return u(!1),t},[d,s,u]),x=(0,n.useCallback)(e=>{u(e)},[u]),w=(0,n.useCallback)(e=>!!e&&!!m&&m.identity===e.identity&&m.fingerprint===e.fingerprint,[m]),k=(0,n.useCallback)(e=>d.value.get().lease?.epoch===e,[d]);return(0,n.useEffect)(()=>{let e=d.value.get().lease;if(e&&e.submitted&&"submitting"===e.phase){if(nz(t,e.destinationHref))return void p(e);if(a&&nz(r,e.destinationHref)){e.navigationObserved||nL(d,{...e,navigationObserved:!0});return}(e.navigationObserved||t!==e.originHref||a&&null!==r)&&g(e.epoch)}},[p,a,r,f,t,g,d]),(0,n.useEffect)(()=>{let e=h.get();h.set(t),!nz(e,t)&&s.get()&&u(!1)},[t,h,s,u]),{open:c,projectionTarget:m,onOpenChange:x,beginProjection:v,markProjectionSubmitted:y,rollbackProjection:g,closeWithoutProjection:b,isProjected:w,isLatestProjection:k}}({queryClient:t,publishedHref:r,navigationPending:i,pendingHref:s}),M=(0,n.useCallback)(e=>{x(e),"marked"===e&&y(!0)},[x,y]),A=(0,n.useCallback)(e=>w.current[e],[]),R=(0,n.useCallback)((e,t)=>{w.current[e]=t},[]),D=(0,n.useCallback)(e=>S.mutateAsync({friendshipId:e}),[S]),L=(0,n.useCallback)(e=>P.mutateAsync({friendshipId:e}),[P]),z=(0,n$.f)({rows:f.friendRequests,onAccept:D,onReject:L,surface:"inbox"}),T=(0,n.useCallback)((e,n,r,i,s)=>{let o=E.beginProjection(e,n);a(),(0,nF.W)(t);let l=nH(t,{...r,href:n,viewerId:c},u),f=n;try{f=i?.()??n,d(f),E.markProjectionSubmitted(o)&&s?.()}catch(n){(0,nW.n)(t,l);let e=new URLSearchParams(f.split("?")[1]??"").get("inboxThreadOpener");throw e&&(0,nR.m)(t,e),E.isLatestProjection(o)&&(a(),E.rollbackProjection(o,!0)),n}},[u,a,E,d,t,c]),q=(0,n.useCallback)((e,n,r)=>{let i=(0,eA.O)(e.serverId,n.channelId),s=r?(0,nR._)(e,n):null;if(!s){let r=E.closeWithoutProjection();a(),(0,nF.W)(t);let s=nH(t,{href:i,viewerId:c,channelId:n.channelId,serverId:e.serverId,scopeKind:"channel",expectedSurfaceKind:"forum"===n.type?"forum":"channel"},u);try{d(i)}catch(e){throw(0,nW.n)(t,s),a(),E.onOpenChange(r),e}return}T(s,i,{channelId:n.channelId,serverId:e.serverId,scopeKind:"channel",expectedSurfaceKind:"forum"===n.type?"forum":"channel"})},[u,a,E,d,T,t,c]),K=(0,n.useCallback)((e,n,a)=>{let r=(0,nR.V)(e,n,a),i=(0,eA.O)(e.serverId,a.channelId);T(r,i,{channelId:a.channelId,serverId:e.serverId,scopeKind:"channel",expectedSurfaceKind:"thread"},()=>a.openerMessageId&&!0===a.openerUnread&&void 0!==a.openerSeq?(0,nF.x)(t,{serverId:e.serverId,parentChannelId:a.parentChannelId??n.channelId,childChannelId:a.channelId,openerMessageId:a.openerMessageId,openerSeq:a.openerSeq}):i)},[T,t]),$=(0,n.useCallback)(e=>{let n=E.closeWithoutProjection();a(),(0,nF.W)(t);let r=null!=e.m.seq?`?seq=${e.m.seq}`:"",i=e.serverId?`${(0,eA.O)(e.serverId,e.channelId)}${r}`:`/c/me/${e.channelId}${r}`,s=nH(t,{href:i,viewerId:c,channelId:e.channelId,...e.serverId?{serverId:e.serverId}:{},scopeKind:e.serverId?"channel":"dm",...e.serverId?{anchorMessageId:e.m.id}:{},...!e.serverId?{expectedSurfaceKind:"dm"}:{}},u);try{d(i)}catch(e){throw(0,nW.n)(t,s),a(),E.onOpenChange(n),e}},[u,a,E,d,t,c]),F=(0,n.useCallback)(e=>{let n=e.channelId;T((0,nR.d)(e),`/c/me/${n}`,{channelId:n,scopeKind:"dm",expectedSurfaceKind:"dm"},()=>{let n={id:e.channelId,userId:e.otherUserId,name:e.otherUserName,discriminator:e.otherUserDiscriminator,avatar:e.otherUserAvatar,avatarVersion:e.otherUserAvatarVersion,status:"offline",preview:"",activityAt:e.lastMessageAt,unread:!1};(0,O.R8)(t,n)},()=>{(0,nA.f)(t,null,n).catch(()=>void 0)})},[T,t]),U=(0,n.useCallback)(e=>{let t=(0,nR.C)(e);t&&e.serverId&&e.channelId&&T(t,`${(0,eA.O)(e.serverId,e.channelId)}?msg=${e.m.id}`,{channelId:e.channelId,serverId:e.serverId,scopeKind:"channel",anchorMessageId:e.m.id})},[T]),_=(0,n.useCallback)(()=>{let e=E.closeWithoutProjection();a();try{d("/c/me/friends?tab=new")}catch(t){throw a(),E.onOpenChange(e),t}},[a,E,d]),B={friendRequests:z.items,unreads:m,unreadDms:h,mentions:p,marked:k.marked,markedLoading:k.isLoading,loading:g,attentionError:f.isInitialError,onRetryAttention:()=>{f.refetch()},hasProjectedUnreads:f.hasUnread,hasProjectedMentions:f.hasMention,onOpenChannel:q,onOpenThread:K,onOpenDm:F,onOpenMention:U,onOpenMarked:$,onOpenFriendRequests:_,onAcceptFriendRequest:e=>{z.act(e,"accept")},onRejectFriendRequest:e=>{z.act(e,"reject")},onRetryFriendRequest:e=>{z.retry(e)},activeTab:b,onActiveTabChange:M,onMarkedTabSelected:()=>y(!0),getScrollOffset:A,onScrollOffsetChange:R,onMarkAllRead:()=>{C.mutate()},onDeleteMention:e=>I.mutate({mentionId:e}),onUnmark:e=>j({messageId:e})},V=f.exactAttentionCount;return{popoverProps:B,unreadCount:V,unreadCountPartial:!1,hasUnread:V>0,open:E.open,onOpenChange:E.onOpenChange}}({router:q,queryClient:w,cancelPendingNavigation:q.cancelPendingNavigation,publishedHref:q.publishedHref,navigationPending:q.navigationPending,pendingHref:q.pendingHref,viewerId:k.id,accessEpoch:j}),[el,ec]=(0,o.f)((0,l.f)(nr)),eu=(0,n.useCallback)(e=>{ec(t=>(function(e,t){switch(t.type){case"update.sync":{if(e.update)return nc(e,t.eligibleMachineIds);if(0===t.eligibleMachineIds.length)return e;let n=t.collapsed||"none"!==e.active;return{active:n?e.active:"update",update:{phase:n?"collapsedBadge":"expanded",targetMachineIds:ni(t.eligibleMachineIds),acceptedMachineIds:[],failedMachineIds:[],pendingMachineIds:[]}}}case"update.eligibility":return nc(e,t.eligibleMachineIds);case"update.clear":return{active:"update"===e.active?"none":e.active,update:null};case"update.open":if(!e.update)return e;return{active:"update",update:{...e.update,phase:"collapsedBadge"===e.update.phase?"expanded":e.update.phase}};case"update.collapse":if(!e.update)return"update"===e.active?{...e,active:"none"}:e;return{active:"update"===e.active?"none":e.active,update:{...e.update,phase:"expanded"===e.update.phase?"collapsedBadge":e.update.phase}};case"update.dispatch":{if(!e.update)return e;let n=new Set(t.machineIds);return{active:"update",update:{...e.update,phase:"updating",failedMachineIds:ns(e.update.failedMachineIds,n),pendingMachineIds:ni([...e.update.pendingMachineIds,...t.machineIds])}}}case"update.settle":{if(!e.update)return e;let n=new Set(e.update.targetMachineIds),a=t.acceptedMachineIds.filter(e=>n.has(e)),r=t.failedMachineIds.filter(e=>n.has(e)),i=new Set(a),s=new Set(r),o=new Set([...i,...s]),l=ni([...ns(e.update.acceptedMachineIds,s),...a]),c=ni([...ns(e.update.failedMachineIds,i),...r]);return{active:e.active,update:{...e.update,phase:c.length>0?"retry":"updating",acceptedMachineIds:l,failedMachineIds:c,pendingMachineIds:ns(e.update.pendingMachineIds,o)}}}case"extension.open":return{active:t.extension,update:e.update?.phase==="expanded"?{...e.update,phase:"collapsedBadge"}:e.update};case"extension.close":if(t.extension&&e.active!==t.extension)return e;return{active:"none",update:e.update?.phase==="expanded"?{...e.update,phase:"collapsedBadge"}:e.update}}})(t,e))},[ec]),ed=function({userId:e,extensionState:t,dispatch:a,latestDaemonVersion:r="0.1.51",requestUpdate:i=n2}){let s=(0,X.f)(),o=(0,n.useRef)(null);(0,n.useLayoutEffect)(()=>()=>{o.current=null},[s.registry,e,r]);let l=(0,ey.t)(),c=(0,n.useMemo)(()=>{var e;return r?(e=l.machines,(0,nJ.n)(r)?e.filter(e=>{let t=e.daemonVersion;return!!(0,n0.d)(e.status)&&!!t&&!!(0,nJ.n)(t)&&(0,nJ.T)(t,nZ.W)&&!(0,nJ.T)(t,r)}):[]):[]},[r,l.machines]),u=(0,n.useMemo)(()=>c.map(e=>e.id),[c]);(0,n.useLayoutEffect)(()=>{let e=new Set(u);for(let t of o.current?.machineIds??[])e.has(t)||o.current?.machineIds.delete(t)},[u]);let d=(0,n.useMemo)(()=>({registry:s.registry,userId:e,latestDaemonVersion:r}),[s.registry,e,r]),f=(0,n.useRef)(d);(0,n.useEffect)(()=>{f.current!==d&&(f.current=d,a({type:"update.clear"}))},[a,d]);let m=t.update;(0,n.useEffect)(()=>{if(r&&(0,nJ.n)(r)&&l.isSuccess){if(0===u.length){n5(e,r,!1),a({type:"update.clear"});return}if(!m)return void a({type:"update.sync",collapsed:function(e,t){try{return"1"===window.localStorage.getItem(n4(e,t))}catch{return!1}}(e,r),eligibleMachineIds:u});a({type:"update.eligibility",eligibleMachineIds:u})}},[a,u,r,l.isSuccess,m,e]);let h=(0,n.useCallback)(()=>{r&&t.update&&(n5(e,r,!0),a({type:"update.collapse"}))},[a,t.update,r,e]),p=(0,n.useCallback)(()=>{r&&t.update&&(n5(e,r,!1),a({type:"update.open"}))},[a,t.update,r,e]),g=(0,n.useCallback)(async()=>{let e=t.update;if(!e||e.pendingMachineIds.length>0)return;let n=function(e,t){let n=new Set(t);if("retry"===e.phase)return e.failedMachineIds.filter(e=>n.has(e));let a=new Set(e.acceptedMachineIds),r=new Set(e.pendingMachineIds);return e.targetMachineIds.filter(e=>n.has(e)&&!a.has(e)&&!r.has(e))}(e,u);if(0===n.length)return;let r=s.begin().token,l=s.registry.authenticationView.get();s.assertOwner(r);let c={machineIds:new Set(n)};o.current=c,a({type:"update.dispatch",machineIds:n});let d=await n3(n,i);try{s.assertOwner(r)}catch{return}let f=s.registry.authenticationView.get();if(!f.active||f.generation!==l.generation||o.current!==c)return;let m=c.machineIds;for(let e of(d.acceptedMachineIds=d.acceptedMachineIds.filter(e=>m.has(e)),d.failedMachineIds=d.failedMachineIds.filter(e=>m.has(e)),d.failedMachineIds))n1.f.warn("daemon update request failed",{machineId:e});a({type:"update.settle",...d})},[a,u,t.update,i,s]);return{eligibleMachines:c,eligibleMachineIds:u,update:m,collapse:h,open:p,request:g}}({userId:k.id,extensionState:el,dispatch:eu}),ef=(0,n.useCallback)(e=>{if(!e){eo.onOpenChange(!1),eu({type:"extension.close",extension:"inbox"});return}"profile"===el.active&&es.closeProfile(),"update"===el.active&&ed.collapse(),eo.onOpenChange(!0),eu({type:"extension.open",extension:"inbox"})},[ed,eu,eo,es,el.active]),[em,eh]=(0,o.f)((0,l.f)(null)),ep=(0,n.useCallback)(()=>{if(eh(null),"mobile"!==S||"detail"!==L.surface&&"detail"!==en.surface)return void ef(!0);let e={viewerId:k.id,isCurrent:q.captureIntent({nextCommitHref:"/c/me"})};q.push("/c/me"),eh(e)},[S,en.surface,L.surface,k.id,q,ef,eh]);(0,n.useEffect)(()=>{!em||(em.viewerId===k.id&&em.isCurrent()?q.navigationPending||null!==q.pendingHref||"/c/me"!==q.publishedHref||"/c/me"!==L.href||"list"!==en.surface||(eh(null),ef(!0)):eh(null))},[en.surface,L.href,k.id,em,q.navigationPending,q.pendingHref,q.publishedHref,ef,eh]),(0,eU.m)(k.id,L,q,x);let eg=(0,n.useCallback)((e,t,n,a)=>{if("profile"===el.active){es.closeProfile(),eu({type:"extension.close",extension:"profile"});return}"inbox"===el.active&&eo.onOpenChange(!1),"update"===el.active&&ed.collapse(),es.openProfile(e,t,n,a),eu({type:"extension.open",extension:"profile"})},[ed,eu,eo,es,el.active]),ev=(0,n.useCallback)(()=>{"inbox"===el.active&&eo.onOpenChange(!1),"profile"===el.active&&es.closeProfile(),ed.open()},[ed,eo,es,el.active]),eb=(0,n.useCallback)(()=>{"inbox"===el.active&&eo.onOpenChange(!1),"profile"===el.active&&es.closeProfile(),"update"===el.active&&ed.collapse(),eu({type:"extension.close",extension:el.active})},[ed,eu,eo,es,el.active]);(0,n.useEffect)(()=>{"mobile"===S&&"detail"===en.surface&&"none"!==el.active&&eb()},[S,en.surface,eb,el.active]);let ex=(0,n.useCallback)(()=>("mobile"!==S||"detail"!==en.surface)&&"none"!==el.active&&(eb(),!0),[S,en.surface,eb,el.active]),ew=(0,n.useCallback)(()=>{$.parentPath&&q.replace($.parentPath)},[q,$.parentPath]);return!function({dismissShellOverlay:e,parentPath:t,replacePath:a}){(0,n.useEffect)(()=>{let n=n=>{!n.cancelable||(0!==document.querySelectorAll('[data-slot="dialog-content"],[data-slot="alert-dialog-content"],[data-slot="sheet-content"]').length&&(document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",code:"Escape",bubbles:!0,cancelable:!0})),1)||e()?n.preventDefault():t&&(n.preventDefault(),a(t)))};return window.addEventListener(n7,n),()=>window.removeEventListener(n7,n)},[e,t,a])}({dismissShellOverlay:ex,parentPath:$.parentPath,replacePath:K}),(0,n.useEffect)(()=>{"inbox"!==el.active||eo.open||eu({type:"extension.close",extension:"inbox"})},[eu,eo.open,el.active]),(0,n.useEffect)(()=>{"profile"!==el.active||es.profile?.data.userId!==k.id&&eu({type:"extension.close",extension:"profile"})},[k.id,eu,es.profile,el.active]),(0,n.useEffect)(()=>{"mobile"===S&&E?.status==="active"&&"server"===E.stage&&"detail"===$.surface&&$.parentPath&&K($.parentPath)},[S,E,K,$.parentPath,$.surface]),(0,n.useEffect)(()=>{(0,u.A)(w).ui.actions.registerUiHandlers({previewImage:es.previewImage,previewAttachment:es.previewAttachment,openProfile:es.openProfile,goBackMobile:ew,navigatePath:q.push,replacePath:q.replace,navigate:ei.navigate,cancelPendingNavigation:q.cancelPendingNavigation})},[ew,es.openProfile,es.previewAttachment,es.previewImage,ei.navigate,q.cancelPendingNavigation,q.push,q.replace,w]),(0,t.jsx)(e_.W,{value:{breakpoint:S,frame:L,navigation:q,ownerDeleteRouteScope:b,openInbox:ep,notificationConsumer:x},children:(0,t.jsx)(nf,{breakpoint:S,checkpoint:en,sidebar:h,extraDialogs:g,rail:ei,profile:es,inbox:eo,userBarExtension:el,daemonUpdate:ed,onUserBarInboxOpenChange:ef,onUserBarOpenProfile:eg,onUserBarOpenUpdate:ev,dismissUserBarExtension:eb,children:p})})}function n6({sidebar:e,children:r}){let i=(0,a.useSelectedLayoutSegments)(),o=i.length?`/c/${i.join("/")}`:"/c",l=(0,eA.B)(o),c=(0,s.d)(),d=(0,F.$)(),f=(0,n.useMemo)(()=>l?{serverId:l,token:(0,eO.C)(c)}:void 0,[c,l]),m=(0,n.useCallback)(()=>e,[e]);return(0,n.useLayoutEffect)(()=>{(0,u.A)(c).ui.actions.setCurrentServerId(l)},[c,l]),(0,t.jsx)(n9,{view:l?"server":"dm",activeServerId:l??void 0,frameHref:o,sidebar:m,ownerDeleteRouteScope:f,children:r},d.id)}function ae({redirectTo:e}={}){let t=(0,a.useRouter)(),r=(0,eF.$)(),i=(0,A.O)();return(0,n.useEffect)(()=>{if("unknown"===r)return;let n=document.cookie.match(/(?:^|; )is_sign_in=([^;]*)/);n&&(document.cookie="is_sign_in=; max-age=0; path=/",(0,ef.r)({event:"sign_in_success",method:n[1]}));let a=document.cookie.match(/(?:^|; )is_new_signup=([^;]*)/);if(a&&(document.cookie="is_new_signup=; max-age=0; path=/",(0,ef.r)({event:"sign_up",method:a[1]}),"mobile"!==r&&e)){if(e.startsWith("/c/")){if(!i?.runtime.lifecycle.get().active)return;(0,ee.$)(i.runtime),t.replace(e);return}window.location.replace(e)}},[r,e,t,i]),null}var at=e.i(181402),an=e.i(824863),aa=e.i(88723),ar=e.i(395207);let ai={isDesktopTauri:()=>(0,an.m)()&&(0,an.y)(),invoke:an.Y,postCancel:e=>fetch("/api/auth/native/cancel",{method:"POST",credentials:"same-origin",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(15e3)})};async function as(e=ai){if(!e.isDesktopTauri())return;let t=ar.f.nullable().parse(await e.invoke("native_oauth_snapshot"));if(!t)return;let n=aa.f.nullable().parse(await e.invoke("native_oauth_cancel",{attemptId:t.attemptId}));n&&await e.postCancel(n).catch(()=>{})}function ao(){return(0,n.useEffect)(()=>{as().catch(()=>{})},[]),null}var al=e.i(455393);e.s(["CommunityLayoutClient",0,function({children:e,sidebar:r,currentUser:i}){let s=(0,a.useRouter)(),o=(0,a.usePathname)(),l="public-invite"===(0,eA.P)(o).route;return((0,n.useEffect)(()=>{l||i||s.replace("/sign-in")},[i,l,s]),(0,n.useEffect)(()=>{i?(0,al.j)(i.id,o):(0,al.k)()},[i,o]),l)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ae,{}),e]}):i?(0,t.jsxs)(at.N,{children:[(0,t.jsx)(ao,{}),(0,t.jsxs)(eT,{currentUser:i,children:[(0,t.jsx)(ae,{redirectTo:"/c/me/machines"}),(0,t.jsx)(n6,{sidebar:r,children:e})]})]}):(0,t.jsx)(ez.f,{pathname:o})}],200069)},401462,e=>{var t=e.i(895231),n=e.i(18745),a=e.i(215932);e.s(["CommunitySessionFallback",0,function(){let e=(0,n.usePathname)();return(0,t.jsx)(a.f,{pathname:e})}])},109762,527668,e=>{var t=e.i(895231),n=e.i(315116),a=e.i(974802),r=e.i(186339),i=e.i(255334),s=e.i(996718),o=e.i(381153);let l="col-start-1 row-start-2 flex min-w-0 items-center gap-1 px-2 thin-scrollbar sm:row-span-2 sm:row-start-1 sm:flex-col sm:items-stretch sm:gap-2 sm:overflow-y-auto sm:p-4",c="h-11 min-w-0 flex-1 flex-row justify-start gap-1 overflow-hidden p-0 group-data-horizontal/tabs:h-11 sm:h-auto sm:w-full sm:flex-none sm:flex-col",u="size-11 justify-center gap-2 px-0 sm:h-9 sm:w-full sm:justify-start sm:px-2",d="sr-only sm:not-sr-only sm:min-w-0 sm:truncate sm:px-2 sm:pt-1 sm:text-xs sm:font-medium sm:text-muted-foreground",f="flex shrink-0 gap-1 sm:mt-auto sm:w-full sm:flex-col sm:border-t sm:border-border/60 sm:pt-2";e.s(["n",0,"size-11 shrink-0 justify-center text-destructive hover:text-destructive sm:h-9 sm:w-full sm:justify-start","M",0,l,"o",0,f,"R",0,d,"j",0,c,"b",0,u],527668),e.s(["I",0,function({value:e,onValueChange:m,label:h,title:p,tabs:g,onClose:v,navFooter:y,disabled:b=!1,children:x}){let w=(0,s.$)();return(0,t.jsxs)(i.i,{orientation:"mobile"===w?"horizontal":"vertical",value:e,onValueChange:e=>m(e),className:`grid min-h-0 w-full flex-1 gap-0 ${a.default.shell}`,"data-testid":o.f.settingsShell,children:[(0,t.jsxs)("header",{className:"col-start-1 row-start-1 flex h-16 min-w-0 items-center px-4 sm:col-start-2 sm:px-8",children:[(0,t.jsx)("h1",{className:"min-w-0 flex-1 truncate text-lg font-medium tracking-tight",children:p}),(0,t.jsx)(r.K,{variant:"ghost",size:"icon-sm",className:"size-11 sm:size-8",onClick:v,disabled:b,"aria-label":"Close settings","data-testid":o.f.settingsClose,children:(0,t.jsx)(n.X,{className:"size-4"})})]}),(0,t.jsxs)("nav",{className:l,style:{background:"var(--d-rail)"},"data-testid":o.f.settingsNav,children:[(0,t.jsx)("div",{className:d,"data-testid":o.f.settingsLabel,children:h}),(0,t.jsx)(i.U,{variant:"line",className:c,children:g.map(({value:e,label:n,icon:a})=>(0,t.jsxs)(i.k,{value:e,disabled:b,className:u,"data-testid":o.f.settingsTab(e),children:[(0,t.jsx)(a,{className:"size-4"}),(0,t.jsx)("span",{className:"sr-only whitespace-nowrap sm:not-sr-only",children:n})]},e))}),y?(0,t.jsx)("div",{className:f,children:y}):null]}),(0,t.jsx)("div",{className:"col-start-1 row-start-3 min-h-0 min-w-0 overflow-y-auto rounded-tl-xl bg-background px-4 pt-6 pb-4 thin-scrollbar sm:col-start-2 sm:row-start-2 sm:p-8 sm:pt-4","data-testid":o.f.settingsContent,children:x})]})},"s",0,function(e){return(0,t.jsx)(i.S,{...e,keepMounted:!0})}],109762)},563932,e=>{e.i(341604),e.s([])},215932,52622,e=>{var t=e.i(895231),n=e.i(8497),a=e.i(250569),r=e.i(708884),i=e.i(996718),s=e.i(622435),o=e.i(381153),l=e.i(800989),c=e.i(742547),u=e.i(727854),d=e.i(551970),f=e.i(888917),m=e.i(613349),h=e.i(259728),p=e.i(190209);let g=()=>()=>{},v="(min-width: 640px)",y={getItem:e=>"u"<typeof localStorage?null:localStorage.getItem(e),setItem:(e,t)=>{"u">typeof localStorage&&localStorage.setItem(e,t)}},b=1+1/64;function x(e){let t=document.documentElement;"number"==typeof e&&(t.style.setProperty(h.t,`${e}px`),t.style.setProperty(h.S,`${(0,h.s)(e)}px`)),t.setAttribute(h.I,"")}function w(){document.documentElement.removeAttribute(h.I)}function k({breakpoint:e,surface:n,rail:a,sidebar:i,main:s,userBar:o,overlays:l,busy:j,label:C,routeKind:I,testId:S,preserveHiddenMobileModules:N=!1}){let{defaultLayout:P,onLayoutChanged:E}=(0,d.G)({id:"community-shell",onlySaveAfterUserInteractions:!0,storage:y}),M=(0,c.useSyncExternalStore)(g,()=>!0,()=>!1),A=M?P?.sidebar:void 0,O=(0,c.useRef)(null),R=(0,c.useRef)(null),D=(0,c.useRef)(null),L=(0,c.useRef)(null),z=(0,c.useRef)(null),T=(0,c.useRef)(e),q=(0,c.useRef)(e),K=(0,c.useRef)(void 0),$=(0,c.useRef)(null),F=(0,c.useRef)(!1);(0,c.useInsertionEffect)(()=>{if(q.current=e,"mobile"===e&&null!==$.current){let{animationFrame:e}=$.current;null!==e&&cancelAnimationFrame(e),$.current=null,w()}"mobile"===T.current&&"desktop"===e&&null===$.current&&($.current={target:(0,h.c)(K.current,A),animationFrame:null},x($.current.target))},[e,A]);let U=(0,c.useCallback)(e=>{z.current?.style.setProperty("--community-desktop-user-bar-width",`${(0,h.s)(e)}px`)},[]),_=(0,c.useCallback)(e=>{if("desktop"!==q.current||null!==$.current)return;let t=O.current?.getBoundingClientRect().width,n=t&&t>0?t:e.inPixels;K.current=n,U(n)},[U]),B=(0,c.useCallback)(()=>{let e=D.current;e&&(e.resize(h.U),queueMicrotask(()=>{let e=R.current?.getLayout();e&&0!==Object.keys(e).length&&E(e,{isUserInteraction:!0})}))},[E]);(0,c.useLayoutEffect)(()=>{let e=e=>{let t=L.current;if(!t)return;let n=t.getBoundingClientRect();e.clientX>=n.left-10&&e.clientX<=n.right+10&&e.clientY>=n.top&&e.clientY<=n.bottom&&B()};return document.addEventListener("dblclick",e,!0),()=>document.removeEventListener("dblclick",e,!0)},[B]),(0,c.useLayoutEffect)(()=>{if(void 0===P||F.current)return;let t=R.current;if(!t)return;let n=document.documentElement.hasAttribute(h.I)&&window.matchMedia(v).matches?O.current?.getBoundingClientRect().width:void 0,a="desktop"===e?O.current?.closest('[data-slot="resizable-panel-group"]')?.getBoundingClientRect().width:void 0,r=a&&a>h.h?Math.min(h.a,Math.max(h.V,P.sidebar/100*(a-h.h))):n;F.current=!0,t.setLayout(P),r&&r>0?(D.current?.resize(r),K.current=r,U(r)):z.current?.style.setProperty("--community-desktop-user-bar-width",(0,h.n)(P.sidebar))},[e,P,U]),(0,c.useLayoutEffect)(()=>{!j&&void 0!==P&&F.current&&null===$.current&&window.matchMedia(v).matches&&requestAnimationFrame(()=>{w()})},[e,j,P]),(0,c.useLayoutEffect)(()=>{T.current=e;let t=$.current;if("desktop"!==e||null===t)return;let n=D.current;if(!n)return;let a=!1,r=()=>{if(a||$.current!==t||"desktop"!==q.current)return;let e=O.current?.closest('[data-slot="resizable-panel-group"]')?.getBoundingClientRect().width,i=e&&e>h.h?e-h.h:void 0,s="string"==typeof t.target?Number.parseFloat(t.target):i?t.target/i*100:void 0;(0,u.flushSync)(()=>{if(w(),void 0!==s){let e=R.current,t=Object.keys(e?.getLayout()??{});for(let n of 2===t.length?[t,t.toReversed()]:[["main","sidebar"],["sidebar","main"]]){let t=Object.fromEntries(n.map(e=>[e,"sidebar"===e?s:100-s])),a=e?.setLayout(t);if(a?.sidebar!==void 0&&.01>=Math.abs(a.sidebar-s))break}}else n.resize(t.target)});let o=n.getSize(),l="number"==typeof t.target?t.target:i&&void 0!==s?Math.min(h.a,Math.max(h.V,s/100*i)):void 0,c=R.current?.getLayout()?.sidebar??o.asPercentage;if(!(void 0===s?void 0!==l&&Math.abs(o.inPixels-l)<=b:.01>=Math.abs(c-s))){x(t.target),t.animationFrame=requestAnimationFrame(r);return}let d=O.current?.getBoundingClientRect().width,f=d&&d>0?d:o.inPixels;if(void 0!==l&&Math.abs(f-l)>b){x(t.target),t.animationFrame=requestAnimationFrame(r);return}K.current=f,U(f),$.current=null};return queueMicrotask(r),()=>{a=!0,null!==t.animationFrame&&cancelAnimationFrame(t.animationFrame),$.current===t&&($.current=null,w())}},[e,P,U]);let V="desktop"===e,W="mobile"===e&&"list"===n,H="mobile"===e&&"detail"===n,Y="unknown"===e,Q=Y&&"detail"===n,G=W||Y&&"list"===n,X=H||Q,J=H||Q,Z=W||Y&&"list"===n,ee=V||W||Y||N,et={"--community-desktop-user-bar-width":(0,h.n)(A),marginLeft:-h.i};return(0,t.jsxs)(p.f,{"aria-busy":j?"true":void 0,"aria-label":C,"data-community-route-kind":I,"data-testid":S,"data-slot":"community-shell-root",children:[(!H||N)&&(0,t.jsx)("div",{inert:H,"aria-hidden":H||void 0,className:(0,m.c)("flex min-h-0",Q&&"hidden sm:contents",H&&N&&"hidden"),children:a}),(0,t.jsxs)("div",{className:(0,m.c)("relative flex min-h-0 min-w-0 flex-1 flex-col",!H&&!Q&&"pt-2",Q&&"pt-0 sm:pt-2"),children:[(0,t.jsx)(r.K,{"data-slot":"community-app-surface",className:(0,m.c)("rounded-tl-xl rounded-tr-none rounded-br-none rounded-bl-none ring-0 border-l border-t border-border/40 shadow-none",H&&"rounded-none border-0 bg-background shadow-none ring-0",Q&&"max-sm:rounded-none max-sm:border-0 max-sm:bg-background max-sm:shadow-none max-sm:ring-0"),children:(0,t.jsxs)(f.C,{id:"community-shell",groupRef:R,orientation:"horizontal",disabled:!V,className:(0,m.c)("min-h-0 flex-1",!V&&["max-sm:*:data-[mobile-active=true]:flex-1!","max-sm:*:data-[mobile-hidden=true]:flex-none!","max-sm:*:data-[mobile-hidden=true]:w-0!","max-sm:*:data-[mobile-hidden=true]:min-w-0!","max-sm:*:data-[mobile-hidden=true]:max-w-0!","max-sm:*:data-[mobile-hidden=true]:overflow-hidden!"]),defaultLayout:M?P:void 0,onLayoutChanged:E,children:[(0,t.jsx)(f.y,{id:"sidebar",panelRef:D,defaultSize:h.U,minSize:h.V,maxSize:h.a,groupResizeBehavior:"preserve-pixel-size",onResize:_,disabled:!V,"data-mobile-active":G||void 0,"data-mobile-hidden":X||void 0,className:(0,m.c)("flex flex-col bg-sidebar",(V||W||Y)&&"pb-[calc(3.75rem+var(--app-safe-area-bottom))] sm:pb-15"),children:(0,t.jsx)("div",{ref:O,"data-slot":"community-sidebar-panel-content","data-community-mobile-surface":W?"list":void 0,hidden:H,inert:H,"aria-hidden":H||void 0,className:(0,m.c)("flex min-h-0 min-w-0 flex-1 flex-col",Q&&"max-sm:hidden"),children:i})}),(0,t.jsx)(f.U,{disabled:!V,className:(0,m.c)("bg-transparent",!V&&"max-sm:w-0! max-sm:min-w-0! max-sm:max-w-0! max-sm:overflow-hidden"),disableDoubleClick:!0,elementRef:L}),(0,t.jsx)(f.y,{id:"main",groupResizeBehavior:"preserve-relative-size",disabled:!V,"data-mobile-active":J||void 0,"data-mobile-hidden":Z||void 0,className:"flex min-w-0 flex-col bg-background",children:(0,t.jsx)("div",{"data-slot":"community-main-panel-content","data-community-mobile-surface":H?"detail":void 0,hidden:W,inert:W,"aria-hidden":W||void 0,className:(0,m.c)("flex min-h-0 flex-1 flex-col",Y&&"list"===n&&"max-sm:hidden"),children:s})})]})}),ee&&(0,t.jsxs)("div",{ref:z,"data-slot":"community-user-bar-overlay",inert:H,"aria-hidden":H||void 0,className:(0,m.c)("absolute bottom-0 left-0 z-10",V&&"w-(--community-desktop-user-bar-width)",Y&&"w-[calc(100%+3.5rem)] sm:w-(--community-desktop-user-bar-width)",Q&&"max-sm:hidden",H&&N&&"hidden"),style:W?{width:`calc(100% + ${h.i}px)`,marginLeft:-h.i}:et,children:[(0,t.jsx)("div",{"data-slot":"community-user-bar-underlay","aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 bottom-0 -z-10 bg-linear-to-t from-(--app-bg) to-transparent",style:{height:h.q}}),o]})]}),l]})}e.s(["f",0,k],52622);var j=e.i(274762),C=e.i(804);e.s(["f",0,function({pathname:e}){let c=(0,i.$)(),u=(0,s.P)(e);return"community"!==u.rail?(0,t.jsx)(p.f,{"data-testid":o.f.initialFrame,"data-community-route-kind":u.route,"aria-busy":"true","aria-label":"Loading community",children:(0,t.jsx)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:(0,t.jsx)(r.K,{className:"rounded-none border-0 bg-background",children:"none"!==u.main.kind&&(0,t.jsx)(l.CommunityPendingFrame,{href:e,plan:u})})})}):(0,t.jsx)(k,{breakpoint:c,surface:"list"===u.surface?"list":"detail",rail:(0,t.jsx)(j.X,{bottomInset:60}),sidebar:"server"===u.sidebar.kind?(0,t.jsx)(n.m,{targetServerId:u.sidebar.serverId}):(0,t.jsx)(a.h,{}),main:(0,t.jsx)(l.CommunityPendingFrame,{href:e,plan:u,reserveBackSlot:"detail"===u.surface}),userBar:(0,t.jsx)(C.x,{}),testId:o.f.initialFrame,routeKind:u.route,busy:!0,label:"Loading community",preserveHiddenMobileModules:!0})}],215932)},875061,e=>{var t=e.i(644452),n=e.i(32042),a=e.i(294237),r=e.i(613349);let i=(0,a.f)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-1 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});e.s(["t",0,function({className:e,variant:a="default",render:s,...o}){var l;return l={defaultTagName:"span",props:(0,t.w)({className:(0,r.c)(i({variant:a}),e)},o),render:s,state:{slot:"badge",variant:a}},(0,n.a)(l.defaultTagName??"div",l,l)},"y",0,i],875061)},410763,e=>{var t=e.i(895231),n=e.i(742547),a=e.i(294237),r=e.i(613349),i=e.i(473131),s=e.i(434433);let o=(0,a.f)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["N",0,function({className:e,orientation:n="vertical",...a}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":n,className:(0,r.c)(o({orientation:n}),e),...a})},"v",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,r.c)("group/field-content flex flex-1 flex-col gap-1 leading-snug",e),...n})},"H",0,function({className:e,...n}){return(0,t.jsx)("p",{"data-slot":"field-description",className:(0,r.c)("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-2","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...n})},"E",0,function({className:e,children:a,errors:i,...s}){let o=(0,n.useMemo)(()=>{if(a)return a;if(!i?.length)return null;let e=[...new Map(i.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,t.jsx)("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:e.map((e,n)=>e?.message&&(0,t.jsx)("li",{children:e.message},n))})},[a,i]);return o?(0,t.jsx)("div",{role:"alert","data-slot":"field-error",className:(0,r.c)("text-sm font-normal text-destructive",e),...s,children:o}):null},"e",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-group",className:(0,r.c)("group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...n})},"u",0,function({className:e,...n}){return(0,t.jsx)(i.f,{"data-slot":"field-label",className:(0,r.c)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...n})},"f",0,function({children:e,className:n,...a}){return(0,t.jsxs)("div",{"data-slot":"field-separator","data-content":!!e,className:(0,r.c)("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",n),...a,children:[(0,t.jsx)(s.f,{className:"absolute inset-0 top-1/2"}),e&&(0,t.jsx)("span",{className:"relative mx-auto block w-fit bg-background px-2 text-muted-foreground","data-slot":"field-separator-content",children:e})]})},"G",0,function({className:e,...n}){return(0,t.jsx)("fieldset",{"data-slot":"field-set",className:(0,r.c)("flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",e),...n})},"t",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"field-label",className:(0,r.c)("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",e),...n})}])},182149,254578,e=>{var t=e.i(895231),n=e.i(742547),a=Object.defineProperty,r=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,c=(e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;function u(e){let t=e.getBoundingClientRect().right,n=e;for(;n;){if("visible"!==getComputedStyle(n).overflowX)return n.getBoundingClientRect().left+n.clientLeft+n.clientWidth-t;n=n.parentElement}return document.documentElement.clientWidth-t}var d=n.createContext({}),f=n.forwardRef((e,t)=>{let a;var f,p,g,v,y,{value:b,onChange:x,maxLength:w,textAlign:k="left",pattern:j,placeholder:C,inputMode:I="numeric",onComplete:S,pushPasswordManagerStrategy:N="increase-width",pasteTransformer:P,containerClassName:E,noScriptCSSFallback:M=h,nonce:A,render:O,children:R}=e,D=((e,t)=>{var n={};for(var a in e)o.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&s)for(var a of s(e))0>t.indexOf(a)&&l.call(e,a)&&(n[a]=e[a]);return n})(e,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","nonce","render","children"]);let[L,z]=n.useState("string"==typeof D.defaultValue?D.defaultValue:""),T=null!=b?b:L,q=(a=n.useRef(),n.useEffect(()=>{a.current=T}),a.current),K=n.useCallback(e=>{null==x||x(e),z(e)},[x]),$=n.useMemo(()=>j?"string"==typeof j?new RegExp(j):j:null,[j]),F=n.useRef(null),U=n.useRef(null),_=n.useRef({value:T,onChange:K,isIOS:"u">typeof window&&(null==(p=null==(f=null==window?void 0:window.CSS)?void 0:f.supports)?void 0:p.call(f,"-webkit-touch-callout","none"))}),B=n.useRef({prev:[null==(g=F.current)?void 0:g.selectionStart,null==(v=F.current)?void 0:v.selectionEnd,null==(y=F.current)?void 0:y.selectionDirection]});n.useImperativeHandle(t,()=>F.current,[]),n.useEffect(()=>{let e=F.current,t=U.current;if(!e||!t)return;function n(){if(document.activeElement!==e){G(null),J(null);return}let t=e.selectionStart,n=e.selectionEnd,a=e.selectionDirection,r=e.maxLength,i=e.value,s=B.current.prev,o=-1,l=-1,c;if(0!==i.length&&null!==t&&null!==n){let a=t===n,u=t===i.length&&i.length<r;if(a&&!u){if(0===t)o=0,l=1,c="forward";else if(t===r)o=t-1,l=t,c="backward";else if(r>1&&i.length>1){let e=0;if(null!==s[0]&&null!==s[1]){c=t<s[1]?"backward":"forward";let n=s[0]===s[1]&&s[0]<r;"backward"!==c||n||(e=-1)}o=e+t,l=e+t+1}}-1!==o&&-1!==l&&o!==l&&e.setSelectionRange(o,l,c)}let u=-1!==o?o:t,d=-1!==l?l:n,f=null!=c?c:a;G(u),J(d),B.current.prev=[u,d,f]}if(_.current.value!==e.value&&_.current.onChange(e.value),B.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection],document.addEventListener("selectionchange",n,{capture:!0}),n(),document.activeElement===e&&Y(!0),!document.getElementById("input-otp-style")){let e=document.createElement("style");if(e.id="input-otp-style",A&&e.setAttribute("nonce",A),document.head.appendChild(e),e.sheet){let t="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";m(e.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),m(e.sheet,`[data-input-otp]:autofill { ${t} }`),m(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),m(e.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),m(e.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let a=()=>{t&&t.style.setProperty("--root-height",`${e.clientHeight}px`)};a();let r="u"<typeof ResizeObserver?null:new ResizeObserver(a);return null==r||r.observe(e),()=>{document.removeEventListener("selectionchange",n,{capture:!0}),null==r||r.disconnect()}},[]);let[V,W]=n.useState(!1),[H,Y]=n.useState(!1),[Q,G]=n.useState(null),[X,J]=n.useState(null);n.useEffect(()=>{var e;let t=[setTimeout(e=()=>{var e,t,n,a;null==(e=F.current)||e.dispatchEvent(new Event("input"));let r=null==(t=F.current)?void 0:t.selectionStart,i=null==(n=F.current)?void 0:n.selectionEnd,s=null==(a=F.current)?void 0:a.selectionDirection;null!==r&&null!==i&&(G(r),J(i),B.current.prev=[r,i,s])},0),setTimeout(e,10),setTimeout(e,50)];return()=>{t.forEach(e=>clearTimeout(e))}},[T,H]),n.useEffect(()=>{void 0!==q&&T!==q&&q.length<w&&T.length===w&&(null==S||S(T))},[w,S,q,T]);let Z=function({containerRef:e,inputRef:t,pushPasswordManagerStrategy:a,isFocused:r}){let[i,s]=n.useState(!1),[o,l]=n.useState(!1),[c,d]=n.useState(!1),f=n.useMemo(()=>"none"!==a&&("increase-width"===a||"experimental-no-flickering"===a)&&i&&o,[i,o,a]),m=n.useCallback(()=>{let n=e.current,r=t.current;if(!n||!r||c||"none"===a)return;let i=n.getBoundingClientRect().left+n.offsetWidth,o=n.getBoundingClientRect().top+n.offsetHeight/2;0===document.querySelectorAll('[data-lastpass-icon-root],com-1password-button,[data-dashlanecreated],[style$="2147483647 !important;"]').length&&document.elementFromPoint(i-18,o)===n||(l(u(n)>=40),s(!0),d(!0))},[e,t,c,a]);return n.useEffect(()=>{let t=e.current;if(!t||"none"===a)return;function n(){l(u(t)>=40)}n();let r=setInterval(n,1e3);return()=>{clearInterval(r)}},[e,a]),n.useEffect(()=>{let e=r||document.activeElement===t.current;if("none"===a||!e)return;let n=setTimeout(m,0),i=setTimeout(m,2e3),s=setTimeout(m,5e3),o=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(n),clearTimeout(i),clearTimeout(s),clearTimeout(o)}},[t,r,a,m]),{hasPWMBadge:i,willPushPWMBadge:f,PWM_BADGE_SPACE_WIDTH:"40px"}}({containerRef:U,inputRef:F,pushPasswordManagerStrategy:N,isFocused:H}),ee=n.useCallback(e=>{let t=e.currentTarget.value.slice(0,w);t.length>0&&$&&!$.test(t)?e.preventDefault():("string"==typeof q&&t.length<q.length&&document.dispatchEvent(new Event("selectionchange")),K(t))},[w,K,q,$]),et=n.useCallback(()=>{var e;if(F.current){let t=Math.min(F.current.value.length,w-1),n=F.current.value.length;null==(e=F.current)||e.setSelectionRange(t,n),G(t),J(n)}Y(!0)},[w]),en=n.useCallback(e=>{var t,n;let a=F.current;if(!P&&(!_.current.isIOS||!e.clipboardData||!a))return;let r=e.clipboardData.getData("text/plain"),i=P?P(r):r;e.preventDefault();let s=null==(t=F.current)?void 0:t.selectionStart,o=null==(n=F.current)?void 0:n.selectionEnd,l=(s!==o?T.slice(0,s)+i+T.slice(o):T.slice(0,s)+i+T.slice(s)).slice(0,w);if(l.length>0&&$&&!$.test(l))return;a.value=l,K(l);let c=Math.min(l.length,w-1),u=l.length;a.setSelectionRange(c,u),G(c),J(u)},[w,K,P,$,T]),ea=n.useMemo(()=>({position:"relative",cursor:D.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[D.disabled]),er=n.useMemo(()=>({position:"absolute",inset:0,width:Z.willPushPWMBadge?`calc(100% + ${Z.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:Z.willPushPWMBadge?`inset(0 ${Z.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:k,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height, 16px)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[Z.PWM_BADGE_SPACE_WIDTH,Z.willPushPWMBadge,k]),ei=n.useMemo(()=>{var e;return n.createElement("input",r(((e,t)=>{for(var n in t||(t={}))o.call(t,n)&&c(e,n,t[n]);if(s)for(var n of s(t))l.call(t,n)&&c(e,n,t[n]);return e})({autoComplete:D.autoComplete||"one-time-code"},D),i({"data-input-otp":!0,"data-input-otp-placeholder-shown":0===T.length||void 0,"data-input-otp-mss":Q,"data-input-otp-mse":X,inputMode:I,pattern:null==$?void 0:$.source,"aria-placeholder":C,style:er,maxLength:w,value:T,ref:F,spellCheck:null!=(e=D.spellCheck)&&e,onPaste:e=>{var t;en(e),null==(t=D.onPaste)||t.call(D,e)},onChange:ee,onMouseOver:e=>{var t;W(!0),null==(t=D.onMouseOver)||t.call(D,e)},onMouseLeave:e=>{var t;W(!1),null==(t=D.onMouseLeave)||t.call(D,e)},onFocus:e=>{var t;et(),null==(t=D.onFocus)||t.call(D,e)},onBlur:e=>{var t;Y(!1),null==(t=D.onBlur)||t.call(D,e)}})))},[ee,et,en,I,er,w,X,Q,C,D,null==$?void 0:$.source,T]),es=n.useMemo(()=>({slots:Array.from({length:w}).map((e,t)=>{var n;let a=H&&null!==Q&&null!==X&&(Q===X&&t===Q||t>=Q&&t<X),r=void 0!==T[t]?T[t]:null;return{char:r,placeholderChar:void 0!==T[0]?null:null!=(n=null==C?void 0:C[t])?n:null,isActive:a,hasFakeCaret:a&&null===r}}),isFocused:H,isHovering:!D.disabled&&V}),[H,V,w,X,Q,C,D.disabled,T]),eo=n.useMemo(()=>O?O(es):n.createElement(d.Provider,{value:es},R),[R,es,O]);return n.createElement(n.Fragment,null,null!==M&&n.createElement("noscript",null,n.createElement("style",null,M)),n.createElement("div",{ref:U,"data-input-otp-container":!0,translate:"no",style:ea,className:E},eo,n.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},ei)))});function m(e,t){try{e.insertRule(t)}catch(e){console.warn("input-otp could not insert CSS rule:",t)}}f.displayName="Input";var h=`
|
|
2
2
|
[data-input-otp] {
|
|
3
3
|
--nojs-bg: white !important;
|
|
4
4
|
--nojs-fg: black !important;
|