@xopcai/xopc 0.0.354 → 0.0.355
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B8PS1eLP.js → agent-avatar-dicebear-DiEBNuSv.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CLBSL9hl.js → agent-defaults-settings-panel-DpBmB3QX.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-BninweSg.js → agent-plugin-dialog-DlojWUY_.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CcVLP_WP.js → agents-CeSCdUHP.js} +3 -3
- package/dist/gateway/static/root/assets/{app-management-settings-panel-COdQOmdT.js → app-management-settings-panel-MkSa6isi.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CDNjc2yy.js → appearance-settings-B7hCkaT_.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C-kvpPj8.js → apps-page-D_CduJuC.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-87DN5nXX.js → automations-page-uEnQawd7.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-BdZ8NO8k.js → automations-workspace-pdiSK3Qk.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B04Kv5DU.js → block-editor-r4mKGacz.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Ck6Zb9aU.js → browser-automations-page-Blrxyy_h.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DHlyYItE.js → browser-settings-page-DGuwrO7j.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-C-6RLFNh.js → capabilities-page-DUIA2K--.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CST_HBkR.js → capabilities-settings-panel-CwPNQsJS.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-PBPJJsp6.js → capability-header-actions-CyvI2F5x.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-CM4sIvcP.js → channels-DBxDJV8I.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DTd7mWyE.js → chat-terminal-dock-YdxhecE7.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page--9rh1mvu.js → computer-settings-page-BuCrA8yD.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-v6Is0BOO.js → connector-service-page-BiB2GYkp.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CryQzmEZ.js → connectors-page-nQAgZk-5.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-DTsMzjoZ.js → date-picker-BJtADyRQ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Y1QYCcLp.js → dependency-picker-D-Ko0G40.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-D9dfZrOp.js → desktop-pet-CVPWcWwC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BHVOHZUL.js → desktop-pet-settings-BcN_I-7y.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-Cy5YDZ2b.js → device-pairing-wizard-CoKKoUlt.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DeMo9KlE.js → directory-picker-path-field-m0CubGEP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-AWrvy1Nb.js → extension-page-Dd88ynHj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-C5KgmhYu.js → extension-settings-page-Dq1MXh6D.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DC-lok0J.js → gateway-settings-C_bTRQeE.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-C29_VFAs.js → home-page-xbqSikkK.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BKVKfVMA.js → imports-page-Cd4tcbLU.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BJh5gU04.css → index-BuzC93X-.css} +1 -1
- package/dist/gateway/static/root/assets/{index-ByFXhQ-T.js → index-CYeGnj-L.js} +43 -44
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DiwE4gKU.js → keyboard-shortcuts-settings-CmalfzgQ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-Dt3TC64L.js → local-app-workbench-page-BquHHLj6.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DFPhWkxU.js → local-apps-page-RPLHMvYs.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-C4faHZHj.js → logs-page-7NMGltSw.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-pZLdvIiw.js → management-settings-zwFewbhp.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-BLnT1tYJ.js → note-detail-panel-CwMg9cvF.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-BawArJvP.js → notes-page-CWJwrvo7.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CiBUm2Br.js → page-context-capture-button-DqmAq4Ov.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-Bbgx_dgV.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-B8_w6c3J.js → product-open-page-SsG2sljT.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CDZdKiTz.js → project-detail-page-wp5cFhM7.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BvahSrZi.js → projects-page-Brfi519S.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CU_UdkuI.js → remote-access-hub-BdtF8Cvk.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BnMS50vK.js → runtime-tools-settings-panel-CT6HKczq.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-CDR1-q25.js → scenes-page-BmlI42OR.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-B4Xa8w8S.js → schema-form-DEcsbgne.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Ymyg98G-.js → sessions-page-C_G8fZwV.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDxdzwDs.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CHZdpvkT.js → settings-page-P50kLPUz.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-HESfALIF.js → setup-status-panel-DtnwH0wN.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CXEBo5YL.js → shares-settings-7Ak_MsJg.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DYgcO7y0.js → skill-api-CcdHQhxd.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-Dx5v64jU.js → skills-page-ChjXDxdX.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-wXCBwYwE.js → system-settings-panel-DAR0w3Xi.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-hoIyr7tp.js → task-detail-page-DEx0kXDV.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-C0t8y3Mi.js → tunnel-api-CBy97LfF.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-A2DZAidl.js → usage-page-BdX6VPQC.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-C1jGTwjK.js → user-model-page-CRxiQnWG.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-xB0QpOFk.js → work-discovery-overlay-DvwmD9Ma.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-rM4U1FXc.js → workflow-run-setup-panel-BQ3fmhM-.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-QKC34FzQ.js → workflows-page-Bl8rd4fM.js} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +2 -1
- package/dist/src/agent/embedded/run-turn.js +19 -1
- package/dist/src/agent/embedded/types.d.ts +1 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/prompt/sections/messaging-runtime.js +2 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -0
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tools/personal-preference-tool.d.ts +1 -1
- package/dist/src/agent/tools/personal-preference-tool.js +3 -2
- package/dist/src/agent/tools/personal-task-tool.d.ts +2 -1
- package/dist/src/agent/tools/personal-task-tool.js +26 -7
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-config/schema.d.ts +5 -1
- package/dist/src/agent-config/schema.js +2 -1
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +3 -3
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/personal-agent.js +16 -1
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +41 -0
- package/dist/src/gateway/service/run-gateway-agent.js +2 -1
- package/dist/src/gateway/service.js +13 -13
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +9 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +43 -3
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/personal-agent/service.d.ts +1 -0
- package/dist/src/personal-agent/service.js +14 -2
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/task-main-update-delivery.js +5 -2
- package/dist/src/tasks/task-origin-repository.d.ts +4 -1
- package/dist/src/tasks/task-origin-repository.js +3 -3
- package/dist/src/tasks/task-run-coordinator.d.ts +1 -0
- package/dist/src/tasks/task-run-coordinator.js +13 -7
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
- package/dist/src/tasks/task-run-dispatcher.js +6 -4
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/personal-page-Cng583RH.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-wMZhxwTM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./chevron-right-BweFrslA.js";import{t as o}from"./circle-alert-BEjgurr2.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./clock-3-DnrAnuyZ.js";import{t as l}from"./external-link-DjqjBmc3.js";import{A as u,E as d,O as f,T as p,b as m,l as h,m as g,n as _,p as v,t as y,w as b,x}from"./use-composer-attachments-DL61XeSu.js";import{_ as S}from"./markdown-view-7tzqIp_G.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./settings-2-D-csvaET.js";import{t as ee}from"./sparkles-DHlfQFAF.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./messages-DPw2X06D.js";import{t as D}from"./cn-JdwAhgNB.js";import{n as O}from"./locale-store-Y1aBayM_.js";import{a as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dist-BGTk37IG.js";import{t as I}from"./button-CS04eWY9.js";import{a as L,i as R,o as z,r as B}from"./dist-3h6cXXhT.js";import{t as V}from"./skeleton-BwbyijEw.js";import{Fo as H,Ja as U,Jo as W,Ki as G,Ns as K,Or as te,Rr as ne,Xr as re,_c as ie,cn as ae,dn as oe,ia as se,ln as ce,os as le,r as ue,un as de,yc as fe}from"./index-ByFXhQ-T.js";import{n as pe}from"./tab-completion-input-D64VNmiA.js";var q=e(t(),1),J=n(),Y=r(),me=12e3;function he(e){let t=(0,J.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:v,onDragOver:y,onDragLeave:b,onDrop:x,onSubmit:S}=e,C=n===`inline`,w;t[0]!==s||t[1]!==a?(w=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=w):w=t[2];let T=w,E=d.voiceActive&&d.phase!==`error`,O;t[3]!==S||t[4]!==d.voiceActive?(O=e=>{if(d.voiceActive){e.preventDefault();return}S(e)},t[3]=S,t[4]=d.voiceActive,t[5]=O):O=t[5];let k=C?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=D(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==C||t[9]!==c||t[10]!==o.dropFiles?(j=c?(0,Y.jsx)(`div`,{className:D(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,C&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=C,t[9]=c,t[10]=o.dropFiles,t[11]=j):j=t[11];let M=!C&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,N;t[12]===M?N=t[13]:(N=D(M),t[12]=M,t[13]=N);let P=C?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,Y.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let L;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.retryVoiceInput||t[29]!==d.settingsRequired||t[30]!==d.voiceActive?(L=d.voiceActive?(0,Y.jsx)(de,{phase:d.phase,elapsedLabel:d.elapsedLabel,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.retryVoiceInput,t[29]=d.settingsRequired,t[30]=d.voiceActive,t[31]=L):L=t[31];let R=E&&`hidden`,z=C?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,B;t[32]!==R||t[33]!==z?(B=D(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,R,z),t[32]=R,t[33]=z,t[34]=B):B=t[34];let V;t[35]===m?V=t[36]:(V=e=>m(e.target.value),t[35]=m,t[36]=V);let H=!C,U;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==m||t[43]!==v||t[44]!==B||t[45]!==V||t[46]!==H?(U=(0,Y.jsx)(pe,{ref:i,id:r,className:B,value:a,onChange:V,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:ge,placeholder:o.intentPlaceholder,maxLength:me,autoFocus:H}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=m,t[43]=v,t[44]=B,t[45]=V,t[46]=H,t[47]=U):U=t[47];let G=C?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,K;t[48]!==s||t[49]!==g||t[50]!==G?(K=(0,Y.jsx)(_,{attachments:s,topPadded:!1,onRemove:g,className:G}),t[48]=s,t[49]=g,t[50]=G,t[51]=K):K=t[51];let te;t[52]!==C||t[53]!==a.length||t[54]!==o.shortcut?(te=C?null:(0,Y.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Y.jsx)(`span`,{children:o.shortcut}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,me.toLocaleString()]})]}),t[52]=C,t[53]=a.length,t[54]=o.shortcut,t[55]=te):te=t[55];let re;t[56]!==L||t[57]!==U||t[58]!==K||t[59]!==te||t[60]!==N||t[61]!==F?(re=(0,Y.jsxs)(`div`,{className:N,children:[F,L,U,K,te]}),t[56]=L,t[57]=U,t[58]=K,t[59]=te,t[60]=N,t[61]=F,t[62]=re):re=t[62];let ie=C?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,ae;t[63]===ie?ae=t[64]:(ae=D(`flex shrink-0 items-center gap-2 border-t`,ie),t[63]=ie,t[64]=ae);let oe=!C&&`mr-auto`,se;t[65]===oe?se=t[66]:(se=D(`flex items-center gap-1`,oe),t[65]=oe,t[66]=se);let ce=l||u,le;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Y.jsx)(W,{className:`size-4`,"aria-hidden":!0}),t[67]=le):le=t[67];let ue;t[68]!==o.attachTitle||t[69]!==h||t[70]!==ce?(ue=(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ce,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:le}),t[68]=o.attachTitle,t[69]=h,t[70]=ce,t[71]=ue):ue=t[71];let fe;t[72]!==l||t[73]!==f||t[74]!==d.startVoiceInput||t[75]!==d.voiceActive?(fe=d.voiceActive?null:(0,Y.jsx)(ne,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[72]=l,t[73]=f,t[74]=d.startVoiceInput,t[75]=d.voiceActive,t[76]=fe):fe=t[76];let q;t[77]!==se||t[78]!==ue||t[79]!==fe?(q=(0,Y.jsxs)(`div`,{className:se,children:[ue,fe]}),t[77]=se,t[78]=ue,t[79]=fe,t[80]=q):q=t[80];let he;t[81]!==p||t[82]!==C||t[83]!==o.shortcut?(he=C?(0,Y.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[81]=p,t[82]=C,t[83]=o.shortcut,t[84]=he):he=t[84];let X=C?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,_e=!T||l||d.voiceActive,Z=C?`size-3.5`:`size-4`,Q;t[85]===Z?Q=t[86]:(Q=(0,Y.jsx)(ee,{className:Z,"aria-hidden":!0}),t[85]=Z,t[86]=Q);let ve;t[87]!==o.submit||t[88]!==X||t[89]!==_e||t[90]!==Q?(ve=(0,Y.jsxs)(I,{type:`submit`,variant:`primary`,className:X,disabled:_e,children:[Q,o.submit]}),t[87]=o.submit,t[88]=X,t[89]=_e,t[90]=Q,t[91]=ve):ve=t[91];let ye;t[92]!==ae||t[93]!==q||t[94]!==he||t[95]!==ve?(ye=(0,Y.jsxs)(`div`,{className:ae,children:[q,he,ve]}),t[92]=ae,t[93]=q,t[94]=he,t[95]=ve,t[96]=ye):ye=t[96];let be;return t[97]!==b||t[98]!==y||t[99]!==x||t[100]!==O||t[101]!==re||t[102]!==ye||t[103]!==A||t[104]!==j?(be=(0,Y.jsxs)(`form`,{onSubmit:O,onDragOver:y,onDragLeave:b,onDrop:x,className:A,children:[j,re,ye]}),t[97]=b,t[98]=y,t[99]=x,t[100]=O,t[101]=re,t[102]=ye,t[103]=A,t[104]=j,t[105]=be):be=t[105],be}function ge(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function X(e){let t=(0,J.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function _e(e){let t=(0,J.c)(69),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,l,u,d;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.sceneAction||t[7]!==r.sceneHint||t[8]!==r.why||t[9]!==i||t[10]!==n.capabilities||t[11]!==n.continuation||t[12]!==n.estimatedMinutes||t[13]!==n.outcome||t[14]!==n.rationale||t[15]!==n.title){let e=n.capabilities.filter(Q),f;t[22]===r.aiLabel?f=t[23]:(f=(0,Y.jsx)(`span`,{children:r.aiLabel}),t[22]=r.aiLabel,t[23]=f);let p;t[24]!==r.minutes||t[25]!==n.estimatedMinutes?(p=n.estimatedMinutes?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[24]=r.minutes,t[25]=n.estimatedMinutes,t[26]=p):p=t[26];let m;t[27]!==f||t[28]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[f,p]}),t[27]=f,t[28]=p,t[29]=m):m=t[29];let h;t[30]!==r.history||t[31]!==i?(h=(0,Y.jsx)(X,{label:r.history,onClick:i}),t[30]=r.history,t[31]=i,t[32]=h):h=t[32],t[33]!==h||t[34]!==m?(a=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[m,h]}),t[33]=h,t[34]=m,t[35]=a):a=t[35],t[36]===n.title?o=t[37]:(o=(0,Y.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[36]=n.title,t[37]=o),t[38]===n.outcome?s=t[39]:(s=(0,Y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[38]=n.outcome,t[39]=s);let g;t[40]===r.why?g=t[41]:(g=(0,Y.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[40]=r.why,t[41]=g),t[42]!==n.rationale||t[43]!==g?(l=(0,Y.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[g,n.rationale]}),t[42]=n.rationale,t[43]=g,t[44]=l):l=t[44],t[45]!==r.automationAction||t[46]!==r.automationHint||t[47]!==r.sceneAction||t[48]!==r.sceneHint||t[49]!==n.continuation?(u=n.continuation?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.continuation.kind===`automation`?r.automationHint:r.sceneHint}),(0,Y.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n.continuation.kind===`automation`?r.automationAction:r.sceneAction})]}):null,t[45]=r.automationAction,t[46]=r.automationHint,t[47]=r.sceneAction,t[48]=r.sceneHint,t[49]=n.continuation,t[50]=u):u=t[50],d=e.length>0?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.sceneAction,t[7]=r.sceneHint,t[8]=r.why,t[9]=i,t[10]=n.capabilities,t[11]=n.continuation,t[12]=n.estimatedMinutes,t[13]=n.outcome,t[14]=n.rationale,t[15]=n.title,t[16]=a,t[17]=o,t[18]=s,t[19]=l,t[20]=u,t[21]=d}else a=t[16],o=t[17],s=t[18],l=t[19],u=t[20],d=t[21];let f;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Y.jsx)(ie,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[51]=f):f=t[51];let p;t[52]===r.evidence?p=t[53]:(p=(0,Y.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,f]}),t[52]=r.evidence,t[53]=p);let m;t[54]===n.evidence?m=t[55]:(m=n.evidence.map(Z),t[54]=n.evidence,t[55]=m);let h;t[56]===m?h=t[57]:(h=(0,Y.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:m}),t[56]=m,t[57]=h);let g;t[58]!==h||t[59]!==p?(g=(0,Y.jsxs)(`details`,{className:`mt-4 group`,children:[p,h]}),t[58]=h,t[59]=p,t[60]=g):g=t[60];let _;return t[61]!==a||t[62]!==g||t[63]!==o||t[64]!==s||t[65]!==l||t[66]!==u||t[67]!==d?(_=(0,Y.jsxs)(Y.Fragment,{children:[a,o,s,l,u,d,g]}),t[61]=a,t[62]=g,t[63]=o,t[64]=s,t[65]=l,t[66]=u,t[67]=d,t[68]=_):_=t[68],_}function Z(e){return(0,Y.jsx)(`li`,{children:e.href?(0,Y.jsx)(`a`,{href:`#${e.href}`,className:`hover:text-accent hover:underline`,children:e.observation}):e.observation},e.id)}function Q(e){return e.readiness!==`ready`}function ve(e){let t=(0,J.c)(130),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:c,onClarification:l,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,q.useState)(),h;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(h=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==p?(_=g.find(e=>e.id===p)??g[0],t[4]=g,t[5]=p,t[6]=_):_=t[6];let v=_,y;t[7]===g[0]?.id?y=t[8]:(y=()=>m(g[0]?.id),t[7]=g[0]?.id,t[8]=y);let b=g[0]?.id,x;if(t[9]!==n.state||t[10]!==b?(x=[n.state,b],t[9]=n.state,t[10]=b,t[11]=x):x=t[11],(0,q.useEffect)(y,x),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(s,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==u?(o=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=o):o=t[22];let c=`#${f.href}`,l;t[23]!==r.viewProgress||t[24]!==c?(l=(0,Y.jsx)(I,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Y.jsx)(`a`,{href:c,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=c,t[25]=l):l=t[25];let d;t[26]!==o||t[27]!==l?(d=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,l]}),t[26]=o,t[27]=l,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==a?(p=(0,Y.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,d]})}),t[29]=d,t[30]=a,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let i;t[33]===r.aiLabel?i=t[34]:(i=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=i);let a;t[35]!==r.history||t[36]!==u?(a=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=a):a=t[37];let o;t[38]!==i||t[39]!==a?(o=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,a]}),t[38]=i,t[39]=a,t[40]=o):o=t[40];let s;t[41]===n.question.question?s=t[42]:(s=(0,Y.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=s);let c;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==l){let e;t[47]!==n.question.question||t[48]!==l?(e=e=>(0,Y.jsx)(I,{type:`button`,variant:`secondary`,className:`min-h-11`,onClick:()=>l(n.question.question,e.label),children:e.label},e.id),t[47]=n.question.question,t[48]=l,t[49]=e):e=t[49],c=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=l,t[46]=c}else c=t[46];let d;t[50]===c?d=t[51]:(d=(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:c}),t[50]=c,t[51]=d);let f;return t[52]!==s||t[53]!==d||t[54]!==o?(f=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[o,s,d]}),t[52]=s,t[53]=d,t[54]=o,t[55]=f):f=t[55],f}if(!v)return null;let S=d?.opportunityId===v.id?d.value:void 0,C;t[56]!==n.stale||t[57]!==r.refreshing?(C=n.stale?(0,Y.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Y.jsx)(H,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[56]=n.stale,t[57]=r.refreshing,t[58]=C):C=t[58];let T;t[59]!==r||t[60]!==u||t[61]!==v?(T=(0,Y.jsx)(_e,{opportunity:v,copy:r,onOpenHistory:u}),t[59]=r,t[60]=u,t[61]=v,t[62]=T):T=t[62];let E;t[63]!==i||t[64]!==r.configure||t[65]!==r.degradedStart||t[66]!==r.setupHint||t[67]!==r.setupTitle||t[68]!==o||t[69]!==v||t[70]!==S?(E=S?.state===`needs_setup`?(0,Y.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:S.blockers.map(ye)}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[S.recoveryActions.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),S.degradedAction?(0,Y.jsx)(I,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[63]=i,t[64]=r.configure,t[65]=r.degradedStart,t[66]=r.setupHint,t[67]=r.setupTitle,t[68]=o,t[69]=v,t[70]=S,t[71]=E):E=t[71];let D;t[72]!==i||t[73]!==r.start||t[74]!==o||t[75]!==v?(D=v.actions.canStart?(0,Y.jsxs)(I,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`start`),children:[(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[72]=i,t[73]=r.start,t[74]=o,t[75]=v,t[76]=D):D=t[76];let O;t[77]!==i||t[78]!==r.discuss||t[79]!==o||t[80]!==v?(O=v.actions.canDiscuss?(0,Y.jsxs)(I,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`discuss`),children:[(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[77]=i,t[78]=r.discuss,t[79]=o,t[80]=v,t[81]=O):O=t[81];let k;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Y.jsx)(H,{className:`size-4`,"aria-hidden":!0}),t[82]=k):k=t[82];let A;t[83]!==i||t[84]!==r.refresh||t[85]!==a?(A=(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[83]=i,t[84]=r.refresh,t[85]=a,t[86]=A):A=t[86];let j;t[87]===r.feedback?j=t[88]:(j=(0,Y.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[87]=r.feedback,t[88]=j);let M;t[89]===r.alreadyDone?M=t[90]:(M=[`already_done`,r.alreadyDone],t[89]=r.alreadyDone,t[90]=M);let N;t[91]===r.irrelevant?N=t[92]:(N=[`irrelevant`,r.irrelevant],t[91]=r.irrelevant,t[92]=N);let P;t[93]===r.later?P=t[94]:(P=[`too_early`,r.later],t[93]=r.later,t[94]=P);let F;t[95]===r.sourceIncorrect?F=t[96]:(F=[`source_incorrect`,r.sourceIncorrect],t[95]=r.sourceIncorrect,t[96]=F);let L;t[97]===r.lessLikeThis?L=t[98]:(L=[`less_like_this`,r.lessLikeThis],t[97]=r.lessLikeThis,t[98]=L);let R;t[99]!==M||t[100]!==N||t[101]!==P||t[102]!==F||t[103]!==L?(R=[M,N,P,F,L],t[99]=M,t[100]=N,t[101]=P,t[102]=F,t[103]=L,t[104]=R):R=t[104];let z=R,B;t[105]!==c||t[106]!==v||t[107]!==z?(B=(0,Y.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:z.map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(v,t),children:n},t)})}),t[105]=c,t[106]=v,t[107]=z,t[108]=B):B=t[108];let V;t[109]!==j||t[110]!==B?(V=(0,Y.jsxs)(`details`,{className:`relative ml-auto`,children:[j,B]}),t[109]=j,t[110]=B,t[111]=V):V=t[111];let U;t[112]!==O||t[113]!==A||t[114]!==V||t[115]!==D?(U=(0,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O,A,V]}),t[112]=O,t[113]=A,t[114]=V,t[115]=D,t[116]=U):U=t[116];let W;t[117]!==U||t[118]!==C||t[119]!==T||t[120]!==E?(W=(0,Y.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[C,T,E,U]}),t[117]=U,t[118]=C,t[119]=T,t[120]=E,t[121]=W):W=t[121];let G;t[122]!==r.alternatives||t[123]!==g||t[124]!==v.id?(G=g.length>1?(0,Y.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:g.filter(e=>e.id!==v.id).map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[122]=r.alternatives,t[123]=g,t[124]=v.id,t[125]=G):G=t[125];let K;return t[126]!==r.aiLabel||t[127]!==W||t[128]!==G?(K=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[W,G]}),t[126]=r.aiLabel,t[127]=W,t[128]=G,t[129]=K):K=t[129],K}function ye(e){return(0,Y.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var be=new Set([`started`,`discussing`,`completed`]);function xe(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Se)}),e[0]=t):t=e[0],t}function Se(e){return(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Y.jsx)(V,{className:`h-4 w-24 rounded`}),(0,Y.jsx)(V,{className:`h-5 w-4/5 rounded`}),(0,Y.jsx)(V,{className:`h-4 w-3/5 rounded`})]},e)}function Ce(e){let t=(0,J.c)(11),{open:n,refreshKey:r,onOpenChange:a,onReevaluate:o}=e,s=O(Te),u=E(s).projectsPage.home,d=i(),[f,p]=(0,q.useState)(`all`),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[0]=m):m=t[0];let[h,g]=(0,q.useState)(m),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(),C;t[1]===n?C=t[2]:(C=()=>{if(!n)return;let e=!0;return v(!0),b(void 0),x().then(t=>{e&&g(t.items)}).catch(t=>{e&&b(t instanceof Error?t.message:String(t))}).finally(()=>{e&&v(!1)}),()=>{e=!1}},t[1]=n,t[2]=C);let w;t[3]!==n||t[4]!==r?(w=[n,r],t[3]=n,t[4]=r,t[5]=w):w=t[5],(0,q.useEffect)(C,w);let ee=h.filter(e=>f===`all`||(f===`adopted`?be.has(e.status):!be.has(e.status))),D=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),L=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of ee){let t=D.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let z=[...R.entries()],B=e=>e.feedbackKind===`already_done`?u.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?u.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?u.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?u.advisorHistoryStatusLessLikeThis:{available:u.advisorHistoryStatusAvailable,started:u.advisorHistoryStatusStarted,discussing:u.advisorHistoryStatusDiscussing,completed:u.advisorHistoryStatusCompleted,snoozed:u.advisorHistoryStatusSnoozed,dismissed:u.advisorHistoryStatusDismissed,expired:u.advisorHistoryStatusExpired,superseded:u.advisorHistoryStatusSuperseded}[e.status],V=e=>{if(e.href){a(!1),d(S(`/`,e.href));return}e.status===`discussing`&&(a(!1),d(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},U;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=U):U=t[6];let W;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.jsx)(K,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=W):W=t[7];let G;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[8]=G):G=t[8];let te=_?(0,Y.jsx)(xe,{}):y?(0,Y.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Y.jsx)(`p`,{children:u.advisorHistoryLoadFailed}),(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>a(!1),children:u.advisorHistoryClose})]}):z.length===0?(0,Y.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Y.jsx)(K,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:u.advisorHistoryEmpty}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryEmptyHint})]}):(0,Y.jsx)(`div`,{className:`space-y-6`,children:z.map(e=>{let[t,n]=e;return(0,Y.jsxs)(`section`,{"aria-label":t,children:[(0,Y.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Y.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:B(e)}),(0,Y.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:L.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Y.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Y.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReturnsAt,` `,L.format(new Date(e.snoozedUntil))]}):null,(0,Y.jsxs)(`details`,{className:`group mt-3`,children:[(0,Y.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[u.advisorHistoryEvidence,(0,Y.jsx)(ie,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(we)})]}),t||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Y.jsxs)(I,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>V(e),children:[(0,Y.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?u.advisorHistoryContinueDiscussion:u.advisorHistoryViewProgress]}):null,n?(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{a(!1),o()},children:[(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),ne;return t[9]===te?ne=t[10]:(ne=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:te}),t[9]=te,t[10]=ne),(0,Y.jsx)(F,{open:n,onOpenChange:a,children:(0,Y.jsxs)(M,{children:[U,(0,Y.jsxs)(N,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[W,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(P,{className:`text-base font-semibold text-fg`,children:u.advisorHistoryTitle}),(0,Y.jsx)(A,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryDescription})]}),(0,Y.jsx)(j,{asChild:!0,children:(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":u.advisorHistoryClose,children:G})})]}),(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Y.jsx)(`div`,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":u.advisorHistoryFilterLabel,children:[[`all`,u.advisorHistoryFilterAll],[`adopted`,u.advisorHistoryFilterAdopted],[`other`,u.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${f===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":f===t,onClick:()=>p(t),children:n},t)})})}),ne]})]})})}function we(e){return(0,Y.jsx)(`li`,{children:e.observation},e.id)}function Te(e){return e.language}function Ee(e,t){return e.replace(`{{count}}`,String(t))}function $(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ee(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var De={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Oe(e){let t=(0,J.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=$(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,Y.jsx)(H,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h=De[u.tone],g;t[5]===h?g=t[6]:(g=D(`size-1.5 shrink-0 rounded-full`,h),t[5]=h,t[6]=g);let _;t[7]===g?_=t[8]:(_=(0,Y.jsx)(`span`,{className:g,"aria-hidden":!0}),t[7]=g,t[8]=_);let v;t[9]!==i.label||t[10]!==u.label?(v=(0,Y.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=v):v=t[11];let y;t[12]!==p||t[13]!==m||t[14]!==_||t[15]!==v?(y=(0,Y.jsx)(z,{asChild:!0,children:(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":p,children:[m,_,v]})}),t[12]=p,t[13]=m,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u.refreshing?b=t[18]:(b=(0,Y.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,Y.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=b);let x;t[19]===u.label?x=t[20]:(x=(0,Y.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=x);let S;t[21]===u.detail?S=t[22]:(S=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=S);let C;t[23]!==x||t[24]!==S?(C=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==b?(w=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,C]}),t[26]=C,t[27]=b,t[28]=w):w=t[28];let T;t[29]===a?T=t[30]:(T=()=>{c(!1),a()},t[29]=a,t[30]=T);let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[31]=E):E=t[31];let O;t[32]!==i.history||t[33]!==T?(O=(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:T,children:[E,i.history]}),t[32]=i.history,t[33]=T,t[34]=O):O=t[34];let k;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==f?(k=d?(0,Y.jsxs)(I,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=f,t[39]=k):k=t[39];let A;t[40]!==O||t[41]!==k?(A=(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[O,k]}),t[40]=O,t[41]=k,t[42]=A):A=t[42];let j;t[43]!==w||t[44]!==A?(j=(0,Y.jsx)(R,{children:(0,Y.jsxs)(B,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-panel p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:ke,children:[w,A]})}),t[43]=w,t[44]=A,t[45]=j):j=t[45];let M;return t[46]!==s||t[47]!==j||t[48]!==y?(M=(0,Y.jsxs)(L,{open:s,onOpenChange:c,children:[y,j]}),t[46]=s,t[47]=j,t[48]=y,t[49]=M):M=t[49],M}function ke(e){return e.preventDefault()}function Ae(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function je(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(V,{className:`h-10 w-3/5 rounded-xl`}),(0,Y.jsx)(V,{className:`h-5 w-4/5 rounded-lg`})]}),(0,Y.jsx)(V,{className:`h-64 rounded-2xl`}),(0,Y.jsx)(V,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function Me(e){let t=(0,J.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${te(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,Y.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,Y.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Y.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,Y.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,Y.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let y;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(y=n.primaryAction||n.secondaryActions.length>0?(0,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,Y.jsx)(I,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,Y.jsx)(I,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=y):y=t[27];let b;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==y?(b=(0,Y.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,y]}),t[28]=f,t[29]=_,t[30]=v,t[31]=y,t[32]=b):b=t[32],b}function Ne(e){let t=(0,J.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,Y.jsx)(fe,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let o=i,s=!n.openAction,c;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(c=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=c):c=t[5];let l;t[6]===o?l=t[7]:(l=(0,Y.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:o}),t[6]=o,t[7]=l);let u;t[8]===n.title?u=t[9]:(u=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=u);let d;t[10]===n.summary?d=t[11]:(d=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]===n.statusLabel?p=t[16]:(p=n.statusLabel?(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=p);let m;t[17]===n.openAction?m=t[18]:(m=n.openAction?(0,Y.jsx)(a,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=m);let h;return t[19]!==s||t[20]!==c||t[21]!==l||t[22]!==f||t[23]!==p||t[24]!==m?(h=(0,Y.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:s,onClick:c,children:[l,f,p,m]}),t[19]=s,t[20]=c,t[21]=l,t[22]=f,t[23]=p,t[24]=m,t[25]=h):h=t[25],h}function Pe(){let e=O(e=>e.language),t=E(e),n=t.projectsPage,r=U(e),a=i(),s=G(e=>e.setPageHeader),c=G(e=>e.clearPageHeader),[l,_]=(0,q.useState)(null),[x,w]=(0,q.useState)(!0),[ee,D]=(0,q.useState)(null),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(``),[V,H]=(0,q.useState)(null),[W,K]=(0,q.useState)(!1),[te,ne]=(0,q.useState)(),[ie,le]=(0,q.useState)(!1),[de,fe]=(0,q.useState)(0),[pe,J]=(0,q.useState)(),[me,ge]=(0,q.useState)(),[X,_e]=(0,q.useState)(!1),Z=y({chat:t.chat}),Q=(0,q.useRef)(null),ye=se({disabled:X,chat:t.chat,onTranscript:e=>{B(t=>oe(t,e)),window.setTimeout(()=>Q.current?.focus(),0)}}),{phase:be,voiceActive:xe,startVoiceInput:Se,cancelVoiceInput:we,confirmVoiceInput:Te,retryVoiceInput:Ee}=ye,$=(0,q.useCallback)(async(t=!1)=>{t&&w(!0),D(null);try{_(await m(e))}catch(e){D(e instanceof Error?e.message:String(e))}finally{w(!1)}},[e]);(0,q.useEffect)(()=>{$(!0)},[$]),(0,q.useEffect)(()=>{if(!pe)return;let e=window.setTimeout(()=>J(void 0),8e3);return()=>window.clearTimeout(e)},[pe]),(0,q.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,$()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`,`home-advisor-updated`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[$]);let De=(0,q.useCallback)(async e=>{if(!(e.length===0||X)){_e(!0);try{await Z.processFiles(e)}finally{_e(!1)}}},[X,Z.processFiles]),ke=(0,q.useCallback)(async e=>{let t=re(e.clipboardData);t.length!==0&&(e.preventDefault(),await De(t))},[De]),Pe=(0,q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,Z.setIsDragging(!0))},[Z.setIsDragging]),Fe=(0,q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&Z.setIsDragging(!1)},[Z.setIsDragging]),Ie=(0,q.useCallback)(async e=>{e.preventDefault(),Z.setIsDragging(!1),await De(Array.from(e.dataTransfer.files))},[Z.setIsDragging,De]),Le=(0,q.useCallback)(e=>{e.preventDefault();let t=Z.wireAttachmentsPayload(),n=h(z,t.length>0?ue(t):void 0,{projectScope:`none`});n&&(R(!1),B(``),Z.clearAttachments(),a(n))},[Z.clearAttachments,Z.wireAttachmentsPayload,z,a]),Re=Z.attachments.length>=10,ze={attachTitle:Re?Ae(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${Z.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Be=(0,q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),Ve=!!(l&&l.needsUser.length===0&&l.backgroundCount===0),He=!!(l&&l.needsUser.length===0),Ue=He||L;(0,q.useEffect)(()=>{!Ue&&xe&&we()},[we,Ue,xe]),(0,q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!Ue||X||(e.preventDefault(),be===`recording`?Te():be===`idle`?(Q.current?.focus(),Se()):be===`error`&&Ee())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!Ue||!xe||(e.preventDefault(),we(),Q.current?.focus())};return window.addEventListener(ce,e),window.addEventListener(ae,t),()=>{window.removeEventListener(ce,e),window.removeEventListener(ae,t)}},[X,we,Ue,Te,Ee,Se,xe,be]);let We=(0,q.useCallback)(e=>{e||we(),R(e)},[we]),Ge=(0,q.useCallback)((e,t)=>{if(e.type===`open`){a(S(`/`,e.href));return}H(t),D(null),(async()=>{try{e.type===`connector_decision`?await p({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await d({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await v({kind:e.subjectKind,runId:e.runId}),await $()}catch(e){D(e instanceof Error?e.message:String(e))}finally{H(null)}})()},[$,a]),Ke=(0,q.useCallback)(()=>{K(!0),ne(void 0),ge(void 0),D(null),b(e).then(()=>$()).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>K(!1))},[e,$]),qe=(0,q.useCallback)((e,t)=>{K(!0),D(null),g(e,t).then(async t=>{if(t.outcome===`needs_setup`){ge({opportunityId:e.id,value:t.preflight});return}if(ge(void 0),fe(e=>e+1),t.outcome===`task`){ne({title:n.home.advisorStartedTitle,detail:Ae(n.home.advisorStartedDetail,{title:e.title}),href:S(`/`,t.href)}),await $();return}a(t.href)}).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>K(!1))},[$,a,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),Je=(0,q.useCallback)((e,t)=>{K(!0),ne(void 0),ge(void 0),D(null),f(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(J({opportunityId:e.id,idempotencyKey:t}),fe(e=>e+1),$())).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>K(!1))},[$]),Ye=(0,q.useCallback)(()=>{if(!pe)return;let e=pe;J(void 0),K(!0),D(null),u(e.opportunityId,e.idempotencyKey).then(()=>(fe(e=>e+1),$())).catch(t=>{J(e),D(t instanceof Error?t.message:String(t))}).finally(()=>K(!1))},[pe,$]),Xe=(0,q.useCallback)((e,t)=>{a(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[a]),Ze=(0,q.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l?(0,Y.jsx)(Oe,{advisor:l.advisor,busy:W,copy:Be,onOpenHistory:()=>le(!0),onRefresh:Ke}):null,He?null:(0,Y.jsxs)(I,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>R(!0),children:[(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[W,Be,r.newWork,l,Ke,He]);(0,q.useLayoutEffect)(()=>(s({startExtra:null,main:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:Ze}),()=>c()),[c,Ze,s,n.title]);let Qe=l?.needsUser.length??0,$e=l?.backgroundCount??0,et=Qe>0?Ae(n.home.attentionTitle,{count:Qe}):$e>0?n.home.clearTitle:n.home.idleTitle,tt=Qe>0?$e>0?Ae(n.home.attentionIntroWithBackground,{count:$e}):n.home.attentionIntro:$e>0?Ae(n.home.clearIntro,{count:$e}):n.home.idleIntro;return(0,Y.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,Y.jsx)(`input`,{ref:Z.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&De(Array.from(t)),e.target.value=``}}),(0,Y.jsx)(F,{open:L,onOpenChange:We,children:(0,Y.jsxs)(M,{children:[(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(N,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(P,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,Y.jsx)(A,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,Y.jsx)(j,{asChild:!0,children:(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsx)(he,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Q,intent:z,labels:{...ze,submit:r.submit},attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Re,voice:ye,chat:t.chat,cancelAction:(0,Y.jsx)(j,{asChild:!0,children:(0,Y.jsx)(I,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:B,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void ke(e),onDragOver:Pe,onDragLeave:Fe,onDrop:e=>void Ie(e),onSubmit:Le})]})]})}),(0,Y.jsx)(Ce,{open:ie,refreshKey:de,onOpenChange:le,onReevaluate:Ke}),ee?(0,Y.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Y.jsx)(`span`,{children:ee}),(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:n.home.retry})]}):null,x?(0,Y.jsx)(je,{}):l?(0,Y.jsxs)(`div`,{className:Ve?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,Y.jsxs)(`section`,{className:Ve?`w-full text-center`:`max-w-3xl`,children:[(0,Y.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:et}),(0,Y.jsx)(`p`,{className:Ve?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:tt})]}),He?(0,Y.jsx)(he,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Q,intent:z,labels:ze,attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Re,voice:ye,chat:t.chat,onIntentChange:B,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void ke(e),onDragOver:Pe,onDragLeave:Fe,onDrop:e=>void Ie(e),onSubmit:Le}):null,(0,Y.jsx)(ve,{advisor:l.advisor,busy:W,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,sceneHint:n.home.advisorSceneHint,sceneAction:n.home.advisorSceneAction,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:Ke,onAction:qe,onFeedback:Je,onClarification:Xe,onOpenHistory:()=>le(!0),preflight:me,receipt:te}),l.needsUser.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,Y.jsx)(o,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:l.needsUser.map(t=>(0,Y.jsx)(Me,{item:t,busy:V===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Ge},t.id))})]}):null,l.background.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,Y.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ae(n.home.backgroundCount,{count:l.backgroundCount})})]}),(0,Y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:l.background.map(e=>(0,Y.jsx)(Ne,{item:e,onAction:Ge},e.id))})]}):null]}):null,pe?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Ye,children:n.home.advisorUndo})]}):null]})}export{Pe as HomePage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./chevron-right-BweFrslA.js";import{t as o}from"./circle-alert-BEjgurr2.js";import{t as s}from"./circle-check-C23XjkUj.js";import{t as c}from"./clock-3-DnrAnuyZ.js";import{t as l}from"./external-link-DjqjBmc3.js";import{A as u,E as d,O as f,T as p,b as m,l as h,m as g,n as _,p as v,t as y,w as b,x}from"./use-composer-attachments-DL61XeSu.js";import{_ as S}from"./markdown-view-7tzqIp_G.js";import{t as C}from"./plus-Q2yW6OE7.js";import{t as w}from"./settings-2-D-csvaET.js";import{t as ee}from"./sparkles-DHlfQFAF.js";import{t as T}from"./x-B_N4OPjy.js";import{t as E}from"./messages-DPw2X06D.js";import{t as D}from"./cn-JdwAhgNB.js";import{n as O}from"./locale-store-Y1aBayM_.js";import{a as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dist-BGTk37IG.js";import{t as I}from"./button-CS04eWY9.js";import{a as L,i as R,o as z,r as B}from"./dist-3h6cXXhT.js";import{t as V}from"./skeleton-BwbyijEw.js";import{Fo as H,Ja as U,Jo as W,Ki as G,Ns as K,Or as te,Rr as ne,Xr as re,_c as ie,cn as ae,dn as oe,ia as se,ln as ce,os as le,r as ue,un as de,yc as fe}from"./index-CYeGnj-L.js";import{n as pe}from"./tab-completion-input-D64VNmiA.js";var q=e(t(),1),J=n(),Y=r(),me=12e3;function he(e){let t=(0,J.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:f,cancelAction:p,onIntentChange:m,onPickFiles:h,onRemoveAttachment:g,onPaste:v,onDragOver:y,onDragLeave:b,onDrop:x,onSubmit:S}=e,C=n===`inline`,w;t[0]!==s||t[1]!==a?(w=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=w):w=t[2];let T=w,E=d.voiceActive&&d.phase!==`error`,O;t[3]!==S||t[4]!==d.voiceActive?(O=e=>{if(d.voiceActive){e.preventDefault();return}S(e)},t[3]=S,t[4]=d.voiceActive,t[5]=O):O=t[5];let k=C?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=D(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==C||t[9]!==c||t[10]!==o.dropFiles?(j=c?(0,Y.jsx)(`div`,{className:D(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,C&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=C,t[9]=c,t[10]=o.dropFiles,t[11]=j):j=t[11];let M=!C&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,N;t[12]===M?N=t[13]:(N=D(M),t[12]=M,t[13]=N);let P=C?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,Y.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let L;t[18]!==l||t[19]!==f||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.retryVoiceInput||t[29]!==d.settingsRequired||t[30]!==d.voiceActive?(L=d.voiceActive?(0,Y.jsx)(de,{phase:d.phase,elapsedLabel:d.elapsedLabel,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:f,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=f,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.retryVoiceInput,t[29]=d.settingsRequired,t[30]=d.voiceActive,t[31]=L):L=t[31];let R=E&&`hidden`,z=C?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,B;t[32]!==R||t[33]!==z?(B=D(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,R,z),t[32]=R,t[33]=z,t[34]=B):B=t[34];let V;t[35]===m?V=t[36]:(V=e=>m(e.target.value),t[35]=m,t[36]=V);let H=!C,U;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==m||t[43]!==v||t[44]!==B||t[45]!==V||t[46]!==H?(U=(0,Y.jsx)(pe,{ref:i,id:r,className:B,value:a,onChange:V,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:m,onKeyDown:ge,placeholder:o.intentPlaceholder,maxLength:me,autoFocus:H}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=m,t[43]=v,t[44]=B,t[45]=V,t[46]=H,t[47]=U):U=t[47];let G=C?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,K;t[48]!==s||t[49]!==g||t[50]!==G?(K=(0,Y.jsx)(_,{attachments:s,topPadded:!1,onRemove:g,className:G}),t[48]=s,t[49]=g,t[50]=G,t[51]=K):K=t[51];let te;t[52]!==C||t[53]!==a.length||t[54]!==o.shortcut?(te=C?null:(0,Y.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Y.jsx)(`span`,{children:o.shortcut}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,me.toLocaleString()]})]}),t[52]=C,t[53]=a.length,t[54]=o.shortcut,t[55]=te):te=t[55];let re;t[56]!==L||t[57]!==U||t[58]!==K||t[59]!==te||t[60]!==N||t[61]!==F?(re=(0,Y.jsxs)(`div`,{className:N,children:[F,L,U,K,te]}),t[56]=L,t[57]=U,t[58]=K,t[59]=te,t[60]=N,t[61]=F,t[62]=re):re=t[62];let ie=C?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,ae;t[63]===ie?ae=t[64]:(ae=D(`flex shrink-0 items-center gap-2 border-t`,ie),t[63]=ie,t[64]=ae);let oe=!C&&`mr-auto`,se;t[65]===oe?se=t[66]:(se=D(`flex items-center gap-1`,oe),t[65]=oe,t[66]=se);let ce=l||u,le;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Y.jsx)(W,{className:`size-4`,"aria-hidden":!0}),t[67]=le):le=t[67];let ue;t[68]!==o.attachTitle||t[69]!==h||t[70]!==ce?(ue=(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ce,title:o.attachTitle,"aria-label":o.attachTitle,onClick:h,children:le}),t[68]=o.attachTitle,t[69]=h,t[70]=ce,t[71]=ue):ue=t[71];let fe;t[72]!==l||t[73]!==f||t[74]!==d.startVoiceInput||t[75]!==d.voiceActive?(fe=d.voiceActive?null:(0,Y.jsx)(ne,{disabled:l,chat:f,onStart:d.startVoiceInput}),t[72]=l,t[73]=f,t[74]=d.startVoiceInput,t[75]=d.voiceActive,t[76]=fe):fe=t[76];let q;t[77]!==se||t[78]!==ue||t[79]!==fe?(q=(0,Y.jsxs)(`div`,{className:se,children:[ue,fe]}),t[77]=se,t[78]=ue,t[79]=fe,t[80]=q):q=t[80];let he;t[81]!==p||t[82]!==C||t[83]!==o.shortcut?(he=C?(0,Y.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):p,t[81]=p,t[82]=C,t[83]=o.shortcut,t[84]=he):he=t[84];let X=C?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,_e=!T||l||d.voiceActive,Z=C?`size-3.5`:`size-4`,Q;t[85]===Z?Q=t[86]:(Q=(0,Y.jsx)(ee,{className:Z,"aria-hidden":!0}),t[85]=Z,t[86]=Q);let ve;t[87]!==o.submit||t[88]!==X||t[89]!==_e||t[90]!==Q?(ve=(0,Y.jsxs)(I,{type:`submit`,variant:`primary`,className:X,disabled:_e,children:[Q,o.submit]}),t[87]=o.submit,t[88]=X,t[89]=_e,t[90]=Q,t[91]=ve):ve=t[91];let ye;t[92]!==ae||t[93]!==q||t[94]!==he||t[95]!==ve?(ye=(0,Y.jsxs)(`div`,{className:ae,children:[q,he,ve]}),t[92]=ae,t[93]=q,t[94]=he,t[95]=ve,t[96]=ye):ye=t[96];let be;return t[97]!==b||t[98]!==y||t[99]!==x||t[100]!==O||t[101]!==re||t[102]!==ye||t[103]!==A||t[104]!==j?(be=(0,Y.jsxs)(`form`,{onSubmit:O,onDragOver:y,onDragLeave:b,onDrop:x,className:A,children:[j,re,ye]}),t[97]=b,t[98]=y,t[99]=x,t[100]=O,t[101]=re,t[102]=ye,t[103]=A,t[104]=j,t[105]=be):be=t[105],be}function ge(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function X(e){let t=(0,J.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,Y.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function _e(e){let t=(0,J.c)(69),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,l,u,d;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.sceneAction||t[7]!==r.sceneHint||t[8]!==r.why||t[9]!==i||t[10]!==n.capabilities||t[11]!==n.continuation||t[12]!==n.estimatedMinutes||t[13]!==n.outcome||t[14]!==n.rationale||t[15]!==n.title){let e=n.capabilities.filter(Q),f;t[22]===r.aiLabel?f=t[23]:(f=(0,Y.jsx)(`span`,{children:r.aiLabel}),t[22]=r.aiLabel,t[23]=f);let p;t[24]!==r.minutes||t[25]!==n.estimatedMinutes?(p=n.estimatedMinutes?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[24]=r.minutes,t[25]=n.estimatedMinutes,t[26]=p):p=t[26];let m;t[27]!==f||t[28]!==p?(m=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[f,p]}),t[27]=f,t[28]=p,t[29]=m):m=t[29];let h;t[30]!==r.history||t[31]!==i?(h=(0,Y.jsx)(X,{label:r.history,onClick:i}),t[30]=r.history,t[31]=i,t[32]=h):h=t[32],t[33]!==h||t[34]!==m?(a=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[m,h]}),t[33]=h,t[34]=m,t[35]=a):a=t[35],t[36]===n.title?o=t[37]:(o=(0,Y.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[36]=n.title,t[37]=o),t[38]===n.outcome?s=t[39]:(s=(0,Y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[38]=n.outcome,t[39]=s);let g;t[40]===r.why?g=t[41]:(g=(0,Y.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[40]=r.why,t[41]=g),t[42]!==n.rationale||t[43]!==g?(l=(0,Y.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[g,n.rationale]}),t[42]=n.rationale,t[43]=g,t[44]=l):l=t[44],t[45]!==r.automationAction||t[46]!==r.automationHint||t[47]!==r.sceneAction||t[48]!==r.sceneHint||t[49]!==n.continuation?(u=n.continuation?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.continuation.kind===`automation`?r.automationHint:r.sceneHint}),(0,Y.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n.continuation.kind===`automation`?r.automationAction:r.sceneAction})]}):null,t[45]=r.automationAction,t[46]=r.automationHint,t[47]=r.sceneAction,t[48]=r.sceneHint,t[49]=n.continuation,t[50]=u):u=t[50],d=e.length>0?(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.sceneAction,t[7]=r.sceneHint,t[8]=r.why,t[9]=i,t[10]=n.capabilities,t[11]=n.continuation,t[12]=n.estimatedMinutes,t[13]=n.outcome,t[14]=n.rationale,t[15]=n.title,t[16]=a,t[17]=o,t[18]=s,t[19]=l,t[20]=u,t[21]=d}else a=t[16],o=t[17],s=t[18],l=t[19],u=t[20],d=t[21];let f;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Y.jsx)(ie,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[51]=f):f=t[51];let p;t[52]===r.evidence?p=t[53]:(p=(0,Y.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,f]}),t[52]=r.evidence,t[53]=p);let m;t[54]===n.evidence?m=t[55]:(m=n.evidence.map(Z),t[54]=n.evidence,t[55]=m);let h;t[56]===m?h=t[57]:(h=(0,Y.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:m}),t[56]=m,t[57]=h);let g;t[58]!==h||t[59]!==p?(g=(0,Y.jsxs)(`details`,{className:`mt-4 group`,children:[p,h]}),t[58]=h,t[59]=p,t[60]=g):g=t[60];let _;return t[61]!==a||t[62]!==g||t[63]!==o||t[64]!==s||t[65]!==l||t[66]!==u||t[67]!==d?(_=(0,Y.jsxs)(Y.Fragment,{children:[a,o,s,l,u,d,g]}),t[61]=a,t[62]=g,t[63]=o,t[64]=s,t[65]=l,t[66]=u,t[67]=d,t[68]=_):_=t[68],_}function Z(e){return(0,Y.jsx)(`li`,{children:e.href?(0,Y.jsx)(`a`,{href:`#${e.href}`,className:`hover:text-accent hover:underline`,children:e.observation}):e.observation},e.id)}function Q(e){return e.readiness!==`ready`}function ve(e){let t=(0,J.c)(130),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:c,onClarification:l,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,q.useState)(),h;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(h=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==p?(_=g.find(e=>e.id===p)??g[0],t[4]=g,t[5]=p,t[6]=_):_=t[6];let v=_,y;t[7]===g[0]?.id?y=t[8]:(y=()=>m(g[0]?.id),t[7]=g[0]?.id,t[8]=y);let b=g[0]?.id,x;if(t[9]!==n.state||t[10]!==b?(x=[n.state,b],t[9]=n.state,t[10]=b,t[11]=x):x=t[11],(0,q.useEffect)(y,x),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(s,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==u?(o=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=o):o=t[22];let c=`#${f.href}`,l;t[23]!==r.viewProgress||t[24]!==c?(l=(0,Y.jsx)(I,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,Y.jsx)(`a`,{href:c,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=c,t[25]=l):l=t[25];let d;t[26]!==o||t[27]!==l?(d=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,l]}),t[26]=o,t[27]=l,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==a?(p=(0,Y.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,d]})}),t[29]=d,t[30]=a,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let i;t[33]===r.aiLabel?i=t[34]:(i=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=i);let a;t[35]!==r.history||t[36]!==u?(a=(0,Y.jsx)(X,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=a):a=t[37];let o;t[38]!==i||t[39]!==a?(o=(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[i,a]}),t[38]=i,t[39]=a,t[40]=o):o=t[40];let s;t[41]===n.question.question?s=t[42]:(s=(0,Y.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=s);let c;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==l){let e;t[47]!==n.question.question||t[48]!==l?(e=e=>(0,Y.jsx)(I,{type:`button`,variant:`secondary`,className:`min-h-11`,onClick:()=>l(n.question.question,e.label),children:e.label},e.id),t[47]=n.question.question,t[48]=l,t[49]=e):e=t[49],c=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=l,t[46]=c}else c=t[46];let d;t[50]===c?d=t[51]:(d=(0,Y.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:c}),t[50]=c,t[51]=d);let f;return t[52]!==s||t[53]!==d||t[54]!==o?(f=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[o,s,d]}),t[52]=s,t[53]=d,t[54]=o,t[55]=f):f=t[55],f}if(!v)return null;let S=d?.opportunityId===v.id?d.value:void 0,C;t[56]!==n.stale||t[57]!==r.refreshing?(C=n.stale?(0,Y.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,Y.jsx)(H,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[56]=n.stale,t[57]=r.refreshing,t[58]=C):C=t[58];let T;t[59]!==r||t[60]!==u||t[61]!==v?(T=(0,Y.jsx)(_e,{opportunity:v,copy:r,onOpenHistory:u}),t[59]=r,t[60]=u,t[61]=v,t[62]=T):T=t[62];let E;t[63]!==i||t[64]!==r.configure||t[65]!==r.degradedStart||t[66]!==r.setupHint||t[67]!==r.setupTitle||t[68]!==o||t[69]!==v||t[70]!==S?(E=S?.state===`needs_setup`?(0,Y.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:S.blockers.map(ye)}),(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[S.recoveryActions.map(e=>(0,Y.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),S.degradedAction?(0,Y.jsx)(I,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[63]=i,t[64]=r.configure,t[65]=r.degradedStart,t[66]=r.setupHint,t[67]=r.setupTitle,t[68]=o,t[69]=v,t[70]=S,t[71]=E):E=t[71];let D;t[72]!==i||t[73]!==r.start||t[74]!==o||t[75]!==v?(D=v.actions.canStart?(0,Y.jsxs)(I,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`start`),children:[(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[72]=i,t[73]=r.start,t[74]=o,t[75]=v,t[76]=D):D=t[76];let O;t[77]!==i||t[78]!==r.discuss||t[79]!==o||t[80]!==v?(O=v.actions.canDiscuss?(0,Y.jsxs)(I,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(v,`discuss`),children:[(0,Y.jsx)(le,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[77]=i,t[78]=r.discuss,t[79]=o,t[80]=v,t[81]=O):O=t[81];let k;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Y.jsx)(H,{className:`size-4`,"aria-hidden":!0}),t[82]=k):k=t[82];let A;t[83]!==i||t[84]!==r.refresh||t[85]!==a?(A=(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[k,r.refresh]}),t[83]=i,t[84]=r.refresh,t[85]=a,t[86]=A):A=t[86];let j;t[87]===r.feedback?j=t[88]:(j=(0,Y.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[87]=r.feedback,t[88]=j);let M;t[89]===r.alreadyDone?M=t[90]:(M=[`already_done`,r.alreadyDone],t[89]=r.alreadyDone,t[90]=M);let N;t[91]===r.irrelevant?N=t[92]:(N=[`irrelevant`,r.irrelevant],t[91]=r.irrelevant,t[92]=N);let P;t[93]===r.later?P=t[94]:(P=[`too_early`,r.later],t[93]=r.later,t[94]=P);let F;t[95]===r.sourceIncorrect?F=t[96]:(F=[`source_incorrect`,r.sourceIncorrect],t[95]=r.sourceIncorrect,t[96]=F);let L;t[97]===r.lessLikeThis?L=t[98]:(L=[`less_like_this`,r.lessLikeThis],t[97]=r.lessLikeThis,t[98]=L);let R;t[99]!==M||t[100]!==N||t[101]!==P||t[102]!==F||t[103]!==L?(R=[M,N,P,F,L],t[99]=M,t[100]=N,t[101]=P,t[102]=F,t[103]=L,t[104]=R):R=t[104];let z=R,B;t[105]!==c||t[106]!==v||t[107]!==z?(B=(0,Y.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:z.map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>c(v,t),children:n},t)})}),t[105]=c,t[106]=v,t[107]=z,t[108]=B):B=t[108];let V;t[109]!==j||t[110]!==B?(V=(0,Y.jsxs)(`details`,{className:`relative ml-auto`,children:[j,B]}),t[109]=j,t[110]=B,t[111]=V):V=t[111];let U;t[112]!==O||t[113]!==A||t[114]!==V||t[115]!==D?(U=(0,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,O,A,V]}),t[112]=O,t[113]=A,t[114]=V,t[115]=D,t[116]=U):U=t[116];let W;t[117]!==U||t[118]!==C||t[119]!==T||t[120]!==E?(W=(0,Y.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[C,T,E,U]}),t[117]=U,t[118]=C,t[119]=T,t[120]=E,t[121]=W):W=t[121];let G;t[122]!==r.alternatives||t[123]!==g||t[124]!==v.id?(G=g.length>1?(0,Y.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:g.filter(e=>e.id!==v.id).map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[122]=r.alternatives,t[123]=g,t[124]=v.id,t[125]=G):G=t[125];let K;return t[126]!==r.aiLabel||t[127]!==W||t[128]!==G?(K=(0,Y.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[W,G]}),t[126]=r.aiLabel,t[127]=W,t[128]=G,t[129]=K):K=t[129],K}function ye(e){return(0,Y.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var be=new Set([`started`,`discussing`,`completed`]);function xe(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Se)}),e[0]=t):t=e[0],t}function Se(e){return(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,Y.jsx)(V,{className:`h-4 w-24 rounded`}),(0,Y.jsx)(V,{className:`h-5 w-4/5 rounded`}),(0,Y.jsx)(V,{className:`h-4 w-3/5 rounded`})]},e)}function Ce(e){let t=(0,J.c)(11),{open:n,refreshKey:r,onOpenChange:a,onReevaluate:o}=e,s=O(Te),u=E(s).projectsPage.home,d=i(),[f,p]=(0,q.useState)(`all`),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[0]=m):m=t[0];let[h,g]=(0,q.useState)(m),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(),C;t[1]===n?C=t[2]:(C=()=>{if(!n)return;let e=!0;return v(!0),b(void 0),x().then(t=>{e&&g(t.items)}).catch(t=>{e&&b(t instanceof Error?t.message:String(t))}).finally(()=>{e&&v(!1)}),()=>{e=!1}},t[1]=n,t[2]=C);let w;t[3]!==n||t[4]!==r?(w=[n,r],t[3]=n,t[4]=r,t[5]=w):w=t[5],(0,q.useEffect)(C,w);let ee=h.filter(e=>f===`all`||(f===`adopted`?be.has(e.status):!be.has(e.status))),D=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),L=new Intl.DateTimeFormat(s===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),R=new Map;for(let e of ee){let t=D.format(new Date(e.updatedAt));R.set(t,[...R.get(t)??[],e])}let z=[...R.entries()],B=e=>e.feedbackKind===`already_done`?u.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?u.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?u.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?u.advisorHistoryStatusLessLikeThis:{available:u.advisorHistoryStatusAvailable,started:u.advisorHistoryStatusStarted,discussing:u.advisorHistoryStatusDiscussing,completed:u.advisorHistoryStatusCompleted,snoozed:u.advisorHistoryStatusSnoozed,dismissed:u.advisorHistoryStatusDismissed,expired:u.advisorHistoryStatusExpired,superseded:u.advisorHistoryStatusSuperseded}[e.status],V=e=>{if(e.href){a(!1),d(S(`/`,e.href));return}e.status===`discussing`&&(a(!1),d(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},U;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=U):U=t[6];let W;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.jsx)(K,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=W):W=t[7];let G;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[8]=G):G=t[8];let te=_?(0,Y.jsx)(xe,{}):y?(0,Y.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,Y.jsx)(`p`,{children:u.advisorHistoryLoadFailed}),(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>a(!1),children:u.advisorHistoryClose})]}):z.length===0?(0,Y.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,Y.jsx)(K,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,Y.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:u.advisorHistoryEmpty}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryEmptyHint})]}):(0,Y.jsx)(`div`,{className:`space-y-6`,children:z.map(e=>{let[t,n]=e;return(0,Y.jsxs)(`section`,{"aria-label":t,children:[(0,Y.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,Y.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,Y.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:B(e)}),(0,Y.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,Y.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:L.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,Y.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,Y.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReturnsAt,` `,L.format(new Date(e.snoozedUntil))]}):null,(0,Y.jsxs)(`details`,{className:`group mt-3`,children:[(0,Y.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[u.advisorHistoryEvidence,(0,Y.jsx)(ie,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(we)})]}),t||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,Y.jsxs)(I,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>V(e),children:[(0,Y.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?u.advisorHistoryContinueDiscussion:u.advisorHistoryViewProgress]}):null,n?(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{a(!1),o()},children:[(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),u.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),ne;return t[9]===te?ne=t[10]:(ne=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:te}),t[9]=te,t[10]=ne),(0,Y.jsx)(F,{open:n,onOpenChange:a,children:(0,Y.jsxs)(M,{children:[U,(0,Y.jsxs)(N,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[W,(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(P,{className:`text-base font-semibold text-fg`,children:u.advisorHistoryTitle}),(0,Y.jsx)(A,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.advisorHistoryDescription})]}),(0,Y.jsx)(j,{asChild:!0,children:(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":u.advisorHistoryClose,children:G})})]}),(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,Y.jsx)(`div`,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":u.advisorHistoryFilterLabel,children:[[`all`,u.advisorHistoryFilterAll],[`adopted`,u.advisorHistoryFilterAdopted],[`other`,u.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,Y.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${f===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":f===t,onClick:()=>p(t),children:n},t)})})}),ne]})]})})}function we(e){return(0,Y.jsx)(`li`,{children:e.observation},e.id)}function Te(e){return e.language}function Ee(e,t){return e.replace(`{{count}}`,String(t))}function $(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Ee(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var De={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Oe(e){let t=(0,J.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=$(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,f=n.state===`ready`?i.findAnother:i.retry,p=`${i.label}:${u.label}`,m;t[3]===u.refreshing?m=t[4]:(m=u.refreshing?(0,Y.jsx)(H,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=m);let h=De[u.tone],g;t[5]===h?g=t[6]:(g=D(`size-1.5 shrink-0 rounded-full`,h),t[5]=h,t[6]=g);let _;t[7]===g?_=t[8]:(_=(0,Y.jsx)(`span`,{className:g,"aria-hidden":!0}),t[7]=g,t[8]=_);let v;t[9]!==i.label||t[10]!==u.label?(v=(0,Y.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=v):v=t[11];let y;t[12]!==p||t[13]!==m||t[14]!==_||t[15]!==v?(y=(0,Y.jsx)(z,{asChild:!0,children:(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":p,children:[m,_,v]})}),t[12]=p,t[13]=m,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u.refreshing?b=t[18]:(b=(0,Y.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,Y.jsx)(H,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Y.jsx)(ee,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=b);let x;t[19]===u.label?x=t[20]:(x=(0,Y.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=x);let S;t[21]===u.detail?S=t[22]:(S=(0,Y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=S);let C;t[23]!==x||t[24]!==S?(C=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S]}),t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==b?(w=(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[b,C]}),t[26]=C,t[27]=b,t[28]=w):w=t[28];let T;t[29]===a?T=t[30]:(T=()=>{c(!1),a()},t[29]=a,t[30]=T);let E;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),t[31]=E):E=t[31];let O;t[32]!==i.history||t[33]!==T?(O=(0,Y.jsxs)(I,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:T,children:[E,i.history]}),t[32]=i.history,t[33]=T,t[34]=O):O=t[34];let k;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==f?(k=d?(0,Y.jsxs)(I,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,Y.jsx)(H,{className:`size-3.5`,"aria-hidden":!0}),f]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=f,t[39]=k):k=t[39];let A;t[40]!==O||t[41]!==k?(A=(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[O,k]}),t[40]=O,t[41]=k,t[42]=A):A=t[42];let j;t[43]!==w||t[44]!==A?(j=(0,Y.jsx)(R,{children:(0,Y.jsxs)(B,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-panel p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:ke,children:[w,A]})}),t[43]=w,t[44]=A,t[45]=j):j=t[45];let M;return t[46]!==s||t[47]!==j||t[48]!==y?(M=(0,Y.jsxs)(L,{open:s,onOpenChange:c,children:[y,j]}),t[46]=s,t[47]=j,t[48]=y,t[49]=M):M=t[49],M}function ke(e){return e.preventDefault()}function Ae(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function je(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(V,{className:`h-10 w-3/5 rounded-xl`}),(0,Y.jsx)(V,{className:`h-5 w-4/5 rounded-lg`})]}),(0,Y.jsx)(V,{className:`h-64 rounded-2xl`}),(0,Y.jsx)(V,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function Me(e){let t=(0,J.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${te(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,Y.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,Y.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Y.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,Y.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,Y.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let y;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(y=n.primaryAction||n.secondaryActions.length>0?(0,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,Y.jsx)(I,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,Y.jsx)(I,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=y):y=t[27];let b;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==y?(b=(0,Y.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,y]}),t[28]=f,t[29]=_,t[30]=v,t[31]=y,t[32]=b):b=t[32],b}function Ne(e){let t=(0,J.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,Y.jsx)(fe,{className:`size-4`,"aria-hidden":!0}):(0,Y.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let o=i,s=!n.openAction,c;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(c=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=c):c=t[5];let l;t[6]===o?l=t[7]:(l=(0,Y.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:o}),t[6]=o,t[7]=l);let u;t[8]===n.title?u=t[9]:(u=(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=u);let d;t[10]===n.summary?d=t[11]:(d=(0,Y.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]===n.statusLabel?p=t[16]:(p=n.statusLabel?(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=p);let m;t[17]===n.openAction?m=t[18]:(m=n.openAction?(0,Y.jsx)(a,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=m);let h;return t[19]!==s||t[20]!==c||t[21]!==l||t[22]!==f||t[23]!==p||t[24]!==m?(h=(0,Y.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:s,onClick:c,children:[l,f,p,m]}),t[19]=s,t[20]=c,t[21]=l,t[22]=f,t[23]=p,t[24]=m,t[25]=h):h=t[25],h}function Pe(){let e=O(e=>e.language),t=E(e),n=t.projectsPage,r=U(e),a=i(),s=G(e=>e.setPageHeader),c=G(e=>e.clearPageHeader),[l,_]=(0,q.useState)(null),[x,w]=(0,q.useState)(!0),[ee,D]=(0,q.useState)(null),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(``),[V,H]=(0,q.useState)(null),[W,K]=(0,q.useState)(!1),[te,ne]=(0,q.useState)(),[ie,le]=(0,q.useState)(!1),[de,fe]=(0,q.useState)(0),[pe,J]=(0,q.useState)(),[me,ge]=(0,q.useState)(),[X,_e]=(0,q.useState)(!1),Z=y({chat:t.chat}),Q=(0,q.useRef)(null),ye=se({disabled:X,chat:t.chat,onTranscript:e=>{B(t=>oe(t,e)),window.setTimeout(()=>Q.current?.focus(),0)}}),{phase:be,voiceActive:xe,startVoiceInput:Se,cancelVoiceInput:we,confirmVoiceInput:Te,retryVoiceInput:Ee}=ye,$=(0,q.useCallback)(async(t=!1)=>{t&&w(!0),D(null);try{_(await m(e))}catch(e){D(e instanceof Error?e.message:String(e))}finally{w(!1)}},[e]);(0,q.useEffect)(()=>{$(!0)},[$]),(0,q.useEffect)(()=>{if(!pe)return;let e=window.setTimeout(()=>J(void 0),8e3);return()=>window.clearTimeout(e)},[pe]),(0,q.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,$()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`,`home-advisor-updated`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[$]);let De=(0,q.useCallback)(async e=>{if(!(e.length===0||X)){_e(!0);try{await Z.processFiles(e)}finally{_e(!1)}}},[X,Z.processFiles]),ke=(0,q.useCallback)(async e=>{let t=re(e.clipboardData);t.length!==0&&(e.preventDefault(),await De(t))},[De]),Pe=(0,q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,Z.setIsDragging(!0))},[Z.setIsDragging]),Fe=(0,q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&Z.setIsDragging(!1)},[Z.setIsDragging]),Ie=(0,q.useCallback)(async e=>{e.preventDefault(),Z.setIsDragging(!1),await De(Array.from(e.dataTransfer.files))},[Z.setIsDragging,De]),Le=(0,q.useCallback)(e=>{e.preventDefault();let t=Z.wireAttachmentsPayload(),n=h(z,t.length>0?ue(t):void 0,{projectScope:`none`});n&&(R(!1),B(``),Z.clearAttachments(),a(n))},[Z.clearAttachments,Z.wireAttachmentsPayload,z,a]),Re=Z.attachments.length>=10,ze={attachTitle:Re?Ae(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${Z.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Be=(0,q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),Ve=!!(l&&l.needsUser.length===0&&l.backgroundCount===0),He=!!(l&&l.needsUser.length===0),Ue=He||L;(0,q.useEffect)(()=>{!Ue&&xe&&we()},[we,Ue,xe]),(0,q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!Ue||X||(e.preventDefault(),be===`recording`?Te():be===`idle`?(Q.current?.focus(),Se()):be===`error`&&Ee())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!Ue||!xe||(e.preventDefault(),we(),Q.current?.focus())};return window.addEventListener(ce,e),window.addEventListener(ae,t),()=>{window.removeEventListener(ce,e),window.removeEventListener(ae,t)}},[X,we,Ue,Te,Ee,Se,xe,be]);let We=(0,q.useCallback)(e=>{e||we(),R(e)},[we]),Ge=(0,q.useCallback)((e,t)=>{if(e.type===`open`){a(S(`/`,e.href));return}H(t),D(null),(async()=>{try{e.type===`connector_decision`?await p({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await d({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await v({kind:e.subjectKind,runId:e.runId}),await $()}catch(e){D(e instanceof Error?e.message:String(e))}finally{H(null)}})()},[$,a]),Ke=(0,q.useCallback)(()=>{K(!0),ne(void 0),ge(void 0),D(null),b(e).then(()=>$()).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>K(!1))},[e,$]),qe=(0,q.useCallback)((e,t)=>{K(!0),D(null),g(e,t).then(async t=>{if(t.outcome===`needs_setup`){ge({opportunityId:e.id,value:t.preflight});return}if(ge(void 0),fe(e=>e+1),t.outcome===`task`){ne({title:n.home.advisorStartedTitle,detail:Ae(n.home.advisorStartedDetail,{title:e.title}),href:S(`/`,t.href)}),await $();return}a(t.href)}).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>K(!1))},[$,a,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),Je=(0,q.useCallback)((e,t)=>{K(!0),ne(void 0),ge(void 0),D(null),f(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(J({opportunityId:e.id,idempotencyKey:t}),fe(e=>e+1),$())).catch(e=>D(e instanceof Error?e.message:String(e))).finally(()=>K(!1))},[$]),Ye=(0,q.useCallback)(()=>{if(!pe)return;let e=pe;J(void 0),K(!0),D(null),u(e.opportunityId,e.idempotencyKey).then(()=>(fe(e=>e+1),$())).catch(t=>{J(e),D(t instanceof Error?t.message:String(t))}).finally(()=>K(!1))},[pe,$]),Xe=(0,q.useCallback)((e,t)=>{a(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[a]),Ze=(0,q.useMemo)(()=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l?(0,Y.jsx)(Oe,{advisor:l.advisor,busy:W,copy:Be,onOpenHistory:()=>le(!0),onRefresh:Ke}):null,He?null:(0,Y.jsxs)(I,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>R(!0),children:[(0,Y.jsx)(C,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[W,Be,r.newWork,l,Ke,He]);(0,q.useLayoutEffect)(()=>(s({startExtra:null,main:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:Ze}),()=>c()),[c,Ze,s,n.title]);let Qe=l?.needsUser.length??0,$e=l?.backgroundCount??0,et=Qe>0?Ae(n.home.attentionTitle,{count:Qe}):$e>0?n.home.clearTitle:n.home.idleTitle,tt=Qe>0?$e>0?Ae(n.home.attentionIntroWithBackground,{count:$e}):n.home.attentionIntro:$e>0?Ae(n.home.clearIntro,{count:$e}):n.home.idleIntro;return(0,Y.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,Y.jsx)(`input`,{ref:Z.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&De(Array.from(t)),e.target.value=``}}),(0,Y.jsx)(F,{open:L,onOpenChange:We,children:(0,Y.jsxs)(M,{children:[(0,Y.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Y.jsxs)(N,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(P,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,Y.jsx)(A,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,Y.jsx)(j,{asChild:!0,children:(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,Y.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Y.jsx)(he,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Q,intent:z,labels:{...ze,submit:r.submit},attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Re,voice:ye,chat:t.chat,cancelAction:(0,Y.jsx)(j,{asChild:!0,children:(0,Y.jsx)(I,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:B,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void ke(e),onDragOver:Pe,onDragLeave:Fe,onDrop:e=>void Ie(e),onSubmit:Le})]})]})}),(0,Y.jsx)(Ce,{open:ie,refreshKey:de,onOpenChange:le,onReevaluate:Ke}),ee?(0,Y.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Y.jsx)(`span`,{children:ee}),(0,Y.jsx)(I,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void $(),children:n.home.retry})]}):null,x?(0,Y.jsx)(je,{}):l?(0,Y.jsxs)(`div`,{className:Ve?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,Y.jsxs)(`section`,{className:Ve?`w-full text-center`:`max-w-3xl`,children:[(0,Y.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:et}),(0,Y.jsx)(`p`,{className:Ve?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:tt})]}),He?(0,Y.jsx)(he,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Q,intent:z,labels:ze,attachments:Z.attachments,isDragging:Z.isDragging,attachmentBusy:X,attachmentsFull:Re,voice:ye,chat:t.chat,onIntentChange:B,onPickFiles:()=>Z.fileInputRef.current?.click(),onRemoveAttachment:Z.removeAttachment,onPaste:e=>void ke(e),onDragOver:Pe,onDragLeave:Fe,onDrop:e=>void Ie(e),onSubmit:Le}):null,(0,Y.jsx)(ve,{advisor:l.advisor,busy:W,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,sceneHint:n.home.advisorSceneHint,sceneAction:n.home.advisorSceneAction,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:Ke,onAction:qe,onFeedback:Je,onClarification:Xe,onOpenHistory:()=>le(!0),preflight:me,receipt:te}),l.needsUser.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,Y.jsx)(o,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,Y.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,Y.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:l.needsUser.map(t=>(0,Y.jsx)(Me,{item:t,busy:V===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Ge},t.id))})]}):null,l.background.length>0?(0,Y.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,Y.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,Y.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ae(n.home.backgroundCount,{count:l.backgroundCount})})]}),(0,Y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:l.background.map(e=>(0,Y.jsx)(Ne,{item:e,onAction:Ge},e.id))})]}):null]}):null,pe?(0,Y.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-panel px-4 py-3 text-sm text-fg shadow-float`,children:[(0,Y.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,Y.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:Ye,children:n.home.advisorUndo})]}):null]})}export{Pe as HomePage};
|
package/dist/gateway/static/root/assets/{imports-page-BKVKfVMA.js → imports-page-Cd4tcbLU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./settings-2-D-csvaET.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./messages-DPw2X06D.js";import{t as d}from"./cn-JdwAhgNB.js";import{a as f,n as p,r as m}from"./locale-store-Y1aBayM_.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./button-CS04eWY9.js";import{i as C,o as w}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Ho as T,Hs as E,Sc as D,Zo as O,_c as k}from"./index-ByFXhQ-T.js";import{n as A,r as j}from"./settings-page-layout-X1x-2Cp9.js";import{n as M}from"./settings-loading-skeleton-CAmWMaOT.js";var N=e(t(),1);async function P(e,t,n){return(await f(m(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:s,locked:f,error:m,onClose:T,onRefresh:k,onSubmit:A}=e,j=u(p(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=j.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===T?Y=t[18]:(Y=e=>{e||T()},t[17]=T,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${w}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=d(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,C),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(l,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=m&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:m}),(0,B.jsx)(S,{variant:`secondary`,disabled:f,onClick:k,children:j.refresh})]}),$;t[22]!==m||t[23]!==i?($=!i&&!m&&(0,B.jsx)(M,{sections:2}),t[22]=m,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:j.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:c,title:j.personalSetup,description:j.personalSetupHint,items:G,selected:a,open:P,disabled:f,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:O,title:j.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:D,title:j.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:E,title:j.kinds.project,description:j.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:f,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:f,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:j.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[j.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=S,ke=!i||!a.size||s,Ae=s?j.importing:f?j.retry:j.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==A||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:A,children:Ae}),t[29]=Oe,t[30]=A,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(x,{open:n,onOpenChange:Y,children:(0,B.jsxs)(v,{children:[X,(0,B.jsxs)(y,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(b,{className:`text-xl font-semibold text-fg`,children:j.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(g,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:j.chooseHint})]}),(0,B.jsx)(_,{asChild:!0,children:(0,B.jsx)(S,{variant:`ghost`,"aria-label":j.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.runningHint}),f&&!s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(S,{variant:`ghost`,onClick:T,children:s?j.close:j.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=u(p(fe)).imports,[o,s]=(0,N.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>s(U),t[0]=c):c=t[0];let l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(T,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=l):l=t[1];let f=a.connectionsHint.replace(`{count}`,String(r.length)),m;t[2]===f?m=t[3]:(m=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:f}),t[2]=f,t[3]=m);let h=o&&`rotate-180`,g;t[4]===h?g=t[5]:(g=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[4]=h,t[5]=g);let _;t[6]===g?_=t[7]:(_=(0,B.jsx)(k,{"aria-hidden":`true`,className:g}),t[6]=g,t[7]=_);let v;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(v=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(S,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=v):v=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(S,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:c,children:[l,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),m]}),_]})}),v]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=p(pe),a;t[0]===i?a=t[1]:(a=u(i),t[0]=i,t[1]=a);let o=a.imports,[s,c]=(0,N.useState)(),[l,d]=(0,N.useState)(!1),[f,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==s?(h=async function(){if(d(G),!s)try{c(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=s,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=o.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x;t[12]!==_||t[13]!==v||t[14]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=x):x=t[15];let C;t[16]===g?C=t[17]:(C=()=>void g(),t[16]=g,t[17]=C);let w;t[18]!==o.preview||t[19]!==C?(w=(0,B.jsx)(S,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:C,children:o.preview}),t[18]=o.preview,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==x?(T=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,w]}),t[21]=w,t[22]=x,t[23]=T):T=t[23];let E;t[24]===r.reason?E=t[25]:(E=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=E);let D;t[26]!==f||t[27]!==l||t[28]!==s?(D=l&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:f?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:f}):s?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:s.text}):(0,B.jsx)(M,{sections:1})}),t[26]=f,t[27]=l,t[28]=s,t[29]=D):D=t[29];let O;return t[30]!==T||t[31]!==E||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[T,E,D]}),t[30]=T,t[31]=E,t[32]=D,t[33]=O):O=t[33],O}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:l,onCheckedChange:u,children:f}=e,p;t[0]!==a||t[1]!==o?(p=L(a,o),t[0]=a,t[1]=o,t[2]=p):p=t[2];let m=p,h;t[3]!==l||t[4]!==s?(h=()=>l(!s),t[3]=l,t[4]=s,t[5]=h):h=t[5];let g;t[6]===n?g=t[7]:(g=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=g);let _;t[8]===r?_=t[9]:(_=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=_);let v;t[10]===i?v=t[11]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=v);let y;t[12]!==_||t[13]!==v?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=s&&`rotate-180`,x;t[15]===b?x=t[16]:(x=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[15]=b,t[16]=x);let C;t[17]===x?C=t[18]:(C=(0,B.jsx)(k,{"aria-hidden":`true`,className:x}),t[17]=x,t[18]=C);let w;t[19]!==s||t[20]!==h||t[21]!==g||t[22]!==y||t[23]!==C?(w=(0,B.jsxs)(S,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:h,children:[g,y,C]}),t[19]=s,t[20]=h,t[21]=g,t[22]=y,t[23]=C,t[24]=w):w=t[24];let T=c||!m.availableCount,E;t[25]!==u||t[26]!==m.checked||t[27]!==m.indeterminate||t[28]!==T||t[29]!==r?(E=(0,B.jsx)(X,{label:r,checked:m.checked,indeterminate:m.indeterminate,disabled:T,onChange:u}),t[25]=u,t[26]=m.checked,t[27]=m.indeterminate,t[28]=T,t[29]=r,t[30]=E):E=t[30];let D;t[31]!==w||t[32]!==E?(D=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[w,E]}),t[31]=w,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==f||t[35]!==s?(O=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:f}),t[34]=f,t[35]=s,t[36]=O):O=t[36];let A;return t[37]!==D||t[38]!==O?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[D,O]}),t[37]=D,t[38]=O,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:s,onToggle:c,onToggleAll:l}=e,f=u(p(_e)).imports,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``),[v,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==o?(b=L(i,o),t[0]=i,t[1]=o,t[2]=b):b=t[2];let x=b,C=Y(i,g),w=C.slice(0,v),T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>h(ge),t[3]=T):T=t[3];let E;t[4]===n?E=t[5]:(E=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=E);let D;t[6]!==i.length||t[7]!==r?(D=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=D):D=t[8];let O;t[9]!==x.availableCount||t[10]!==x.selectedCount?(O=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[x.selectedCount,`/`,x.availableCount]}),t[9]=x.availableCount,t[10]=x.selectedCount,t[11]=O):O=t[11];let A=m&&`rotate-180`,j;t[12]===A?j=t[13]:(j=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(k,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==m||t[17]!==E||t[18]!==D||t[19]!==O||t[20]!==M?(P=(0,B.jsxs)(S,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":m,onClick:T,children:[E,D,O,M]}),t[16]=m,t[17]=E,t[18]=D,t[19]=O,t[20]=M,t[21]=P):P=t[21];let I=s||!x.availableCount,R;t[22]!==l||t[23]!==x.checked||t[24]!==x.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:x.checked,indeterminate:x.indeterminate,disabled:I,onChange:l}),t[22]=l,t[23]=x.checked,t[24]=x.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=m&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:g,label:f.searchWithin.replace(`{group}`,r),onChange:e=>{_(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:w.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:s,onChange:t=>c(e,t)},e.id))}),!C.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:f.noMatches}),w.length<C.length&&(0,B.jsx)(S,{variant:`ghost`,className:`w-full`,onClick:()=>y(K),children:f.showMore.replace(`{count}`,String(C.length-w.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:s}=e,c=u(p(ye)).imports,[l,d]=(0,N.useState)(``),[f,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,l,h),_=g.slice(0,f),v=r.length>8&&(0,B.jsx)(J,{value:l,label:c.searchWithin.replace(`{group}`,c.kinds.project),onChange:e=>{d(e),m(60)}}),y;t[2]!==o||t[3]!==n||t[4]!==s||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:s},e.id),t[2]=o,t[3]=n,t[4]=s,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),x;t[8]===b?x=t[9]:(x=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=x);let C=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:c.noMatches}),w=_.length<g.length&&(0,B.jsx)(S,{variant:`ghost`,className:`w-full`,onClick:()=>m(q),children:c.showMore.replace(`{count}`,String(g.length-_.length))}),T;return t[10]!==v||t[11]!==x||t[12]!==C||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,x,C,w]}),t[10]=v,t[11]=x,t[12]=C,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:s}=e,c=u(p(we)).imports,[l,f]=(0,N.useState)(!1),m;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),m=i.filter(e),t[0]=i,t[1]=a,t[2]=m}else m=t[2];let h=m.length,g=S,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>f(Ce),t[5]=_):_=t[5];let v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b;t[10]!==v||t[11]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let x=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[c.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,c.chosenCount.replace(`{count}`,String(h))]}),C=l&&`rotate-180`,w;t[13]===C?w=t[14]:(w=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,C),t[13]=C,t[14]=w);let T;t[15]===w?T=t[16]:(T=(0,B.jsx)(k,{"aria-hidden":`true`,className:w}),t[15]=w,t[16]=T);let E;t[17]!==g||t[18]!==l||t[19]!==x||t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,B.jsxs)(g,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":l,onClick:_,children:[b,x,T]}),t[17]=g,t[18]=l,t[19]=x,t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=r.name,O;t[24]!==r.id||t[25]!==a?(O=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=O):O=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==s||t[31]!==r?(j=e=>s(r,e.target.checked),t[30]=s,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==O||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":D,checked:O,disabled:A,onChange:j}),t[33]=r.name,t[34]=O,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==E||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[E,M]}),t[38]=E,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==s||t[45]!==l||t[46]!==a||t[47]!==c?(L=l&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>s(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:c.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=s,t[45]=l,t[46]=a,t[47]=c,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let c=`${r}…`,l;t[3]===i?l=t[4]:(l=e=>i(e.target.value),t[3]=i,t[4]=l);let u;t[5]!==r||t[6]!==c||t[7]!==l||t[8]!==n?(u=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:c,"aria-label":r,onChange:l,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=c,t[7]=l,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==o||t[11]!==u?(d=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,u]}),t[10]=o,t[11]=u,t[12]=d):d=t[12],d}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=p(Te),c;t[0]===s?c=t[1]:(c=u(s),t[0]=s,t[1]=c);let l=c.imports,[d,f]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==d?(v=async function(){if(_(Q),!d)try{f(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=d,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let x;t[9]===o?x=t[10]:(x=e=>o(e.target.checked),t[9]=o,t[10]=x);let C;t[11]!==i||t[12]!==b||t[13]!==x?(C=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:x}),t[11]=i,t[12]=b,t[13]=x,t[14]=C):C=t[14];let w;t[15]===r.name?w=t[16]:(w=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=w);let T;t[17]===r.displayPath?T=t[18]:(T=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]!==C||t[23]!==E?(D=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[C,E]}),t[22]=C,t[23]=E,t[24]=D):D=t[24];let O;t[25]!==r.name||t[26]!==r.status||t[27]!==l||t[28]!==y?(O=r.status!==`blocked`&&(0,B.jsx)(S,{variant:`ghost`,"aria-label":`${l.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:l.preview}),t[25]=r.name,t[26]=r.status,t[27]=l,t[28]=y,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;t[33]===r.description?A=t[34]:(A=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=A);let j;t[35]!==r.status||t[36]!==r.targetName||t[37]!==l?(j=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[l.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=l,t[38]=j):j=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==d||t[42]!==m||t[43]!==g||t[44]!==l?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:d.text}),d.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l.previewTruncated})]}):(0,B.jsx)(M,{sections:1})}),t[41]=d,t[42]=m,t[43]=g,t[44]=l,t[45]=R):R=t[45];let z;return t[46]!==k||t[47]!==A||t[48]!==j||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[k,A,j,L,R]}),t[46]=k,t[47]=A,t[48]=j,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=u(p(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,s]=(0,N.useState)(),[c,l]=(0,N.useState)(!1),[d,f]=(0,N.useState)(),[m,h]=(0,N.useState)(new Set),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(),[b,x]=(0,N.useState)(),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(``),[D,O]=(0,N.useState)(0),k=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return w(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||w(t instanceof Error?t.message:String(t))}),()=>{e.abort(),k.current?.abort()}},[D]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&y(t=>t?.requestId===e.id?void 0:t)}async function R(e){k.current?.abort();let t=new AbortController;k.current=t,s(e),l(!0),f(void 0),h(new Set),E(``),x(void 0),y(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(f(n),h(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}async function z(){if(!d||!m.size||F.current)return;F.current=!0,_(!0),E(``),w(``);let e=v??{inventoryId:d.id,candidateIds:[...m],requestId:crypto.randomUUID(),retryOf:b};y(e);try{L(await P(`/runs`,e)),l(!1)}catch(e){let t=e instanceof Error?e.message:String(e);E(t),w(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&y(void 0)}finally{F.current=!1,_(!1)}}async function H(e){s(e.source),l(!0),f(void 0),h(new Set),E(``),y(void 0),x(e.id),k.current?.abort();let t=new AbortController;k.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),f({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),h(r)}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{title:e.title,subtitle:e.subtitle}),C&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:C}),!t&&(0,B.jsx)(S,{variant:`ghost`,onClick:()=>O(e=>e+1),children:e.retry})]}),!t&&!C&&(0,B.jsx)(M,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(S,{variant:`secondary`,disabled:g||!t.detected||!!v&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{w(``),v&&r===t.id?l(!0):R(t.id)},children:g&&r===t.id?e.importing:v&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(S,{variant:`ghost`,disabled:g||!!v,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(S,{variant:`ghost`,className:`mt-3`,onClick:()=>O(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:d,selected:m,onSelected:h,busy:g,locked:g||!!v,error:T,onClose:()=>{k.current?.abort(),l(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ as ImportsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./search-DA7gz22f.js";import{t as c}from"./settings-2-D-csvaET.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./messages-DPw2X06D.js";import{t as d}from"./cn-JdwAhgNB.js";import{a as f,n as p,r as m}from"./locale-store-Y1aBayM_.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BGTk37IG.js";import{t as S}from"./button-CS04eWY9.js";import{i as C,o as w}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{Ho as T,Hs as E,Sc as D,Zo as O,_c as k}from"./index-CYeGnj-L.js";import{n as A,r as j}from"./settings-page-layout-X1x-2Cp9.js";import{n as M}from"./settings-loading-skeleton-CAmWMaOT.js";var N=e(t(),1);async function P(e,t,n){return(await f(m(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var F=n();function I(e){return e.kind!==`connection`&&(e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`)}function L(e,t){let n=e.filter(I),r=n.filter(e=>t.has(e.id)).length;return{checked:n.length>0&&r===n.length,indeterminate:r>0&&r<n.length,selectedCount:r,availableCount:n.length}}function R(e,t,n,r){return n.reduce((t,n)=>z(e,t,n,r),new Set(t))}function z(e,t,n,r){let i=new Set(t);if(!I(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&I(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var B=r();function V(e){let t=(0,F.c)(34),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:s,locked:f,error:m,onClose:T,onRefresh:k,onSubmit:A}=e,j=u(p(ue)).imports,[P,I]=(0,N.useState)(!0),[L,V]=(0,N.useState)(!1),U;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>{I(!0),V(!1)},t[0]=U):U=t[0];let fe=i?.id,W;t[1]===fe?W=t[2]:(W=[fe],t[1]=fe,t[2]=W),(0,N.useEffect)(U,W);let G=i?.candidates.filter(le)??[],pe;t[3]===i?.candidates?pe=t[4]:(pe=i?.candidates.filter(ce)??[],t[3]=i?.candidates,t[4]=pe);let K=pe,ge;t[5]===i?.candidates?ge=t[6]:(ge=i?.candidates.filter(se)??[],t[5]=i?.candidates,t[6]=ge);let _e=ge,q;if(t[7]!==i?.candidates){q=new Map;for(let e of i?.candidates??[]){if(!e.parentId)continue;let t=q.get(e.parentId)??[];t.push(e),q.set(e.parentId,t)}t[7]=i?.candidates,t[8]=q}else q=t[8];let ye=q,be=i?.candidates.filter(e=>a.has(e.id))??[],xe=j.selected.replace(`{skills}`,String(be.filter(oe).length)).replace(`{context}`,String(be.filter(ae).length)).replace(`{projects}`,String(be.filter(ie).length)),Se;t[9]!==i||t[10]!==o||t[11]!==a?(Se=(e,t)=>{i&&o(z(i,a,e,t))},t[9]=i,t[10]=o,t[11]=a,t[12]=Se):Se=t[12];let Ce=Se,we;t[13]!==i||t[14]!==o||t[15]!==a?(we=(e,t)=>{i&&o(R(i,a,e,t))},t[13]=i,t[14]=o,t[15]=a,t[16]=we):we=t[16];let J=we,Y;t[17]===T?Y=t[18]:(Y=e=>{e||T()},t[17]=T,t[18]=Y);let X;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,B.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 bg-scrim ${w}`}),t[19]=X):X=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=d(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),720px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay outline-none`,`max-sm:bottom-0 max-sm:left-0 max-sm:top-auto max-sm:h-[min(92dvh,760px)] max-sm:w-full max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none`,C),t[20]=Z):Z=t[20];let Q;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,B.jsx)(l,{"aria-hidden":`true`,className:`h-4 w-4`}),t[21]=Q):Q=t[21];let Te=m&&(0,B.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg`,children:[(0,B.jsx)(`p`,{children:m}),(0,B.jsx)(S,{variant:`secondary`,disabled:f,onClick:k,children:j.refresh})]}),$;t[22]!==m||t[23]!==i?($=!i&&!m&&(0,B.jsx)(M,{sections:2}),t[22]=m,t[23]=i,t[24]=$):$=t[24];let Ee=i&&(0,B.jsxs)(B.Fragment,{children:[!i.complete&&(0,B.jsx)(`p`,{className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:j.incomplete}),G.length>0&&(0,B.jsxs)(me,{icon:c,title:j.personalSetup,description:j.personalSetupHint,items:G,selected:a,open:P,disabled:f,onOpenChange:I,onCheckedChange:e=>J(G,e),children:[(0,B.jsx)(he,{icon:O,title:j.kinds.skill,items:G.filter(re),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ne),e)}),(0,B.jsx)(he,{icon:D,title:j.kinds.context,items:G.filter(te),inventoryId:i.id,selected:a,disabled:f,onToggle:Ce,onToggleAll:e=>J(G.filter(ee),e)})]}),K.length>0&&(0,B.jsx)(me,{icon:E,title:j.kinds.project,description:j.projectsHint.replace(`{count}`,String(K.length)),items:K,selected:a,open:L,disabled:f,onOpenChange:V,onCheckedChange:e=>J(K,e),children:(0,B.jsx)(ve,{inventoryId:i.id,projects:K,projectChildren:ye,selected:a,disabled:f,onToggle:Ce})}),_e.length>0&&(0,B.jsx)(de,{inventoryId:i.id,items:_e}),!i.candidates.length&&(0,B.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-5 text-sm text-fg-muted`,children:j.noContent}),!!i.notices.length&&(0,B.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer font-medium text-fg`,children:[j.scanNotices,` (`,i.notices.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2`,children:i.notices.map(H)})]})]}),De;t[25]!==Te||t[26]!==$||t[27]!==Ee?(De=(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4 sm:p-6`,children:[Te,$,Ee]}),t[25]=Te,t[26]=$,t[27]=Ee,t[28]=De):De=t[28];let Oe=S,ke=!i||!a.size||s,Ae=s?j.importing:f?j.retry:j.importCount.replace(`{count}`,String(a.size)),je;return t[29]!==Oe||t[30]!==A||t[31]!==ke||t[32]!==Ae?(je=(0,B.jsx)(Oe,{variant:`primary`,disabled:ke,onClick:A,children:Ae}),t[29]=Oe,t[30]=A,t[31]=ke,t[32]=Ae,t[33]=je):je=t[33],(0,B.jsx)(x,{open:n,onOpenChange:Y,children:(0,B.jsxs)(v,{children:[X,(0,B.jsxs)(y,{className:Z,children:[(0,B.jsx)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-5 sm:p-6`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(b,{className:`text-xl font-semibold text-fg`,children:j.chooseTitle.replace(`{source}`,r)}),(0,B.jsx)(g,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:j.chooseHint})]}),(0,B.jsx)(_,{asChild:!0,children:(0,B.jsx)(S,{variant:`ghost`,"aria-label":j.close,className:`h-10 w-10 shrink-0 p-0`,children:Q})})]})}),De,(0,B.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-overlay p-4 sm:px-6 sm:py-5`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,B.jsxs)(`div`,{"aria-live":`polite`,className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:xe}),s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.runningHint}),f&&!s&&(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.retryHint})]}),(0,B.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2`,children:[(0,B.jsx)(S,{variant:`ghost`,onClick:T,children:s?j.close:j.cancel}),je]})]})})]})]})})}function H(e,t){return(0,B.jsx)(`li`,{className:`break-words`,children:e},t)}function ee(e){return e.kind===`context`}function te(e){return e.kind===`context`}function ne(e){return e.kind===`skill`}function re(e){return e.kind===`skill`}function ie(e){return e.kind===`project`}function ae(e){return e.kind===`context`}function oe(e){return e.kind===`skill`}function se(e){return e.kind===`connection`}function ce(e){return e.kind===`project`}function le(e){return!e.parentId&&(e.kind===`skill`||e.kind===`context`)}function ue(e){return e.language}function de(e){let t=(0,F.c)(13),{inventoryId:n,items:r}=e,a=u(p(fe)).imports,[o,s]=(0,N.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>s(U),t[0]=c):c=t[0];let l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(T,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[1]=l):l=t[1];let f=a.connectionsHint.replace(`{count}`,String(r.length)),m;t[2]===f?m=t[3]:(m=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:f}),t[2]=f,t[3]=m);let h=o&&`rotate-180`,g;t[4]===h?g=t[5]:(g=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,h),t[4]=h,t[5]=g);let _;t[6]===g?_=t[7]:(_=(0,B.jsx)(k,{"aria-hidden":`true`,className:g}),t[6]=g,t[7]=_);let v;return t[8]!==n||t[9]!==r||t[10]!==o||t[11]!==a?(v=o&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:[r.map(e=>(0,B.jsx)(W,{inventoryId:n,item:e},e.id)),(0,B.jsx)(S,{asChild:!0,variant:`secondary`,children:(0,B.jsx)(i,{to:`/capabilities/connectors`,children:a.connectionsAction})})]}),t[8]=n,t[9]=r,t[10]=o,t[11]=a,t[12]=v):v=t[12],(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[(0,B.jsx)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:(0,B.jsxs)(S,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":o,onClick:c,children:[l,(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:a.kinds.connection}),m]}),_]})}),v]})}function U(e){return!e}function fe(e){return e.language}function W(e){let t=(0,F.c)(34),{inventoryId:n,item:r}=e,i=p(pe),a;t[0]===i?a=t[1]:(a=u(i),t[0]=i,t[1]=a);let o=a.imports,[s,c]=(0,N.useState)(),[l,d]=(0,N.useState)(!1),[f,m]=(0,N.useState)(``),h;t[2]!==n||t[3]!==r.id||t[4]!==s?(h=async function(){if(d(G),!s)try{c(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;m(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=s,t[5]=h):h=t[5];let g=h,_;t[6]===r.name?_=t[7]:(_=(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=_);let v;t[8]===r.displayPath?v=t[9]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[8]=r.displayPath,t[9]=v);let y=o.statuses[r.status],b;t[10]===y?b=t[11]:(b=(0,B.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x;t[12]!==_||t[13]!==v||t[14]!==b?(x=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v,b]}),t[12]=_,t[13]=v,t[14]=b,t[15]=x):x=t[15];let C;t[16]===g?C=t[17]:(C=()=>void g(),t[16]=g,t[17]=C);let w;t[18]!==o.preview||t[19]!==C?(w=(0,B.jsx)(S,{variant:`ghost`,className:`h-9 shrink-0 px-2`,onClick:C,children:o.preview}),t[18]=o.preview,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==x?(T=(0,B.jsxs)(`div`,{className:`flex items-start gap-3`,children:[x,w]}),t[21]=w,t[22]=x,t[23]=T):T=t[23];let E;t[24]===r.reason?E=t[25]:(E=r.reason&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:r.reason}),t[24]=r.reason,t[25]=E);let D;t[26]!==f||t[27]!==l||t[28]!==s?(D=l&&(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-surface-inset p-3`,children:f?(0,B.jsx)(`p`,{role:`alert`,className:`text-xs text-fg-muted`,children:f}):s?(0,B.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:s.text}):(0,B.jsx)(M,{sections:1})}),t[26]=f,t[27]=l,t[28]=s,t[29]=D):D=t[29];let O;return t[30]!==T||t[31]!==E||t[32]!==D?(O=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[T,E,D]}),t[30]=T,t[31]=E,t[32]=D,t[33]=O):O=t[33],O}function G(e){return!e}function pe(e){return e.language}function me(e){let t=(0,F.c)(40),{icon:n,title:r,description:i,items:a,selected:o,open:s,disabled:c,onOpenChange:l,onCheckedChange:u,children:f}=e,p;t[0]!==a||t[1]!==o?(p=L(a,o),t[0]=a,t[1]=o,t[2]=p):p=t[2];let m=p,h;t[3]!==l||t[4]!==s?(h=()=>l(!s),t[3]=l,t[4]=s,t[5]=h):h=t[5];let g;t[6]===n?g=t[7]:(g=(0,B.jsx)(`span`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-surface-panel text-fg`,children:(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5`})}),t[6]=n,t[7]=g);let _;t[8]===r?_=t[9]:(_=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r}),t[8]=r,t[9]=_);let v;t[10]===i?v=t[11]:(v=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:i}),t[10]=i,t[11]=v);let y;t[12]!==_||t[13]!==v?(y=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=s&&`rotate-180`,x;t[15]===b?x=t[16]:(x=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,b),t[15]=b,t[16]=x);let C;t[17]===x?C=t[18]:(C=(0,B.jsx)(k,{"aria-hidden":`true`,className:x}),t[17]=x,t[18]=C);let w;t[19]!==s||t[20]!==h||t[21]!==g||t[22]!==y||t[23]!==C?(w=(0,B.jsxs)(S,{variant:`ghost`,className:`min-w-0 flex-1 justify-start gap-3 px-1 text-left`,"aria-expanded":s,onClick:h,children:[g,y,C]}),t[19]=s,t[20]=h,t[21]=g,t[22]=y,t[23]=C,t[24]=w):w=t[24];let T=c||!m.availableCount,E;t[25]!==u||t[26]!==m.checked||t[27]!==m.indeterminate||t[28]!==T||t[29]!==r?(E=(0,B.jsx)(X,{label:r,checked:m.checked,indeterminate:m.indeterminate,disabled:T,onChange:u}),t[25]=u,t[26]=m.checked,t[27]=m.indeterminate,t[28]=T,t[29]=r,t[30]=E):E=t[30];let D;t[31]!==w||t[32]!==E?(D=(0,B.jsxs)(`div`,{className:`flex min-h-16 items-center gap-3 px-3 py-2 sm:px-4`,children:[w,E]}),t[31]=w,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==f||t[35]!==s?(O=s&&(0,B.jsx)(`div`,{className:`space-y-2 border-t border-edge bg-surface-overlay p-3 sm:p-4`,children:f}),t[34]=f,t[35]=s,t[36]=O):O=t[36];let A;return t[37]!==D||t[38]!==O?(A=(0,B.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-inset`,children:[D,O]}),t[37]=D,t[38]=O,t[39]=A):A=t[39],A}function he(e){let t=(0,F.c)(34),{icon:n,title:r,items:i,inventoryId:a,selected:o,disabled:s,onToggle:c,onToggleAll:l}=e,f=u(p(_e)).imports,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(``),[v,y]=(0,N.useState)(60);if(!i.length)return null;let b;t[0]!==i||t[1]!==o?(b=L(i,o),t[0]=i,t[1]=o,t[2]=b):b=t[2];let x=b,C=Y(i,g),w=C.slice(0,v),T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>h(ge),t[3]=T):T=t[3];let E;t[4]===n?E=t[5]:(E=(0,B.jsx)(n,{"aria-hidden":`true`,className:`h-5 w-5 shrink-0 text-fg-muted`}),t[4]=n,t[5]=E);let D;t[6]!==i.length||t[7]!==r?(D=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:[r,` (`,i.length,`)`]}),t[6]=i.length,t[7]=r,t[8]=D):D=t[8];let O;t[9]!==x.availableCount||t[10]!==x.selectedCount?(O=(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[x.selectedCount,`/`,x.availableCount]}),t[9]=x.availableCount,t[10]=x.selectedCount,t[11]=O):O=t[11];let A=m&&`rotate-180`,j;t[12]===A?j=t[13]:(j=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,A),t[12]=A,t[13]=j);let M;t[14]===j?M=t[15]:(M=(0,B.jsx)(k,{"aria-hidden":`true`,className:j}),t[14]=j,t[15]=M);let P;t[16]!==m||t[17]!==E||t[18]!==D||t[19]!==O||t[20]!==M?(P=(0,B.jsxs)(S,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-1 text-left`,"aria-expanded":m,onClick:T,children:[E,D,O,M]}),t[16]=m,t[17]=E,t[18]=D,t[19]=O,t[20]=M,t[21]=P):P=t[21];let I=s||!x.availableCount,R;t[22]!==l||t[23]!==x.checked||t[24]!==x.indeterminate||t[25]!==I||t[26]!==r?(R=(0,B.jsx)(X,{label:r,checked:x.checked,indeterminate:x.indeterminate,disabled:I,onChange:l}),t[22]=l,t[23]=x.checked,t[24]=x.indeterminate,t[25]=I,t[26]=r,t[27]=R):R=t[27];let z;t[28]!==P||t[29]!==R?(z=(0,B.jsxs)(`div`,{className:`flex min-h-14 items-center gap-2 px-3 py-2`,children:[P,R]}),t[28]=P,t[29]=R,t[30]=z):z=t[30];let V=m&&(0,B.jsxs)(`div`,{className:`space-y-2 border-t border-edge p-2`,children:[i.length>8&&(0,B.jsx)(J,{value:g,label:f.searchWithin.replace(`{group}`,r),onChange:e=>{_(e),y(60)}}),(0,B.jsx)(`div`,{className:`space-y-1`,children:w.map(e=>(0,B.jsx)(Z,{inventoryId:a,item:e,checked:o.has(e.id),disabled:s,onChange:t=>c(e,t)},e.id))}),!C.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:f.noMatches}),w.length<C.length&&(0,B.jsx)(S,{variant:`ghost`,className:`w-full`,onClick:()=>y(K),children:f.showMore.replace(`{count}`,String(C.length-w.length))})]}),H;return t[31]!==z||t[32]!==V?(H=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[z,V]}),t[31]=z,t[32]=V,t[33]=H):H=t[33],H}function K(e){return e+60}function ge(e){return!e}function _e(e){return e.language}function ve(e){let t=(0,F.c)(15),{inventoryId:n,projects:r,projectChildren:i,selected:a,disabled:o,onToggle:s}=e,c=u(p(ye)).imports,[l,d]=(0,N.useState)(``),[f,m]=(0,N.useState)(60),h;t[0]===i?h=t[1]:(h=e=>i.get(e.id)??[],t[0]=i,t[1]=h);let g=Y(r,l,h),_=g.slice(0,f),v=r.length>8&&(0,B.jsx)(J,{value:l,label:c.searchWithin.replace(`{group}`,c.kinds.project),onChange:e=>{d(e),m(60)}}),y;t[2]!==o||t[3]!==n||t[4]!==s||t[5]!==i||t[6]!==a?(y=e=>(0,B.jsx)(be,{inventoryId:n,project:e,children:i.get(e.id)??[],selected:a,disabled:o,onToggle:s},e.id),t[2]=o,t[3]=n,t[4]=s,t[5]=i,t[6]=a,t[7]=y):y=t[7];let b=_.map(y),x;t[8]===b?x=t[9]:(x=(0,B.jsx)(`div`,{className:`space-y-2`,children:b}),t[8]=b,t[9]=x);let C=!g.length&&(0,B.jsx)(`p`,{className:`p-3 text-sm text-fg-muted`,children:c.noMatches}),w=_.length<g.length&&(0,B.jsx)(S,{variant:`ghost`,className:`w-full`,onClick:()=>m(q),children:c.showMore.replace(`{count}`,String(g.length-_.length))}),T;return t[10]!==v||t[11]!==x||t[12]!==C||t[13]!==w?(T=(0,B.jsxs)(`div`,{className:`space-y-2`,children:[v,x,C,w]}),t[10]=v,t[11]=x,t[12]=C,t[13]=w,t[14]=T):T=t[14],T}function q(e){return e+60}function ye(e){return e.language}function be(e){let t=(0,F.c)(52),{inventoryId:n,project:r,children:i,selected:a,disabled:o,onToggle:s}=e,c=u(p(we)).imports,[l,f]=(0,N.useState)(!1),m;if(t[0]!==i||t[1]!==a){let e;t[3]===a?e=t[4]:(e=e=>a.has(e.id),t[3]=a,t[4]=e),m=i.filter(e),t[0]=i,t[1]=a,t[2]=m}else m=t[2];let h=m.length,g=S,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>f(Ce),t[5]=_):_=t[5];let v;t[6]===r.name?v=t[7]:(v=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:r.name}),t[6]=r.name,t[7]=v);let y;t[8]===r.displayPath?y=t[9]:(y=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs font-normal text-fg-muted`,children:r.displayPath}),t[8]=r.displayPath,t[9]=y);let b;t[10]!==v||t[11]!==y?(b=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[v,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let x=i.length>0&&(0,B.jsxs)(`span`,{className:`text-xs font-normal text-fg-muted`,children:[c.projectContents.replace(`{skills}`,String(i.filter(Se).length)).replace(`{context}`,String(i.filter(xe).length)),` · `,c.chosenCount.replace(`{count}`,String(h))]}),C=l&&`rotate-180`,w;t[13]===C?w=t[14]:(w=d(`h-4 w-4 shrink-0 text-fg-muted transition-transform duration-200 motion-reduce:transition-none`,C),t[13]=C,t[14]=w);let T;t[15]===w?T=t[16]:(T=(0,B.jsx)(k,{"aria-hidden":`true`,className:w}),t[15]=w,t[16]=T);let E;t[17]!==g||t[18]!==l||t[19]!==x||t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,B.jsxs)(g,{variant:`ghost`,className:`min-w-0 flex-1 justify-start px-2 text-left`,"aria-expanded":l,onClick:_,children:[b,x,T]}),t[17]=g,t[18]=l,t[19]=x,t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=r.name,O;t[24]!==r.id||t[25]!==a?(O=a.has(r.id),t[24]=r.id,t[25]=a,t[26]=O):O=t[26];let A;t[27]!==o||t[28]!==r?(A=o||!I(r),t[27]=o,t[28]=r,t[29]=A):A=t[29];let j;t[30]!==s||t[31]!==r?(j=e=>s(r,e.target.checked),t[30]=s,t[31]=r,t[32]=j):j=t[32];let M;t[33]!==r.name||t[34]!==O||t[35]!==A||t[36]!==j?(M=(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":D,checked:O,disabled:A,onChange:j}),t[33]=r.name,t[34]=O,t[35]=A,t[36]=j,t[37]=M):M=t[37];let P;t[38]!==E||t[39]!==M?(P=(0,B.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[E,M]}),t[38]=E,t[39]=M,t[40]=P):P=t[40];let L;t[41]!==i||t[42]!==o||t[43]!==n||t[44]!==s||t[45]!==l||t[46]!==a||t[47]!==c?(L=l&&(0,B.jsx)(`div`,{className:`border-t border-edge p-2`,children:i.length?(0,B.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,B.jsx)(Z,{inventoryId:n,item:e,checked:a.has(e.id),disabled:o,onChange:t=>s(e,t)},e.id))}):(0,B.jsx)(`p`,{className:`p-2 text-xs text-fg-muted`,children:c.directoryOnly})}),t[41]=i,t[42]=o,t[43]=n,t[44]=s,t[45]=l,t[46]=a,t[47]=c,t[48]=L):L=t[48];let R;return t[49]!==P||t[50]!==L?(R=(0,B.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[P,L]}),t[49]=P,t[50]=L,t[51]=R):R=t[51],R}function xe(e){return e.kind===`context`}function Se(e){return e.kind===`skill`}function Ce(e){return!e}function we(e){return e.language}function J(e){let t=(0,F.c)(13),{value:n,label:r,onChange:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-fg-muted`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,B.jsx)(`span`,{className:`sr-only`,children:r}),t[1]=r,t[2]=o);let c=`${r}…`,l;t[3]===i?l=t[4]:(l=e=>i(e.target.value),t[3]=i,t[4]=l);let u;t[5]!==r||t[6]!==c||t[7]!==l||t[8]!==n?(u=(0,B.jsx)(`input`,{type:`search`,autoComplete:`off`,value:n,placeholder:c,"aria-label":r,onChange:l,className:`min-w-0 flex-1 border-0 bg-transparent px-0 py-2 text-sm text-fg placeholder:text-fg-subtle`}),t[5]=r,t[6]=c,t[7]=l,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==o||t[11]!==u?(d=(0,B.jsxs)(`label`,{className:`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 focus-within:border-accent focus-within:ring-1 focus-within:ring-accent`,children:[a,o,u]}),t[10]=o,t[11]=u,t[12]=d):d=t[12],d}function Y(e,t,n=()=>[]){let r=t.trim().toLocaleLowerCase();if(!r)return e;let i=e=>`${e.name} ${e.description} ${e.displayPath}`.toLocaleLowerCase().includes(r);return e.filter(e=>i(e)||n(e).some(i))}function X(e){let t=(0,F.c)(10),{label:n,checked:r,indeterminate:i,disabled:a,onChange:o}=e,s=(0,N.useRef)(null),c,l;t[0]===i?(c=t[1],l=t[2]):(c=()=>{s.current&&(s.current.indeterminate=i)},l=[i],t[0]=i,t[1]=c,t[2]=l),(0,N.useEffect)(c,l);let u;t[3]===o?u=t[4]:(u=e=>o(e.target.checked),t[3]=o,t[4]=u);let d;return t[5]!==r||t[6]!==a||t[7]!==n||t[8]!==u?(d=(0,B.jsx)(`input`,{ref:s,type:`checkbox`,"aria-label":n,checked:r,disabled:a,onChange:u}),t[5]=r,t[6]=a,t[7]=n,t[8]=u,t[9]=d):d=t[9],d}function Z(e){let t=(0,F.c)(52),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=p(Te),c;t[0]===s?c=t[1]:(c=u(s),t[0]=s,t[1]=c);let l=c.imports,[d,f]=(0,N.useState)(),[m,h]=(0,N.useState)(``),[g,_]=(0,N.useState)(!1),v;t[2]!==n||t[3]!==r.id||t[4]!==d?(v=async function(){if(_(Q),!d)try{f(await P(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;h(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=d,t[5]=v):v=t[5];let y=v,b;t[6]!==a||t[7]!==r?(b=a||!I(r),t[6]=a,t[7]=r,t[8]=b):b=t[8];let x;t[9]===o?x=t[10]:(x=e=>o(e.target.checked),t[9]=o,t[10]=x);let C;t[11]!==i||t[12]!==b||t[13]!==x?(C=(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:i,disabled:b,onChange:x}),t[11]=i,t[12]=b,t[13]=x,t[14]=C):C=t[14];let w;t[15]===r.name?w=t[16]:(w=(0,B.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=w);let T;t[17]===r.displayPath?T=t[18]:(T=(0,B.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,title:r.displayPath,children:r.displayPath}),t[17]=r.displayPath,t[18]=T);let E;t[19]!==w||t[20]!==T?(E=(0,B.jsxs)(`span`,{className:`min-w-0`,children:[w,T]}),t[19]=w,t[20]=T,t[21]=E):E=t[21];let D;t[22]!==C||t[23]!==E?(D=(0,B.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3 py-1`,children:[C,E]}),t[22]=C,t[23]=E,t[24]=D):D=t[24];let O;t[25]!==r.name||t[26]!==r.status||t[27]!==l||t[28]!==y?(O=r.status!==`blocked`&&(0,B.jsx)(S,{variant:`ghost`,"aria-label":`${l.preview}: ${r.name}`,className:`h-9 shrink-0 px-2`,onClick:()=>void y(),children:l.preview}),t[25]=r.name,t[26]=r.status,t[27]=l,t[28]=y,t[29]=O):O=t[29];let k;t[30]!==D||t[31]!==O?(k=(0,B.jsxs)(`div`,{className:`flex items-start gap-2`,children:[D,O]}),t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;t[33]===r.description?A=t[34]:(A=r.description&&(0,B.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[33]=r.description,t[34]=A);let j;t[35]!==r.status||t[36]!==r.targetName||t[37]!==l?(j=r.status!==`ready`&&(0,B.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[l.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[35]=r.status,t[36]=r.targetName,t[37]=l,t[38]=j):j=t[38];let L;t[39]===r.reason?L=t[40]:(L=r.reason&&(0,B.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[39]=r.reason,t[40]=L);let R;t[41]!==d||t[42]!==m||t[43]!==g||t[44]!==l?(R=g&&(0,B.jsx)(`div`,{className:`ml-7 mt-2 rounded-lg border border-edge bg-surface-inset p-3`,children:m?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:m}):d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:d.text}),d.truncated&&(0,B.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l.previewTruncated})]}):(0,B.jsx)(M,{sections:1})}),t[41]=d,t[42]=m,t[43]=g,t[44]=l,t[45]=R):R=t[45];let z;return t[46]!==k||t[47]!==A||t[48]!==j||t[49]!==L||t[50]!==R?(z=(0,B.jsxs)(`div`,{className:`min-w-0 rounded-lg px-2 py-1.5 hover:bg-surface-hover/60`,children:[k,A,j,L,R]}),t[46]=k,t[47]=A,t[48]=j,t[49]=L,t[50]=R,t[51]=z):z=t[51],z}function Q(e){return!e}function Te(e){return e.language}function $(){let e=u(p(e=>e.language)).imports,[t,n]=(0,N.useState)(),[r,s]=(0,N.useState)(),[c,l]=(0,N.useState)(!1),[d,f]=(0,N.useState)(),[m,h]=(0,N.useState)(new Set),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(),[b,x]=(0,N.useState)(),[C,w]=(0,N.useState)(``),[T,E]=(0,N.useState)(``),[D,O]=(0,N.useState)(0),k=(0,N.useRef)(null),F=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let e=new AbortController;return w(``),P(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||w(t instanceof Error?t.message:String(t))}),()=>{e.abort(),k.current?.abort()}},[D]);let I=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,N.useEffect)(()=>{if(!I)return;let e=new AbortController,t,n=async()=>{for(let t of I.split(`,`))try{let n=await P(`/runs/${t}`,void 0,e.signal);e.signal.aborted||L(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[I]);function L(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&y(t=>t?.requestId===e.id?void 0:t)}async function R(e){k.current?.abort();let t=new AbortController;k.current=t,s(e),l(!0),f(void 0),h(new Set),E(``),x(void 0),y(void 0);try{let n=await P(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(f(n),h(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}async function z(){if(!d||!m.size||F.current)return;F.current=!0,_(!0),E(``),w(``);let e=v??{inventoryId:d.id,candidateIds:[...m],requestId:crypto.randomUUID(),retryOf:b};y(e);try{L(await P(`/runs`,e)),l(!1)}catch(e){let t=e instanceof Error?e.message:String(e);E(t),w(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&y(void 0)}finally{F.current=!1,_(!1)}}async function H(e){s(e.source),l(!0),f(void 0),h(new Set),E(``),y(void 0),x(e.id),k.current?.abort();let t=new AbortController;k.current=t;try{let n=await P(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),f({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),h(r)}catch(e){t.signal.aborted||E(e instanceof Error?e.message:String(e))}}let ee=t?.filter(e=>e.detected||e.lastImport);return(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{title:e.title,subtitle:e.subtitle}),C&&(0,B.jsxs)(`div`,{role:`alert`,className:`rounded-xl bg-danger-soft p-4 text-sm text-danger`,children:[(0,B.jsx)(`p`,{children:C}),!t&&(0,B.jsx)(S,{variant:`ghost`,onClick:()=>O(e=>e+1),children:e.retry})]}),!t&&!C&&(0,B.jsx)(M,{sections:1}),t&&(0,B.jsxs)(`section`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),ee?.length?(0,B.jsx)(`div`,{className:`flex flex-col gap-1 overflow-hidden rounded-xl bg-surface-hover/20 p-1 [&>*]:rounded-lg [&>*]:bg-surface-base/45`,children:ee.map(t=>(0,B.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,B.jsx)(o,{className:`h-5 w-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,B.jsx)(S,{variant:`secondary`,disabled:g||!t.detected||!!v&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{w(``),v&&r===t.id?l(!0):R(t.id)},children:g&&r===t.id?e.importing:v&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,B.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,B.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,B.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,B.jsxs)(`details`,{children:[(0,B.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,B.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,B.jsxs)(`li`,{className:`break-words`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,B.jsx)(S,{variant:`ghost`,disabled:g||!!v,onClick:()=>void H(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/20 p-6 text-sm text-fg-muted`,children:[(0,B.jsx)(`p`,{children:e.empty}),(0,B.jsx)(S,{variant:`ghost`,className:`mt-3`,onClick:()=>O(e=>e+1),children:e.refresh})]}),(0,B.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),ee?.some(e=>e.lastImport)&&(0,B.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/skills`,children:e.openSkills}),(0,B.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,B.jsx)(i,{className:`text-accent`,to:`/capabilities/connectors`,children:e.connections})]})]}),(0,B.jsx)(V,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:d,selected:m,onSelected:h,busy:g,locked:g||!!v,error:T,onClose:()=>{k.current?.abort(),l(!1)},onRefresh:()=>{r&&R(r)},onSubmit:()=>void z()})]})}export{$ as ImportsPage};
|