@xopcai/xopc 0.0.147 → 0.0.149
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/{activity-store-DXeSSlw1.js → activity-store-B4s0ipx2.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CFdJKSjY.js → agent-avatar-dicebear-BSccACje.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DZDOcgz5.js +2 -0
- package/dist/gateway/static/root/assets/{api-Bs69B5zA.js → api-BMdUsNCV.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-ag1ViXT_.js → app-management-settings-panel-DrLGhYkI.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C6iMpwOM.js → appearance-settings-BNasnY9D.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Cmr-Hvm9.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Dwi3mIBy.js → archive-plugin-BQ17IK9x.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BaCDoq40.js → attachment-load-HXvgWHXu.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CwqtFgnw.js → automation-suggestion-card-CjIWpsch.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-TWgUAI8t.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DoAYhsxa.js → binary-plugins-DifWJzNZ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Bw72pO7S.js → block-editor-DtRzIkPU.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DBsFItW_.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-vdbAR65Q.js → capability-presets-api-DazKjWW1.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-BAsKbJgm.js → capability-presets-settings-panel-Cvrw4fD1.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-rTG26jpV.js → channel-recipient-api-Bea6if_6.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BBkzrBYy.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-CuU6ez3y.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-DIMP4NWY.js → connector-logo-BjbYbJjQ.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DLsZCAw7.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-kQq2e0BN.js → desktop-pet-C6V-PHwi.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B6vtozMY.js → desktop-pet-settings-5Fcz47XQ.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Dn5-e3v4.js → directory-picker-path-field-C8zZNUzC.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BzwIujPG.js → dreaming-settings-gJSw7Adk.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-D_e_hsEy.js → extension-debug-page-DFE5ADJ0.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D15CWHBd.js → extension-page-CfR-aW8G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-D4P0n1om.js → extension-settings-page-CFIEbs2L.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-B4qZctjG.js → gateway-config-api-B6M_ra8U.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BrxzyVW2.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BpgMunEb.js → gateway-startup-retry-DNA3OOzV.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DrVHKXHq.js → goal-create-dialog-DRVRLc5Z.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-8F7NElzP.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-B6YJB_ct.js → goals-config-api-D88opgcs.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BaoLiV8G.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-BROWCIcL.js → goals-settings-D07UL8Jo.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CoCwIOIg.js → heartbeat-settings-YCSNOcXC.js} +1 -1
- package/dist/gateway/static/root/assets/{index-CxkNzw3e.js → index-CH7XN6KY.js} +43 -43
- package/dist/gateway/static/root/assets/index-Dfnl9tp_.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bm_AIYQ7.js → keyboard-shortcuts-settings-BHnh5OoY.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Boe8n4zH.js +2 -0
- package/dist/gateway/static/root/assets/local-apps-page-CKvtLzsF.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-Bp8joZck.js → locale-store-BneNAR8R.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Cb4Uptct.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-Dy7QpaAz.js → markdown-split-BVSFG99p.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-3Lxliy9D.js → media-plugins-DdOjIVk3.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CQGpD-dC.js → messages-t1yPaVCt.js} +5 -5
- package/dist/gateway/static/root/assets/models-hub-panel-CNiUKZUV.js +2 -0
- package/dist/gateway/static/root/assets/{notes-page-BJtT4vSf.js → notes-page-ZbLR3awn.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-C9__VkD6.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-DKB6RDre.js → page-tabs-DMlQERNg.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Br_YhYHp.js → preview-open-alternatives-CbiJRPxK.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CZhuB5kO.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BOq4WVdR.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BxGq0ebQ.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BgIE9BBh.js → save-bar-controls-BZTj3hxl.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-BXDP-oMz.js → schedule-field-CxYDObjT.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Dhv-SmjG.js → schema-form-CBbXgpKQ.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B6gSU_Au.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DwuBL834.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-CUTExnlK.js → settings-collapsible-section-BySKZ8rp.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-CmnDhsf0.js → settings-form-section-CjINay6t.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-B79dq-XY.js → settings-loading-skeleton-vitElc-n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-Db8uAv3X.js → settings-page-BNrVwuL7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DaFwstQw.js → settings-page-layout-HdlQOOqp.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BJeA4mmk.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Bi00uXzV.js → share-preview-page-DC-eQONB.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DB2KYA2_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DQtZiejw.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Pm0fNe_p.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-Cxaph7hW.js → system-settings-panel-CVa90q2f.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-eCTN1RpG.js → theme-store-D1cOpgsy.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CcZ_tyFY.js → typed-models-lib-DIKF9vpz.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-C4PWbNoi.js → use-channel-catalog-DnvpI0Ys.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-DnLqQyRG.js +1 -0
- package/dist/gateway/static/root/assets/{user-profile-fields-editor-CPOO9Jz5.js → user-profile-fields-editor-y8gTmkPX.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-C8cgtSF7.js → user-profile-settings-panel-C3pvqe28.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-CiZK2KwH.js → utils-BK2vwu_3.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BiFIIWC4.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-D2-_bC0J.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-B0FPG4eJ.js +1 -0
- package/dist/gateway/static/root/assets/work-page-BDeVxts_.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BPzS67fU.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-xPhmrRLs.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/gateway/hono/routes/work-discovery.js +32 -0
- package/dist/src/gateway/hono/routes/work-discovery.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/046_work_discovery_feedback.sql +13 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/work-discovery/analyzer.js +23 -4
- package/dist/src/work-discovery/analyzer.js.map +1 -1
- package/dist/src/work-discovery/index.js +2 -2
- package/dist/src/work-discovery/probe.d.ts +6 -0
- package/dist/src/work-discovery/probe.js +12 -1
- package/dist/src/work-discovery/probe.js.map +1 -1
- package/dist/src/work-discovery/repository.d.ts +7 -1
- package/dist/src/work-discovery/repository.js +35 -2
- package/dist/src/work-discovery/repository.js.map +1 -1
- package/dist/src/work-discovery/service.d.ts +6 -1
- package/dist/src/work-discovery/service.js +64 -5
- package/dist/src/work-discovery/service.js.map +1 -1
- package/dist/src/work-discovery/types.d.ts +21 -0
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-DKjbRpbA.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-CpX3lBFF.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DlupOxFQ.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BwLoUBcZ.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CxFWy0cE.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-OKlqTtKJ.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BjQQwX62.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-BvndV7TP.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-PHlCwv68.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-Hg9uyO6e.js +0 -2
- package/dist/gateway/static/root/assets/index-DjCSOyaN.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BJWFcxwG.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-BsiZMrEf.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DOmK61ey.js +0 -7
- package/dist/gateway/static/root/assets/models-hub-panel-DGCZom4o.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-B_bN7cOR.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-Dq8JouJj.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DvfL7fSe.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DqwMXSXP.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B_mOZkQk.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BHGmH6YS.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BUSEj0KK.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DzsTYfuX.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DSsdU081.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DeB1tQZL.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-QTVMx_hG.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-b-YZtvUu.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-4zVDOl2G.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-CHe2tfkc.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-8SLCYeXE.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DEOFqiWn.js +0 -11
|
@@ -0,0 +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{l as i,u as a}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as o}from"./cn-BQ_8x0bT.js";import{t as s}from"./circle-alert-RzVebuX2.js";import{t as c}from"./messages-t1yPaVCt.js";import{d as l,i as u,n as d,o as f,r as p}from"./locale-store-BneNAR8R.js";import{i as m}from"./vendor-swr-BIWyz7Rc.js";import{Ao as h,As as g,Bs as _,Fo as v,Io as y,Jo as b,Lr as x,Mo as S,No as C,Ol as w,Po as T,Qs as E,Wo as D,Xo as O,Yo as k,Zl as A,ai as j,ao as M,cs as N,dc as P,hs as F,ii as I,it as L,jo as R,ko as z,oc as B,oi as ee,oo as te,sa as ne,to as re,ys as ie,zc as V}from"./index-CH7XN6KY.js";import{n as ae,t as oe}from"./settings-page-layout-HdlQOOqp.js";import{n as se}from"./settings-loading-skeleton-vitElc-n.js";import{t as ce}from"./schema-form-CBbXgpKQ.js";import{t as le}from"./browser-BLJWD7WI.js";import{n as ue,t as de}from"./channels-status-swr-CuU6ez3y.js";import{t as fe}from"./use-channel-catalog-DnvpI0Ys.js";var H=n(),pe=e(le(),1),U=e(t(),1),W=r();function me(e){let t=e.actions??{};for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n?.result===`qr`)return[e,n]}let n=Object.entries(t).find(([,e])=>e.result===`qr`);if(n)return n;let r=e.ui?.card?.primaryAction;if(r&&t[r])return[r,t[r]];for(let e of[`login.start`,`setup.start`]){let n=t[e];if(n)return[e,n]}return Object.entries(t).find(([,e])=>e.result===`form`)??null}async function he(e){let t=await p(l(`/api/channels/${encodeURIComponent(e.channelId)}/actions/${encodeURIComponent(e.actionId)}?locale=${encodeURIComponent(e.locale)}`),{method:`POST`,body:JSON.stringify({...e.accountId?{accountId:e.accountId}:{},...e.input===void 0?{}:{input:e.input}})}),n=await t.json().catch(()=>({}));if(!t.ok||n.ok===!1)throw Error(n.error?.message??t.statusText);return n.payload??{type:`ok`}}function ge(e){return e?.type===`poll`&&e.phase===`done`}function G(e){return e&&`message`in e&&typeof e.message==`string`?e.message:null}function K(e,t){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrPayload?e.qrPayload:t===`weixin`&&e.qrcodeUrl?e.qrcodeUrl:null}function q(e){return e?.type!==`qr`&&e?.type!==`poll`?null:e.qrcodeUrl??null}function _e({entry:e,locale:t,messages:n,onChanged:r,compact:i=!1}){let a=(0,U.useMemo)(()=>me(e),[e]),s=(0,U.useMemo)(()=>({defaultBooleanLabel:n.schemaBooleanDefault,unsupportedArrayType:n.schemaUnsupportedArrayType,arrayAddPlaceholder:n.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>n.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[n]),[c,l]=(0,U.useState)({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null});(0,U.useEffect)(()=>{l({payload:null,poll:null,busy:!1,error:null,formDraft:{},generatedQr:null})},[e.id]);let u=(0,U.useCallback)(async(n,i)=>{l(e=>({...e,busy:!0,error:null}));try{let a=await he({channelId:e.id,actionId:n,locale:t,input:i});l(e=>({...e,payload:a,poll:a.type===`qr`&&a.statusAction&&a.sessionKey?{actionId:a.statusAction,sessionKey:a.sessionKey,intervalMs:Math.max(1e3,a.pollIntervalMs??2500)}:null,busy:!1,formDraft:a.type===`form`?a.values??{}:e.formDraft})),`configChanged`in a&&a.configChanged===!0&&await r()}catch(e){l(t=>({...t,busy:!1,error:e instanceof Error?e.message:String(e)}))}},[e.id,t,r]);(0,U.useEffect)(()=>{let t=K(c.payload,e.id);if(!t){l(e=>e.generatedQr?{...e,generatedQr:null}:e);return}let n=!1;return l(e=>e.generatedQr?{...e,generatedQr:null}:e),pe.toDataURL(t,{width:220,margin:1}).then(e=>{n||l(t=>({...t,generatedQr:e}))}),()=>{n=!0}},[e.id,c.payload]),(0,U.useEffect)(()=>{let n=c.poll;if(!n)return;let i=!1,a=window.setInterval(()=>{i||he({channelId:e.id,actionId:n.actionId,locale:t,input:{sessionKey:n.sessionKey}}).then(async e=>{i||(l(t=>({...t,payload:e,poll:ge(e)?null:t.poll,error:null})),`configChanged`in e&&e.configChanged===!0&&await r(),ge(e)&&window.clearInterval(a))}).catch(e=>{i||l(t=>({...t,error:e instanceof Error?e.message:String(e)}))})},n.intervalMs);return()=>{i=!0,window.clearInterval(a)}},[e.id,t,r,c.poll]);let d=a?.[1].label??(e.configured?n.reconnect:n.connect),f=e.actions?.[`doctor.run`]?.label??n.diagnose,p=G(c.payload),m=K(c.payload,e.id),h=m?c.generatedQr:q(c.payload),g=a?.[1].result===`qr`&&(c.busy||c.payload?.type===`qr`||c.payload?.type===`poll`),v=c.payload?.type===`form`?c.payload:null,y=c.payload?.type===`diagnostics`?c.payload.checks:null;return(0,W.jsxs)(`div`,{className:i?`space-y-3`:`rounded-lg bg-surface-panel/80 p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:o(`flex flex-wrap items-start gap-3`,i?`justify-end`:`justify-between`),children:[i?null:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.setupTitle}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.configured?n.setupConfiguredHint:n.setupEmptyHint})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?(0,W.jsxs)(F,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(a[0]),children:[c.busy?(0,W.jsx)(V,{className:`size-4 animate-spin`}):(0,W.jsx)(P,{className:`size-4`}),d]}):null,e.actions?.[`doctor.run`]?(0,W.jsxs)(F,{type:`button`,variant:`secondary`,disabled:c.busy,onClick:()=>void u(`doctor.run`),children:[(0,W.jsx)(_,{className:`size-4`}),f]}):null]})]}),p?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:p}):null,c.error?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-red-600 dark:text-red-400`,children:c.error}):null,g?(0,W.jsxs)(`div`,{className:o(`flex h-80 items-center justify-center gap-4 overflow-hidden rounded-lg bg-surface-base px-3 py-3 shadow-surface`,i?`mt-1 flex-col text-center sm:h-64 sm:flex-row sm:text-left`:`mt-4 flex-col sm:h-64 sm:flex-row`),children:[(0,W.jsx)(`div`,{className:`flex size-56 shrink-0 items-center justify-center rounded-lg border border-edge bg-white p-3`,children:h?(0,W.jsx)(`img`,{src:h,alt:`${e.label} setup QR`,className:`size-52 object-contain`}):(0,W.jsx)(`div`,{className:`flex size-52 items-center justify-center rounded-md bg-surface-base`,children:(0,W.jsx)(M,{className:`size-48 rounded-md`})})}),(0,W.jsxs)(`div`,{className:o(`min-w-0 max-w-sm text-sm text-fg-muted`,i&&`w-full sm:w-auto`),children:[h?(0,W.jsx)(`p`,{className:`line-clamp-3`,children:n.waitingConfirmation}):(0,W.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,W.jsx)(M,{className:`h-4 w-48 max-w-full`}),(0,W.jsx)(M,{className:`h-4 w-36 max-w-full`})]}),m?(0,W.jsxs)(`a`,{className:`mt-2 inline-flex items-center gap-1 text-accent hover:underline`,href:m,target:`_blank`,rel:`noreferrer`,children:[n.openSetupLink,(0,W.jsx)(w,{className:`size-3.5`})]}):null]})]}):null,c.payload?.type===`poll`&&c.payload.phase===`done`?(0,W.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-surface-base px-3 py-2 text-sm shadow-surface`,children:[(0,W.jsx)(A,{className:c.payload.ok?`size-4 text-green-600`:`size-4 text-red-600`}),(0,W.jsx)(`span`,{className:c.payload.ok?`text-fg`:`text-red-600 dark:text-red-400`,children:c.payload.message??(c.payload.ok?n.complete:n.failed)})]}):null,v?(0,W.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,W.jsx)(ce,{schema:v.schema,values:c.formDraft,onChange:e=>l(t=>({...t,formDraft:e})),disabled:c.busy,labels:s}),(0,W.jsx)(F,{type:`button`,variant:`primary`,disabled:c.busy,onClick:()=>void u(v.submitAction,c.formDraft),children:n.saveSetup})]}):null,y?(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:y.map((e,t)=>(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.label??e.id??n.diagnosticCheckFallback.replace(`{{index}}`,String(t+1))}),(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e.status??`unknown`})]}),e.message?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.message}):null]},e.id??t))}):null]})}var ve=40;function J(e){return`ui:route:channel:${e.trim().toLowerCase()}`}function ye(e,t){return e.find(e=>e.id===J(t))?.agentId?.trim().toLowerCase()??``}function be(e,t,n){let r=J(t),i=e.filter(e=>e.id!==r),a=n.trim().toLowerCase();return a?[...i,{id:r,agentId:a,priority:ve,enabled:!0,match:{channel:t.trim().toLowerCase(),accountId:`*`}}]:i}function xe(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Se(e,t,n){let r=xe(e);return r.ready?r.enabled?n?t?.connected===!0?`running`:`stopped`:`checking`:`disabled`:`needs_setup`}function Ce(e,t=!1){return e===`drawer`?o(`xopc-drawer-right fixed right-0 top-0 flex size-full flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`,t?`max-w-[36rem]`:`max-w-xl`,k):o(`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),52rem)] w-[min(calc(100%-2rem),32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,t&&`h-[min(calc(100dvh-2rem),48rem)] w-[min(calc(100%-2rem),36rem)]`,k,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`)}function we(e){let t=(0,H.c)(33),{presentation:n,open:r,onOpenChange:i,title:a,description:s,srTitle:c,srDescription:l,closeAriaLabel:u,children:d,footer:f,wide:p,headerExtra:m}=e,g=p===void 0?!1:p,_=n===`drawer`,[y,x]=(0,U.useState)(null),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,W.jsx)(C,{className:o(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,O)}),t[0]=w):w=t[0];let E;t[1]!==n||t[2]!==g?(E=Ce(n,g),t[1]=n,t[2]=g,t[3]=E):E=t[3];let D;t[4]===c?D=t[5]:(D=c?(0,W.jsx)(v,{className:`sr-only`,children:c}):null,t[4]=c,t[5]=D);let k;t[6]===l?k=t[7]:(k=l?(0,W.jsx)(S,{className:`sr-only`,children:l}):null,t[6]=l,t[7]=k);let A;t[8]!==u||t[9]!==s||t[10]!==m||t[11]!==_||t[12]!==a?(A=_?(0,W.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[a?(0,W.jsx)(`div`,{className:`text-base font-semibold text-fg`,children:a}):null,s?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:s}):null]}),(0,W.jsx)(h,{asChild:!0,children:(0,W.jsx)(F,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":u,children:(0,W.jsx)(ie,{className:`size-5`,strokeWidth:1.75})})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(h,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:o(N,`absolute right-3 top-3 z-20 p-1.5 hover:bg-surface-hover`),"aria-label":u,children:(0,W.jsx)(ie,{className:`size-4`})})}),m]}),t[8]=u,t[9]=s,t[10]=m,t[11]=_,t[12]=a,t[13]=A):A=t[13];let j=_?`px-4 py-4`:`p-6`,M;t[14]===j?M=t[15]:(M=o(`min-h-0 flex-1 overflow-y-auto`,j),t[14]=j,t[15]=M);let P;t[16]!==d||t[17]!==M?(P=(0,W.jsx)(`div`,{className:M,children:d}),t[16]=d,t[17]=M,t[18]=P):P=t[18];let I;t[19]!==f||t[20]!==y||t[21]!==D||t[22]!==k||t[23]!==A||t[24]!==P?(I=(0,W.jsxs)(b,{layer:`modal`,portalContainer:y,children:[D,k,A,P,f]}),t[19]=f,t[20]=y,t[21]=D,t[22]=k,t[23]=A,t[24]=P,t[25]=I):I=t[25];let L;t[26]!==I||t[27]!==E?(L=(0,W.jsxs)(T,{children:[w,(0,W.jsx)(R,{ref:x,className:E,onOpenAutoFocus:Te,children:I})]}),t[26]=I,t[27]=E,t[28]=L):L=t[28];let B;return t[29]!==i||t[30]!==r||t[31]!==L?(B=(0,W.jsx)(z,{open:r,onOpenChange:i,children:L}),t[29]=i,t[30]=r,t[31]=L,t[32]=B):B=t[32],B}function Te(e){return e.preventDefault()}var Ee=(0,U.memo)(function(e){let t=(0,H.c)(10),{ch:n,refreshing:r,saveOk:i,onRefresh:a}=e,o;t[0]!==n.saved||t[1]!==i?(o=i?(0,W.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.saved}):null,t[0]=n.saved,t[1]=i,t[2]=o):o=t[2];let s;t[3]!==n.refresh||t[4]!==a||t[5]!==r?(s=(0,W.jsx)(ne,{className:`size-9 shrink-0 p-0`,loading:r,label:n.refresh,onClick:a}),t[3]=n.refresh,t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,W.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center justify-end gap-2`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c});function De(e){let t=(0,H.c)(24),{ch:n,dirty:r,saving:i,onCancel:a,onDiscard:o,onSave:s,showCancel:c}=e,l=c===void 0?!0:c,u;t[0]!==n.unsavedHint||t[1]!==r?(u=r?(0,W.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:n.unsavedHint}):null,t[0]=n.unsavedHint,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==n.modalCancel||t[4]!==a||t[5]!==l?(d=l?(0,W.jsx)(F,{type:`button`,variant:`secondary`,onClick:a,children:n.modalCancel}):null,t[3]=n.modalCancel,t[4]=a,t[5]=l,t[6]=d):d=t[6];let f=!r||i,p;t[7]!==n.discard||t[8]!==o||t[9]!==f?(p=(0,W.jsx)(F,{type:`button`,variant:`secondary`,disabled:f,onClick:o,children:n.discard}),t[7]=n.discard,t[8]=o,t[9]=f,t[10]=p):p=t[10];let m=!r||i,h;t[11]===s?h=t[12]:(h=()=>void s(),t[11]=s,t[12]=h);let g=i?n.saving:n.save,_;t[13]!==m||t[14]!==h||t[15]!==g?(_=(0,W.jsx)(F,{type:`button`,variant:`primary`,disabled:m,onClick:h,children:g}),t[13]=m,t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==d||t[18]!==p||t[19]!==_?(v=(0,W.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[d,p,_]}),t[17]=d,t[18]=p,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==u?(y=(0,W.jsxs)(`div`,{className:`sticky bottom-0 shrink-0 border-t border-edge-subtle bg-surface-panel px-6 py-4 dark:border-edge-subtle`,children:[u,v]}),t[21]=v,t[22]=u,t[23]=y):y=t[23],y}var Oe=`channels-status`;function ke(e){if(!e||typeof e!=`object`)return null;let t=e.channels;return Array.isArray(t)?t:null}function Ae(e){let t=t=>e(t.detail);return window.addEventListener(Oe,t),()=>window.removeEventListener(Oe,t)}function je(e,t){let n=(0,H.c)(4),r=t===void 0?!0:t,i,a;n[0]!==r||n[1]!==e?(i=()=>{if(r)return Ae(e)},a=[r,e],n[0]=r,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,U.useEffect)(i,a)}function Me(e){return e?l(`/api/channels/${encodeURIComponent(e)}/config`):null}async function Ne(e){return(await u(l(`/api/channels/${encodeURIComponent(e)}/config`))).payload?.config??{}}var Pe=[`enabled`];async function Fe(){let e=await u(l(`/api/config`));return{channels:e.payload?.config?.channels??{},bindings:e.payload?.config?.bindings??[]}}function Ie(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function Le(e){return e.configPath.startsWith(`channels.`)&&e.configPath.slice(9).split(`.`)[0]||e.id}function Y(e){let t=e.configured===!0,n=e.enabled===!0;return e.setupStatus??{enabled:n,ready:t,state:n&&!t?`needs_setup`:n?`ready`:`disabled`,issues:[]}}function Re(e,t){return e===`running`?t.connectionRunning:e===`stopped`?t.connectionStopped:e===`checking`?t.connectionChecking:e===`disabled`?t.connectionDisabled:t.connectionNeedsSetup}function ze(e,t){return e===`running`?t.connectionRunningHint:e===`stopped`?t.connectionStoppedHint:e===`disabled`?t.connectionDisabledHint:e===`needs_setup`?t.connectionNeedsSetupHint:t.connectionChecking}function Be(e){return e===`running`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`stopped`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`checking`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:e===`disabled`?`bg-surface-hover text-fg-muted`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`}function Ve(e){if(!e)return[];let t=e.uiHints??{},n=X(e.configSchema)&&Array.isArray(e.configSchema.required)?e.configSchema.required.map(String):[],r=Y(e).issues.map(e=>e.fieldPath).filter(e=>!!e),i=Object.entries(t).filter(([,e])=>!X(e)||e.advanced===!0?!1:(Array.isArray(e.tags)?e.tags.map(String):[]).includes(`basic`)||e.advanced===!1).map(([e])=>e).filter(e=>!Pe.includes(e));return Array.from(new Set([...i,...n,...r])).filter(e=>!Pe.includes(e))}function X(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e){return JSON.parse(JSON.stringify(e??{type:`object`,properties:{}}))}function He(e,t){let n={...Z(e),properties:{}};for(let r of t){let t=r.split(`.`),i=e,a=n;for(let[e,n]of t.entries()){let r=i.properties;if(!X(r)||!X(r[n]))break;let o=X(a.properties)?a.properties:{};if(a.properties=o,o[n]||(o[n]={...Z(r[n]),properties:{}}),e===t.length-1){o[n]=Z(r[n]);break}i=r[n],a=o[n]}}return n}function Ue(e){let t=e.properties;if(!X(t))return!1;for(let[e,n]of Object.entries(t))X(n)&&n.type===`object`&&Ue(n)&&delete t[e];return Object.keys(t).length===0}function We(e,t){let n=Z(e);for(let e of t){let t=e.split(`.`),r=n;for(let[e,n]of t.entries()){let i=r.properties;if(!X(i))break;if(e===t.length-1){delete i[n];break}if(!X(i[n]))break;r=i[n]}}return Ue(n),n}function Ge(e){return e.type===`object`&&X(e.properties)&&Object.keys(e.properties).length>0}function Ke(e,t){let n=e;for(let e of t.split(`.`)){if(!X(n))return;n=n[e]}return n}function qe(e){let t=e.accounts;return X(t)?Object.values(t).filter(e=>X(e)&&e.enabled!==!1).length:+(e.configured===!0)}function Je(e,t,n){return t==null||t===``?null:e.toLowerCase().includes(`dmpolicy`)&&typeof t==`string`?`${n.dmPolicy}: ${n.policy.dm[t]??t}`:(e.toLowerCase().includes(`stream`)||e.toLowerCase().includes(`streaming`))&&typeof t==`string`?`${n.cardStream}: ${n.policy.stream[t]??t}`:typeof t==`boolean`?t?n.enabledLabel:n.disabledLabel:String(t)}function Ye(e,t,n){let r=[],i=Y(e);if(i.issues.length>0&&r.push(Qe(i.issues[0],n)),t){let i=e.ui?.card?.summaryFields??[`dmPolicy`,`streamMode`,`streaming.mode`];for(let e of i){let i=Je(e,Ke(t,e),n);i&&r.push(i)}let a=qe(t);a>0&&r.push(n.cardAccounts.replace(`{{count}}`,String(a)))}return r.length>0?r.slice(0,2):i.ready?[n.hubStatusConfigured]:[]}function Q(e,t){let n=Y(e),r=me(e);return n.state===`needs_setup`?r?.[1].label??t.completeSetup:!n.enabled&&n.ready?t.enableChannel:n.state===`error`?t.diagnose:n.ready?t.manageChannel:r?.[1].label??t.startConfiguration}function Xe(e,t){let n=me(e);return n?.[1].result===`qr`?t.cardSetupQrHint:n?.[1].result===`form`?t.cardSetupConfigHint:t.cardSetupGenericHint}function Ze(e,t){let n=e.capabilities??{},r=[];return n.login===!0&&r.push(t.cardCapabilityLogin),n.pairing===!0&&r.push(t.cardCapabilityPairing),n.multiAccount===!0&&r.push(t.cardCapabilityMultiAccount),n.streaming===!0&&r.push(t.cardCapabilityStreaming),n.media===!0&&r.push(t.cardCapabilityMedia),n.doctor===!0&&r.push(t.cardCapabilityDoctor),r.slice(0,3)}function Qe(e,t){return e.code===`telegram.missing_credential`?t.setupIssueTelegramMissingCredential:e.code===`weixin.missing_account`?t.setupIssueWeixinMissingAccount:e.code===`feishu.missing_credentials`?t.setupIssueFeishuMissingCredentials:e.code===`config.missing_required`&&e.fieldPath?t.setupIssueMissingRequired.replace(`{{field}}`,e.fieldPath):e.message}function $e({entry:e}){let t=f(e=>e.token),[n,r]=(0,U.useState)(!1),i=(0,U.useMemo)(()=>{if(!e.ui?.icon||n)return null;let r=new URL(l(`/api/extensions/${encodeURIComponent(e.extensionId)}/assets/${Ie(e.ui.icon)}`));return t?.trim()&&r.searchParams.set(`token`,t.trim()),r.toString()},[n,e.extensionId,e.ui?.icon,t]);return(0,W.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-2xl bg-surface-base text-fg`,children:i?(0,W.jsx)(`img`,{src:i,alt:``,draggable:!1,className:`size-7`,"aria-hidden":!0,onError:()=>r(!0)}):(0,W.jsx)(te,{sourceChannel:e.id,className:`size-7`})})}function et(e){let t=(0,H.c)(16),{checked:n,disabled:r,onToggle:i,label:a}=e,s;t[0]===i?s=t[1]:(s=e=>{e.stopPropagation(),i()},t[0]=i,t[1]=s);let c=n?`border-accent bg-accent`:`border-edge bg-surface-hover`,l=r&&`cursor-not-allowed opacity-60`,u;t[2]!==c||t[3]!==l?(u=o(`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border transition-colors`,c,l),t[2]=c,t[3]=l,t[4]=u):u=t[4];let d=n?`translate-x-5`:`translate-x-0.5`,f;t[5]===d?f=t[6]:(f=o(`size-5 rounded-full bg-white shadow-surface transition-transform`,d),t[5]=d,t[6]=f);let p;t[7]===f?p=t[8]:(p=(0,W.jsx)(`span`,{className:f}),t[7]=f,t[8]=p);let m;return t[9]!==n||t[10]!==r||t[11]!==a||t[12]!==s||t[13]!==u||t[14]!==p?(m=(0,W.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":a,disabled:r,onClick:s,className:u,children:p}),t[9]=n,t[10]=r,t[11]=a,t[12]=s,t[13]=u,t[14]=p,t[15]=m):m=t[15],m}function tt(e){let t=(0,H.c)(71),{entry:n,config:r,runtime:i,busy:a,restarting:s,ch:c,onOpen:l,onToggle:u,onRestart:d}=e,f;t[0]===n?f=t[1]:(f=Y(n),t[0]=n,t[1]=f);let p=f,m,h,g,_,v,y,b;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==l||t[7]!==d||t[8]!==u||t[9]!==i||t[10]!==p.enabled||t[11]!==p.ready){let e=Ye(n,r,c),s=Ze(n,c);m=!p.enabled&&p.ready?u:i===`stopped`?d:l,y=`flex min-h-[15.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`;let f;t[19]===n?f=t[20]:(f=(0,W.jsx)($e,{entry:n}),t[19]=n,t[20]=f);let x;t[21]===n.label?x=t[22]:(x=(0,W.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:n.label}),t[21]=n.label,t[22]=x);let S;t[23]===i?S=t[24]:(S=o(`mt-1 inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,Be(i)),t[23]=i,t[24]=S);let C;t[25]!==c||t[26]!==i?(C=Re(i,c),t[25]=c,t[26]=i,t[27]=C):C=t[27];let w;t[28]!==S||t[29]!==C?(w=(0,W.jsx)(`span`,{className:S,children:C}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==x?(T=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[x,w]}),t[31]=w,t[32]=x,t[33]=T):T=t[33];let E;t[34]!==T||t[35]!==f?(E=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[f,T]}),t[34]=T,t[35]=f,t[36]=E):E=t[36];let D=p.enabled,O;t[37]!==c.toggleChannel||t[38]!==n.label?(O=c.toggleChannel.replace(`{{channel}}`,n.label),t[37]=c.toggleChannel,t[38]=n.label,t[39]=O):O=t[39];let k;t[40]!==a||t[41]!==u||t[42]!==p.enabled||t[43]!==O?(k=(0,W.jsx)(et,{checked:D,disabled:a,label:O,onToggle:u}),t[40]=a,t[41]=u,t[42]=p.enabled,t[43]=O,t[44]=k):k=t[44],t[45]!==E||t[46]!==k?(b=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[45]=E,t[46]=k,t[47]=b):b=t[47],h=`button`,g=l,_=`mt-5 min-h-[6.25rem] text-left`,v=p.ready?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`line-clamp-2 text-sm leading-6 text-fg-muted`,children:n.description??n.id}),e.length>0?(0,W.jsx)(`div`,{className:`mt-3 space-y-0.5 text-sm leading-5 text-fg-muted`,children:e.map(rt)}):null]}):(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:c.cardSetupTitle}),(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm leading-5 text-fg-muted`,children:e[0]??Xe(n,c)}),s.length>0?(0,W.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:s.map(nt)}):null]}),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=l,t[7]=d,t[8]=u,t[9]=i,t[10]=p.enabled,t[11]=p.ready,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b}else m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17],b=t[18];let x;t[48]!==h||t[49]!==g||t[50]!==_||t[51]!==v?(x=(0,W.jsx)(`button`,{type:h,onClick:g,className:_,children:v}),t[48]=h,t[49]=g,t[50]=_,t[51]=v,t[52]=x):x=t[52];let S=a||s,C;t[53]!==a||t[54]!==s?(C=a||s?(0,W.jsx)(V,{className:`size-4 animate-spin`}):null,t[53]=a,t[54]=s,t[55]=C):C=t[55];let w;t[56]!==c||t[57]!==n||t[58]!==s||t[59]!==i?(w=s?c.restartingChannel:i===`stopped`?c.restartChannel:Q(n,c),t[56]=c,t[57]=n,t[58]=s,t[59]=i,t[60]=w):w=t[60];let T;t[61]!==m||t[62]!==C||t[63]!==w||t[64]!==S?(T=(0,W.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,W.jsxs)(F,{type:`button`,variant:`secondary`,className:`w-full rounded-2xl py-2.5`,onClick:m,disabled:S,children:[C,w]})}),t[61]=m,t[62]=C,t[63]=w,t[64]=S,t[65]=T):T=t[65];let E;return t[66]!==T||t[67]!==y||t[68]!==b||t[69]!==x?(E=(0,W.jsxs)(`article`,{className:y,children:[b,x,T]}),t[66]=T,t[67]=y,t[68]=b,t[69]=x,t[70]=E):E=t[70],E}function nt(e){return(0,W.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function rt(e){return(0,W.jsx)(`p`,{className:`truncate`,title:e,children:e},e)}function it(e){let t=(0,H.c)(51),{runtime:n,restarting:r,checking:i,showConnectionOptions:a,canManageConnection:c,ch:l,onRestart:u,onCheck:d,onManageConnection:f}=e,p=n===`running`?A:n===`stopped`||n===`needs_setup`?s:V,m=n===`running`&&`text-emerald-600 dark:text-emerald-400`,h=n===`stopped`&&`text-red-600 dark:text-red-400`,g=n===`checking`&&`animate-spin text-amber-600 dark:text-amber-400`,_=n===`disabled`&&`text-fg-muted`,v=n===`needs_setup`&&`text-amber-600 dark:text-amber-400`,y;t[0]!==m||t[1]!==h||t[2]!==g||t[3]!==_||t[4]!==v?(y=o(`mt-0.5 size-5 shrink-0`,m,h,g,_,v),t[0]=m,t[1]=h,t[2]=g,t[3]=_,t[4]=v,t[5]=y):y=t[5];let b;t[6]!==p||t[7]!==y?(b=(0,W.jsx)(p,{className:y}),t[6]=p,t[7]=y,t[8]=b):b=t[8];let x;t[9]===l.connectionStatus?x=t[10]:(x=(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectionStatus}),t[9]=l.connectionStatus,t[10]=x);let S;t[11]!==l||t[12]!==n?(S=ze(n,l),t[11]=l,t[12]=n,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:S}),t[14]=S,t[15]=C);let w;t[16]!==C||t[17]!==x?(w=(0,W.jsxs)(`div`,{children:[x,C]}),t[16]=C,t[17]=x,t[18]=w):w=t[18];let T;t[19]!==w||t[20]!==b?(T=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[b,w]}),t[19]=w,t[20]=b,t[21]=T):T=t[21];let E=i||r,D;t[22]===i?D=t[23]:(D=i?(0,W.jsx)(V,{className:`size-4 animate-spin`}):null,t[22]=i,t[23]=D);let O=i?l.checkingConnection:l.checkConnection,k;t[24]!==d||t[25]!==E||t[26]!==D||t[27]!==O?(k=(0,W.jsxs)(F,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:E,onClick:d,children:[D,O]}),t[24]=d,t[25]=E,t[26]=D,t[27]=O,t[28]=k):k=t[28];let j;t[29]!==l.restartChannel||t[30]!==l.restartingChannel||t[31]!==i||t[32]!==u||t[33]!==r||t[34]!==n?(j=n===`stopped`?(0,W.jsxs)(F,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:r||i,onClick:u,children:[r?(0,W.jsx)(V,{className:`size-4 animate-spin`}):(0,W.jsx)(B,{className:`size-4`}),r?l.restartingChannel:l.restartChannel]}):null,t[29]=l.restartChannel,t[30]=l.restartingChannel,t[31]=i,t[32]=u,t[33]=r,t[34]=n,t[35]=j):j=t[35];let M;t[36]!==c||t[37]!==l.connectionOptions||t[38]!==l.hideConnectionOptions||t[39]!==i||t[40]!==f||t[41]!==r||t[42]!==a?(M=c?(0,W.jsx)(F,{type:`button`,variant:`ghost`,className:`px-2.5 py-1.5 text-xs`,disabled:i||r,onClick:f,children:a?l.hideConnectionOptions:l.connectionOptions}):null,t[36]=c,t[37]=l.connectionOptions,t[38]=l.hideConnectionOptions,t[39]=i,t[40]=f,t[41]=r,t[42]=a,t[43]=M):M=t[43];let N;t[44]!==k||t[45]!==j||t[46]!==M?(N=(0,W.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[k,j,M]}),t[44]=k,t[45]=j,t[46]=M,t[47]=N):N=t[47];let P;return t[48]!==T||t[49]!==N?(P=(0,W.jsx)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[T,N]})}),t[48]=T,t[49]=N,t[50]=P):P=t[50],P}function at(e){let t=(0,H.c)(33),{entry:n,ch:r}=e,i,a,o,s,c,l,u,d,f;if(t[0]!==r||t[1]!==n){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Y(n);if(e.ready||e.issues.length===0){f=null;break bb0}d=`rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,l=`flex items-start gap-3`,t[11]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,W.jsx)(g,{className:`mt-0.5 size-4 shrink-0`}),t[11]=u):u=t[11],o=`min-w-0`,t[12]===r.setupReadinessTitle?s=t[13]:(s=(0,W.jsx)(`h3`,{className:`text-sm font-semibold`,children:r.setupReadinessTitle}),t[12]=r.setupReadinessTitle,t[13]=s);let p=e.enabled?r.setupReadinessEnabledBody:r.setupReadinessDisabledBody;t[14]===p?c=t[15]:(c=(0,W.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-amber-900 dark:text-amber-200`,children:p}),t[14]=p,t[15]=c),i=`mt-2 list-disc space-y-1 pl-5 text-sm text-amber-900 dark:text-amber-200`;let m;t[16]===r?m=t[17]:(m=e=>(0,W.jsx)(`li`,{children:Qe(e,r)},`${e.code}:${e.fieldPath??``}`),t[16]=r,t[17]=m),a=e.issues.map(m)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;t[18]!==i||t[19]!==a?(p=(0,W.jsx)(`ul`,{className:i,children:a}),t[18]=i,t[19]=a,t[20]=p):p=t[20];let m;t[21]!==p||t[22]!==o||t[23]!==s||t[24]!==c?(m=(0,W.jsxs)(`div`,{className:o,children:[s,c,p]}),t[21]=p,t[22]=o,t[23]=s,t[24]=c,t[25]=m):m=t[25];let h;t[26]!==m||t[27]!==l||t[28]!==u?(h=(0,W.jsxs)(`div`,{className:l,children:[u,m]}),t[26]=m,t[27]=l,t[28]=u,t[29]=h):h=t[29];let _;return t[30]!==h||t[31]!==d?(_=(0,W.jsx)(`section`,{className:d,children:h}),t[30]=h,t[31]=d,t[32]=_):_=t[32],_}function ot(){let e=d(e=>e.language),t=c(e),n=f(e=>!!e.token),r=i(),{channelId:s}=a(),u=ee(s),h=fe(n,e),g=h.entries,{data:_,mutate:v,isValidating:b}=m(n?de():null,ue,{revalidateOnFocus:!0}),{data:S,mutate:C}=m(n?`channels-config-map`:null,Fe,{revalidateOnFocus:!1}),T=S?.channels??{},O=S?.bindings??[],{data:k}=m(n?`channel-routing-agents`:null,re,{revalidateOnFocus:!1}),A=y(e=>e.setPageHeader),M=y(e=>e.clearPageHeader),N=(0,U.useMemo)(()=>g.find(e=>e.id===u),[u,g]),P=N?Le(N):null,{data:F,mutate:R}=m(n&&P?Me(P):null,()=>Ne(P)),[z,B]=(0,U.useState)(null),[te,ne]=(0,U.useState)(!1),[ie,V]=(0,U.useState)(null),[le,H]=(0,U.useState)(null),[pe,he]=(0,U.useState)(!1),[ge,G]=(0,U.useState)(null),[K,q]=(0,U.useState)(null),ve=z??F??{},J=t.channelsSettings,xe=(0,U.useMemo)(()=>N?.configSchema??{type:`object`,properties:{}},[N?.configSchema]),Ce=(0,U.useMemo)(()=>We(xe,Pe),[xe]),Te=(0,U.useMemo)(()=>Ve(N),[N]),Oe=(0,U.useMemo)(()=>He(Ce,Te),[Te,Ce]),Ae=(0,U.useMemo)(()=>We(Ce,Te),[Te,Ce]),Ie=(0,U.useMemo)(()=>Ge(Oe),[Oe]),ze=N?K??ye(O,N.id):``,X=(0,U.useMemo)(()=>(k?.items??[]).map(e=>{let n=x(e,t.agentsSettings);return{value:e.id,label:n===e.id?n:`${n} · ${e.id}`}}),[k?.items,t.agentsSettings]),Z=k?.items.find(e=>e.id===k.defaultId),Ue=Z?x(Z,t.agentsSettings):k?.defaultId??``,Ke=(0,U.useMemo)(()=>({defaultBooleanLabel:J.schemaBooleanDefault,unsupportedArrayType:J.schemaUnsupportedArrayType,arrayAddPlaceholder:J.schemaArrayAddPlaceholder,unsupportedFieldType:(e,t)=>J.schemaUnsupportedFieldType.replace(`{{title}}`,e).replace(`{{type}}`,t?` (${t})`:``)}),[J]),qe=(0,U.useMemo)(()=>new Map((_??[]).map(e=>[e.name,e])),[_]),Je=_!==void 0,Ye=(0,U.useCallback)(e=>Se(e,qe.get(e.id),Je),[qe,Je]),Q=(0,U.useCallback)(async()=>{await Promise.all([h.mutate(),v()])},[h,v]);je((0,U.useCallback)(e=>{let t=ke(e);t&&v(t,!1)},[v]),n);let Xe=(0,U.useMemo)(()=>n?(0,W.jsx)(Ee,{ch:J,refreshing:h.isValidating||b,saveOk:!1,onRefresh:()=>void Q()}):null,[h.isValidating,J,n,b,Q]);(0,U.useLayoutEffect)(()=>(A({startExtra:null,main:(0,W.jsx)(`div`,{className:`min-w-0`,children:(0,W.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.settingsSections.channels})}),end:Xe}),()=>M()),[M,Xe,t.settingsSections.channels,A]);let Ze=(0,U.useCallback)(e=>{r(j(e)),B(null),q(null),G(null)},[r]),Qe=(0,U.useCallback)(()=>{r(I),B(null),q(null),G(null)},[r]),nt=(0,U.useCallback)(async e=>{H(e.id),G(null);try{let t=await p(l(`/api/channels/${encodeURIComponent(e.id)}/restart`),{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}await Q()}catch(e){G(e instanceof Error?e.message:String(e))}finally{H(null)}},[Q]);(0,U.useEffect)(()=>{q(null),he(!1)},[N?.id]);let rt=(0,U.useCallback)(async()=>{if(!N||!z&&K===null)return!1;let e=Le(N);ne(!0),G(null);try{let t=await p(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({...z?{channels:{[e]:z}}:{},...K===null?{}:{bindings:be(O,N.id,K)}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error?.message??t.statusText)}return z&&await R(z,!1),await C(),await h.mutate(),B(null),q(null),!0}catch(e){return G(e instanceof Error?e.message:String(e)),!1}finally{ne(!1)}},[N,K,O,h,z,C,R]),ot=(0,U.useCallback)(async e=>{let t=Y(e),n=Le(e),r=N?.id===e.id?z:null;if(!t.enabled&&!t.ready&&!r){Ze(e.id);return}V(e.id),G(null);try{let i=t.enabled?{enabled:!1}:r?{...r,enabled:!0}:{enabled:!0},a=await p(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({channels:{[n]:i}})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error?.message??a.statusText)}await h.mutate(),await C(),await v(),N?.id===e.id&&(await R(),B(null))}catch(e){G(e instanceof Error?e.message:String(e))}finally{V(null)}},[N?.id,h,z,C,R,v,Ze]),$=N?.ui?.modal,st=$?.placement!==`replace-config`,ct=N?Ye(N):`checking`,lt=N?!Y(N).ready||pe:!1;return n?(0,W.jsxs)(oe,{gap:`gap-4`,children:[h.isLoading?(0,W.jsx)(se,{sections:2}):h.error?(0,W.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:String(h.error)}):(0,W.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:g.map(e=>(0,W.jsx)(tt,{entry:e,config:T[Le(e)]?.config,runtime:Ye(e),busy:ie===e.id,restarting:le===e.id,ch:J,onOpen:()=>Ze(e.id),onToggle:()=>void ot(e),onRestart:()=>void nt(e)},e.id))}),ge?(0,W.jsx)(`p`,{className:`mt-4 text-sm text-red-600 dark:text-red-400`,children:ge}):null,(0,W.jsx)(we,{presentation:`modal`,open:!!N,onOpenChange:e=>{e||Qe()},closeAriaLabel:J.close,srTitle:N?.label??J.selectChannel,srDescription:N?.description,wide:!0,footer:N?(0,W.jsx)(De,{ch:J,dirty:!!z||K!==null,saving:te,onCancel:Qe,onDiscard:()=>{B(null),q(null)},onSave:rt}):null,children:N?(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(`div`,{className:`rounded-xl bg-surface-panel/80 px-3 py-3 shadow-surface`,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,W.jsx)($e,{entry:N}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:N.label}),(0,W.jsx)(`span`,{className:o(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,Be(ct)),children:Re(ct,J)})]}),(0,W.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm text-fg-muted`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:!Y(N).ready&&me(N)?.[1].result===`qr`?J.scanLoginHint.replace(`{{channel}}`,N.label):N.description}),N.docsPath?(0,W.jsxs)(`a`,{href:N.docsPath,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-accent hover:underline`,children:[J.docs,(0,W.jsx)(w,{className:`size-3.5`})]}):null]})]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pr-8`,children:[(0,W.jsx)(`span`,{className:`hidden text-xs text-fg-muted sm:inline`,children:Y(N).enabled?J.enabledLabel:J.disabledLabel}),(0,W.jsx)(et,{checked:Y(N).enabled,disabled:ie===N.id,label:J.toggleChannel.replace(`{{channel}}`,N.label),onToggle:()=>void ot(N)})]})]})}),(0,W.jsx)(it,{runtime:ct,restarting:le===N.id,checking:b,showConnectionOptions:pe,canManageConnection:Y(N).ready&&$?.placement!==`replace-config`,ch:J,onRestart:()=>void nt(N),onCheck:()=>void Q(),onManageConnection:()=>he(e=>!e)}),(0,W.jsx)(at,{entry:N,ch:J}),lt&&$?.placement!==`replace-config`?(0,W.jsx)(_e,{entry:N,locale:e,messages:J,compact:!0,onChanged:async()=>{await R(),await Q(),await C()}},N.id):null,$?.entrypoint&&$.placement===`before-config`?(0,W.jsx)(L,{extensionId:N.extensionId,extensionName:N.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:N.id,entry:N,config:ve}}):null,$?.entrypoint&&$.placement!==`before-config`?(0,W.jsx)(L,{extensionId:N.extensionId,extensionName:N.label,entrypoint:$.entrypoint,permissions:$.permissions,minHeight:$.minHeight,maxHeight:$.maxHeight,initialData:{channelId:N.id,entry:N,config:ve}}):null,st&&Ie?(0,W.jsxs)(`section`,{className:`rounded-xl bg-surface-panel/80 p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`mb-4`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.basicConfiguration}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.basicConfigurationHint})]}),(0,W.jsx)(ce,{schema:Oe,values:ve,onChange:e=>B(e),disabled:te,labels:Ke})]}):null,(0,W.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(E,{className:`size-4 text-fg-muted`}),J.messageHandling]}),(0,W.jsxs)(`div`,{className:`bg-surface-base/50 p-4`,children:[(0,W.jsxs)(`div`,{className:`mb-3`,children:[(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:J.agentRouting}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:J.messageHandlingHint})]}),(0,W.jsx)(D,{value:ze,options:X,placeholder:J.agentRoutingSelect,emptyLabel:J.agentRoutingDefault.replace(`{{agent}}`,Ue||J.agentRoutingSelect),ariaLabel:J.agentRouting,disabled:te||!k,onChange:e=>q(e)})]})]}),st&&Ge(Ae)?(0,W.jsxs)(`details`,{className:`group rounded-xl bg-surface-panel/80 shadow-surface`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsx)(E,{className:`size-4 text-fg-muted`}),J.advancedConfiguration]}),(0,W.jsx)(`div`,{className:`bg-surface-base/50 p-4`,children:(0,W.jsx)(ce,{schema:Ae,values:ve,onChange:e=>B(e),disabled:te,labels:Ke})})]}):null,ge?(0,W.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:ge}):null]}):null})]}):(0,W.jsxs)(oe,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,W.jsx)(ae,{title:t.settingsSections.channels}),(0,W.jsx)(`p`,{className:`text-sm text-fg-muted`,children:J.tokenRequired})]})}export{ot as ChannelsSettingsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e}from"./locale-store-BneNAR8R.js";import{n as t}from"./channel-recipient-api-Bea6if_6.js";function n(){return e(`/api/channels/status`)}var r=t;export{r as n,n as t};
|
package/dist/gateway/static/root/assets/{connector-logo-DIMP4NWY.js → connector-logo-BjbYbJjQ.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"./cn-BQ_8x0bT.js";import{
|
|
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"./cn-BQ_8x0bT.js";import{Dc as a}from"./index-CH7XN6KY.js";var o=n(),s=e(t(),1),c=r(),l={sm:{frame:`size-9 rounded-lg`,image:`size-6`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-7`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-8`,fallback:`size-5`}};function u(e){let t=(0,o.c)(18),{connector:n,size:r,className:u}=e,d=r===void 0?`md`:r,f=n?.branding?.logoUrl,[p,m]=(0,s.useState)(!1),h=l[d],g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{m(!1)},t[0]=g):g=t[0];let _;t[1]===f?_=t[2]:(_=[f],t[1]=f,t[2]=_),(0,s.useEffect)(g,_);let v;t[3]!==u||t[4]!==h.frame?(v=i(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-surface-base`,h.frame,u),t[3]=u,t[4]=h.frame,t[5]=v):v=t[5];let y;t[6]===n?y=t[7]:(y=n?.branding?.backgroundColor?{backgroundColor:n.branding.backgroundColor}:void 0,t[6]=n,t[7]=y);let b=n?.displayName,x;t[8]!==h.fallback||t[9]!==h.image||t[10]!==p||t[11]!==f?(x=f&&!p?(0,c.jsx)(`img`,{src:f,alt:``,loading:`lazy`,draggable:!1,className:i(`object-contain`,h.image),onError:()=>m(!0)}):(0,c.jsx)(a,{className:i(`text-fg-muted`,h.fallback),"aria-hidden":!0}),t[8]=h.fallback,t[9]=h.image,t[10]=p,t[11]=f,t[12]=x):x=t[12];let S;return t[13]!==v||t[14]!==y||t[15]!==b||t[16]!==x?(S=(0,c.jsx)(`span`,{className:v,style:y,title:b,children:x}),t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S):S=t[17],S}export{u as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./check-BODqo66o.js";import{n as s}from"./copy-to-clipboard-HOJ79TWv.js";import{t as c}from"./messages-t1yPaVCt.js";import{d as l,i as u,n as d,o as f}from"./locale-store-BneNAR8R.js";import{$s as p,Ao as m,Ci as h,Dc as g,Di as _,Fo as v,Gi as y,Go as b,Hi as x,Io as S,Ml as C,Mo as w,No as T,Po as E,Qs as D,Rs as O,Si as k,Sl as A,Ti as j,Ui as M,Vi as N,Vl as P,Vs as F,Wi as I,Wo as L,Xo as R,Yo as z,Ys as B,Zl as ee,bs as te,cc as ne,el as re,gc as ie,hc as ae,hs as V,ic as oe,io as se,jo as ce,js as le,ko as ue,ls as H,ms as de,os as fe,qo as pe,ro as me,sa as he,tc as ge,tu as U,vc as W,wi as G,ys as _e,zc as K}from"./index-CH7XN6KY.js";import{t as ve}from"./page-tabs-DMlQERNg.js";import{t as q}from"./connector-logo-BjbYbJjQ.js";var J=e(t(),1),Y=n(),X=r(),Z=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`,ye=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function be(e,t){return t.some(t=>t.connectorId===e.id)}function xe(){let e=(0,Y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,Z)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,X.jsx)(`div`,{className:a(`h-4 min-w-0 flex-1`,Z)}),(0,X.jsx)(`div`,{className:a(`h-8 w-[4.5rem] shrink-0 rounded-lg`,Z)})]}),(0,X.jsx)(`div`,{className:a(`h-3 w-full`,Z)}),(0,X.jsx)(`div`,{className:a(`h-3 w-[88%]`,Z)})]})]})}),e[1]=n):n=e[1],n}function Se(){let e=(0,Y.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:a(`size-10 shrink-0 rounded-xl`,Z)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,X.jsx)(`div`,{className:a(`h-4 w-48 max-w-full`,Z)}),(0,X.jsx)(`div`,{className:a(`h-3 w-72 max-w-full`,Z)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,Z)}),(0,X.jsx)(`div`,{className:a(`h-9 w-20 rounded-lg`,Z)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,X.jsx)(`div`,{className:a(`h-8 w-20 rounded-md`,Z)}),(0,X.jsx)(`div`,{className:a(`h-8 w-24 rounded-md`,Z)}),(0,X.jsx)(`div`,{className:a(`h-8 w-28 rounded-md`,Z)})]}),(0,X.jsx)(`div`,{className:a(`mt-3 h-20 rounded-xl`,Z)})]}),e[3]=i):i=e[3],i}function Ce(e){let t=(0,Y.c)(80),{connector:n,installed:r,onInstall:i,onOpenDetails:o,t:s}=e,c,l,u,d,f,p,m,h,_,v;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==s.connect||t[5]!==s.connectedBadge||t[6]!==s.connectorBeta||t[7]!==s.connectorCapabilityLabels||t[8]!==s.connectorExperimental||t[9]!==s.connectorVerified||t[10]!==s.integrationStrategyComposio||t[11]!==s.integrationStrategyMcp||t[12]!==s.integrationStrategyNative){let e=n.capabilities.filter(we),y=e.slice(0,3),b=Math.max(0,e.length-y.length),x=s.connect,S=n.verificationLevel===`verified`?s.connectorVerified:n.verificationLevel===`beta`?s.connectorBeta:n.verificationLevel===`experimental`?s.connectorExperimental:null,C=n.integrationStrategy?.lane===`native`?s.integrationStrategyNative:n.integrationStrategy?.lane===`mcp`?s.integrationStrategyMcp:n.integrationStrategy?.lane===`composio`?s.integrationStrategyComposio:null,w;t[23]!==x||t[24]!==n||t[25]!==i?(w=e=>(0,X.jsxs)(V,{type:`button`,variant:`primary`,className:a(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:e=>{e.stopPropagation(),i(n)},children:[(0,X.jsx)(g,{className:`size-4`}),x]}),t[23]=x,t[24]=n,t[25]=i,t[26]=w):w=t[26],c=w;let T;t[27]!==n||t[28]!==o?(T=e=>{!o||e.currentTarget!==e.target||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),o(n))},t[27]=n,t[28]=o,t[29]=T):T=t[29];let E=T,D=o?`cursor-pointer`:null;t[30]===D?p=t[31]:(p=a(`group flex min-h-[9.5rem] flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,D),t[30]=D,t[31]=p),m=o?`button`:void 0,h=o?0:void 0,t[32]!==n||t[33]!==o?(_=()=>o?.(n),t[32]=n,t[33]=o,t[34]=_):_=t[34],v=E,l=`flex min-w-0 flex-1 flex-col`;let O;t[35]===n?O=t[36]:(O=(0,X.jsx)(q,{connector:n}),t[35]=n,t[36]=O);let k;t[37]===n.displayName?k=t[38]:(k=(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[37]=n.displayName,t[38]=k);let A;t[39]===S?A=t[40]:(A=S?(0,X.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:S}):null,t[39]=S,t[40]=A);let j;t[41]===C?j=t[42]:(j=C?(0,X.jsx)(`span`,{className:`ml-1 mt-1 inline-flex rounded-full border border-accent/20 bg-accent-soft px-1.5 py-0.5 text-[10px] font-medium text-accent-fg`,children:C}):null,t[41]=C,t[42]=j);let M;t[43]!==k||t[44]!==A||t[45]!==j?(M=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[k,A,j]}),t[43]=k,t[44]=A,t[45]=j,t[46]=M):M=t[46];let N;t[47]!==O||t[48]!==M?(N=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[O,M]}),t[47]=O,t[48]=M,t[49]=N):N=t[49];let P;t[50]!==r||t[51]!==c?(P=r?null:(0,X.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 transition-opacity sm:pointer-events-none sm:flex sm:opacity-0 sm:group-hover:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:pointer-events-auto sm:group-focus-within:opacity-100`,children:c()}),t[50]=r,t[51]=c,t[52]=P):P=t[52];let F;t[53]!==r||t[54]!==s.connectedBadge?(F=r?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,X.jsx)(ee,{className:`size-3`,"aria-hidden":!0}),s.connectedBadge]}):null,t[53]=r,t[54]=s.connectedBadge,t[55]=F):F=t[55];let I;t[56]!==P||t[57]!==F?(I=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[P,F]}),t[56]=P,t[57]=F,t[58]=I):I=t[58],t[59]!==N||t[60]!==I?(u=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[N,I]}),t[59]=N,t[60]=I,t[61]=u):u=t[61],t[62]===n.description?d=t[63]:(d=(0,X.jsx)(`p`,{className:`mt-4 line-clamp-2 text-sm leading-6 text-fg-muted`,title:n.description,children:n.description}),t[62]=n.description,t[63]=d),f=y.length>0?(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:[y.map(e=>(0,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:s.connectorCapabilityLabels[e]??e},e)),b>0?(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,b]}):null]}):null,t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=s.connect,t[5]=s.connectedBadge,t[6]=s.connectorBeta,t[7]=s.connectorCapabilityLabels,t[8]=s.connectorExperimental,t[9]=s.connectorVerified,t[10]=s.integrationStrategyComposio,t[11]=s.integrationStrategyMcp,t[12]=s.integrationStrategyNative,t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f,t[18]=p,t[19]=m,t[20]=h,t[21]=_,t[22]=v}else c=t[13],l=t[14],u=t[15],d=t[16],f=t[17],p=t[18],m=t[19],h=t[20],_=t[21],v=t[22];let y;t[64]!==l||t[65]!==u||t[66]!==d||t[67]!==f?(y=(0,X.jsxs)(`div`,{className:l,children:[u,d,f]}),t[64]=l,t[65]=u,t[66]=d,t[67]=f,t[68]=y):y=t[68];let b;t[69]!==r||t[70]!==c?(b=r?null:(0,X.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:c(`w-full`)}),t[69]=r,t[70]=c,t[71]=b):b=t[71];let x;return t[72]!==y||t[73]!==b||t[74]!==p||t[75]!==m||t[76]!==h||t[77]!==_||t[78]!==v?(x=(0,X.jsxs)(`div`,{className:p,role:m,tabIndex:h,onClick:_,onKeyDown:v,children:[y,b]}),t[72]=y,t[73]=b,t[74]=p,t[75]=m,t[76]=h,t[77]=_,t[78]=v,t[79]=x):x=t[79],x}function we(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}function Q(e,t){if(!e.payload)throw Error(e.error??t);return e.payload}async function Te(){let[e,t]=await Promise.all([u(l(`/api/connectors/catalog`)),Ee().catch(()=>[])]),n=Q(e,`Could not load connector catalog.`).connectors;return[...new Map([...t,...n].map(e=>[e.id,e])).values()]}async function Ee(e=!1){return Q(await u(l(`/api/connectors/composio/catalog${e?`?refresh=1`:``}`)),`Could not load Composio catalog.`).connectors}async function De(e){let t=new URLSearchParams;return e?.q?.trim()&&t.set(`q`,e.q.trim()),e?.page&&t.set(`page`,String(e.page)),e?.pageSize&&t.set(`pageSize`,String(e.pageSize)),e?.category?.trim()&&t.set(`category`,e.category.trim()),e?.sort&&t.set(`sort`,e.sort),Q(await u(l(`/api/capabilities/connectors${t.size?`?${t.toString()}`:``}`)),`Could not load Store connector capabilities.`)}async function Oe(e,t){return Q(await u(l(`/api/capabilities/connectors/${encodeURIComponent(e)}/install-plan`),{method:`POST`,body:JSON.stringify({version:t})}),`Could not prepare connector installation.`).plan}async function ke(e,t,n){let r=await u(l(`/api/capabilities/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify({...t,version:n})});return me(),Q(r,`Could not install Store connector.`).instance}async function Ae(){return Q(await u(l(`/api/connectors/catalog`)),`Could not load connector registries.`).registries??[]}async function je(){return Q(await u(l(`/api/connectors/installed`)),`Could not load installed connectors.`).instances}var Me=new Map,Ne=300*1e3;async function Pe(e,t=`all`,n){let r=e.trim(),i=t.trim()||`all`,a=n?.browse??!1,o=Math.max(n?.page??1,1),s=Math.max(n?.pageSize??24,1),c=`${i}:${r}:${a?`browse`:`search`}:${o}:${s}`,d=Date.now(),f=Me.get(c);if(f&&f.expiresAt>d)return f.promise;let p=new URLSearchParams;r&&p.set(`q`,r),i!==`all`&&p.set(`source`,i),a&&p.set(`browse`,`1`),p.set(`page`,String(o)),p.set(`pageSize`,String(s));let m=u(l(`/api/connectors/registry/search?${p.toString()}`)).then(e=>{let t=Q(e,`Could not search connector registries.`),n=Math.max(0,...(t.results??[]).map(e=>e.totalPages??0))||void 0;return{connectors:t.connectors,totalPages:n}});Me.set(c,{expiresAt:d+Ne,promise:m});try{return await m}catch(e){throw Me.delete(c),e}}async function Fe(e){return Q(await u(l(`/api/connectors/${encodeURIComponent(e)}/auth/start`),{method:`POST`}),`Could not start connector authorization.`).authorization}async function Ie(e,t){let n=await u(l(`/api/connectors/${encodeURIComponent(e)}/install`),{method:`POST`,body:JSON.stringify(t)});return me(),Q(n,`Could not install connector.`).instance}async function Le(e,t={}){return Q(await u(l(`/api/connectors/preview`),{method:`POST`,body:JSON.stringify({...t,definition:e})}),`Could not preview connector capabilities.`).preview}async function Re(e,t){return Q(await u(l(`/api/connectors/${encodeURIComponent(e)}/config`),{method:`POST`,body:JSON.stringify(t)}),`Could not update connector config.`).instance}async function ze(e){await u(l(`/api/connectors/${encodeURIComponent(e)}`),{method:`DELETE`}),me()}async function Be(e){return Q(await u(l(`/api/connectors/${encodeURIComponent(e)}/test`),{method:`POST`}),`Connector test failed.`)}async function Ve(){return Q(await u(l(`/api/connectors/composio/connections`)),`Could not load Composio connections.`).connections}async function He(e,t){return Q(await u(l(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio connection.`).connection}async function Ue(e){return Q(await u(l(`/api/connectors/composio/${encodeURIComponent(e)}/health`)),`Could not check Composio connector health.`).health}async function We(e){await u(l(`/api/connectors/composio/connections/${encodeURIComponent(e)}/refresh`),{method:`POST`})}async function Ge(e){await u(l(`/api/connectors/composio/connections/${encodeURIComponent(e)}`),{method:`DELETE`})}async function Ke(e){return Q(await u(l(`/api/connectors/composio/${encodeURIComponent(e)}/scope`)),`Could not load Composio scope.`).scope}async function qe(e,t){let n=await u(l(`/api/connectors/composio/${encodeURIComponent(e)}/scope`),{method:`POST`,body:JSON.stringify({scope:t})});return me(),Q(n,`Could not update Composio scope.`).scope}async function Je(e){return Q(await u(l(`/api/connectors/composio/${encodeURIComponent(e)}/policy`)),`Could not load Composio policy.`)}async function Ye(e,t){return Q(await u(l(`/api/connectors/composio/${encodeURIComponent(e)}/policy`),{method:`PATCH`,body:JSON.stringify(t)}),`Could not update Composio policy.`).policy}async function Xe(e){return Q(await u(l(`/api/connectors/composio/${encodeURIComponent(e)}/tools`)),`Could not load Composio tools.`).tools}async function Ze(e=50){return Q(await u(l(`/api/connectors/composio/triggers?limit=${encodeURIComponent(String(e))}`)),`Could not load Composio trigger events.`).events}async function Qe(e){return Q(await u(l(`/api/connectors/${encodeURIComponent(e.connectorId)}/memory-sync`),{method:`POST`,body:JSON.stringify(e)}),`Could not sync connector data to memory.`)}async function $e(e=`pending`){return Q(await u(l(`/api/connectors/approvals?status=${encodeURIComponent(e)}`)),`Could not load connector approvals.`).approvals}async function et(e,t){return Q(await u(l(`/api/connectors/approvals/respond`),{method:`POST`,body:JSON.stringify({id:e,decision:t})}),`Could not update connector approval.`).approval}function tt(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function nt(e,t){return t.connectorCapabilityLabels[e]??e}function rt(e,t){if(e.runtime.type===`mcp`)return tt(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`channel`?e.runtime.channelId:e.runtime.type===`nativeTool`?e.runtime.toolsetId:e.runtime.sourceKind;return tt(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function it(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function at(e){return(e.setup.secrets??[]).filter(e=>e.required).length+(e.setup.config??[]).filter(e=>e.required).length}function ot(e){let t=(0,Y.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`div`,{className:`border-b border-edge px-3 py-2 text-xs font-semibold text-fg`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,16).map(st),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>16?(0,X.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-subtle`,children:[`+`,r.length-16]}):null,t[4]=r.length,t[5]=o);let s;t[6]!==a||t[7]!==o?(s=(0,X.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==s?(c=(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base`,children:[i,s]}),t[9]=i,t[10]=s,t[11]=c):c=t[11],c}function st(e){return(0,X.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,X.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function ct({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),f=at(e),h=e.capabilities.slice(0,8),_=Math.max(0,e.capabilities.length-h.length),y=[...(e.setup.secrets??[]).map(e=>({key:`secret:${e.key}`,label:e.label,description:e.description,required:e.required,kind:i.connectorSetupSecret})),...(e.setup.config??[]).map(e=>({key:`config:${e.key}`,label:e.label,description:e.description,required:!!e.required,kind:i.connectorSetupConfig}))],b=async()=>{s(!0),d(null);try{l(await Le(e))}catch(e){l(null),d(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,X.jsx)(ue,{open:!0,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(E,{children:[(0,X.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(ce,{className:a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,52rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(q,{connector:e,size:`lg`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.source}),(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.kind}),t?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,X.jsx)(ee,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]}):null]}),(0,X.jsx)(v,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,X.jsx)(w,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:e.description})]})]}),(0,X.jsx)(m,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.focusRingPanel),"aria-label":i.modalClose,children:[(0,X.jsx)(_e,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,X.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),i.detailTools]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:c?tt(i.connectorPreviewToolsCount,{count:c.toolCount}):i.connectorPreviewUnknown})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,X.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),i.detailPermissions]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:it(e,i)})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,X.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRequiredInputs]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:tt(i.connectorRequiredInputsCount,{count:f})})]})]}),(0,X.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorCapabilitiesTitle}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[h.map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-muted`,children:nt(e,i)},e)),_>0?(0,X.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-subtle`,children:[`+`,_]}):null]}),(0,X.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:i.connectorCapabilitiesHint})]}),u?(0,X.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:u}):null,c?(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorPreviewTitle}),(0,X.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-xs font-medium`,c.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:c.ok?i.healthStatusHealthy:i.healthStatusLabels[c.status]??c.status})]}),(0,X.jsxs)(`div`,{className:`mb-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:c.toolCount}),(0,X.jsx)(`div`,{className:`text-fg-muted`,children:i.toolsMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:c.resourceCount}),(0,X.jsx)(`div`,{className:`text-fg-muted`,children:i.resourcesMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:c.promptCount}),(0,X.jsx)(`div`,{className:`text-fg-muted`,children:i.promptsMetric})]})]}),(0,X.jsxs)(`div`,{className:`grid gap-2`,children:[(0,X.jsx)(ot,{title:i.detailTools,items:c.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,X.jsx)(ot,{title:i.detailResources,items:c.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,X.jsx)(ot,{title:i.detailPrompts,items:c.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??tt(i.promptArgumentCount,{count:e.argumentCount})}))})]}),c.error?(0,X.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:c.error}):null,c.action?(0,X.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:c.action}):null]}):null]}),(0,X.jsxs)(`aside`,{className:`space-y-3`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(re,{className:`size-4 text-accent`,"aria-hidden":!0}),i.detailPermissions]}),(0,X.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:it(e,i)})]}),(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(C,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorSetupTitle]}),y.length>0?(0,X.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-lg border border-edge`,children:y.map(e=>(0,X.jsxs)(`div`,{className:`bg-surface-panel px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),(0,X.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e.kind}),e.required?(0,X.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-1.5 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:i.connectorSetupRequired}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.key))}):(0,X.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.connectorSetupNone})]}),(0,X.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,X.jsx)(`p`,{className:`mt-2 break-words text-xs leading-5 text-fg-muted`,children:rt(e,i)})]})]})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,X.jsx)(m,{asChild:!0,children:(0,X.jsx)(V,{variant:`secondary`,children:i.modalClose})}),(0,X.jsxs)(V,{variant:`secondary`,disabled:o,onClick:()=>void b(),children:[o?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(te,{className:`size-4`}),i.connectorPreviewButton]}),t?(0,X.jsxs)(V,{variant:`secondary`,disabled:!0,children:[(0,X.jsx)(W,{className:`size-4`}),i.connectedBadge]}):(0,X.jsxs)(V,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,X.jsx)(g,{className:`size-4`}),i.connect]})]})]})]})})}var lt=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,de);function ut(e){let t=(0,Y.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:i,onChange:o,onSave:s,onClose:c,t:l,mcp:u}=e,d;t[0]===c?d=t[1]:(d=e=>{e||c()},t[0]=c,t[1]=d);let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(32rem,calc(100vh-2rem))] w-[min(100%-2rem,38rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[3]=p):p=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,X.jsx)(ie,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=h):h=t[4];let g;t[5]===l.runtimeSettingsTitle?g=t[6]:(g=(0,X.jsx)(v,{className:`text-base font-semibold text-fg`,children:l.runtimeSettingsTitle}),t[5]=l.runtimeSettingsTitle,t[6]=g);let _;t[7]===l.runtimeSettingsHint?_=t[8]:(_=(0,X.jsx)(w,{className:`mt-1 text-sm text-fg-muted`,children:l.runtimeSettingsHint}),t[7]=l.runtimeSettingsHint,t[8]=_);let y;t[9]!==g||t[10]!==_?(y=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[h,(0,X.jsxs)(`div`,{className:`min-w-0`,children:[g,_]})]}),t[9]=g,t[10]=_,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.focusRingPanel),t[12]=b):b=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(_e,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=x):x=t[13];let S;t[14]===l.modalClose?S=t[15]:(S=(0,X.jsx)(m,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:b,"aria-label":l.modalClose,children:x})}),t[14]=l.modalClose,t[15]=S);let C;t[16]!==S||t[17]!==y?(C=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[y,S]}),t[16]=S,t[17]=y,t[18]=C):C=t[18];let D;t[19]===u.idleTtlLabel?D=t[20]:(D=(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:u.idleTtlLabel}),t[19]=u.idleTtlLabel,t[20]=D);let O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=a(lt,`w-40 flex-none`),t[21]=O):O=t[21];let k=r??``,A;t[22]===o?A=t[23]:(A=e=>{let t=e.currentTarget.value.trim();o(t===``?void 0:Number.parseInt(t,10))},t[22]=o,t[23]=A);let j;t[24]!==u.idleTtlPlaceholder||t[25]!==k||t[26]!==A?(j=(0,X.jsx)(`input`,{type:`number`,min:0,className:O,value:k,placeholder:u.idleTtlPlaceholder,onChange:A}),t[24]=u.idleTtlPlaceholder,t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;t[28]===u.idleTtlHint?M=t[29]:(M=(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:u.idleTtlHint}),t[28]=u.idleTtlHint,t[29]=M);let N;t[30]!==D||t[31]!==j||t[32]!==M?(N=(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,X.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[D,j,M]})}),t[30]=D,t[31]=j,t[32]=M,t[33]=N):N=t[33];let P;t[34]!==c||t[35]!==i||t[36]!==l.modalCancel?(P=(0,X.jsx)(V,{type:`button`,variant:`secondary`,disabled:i,onClick:c,children:l.modalCancel}),t[34]=c,t[35]=i,t[36]=l.modalCancel,t[37]=P):P=t[37];let F;t[38]===s?F=t[39]:(F=()=>void s(),t[38]=s,t[39]=F);let I;t[40]===i?I=t[41]:(I=i?(0,X.jsx)(K,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,t[40]=i,t[41]=I);let L;t[42]!==u.save||t[43]!==i||t[44]!==F||t[45]!==I?(L=(0,X.jsxs)(V,{type:`button`,variant:`primary`,disabled:i,onClick:F,children:[I,u.save]}),t[42]=u.save,t[43]=i,t[44]=F,t[45]=I,t[46]=L):L=t[46];let R;t[47]!==P||t[48]!==L?(R=(0,X.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[P,L]}),t[47]=P,t[48]=L,t[49]=R):R=t[49];let z;t[50]!==C||t[51]!==N||t[52]!==R?(z=(0,X.jsxs)(E,{children:[f,(0,X.jsxs)(ce,{className:p,children:[C,N,R]})]}),t[50]=C,t[51]=N,t[52]=R,t[53]=z):z=t[53];let B;return t[54]!==n||t[55]!==d||t[56]!==z?(B=(0,X.jsx)(ue,{open:n,onOpenChange:d,children:z}),t[54]=n,t[55]=d,t[56]=z,t[57]=B):B=t[57],B}var dt=(0,J.memo)(function(e){let t=(0,Y.c)(12),{value:n,onChange:r,placeholder:i,className:o}=e,s;t[0]===o?s=t[1]:(s=a(`relative flex min-h-9 min-w-0 flex-1 cursor-text items-center rounded-pill border border-edge bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface`,o),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(ge,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=c):c=t[2];let l;t[3]===r?l=t[4]:(l=e=>r(e.currentTarget.value),t[3]=r,t[4]=l);let u;t[5]!==i||t[6]!==l||t[7]!==n?(u=(0,X.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:n,onChange:l,placeholder:i,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),t[5]=i,t[6]=l,t[7]=n,t[8]=u):u=t[8];let d;return t[9]!==s||t[10]!==u?(d=(0,X.jsxs)(`label`,{className:s,children:[c,u]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}),ft=(0,J.memo)(function(e){let t=(0,Y.c)(30),{onBrowseCatalog:n,onAddCustomServer:r,onOpenRuntimeSettings:i,addLabel:o,browseLabel:s,customLabel:c,settingsLabel:l}=e,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(D,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=u):u=t[0];let d;t[1]===l?d=t[2]:(d=(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:l}),t[1]=l,t[2]=d);let f;t[3]!==i||t[4]!==l||t[5]!==d?(f=(0,X.jsxs)(V,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,"aria-label":l,title:l,onClick:i,children:[u,d]}),t[3]=i,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(ae,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=p):p=t[7];let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(U,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=m):m=t[8];let g;t[9]===o?g=t[10]:(g=(0,X.jsx)(_,{asChild:!0,children:(0,X.jsxs)(V,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[p,o,m]})}),t[9]=o,t[10]=g);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=a(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,H.transition),t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(O,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=y):y=t[12];let b;t[13]!==s||t[14]!==n?(b=(0,X.jsxs)(h,{className:v,onSelect:n,children:[y,s]}),t[13]=s,t[14]=n,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=a(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,H.transition),t[16]=x):x=t[16];let S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(te,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=S):S=t[17];let C;t[18]!==c||t[19]!==r?(C=(0,X.jsxs)(h,{className:x,onSelect:r,children:[S,c]}),t[18]=c,t[19]=r,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==b?(w=(0,X.jsx)(G,{children:(0,X.jsxs)(k,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[b,C]})}),t[21]=C,t[22]=b,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==g?(T=(0,X.jsxs)(j,{children:[g,w]}),t[24]=w,t[25]=g,t[26]=T):T=t[26];let E;return t[27]!==T||t[28]!==f?(E=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[f,T]}),t[27]=T,t[28]=f,t[29]=E):E=t[29],E}),pt=/^([^:=]+)[:=](.*)$/;function mt(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=pt.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function ht(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function gt(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function _t(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function vt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||_t(t)&&(r[e]=t);return r}function yt(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function bt(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function xt(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=yt(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=bt(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=ht(e.headers);return n&&(t.headers=n),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),t}function St(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:gt(a),connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0}}function Ct(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],connectionTimeoutMs:void 0}}function wt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||_t(t)?[]:[St(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function Tt(e){return xt(e)}async function Et(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=xt(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await u(l(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),me()}function Dt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n==`string`){let e=n.trim();e&&t.push({name:e});continue}if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function Ot(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function kt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function At(e,t){let n=await u(l(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=Dt(n.payload.tools),i=Ot(n.payload.resources),a=kt(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function jt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Mt(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function Nt(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function $(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function Pt({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(null),p=Nt(e),m=(0,J.useCallback)(async()=>{o(!0),f(null);try{let t=await At(e.id.trim());u({toolCount:t.toolCount,resourceCount:t.resourceCount,promptCount:t.promptCount})}catch(e){f(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e.id]),h=(0,J.useCallback)(async()=>{c(!0),f(null);try{await i()}catch(e){f(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,X.jsxs)(`div`,{className:`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,onClick:r,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,X.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.transportLabels[e.transport]})]}),p?(0,X.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-subtle`,title:p,children:p}):null,d?(0,X.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null,l?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:$(n.customCapabilitySummary,{tools:String(l.toolCount),resources:String(l.resourceCount),prompts:String(l.promptCount)})}):null]}),(0,X.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.connectorDetails}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(V,{variant:`secondary`,disabled:a,onClick:()=>void m(),children:[a?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(W,{className:`size-4`}),t.testConnection]}),(0,X.jsxs)(V,{variant:`ghost`,disabled:s,onClick:()=>void h(),children:[s?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(le,{className:`size-4`}),t.removeServer]})]})]})]})}function Ft(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function It(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||Ft(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
|
|
2
|
+
`).toLowerCase().includes(r)}function Lt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Rt(e){let t=(0,Y.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:i,searchEmptyLabel:o}=e,[s,c]=(0,J.useState)(``),l;if(t[0]!==s||t[1]!==r||t[2]!==n){let e;t[4]!==s||t[5]!==r?(e=e=>It(e,s,r),t[4]=s,t[5]=r,t[6]=e):e=t[6],l=n.filter(e),t[0]=s,t[1]=r,t[2]=n,t[3]=l}else l=t[3];let u=l,d;t[7]===s?d=t[8]:(d=s.trim(),t[7]=s,t[8]=d);let f=d.length>0,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(ge,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=p):p=t[9];let m,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=a(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,de),h=e=>c(e.target.value),t[10]=m,t[11]=h):(m=t[10],h=t[11]);let g;t[12]!==s||t[13]!==i?(g=(0,X.jsxs)(`div`,{className:`relative`,children:[p,(0,X.jsx)(`input`,{type:`search`,value:s,placeholder:i,"aria-label":i,className:m,onChange:h})]}),t[12]=s,t[13]=i,t[14]=g):g=t[14];let _;t[15]!==u.length||t[16]!==f||t[17]!==n.length?(_=f?(0,X.jsxs)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:[u.length,` / `,n.length]}):null,t[15]=u.length,t[16]=f,t[17]=n.length,t[18]=_):_=t[18];let v;t[19]!==g||t[20]!==_?(v=(0,X.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[g,_]}),t[19]=g,t[20]=_,t[21]=v):v=t[21];let y;t[22]!==u||t[23]!==o||t[24]!==r?(y=(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:u.length===0?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>{let n=e.shortName||Lt(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,X.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,X.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,X.jsx)(`p`,{className:`mt-1 truncate text-xs leading-relaxed text-fg-muted`,title:e.description,children:e.description}):null]},i)})})}),t[22]=u,t[23]=o,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==y?(b=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[v,y]}),t[26]=v,t[27]=y,t[28]=b):b=t[28],b}function zt(e){let t=(0,Y.c)(38),{open:n,onOpenChange:r,serverId:i,title:o,subtitle:s,searchPlaceholder:c,searchEmptyLabel:l,emptyLabel:u,closeLabel:d,tools:f,stripPrefix:p}=e,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(T,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,R)}),t[0]=h):h=t[0];let g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=a(`fixed left-1/2 top-1/2 flex max-h-[min(88vh,40rem)] w-[min(100%-2rem,min(92vw,36rem))] -translate-x-1/2 -translate-y-1/2 flex-col`,z,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=g):g=t[1];let _;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(te,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=_):_=t[2];let y;t[3]===o?y=t[4]:(y=(0,X.jsxs)(v,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[_,o]}),t[3]=o,t[4]=y);let b;t[5]!==i||t[6]!==s||t[7]!==f.length?(b=s.replace(`{{serverId}}`,i).replace(`{{count}}`,String(f.length)),t[5]=i,t[6]=s,t[7]=f.length,t[8]=b):b=t[8];let x;t[9]===b?x=t[10]:(x=(0,X.jsx)(w,{className:`mt-1 text-sm text-fg-muted`,children:b}),t[9]=b,t[10]=x);let S;t[11]!==y||t[12]!==x?(S=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[y,x]}),t[11]=y,t[12]=x,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(_e,{className:`size-4`,"aria-hidden":!0}),t[14]=C):C=t[14];let D;t[15]===d?D=t[16]:(D=(0,X.jsx)(m,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":d,children:C})}),t[15]=d,t[16]=D);let O;t[17]!==S||t[18]!==D?(O=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[S,D]}),t[17]=S,t[18]=D,t[19]=O):O=t[19];let k;t[20]!==u||t[21]!==n||t[22]!==l||t[23]!==c||t[24]!==i||t[25]!==p||t[26]!==f?(k=f.length>0?(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(Rt,{tools:f,stripPrefix:p,searchPlaceholder:c,searchEmptyLabel:l},`${i}-${n?`open`:`closed`}`)}):(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:u})}),t[20]=u,t[21]=n,t[22]=l,t[23]=c,t[24]=i,t[25]=p,t[26]=f,t[27]=k):k=t[27];let A;t[28]===d?A=t[29]:(A=(0,X.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,X.jsx)(m,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`secondary`,children:d})})}),t[28]=d,t[29]=A);let j;t[30]!==O||t[31]!==k||t[32]!==A?(j=(0,X.jsxs)(E,{children:[h,(0,X.jsxs)(ce,{className:g,children:[O,k,A]})]}),t[30]=O,t[31]=k,t[32]=A,t[33]=j):j=t[33];let M;return t[34]!==r||t[35]!==n||t[36]!==j?(M=(0,X.jsx)(ue,{open:n,onOpenChange:r,children:j}),t[34]=r,t[35]=n,t[36]=j,t[37]=M):M=t[37],M}var Bt=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,de);function Vt(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function Ht(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function Ut(e,t){return e.errorCode===`missing_credential`?t.composioHealthMissingCredential:e.errorCode===`unauthorized`?t.composioHealthUnauthorized:e.errorCode===`forbidden`?t.composioHealthForbidden:e.errorCode===`network`?t.composioHealthNetwork:e.errorCode===`timeout`?t.composioHealthTimeout:t.composioHealthDegraded}function Wt({instance:e,t}){let n=Vt(e),[r,i]=(0,J.useState)([]),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)([]),[_,v]=(0,J.useState)(``),[y,x]=(0,J.useState)(`{}`),[S,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(`read`),[k,A]=(0,J.useState)(!1),[j,M]=(0,J.useState)(null),N=(0,J.useCallback)(async()=>{if(!(!n||e.materialized.type!==`composio`||e.materialized.role===`credential`)){A(!0),M(null);try{let[t,r,a,o,s,l,d]=await Promise.all([Ve().catch(()=>[]),Xe(n).catch(()=>[]),Ze(20).catch(()=>[]),Ke(n).catch(()=>`read`),$e().catch(()=>[]),Je(n).catch(()=>null),Ue(n).catch(()=>null)]);i(t.filter(e=>e.toolkit.toLowerCase()===n.toLowerCase())),c(r),u(a.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===n.toLowerCase())),O(o),f(s.filter(t=>t.connectorId===e.connectorId)),m(l?.policy??null),g(l?.agents??[]),v(e=>e||r.find(e=>e.scope===`read`&&e.curated)?.slug||``),E(d)}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[e.connectorId,e.materialized,n]);(0,J.useEffect)(()=>{N()},[N]);let P=(0,J.useCallback)(async()=>{if(n){A(!0),M(null);try{let t=await Fe(e.connectorId);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`)}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[e.connectorId,n]),I=(0,J.useCallback)(async e=>{if(n){O(e);try{await qe(n,e),await N()}catch(e){M(e instanceof Error?e.message:String(e))}}},[N,n]),L=(0,J.useCallback)(async(e,t)=>{A(!0),M(null);try{await et(e,t),await N()}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[N]),R=(0,J.useCallback)(async e=>{if(n){M(null);try{m(await Ye(n,e))}catch(e){M(e instanceof Error?e.message:String(e))}}},[e.connectorId,n]),z=(0,J.useCallback)(e=>{p&&R({allowedAgentIds:p.allowedAgentIds.includes(e)?p.allowedAgentIds.filter(t=>t!==e):[...p.allowedAgentIds,e]})},[R,p]),B=(0,J.useCallback)(async e=>{A(!0),M(null);try{await e(),await N()}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[N]),ee=(0,J.useCallback)(async()=>{if(!(!n||!_)){A(!0),M(null),w(null);try{let n=JSON.parse(y);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(t.composioMemoryArgumentsObject);let i=p?.allowedAgentIds[0]??h[0]?.id;if(!i)throw Error(t.composioMemoryAgentMissing);w((await Qe({connectorId:e.connectorId,actionId:_,agentId:i,connectionId:r.find(e=>e.isDefault)?.id,arguments:n})).recordId)}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}}},[h,r,e.connectorId,_,y,p,t,n]);return n?e.materialized.type===`composio`&&e.materialized.role===`credential`?(0,X.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:t.composioApiKeyStored}):(0,X.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:$(t.composioToolkitTitle,{toolkit:n})}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioScopeHint})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(b,{className:a(Bt,`h-9 w-28 py-1`),value:D,onChange:e=>void I(e.currentTarget.value),children:[(0,X.jsx)(pe,{value:`read`,children:t.composioScopeRead}),(0,X.jsx)(pe,{value:`write`,children:t.composioScopeWrite}),(0,X.jsx)(pe,{value:`admin`,children:t.composioScopeAdmin})]}),(0,X.jsxs)(V,{variant:`secondary`,disabled:k,onClick:()=>void P(),children:[k?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(re,{className:`size-4`}),t.connectOAuth]}),(0,X.jsx)(V,{variant:`ghost`,disabled:k,onClick:()=>void N(),children:t.refresh})]})]}),j?(0,X.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:j}):null,T?(0,X.jsxs)(`div`,{className:a(`mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg border px-3 py-2 text-xs`,T.status===`connected`?`border-emerald-500/30 bg-emerald-500/5 text-emerald-700`:`border-amber-500/30 bg-amber-500/5 text-amber-700`),children:[(0,X.jsx)(`span`,{children:T.status===`connected`?$(t.composioHealthConnected,{count:String(T.activeConnections)}):T.status===`reauthorization_required`?t.composioHealthReconnect:T.status===`degraded`?Ut(T,t):t.composioHealthDisconnected}),T.recovery===`none`?null:(0,X.jsx)(V,{variant:`ghost`,disabled:k,onClick:()=>void(T.recovery===`retry`?N():P()),children:T.recovery===`retry`?t.composioRetry:t.connectOAuth}),T.status===`degraded`&&T.message?(0,X.jsx)(`p`,{className:`basis-full break-words text-[11px] opacity-80`,children:T.message}):null]}):null,p?(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-panel p-3 md:grid-cols-[minmax(0,180px)_1fr]`,children:[(0,X.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioConfirmationPolicy,(0,X.jsxs)(b,{className:a(Bt,`mt-1 h-9 py-1`),value:p.confirmationPolicy,onChange:e=>void R({confirmationPolicy:e.currentTarget.value}),children:[(0,X.jsx)(pe,{value:`writes`,children:t.composioConfirmWrites}),(0,X.jsx)(pe,{value:`always`,children:t.composioConfirmAlways}),(0,X.jsx)(pe,{value:`never`,children:t.composioConfirmNever})]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.composioAllowedAgents}),(0,X.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:p.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:h.map(e=>(0,X.jsx)(`button`,{type:`button`,className:a(`rounded-full border px-2.5 py-1 text-xs transition-colors`,p.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge text-fg-muted hover:text-fg`),onClick:()=>z(e.id),children:e.name},e.id))})]})]}):null,[`gmail`,`googledrive`,`notion`,`slack`].includes(n)&&s.some(e=>e.scope===`read`&&e.curated)?(0,X.jsxs)(`div`,{className:`mt-4 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(C,{className:`mt-0.5 size-4 text-accent`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.composioMemorySync}),(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioMemorySyncHint})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-[minmax(0,240px)_1fr_auto] md:items-end`,children:[(0,X.jsxs)(`label`,{className:`text-xs text-fg-subtle`,children:[t.composioMemoryReadAction,(0,X.jsx)(b,{className:a(Bt,`mt-1 h-9 py-1`),value:_,onChange:e=>v(e.currentTarget.value),children:s.filter(e=>e.scope===`read`&&e.curated).map(e=>(0,X.jsx)(pe,{value:e.slug,children:e.name??e.slug},e.slug))})]}),(0,X.jsxs)(`label`,{className:`text-xs text-fg-subtle`,children:[t.composioMemoryArguments,(0,X.jsx)(`input`,{className:a(Bt,`mt-1 h-9 py-1 font-mono text-xs`),value:y,onChange:e=>x(e.currentTarget.value)})]}),(0,X.jsxs)(V,{disabled:k||!_,onClick:()=>void ee(),children:[k?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(C,{className:`size-4`}),t.composioSyncNow]})]}),S?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-emerald-600`,children:$(t.composioMemorySynced,{id:S})}):null]}):null,d.length?(0,X.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioPendingApprovals}),d.map(e=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`truncate font-mono text-xs font-medium text-fg`,children:e.actionId}),(0,X.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-subtle`,children:JSON.stringify(e.argumentsPreview)}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:$(t.composioApprovalExpires,{time:new Date(e.expiresAt).toLocaleTimeString()})})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsxs)(V,{variant:`secondary`,disabled:k,onClick:()=>void L(e.id,`denied`),children:[(0,X.jsx)(_e,{className:`size-4`}),t.composioDeny]}),(0,X.jsxs)(V,{disabled:k,onClick:()=>void L(e.id,`approved`),children:[(0,X.jsx)(o,{className:`size-4`}),t.approve]})]})]},e.id))]}):null,(0,X.jsxs)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioConnections}),r.length?r.map(e=>(0,X.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.accountEmail??e.username??e.workspace??e.providerConnectionId}),(0,X.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[e.status,e.isDefault?` · ${t.composioDefaultAccount}`:``]})]}),(0,X.jsx)(`input`,{className:a(Bt,`h-8 py-1 text-xs`),defaultValue:e.alias??``,placeholder:t.composioAccountAlias,onBlur:t=>{t.currentTarget.value!==(e.alias??``)&&B(()=>He(e.id,{alias:t.currentTarget.value}))}}),(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[(0,X.jsx)(V,{variant:`ghost`,className:`size-8 p-0`,title:t.composioMakeDefault,disabled:k||e.isDefault,onClick:()=>void B(async()=>{await He(e.id,{isDefault:!0}),n&&await Ye(n,{selectedConnectionIds:[e.id]})}),children:(0,X.jsx)(F,{className:a(`size-4`,e.isDefault&&`fill-current`)})}),(0,X.jsx)(V,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:k,onClick:()=>void B(()=>We(e.id)),children:(0,X.jsx)(ne,{className:`size-4`})}),(0,X.jsx)(V,{variant:`ghost`,className:`size-8 p-0`,title:t.composioRevoke,disabled:k,onClick:()=>{window.confirm(t.composioRevokeConfirm)&&B(()=>Ge(e.id))},children:(0,X.jsx)(le,{className:`size-4 text-red-500`})})]})]},e.id)):(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioConnectionsEmpty})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),s.length?s.slice(0,8).map(e=>(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,X.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[Ht(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),l.length?l.slice(0,5).map(e=>(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel p-2`,children:[(0,X.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})]})]})]}):null}var Gt=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,de);function Kt(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function qt(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function Jt(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function Yt(e){let t=(0,Y.c)(12),{title:n,description:r,meta:i}=e,o;t[0]===r?o=t[1]:(o=r?(0,X.jsx)(M,{delayDuration:300,skipDelayDuration:100,children:(0,X.jsxs)(I,{children:[(0,X.jsx)(y,{asChild:!0,children:(0,X.jsx)(`p`,{tabIndex:0,title:r,className:a(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:r})}),(0,X.jsx)(x,{children:(0,X.jsx)(N,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,X.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:r})})})]})}):null,t[0]=r,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=(0,X.jsx)(`p`,{className:`min-w-0 break-all font-mono text-xs font-medium leading-5 text-fg`,children:n}),t[2]=n,t[3]=c);let l;t[4]===i?l=t[5]:(l=i?(0,X.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] leading-4 text-fg-subtle`,children:i}):null,t[4]=i,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==s||t[10]!==u?(d=(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[u,s]}),t[9]=s,t[10]=u,t[11]=d):d=t[11],d}function Xt({instance:e,definition:t,onClose:n,onChanged:r,t:i,mcp:o}){let[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1),[p,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(`health`),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(()=>qt(t,e)),[D,O]=(0,J.useState)(null),k=t?.setup.config??[],j=e.materialized.type===`mcp`&&k.length>0&&(t?.setup.secrets??[]).length===0,M=p?p.toolCount:e.usage.lastToolCount,N=(0,J.useMemo)(()=>{let t=[[`health`,B,i.detailHealth],[`tools`,te,`${i.detailTools} ${p?p.toolCount:e.usage.lastToolCount??``}`],[`resources`,C,`${i.detailResources} ${p?p.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,A,`${i.detailPrompts} ${p?p.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,re,i.detailPermissions]];return j?[...t,[`config`,C,i.connectorConfigLabel]]:t},[p,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,j,i]),P=(0,J.useCallback)(async()=>{c(!0),O(null);try{let t=await Be(e.instanceId);h(t),t.toolCount>0&&_(`tools`),r()}catch(e){O(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,r]),F=(0,J.useCallback)(async()=>{u(!0),O(null);try{await ze(e.instanceId),await r(),n()}catch(e){O(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,r,n]),I=(0,J.useCallback)(async()=>{if(!(!t||!j)){f(!0),O(null);try{let n={};for(let e of t.setup.config??[]){let t=Jt(e.type,x[e.key]??``);t!==void 0&&(n[e.key]=t)}await Re(e.instanceId,{config:n}),await r(),_(`health`)}catch(e){O(e instanceof Error?e.message:String(e))}finally{f(!1)}}},[x,t,e.instanceId,r,j]);return(0,X.jsxs)(ue,{open:!0,onOpenChange:e=>{e||n()},children:[(0,X.jsxs)(E,{children:[(0,X.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(ce,{className:a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(q,{connector:t,size:`lg`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(v,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,X.jsx)(w,{className:`mt-1 text-sm text-fg-muted`,children:e.materialized.type===`mcp`?$(i.mcpServerRuntime,{serverId:e.materialized.serverId}):$(i.runtimeLabel,{runtime:e.materialized.type})})]})]}),(0,X.jsx)(m,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.focusRingPanel),"aria-label":i.modalClose,children:[(0,X.jsx)(_e,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[D?(0,X.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:D}):null,(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:N.map(([e,t,n])=>(0,X.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,g===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>_(e),children:[(0,X.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,X.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[g===`health`?(0,X.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,X.jsxs)(`p`,{children:[i.statusLabel,` `,(0,X.jsx)(`span`,{className:p?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:Kt(p?.status??e.usage.lastHealthStatus,i)})]}),(0,X.jsxs)(`p`,{children:[i.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():i.never]}),p?.action?(0,X.jsx)(`p`,{children:p.action}):null]}):null,g===`tools`?p?.tools.length?(0,X.jsxs)(`div`,{className:`grid gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:$(i.toolsAvailable,{count:String(p.tools.length)})}),(0,X.jsx)(V,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>b(!0),children:o.viewAllTools})]}),(0,X.jsx)(`div`,{className:`grid gap-2`,children:p.tools.slice(0,8).map(e=>(0,X.jsx)(Yt,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`text-fg-muted`,children:M?$(i.toolsLastCheckSummary,{count:String(M)}):i.toolsRunTestHint}),(0,X.jsxs)(V,{type:`button`,variant:`secondary`,disabled:s,onClick:()=>void P(),children:[s?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(W,{className:`size-4`}),i.test]})]}):null,g===`resources`?p?.resources.length?(0,X.jsx)(`div`,{className:`grid gap-2`,children:p.resources.slice(0,8).map(e=>(0,X.jsx)(Yt,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,X.jsx)(`p`,{className:`text-fg-muted`,children:i.resourcesRunTestHint}):null,g===`prompts`?p?.prompts.length?(0,X.jsx)(`div`,{className:`grid gap-2`,children:p.prompts.slice(0,8).map(e=>(0,X.jsx)(Yt,{title:e.title??e.name,description:e.description,meta:e.argumentCount?$(i.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,X.jsx)(`p`,{className:`text-fg-muted`,children:i.promptsRunTestHint}):null,g===`permissions`?(0,X.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,X.jsx)(`p`,{children:$(i.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,X.jsx)(`p`,{children:e.materialized.type===`mcp`?$(i.runtimeServerLabel,{runtime:e.materialized.type.toUpperCase(),serverId:e.materialized.serverId}):$(i.runtimeLabel,{runtime:e.materialized.type.toUpperCase()})}),(0,X.jsx)(`p`,{children:e.materialized.type===`mcp`?i.mcpPolicyHint:i.connectorPolicyHint})]}):null,g===`config`&&j?(0,X.jsx)(`div`,{className:`grid gap-3`,children:k.map(e=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,X.jsx)(`input`,{className:Gt,value:x[e.key]??``,placeholder:e.placeholder,onChange:t=>S(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}),e.materialized.type===`composio`?(0,X.jsx)(Wt,{instance:e,t:i}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,X.jsx)(V,{variant:`secondary`,onClick:n,children:i.modalClose}),g===`config`&&j?(0,X.jsxs)(V,{variant:`primary`,disabled:d,onClick:()=>void I(),children:[d?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(oe,{className:`size-4`}),i.modalSave]}):null,e.materialized.type===`mcp`?(0,X.jsxs)(V,{variant:`secondary`,disabled:s,onClick:()=>void P(),children:[s?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(W,{className:`size-4`}),i.test]}):null,(0,X.jsxs)(V,{variant:`ghost`,disabled:l,onClick:()=>void F(),children:[l?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(le,{className:`size-4`}),i.remove]})]})]})]}),e.materialized.type===`mcp`?(0,X.jsx)(zt,{open:y,onOpenChange:b,serverId:e.materialized.serverId,title:$(i.installedToolsDialogTitle,{name:e.displayName}),subtitle:i.installedToolsDialogSubtitle,searchPlaceholder:o.toolsDialogSearchPlaceholder,searchEmptyLabel:o.toolsDialogSearchEmpty,emptyLabel:i.toolsRunTestHint,closeLabel:o.toolsDialogClose,tools:p?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null]})}function Zt({instance:e,definition:t,highlighted:n=!1,onOpenDetails:r,onChanged:i,t:o}){let[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),p=(0,J.useCallback)(async()=>{c(!0),f(null);try{await Be(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e.instanceId,i]),m=(0,J.useCallback)(async()=>{u(!0),f(null);try{await ze(e.instanceId),await i()}catch(e){f(e instanceof Error?e.message:String(e)),u(!1)}},[e.instanceId,i]),h=e.usage.lastHealthStatus?o.healthStatusLabels[e.usage.lastHealthStatus]??e.usage.lastHealthStatus:o.healthNotTested,g=e.usage.lastToolCount??0,_=!!(t?.setup.config?.length&&!t.setup.secrets?.length&&e.materialized.type===`mcp`);return(0,X.jsxs)(`div`,{className:a(`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,n&&`ring-2 ring-accent/45 ring-offset-2 ring-offset-surface-panel`),onClick:()=>r(e),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,X.jsx)(q,{connector:t}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,X.jsx)(ee,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}),_?(0,X.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorConfigLabel}):null]}),(0,X.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all text-sm leading-5 text-fg-muted`,children:e.materialized.type===`mcp`?$(o.mcpServerRuntime,{serverId:e.materialized.serverId}):$(o.runtimeLabel,{runtime:e.materialized.type})}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,X.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[o.statusLabel,` `,h]}),(0,X.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:$(o.toolsAvailable,{count:String(g)})})]}),d?(0,X.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:d}):null]})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:o.connectorDetails}),(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[e.materialized.type===`mcp`?(0,X.jsxs)(V,{variant:`secondary`,disabled:s,onClick:()=>void p(),children:[s?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(W,{className:`size-4`}),o.test]}):null,(0,X.jsxs)(V,{variant:`ghost`,disabled:l,onClick:()=>void m(),children:[l?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(le,{className:`size-4`}),o.remove]})]})]})]})}var Qt=a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,de),$t=a(Qt,`min-h-28 font-mono`);function en(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function tn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function nn(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}function rn(e){let t=(0,Y.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`div`,{className:`border-b border-edge px-3 py-2 text-xs font-semibold text-fg`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,12).map(an),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>12?(0,X.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-subtle`,children:[`+`,r.length-12]}):null,t[4]=r.length,t[5]=o);let s;t[6]!==a||t[7]!==o?(s=(0,X.jsxs)(`div`,{className:`max-h-40 overflow-y-auto`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==s?(c=(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel`,children:[i,s]}),t[9]=i,t[10]=s,t[11]=c):c=t[11],c}function an(e){return(0,X.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,X.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,X.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function on({draft:e,onChange:t,onClose:n,onInstalled:r,t:i}){let{connector:o}=e,s=e.result?`complete`:e.installing?`health`:`configure`,c=[{id:`configure`,label:i.connectStepConfigure},{id:`health`,label:i.connectStepVerify},{id:`complete`,label:i.connectStepReady}],l=(0,J.useCallback)(async()=>{t({...e,installing:!0,error:null,result:null,health:null});try{let n={};for(let t of o.setup.config??[]){let r=tn(t.type,e.config[t.key]??``);r!==void 0&&(n[t.key]=r)}let i=e.store?await ke(e.store.packageName,{secrets:e.secrets,config:n},e.store.version):await Ie(o.id,{secrets:e.secrets,config:n,definition:o.source===`registry`?o:void 0}),a=null;try{a=await Be(i.instanceId)}catch{a=null}t({...e,installing:!1,result:i,health:a}),await r(i)}catch(n){t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[o,e,t,r]);return(0,X.jsx)(ue,{open:!0,onOpenChange:e=>{e||n()},children:(0,X.jsxs)(E,{children:[(0,X.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(ce,{className:a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(q,{connector:o,size:`lg`}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(v,{className:`text-base font-semibold text-fg`,children:$(i.connectDialogTitle,{name:o.displayName})}),(0,X.jsx)(w,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:o.description})]})]}),(0,X.jsx)(m,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.focusRingPanel),"aria-label":i.modalClose,children:[(0,X.jsx)(_e,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 overflow-y-auto px-6 py-5`,children:[(0,X.jsx)(`div`,{className:`mb-5 grid grid-cols-3 gap-2`,"aria-label":i.connectProgressAria,children:c.map((e,t)=>{let n=c.findIndex(e=>e.id===s);return(0,X.jsxs)(`div`,{className:a(`rounded-xl border px-3 py-2 text-xs font-medium`,t===n?`border-accent bg-accent-soft text-accent-fg`:t<n?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-edge bg-surface-base text-fg-muted`),children:[(0,X.jsxs)(`span`,{className:`mr-1 tabular-nums`,children:[t+1,`.`]}),e.label]},e.id)})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.integrationStrategy?(0,X.jsx)(`div`,{className:`rounded-xl border border-accent/20 bg-accent-soft/60 px-4 py-3 text-sm text-accent-fg`,children:o.integrationStrategy.lane===`mcp`?i.integrationStrategyMcpHint:o.integrationStrategy.lane===`native`?i.integrationStrategyNativeHint:i.integrationStrategyComposioHint}):null,e.store?(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.detailPermissions}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,X.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,X.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:i.storeLocalExecDenied})]})]}):null,(o.setup.secrets??[]).map(n=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,X.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,X.jsx)(fe,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:i.secretInputLabels,placeholder:n.required?i.requiredPlaceholder:i.optionalPlaceholder})]},n.key)),(o.setup.config??[]).map(n=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,X.jsx)(`textarea`,{className:$t,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,X.jsx)(`input`,{className:Qt,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,X.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,X.jsx)(K,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),i.connectingTitle]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i.connectingHint})]}):null,e.error?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:e.error}):null,e.result?(0,X.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:$(i.connectedAs,{target:e.result.materialized.type===`mcp`?e.result.materialized.serverId:e.result.instanceId})}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:$(i.runtimeLabel,{runtime:e.result.materialized.type.toUpperCase()})})]}),(0,X.jsx)(`span`,{className:a(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?i.healthStatusHealthy:en(e.health?.status,i)})]}),e.health?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.toolCount}),(0,X.jsx)(`div`,{children:i.toolsMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.resourceCount}),(0,X.jsx)(`div`,{children:i.resourcesMetric})]}),(0,X.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,X.jsx)(`div`,{className:`font-semibold text-fg`,children:e.health.promptCount}),(0,X.jsx)(`div`,{children:i.promptsMetric})]})]}),(0,X.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,X.jsx)(rn,{title:i.detailTools,items:e.health.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,X.jsx)(rn,{title:i.detailResources,items:e.health.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,X.jsx)(rn,{title:i.detailPrompts,items:e.health.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??$(i.promptArgumentCount,{count:String(e.argumentCount)})}))})]})]}):(0,X.jsx)(`p`,{className:`mt-3`,children:i.installedWithoutHealth}),e.health?.action?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,X.jsxs)(V,{variant:`primary`,disabled:!!e.result||e.installing,onClick:()=>void l(),children:[e.installing?(0,X.jsx)(K,{className:`size-4 animate-spin`}):e.result?(0,X.jsx)(ee,{className:`size-4`}):(0,X.jsx)(g,{className:`size-4`}),e.result?i.connectedBadge:i.connect]})})]})]})})}function sn(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return Ct(r)}function cn(e,t,n){let r=e.key.trim();if(r)return`key:${r}`;let i=e.value.trim();return i?`value:${i}`:`empty:${n.slice(0,t).filter(e=>!e.key.trim()&&!e.value.trim()).length}`}function ln(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,de)}function un({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:o,keyPlaceholder:c,valuePlaceholder:l,headers:u,onChange:d}){let f=(e,t)=>{d(u.map((n,r)=>r===e?{...n,...t}:n))},p=()=>{d([...u,{key:``,value:``}])},m=e=>{let t=u.filter((t,n)=>n!==e);d(t.length>0?t:[{key:``,value:``}])},h=async()=>{try{let e=await s();if(!e){window.alert(o);return}let t=mt(e);if(!t?.length){window.alert(o);return}d(t)}catch{window.alert(o)}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,X.jsx)(`span`,{children:e}),t?(0,X.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,X.jsxs)(V,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void h(),children:[(0,X.jsx)(P,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{className:a(ln(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:c,onChange:e=>f(t,{key:e.target.value})}),(0,X.jsx)(`input`,{className:a(ln(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:l,onChange:e=>f(t,{value:e.target.value})}),(0,X.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:u.length<=1&&!e.key&&!e.value,onClick:()=>m(t),"aria-label":r,children:(0,X.jsx)(le,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},cn(e,t,u)))}),(0,X.jsxs)(`button`,{type:`button`,className:a(`self-start text-sm text-accent hover:underline`,H.press),onClick:p,children:[`+ `,n]})]})}var dn=[`stdio`,`sse`,`streamable-http`];function fn(e){let t=(0,Y.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,X.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,X.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,X.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function pn(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,de)}function mn(e){let t=(0,Y.c)(29),{row:n,t:r,onUpdate:i,idConflictMessage:o,variant:s}=e,c=s===void 0?`all`:s,l=c===`all`||c===`basic`,u=c===`all`||c===`advanced`,d;t[0]!==o||t[1]!==i||t[2]!==n.id||t[3]!==n.transport||t[4]!==l||t[5]!==r?(d=l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fn,{label:r.transportLabel,required:!0,children:(0,X.jsx)(b,{className:pn(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:dn.map(e=>(0,X.jsx)(pe,{value:e,children:r.transportLabels[e]},e))})}),(0,X.jsxs)(fn,{label:r.serverIdLabel,required:!0,children:[(0,X.jsx)(`input`,{className:pn(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),o?(0,X.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:o}):null]})]}):null,t[0]=o,t[1]=i,t[2]=n.id,t[3]=n.transport,t[4]=l,t[5]=r,t[6]=d):d=t[6];let f;t[7]!==i||t[8]!==n.argsText||t[9]!==n.command||t[10]!==n.cwd||t[11]!==n.envJson||t[12]!==n.headers||t[13]!==n.transport||t[14]!==n.url||t[15]!==u||t[16]!==l||t[17]!==r||t[18]!==c?(f=n.transport===`stdio`?(0,X.jsxs)(X.Fragment,{children:[l?(0,X.jsx)(`div`,{className:c===`basic`?`md:col-span-2`:void 0,children:(0,X.jsx)(fn,{label:r.commandLabel,required:!0,children:(0,X.jsx)(`input`,{className:pn(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,u?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fn,{label:r.argsLabel,description:r.argsHint,children:(0,X.jsx)(`input`,{className:pn(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}),(0,X.jsx)(fn,{label:r.cwdLabel,children:(0,X.jsx)(`input`,{className:pn(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,X.jsx)(fn,{label:r.envLabel,description:r.envHint,children:(0,X.jsx)(`textarea`,{className:a(pn(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,X.jsxs)(X.Fragment,{children:[l?(0,X.jsx)(`div`,{className:`md:col-span-2`,children:(0,X.jsx)(fn,{label:r.urlLabel,required:!0,children:(0,X.jsx)(`input`,{className:a(pn(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,u?(0,X.jsx)(un,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>i({headers:e})}):null]}),t[7]=i,t[8]=n.argsText,t[9]=n.command,t[10]=n.cwd,t[11]=n.envJson,t[12]=n.headers,t[13]=n.transport,t[14]=n.url,t[15]=u,t[16]=l,t[17]=r,t[18]=c,t[19]=f):f=t[19];let p;t[20]!==i||t[21]!==n||t[22]!==u||t[23]!==r?(p=u?(0,X.jsx)(fn,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,X.jsx)(`input`,{type:`number`,min:1,max:600,className:pn(),value:jt(n),placeholder:r.timeoutPlaceholder,onChange:e=>i({connectionTimeoutMs:Mt(e.target.value)})})}):null,t[20]=i,t[21]=n,t[22]=u,t[23]=r,t[24]=p):p=t[24];let m;return t[25]!==d||t[26]!==f||t[27]!==p?(m=(0,X.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[d,f,p]}),t[25]=d,t[26]=f,t[27]=p,t[28]=m):m=t[28],m}function hn(e,t){if(e.shortName)return e.shortName;let n=`${t.trim()}__`;return n&&e.name.startsWith(n)?e.name.slice(n.length):e.name}function gn(e){let t=(0,Y.c)(13),{tool:n,serverId:r}=e,i;t[0]!==r||t[1]!==n?(i=hn(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o=i,s=n.name===o?o:n.name,c;t[3]===n.description?c=t[4]:(c=n.description?.trim(),t[3]=n.description,t[4]=c);let l=c,u;t[5]!==o||t[6]!==s?(u=(0,X.jsx)(`p`,{className:`break-all font-mono text-xs font-medium leading-5 text-fg`,title:s,children:o}),t[5]=o,t[6]=s,t[7]=u):u=t[7];let d;t[8]===l?d=t[9]:(d=l?(0,X.jsx)(M,{delayDuration:300,skipDelayDuration:100,children:(0,X.jsxs)(I,{children:[(0,X.jsx)(y,{asChild:!0,children:(0,X.jsx)(`p`,{tabIndex:0,title:l,className:a(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:l})}),(0,X.jsx)(x,{children:(0,X.jsx)(N,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,X.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:l})})})]})}):null,t[8]=l,t[9]=d);let f;return t[10]!==u||t[11]!==d?(f=(0,X.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[u,d]}),t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function _n({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:i,config:o,managedServerIds:s,t:c,cs:l,onClose:u,onSaved:d}){let[f,h]=(0,J.useState)(n),[g,_]=(0,J.useState)(!1),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,D]=(0,J.useState)(!1),[O,k]=(0,J.useState)({status:`idle`}),[A,j]=(0,J.useState)(null),M=n.id.trim(),N=f.id.trim()!==M&&s.has(f.id.trim())||s.has(f.id.trim())&&t===`add`?c.reservedServerId:void 0,P=f.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===f.id.trim())?l.duplicateServerId:void 0,F=f.id.trim().length>0&&!N&&!P&&(f.transport===`stdio`?f.command.trim().length>0:f.url.trim().length>0),I=Nt(f),L=(0,J.useCallback)(async()=>{if(f.id.trim()){b(!0),S(null),k({status:`loading`});try{k({status:`ok`,tools:(await At(f.id.trim(),Tt(f))).tools})}catch(e){k({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{b(!1)}}},[f]),R=(0,J.useCallback)(async()=>{if(!(!F||g)){_(!0),S(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(f),await Et({sessionIdleTtlMinutes:i,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},vt(o)),await d(),u()}catch(e){S(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[F,o,r,n.clientKey,t,u,d,M,f,g,i]);return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ue,{open:e,onOpenChange:e=>{e||u()},children:(0,X.jsxs)(E,{children:[(0,X.jsx)(T,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,X.jsxs)(ce,{className:a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(v,{className:`text-base font-semibold text-fg`,children:t===`add`?l.addCustomServerTitle:l.editCustomServerTitle}),(0,X.jsx)(w,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?l.addCustomServerHint:l.editCustomServerHint})]}),(0,X.jsx)(m,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,H.focusRingPanel),"aria-label":l.modalClose,children:[(0,X.jsx)(_e,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:l.modalClose})]})})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,X.jsx)(p,{className:`size-4 text-accent`,"aria-hidden":!0}),f.id.trim()||c.cardUntitled]}),(0,X.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-fg-muted`,children:I||(f.transport===`stdio`?c.commandLabel:c.urlLabel)})]}),(0,X.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:c.transportLabels[f.transport]})]})}),(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`div`,{className:`mb-3`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:l.connectorBasicConfigTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:l.connectorBasicConfigHint})]}),(0,X.jsx)(mn,{row:f,t:c,variant:`basic`,onUpdate:e=>{h(t=>({...t,...e})),S(null)},idConflictMessage:N??P})]}),O.status===`ok`?(0,X.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,X.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),O.tools.length===0?c.toolsEmpty:c.toolsTitle.replace(`{{count}}`,String(O.tools.length))]}),O.tools.length>0?(0,X.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>j(O.tools),children:c.viewAllTools}):null]}),O.tools.length>0?(0,X.jsx)(`div`,{className:`mt-3 grid gap-2`,children:O.tools.slice(0,6).map((e,t)=>(0,X.jsx)(gn,{tool:e,serverId:f.id},e.name||`tool-${t}`))}):null]}):null,O.status===`error`?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:O.message}):null,x?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x}):null,(0,X.jsxs)(`details`,{open:C,onToggle:e=>D(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg hover:text-fg [&::-webkit-details-marker]:hidden`,children:[(0,X.jsx)(U,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`group-open:hidden`,children:l.connectorShowAdvancedConfig}),(0,X.jsx)(`span`,{className:`hidden group-open:inline`,children:l.connectorHideAdvancedConfig})]}),(0,X.jsx)(`div`,{className:`border-t border-edge px-4 py-4`,children:(0,X.jsx)(mn,{row:f,t:c,variant:`advanced`,onUpdate:e=>{h(t=>({...t,...e})),S(null)}})})]})]})}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,X.jsxs)(V,{variant:`secondary`,disabled:!f.id.trim()||y,onClick:()=>void L(),children:[y?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(W,{className:`size-4`}),c.testConnection]}),(0,X.jsx)(m,{asChild:!0,children:(0,X.jsx)(V,{variant:`secondary`,children:l.modalCancel})}),(0,X.jsxs)(V,{variant:`primary`,disabled:!F||g,onClick:()=>void R(),children:[g?(0,X.jsx)(K,{className:`size-4 animate-spin`}):(0,X.jsx)(ee,{className:`size-4`}),g?c.saving:l.modalSave]})]})]})]})}),A?(0,X.jsx)(zt,{open:!0,onOpenChange:e=>{e||j(null)},serverId:f.id,title:c.toolsDialogTitle,subtitle:c.toolsDialogSubtitle,searchPlaceholder:c.toolsDialogSearchPlaceholder,searchEmptyLabel:c.toolsDialogSearchEmpty,emptyLabel:c.toolsEmpty,closeLabel:c.toolsDialogClose,tools:A,stripPrefix:`${f.id.trim()}__`}):null]}):null}var vn=[`understand`,`act`,`reach`];function yn(e){let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase();return t.has(`channel`)||t.has(`events`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n)?`reach`:t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n)?`understand`:`act`}function bn(e,t){let n=t?yn(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function xn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.description,e.category,e.kind,e.source,...e.tags??[]].some(e=>e.toLowerCase().includes(n)):!0}function Sn(e,t,n){return e.filter(e=>xn(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function Cn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.connectorId,e.instanceId,e.status,e.connectionStatus??``,e.materialized.type,e.materialized.type===`mcp`?e.materialized.serverId:e.materialized.id].some(e=>e.toLowerCase().includes(n)):!0}function wn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.command??``,e.url??``,e.transport].some(e=>e.toLowerCase().includes(n)):!0}var Tn=`all`,En=`builtin`,Dn=`xopc-store`;function On(e){let t=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(e.category??``)?e.category:`custom`;return{id:e.name,version:e.latestVersion??`store`,displayName:e.name,description:e.description,category:t,kind:`mcp`,source:`store`,capabilities:[`tools`,`runtime.mcp.streamableHttp`],tags:[`store`],auth:{mode:`none`},setup:{},runtime:{type:`mcp`,serverId:`store-${e.name}`.slice(0,64)}}}function kn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function An(){let e=c(d(e=>e.language)),t=e.connectorsSettings,n=e.mcpSettings,r=f(e=>e.token),o=!!r,[s,l]=i(),[u,p]=(0,J.useState)(s.get(`tab`)===`connected`?`connected`:`discover`),m=(0,J.useRef)(!1),[h,g]=(0,J.useState)({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!0,error:null}),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(!1),[x,C]=(0,J.useState)(1),[w,T]=(0,J.useState)(void 0),[E,D]=(0,J.useState)(``),[O,k]=(0,J.useState)(``),[A,j]=(0,J.useState)(En),[M,N]=(0,J.useState)(`name`),[P,F]=(0,J.useState)(`all`),[I,R]=(0,J.useState)(null),[z,B]=(0,J.useState)(null),[ee,te]=(0,J.useState)(null),[ne,re]=(0,J.useState)(null),[ie,ae]=(0,J.useState)(null),[oe,ce]=(0,J.useState)(null),[le,ue]=(0,J.useState)(!1),[H,de]=(0,J.useState)(void 0),[fe,pe]=(0,J.useState)(!1),{data:me,mutate:ge}=se(o),U=me?.payload?.config,W=(0,J.useMemo)(()=>U===void 0?null:wt(U),[U]),G=W?.servers??[],_e=h.instances.length+G.length;(0,J.useEffect)(()=>{W&&de(W.sessionIdleTtlMinutes)},[W]);let q=(0,J.useCallback)(async()=>{if(!r){g({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:null});return}g(e=>({...e,loading:!0,error:null}));try{let[e,t,n]=await Promise.all([Te(),je(),Ae()]);g(r=>({catalog:e,registryCatalog:r.registryCatalog,instances:t,registries:n,loading:!1,error:null}))}catch(e){g({catalog:[],registryCatalog:[],instances:[],registries:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[r]);(0,J.useEffect)(()=>{q()},[q]),(0,J.useEffect)(()=>{m.current||h.loading||o&&!W||(p(_e>0?`connected`:`discover`),m.current=!0)},[o,_e,W,h.loading]);let Y=(0,J.useCallback)(e=>{m.current=!0,p(e)},[]),Z=(0,J.useMemo)(()=>[{id:Dn,displayName:t.storeSourceName},...h.registries],[t.storeSourceName,h.registries]),we=(0,J.useCallback)(async e=>{if(!o||A===En){g(e=>({...e,registryCatalog:[]})),C(1),T(void 0);return}let t=O.trim(),n=e?.browse??!1,r=Math.max(e?.page??1,1),i=e?.append??!1,a=A===Tn?Z:Z.filter(e=>e.id===A);if(a.length!==0){v(!0),i?g(e=>({...e,error:null})):(C(1),T(void 0),g(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(a.map(async e=>{if(e.id===Dn){let e=await De({q:t||void 0,page:r,pageSize:24,sort:M===`source`?`newest`:`downloads`});return{connectors:e.items.map(On),totalPages:e.meta.totalPages}}return Pe(t,e.id,{browse:n,page:r})})),o=kn(e.flatMap(e=>e.connectors)),s=Math.max(1,...e.map(e=>e.totalPages??1));C(r),T(s),g(e=>({...e,registryCatalog:i?kn([...e.registryCatalog,...o]):o}))}catch(e){g(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{v(!1)}}},[M,O,A,o,Z]);(0,J.useEffect)(()=>{if(u!==`discover`||h.loading)return;if(A===En){g(e=>({...e,registryCatalog:[]})),C(1),T(void 0);return}let e=window.setTimeout(()=>{we({browse:!O.trim()})},O.trim()?350:0);return()=>window.clearTimeout(e)},[O,A,we,h.loading,u]);let Q=(0,J.useMemo)(()=>new Set(h.instances.map(e=>e.connectorId)),[h.instances]),Ee=(0,J.useMemo)(()=>new Map([...h.catalog,...h.registryCatalog].map(e=>[e.id,e])),[h.catalog,h.registryCatalog]);(0,J.useEffect)(()=>{if(h.loading)return;let e=s.get(`connector`),t=s.get(`instance`);if(!e&&!t)return;let n=h.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)m.current=!0,D(``),te(n.instanceId),re(n),p(`connected`);else if(e){let t=Ee.get(e);if(!t)return;m.current=!0,j(En),k(``),B(t),p(`discover`)}let r=new URLSearchParams(s);r.delete(`connector`),r.delete(`instance`),r.delete(`personalContext`),r.set(`tab`,n?`connected`:`discover`),l(r,{replace:!0})},[Ee,s,l,h.instances,h.loading]);let ke=(0,J.useCallback)(async e=>{b(!0),g(e=>({...e,error:null}));try{let t=await Oe(e);R(nn(t.definition,{packageName:t.packageName,version:t.version,permissions:t.permissions}))}catch(e){g(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{b(!1)}},[]),Me=(0,J.useMemo)(()=>new Set(h.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[h.instances]),Ne=(0,J.useCallback)(async e=>{if(!W||U===void 0)return;let t=G.filter(t=>t.clientKey!==e.clientKey);await Et({sessionIdleTtlMinutes:W.sessionIdleTtlMinutes,servers:t},vt(U)),await ge(),await q()},[U,G,q,W,ge]),Fe=(0,J.useCallback)(()=>{ce({mode:`add`,row:sn(G,Me)})},[G,Me]),Ie=(0,J.useCallback)(async()=>{if(!(!W||U===void 0||fe)){pe(!0);try{await Et({sessionIdleTtlMinutes:H,servers:G},vt(U)),await ge(),ue(!1)}finally{pe(!1)}}},[U,G,n.saved,W,ge,H,fe]),Le=S(e=>e.setPageHeader),Re=S(e=>e.clearPageHeader),ze=(0,J.useMemo)(()=>(0,X.jsx)(ft,{onBrowseCatalog:()=>Y(`discover`),onAddCustomServer:Fe,onOpenRuntimeSettings:()=>ue(!0),addLabel:t.addConnection,browseLabel:t.addFromCatalog,customLabel:t.addCustomServerAdvanced,settingsLabel:t.runtimeSettings}),[t,Fe,Y]);(0,J.useLayoutEffect)(()=>(Le({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:ze}),()=>Re()),[Re,t.title,ze,Le]);let Be=(0,J.useMemo)(()=>h.instances.map(e=>({instance:e,value:bn(e,Ee.get(e.connectorId))})),[Ee,h.instances]),Ve=(0,J.useMemo)(()=>new Map(Be.map(({instance:e,value:t})=>[e.instanceId,t])),[Be]),He=(0,J.useMemo)(()=>({ready:Be.filter(({value:e})=>e.state===`ready`).length,needsSetup:Be.filter(({value:e})=>e.state===`needs_setup`).length,checking:Be.filter(({value:e})=>e.state===`checking`).length}),[Be]),Ue=(0,J.useMemo)(()=>h.instances.filter(e=>Cn(e,E)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=Ve.get(e.instanceId)?.state??`checking`,i=Ve.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[E,Ve,h.instances]),We=(0,J.useMemo)(()=>G.filter(e=>wn(e,E)),[E,G]),Ge=Ue.length+We.length,Ke=(0,J.useMemo)(()=>h.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1),[h.catalog]),qe=(0,J.useMemo)(()=>{let e=A===En?Ke:A===Tn?kn([...Ke,...h.registryCatalog]):h.registryCatalog;return Sn(P===`all`?e:e.filter(e=>yn(e)===P),O,M)},[Ke,M,O,A,P,h.registryCatalog]),Je=u===`discover`&&A!==En&&!!(w&&x<w),Ye=(0,J.useMemo)(()=>h.instances.find(e=>e.instanceId===ee)??ne,[ee,ne,h.instances]),Xe=(0,J.useMemo)(()=>[{value:Tn,label:t.discoverSourceAll},{value:En,label:t.discoverSourceBuiltin},...Z.map(e=>({value:e.id,label:e.displayName}))],[t.discoverSourceAll,t.discoverSourceBuiltin,Z]),Ze=[{id:`connected`,label:t.tabConnected,count:_e},{id:`discover`,label:t.tabDiscover}];return(0,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[o?null:(0,X.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),(0,X.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,X.jsx)(ve,{items:Ze,activeTab:u,onChange:Y,ariaLabel:t.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),h.error?(0,X.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:h.error}):null,u===`connected`&&o?(0,X.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,X.jsx)(dt,{value:E,onChange:D,placeholder:t.connectedSearchPlaceholder,className:`max-w-xl`}),(0,X.jsx)(he,{className:`size-9 shrink-0 p-0`,loading:h.loading,label:t.refreshConnections,title:t.refreshConnections,onClick:q})]}),Be.length>0?(0,X.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionSummaryTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionSummaryHint}),(0,X.jsxs)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-3`,children:[(0,X.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,X.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:He.ready}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionReady})]}),(0,X.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,X.jsx)(`div`,{className:a(`text-xl font-semibold tabular-nums`,He.needsSetup>0?`text-warning`:`text-fg`),children:He.needsSetup}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionNeedsSetup})]}),(0,X.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-3`,children:[(0,X.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:He.checking}),(0,X.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:t.connectionChecking})]})]})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.connectionsTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectionsHint})]}),h.loading?(0,X.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:ye.slice(0,3).map(e=>(0,X.jsx)(Se,{},e))}):_e===0?(0,X.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connectionsEmpty}),(0,X.jsx)(V,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>Y(`discover`),children:t.addFromCatalog})]}):Ge===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.connectionsSearchEmpty}):(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[Ue.map(e=>(0,X.jsx)(Zt,{instance:e,definition:Ee.get(e.connectorId),highlighted:e.instanceId===ie,onOpenDetails:e=>{ae(null),te(e.instanceId),re(e)},onChanged:q,t},e.instanceId)),We.map(e=>(0,X.jsx)(Pt,{row:e,t:n,cs:t,onEdit:()=>ce({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>Ne(e)},e.clientKey))]}),(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.disableHint})]}):null,u===`discover`&&o?(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.discoverTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.discoverHint})]}),(0,X.jsx)(`div`,{className:`rounded-xl border border-accent/20 bg-accent-soft/60 px-4 py-3 text-sm text-accent-fg`,children:t.integrationStrategyHint}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.outcomeFilterAria,children:[`all`,...vn].map(e=>(0,X.jsx)(`button`,{type:`button`,className:a(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,P===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":P===e,onClick:()=>F(e),children:e===`all`?t.outcomeAll:t.connectorBenefitHeadings[e]},e))}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,X.jsx)(dt,{value:O,onChange:k,placeholder:t.discoverSearchPlaceholder,className:`max-w-xl`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2 sm:grid-cols-2 lg:ml-auto lg:w-[26rem]`,children:[(0,X.jsx)(L,{value:A,options:Xe,placeholder:t.discoverSourceAll,allowEmpty:!1,ariaLabel:t.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:j}),(0,X.jsx)(L,{value:M,options:[{value:`name`,label:t.sortName},{value:`source`,label:t.sortSource}],placeholder:t.sortName,allowEmpty:!1,ariaLabel:t.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>N(e)})]})]}),(h.loading||_)&&qe.length===0?(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:ye.map(e=>(0,X.jsx)(xe,{},e))}):qe.length===0?(0,X.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.discoverEmpty}):(0,X.jsxs)(`div`,{className:`relative`,children:[_?(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":t.loading,children:(0,X.jsx)(K,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:qe.map(e=>(0,X.jsx)(Ce,{connector:e,installed:Q.has(e.id)||be(e,h.instances),onInstall:e=>{if(e.source===`store`){ke(e.id);return}R(nn(e))},onOpenDetails:e.source===`store`?void 0:B,t},e.id))}),Je?(0,X.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,X.jsxs)(V,{type:`button`,variant:`secondary`,disabled:_||y,onClick:()=>void we({browse:!O.trim(),page:x+1,append:!0}),children:[_?(0,X.jsx)(K,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})]}):null]}),I?(0,X.jsx)(on,{draft:I,onChange:R,onClose:()=>R(null),t,onInstalled:async e=>{await q(),await ge(),ae(e.instanceId),Y(`connected`)}}):null,z?(0,X.jsx)(ct,{connector:z,installed:Q.has(z.id)||be(z,h.instances),onClose:()=>B(null),onInstall:e=>R(nn(e)),t}):null,Ye?(0,X.jsx)(Xt,{instance:Ye,definition:Ee.get(Ye.connectorId),onClose:()=>{te(null),re(null)},onChanged:q,t,mcp:n}):null,oe?(0,X.jsx)(_n,{open:!0,mode:oe.mode,initialRow:oe.row,existingCustomServers:G,sessionIdleTtlMinutes:H,config:U,managedServerIds:Me,t:n,cs:t,onClose:()=>ce(null),onSaved:async()=>{await ge(),await q(),Y(`connected`)}},`${oe.mode}-${oe.row.clientKey}`):null,(0,X.jsx)(ut,{open:le,sessionIdleTtlMinutes:H,saving:fe,onChange:de,onSave:Ie,onClose:()=>ue(!1),t,mcp:n})]})})}export{An as ConnectorsPage};
|
|
@@ -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"./messages-
|
|
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"./messages-t1yPaVCt.js";import{n as a}from"./locale-store-BneNAR8R.js";import{t as o,tu as s,ys as c}from"./index-CH7XN6KY.js";import{t as l}from"./desktop-pet-sprite-DqZ6fbIj.js";var u=e(t(),1),d=n();function f(e){return e?`/chat/${e.sessionKey}`:void 0}var p=r(),m=8e3,h=9e4,g=3e4,_=20*6e4,v=45*6e4,y=58;function b(e){let t={error:0,waiting:1,running:2,success:3};return e.sort((e,n)=>t[e.state]-t[n.state]||n.timestamp-e.timestamp).slice(0,3)}function x(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=h}function S(e,t){return e.state===`running`&&t-e.timestamp>=g}function C(e,t,n){return S(e,n)||t===`chatty`||x(e,n)&&t===`normal`?!0:t===`quiet`?e.priority===`high`||e.state===`waiting`||e.state===`error`:e.priority!==`low`}function w(e){return e?e.state===`error`?`error`:e.state===`success`?`success`:e.animation??o(e.phase):`idle`}function T(e,t){return e.replace(/\{\{detail\}\}/g,t)}function E(e){return e.replace(/\s+/g,` `).trim()}function D(e){let t=E(e);return t.length>y?`${t.slice(0,y-1)}…`:t}function O(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.outputLines?.length?T(n,e.outputLines[Math.floor((t-e.timestamp)/1800)%e.outputLines.length]):e.outputTail?T(n,e.outputTail):e.detail&&!e.action.includes(e.detail)?T(n,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function k(e,t){if(e.state!==`success`)return;let n=e.outputLines?.map(E).filter(Boolean).at(-1)??e.outputTail;if(n)return t.replace(/\{\{summary\}\}/g,D(n))}function A(e,t,n){if(S(e,t))return n.stale;if(x(e,t))return n.longRunning}function j(e,t){if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function M(e){let t=e.now-e.lastActivityAt;return e.bubbleEnabled&&e.feedbackLevel!==`quiet`&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&t>=_&&t<=1245e3&&e.now>=e.dismissedUntil}function N(){return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`ember`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,feedbackLevel:`normal`,sizePercent:100,collapsed:!1},pets:[],visible:!0,customPetsDir:``,petIssues:[]}}function P(){let e=i(a(e=>e.language)).desktopPet,[t,n]=(0,u.useState)(N),[r,o]=(0,u.useState)({}),[d,h]=(0,u.useState)(()=>new Set),[g,_]=(0,u.useState)(Date.now()),[y,x]=(0,u.useState)(()=>Date.now()),[S,T]=(0,u.useState)(0),E=(0,u.useRef)(null),D=(0,u.useRef)(!1),P=(0,u.useRef)(null),F=(0,u.useRef)(null),I=(0,u.useRef)(null),L=(0,u.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),R=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),z=(0,u.useMemo)(()=>b(Object.values(r).filter(e=>!e.expiresAt||e.expiresAt>g)),[r,g]),B=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?z.filter(e=>!d.has(e.sessionKey)&&C(e,t.prefs.feedbackLevel,g)):[],[z,d,g,t.prefs.bubbleEnabled,t.prefs.feedbackLevel]),V=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?z.filter(e=>d.has(e.sessionKey)&&C(e,t.prefs.feedbackLevel,g)).length:0,[z,d,g,t.prefs.bubbleEnabled,t.prefs.feedbackLevel]),H=B[0]??z[0],U=w(H),W=M({bubbleEnabled:t.prefs.bubbleEnabled,feedbackLevel:t.prefs.feedbackLevel,collapsed:t.prefs.collapsed,queuedCount:B.length,activeCount:z.length,now:g,lastActivityAt:y,dismissedUntil:S});(0,u.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;e.getState().then(n).catch(()=>{});let t=e.onStateChanged(n),r=e.onEvent(e=>o(t=>{x(Date.now());let n=t[e.sessionKey];return n&&e.sequence<=n.sequence?t:{...t,[e.sessionKey]:{...n,...e,startedAt:n?.startedAt??e.timestamp,outputLines:e.outputLines??n?.outputLines,expiresAt:e.state===`success`?Date.now()+m:void 0}}})),i=window.setInterval(()=>_(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,t(),r(),window.clearInterval(i)}},[]),(0,u.useLayoutEffect)(()=>{let e=P.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[F.current,I.current].filter(e=>e!==null).map(e=>e.getBoundingClientRect());if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom));t.setContentSize({width:Math.ceil(i-n),height:Math.ceil(a-r)})},r=new ResizeObserver(n);return r.observe(e),F.current&&r.observe(F.current),I.current&&r.observe(I.current),n(),()=>r.disconnect()},[W,B.length,t.prefs.collapsed,R]);let G=(e=H)=>{e?.state===`success`&&o(t=>{let{[e.sessionKey]:n,...r}=t;return r}),window.electronAPI?.pet?.openMainWindow(f(e))},K=async()=>{if(d.size>0&&(h(new Set),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},q=(0,u.useCallback)(e=>{e.button===0&&(E.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),J=(0,u.useCallback)(e=>{let t=E.current;!t||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)>4&&(t.moved=!0,window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Y=(0,u.useCallback)(e=>{let t=E.current;!t||t.pointerId!==e.pointerId||(E.current=null,window.electronAPI?.pet?.endDrag(),t.moved&&(D.current=!0,window.setTimeout(()=>{D.current=!1},0)))},[]),X=()=>{D.current||G()},Z=()=>{window.electronAPI?.pet?.hide()};if(!L)return null;let Q={"--desktop-pet-stage-size":`${Math.round(132*R)}px`,"--desktop-pet-menu-size":`${Math.round(28*R)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*R)}px`},$=t.prefs.collapsed?B.length:V;return(0,p.jsxs)(`div`,{ref:P,className:`desktop-pet-window`,style:Q,children:[!t.prefs.collapsed&&B.length>0?(0,p.jsx)(`div`,{ref:F,className:`desktop-pet-bubble desktop-pet-queue`,children:B.map(t=>{let n=A(t,g,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=k(t,e.tipCompleteSummary),i=j(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,p.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>G(t),children:[(0,p.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,p.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,p.jsx)(`strong`,{children:t.sessionLabel}),(0,p.jsxs)(`span`,{children:[r??n??t.action,r||n?``:O(t,g,e.tipTargetSuffix)]})]}),i?(0,p.jsx)(`span`,{className:`desktop-pet-session-cta`,children:i}):null]}),(0,p.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":`收起会话`,onClick:()=>h(e=>new Set(e).add(t.sessionKey)),children:(0,p.jsx)(c,{size:12})})]},t.sessionKey)})}):null,W?(0,p.jsx)(`div`,{ref:F,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,p.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>G(),children:[(0,p.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,p.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,p.jsx)(`strong`,{children:e.idleTipTitle}),(0,p.jsx)(`span`,{children:e.idleTipBody})]})]}),(0,p.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":`收起会话`,onClick:()=>T(Date.now()+v),children:(0,p.jsx)(c,{size:12})})]})}):null,(0,p.jsxs)(`div`,{ref:I,className:`desktop-pet-stage`,children:[(0,p.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void K(),"aria-label":e.menu,children:$>0?(0,p.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,p.jsx)(s,{className:`desktop-pet-menu-chevron size-4`})}),(0,p.jsx)(`button`,{type:`button`,className:`desktop-pet-close-button`,onClick:Z,"aria-label":e.hide,title:e.hide,children:(0,p.jsx)(c,{size:14})}),(0,p.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:X,onPointerDown:q,onPointerMove:J,onPointerUp:Y,onPointerCancel:Y,title:e.openApp,children:(0,p.jsx)(l,{pet:L,action:U,displayHeight:Math.round(112*R)})})]})]})}function F(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,p.jsx)(P,{}),e[0]=t):t=e[0],t}export{F as DesktopPetPage};
|
|
@@ -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{l as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./circle-alert-RzVebuX2.js";import{t as s}from"./messages-CQGpD-dC.js";import{n as c}from"./locale-store-Bp8joZck.js";import{Dl as l,Io as u,Ko as d,Nc as f,Wo as p,ac as m,cs as h,sc as g,xc as _,xs as v}from"./index-CxkNzw3e.js";import{t as y}from"./desktop-pet-sprite-DqZ6fbIj.js";import{n as b,t as x}from"./settings-page-layout-DaFwstQw.js";var S=n(),C=e(t(),1),w=r();function T(e){let t=(0,S.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,w.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,w.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,w.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function E(){let e=s(c(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,C.useState)(null),[S,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(null),k=typeof window<`u`?window.electronAPI?.pet:void 0,A=(0,C.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),j=(0,C.useCallback)(async()=>{if(k){E(!0);try{r(await k.getState())}finally{E(!1)}}},[k]);if((0,C.useEffect)(()=>{if(k)return j(),k.onStateChanged(r)},[k,j]),!u()||!k)return null;if(!n)return(0,w.jsxs)(x,{gap:`gap-4`,children:[(0,w.jsx)(b,{title:e.title,subtitle:e.subtitle}),(0,w.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:e.loading})]});let M=async e=>{E(!0);try{r(await k.setPrefs(e))}finally{E(!1)}},N=async e=>{e?(await k.show(),r(await k.getState())):r(await k.setPrefs({enabled:!1}))},P=e=>{M({selectedPetId:e})},F=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},I=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},L=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=F(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},R=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),z=()=>{I(e.createChatDraft)},B=t=>{I(R(e.optimizeChatDraft,{id:t.id,name:F(t).name,description:F(t).description,sourcePrompt:L(t)}))},V=t=>{I(R(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},H=D??n.prefs.sizePercent,U=async(e=H)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));O(null),t!==n.prefs.sizePercent&&await M({sizePercent:t})};return(0,w.jsxs)(x,{gap:`gap-4`,children:[(0,w.jsx)(b,{title:e.title,subtitle:e.subtitle,actions:(0,w.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,h.press),disabled:S,onClick:()=>void j(),children:[(0,w.jsx)(g,{className:a(`size-3.5`,S&&`animate-spin`),strokeWidth:1.75}),e.refresh]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,h.press),onClick:()=>void k.openCustomPetsDir(),children:[(0,w.jsx)(l,{className:`size-3.5`,strokeWidth:1.75}),e.openFolder]})]})}),(0,w.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 shadow-surface`,children:[(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(T,{title:e.enable,desc:e.enableDesc,checked:n.prefs.enabled,disabled:S,onChange:e=>void N(e)}),(0,w.jsx)(T,{title:e.showOnStartup,desc:e.showOnStartupDesc,checked:n.prefs.showOnStartup,disabled:S,onChange:e=>void M({showOnStartup:e})})]}),(0,w.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,w.jsx)(v,{className:`mt-0.5 size-4 text-accent-fg`,strokeWidth:1.8}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.createTitle}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.createDesc})]})]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 text-xs font-semibold text-white hover:bg-accent/90`,h.press),onClick:z,children:[(0,w.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.createInChat]})]})}),(0,w.jsxs)(`div`,{className:`mt-5`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.petList}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.petListDesc})]}),A?(0,w.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:F(A).name}):null]}),(0,w.jsxs)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-base`,children:[n.pets.map(t=>{let r=t.id===n.prefs.selectedPetId,i=F(t);return(0,w.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-3`,children:[(0,w.jsx)(y,{pet:t,action:`idle`,size:`tiny`}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:i.name}),t.builtin?null:(0,w.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.customBadge})]}),(0,w.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:i.description})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t.builtin?null:(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,h.press),onClick:()=>B(t),children:[(0,w.jsx)(_,{className:`size-3.5`,strokeWidth:1.75}),e.optimizeInChat]}),(0,w.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,r?`bg-surface-hover text-fg-muted`:`bg-surface-panel text-fg hover:bg-surface-hover`,h.press),disabled:r||S,onClick:()=>P(t.id),children:r?e.selected:e.select})]})]},t.id)}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:e.customPets}),(0,w.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,w.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>void k.openCustomPetsDir(),children:[e.openFolder,(0,w.jsx)(l,{className:`size-3.5`,strokeWidth:1.75})]})]})]}),n.petIssues.length>0?(0,w.jsxs)(`div`,{className:`mt-2 rounded-xl border border-danger/30 bg-danger/5 p-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-danger`,children:[(0,w.jsx)(o,{className:`size-3.5`,strokeWidth:1.8}),e.invalidPets]}),(0,w.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.petIssues.map(t=>(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base/70 p-2 text-xs text-fg-muted sm:flex-row sm:items-start sm:justify-between`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`p`,{className:`truncate font-mono text-[11px] text-fg`,children:t.dir}),(0,w.jsx)(`p`,{children:t.reason}),t.details?.length?(0,w.jsx)(`p`,{className:`line-clamp-2`,children:t.details.join(`; `)}):null]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-danger/30 bg-surface-base px-2.5 text-xs font-medium text-danger hover:bg-danger/10`,h.press),onClick:()=>V(t),children:[(0,w.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null]}),(0,w.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,w.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/50 px-3 py-3 dark:bg-surface-hover/35`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.size}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.sizeDesc})]}),(0,w.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[H,`%`]})]}),(0,w.jsx)(`input`,{type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:H,onChange:e=>O(Number(e.target.value)),onBlur:()=>void U(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&U()},onPointerUp:()=>void U()})]}),(0,w.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,w.jsx)(T,{title:e.alwaysOnTop,desc:e.alwaysOnTopDesc,checked:n.prefs.alwaysOnTop,disabled:S,onChange:e=>void M({alwaysOnTop:e})}),(0,w.jsx)(T,{title:e.bubbles,desc:e.bubblesDesc,checked:n.prefs.bubbleEnabled,disabled:S,onChange:e=>void M({bubbleEnabled:e})})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-hover/50 px-3 py-3 dark:bg-surface-hover/35 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.feedbackLevel}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.feedbackLevelDesc})]}),(0,w.jsxs)(p,{className:`w-full sm:w-40`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.feedbackLevel,onChange:e=>void M({feedbackLevel:e.target.value}),children:[(0,w.jsx)(d,{value:`quiet`,children:e.feedbackQuiet}),(0,w.jsx)(d,{value:`normal`,children:e.feedbackNormal}),(0,w.jsx)(d,{value:`chatty`,children:e.feedbackChatty})]})]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,h.press),disabled:S,onClick:()=>void k.resetPosition().then(r),children:[(0,w.jsx)(m,{className:`size-3.5`,strokeWidth:1.75}),e.resetPosition]})]})]})]})}export{E as DesktopPetSettings};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i}from"./chunk-QUQL4437-DXsxWP7r.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./circle-alert-RzVebuX2.js";import{t as s}from"./messages-t1yPaVCt.js";import{n as c}from"./locale-store-BneNAR8R.js";import{Go as l,Lo as u,Ol as d,Pc as f,Sc as p,Ss as m,cc as h,ls as g,oc as _,qo as v}from"./index-CH7XN6KY.js";import{t as y}from"./desktop-pet-sprite-DqZ6fbIj.js";import{n as b,t as x}from"./settings-page-layout-HdlQOOqp.js";var S=n(),C=e(t(),1),w=r();function T(e){let t=(0,S.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,w.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,w.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,w.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function E(){let e=s(c(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,C.useState)(null),[S,E]=(0,C.useState)(!1),[D,O]=(0,C.useState)(null),k=typeof window<`u`?window.electronAPI?.pet:void 0,A=(0,C.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),j=(0,C.useCallback)(async()=>{if(k){E(!0);try{r(await k.getState())}finally{E(!1)}}},[k]);if((0,C.useEffect)(()=>{if(k)return j(),k.onStateChanged(r)},[k,j]),!u()||!k)return null;if(!n)return(0,w.jsxs)(x,{gap:`gap-4`,children:[(0,w.jsx)(b,{title:e.title,subtitle:e.subtitle}),(0,w.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:e.loading})]});let M=async e=>{E(!0);try{r(await k.setPrefs(e))}finally{E(!1)}},N=async e=>{e?(await k.show(),r(await k.getState())):r(await k.setPrefs({enabled:!1}))},P=e=>{M({selectedPetId:e})},F=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},I=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},L=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=F(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},R=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),z=()=>{I(e.createChatDraft)},B=t=>{I(R(e.optimizeChatDraft,{id:t.id,name:F(t).name,description:F(t).description,sourcePrompt:L(t)}))},V=t=>{I(R(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},H=D??n.prefs.sizePercent,U=async(e=H)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));O(null),t!==n.prefs.sizePercent&&await M({sizePercent:t})};return(0,w.jsxs)(x,{gap:`gap-4`,children:[(0,w.jsx)(b,{title:e.title,subtitle:e.subtitle,actions:(0,w.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,g.press),disabled:S,onClick:()=>void j(),children:[(0,w.jsx)(h,{className:a(`size-3.5`,S&&`animate-spin`),strokeWidth:1.75}),e.refresh]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,g.press),onClick:()=>void k.openCustomPetsDir(),children:[(0,w.jsx)(d,{className:`size-3.5`,strokeWidth:1.75}),e.openFolder]})]})}),(0,w.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 shadow-surface`,children:[(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(T,{title:e.enable,desc:e.enableDesc,checked:n.prefs.enabled,disabled:S,onChange:e=>void N(e)}),(0,w.jsx)(T,{title:e.showOnStartup,desc:e.showOnStartupDesc,checked:n.prefs.showOnStartup,disabled:S,onChange:e=>void M({showOnStartup:e})})]}),(0,w.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,w.jsx)(m,{className:`mt-0.5 size-4 text-accent-fg`,strokeWidth:1.8}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.createTitle}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.createDesc})]})]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 text-xs font-semibold text-white hover:bg-accent/90`,g.press),onClick:z,children:[(0,w.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.createInChat]})]})}),(0,w.jsxs)(`div`,{className:`mt-5`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.petList}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.petListDesc})]}),A?(0,w.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:F(A).name}):null]}),(0,w.jsxs)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-base`,children:[n.pets.map(t=>{let r=t.id===n.prefs.selectedPetId,i=F(t);return(0,w.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-3`,children:[(0,w.jsx)(y,{pet:t,action:`idle`,size:`tiny`}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:i.name}),t.builtin?null:(0,w.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.customBadge})]}),(0,w.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:i.description})]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t.builtin?null:(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,g.press),onClick:()=>B(t),children:[(0,w.jsx)(p,{className:`size-3.5`,strokeWidth:1.75}),e.optimizeInChat]}),(0,w.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,r?`bg-surface-hover text-fg-muted`:`bg-surface-panel text-fg hover:bg-surface-hover`,g.press),disabled:r||S,onClick:()=>P(t.id),children:r?e.selected:e.select})]})]},t.id)}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-1 px-3 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:e.customPets}),(0,w.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,w.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>void k.openCustomPetsDir(),children:[e.openFolder,(0,w.jsx)(d,{className:`size-3.5`,strokeWidth:1.75})]})]})]}),n.petIssues.length>0?(0,w.jsxs)(`div`,{className:`mt-2 rounded-xl border border-danger/30 bg-danger/5 p-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-danger`,children:[(0,w.jsx)(o,{className:`size-3.5`,strokeWidth:1.8}),e.invalidPets]}),(0,w.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.petIssues.map(t=>(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base/70 p-2 text-xs text-fg-muted sm:flex-row sm:items-start sm:justify-between`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`p`,{className:`truncate font-mono text-[11px] text-fg`,children:t.dir}),(0,w.jsx)(`p`,{children:t.reason}),t.details?.length?(0,w.jsx)(`p`,{className:`line-clamp-2`,children:t.details.join(`; `)}):null]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-danger/30 bg-surface-base px-2.5 text-xs font-medium text-danger hover:bg-danger/10`,g.press),onClick:()=>V(t),children:[(0,w.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null]}),(0,w.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,w.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/50 px-3 py-3 dark:bg-surface-hover/35`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.size}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.sizeDesc})]}),(0,w.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[H,`%`]})]}),(0,w.jsx)(`input`,{type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:H,onChange:e=>O(Number(e.target.value)),onBlur:()=>void U(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&U()},onPointerUp:()=>void U()})]}),(0,w.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,w.jsx)(T,{title:e.alwaysOnTop,desc:e.alwaysOnTopDesc,checked:n.prefs.alwaysOnTop,disabled:S,onChange:e=>void M({alwaysOnTop:e})}),(0,w.jsx)(T,{title:e.bubbles,desc:e.bubblesDesc,checked:n.prefs.bubbleEnabled,disabled:S,onChange:e=>void M({bubbleEnabled:e})})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-hover/50 px-3 py-3 dark:bg-surface-hover/35 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.feedbackLevel}),(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.feedbackLevelDesc})]}),(0,w.jsxs)(l,{className:`w-full sm:w-40`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.feedbackLevel,onChange:e=>void M({feedbackLevel:e.target.value}),children:[(0,w.jsx)(v,{value:`quiet`,children:e.feedbackQuiet}),(0,w.jsx)(v,{value:`normal`,children:e.feedbackNormal}),(0,w.jsx)(v,{value:`chatty`,children:e.feedbackChatty})]})]}),(0,w.jsxs)(`button`,{type:`button`,className:a(`inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,g.press),disabled:S,onClick:()=>void k.resetPosition().then(r),children:[(0,w.jsx)(_,{className:`size-3.5`,strokeWidth:1.75}),e.resetPosition]})]})]})]})}export{E as DesktopPetSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{At as r,Et as i,jt as a}from"./index-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{At as r,Et as i,jt as a}from"./index-CH7XN6KY.js";var o=e(),s=t();function c(e){let t=(0,o.c)(38),{value:c,onChange:l,disabled:u,wd:d,placeholder:f,inputClassName:p,autoFocus:m,trailing:h}=e,g;t[0]!==l||t[1]!==c?(g={initialPath:c,onPicked:l},t[0]=l,t[1]=c,t[2]=g):g=t[2];let _=r(g),v;t[3]===c?v=t[4]:(v=c.trim(),t[3]=c,t[4]=v);let y=v,b=y?`${y}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,x;t[5]===p?x=t[6]:(x=n(`min-w-0 flex-1`,p),t[5]=p,t[6]=x);let S=u||_.picking,C;t[7]===l?C=t[8]:(C=e=>void l(e.target.value),t[7]=l,t[8]=C);let w=f??d.pathInputPlaceholder,T;t[9]!==m||t[10]!==x||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==c?(T=(0,s.jsx)(`input`,{type:`text`,className:x,value:c,disabled:S,onChange:C,placeholder:w,autoFocus:m,autoComplete:`off`,spellCheck:!1}),t[9]=m,t[10]=x,t[11]=S,t[12]=C,t[13]=w,t[14]=c,t[15]=T):T=t[15];let E=u||_.picking,D;t[16]!==b||t[17]!==_.pick||t[18]!==E||t[19]!==c||t[20]!==d.selectWorkingDirectory?(D=(0,s.jsx)(a,{compact:!0,value:c,onPick:_.pick,disabled:E,title:b,"aria-label":d.selectWorkingDirectory}),t[16]=b,t[17]=_.pick,t[18]=E,t[19]=c,t[20]=d.selectWorkingDirectory,t[21]=D):D=t[21];let O;t[22]!==D||t[23]!==h?(O=(0,s.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[D,h]}),t[22]=D,t[23]=h,t[24]=O):O=t[24];let k;t[25]!==O||t[26]!==T?(k=(0,s.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[T,O]}),t[25]=O,t[26]=T,t[27]=k):k=t[27];let A;t[28]!==_.confirmPick||t[29]!==_.hasNativePicker||t[30]!==_.modalOpen||t[31]!==_.setModalOpen||t[32]!==y||t[33]!==d?(A=_.hasNativePicker?null:(0,s.jsx)(i,{open:_.modalOpen,onOpenChange:_.setModalOpen,initialAbsolutePath:y||void 0,onConfirm:_.confirmPick,wd:d}),t[28]=_.confirmPick,t[29]=_.hasNativePicker,t[30]=_.modalOpen,t[31]=_.setModalOpen,t[32]=y,t[33]=d,t[34]=A):A=t[34];let j;return t[35]!==k||t[36]!==A?(j=(0,s.jsxs)(s.Fragment,{children:[k,A]}),t[35]=k,t[36]=A,t[37]=j):j=t[37],j}export{c as t};
|