@alook/app 0.0.137 → 0.0.139
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/email-worker/index.js +19 -9
- 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/{0njval22g1rht.js → 0gadq1gaq7l2d.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{2n2-erdcjib3l.js → 0pqa0bk3fnq2q.js} +2 -2
- package/bundled/web/.open-next/assets/_next/static/chunks/0pydx20mmtmb-.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{412d684t3r9n2.js → 0u04xzcqoxacf.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{24uei2njvsgf4.js → 10ey8by6dfgey.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{07ib-ldk87gmo.js → 1c0k_1upngs79.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/1fs7xmjtwdhjj.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{1n2ogp1w_pw5c.js → 1l3nq6kc3fbh-.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{19j0bml2m-9uo.js → 22y46i-vrrny_.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/25z9kj3uj7xzn.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{18pvrsqlzwvzb.js → 2h7oy-ljwoem9.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{1uj4q_n378l_e.js → 2qc57pol1-1f3.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/2usqt49xbpqd2.css +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/3rbv_zutwzuxv.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{1ksb3nu_qkssl.js → 41k5317-tm9ix.js} +1 -1
- package/bundled/web/.open-next/cache/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/device.cache +1 -1
- package/bundled/web/.open-next/cache/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/privacy.cache +1 -1
- package/bundled/web/.open-next/cache/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/sitemap.xml.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 +7 -7
- 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/app-path-routes-manifest.json +1 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
- 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 +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/routes-manifest.json +8 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/[traceId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agent-links/route.js +4 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agents/[id]/workspace/browse/route.js +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agents/active-task-counts/route.js +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/artifacts/[id]/thumbnail/route.js +14 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/artifacts/[id]/thumbnail/route_client-reference-manifest.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/artifacts/route.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/[id]/raw/route.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/tasks/[id]/retry/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/device/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app-paths-manifest.json +1 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/0_kl__next-internal_server_app_api_artifacts_[id]_thumbnail_route_actions_17k4myq.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0255f4r._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__03zvu2n._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__055kbgp._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__05b3ysj._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__09-j82k._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__09psmu_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0eaeyl_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0gkkbf4._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0t2tu5g._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0wd6xqg._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__155l597._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__18yr8rv._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1_d30qf._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1bu3ajw._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1g-mlb0._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1k1navi._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1kg1kju._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1lpr5ex._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__1pmcw25._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +19 -17
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_03r3es0._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0591v0o._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_059g9--._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_06fjxe_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_08gc1s_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{_0ulry_i._.js → _0m_ehw8._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0n8pg0d._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0p79t7w._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0r2vuif._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0v95a0y._.js +4 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_12qkx0d._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_139j3zh._.js +4 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1a2lyoh._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1bq9v_v._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1eu061o._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1i4egv6._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1i9fvyt._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1nfaney._.js +4 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1pn2do-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1tu2mle._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1wx8s3g._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__02a8jxi._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__172hwkq._.js → [root-of-the-server]__1e237f4._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__1nnp8st._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +19 -17
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_04ht2b1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_09v4-yk._.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0kozrym._.js → _0g_x3qh._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0lil2o-._.js +65 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0qgcnj5._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_00ft3vz._.js → _10-8eci._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_15s-tjk._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_17z3ujw._.js → _19hsbaa._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1vs9m39._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1xq5127._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0wq6umk._.js → node_modules__pnpm_0-sy0jc._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0fjz-0c._.js → node_modules__pnpm_03t1_eh._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0s5w--e._.js → node_modules__pnpm_0b_f_5l._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_1ve6v4p._.js → node_modules__pnpm_0lmr_qu._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_17siyfl._.js → node_modules__pnpm_0os8mdu._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_1ajm7qp._.js → node_modules__pnpm_0pd1a42._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_1o8q6qh._.js → node_modules__pnpm_0z21f3h._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_198l9yo._.js → node_modules__pnpm_1tajvfi._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0pwl5s4._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_1kzi5ju._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_email_page_tsx_0gv3qni._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_home_page_tsx_0-vs82-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_avatar_0hmu31-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_home_home-page_tsx_1e1vr_i._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
- 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/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 +235 -235
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +466 -347
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +6 -6
- package/bundled/web/migrations/0042_artifact_thumbnail.sql +1 -0
- package/bundled/web/wrangler.toml +1 -1
- package/bundled/ws-do/index.js +18 -8
- package/dist/cli/index.js +22 -4
- package/dist/cli/session-runner.js +6 -4
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/05mvqqr0d48pd.css +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0b0bf61oxocmd.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2l42wg35hly5d.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/2tyy_fxi6rlas.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/3ad50t_oqhpk_.js +0 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0_qhrkj._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0csf1z3._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_18iwzmu._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1xvbchf._.js +0 -65
- /package/bundled/web/.open-next/assets/_next/static/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{h1hjyI_Nl636o2wkYxPeR → 0z9UpPLBZKa_jgTjfoBR5}/robots.txt.cache +0 -0
|
@@ -59,6 +59,6 @@ module.exports=[762276,a=>{"use strict";var b=a.i(854445);a.i(735132);var c=a.i(
|
|
|
59
59
|
- Every interaction builds trust. Be empathetic, accurate, and efficient — resolve on first response when possible.
|
|
60
60
|
- Lead with acknowledgment, then solution or clear next steps. Use simple language.
|
|
61
61
|
- If you can't resolve immediately, set realistic expectations: what you'll do, by when.
|
|
62
|
-
- Track open issues proactively. Escalate complex or sensitive cases with full context.`;a.s(["SCENARIO_PRESETS",0,[{id:"software-dev",label:"Software Development",description:"Build and ship code with a coordinated dev team",icon:"🖥",members:[{role:"leader",description:"Coordinates work, summarizes results, and replies to you",instructions:d},{role:"engineer",description:"Writes code, runs tests, and verifies implementations",instructions:i,relationship:"Delegate coding tasks with: clear requirement description, acceptance criteria (3-5 specific testable items), relevant file paths, existing patterns to follow, and context from research findings if applicable.\n\nReport back with: implementation status, files changed, acceptance criteria checklist (pass/fail each), test results, and self-review concerns. After implementation, send work to the reviewer if one exists."},{role:"researcher",description:"Reads code, explores APIs, and gathers technical context",instructions:f,relationship:"Delegate technical research with: what to investigate, what decision it informs, scope boundary, and relevant file paths or code pointers.\n\nReport back with: technical summary, evidence (file paths, doc URLs, code snippets), recommendation, and confidence level (High/Medium/Low). Flag anything unverified."}]},{id:"content-research",label:"Content & Research",description:"Research topics, write content, and manage publishing",icon:"📝",members:[{role:"leader",description:"Coordinates work, shapes content direction, and delivers output",instructions:d},{role:"researcher",description:"Finds sources, verifies facts, and organizes references",instructions:g,relationship:"Delegate content research with: topic or claim to investigate, target content format (article, report, social), depth needed, and specific sources to check if any.\n\nReport back with: key facts for the writer, organized source list (URL, date, reliability), verification gaps, framing suggestion, and per-claim confidence."},{role:"assistant",description:"Handles formatting, publishing workflows, and follow-ups",instructions:j,relationship:"Delegate content operations with: what content to format or publish, target platform, deadline, and style requirements.\n\nReport back with: what was done (formatted, published, submitted), next step (awaiting review, scheduled date), and blockers if any."}]},{id:"personal-assistant",label:"Personal Assistant",description:"One AI that handles your everyday tasks and communications",icon:"🤖",members:[{role:"leader",description:"Handles all tasks directly — emails, research, scheduling, and more",instructions:e}]},{id:"sales-outreach",label:"Sales & Outreach",description:"Prospect, follow up, and close deals as a team",icon:"📈",members:[{role:"leader",description:"Coordinates outreach strategy and manages deal flow",instructions:d},{role:"researcher",description:"Researches prospects, companies, and market intelligence",instructions:h,relationship:"Delegate prospect research with: target criteria, market or industry focus, what intelligence is needed, and how it will be used (outreach, pitch, proposal).\n\nReport back with: prioritized prospect list (name, role, company, relevance, suggested angle), market signals, and confidence per finding."},{role:"assistant",description:"Handles outreach emails, follow-ups, and pipeline tracking",instructions:k,relationship:"Delegate outreach with: who to contact, messaging angle, follow-up cadence, and desired outcome.\n\nReport back with: emails sent or scheduled, responses received, pipeline updates, and deals needing escalation."}]},{id:"customer-support",label:"Customer Support",description:"Handle tickets, draft replies, and track resolutions",icon:"🎧",members:[{role:"leader",description:"Coordinates support queue and handles escalations",instructions:d},{role:"assistant",description:"Drafts customer responses and tracks open issues",instructions:l,relationship:"Delegate support tasks with: customer issue summary, urgency level, prior interaction context, and resolution approach.\n\nReport back with: response drafted or sent, resolution status, follow-up schedule, and recurring patterns to flag."}]},{id:"custom",label:"Custom",description:"Build your own team from scratch",icon:"✨",members:[{role:"leader",description:"Coordinates work and replies to you",instructions:d}]}],"shuffleMembers",0,function(a){let d=new Set,e=[];for(let f=0;f<a;f++){let a,f=0;do a=(0,b.uniqueNamesGenerator)({dictionaries:[b.names],length:1,style:"capital"}),f++;while(d.has(a)&&f<100)d.add(a),e.push({name:a,avatarUrl:(0,c.serializeAvatarConfig)((0,c.randomConfig)())})}return e}])},212484,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(762276);a.s(["ScenarioPicker",0,function({selected:a,onSelect:e,onBrowseTemplates:f}){return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"What will your company focus on?"}),f&&(0,b.jsxs)("button",{type:"button",onClick:f,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:["Browse templates ",(0,b.jsx)("span",{"aria-hidden":"true",children:"›"})]})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:d.SCENARIO_PRESETS.map(d=>(0,b.jsxs)("button",{onClick:()=>e(d.id),className:(0,c.cn)("flex flex-col items-start gap-1 rounded-lg border p-4 text-left transition-all hover:border-foreground/30",a===d.id?"border-foreground/50 bg-muted/50":"border-border"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,b.jsx)("span",{className:"text-lg",children:d.icon}),(0,b.jsxs)("span",{className:"text-[10px] text-muted-foreground/70",children:[d.members.length," agent",d.members.length>1?"s":""]})]}),(0,b.jsx)("span",{className:"text-sm font-medium",children:d.label}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-tight",children:d.description})]},d.id))})]})}])},263233,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(732254),e=a.i(439882),f=a.i(674899);a.i(735132);var g=a.i(325848),h=a.i(354498),i=a.i(74414);a.i(974936);var j=a.i(911509);let k={leader:"Lead",researcher:"Researcher",engineer:"Engineer",assistant:"Assistant"};a.s(["TeamPreview",0,function({members:a,runtimes:l,onShuffle:m,onAssignRuntime:n}){let o=l.length>1&&n;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Your company"}),(0,b.jsxs)(d.Button,{variant:"ghost",size:"sm",onClick:m,className:"h-7 text-xs gap-1.5",children:[(0,b.jsx)(f.RefreshCw,{className:"size-3"}),"Shuffle"]})]}),(0,b.jsx)("div",{className:(0,c.cn)("grid gap-3 grid-cols-1",2===a.length&&"sm:grid-cols-2",3===a.length&&"sm:grid-cols-2 md:grid-cols-3",a.length>=4&&"sm:grid-cols-2 md:grid-cols-4"),children:a.map((a,c)=>{let d,f=a.avatarUrl?(0,g.parseAvatarUrl)(a.avatarUrl):null;return(0,b.jsxs)(e.Card,{size:"sm",className:"flex flex-col px-3 py-4 gap-2 h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2.5",children:[f?(0,b.jsx)(g.AvatarRenderer,{config:f,size:36,className:"rounded-xl shrink-0"}):(0,b.jsx)("div",{className:"size-9 rounded-xl bg-muted flex items-center justify-center text-sm font-semibold shrink-0",children:a.name.charAt(0)}),(0,b.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,b.jsx)("span",{className:"text-sm font-medium",children:a.name}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground bg-muted/60 px-1.5 py-0.5 rounded",children:k[a.role]})]})]}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground/70 font-mono truncate",children:(0,j.toAlookAddress)(a.emailHandle||a.name.toLowerCase())}),(0,b.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug flex-1",children:a.description}),o&&(d=l.find(b=>b.id===a.runtimeId),(0,b.jsx)("div",{className:"mt-1",children:(0,b.jsxs)(h.Select,{value:a.runtimeId,onValueChange:a=>{a&&n(c,a)},children:[(0,b.jsx)(h.SelectTrigger,{className:"h-7 text-[11px]",children:(0,b.jsxs)("div",{className:"flex items-center gap-1.5 truncate",children:[d&&(0,b.jsx)(i.ProviderLogo,{provider:d.provider||"",className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:d?.provider||d?.runtime_mode||"Select"})]})}),(0,b.jsx)(h.SelectContent,{children:l.map(a=>(0,b.jsx)(h.SelectItem,{value:a.id,children:a.provider||a.runtime_mode},a.id))})]})}))]},c)})})]})}])},927981,a=>a.a(async(b,c)=>{try{var d=a.i(616612),e=a.i(734803),f=a.i(630991),g=a.i(732254),h=a.i(84096),i=a.i(402656),j=a.i(69379),k=a.i(598169),l=a.i(689560),m=a.i(780956),n=a.i(454607),o=a.i(562706),p=a.i(946621),q=a.i(892691),r=a.i(212484),s=a.i(263233),t=a.i(762276);a.i(974936);var u=a.i(372822),v=a.i(588339),w=a.i(881503),x=a.i(561101),y=b([n]);[n]=y.then?(await y)():y,a.s(["StudioOnboardingClient",0,function({workspaceId:a,workspaceSlug:b,workspaceName:c,initialTemplate:y}){let z=(0,f.useRouter)(),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)(!0),[E,F]=(0,e.useState)(y?y.baseScenario:null),[G,H]=(0,e.useState)([]),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),S=(0,u.isTauri)()&&(0,u.isDesktop)(),T=A.filter(a=>"online"===a.status),U=T.length>0;(0,e.useEffect)(()=>{(0,v.listRuntimes)(a).then(a=>{B(a),a.some(a=>"online"===a.status)&&(P(!0),R(!0))}).catch(()=>{}).finally(()=>D(!1))},[a]);let V=(0,e.useCallback)(b=>{"runtime.registered"===b.type&&b.workspaceId===a?(P(!0),R(!0),(0,v.listRuntimes)(a).then(B).catch(()=>{})):"runtime.status"===b.type&&b.workspaceId===a&&(P(!0),"online"===b.status?R(!0):R(!1))},[a]);(0,w.useUserWs)(V);let W=(0,e.useCallback)(async()=>{N(!0);try{let b=await (0,v.createMachineToken)("cli",a);if(L(b.token),S){let c=await (0,u.tauriInvoke)("register_cli",{token:b.token});c.success?(P(!0),R(!0),(0,v.listRuntimes)(a).then(B).catch(()=>{})):m.toast.error(c.message||"Auto-registration failed")}}catch{m.toast.error("Failed to generate token")}finally{N(!1)}},[a,S]);(0,e.useEffect)(()=>{let a=T[0]?.id;a&&H(b=>0!==b.length&&b.some(a=>!a.runtimeId)?b.map(b=>b.runtimeId?b:{...b,runtimeId:a}):b)},[T]);let X=(0,e.useCallback)(async a=>{try{let b=await fetch("/api/studios/check-handles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:a})});if(!b.ok)return null;return await b.json()}catch{return null}},[]);(0,e.useEffect)(()=>{if(!y||C||G.length>0)return;let a=(0,t.shuffleMembers)(y.members.length),b=T[0]?.id||"",c=y.members.map((c,d)=>({name:a[d].name,role:c.role,description:c.description,instructions:c.instructions,avatarUrl:a[d].avatarUrl,runtimeId:b,relationship:c.relationship}));H(c),X(c.map(a=>a.name)).then(a=>{a&&H(b=>b.map(b=>{let c=a.find(a=>a.name===b.name);return c?{...b,emailHandle:c.handle}:b}))})},[y,C]);let Y=async a=>{F(a);let b=t.SCENARIO_PRESETS.find(b=>b.id===a),c=(0,t.shuffleMembers)(b.members.length),d=T[0]?.id||"",e=b.members.map((a,b)=>({name:c[b].name,role:a.role,description:a.description,instructions:a.instructions,avatarUrl:c[b].avatarUrl,runtimeId:d,relationship:a.relationship}));H(e);let f=await X(e.map(a=>a.name));f&&H(a=>a.map(a=>{let b=f.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},Z=async()=>{let a=(0,t.shuffleMembers)(G.length),b=G.map((b,c)=>({...b,name:a[c].name,avatarUrl:a[c].avatarUrl,emailHandle:void 0}));H(b);let c=await X(b.map(a=>a.name));c&&H(a=>a.map(a=>{let b=c.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},$=async()=>{J(!0);try{let b=await fetch("/api/studios",{method:"POST",headers:{"Content-Type":"application/json","X-Workspace-ID":a},body:JSON.stringify({name:void 0,scenario:E,members:G.map(a=>({name:a.name,role:a.role,runtime_id:a.runtimeId,description:a.description,instructions:a.instructions,avatar_url:a.avatarUrl||null,email_handle:a.emailHandle||void 0,relationship:a.relationship||void 0}))})});if(!b.ok){let a=await b.json();throw Error(a.error||"Failed to create company")}let c=await b.json();await fetch(`/api/workspaces/${a}/onboarded`,{method:"POST"}).catch(()=>{}),(0,p.trackWorkspaceCreated)("onboarding"),(0,p.trackOnboardingCompleted)({template_used:E??void 0,agent_count:G.length});for(let a=0;a<G.length;a++)(0,p.trackAgentCreated)({is_first_agent:0===a,has_email:!!G[a].emailHandle});m.toast.success("Company created!"),z.push(`/w/${c.workspace.slug}/agents/${c.leader_agent_id}`)}catch(a){m.toast.error(a instanceof Error?a.message:"Failed to create company"),J(!1)}},_=E&&G.length>0&&G.every(a=>a.runtimeId)&&(U||O&&Q||S);return E?(0,d.jsx)(q.PublicLayout,{leftSlot:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>z.push("/workspaces"),children:[(0,d.jsx)(l.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),(0,d.jsx)("span",{className:"text-muted-foreground/40",children:"/"}),(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>F(null),children:[(0,d.jsx)(k.ArrowLeft,{className:"size-3 mr-1.5"}),"Back"]})]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,o.clearAllCache)(),(0,n.signOut)({fetchOptions:{onSuccess:()=>z.push("/sign-in")}})},children:[(0,d.jsx)(j.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-3xl space-y-10 px-6 py-14",children:[(0,d.jsx)("div",{className:"text-center",children:(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"Build your company"})}),C?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.TeamPreview,{members:G,runtimes:T,onShuffle:Z,onAssignRuntime:(a,b)=>{H(c=>c.map((c,d)=>d===a?{...c,runtimeId:b}:c))}}),!S&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Connect a computer"}),U||O&&Q?(0,d.jsxs)("p",{className:"text-xs text-emerald-600 flex items-center gap-1",children:[(0,d.jsx)(i.CheckCircle2,{className:"size-3"})," Computer connected"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your company needs a connected computer to run tasks."}),(0,d.jsx)("div",{className:"rounded-xl bg-muted/40 p-5",children:(0,d.jsx)(x.ConnectMachineSteps,{generatedToken:K,generatingToken:M,onGenerateToken:W,registered:O,daemonOnline:Q})})]})]}),(0,d.jsx)(g.Button,{onClick:$,disabled:!_||I,className:"w-full",size:"lg",children:I?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.Loader2,{className:"size-4 animate-spin mr-2"}),"Launching..."]}):"Launch company"})]})]})}):(0,d.jsx)(q.PublicLayout,{leftSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>z.push("/workspaces"),children:[(0,d.jsx)(l.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,o.clearAllCache)(),(0,n.signOut)({fetchOptions:{onSuccess:()=>z.push("/sign-in")}})},children:[(0,d.jsx)(j.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),mainClassName:"flex items-center justify-center",children:(0,d.jsxs)("div",{className:"w-full max-w-3xl space-y-8 px-6 py-6",children:[(0,d.jsxs)("div",{className:"text-center space-y-2",children:[(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"What will your company do?"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick a focus area. You can always add more agents later."})]}),(0,d.jsx)(r.ScenarioPicker,{selected:E,onSelect:Y,onBrowseTemplates:()=>z.push(`/templates?workspace_id=${a}`)}),(0,d.jsx)("div",{className:"flex justify-center pt-2",children:(0,d.jsx)("button",{type:"button",onClick:async()=>{await fetch(`/api/workspaces/${a}/onboarded`,{method:"POST"}).catch(()=>{}),z.push(`/w/${b}/home`)},className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Skip for now"})})]})})}]),c()}catch(a){c(a)}},!1)];
|
|
62
|
+
- Track open issues proactively. Escalate complex or sensitive cases with full context.`;a.s(["SCENARIO_PRESETS",0,[{id:"software-dev",label:"Software Development",description:"Build and ship code with a coordinated dev team",icon:"🖥",members:[{role:"leader",description:"Coordinates work, summarizes results, and replies to you",instructions:d},{role:"engineer",description:"Writes code, runs tests, and verifies implementations",instructions:i,relationship:"Delegate coding tasks with: clear requirement description, acceptance criteria (3-5 specific testable items), relevant file paths, existing patterns to follow, and context from research findings if applicable.\n\nReport back with: implementation status, files changed, acceptance criteria checklist (pass/fail each), test results, and self-review concerns. After implementation, send work to the reviewer if one exists."},{role:"researcher",description:"Reads code, explores APIs, and gathers technical context",instructions:f,relationship:"Delegate technical research with: what to investigate, what decision it informs, scope boundary, and relevant file paths or code pointers.\n\nReport back with: technical summary, evidence (file paths, doc URLs, code snippets), recommendation, and confidence level (High/Medium/Low). Flag anything unverified."}]},{id:"content-research",label:"Content & Research",description:"Research topics, write content, and manage publishing",icon:"📝",members:[{role:"leader",description:"Coordinates work, shapes content direction, and delivers output",instructions:d},{role:"researcher",description:"Finds sources, verifies facts, and organizes references",instructions:g,relationship:"Delegate content research with: topic or claim to investigate, target content format (article, report, social), depth needed, and specific sources to check if any.\n\nReport back with: key facts for the writer, organized source list (URL, date, reliability), verification gaps, framing suggestion, and per-claim confidence."},{role:"assistant",description:"Handles formatting, publishing workflows, and follow-ups",instructions:j,relationship:"Delegate content operations with: what content to format or publish, target platform, deadline, and style requirements.\n\nReport back with: what was done (formatted, published, submitted), next step (awaiting review, scheduled date), and blockers if any."}]},{id:"personal-assistant",label:"Personal Assistant",description:"One AI that handles your everyday tasks and communications",icon:"🤖",members:[{role:"leader",description:"Handles all tasks directly — emails, research, scheduling, and more",instructions:e}]},{id:"sales-outreach",label:"Sales & Outreach",description:"Prospect, follow up, and close deals as a team",icon:"📈",members:[{role:"leader",description:"Coordinates outreach strategy and manages deal flow",instructions:d},{role:"researcher",description:"Researches prospects, companies, and market intelligence",instructions:h,relationship:"Delegate prospect research with: target criteria, market or industry focus, what intelligence is needed, and how it will be used (outreach, pitch, proposal).\n\nReport back with: prioritized prospect list (name, role, company, relevance, suggested angle), market signals, and confidence per finding."},{role:"assistant",description:"Handles outreach emails, follow-ups, and pipeline tracking",instructions:k,relationship:"Delegate outreach with: who to contact, messaging angle, follow-up cadence, and desired outcome.\n\nReport back with: emails sent or scheduled, responses received, pipeline updates, and deals needing escalation."}]},{id:"customer-support",label:"Customer Support",description:"Handle tickets, draft replies, and track resolutions",icon:"🎧",members:[{role:"leader",description:"Coordinates support queue and handles escalations",instructions:d},{role:"assistant",description:"Drafts customer responses and tracks open issues",instructions:l,relationship:"Delegate support tasks with: customer issue summary, urgency level, prior interaction context, and resolution approach.\n\nReport back with: response drafted or sent, resolution status, follow-up schedule, and recurring patterns to flag."}]},{id:"custom",label:"Custom",description:"Build your own team from scratch",icon:"✨",members:[{role:"leader",description:"Coordinates work and replies to you",instructions:d}]}],"shuffleMembers",0,function(a){let d=new Set,e=[];for(let f=0;f<a;f++){let a,f=0;do a=(0,b.uniqueNamesGenerator)({dictionaries:[b.names],length:1,style:"capital"}),f++;while(d.has(a)&&f<100)d.add(a),e.push({name:a,avatarUrl:(0,c.serializeAvatarConfig)((0,c.randomConfig)())})}return e}])},212484,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(762276);a.s(["ScenarioPicker",0,function({selected:a,onSelect:e,onBrowseTemplates:f}){return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"What will your company focus on?"}),f&&(0,b.jsxs)("button",{type:"button",onClick:f,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:["Browse templates ",(0,b.jsx)("span",{"aria-hidden":"true",children:"›"})]})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:d.SCENARIO_PRESETS.map(d=>(0,b.jsxs)("button",{onClick:()=>e(d.id),className:(0,c.cn)("flex flex-col items-start gap-1 rounded-lg border p-4 text-left transition-all hover:border-foreground/30",a===d.id?"border-foreground/50 bg-muted/50":"border-border"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,b.jsx)("span",{className:"text-lg",children:d.icon}),(0,b.jsxs)("span",{className:"text-[10px] text-muted-foreground/70",children:[d.members.length," agent",d.members.length>1?"s":""]})]}),(0,b.jsx)("span",{className:"text-sm font-medium",children:d.label}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-tight",children:d.description})]},d.id))})]})}])},263233,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(732254),e=a.i(439882),f=a.i(674899);a.i(735132);var g=a.i(325848),h=a.i(354498),i=a.i(74414);a.i(974936);var j=a.i(911509);let k={leader:"Lead",researcher:"Researcher",engineer:"Engineer",assistant:"Assistant"};a.s(["TeamPreview",0,function({members:a,runtimes:l,onShuffle:m,onAssignRuntime:n}){let o=l.length>1&&n;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Your company"}),(0,b.jsxs)(d.Button,{variant:"ghost",size:"sm",onClick:m,className:"h-7 text-xs gap-1.5",children:[(0,b.jsx)(f.RefreshCw,{className:"size-3"}),"Shuffle"]})]}),(0,b.jsx)("div",{className:(0,c.cn)("grid gap-3 grid-cols-1",2===a.length&&"sm:grid-cols-2",3===a.length&&"sm:grid-cols-2 md:grid-cols-3",a.length>=4&&"sm:grid-cols-2 md:grid-cols-4"),children:a.map((a,c)=>{let d,f=a.avatarUrl?(0,g.parseAvatarUrl)(a.avatarUrl):null;return(0,b.jsxs)(e.Card,{size:"sm",className:"flex flex-col px-3 py-4 gap-2 h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2.5",children:[f?(0,b.jsx)(g.AvatarRenderer,{config:f,size:36,className:"rounded-xl shrink-0"}):(0,b.jsx)("div",{className:"size-9 rounded-xl bg-muted flex items-center justify-center text-sm font-semibold shrink-0",children:a.name.charAt(0)}),(0,b.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,b.jsx)("span",{className:"text-sm font-medium",children:a.name}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground bg-muted/60 px-1.5 py-0.5 rounded",children:k[a.role]})]})]}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground/70 font-mono truncate",children:(0,j.toAlookAddress)(a.emailHandle||a.name.toLowerCase())}),(0,b.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug flex-1",children:a.description}),o&&(d=l.find(b=>b.id===a.runtimeId),(0,b.jsx)("div",{className:"mt-1",children:(0,b.jsxs)(h.Select,{value:a.runtimeId,onValueChange:a=>{a&&n(c,a)},children:[(0,b.jsx)(h.SelectTrigger,{className:"h-7 text-[11px]",children:(0,b.jsxs)("div",{className:"flex items-center gap-1.5 truncate",children:[d&&(0,b.jsx)(i.ProviderLogo,{provider:d.provider||"",className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:d?.provider||d?.runtime_mode||"Select"})]})}),(0,b.jsx)(h.SelectContent,{children:l.map(a=>(0,b.jsx)(h.SelectItem,{value:a.id,children:a.provider||a.runtime_mode},a.id))})]})}))]},c)})})]})}])},927981,a=>a.a(async(b,c)=>{try{var d=a.i(616612),e=a.i(734803),f=a.i(630991),g=a.i(732254),h=a.i(84096),i=a.i(402656),j=a.i(69379),k=a.i(598169),l=a.i(689560),m=a.i(780956),n=a.i(454607),o=a.i(562706),p=a.i(946621),q=a.i(892691),r=a.i(212484),s=a.i(263233),t=a.i(762276);a.i(974936);var u=a.i(372822),v=a.i(588339),w=a.i(881503),x=a.i(561101),y=b([n]);[n]=y.then?(await y)():y,a.s(["StudioOnboardingClient",0,function({workspaceId:a,workspaceSlug:b,initialTemplate:c}){let y=(0,f.useRouter)(),[z,A]=(0,e.useState)([]),[B,C]=(0,e.useState)(!0),[D,E]=(0,e.useState)(c?c.baseScenario:null),[F,G]=(0,e.useState)([]),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(!1),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(!1),R=(0,u.isTauri)()&&(0,u.isDesktop)(),S=z.filter(a=>"online"===a.status),T=S.length>0;(0,e.useEffect)(()=>{(0,v.listRuntimes)(a).then(a=>{A(a),a.some(a=>"online"===a.status)&&(O(!0),Q(!0))}).catch(()=>{}).finally(()=>C(!1))},[a]);let U=(0,e.useCallback)(b=>{"runtime.registered"===b.type&&b.workspaceId===a?(O(!0),Q(!0),(0,v.listRuntimes)(a).then(A).catch(()=>{})):"runtime.status"===b.type&&b.workspaceId===a&&(O(!0),"online"===b.status?Q(!0):Q(!1))},[a]);(0,w.useUserWs)(U);let V=(0,e.useCallback)(async()=>{M(!0);try{let b=await (0,v.createMachineToken)("cli",a);if(K(b.token),R){let c=await (0,u.tauriInvoke)("register_cli",{token:b.token});c.success?(O(!0),Q(!0),(0,v.listRuntimes)(a).then(A).catch(()=>{})):m.toast.error(c.message||"Auto-registration failed")}}catch{m.toast.error("Failed to generate token")}finally{M(!1)}},[a,R]);(0,e.useEffect)(()=>{let a=S[0]?.id;a&&G(b=>0!==b.length&&b.some(a=>!a.runtimeId)?b.map(b=>b.runtimeId?b:{...b,runtimeId:a}):b)},[S]);let W=(0,e.useCallback)(async a=>{try{let b=await fetch("/api/studios/check-handles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:a})});if(!b.ok)return null;return await b.json()}catch{return null}},[]);(0,e.useEffect)(()=>{if(!c||B||F.length>0)return;let a=(0,t.shuffleMembers)(c.members.length),b=S[0]?.id||"",d=c.members.map((c,d)=>({name:a[d].name,role:c.role,description:c.description,instructions:c.instructions,avatarUrl:a[d].avatarUrl,runtimeId:b,relationship:c.relationship}));G(d),W(d.map(a=>a.name)).then(a=>{a&&G(b=>b.map(b=>{let c=a.find(a=>a.name===b.name);return c?{...b,emailHandle:c.handle}:b}))})},[c,B]);let X=async a=>{E(a);let b=t.SCENARIO_PRESETS.find(b=>b.id===a),c=(0,t.shuffleMembers)(b.members.length),d=S[0]?.id||"",e=b.members.map((a,b)=>({name:c[b].name,role:a.role,description:a.description,instructions:a.instructions,avatarUrl:c[b].avatarUrl,runtimeId:d,relationship:a.relationship}));G(e);let f=await W(e.map(a=>a.name));f&&G(a=>a.map(a=>{let b=f.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},Y=async()=>{let a=(0,t.shuffleMembers)(F.length),b=F.map((b,c)=>({...b,name:a[c].name,avatarUrl:a[c].avatarUrl,emailHandle:void 0}));G(b);let c=await W(b.map(a=>a.name));c&&G(a=>a.map(a=>{let b=c.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},Z=async()=>{I(!0);try{let b=await fetch("/api/studios",{method:"POST",headers:{"Content-Type":"application/json","X-Workspace-ID":a},body:JSON.stringify({name:void 0,scenario:D,members:F.map(a=>({name:a.name,role:a.role,runtime_id:a.runtimeId,description:a.description,instructions:a.instructions,avatar_url:a.avatarUrl||null,email_handle:a.emailHandle||void 0,relationship:a.relationship||void 0}))})});if(!b.ok){let a=await b.json();throw Error(a.error||"Failed to create company")}let c=await b.json();await fetch(`/api/workspaces/${a}/onboarded`,{method:"POST"}).catch(()=>{}),(0,p.trackWorkspaceCreated)("onboarding"),(0,p.trackOnboardingCompleted)({template_used:D??void 0,agent_count:F.length});for(let a=0;a<F.length;a++)(0,p.trackAgentCreated)({is_first_agent:0===a,has_email:!!F[a].emailHandle});m.toast.success("Company created!"),y.push(`/w/${c.workspace.slug}/agents/${c.leader_agent_id}`)}catch(a){m.toast.error(a instanceof Error?a.message:"Failed to create company"),I(!1)}},$=D&&F.length>0&&F.every(a=>a.runtimeId)&&(T||N&&P||R);return D?(0,d.jsx)(q.PublicLayout,{leftSlot:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>y.push("/workspaces"),children:[(0,d.jsx)(l.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),(0,d.jsx)("span",{className:"text-muted-foreground/40",children:"/"}),(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>E(null),children:[(0,d.jsx)(k.ArrowLeft,{className:"size-3 mr-1.5"}),"Back"]})]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,o.clearAllCache)(),(0,n.signOut)({fetchOptions:{onSuccess:()=>y.push("/sign-in")}})},children:[(0,d.jsx)(j.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-3xl space-y-10 px-6 py-14",children:[(0,d.jsx)("div",{className:"text-center",children:(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"Build your company"})}),B?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(h.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.TeamPreview,{members:F,runtimes:S,onShuffle:Y,onAssignRuntime:(a,b)=>{G(c=>c.map((c,d)=>d===a?{...c,runtimeId:b}:c))}}),!R&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Connect a computer"}),T||N&&P?(0,d.jsxs)("p",{className:"text-xs text-emerald-600 flex items-center gap-1",children:[(0,d.jsx)(i.CheckCircle2,{className:"size-3"})," Computer connected"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your company needs a connected computer to run tasks."}),(0,d.jsx)("div",{className:"rounded-xl bg-muted/40 p-5",children:(0,d.jsx)(x.ConnectMachineSteps,{generatedToken:J,generatingToken:L,onGenerateToken:V,registered:N,daemonOnline:P})})]})]}),(0,d.jsx)(g.Button,{onClick:Z,disabled:!$||H,className:"w-full",size:"lg",children:H?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.Loader2,{className:"size-4 animate-spin mr-2"}),"Launching..."]}):"Launch company"})]})]})}):(0,d.jsx)(q.PublicLayout,{leftSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>y.push("/workspaces"),children:[(0,d.jsx)(l.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,o.clearAllCache)(),(0,n.signOut)({fetchOptions:{onSuccess:()=>y.push("/sign-in")}})},children:[(0,d.jsx)(j.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),mainClassName:"flex items-center justify-center",children:(0,d.jsxs)("div",{className:"w-full max-w-3xl space-y-8 px-6 py-6",children:[(0,d.jsxs)("div",{className:"text-center space-y-2",children:[(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"What will your company do?"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick a focus area. You can always add more agents later."})]}),(0,d.jsx)(r.ScenarioPicker,{selected:D,onSelect:X,onBrowseTemplates:()=>y.push(`/templates?workspace_id=${a}`)}),(0,d.jsx)("div",{className:"flex justify-center pt-2",children:(0,d.jsx)("button",{type:"button",onClick:async()=>{await fetch(`/api/workspaces/${a}/onboarded`,{method:"POST"}).catch(()=>{}),y.push(`/w/${b}/home`)},className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Skip for now"})})]})})}]),c()}catch(a){c(a)}},!1)];
|
|
63
63
|
|
|
64
64
|
//# sourceMappingURL=src_web_src_1kzi5ju._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[221781,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(630991),e=a.i(506180),f=a.i(752792),g=a.i(588339);a.i(974936);var h=a.i(911509),i=a.i(732254),j=a.i(22902),k=a.i(983039),l=a.i(728778),m=a.i(443354),n=a.i(450274),o=a.i(297897),p=a.i(317703),q=p.Extension.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:a=>{let b=a.style.textAlign;return this.options.alignments.includes(b)?b:this.options.defaultAlignment},renderHTML:a=>a.textAlign?{style:`text-align: ${a.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:a=>({commands:b})=>!!this.options.alignments.includes(a)&&this.options.types.map(c=>b.updateAttributes(c,{textAlign:a})).some(a=>a),unsetTextAlign:()=>({commands:a})=>this.options.types.map(b=>a.resetAttributes(b,"textAlign")).some(a=>a),toggleTextAlign:a=>({editor:b,commands:c})=>!!this.options.alignments.includes(a)&&(b.isActive({textAlign:a})?c.unsetTextAlign():c.setTextAlign(a))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),r=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,s=p.Node.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:a}){return["img",(0,p.mergeAttributes)(this.options.HTMLAttributes,a)]},parseMarkdown:(a,b)=>b.createNode("image",{src:a.href,title:a.title,alt:a.text}),renderMarkdown:a=>{var b,c,d,e,f,g;let h=null!=(c=null==(b=a.attrs)?void 0:b.src)?c:"",i=null!=(e=null==(d=a.attrs)?void 0:d.alt)?e:"",j=null!=(g=null==(f=a.attrs)?void 0:f.title)?g:"";return j?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:a,minWidth:b,minHeight:c,alwaysPreserveAspectRatio:d}=this.options.resize;return({node:e,getPos:f,HTMLAttributes:g,editor:h})=>{let i=document.createElement("img");i.draggable=!1;let j=(0,p.mergeAttributes)(this.options.HTMLAttributes,g);Object.entries(j).forEach(([a,b])=>{if(null!=b)switch(a){case"width":case"height":break;default:i.setAttribute(a,b)}}),null!==j.src&&(i.src=j.src);let k=new p.ResizableNodeView({element:i,editor:h,node:e,getPos:f,onResize:(a,b)=>{i.style.width=`${a}px`,i.style.height=`${b}px`},onCommit:(a,b)=>{let c=f();void 0!==c&&this.editor.chain().setNodeSelection(c).updateAttributes(this.name,{width:a,height:b}).run()},onUpdate:(a,b,c)=>a.type===e.type,options:{directions:a,min:{width:b,height:c},preserveAspectRatio:!0===d}}),l=k.dom;return l.style.visibility="hidden",l.style.pointerEvents="none",i.onload=()=>{l.style.visibility="",l.style.pointerEvents=""},k}},addCommands(){return{setImage:a=>({commands:b})=>b.insertContent({type:this.name,attrs:a})}},addInputRules(){return[(0,p.nodeInputRule)({find:r,type:this.type,getAttributes:a=>{let[,,b,c,d]=a;return{src:c,alt:b,title:d}}})]}}),t=a.i(75118),u=a.i(525132),v=a.i(432340),w=a.i(334235),x=a.i(410732);let y=(0,x.default)("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),z=(0,x.default)("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),A=(0,x.default)("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),B=(0,x.default)("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),C=(0,x.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),D=(0,x.default)("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]),E=(0,x.default)("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),F=(0,x.default)("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),G=(0,x.default)("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),H=(0,x.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),I=(0,x.default)("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]),J=(0,x.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),K=(0,x.default)("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),L=(0,x.default)("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);var M=a.i(995900),M=M;function N({active:a,disabled:c,onAction:d,title:e,children:f}){return(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:c,onMouseDown:a=>a.preventDefault(),onClick:d,className:(0,t.cn)("text-muted-foreground/70",a&&"bg-accent text-foreground")}),children:f}),(0,b.jsx)(u.TooltipContent,{children:e})]})}function O(){return(0,b.jsx)("div",{className:"w-px h-4 bg-border/60 mx-0.5 shrink-0"})}function P({editor:a}){let[,d]=(0,c.useReducer)(a=>a+1,0),[e,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)("link"),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),s=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!a)return;let b=()=>d();return a.on("transaction",b),()=>{a.off("transaction",b)}},[a]),(0,c.useEffect)(()=>{e&&setTimeout(()=>r.current?.focus(),0)},[e]),!a)return null;let x="size-3.5",Q=()=>{let b=j.trim();if(b){try{new URL(b)}catch{m("Please enter a valid URL");return}if(m(""),"link"===g)if(p){let c=n.trim()||b;a.chain().focus().insertContent({type:"text",text:c,marks:[{type:"link",attrs:{href:b}}]}).run()}else a.chain().focus().extendMarkRange("link").setLink({href:b}).run();else a.chain().focus().setImage({src:b}).run();f(!1)}};return(0,b.jsxs)("div",{className:"flex items-center gap-0.5 px-3 py-1 overflow-x-auto",children:[(0,b.jsx)(N,{title:"Bold",active:a.isActive("bold"),onAction:()=>a.chain().focus().toggleBold().run(),children:(0,b.jsx)(y,{className:x})}),(0,b.jsx)(N,{title:"Italic",active:a.isActive("italic"),onAction:()=>a.chain().focus().toggleItalic().run(),children:(0,b.jsx)(z,{className:x})}),(0,b.jsx)(N,{title:"Underline",active:a.isActive("underline"),onAction:()=>a.chain().focus().toggleUnderline().run(),children:(0,b.jsx)(A,{className:x})}),(0,b.jsx)(N,{title:"Strikethrough",active:a.isActive("strike"),onAction:()=>a.chain().focus().toggleStrike().run(),children:(0,b.jsx)(B,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Heading 1",active:a.isActive("heading",{level:1}),onAction:()=>a.chain().focus().toggleHeading({level:1}).run(),children:(0,b.jsx)(K,{className:x})}),(0,b.jsx)(N,{title:"Heading 2",active:a.isActive("heading",{level:2}),onAction:()=>a.chain().focus().toggleHeading({level:2}).run(),children:(0,b.jsx)(L,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Bullet List",active:a.isActive("bulletList"),onAction:()=>a.chain().focus().toggleBulletList().run(),children:(0,b.jsx)(C,{className:x})}),(0,b.jsx)(N,{title:"Ordered List",active:a.isActive("orderedList"),onAction:()=>a.chain().focus().toggleOrderedList().run(),children:(0,b.jsx)(D,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Align Left",active:a.isActive({textAlign:"left"}),onAction:()=>a.chain().focus().setTextAlign("left").run(),children:(0,b.jsx)(E,{className:x})}),(0,b.jsx)(N,{title:"Align Center",active:a.isActive({textAlign:"center"}),onAction:()=>a.chain().focus().setTextAlign("center").run(),children:(0,b.jsx)(F,{className:x})}),(0,b.jsx)(N,{title:"Align Right",active:a.isActive({textAlign:"right"}),onAction:()=>a.chain().focus().setTextAlign("right").run(),children:(0,b.jsx)(G,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onMouseDown:b=>{b.preventDefault(),s.current=a.isActive("link")},onClick:()=>{s.current?a.chain().focus().unsetLink().run():(h("link"),k(""),m(""),o(""),q(a.state.selection.empty),f(!0))},className:(0,t.cn)("text-muted-foreground/70",a.isActive("link")&&"bg-accent text-foreground")}),children:a.isActive("link")?(0,b.jsx)(I,{className:x}):(0,b.jsx)(H,{className:x})}),(0,b.jsx)(u.TooltipContent,{children:a.isActive("link")?"Remove Link":"Insert Link"})]}),(0,b.jsx)(N,{title:"Insert Image",onAction:()=>{h("image"),k(""),m(""),f(!0)},children:(0,b.jsx)(J,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Horizontal Rule",onAction:()=>a.chain().focus().setHorizontalRule().run(),children:(0,b.jsx)(M.default,{className:x})}),(0,b.jsx)(v.Dialog,{open:e,onOpenChange:f,children:(0,b.jsxs)(v.DialogContent,{children:[(0,b.jsx)(v.DialogHeader,{children:(0,b.jsx)(v.DialogTitle,{children:"link"===g?"Insert Link":"Insert Image"})}),"link"===g&&p&&(0,b.jsx)(w.Input,{ref:r,value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"Display text"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(w.Input,{ref:"image"!==g&&p?void 0:r,value:j,onChange:a=>{k(a.target.value),m("")},onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"link"===g?"https://example.com":"https://example.com/image.png",type:"url","aria-invalid":!!l}),l&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:l})]}),(0,b.jsx)(v.DialogFooter,{children:(0,b.jsx)(i.Button,{onClick:Q,disabled:!j.trim(),children:"Insert"})})]})})]})}var Q=a.i(780956),R=a.i(554705),S=a.i(351360),T=a.i(84096),U=a.i(343558),V=a.i(354875);function W({fromAddress:d,onSend:e,onDiscard:f,initialTo:g="",initialSubject:h="",initialBody:j="",initialAttachments:p=[],inReplyTo:r,references:t}){let[v,x]=(0,c.useState)(g),[y,z]=(0,c.useState)(h),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(p),[E,F]=(0,c.useState)(!1),G=(0,c.useRef)(null),H=(0,k.useEditor)({immediatelyRender:!1,content:j||void 0,extensions:[l.default.configure({link:!1,underline:!1}),m.default.configure({placeholder:"Write your email..."}),n.default,o.default.configure({autolink:!0,openOnClick:!1,linkOnPaste:!0}),q.configure({types:["heading","paragraph"]}),s.configure({inline:!0,allowBase64:!0})],editorProps:{attributes:{class:"text-sm max-w-none focus:outline-none min-h-50 px-4 py-3"}}}),I=async()=>{if(v.trim()&&y.trim()&&H){B(!0);try{let a=H.getHTML();await e(v.trim(),y.trim(),a,C,r||t?{inReplyTo:r,references:t}:void 0)&&(x(""),z(""),D([]),H.commands.clearContent())}finally{B(!1)}}},J=async b=>{let c=b.target.files;if(c&&0!==c.length){F(!0);try{let{uploadEmailAttachment:b}=await a.A(81396);for(let a of Array.from(c)){if(a.size>0xa00000){Q.toast.error(`${a.name} exceeds 10 MB limit`);continue}let c=new URLSearchParams(window.location.search).get("workspace_id")??"",d=await b(a,c);D(a=>[...a,d])}}catch{Q.toast.error("Failed to upload attachment")}finally{F(!1),G.current&&(G.current.value="")}}};return(0,b.jsxs)("div",{className:"flex flex-col h-full w-full min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2",children:[(0,b.jsx)("h3",{className:"text-sm font-heading font-medium tracking-tight",children:"New Email"}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(i.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground h-7 px-2",onClick:f,disabled:A,children:[(0,b.jsx)(S.X,{className:"size-3 mr-1"}),"Discard"]}),(0,b.jsxs)(i.Button,{size:"sm",className:"text-xs h-7 px-3",onClick:I,disabled:A||!v.trim()||!y.trim(),children:[A?(0,b.jsx)(T.Loader2,{className:"size-3 mr-1 animate-spin"}):(0,b.jsx)(R.Send,{className:"size-3 mr-1"}),"Send"]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border/30 px-4 py-2.5 space-y-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{className:"text-muted-foreground truncate min-w-0",children:d})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{type:"email",value:v,onChange:a=>x(a.target.value),placeholder:"recipient@example.com",className:"h-7 text-sm border-0 bg-transparent px-1.5 shadow-none focus-visible:ring-0 placeholder:text-muted-foreground/50",disabled:A})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"Subject"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{value:y,onChange:a=>z(a.target.value),placeholder:"Email subject",className:"h-7 text-sm border-0 bg-transparent px-1.5 shadow-none focus-visible:ring-0 placeholder:text-muted-foreground/50",disabled:A})})]})]}),(0,b.jsxs)("div",{className:"flex items-center border-b border-border/30",children:[(0,b.jsx)(P,{editor:H}),(0,b.jsxs)("div",{className:"flex items-center gap-1 px-2 border-l border-border/30",children:[(0,b.jsx)("input",{ref:G,type:"file",multiple:!0,className:"hidden",onChange:J}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:E,onMouseDown:a=>a.preventDefault(),onClick:()=>G.current?.click(),className:"text-muted-foreground/70"}),children:E?(0,b.jsx)(T.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(U.Paperclip,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Attach file"})]})]})]}),C.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5 px-4 py-2 border-b border-border/30",children:C.map(a=>{var c;return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs",children:[(0,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-37.5",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:(c=a.size)<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`}),(0,b.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.key,void D(a=>a.filter(a=>a.key!==b))},className:"text-muted-foreground hover:text-foreground ml-0.5 cursor-pointer",children:(0,b.jsx)(S.X,{className:"size-3"})})]},a.key)})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar",children:(0,b.jsx)(k.EditorContent,{editor:H})})]})}var X=a.i(25668),Y=a.i(598169),Z=a.i(551798),$=a.i(784257),_=a.i(396439),aa=a.i(790107);let ab=(0,x.default)("forward",[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]),ac=(0,x.default)("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);var ad=a.i(340490),ae=a.i(613348);let af=(0,x.default)("shield-alert",[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var ag=a.i(340233),ah=a.i(450817),ai=a.i(946621),aj=a.i(586220),ak=a.i(559745),al=a.i(135510);function am(a){let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return e<7?`${e}d ago`:b.toLocaleDateString(void 0,{month:"short",day:"numeric"})}a.s(["default",0,function(){let a=(0,d.useParams)().id,{workspaceId:k}=(0,e.useWorkspace)(),{agents:l,subscribeWs:m}=(0,f.useAgentContext)(),n=l.find(b=>b.id===a),o=(0,aj.useIsMobile)(),[p,q]=(0,c.useState)("inbox"),[r,s]=(0,c.useState)([]),v=(0,c.useMemo)(()=>r.filter(a=>"unread"===a.status).length,[r]),[w,x]=(0,c.useState)(!0),[y,z]=(0,c.useState)(null),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)({}),[I,J]=(0,c.useState)([]),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)({}),[O,P]=(0,c.useState)(!1),[S,an]=(0,c.useState)(null),[ao,ap]=(0,c.useState)(!1),[aq,ar]=(0,c.useState)(!1),[as,at]=(0,c.useState)([]),[au,av]=(0,c.useState)(!1),aw=(0,c.useCallback)(a=>{q(a),s([]),z(null),B(null),F(!1)},[]),ax=n?.email_handle?(0,h.toAlookAddress)(n.email_handle):"",ay=[...ax?[{type:"alook",address:ax}]:[],...as.map(a=>({type:"custom",address:a.email_address,accountId:a.id}))],[az,aA]=(0,c.useState)(0),aB=ay[az]??ay[0]??null,aC=aB?.address??"",aD=aB?.type==="custom"?aB.accountId:void 0,aE=r.find(a=>a.id===y)??null,aF=(0,c.useCallback)(async(b,c)=>{x(!0);try{let d=await (0,g.listEmails)(a,k,b,c);s(d)}catch{Q.toast.error("Failed to load emails")}finally{x(!1)}},[a,k]);(0,c.useEffect)(()=>{(0,g.listEmailAccounts)(a,k).then(at).catch(()=>{})},[a,k]),(0,c.useEffect)(()=>{aF(p,aC)},[p,aC,aF]),(0,c.useEffect)(()=>m(b=>{"email.received"===b.type&&b.agentId===a?((0,ai.trackEmailReceived)({agent_id:a,mailbox_type:aB?.type==="custom"?"imap":"alook"}),aF(p,aC)):"email.sent"===b.type&&b.agentId===a&&aF(p,aC)}),[m,a,p,aC,aF,aB?.type]);let aG=async a=>{F(!1),z(a),B(null),D(!0),J([]),L(null),N({});try{let[b,c]=await Promise.all([(0,g.getEmailBody)(a,k),(0,g.getEmailThread)(a,k).catch(()=>[])]);B(b),J(c);let d=r.find(b=>b.id===a);d&&"unread"===d.status&&(0,g.updateEmailStatus)(a,k,"read").then(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"read"}:b))}).catch(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"unread"}:b))})}catch{B({content:"(body not available)",isHtml:!1})}finally{D(!1)}},aH=async a=>{if(K===a)return void L(null);if(L(a),!M[a])try{let b=await (0,g.getEmailBody)(a,k);N(c=>({...c,[a]:b}))}catch{N(b=>({...b,[a]:{content:"(body not available)",isHtml:!1}}))}},aI=async()=>{if(S){ap(!0);try{await (0,g.deleteEmail)(S,k),s(a=>a.filter(a=>a.id!==S)),y===S&&(z(null),B(null)),Q.toast.success("Email deleted")}catch{Q.toast.error("Failed to delete email")}finally{ap(!1),P(!1),an(null)}}},aJ=async(b,c,d,e,f)=>{try{return await (0,g.sendEmail)(a,b,c,d,k,e.length>0?e:void 0,f,aD),(0,ai.trackEmailComposed)({agent_id:a,has_attachments:e.length>0}),Q.toast.success("Email sent"),F(!1),aw("sent"),!0}catch{return Q.toast.error("Failed to send email"),!1}},aK=a=>`<br/><br/><div style="border-left: 2px solid #ccc; padding-left: 12px; margin-left: 0; color: #666;"><p><strong>From:</strong> ${a.from_email}<br/><strong>To:</strong> ${a.to_email}<br/><strong>Date:</strong> ${new Date(a.created_at).toLocaleString()}<br/><strong>Subject:</strong> ${a.subject}</p>`+(a.html_body?a.html_body:A?.isHtml?A.content:`<pre>${A?.content??""}</pre>`)+"</div>",aL=a=>({inReplyTo:a.message_id||void 0,references:[a.references,a.message_id].filter(Boolean).join(" ").trim()||void 0}),aM=async a=>{ar(!0);try{await (0,g.trustEmail)(a.id,k),Q.toast.success("Email trusted and sent to agent"),s(b=>b.filter(b=>b.id!==a.id)),z(null)}catch{Q.toast.error("Failed to trust email")}finally{ar(!1)}},[aN,aO]=(0,c.useState)(!1),aP=async()=>{if(aC)try{await navigator.clipboard.writeText(aC),aO(!0),setTimeout(()=>aO(!1),1500)}catch{Q.toast.error("Failed to copy")}},aQ=(0,b.jsxs)("div",{className:"flex h-full flex-col",children:[ay.length>0?(0,b.jsx)("div",{className:"px-3 pt-3 pb-1 relative",children:1===ay.length?(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"group flex items-center gap-1.5 text-left cursor-pointer w-full"}),children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500 shrink-0"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/0 group-hover:text-muted-foreground/60 shrink-0 transition-colors"})]}),(0,b.jsx)(u.TooltipContent,{children:"Click to copy"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 w-full",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>av(!au),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),(0,b.jsx)(ah.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"shrink-0 p-0.5"}),children:aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),au&&(0,b.jsx)("div",{className:"absolute left-2 right-2 top-full mt-0.5 z-10 rounded-lg border border-border bg-popover shadow-md py-1",children:ay.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{aA(c),av(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===az?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]})}):(0,b.jsx)("div",{className:"px-3 pt-3 pb-1",children:(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:"No email configured"})}),(0,b.jsx)("div",{className:"p-2",children:(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{size:"sm",className:"w-full justify-start text-xs h-8 gap-1.5",onClick:()=>{H({}),F(!0),z(null)},disabled:0===ay.length}),children:[(0,b.jsx)(_.Plus,{className:"size-3.5"}),"New Email"]}),(0,b.jsx)(u.TooltipContent,{children:0===ay.length?"Configure an email in agent settings to send emails":"Compose new email"})]})}),(0,b.jsxs)("nav",{className:"flex flex-col gap-0.5 px-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>aw("inbox"),className:(0,t.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","inbox"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,b.jsx)($.Inbox,{className:"size-4 shrink-0"}),"Inbox","inbox"===p&&v>0&&(0,b.jsx)("span",{className:"ml-auto text-xs bg-blue-500 text-white rounded-full px-1.5 py-0.5 leading-none min-w-5 text-center",children:v})]}),(0,b.jsxs)("button",{type:"button",onClick:()=>aw("sent"),className:(0,t.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","sent"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,b.jsx)(R.Send,{className:"size-4 shrink-0"}),"Sent"]}),(0,b.jsxs)("button",{type:"button",onClick:()=>aw("untrust"),className:(0,t.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","untrust"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,b.jsx)(af,{className:"size-4 shrink-0"}),"Untrust"]})]})]}),aR=(0,b.jsx)("div",{className:(0,t.cn)("h-full thin-scrollbar",r.length>0&&!w?"overflow-y-auto":"overflow-hidden"),children:w?(0,b.jsx)(b.Fragment,{children:Array.from({length:3}).map((a,c)=>(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-32"}),(0,b.jsx)(X.Skeleton,{className:"h-2.5 w-10"})]}),(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-48 mb-1.5"}),(0,b.jsx)(X.Skeleton,{className:"h-4 w-16 rounded-full"})]},c))}):0===r.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(Z.Mail,{className:"size-8 text-muted-foreground mb-3"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"inbox"===p?"No emails from trusted senders":"sent"===p?"No emails sent yet":"No untrusted emails"})]}):r.map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>aG(a.id),className:(0,t.cn)("w-full text-left px-4 py-3 border-b border-border/30 transition-colors duration-150 cursor-pointer",y===a.id?"bg-accent/60":"hover:bg-accent/30"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[(0,b.jsx)("p",{className:(0,t.cn)("text-sm truncate","unread"===a.status?"font-semibold":"font-medium text-muted-foreground"),children:"sent"===p?a.to_email:a.from_email}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:["sent"!==p&&(0,b.jsx)("span",{className:(0,t.cn)("text-[10px] rounded-full px-1.5 py-0.5 leading-none font-medium","unread"===a.status?"bg-blue-500/15 text-blue-600 dark:text-blue-400":"bg-muted text-muted-foreground"),children:"unread"===a.status?"unread":"read"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:am(a.created_at)})]})]}),(0,b.jsx)("p",{className:(0,t.cn)("text-[13px] truncate","unread"===a.status?"text-foreground":"text-muted-foreground"),children:a.subject||"(no subject)"})]},a.id))}),aS=(0,b.jsx)("div",{className:"h-full overflow-auto flex flex-col min-w-0 thin-scrollbar",children:E?(0,b.jsx)(W,{fromAddress:aC,onSend:aJ,onDiscard:()=>{F(!1),H({})},initialTo:G.to,initialSubject:G.subject,initialBody:G.body,initialAttachments:G.attachments,inReplyTo:G.inReplyTo,references:G.references},JSON.stringify(G)):aE?(0,b.jsxs)("div",{className:"flex flex-col h-full md:min-w-100 max-w-3xl mx-auto w-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-0.5 border-b border-border/40 px-4 py-1.5",children:["untrust"===p&&(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",disabled:aq,onClick:()=>aM(aE)}),children:aq?(0,b.jsx)(T.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(ag.ShieldCheck,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Trust this email"})]}),"sent"!==p&&(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aE.subject.startsWith("Re:")?aE.subject:`Re: ${aE.subject}`,void(z(null),H({to:aE.from_email,subject:a,body:aK(aE),...aL(aE)}),F(!0))}}),children:(0,b.jsx)(ac,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Reply"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aE.subject.startsWith("Fwd:")?aE.subject:`Fwd: ${aE.subject}`,void(z(null),H({subject:a,body:aK(aE),attachments:aE.attachments??[],...aL(aE)}),F(!0))}}),children:(0,b.jsx)(ab,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Forward"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-destructive",onClick:()=>{an(aE.id),P(!0)}}),children:(0,b.jsx)(aa.Trash2,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Delete"})]})]}),I.length>0&&(0,b.jsx)("div",{className:"border-b border-border/30",children:I.map(a=>(0,b.jsxs)("div",{className:"border-b border-border/20 last:border-b-0",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>aH(a.id),className:"w-full flex items-center gap-2 px-5 py-2.5 text-left hover:bg-accent/30 transition-colors cursor-pointer",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:K===a.id?"▾":"▸"}),(0,b.jsx)("span",{className:"text-sm font-medium truncate flex-1",children:a.from_email}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:am(a.created_at)})]}),K===a.id&&(0,b.jsxs)("div",{className:"px-5 pb-3",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:a.subject}),M[a.id]?M[a.id].isHtml?(0,b.jsx)(al.EmailBodyFrame,{html:M[a.id].content,className:"max-w-full text-sm"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:M[a.id].content}):(0,b.jsx)(T.Loader2,{className:"size-3 animate-spin text-muted-foreground"})]})]},a.id))}),(0,b.jsxs)("div",{className:"p-5",children:[(0,b.jsx)("h2",{className:"text-lg font-heading font-semibold tracking-tight mb-1",children:aE.subject||"(no subject)"}),(0,b.jsxs)("div",{className:"text-sm space-y-1 mb-5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{children:aE.from_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("span",{children:aE.to_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"sent"===p?"Sent":"Received"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:new Date(aE.created_at).toLocaleString()})]})]}),C?(0,b.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,b.jsx)(T.Loader2,{className:"size-4 animate-spin text-muted-foreground"})}):aE.html_body?(0,b.jsx)(al.EmailBodyFrame,{html:aE.html_body,className:"max-w-full"}):A?.isHtml?(0,b.jsx)(al.EmailBodyFrame,{html:A.content,className:"max-w-full"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:A?.content}),aE.attachments&&aE.attachments.length>0&&(0,b.jsxs)("div",{className:"mt-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mb-2 text-xs text-muted-foreground",children:[(0,b.jsx)(U.Paperclip,{className:"size-3"}),aE.attachments.length," attachment",aE.attachments.length>1?"s":""]}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:aE.attachments.map((a,c)=>(0,b.jsxs)("a",{href:`/api/email/${aE.id}/attachment/${c}?workspace_id=${k}`,target:"_blank",rel:"noopener noreferrer",download:a.filename,className:"flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/50 px-2.5 py-1.5 text-xs hover:bg-muted transition-colors cursor-pointer",children:[(0,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-45",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:a.size<1024?`${a.size} B`:a.size<1048576?`${(a.size/1024).toFixed(1)} KB`:`${(a.size/1048576).toFixed(1)} MB`})]},a.key))})]})]})]}):(0,b.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select an email to view"})}),aT=E?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{F(!1),H({})},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"New Email"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aS})]}):y&&aE?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{z(null),B(null)},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium truncate",children:aE.subject||"(no subject)"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aS})]}):(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[ay.length>1&&(0,b.jsxs)("div",{className:"relative px-3 pt-2 pb-1 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>av(!au),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),(0,b.jsx)(ah.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"shrink-0 p-0.5"}),children:aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),au&&(0,b.jsx)("div",{className:"absolute left-2 right-2 top-full mt-0.5 z-10 rounded-lg border border-border bg-popover shadow-md py-1",children:ay.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{aA(c),av(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===az?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)("div",{className:"flex items-center gap-0.5 flex-1 min-w-0",children:[{id:"inbox",label:"Inbox"},{id:"sent",label:"Sent"},{id:"untrust",label:"Untrust"}].map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>aw(a.id),className:(0,t.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors",p===a.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.label,"inbox"===a.id&&"inbox"===p&&v>0&&(0,b.jsx)("span",{className:"ml-0.5 text-[10px] bg-blue-500 text-white rounded-full px-1 leading-none min-w-4 text-center",children:v})]},a.id))}),(0,b.jsx)(i.Button,{size:"icon-sm",variant:"ghost",onClick:()=>{H({}),F(!0),z(null)},disabled:0===ay.length,children:(0,b.jsx)(_.Plus,{className:"size-4"})})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aR})]});return(0,b.jsxs)(b.Fragment,{children:[o?aT:(0,b.jsxs)(ak.ResizablePanelGroup,{orientation:"horizontal",children:[(0,b.jsx)(ak.ResizablePanel,{defaultSize:"15%",minSize:"10%",maxSize:"20%",children:aQ}),(0,b.jsx)(ak.ResizableHandle,{withHandle:!0}),(0,b.jsx)(ak.ResizablePanel,{defaultSize:"30%",minSize:"15%",maxSize:"40%",children:aR}),(0,b.jsx)(ak.ResizableHandle,{withHandle:!0}),(0,b.jsx)(ak.ResizablePanel,{defaultSize:"55%",minSize:"25%",children:aS})]}),(0,b.jsx)(j.ConfirmDialog,{open:O,onOpenChange:P,title:"Delete email",description:"This will permanently delete this email.",loading:ao,onConfirm:aI})]})}],221781)}];
|
|
1
|
+
module.exports=[221781,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(630991),e=a.i(506180),f=a.i(752792),g=a.i(588339);a.i(974936);var h=a.i(911509),i=a.i(732254),j=a.i(22902),k=a.i(983039),l=a.i(728778),m=a.i(443354),n=a.i(450274),o=a.i(297897),p=a.i(317703),q=p.Extension.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:a=>{let b=a.style.textAlign;return this.options.alignments.includes(b)?b:this.options.defaultAlignment},renderHTML:a=>a.textAlign?{style:`text-align: ${a.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:a=>({commands:b})=>!!this.options.alignments.includes(a)&&this.options.types.map(c=>b.updateAttributes(c,{textAlign:a})).some(a=>a),unsetTextAlign:()=>({commands:a})=>this.options.types.map(b=>a.resetAttributes(b,"textAlign")).some(a=>a),toggleTextAlign:a=>({editor:b,commands:c})=>!!this.options.alignments.includes(a)&&(b.isActive({textAlign:a})?c.unsetTextAlign():c.setTextAlign(a))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),r=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,s=p.Node.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:a}){return["img",(0,p.mergeAttributes)(this.options.HTMLAttributes,a)]},parseMarkdown:(a,b)=>b.createNode("image",{src:a.href,title:a.title,alt:a.text}),renderMarkdown:a=>{var b,c,d,e,f,g;let h=null!=(c=null==(b=a.attrs)?void 0:b.src)?c:"",i=null!=(e=null==(d=a.attrs)?void 0:d.alt)?e:"",j=null!=(g=null==(f=a.attrs)?void 0:f.title)?g:"";return j?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:a,minWidth:b,minHeight:c,alwaysPreserveAspectRatio:d}=this.options.resize;return({node:e,getPos:f,HTMLAttributes:g,editor:h})=>{let i=document.createElement("img");i.draggable=!1;let j=(0,p.mergeAttributes)(this.options.HTMLAttributes,g);Object.entries(j).forEach(([a,b])=>{if(null!=b)switch(a){case"width":case"height":break;default:i.setAttribute(a,b)}}),null!==j.src&&(i.src=j.src);let k=new p.ResizableNodeView({element:i,editor:h,node:e,getPos:f,onResize:(a,b)=>{i.style.width=`${a}px`,i.style.height=`${b}px`},onCommit:(a,b)=>{let c=f();void 0!==c&&this.editor.chain().setNodeSelection(c).updateAttributes(this.name,{width:a,height:b}).run()},onUpdate:(a,b,c)=>a.type===e.type,options:{directions:a,min:{width:b,height:c},preserveAspectRatio:!0===d}}),l=k.dom;return l.style.visibility="hidden",l.style.pointerEvents="none",i.onload=()=>{l.style.visibility="",l.style.pointerEvents=""},k}},addCommands(){return{setImage:a=>({commands:b})=>b.insertContent({type:this.name,attrs:a})}},addInputRules(){return[(0,p.nodeInputRule)({find:r,type:this.type,getAttributes:a=>{let[,,b,c,d]=a;return{src:c,alt:b,title:d}}})]}}),t=a.i(75118),u=a.i(525132),v=a.i(432340),w=a.i(334235),x=a.i(410732);let y=(0,x.default)("bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]),z=(0,x.default)("italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]),A=(0,x.default)("underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]),B=(0,x.default)("strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]),C=(0,x.default)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),D=(0,x.default)("list-ordered",[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]),E=(0,x.default)("text-align-start",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]]),F=(0,x.default)("text-align-center",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 19H5",key:"vjpgq2"}]]),G=(0,x.default)("text-align-end",[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 19H7",key:"4cu937"}]]),H=(0,x.default)("link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]),I=(0,x.default)("unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);var J=a.i(611606),J=J;let K=(0,x.default)("heading-1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]),L=(0,x.default)("heading-2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);var M=a.i(995900),M=M;function N({active:a,disabled:c,onAction:d,title:e,children:f}){return(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:c,onMouseDown:a=>a.preventDefault(),onClick:d,className:(0,t.cn)("text-muted-foreground/70",a&&"bg-accent text-foreground")}),children:f}),(0,b.jsx)(u.TooltipContent,{children:e})]})}function O(){return(0,b.jsx)("div",{className:"w-px h-4 bg-border/60 mx-0.5 shrink-0"})}function P({editor:a}){let[,d]=(0,c.useReducer)(a=>a+1,0),[e,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)("link"),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),s=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!a)return;let b=()=>d();return a.on("transaction",b),()=>{a.off("transaction",b)}},[a]),(0,c.useEffect)(()=>{e&&setTimeout(()=>r.current?.focus(),0)},[e]),!a)return null;let x="size-3.5",Q=()=>{let b=j.trim();if(b){try{new URL(b)}catch{m("Please enter a valid URL");return}if(m(""),"link"===g)if(p){let c=n.trim()||b;a.chain().focus().insertContent({type:"text",text:c,marks:[{type:"link",attrs:{href:b}}]}).run()}else a.chain().focus().extendMarkRange("link").setLink({href:b}).run();else a.chain().focus().setImage({src:b}).run();f(!1)}};return(0,b.jsxs)("div",{className:"flex items-center gap-0.5 px-3 py-1 overflow-x-auto",children:[(0,b.jsx)(N,{title:"Bold",active:a.isActive("bold"),onAction:()=>a.chain().focus().toggleBold().run(),children:(0,b.jsx)(y,{className:x})}),(0,b.jsx)(N,{title:"Italic",active:a.isActive("italic"),onAction:()=>a.chain().focus().toggleItalic().run(),children:(0,b.jsx)(z,{className:x})}),(0,b.jsx)(N,{title:"Underline",active:a.isActive("underline"),onAction:()=>a.chain().focus().toggleUnderline().run(),children:(0,b.jsx)(A,{className:x})}),(0,b.jsx)(N,{title:"Strikethrough",active:a.isActive("strike"),onAction:()=>a.chain().focus().toggleStrike().run(),children:(0,b.jsx)(B,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Heading 1",active:a.isActive("heading",{level:1}),onAction:()=>a.chain().focus().toggleHeading({level:1}).run(),children:(0,b.jsx)(K,{className:x})}),(0,b.jsx)(N,{title:"Heading 2",active:a.isActive("heading",{level:2}),onAction:()=>a.chain().focus().toggleHeading({level:2}).run(),children:(0,b.jsx)(L,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Bullet List",active:a.isActive("bulletList"),onAction:()=>a.chain().focus().toggleBulletList().run(),children:(0,b.jsx)(C,{className:x})}),(0,b.jsx)(N,{title:"Ordered List",active:a.isActive("orderedList"),onAction:()=>a.chain().focus().toggleOrderedList().run(),children:(0,b.jsx)(D,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Align Left",active:a.isActive({textAlign:"left"}),onAction:()=>a.chain().focus().setTextAlign("left").run(),children:(0,b.jsx)(E,{className:x})}),(0,b.jsx)(N,{title:"Align Center",active:a.isActive({textAlign:"center"}),onAction:()=>a.chain().focus().setTextAlign("center").run(),children:(0,b.jsx)(F,{className:x})}),(0,b.jsx)(N,{title:"Align Right",active:a.isActive({textAlign:"right"}),onAction:()=>a.chain().focus().setTextAlign("right").run(),children:(0,b.jsx)(G,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onMouseDown:b=>{b.preventDefault(),s.current=a.isActive("link")},onClick:()=>{s.current?a.chain().focus().unsetLink().run():(h("link"),k(""),m(""),o(""),q(a.state.selection.empty),f(!0))},className:(0,t.cn)("text-muted-foreground/70",a.isActive("link")&&"bg-accent text-foreground")}),children:a.isActive("link")?(0,b.jsx)(I,{className:x}):(0,b.jsx)(H,{className:x})}),(0,b.jsx)(u.TooltipContent,{children:a.isActive("link")?"Remove Link":"Insert Link"})]}),(0,b.jsx)(N,{title:"Insert Image",onAction:()=>{h("image"),k(""),m(""),f(!0)},children:(0,b.jsx)(J.default,{className:x})}),(0,b.jsx)(O,{}),(0,b.jsx)(N,{title:"Horizontal Rule",onAction:()=>a.chain().focus().setHorizontalRule().run(),children:(0,b.jsx)(M.default,{className:x})}),(0,b.jsx)(v.Dialog,{open:e,onOpenChange:f,children:(0,b.jsxs)(v.DialogContent,{children:[(0,b.jsx)(v.DialogHeader,{children:(0,b.jsx)(v.DialogTitle,{children:"link"===g?"Insert Link":"Insert Image"})}),"link"===g&&p&&(0,b.jsx)(w.Input,{ref:r,value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"Display text"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(w.Input,{ref:"image"!==g&&p?void 0:r,value:j,onChange:a=>{k(a.target.value),m("")},onKeyDown:a=>{"Enter"===a.key&&Q()},placeholder:"link"===g?"https://example.com":"https://example.com/image.png",type:"url","aria-invalid":!!l}),l&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:l})]}),(0,b.jsx)(v.DialogFooter,{children:(0,b.jsx)(i.Button,{onClick:Q,disabled:!j.trim(),children:"Insert"})})]})})]})}var Q=a.i(780956),R=a.i(554705),S=a.i(351360),T=a.i(84096),U=a.i(343558),V=a.i(354875);function W({fromAddress:d,onSend:e,onDiscard:f,initialTo:g="",initialSubject:h="",initialBody:j="",initialAttachments:p=[],inReplyTo:r,references:t}){let[v,x]=(0,c.useState)(g),[y,z]=(0,c.useState)(h),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(p),[E,F]=(0,c.useState)(!1),G=(0,c.useRef)(null),H=(0,k.useEditor)({immediatelyRender:!1,content:j||void 0,extensions:[l.default.configure({link:!1,underline:!1}),m.default.configure({placeholder:"Write your email..."}),n.default,o.default.configure({autolink:!0,openOnClick:!1,linkOnPaste:!0}),q.configure({types:["heading","paragraph"]}),s.configure({inline:!0,allowBase64:!0})],editorProps:{attributes:{class:"text-sm max-w-none focus:outline-none min-h-50 px-4 py-3"}}}),I=async()=>{if(v.trim()&&y.trim()&&H){B(!0);try{let a=H.getHTML();await e(v.trim(),y.trim(),a,C,r||t?{inReplyTo:r,references:t}:void 0)&&(x(""),z(""),D([]),H.commands.clearContent())}finally{B(!1)}}},J=async b=>{let c=b.target.files;if(c&&0!==c.length){F(!0);try{let{uploadEmailAttachment:b}=await a.A(81396);for(let a of Array.from(c)){if(a.size>0xa00000){Q.toast.error(`${a.name} exceeds 10 MB limit`);continue}let c=new URLSearchParams(window.location.search).get("workspace_id")??"",d=await b(a,c);D(a=>[...a,d])}}catch{Q.toast.error("Failed to upload attachment")}finally{F(!1),G.current&&(G.current.value="")}}};return(0,b.jsxs)("div",{className:"flex flex-col h-full w-full min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2",children:[(0,b.jsx)("h3",{className:"text-sm font-heading font-medium tracking-tight",children:"New Email"}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(i.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground h-7 px-2",onClick:f,disabled:A,children:[(0,b.jsx)(S.X,{className:"size-3 mr-1"}),"Discard"]}),(0,b.jsxs)(i.Button,{size:"sm",className:"text-xs h-7 px-3",onClick:I,disabled:A||!v.trim()||!y.trim(),children:[A?(0,b.jsx)(T.Loader2,{className:"size-3 mr-1 animate-spin"}):(0,b.jsx)(R.Send,{className:"size-3 mr-1"}),"Send"]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border/30 px-4 py-2.5 space-y-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{className:"text-muted-foreground truncate min-w-0",children:d})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{type:"email",value:v,onChange:a=>x(a.target.value),placeholder:"recipient@example.com",className:"h-7 text-sm border-0 bg-transparent px-1.5 shadow-none focus-visible:ring-0 placeholder:text-muted-foreground/50",disabled:A})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"Subject"}),(0,b.jsx)("div",{className:"flex-1 min-w-0 -ml-1.5 rounded-md bg-muted/40",children:(0,b.jsx)(w.Input,{value:y,onChange:a=>z(a.target.value),placeholder:"Email subject",className:"h-7 text-sm border-0 bg-transparent px-1.5 shadow-none focus-visible:ring-0 placeholder:text-muted-foreground/50",disabled:A})})]})]}),(0,b.jsxs)("div",{className:"flex items-center border-b border-border/30",children:[(0,b.jsx)(P,{editor:H}),(0,b.jsxs)("div",{className:"flex items-center gap-1 px-2 border-l border-border/30",children:[(0,b.jsx)("input",{ref:G,type:"file",multiple:!0,className:"hidden",onChange:J}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",disabled:E,onMouseDown:a=>a.preventDefault(),onClick:()=>G.current?.click(),className:"text-muted-foreground/70"}),children:E?(0,b.jsx)(T.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(U.Paperclip,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Attach file"})]})]})]}),C.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5 px-4 py-2 border-b border-border/30",children:C.map(a=>{var c;return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs",children:[(0,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-37.5",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:(c=a.size)<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1048576).toFixed(1)} MB`}),(0,b.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.key,void D(a=>a.filter(a=>a.key!==b))},className:"text-muted-foreground hover:text-foreground ml-0.5 cursor-pointer",children:(0,b.jsx)(S.X,{className:"size-3"})})]},a.key)})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar",children:(0,b.jsx)(k.EditorContent,{editor:H})})]})}var X=a.i(25668),Y=a.i(598169),Z=a.i(551798),$=a.i(784257),_=a.i(396439),aa=a.i(790107);let ab=(0,x.default)("forward",[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]),ac=(0,x.default)("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);var ad=a.i(340490),ae=a.i(613348);let af=(0,x.default)("shield-alert",[["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"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var ag=a.i(340233),ah=a.i(450817),ai=a.i(946621),aj=a.i(586220),ak=a.i(559745),al=a.i(135510);function am(a){let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return e<7?`${e}d ago`:b.toLocaleDateString(void 0,{month:"short",day:"numeric"})}a.s(["default",0,function(){let a=(0,d.useParams)().id,{workspaceId:k}=(0,e.useWorkspace)(),{agents:l,subscribeWs:m}=(0,f.useAgentContext)(),n=l.find(b=>b.id===a),o=(0,aj.useIsMobile)(),[p,q]=(0,c.useState)("inbox"),[r,s]=(0,c.useState)([]),v=(0,c.useMemo)(()=>r.filter(a=>"unread"===a.status).length,[r]),[w,x]=(0,c.useState)(!0),[y,z]=(0,c.useState)(null),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)({}),[I,J]=(0,c.useState)([]),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)({}),[O,P]=(0,c.useState)(!1),[S,an]=(0,c.useState)(null),[ao,ap]=(0,c.useState)(!1),[aq,ar]=(0,c.useState)(!1),[as,at]=(0,c.useState)([]),[au,av]=(0,c.useState)(!1),aw=(0,c.useCallback)(a=>{q(a),s([]),z(null),B(null),F(!1)},[]),ax=n?.email_handle?(0,h.toAlookAddress)(n.email_handle):"",ay=[...ax?[{type:"alook",address:ax}]:[],...as.map(a=>({type:"custom",address:a.email_address,accountId:a.id}))],[az,aA]=(0,c.useState)(0),aB=ay[az]??ay[0]??null,aC=aB?.address??"",aD=aB?.type==="custom"?aB.accountId:void 0,aE=r.find(a=>a.id===y)??null,aF=(0,c.useCallback)(async(b,c)=>{x(!0);try{let d=await (0,g.listEmails)(a,k,b,c);s(d)}catch{Q.toast.error("Failed to load emails")}finally{x(!1)}},[a,k]);(0,c.useEffect)(()=>{(0,g.listEmailAccounts)(a,k).then(at).catch(()=>{})},[a,k]),(0,c.useEffect)(()=>{aF(p,aC)},[p,aC,aF]),(0,c.useEffect)(()=>m(b=>{"email.received"===b.type&&b.agentId===a?((0,ai.trackEmailReceived)({agent_id:a,mailbox_type:aB?.type==="custom"?"imap":"alook"}),aF(p,aC)):"email.sent"===b.type&&b.agentId===a&&aF(p,aC)}),[m,a,p,aC,aF,aB?.type]);let aG=async a=>{F(!1),z(a),B(null),D(!0),J([]),L(null),N({});try{let[b,c]=await Promise.all([(0,g.getEmailBody)(a,k),(0,g.getEmailThread)(a,k).catch(()=>[])]);B(b),J(c);let d=r.find(b=>b.id===a);d&&"unread"===d.status&&(0,g.updateEmailStatus)(a,k,"read").then(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"read"}:b))}).catch(()=>{s(b=>b.map(b=>b.id===a?{...b,status:"unread"}:b))})}catch{B({content:"(body not available)",isHtml:!1})}finally{D(!1)}},aH=async a=>{if(K===a)return void L(null);if(L(a),!M[a])try{let b=await (0,g.getEmailBody)(a,k);N(c=>({...c,[a]:b}))}catch{N(b=>({...b,[a]:{content:"(body not available)",isHtml:!1}}))}},aI=async()=>{if(S){ap(!0);try{await (0,g.deleteEmail)(S,k),s(a=>a.filter(a=>a.id!==S)),y===S&&(z(null),B(null)),Q.toast.success("Email deleted")}catch{Q.toast.error("Failed to delete email")}finally{ap(!1),P(!1),an(null)}}},aJ=async(b,c,d,e,f)=>{try{return await (0,g.sendEmail)(a,b,c,d,k,e.length>0?e:void 0,f,aD),(0,ai.trackEmailComposed)({agent_id:a,has_attachments:e.length>0}),Q.toast.success("Email sent"),F(!1),aw("sent"),!0}catch{return Q.toast.error("Failed to send email"),!1}},aK=a=>`<br/><br/><div style="border-left: 2px solid #ccc; padding-left: 12px; margin-left: 0; color: #666;"><p><strong>From:</strong> ${a.from_email}<br/><strong>To:</strong> ${a.to_email}<br/><strong>Date:</strong> ${new Date(a.created_at).toLocaleString()}<br/><strong>Subject:</strong> ${a.subject}</p>`+(a.html_body?a.html_body:A?.isHtml?A.content:`<pre>${A?.content??""}</pre>`)+"</div>",aL=a=>({inReplyTo:a.message_id||void 0,references:[a.references,a.message_id].filter(Boolean).join(" ").trim()||void 0}),aM=async a=>{ar(!0);try{await (0,g.trustEmail)(a.id,k),Q.toast.success("Email trusted and sent to agent"),s(b=>b.filter(b=>b.id!==a.id)),z(null)}catch{Q.toast.error("Failed to trust email")}finally{ar(!1)}},[aN,aO]=(0,c.useState)(!1),aP=async()=>{if(aC)try{await navigator.clipboard.writeText(aC),aO(!0),setTimeout(()=>aO(!1),1500)}catch{Q.toast.error("Failed to copy")}},aQ=(0,b.jsxs)("div",{className:"flex h-full flex-col",children:[ay.length>0?(0,b.jsx)("div",{className:"px-3 pt-3 pb-1 relative",children:1===ay.length?(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"group flex items-center gap-1.5 text-left cursor-pointer w-full"}),children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500 shrink-0"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/0 group-hover:text-muted-foreground/60 shrink-0 transition-colors"})]}),(0,b.jsx)(u.TooltipContent,{children:"Click to copy"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 w-full",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>av(!au),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),(0,b.jsx)(ah.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"shrink-0 p-0.5"}),children:aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),au&&(0,b.jsx)("div",{className:"absolute left-2 right-2 top-full mt-0.5 z-10 rounded-lg border border-border bg-popover shadow-md py-1",children:ay.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{aA(c),av(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===az?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]})}):(0,b.jsx)("div",{className:"px-3 pt-3 pb-1",children:(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:"No email configured"})}),(0,b.jsx)("div",{className:"p-2",children:(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsxs)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{size:"sm",className:"w-full justify-start text-xs h-8 gap-1.5",onClick:()=>{H({}),F(!0),z(null)},disabled:0===ay.length}),children:[(0,b.jsx)(_.Plus,{className:"size-3.5"}),"New Email"]}),(0,b.jsx)(u.TooltipContent,{children:0===ay.length?"Configure an email in agent settings to send emails":"Compose new email"})]})}),(0,b.jsxs)("nav",{className:"flex flex-col gap-0.5 px-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>aw("inbox"),className:(0,t.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","inbox"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,b.jsx)($.Inbox,{className:"size-4 shrink-0"}),"Inbox","inbox"===p&&v>0&&(0,b.jsx)("span",{className:"ml-auto text-xs bg-blue-500 text-white rounded-full px-1.5 py-0.5 leading-none min-w-5 text-center",children:v})]}),(0,b.jsxs)("button",{type:"button",onClick:()=>aw("sent"),className:(0,t.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","sent"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,b.jsx)(R.Send,{className:"size-4 shrink-0"}),"Sent"]}),(0,b.jsxs)("button",{type:"button",onClick:()=>aw("untrust"),className:(0,t.cn)("flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer","untrust"===p?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[(0,b.jsx)(af,{className:"size-4 shrink-0"}),"Untrust"]})]})]}),aR=(0,b.jsx)("div",{className:(0,t.cn)("h-full thin-scrollbar",r.length>0&&!w?"overflow-y-auto":"overflow-hidden"),children:w?(0,b.jsx)(b.Fragment,{children:Array.from({length:3}).map((a,c)=>(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-32"}),(0,b.jsx)(X.Skeleton,{className:"h-2.5 w-10"})]}),(0,b.jsx)(X.Skeleton,{className:"h-3.5 w-48 mb-1.5"}),(0,b.jsx)(X.Skeleton,{className:"h-4 w-16 rounded-full"})]},c))}):0===r.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(Z.Mail,{className:"size-8 text-muted-foreground mb-3"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"inbox"===p?"No emails from trusted senders":"sent"===p?"No emails sent yet":"No untrusted emails"})]}):r.map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>aG(a.id),className:(0,t.cn)("w-full text-left px-4 py-3 border-b border-border/30 transition-colors duration-150 cursor-pointer",y===a.id?"bg-accent/60":"hover:bg-accent/30"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-0.5",children:[(0,b.jsx)("p",{className:(0,t.cn)("text-sm truncate","unread"===a.status?"font-semibold":"font-medium text-muted-foreground"),children:"sent"===p?a.to_email:a.from_email}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:["sent"!==p&&(0,b.jsx)("span",{className:(0,t.cn)("text-[10px] rounded-full px-1.5 py-0.5 leading-none font-medium","unread"===a.status?"bg-blue-500/15 text-blue-600 dark:text-blue-400":"bg-muted text-muted-foreground"),children:"unread"===a.status?"unread":"read"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:am(a.created_at)})]})]}),(0,b.jsx)("p",{className:(0,t.cn)("text-[13px] truncate","unread"===a.status?"text-foreground":"text-muted-foreground"),children:a.subject||"(no subject)"})]},a.id))}),aS=(0,b.jsx)("div",{className:"h-full overflow-auto flex flex-col min-w-0 thin-scrollbar",children:E?(0,b.jsx)(W,{fromAddress:aC,onSend:aJ,onDiscard:()=>{F(!1),H({})},initialTo:G.to,initialSubject:G.subject,initialBody:G.body,initialAttachments:G.attachments,inReplyTo:G.inReplyTo,references:G.references},JSON.stringify(G)):aE?(0,b.jsxs)("div",{className:"flex flex-col h-full md:min-w-100 max-w-3xl mx-auto w-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-0.5 border-b border-border/40 px-4 py-1.5",children:["untrust"===p&&(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",disabled:aq,onClick:()=>aM(aE)}),children:aq?(0,b.jsx)(T.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(ag.ShieldCheck,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Trust this email"})]}),"sent"!==p&&(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aE.subject.startsWith("Re:")?aE.subject:`Re: ${aE.subject}`,void(z(null),H({to:aE.from_email,subject:a,body:aK(aE),...aL(aE)}),F(!0))}}),children:(0,b.jsx)(ac,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Reply"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-foreground",onClick:()=>{let a;return a=aE.subject.startsWith("Fwd:")?aE.subject:`Fwd: ${aE.subject}`,void(z(null),H({subject:a,body:aK(aE),attachments:aE.attachments??[],...aL(aE)}),F(!0))}}),children:(0,b.jsx)(ab,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Forward"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground/60 hover:text-destructive",onClick:()=>{an(aE.id),P(!0)}}),children:(0,b.jsx)(aa.Trash2,{className:"size-3.5"})}),(0,b.jsx)(u.TooltipContent,{children:"Delete"})]})]}),I.length>0&&(0,b.jsx)("div",{className:"border-b border-border/30",children:I.map(a=>(0,b.jsxs)("div",{className:"border-b border-border/20 last:border-b-0",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>aH(a.id),className:"w-full flex items-center gap-2 px-5 py-2.5 text-left hover:bg-accent/30 transition-colors cursor-pointer",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:K===a.id?"▾":"▸"}),(0,b.jsx)("span",{className:"text-sm font-medium truncate flex-1",children:a.from_email}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:am(a.created_at)})]}),K===a.id&&(0,b.jsxs)("div",{className:"px-5 pb-3",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:a.subject}),M[a.id]?M[a.id].isHtml?(0,b.jsx)(al.EmailBodyFrame,{html:M[a.id].content,className:"max-w-full text-sm"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:M[a.id].content}):(0,b.jsx)(T.Loader2,{className:"size-3 animate-spin text-muted-foreground"})]})]},a.id))}),(0,b.jsxs)("div",{className:"p-5",children:[(0,b.jsx)("h2",{className:"text-lg font-heading font-semibold tracking-tight mb-1",children:aE.subject||"(no subject)"}),(0,b.jsxs)("div",{className:"text-sm space-y-1 mb-5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"From"}),(0,b.jsx)("span",{children:aE.from_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"To"}),(0,b.jsx)("span",{children:aE.to_email})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground w-16 shrink-0",children:"sent"===p?"Sent":"Received"}),(0,b.jsx)("span",{className:"text-muted-foreground",children:new Date(aE.created_at).toLocaleString()})]})]}),C?(0,b.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,b.jsx)(T.Loader2,{className:"size-4 animate-spin text-muted-foreground"})}):aE.html_body?(0,b.jsx)(al.EmailBodyFrame,{html:aE.html_body,className:"max-w-full"}):A?.isHtml?(0,b.jsx)(al.EmailBodyFrame,{html:A.content,className:"max-w-full"}):(0,b.jsx)("div",{className:"text-sm whitespace-pre-wrap leading-[1.65] text-foreground",children:A?.content}),aE.attachments&&aE.attachments.length>0&&(0,b.jsxs)("div",{className:"mt-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mb-2 text-xs text-muted-foreground",children:[(0,b.jsx)(U.Paperclip,{className:"size-3"}),aE.attachments.length," attachment",aE.attachments.length>1?"s":""]}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:aE.attachments.map((a,c)=>(0,b.jsxs)("a",{href:`/api/email/${aE.id}/attachment/${c}?workspace_id=${k}`,target:"_blank",rel:"noopener noreferrer",download:a.filename,className:"flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/50 px-2.5 py-1.5 text-xs hover:bg-muted transition-colors cursor-pointer",children:[(0,b.jsx)(V.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"truncate max-w-45",children:a.filename}),(0,b.jsx)("span",{className:"text-muted-foreground shrink-0",children:a.size<1024?`${a.size} B`:a.size<1048576?`${(a.size/1024).toFixed(1)} KB`:`${(a.size/1048576).toFixed(1)} MB`})]},a.key))})]})]})]}):(0,b.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select an email to view"})}),aT=E?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{F(!1),H({})},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"New Email"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aS})]}):y&&aE?(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{z(null),B(null)},children:(0,b.jsx)(Y.ArrowLeft,{className:"size-4"})}),(0,b.jsx)("span",{className:"text-sm font-medium truncate",children:aE.subject||"(no subject)"})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aS})]}):(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[ay.length>1&&(0,b.jsxs)("div",{className:"relative px-3 pt-2 pb-1 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>av(!au),className:"flex items-center gap-1 text-left cursor-pointer min-w-0 flex-1",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:aC}),(0,b.jsx)(ah.ChevronDown,{className:"size-2.5 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(u.Tooltip,{children:[(0,b.jsx)(u.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:aP,className:"shrink-0 p-0.5"}),children:aN?(0,b.jsx)(ae.Check,{className:"size-2.5 text-green-500"}):(0,b.jsx)(ad.Copy,{className:"size-2.5 text-muted-foreground/40 hover:text-muted-foreground/80 transition-colors"})}),(0,b.jsx)(u.TooltipContent,{children:"Copy address"})]})]}),au&&(0,b.jsx)("div",{className:"absolute left-2 right-2 top-full mt-0.5 z-10 rounded-lg border border-border bg-popover shadow-md py-1",children:ay.map((a,c)=>(0,b.jsxs)("button",{type:"button",onClick:()=>{aA(c),av(!1)},className:(0,t.cn)("flex items-center gap-2 w-full px-2.5 py-1.5 text-left text-xs transition-colors",c===az?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,b.jsx)(Z.Mail,{className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.address}),"custom"===a.type&&(0,b.jsx)("span",{className:"text-[9px] text-muted-foreground/60 shrink-0",children:"IMAP"})]},a.address))})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 border-b border-border/50 px-3 py-2",children:[(0,b.jsx)("div",{className:"flex items-center gap-0.5 flex-1 min-w-0",children:[{id:"inbox",label:"Inbox"},{id:"sent",label:"Sent"},{id:"untrust",label:"Untrust"}].map(a=>(0,b.jsxs)("button",{type:"button",onClick:()=>aw(a.id),className:(0,t.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors",p===a.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.label,"inbox"===a.id&&"inbox"===p&&v>0&&(0,b.jsx)("span",{className:"ml-0.5 text-[10px] bg-blue-500 text-white rounded-full px-1 leading-none min-w-4 text-center",children:v})]},a.id))}),(0,b.jsx)(i.Button,{size:"icon-sm",variant:"ghost",onClick:()=>{H({}),F(!0),z(null)},disabled:0===ay.length,children:(0,b.jsx)(_.Plus,{className:"size-4"})})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-auto",children:aR})]});return(0,b.jsxs)(b.Fragment,{children:[o?aT:(0,b.jsxs)(ak.ResizablePanelGroup,{orientation:"horizontal",children:[(0,b.jsx)(ak.ResizablePanel,{defaultSize:"15%",minSize:"10%",maxSize:"20%",children:aQ}),(0,b.jsx)(ak.ResizableHandle,{withHandle:!0}),(0,b.jsx)(ak.ResizablePanel,{defaultSize:"30%",minSize:"15%",maxSize:"40%",children:aR}),(0,b.jsx)(ak.ResizableHandle,{withHandle:!0}),(0,b.jsx)(ak.ResizablePanel,{defaultSize:"55%",minSize:"25%",children:aS})]}),(0,b.jsx)(j.ConfirmDialog,{open:O,onOpenChange:P,title:"Delete email",description:"This will permanently delete this email.",loading:ao,onConfirm:aI})]})}],221781)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_app_%28app%29_w_%5Bslug%5D_agents_%5Bid%5D_email_page_tsx_0gv3qni._.js.map
|