@xopcai/xopc 0.0.205 → 0.0.206
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-DJBadfSX.js → activity-store-URW-e_me.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Br6C32BX.js → agent-avatar-dicebear-BLK6kRCJ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-D5HVmdNx.js +68 -0
- package/dist/gateway/static/root/assets/{api-B5O7fKXa.js → api-C_MS4arC.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Le1vJ1OO.js → app-management-settings-panel-CnUN6BJk.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CZlAU60t.js → appearance-settings-C8Nx8hZE.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DKCA_LFY.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CRzXRXPE.js → archive-plugin-C7FqeJZD.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CYAAQ6Qi.js → attachment-load-DCYQgsYE.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BEOE4ZKM.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CVR5cUmS.js → binary-plugins-Bf1WROsh.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CFe74rWi.js → block-editor-BPK08Pjv.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-CLRmMdU9.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-Bd68yluo.js → browser-workflow-inputs-cqVoDHyp.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B0uiDLga.js → browser-workflows-page-Des1UTsS.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BNcVi4ar.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BerPMp6f.js → capability-presets-api-D4MjqV2a.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DJjVOCJY.js → capability-presets-settings-panel-uFwW2ah5.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-D2d21_XA.js → channel-recipient-api-CcimZduy.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DSLP8OjS.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-D0OR6Ylw.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-B1njb2Cr.css +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-wpi7abPg.js +38 -0
- package/dist/gateway/static/root/assets/{connectors-api-Bq_vUzxP.js → connectors-api-CUvFu8jh.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BJoHjWnu.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DZBxmKGR.js → cron-expression-hFSZZpvM.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BNHd7HT7.js → date-picker-CKZ0gc-Y.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D1kJBknt.js → dependency-picker-zv1oHtg4.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Di75oHkC.js → desktop-pet-DY9ykMtD.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-D6tD1uym.js → desktop-pet-settings-XiSmmt26.js} +1 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-CZkgk15r.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D91_S7NQ.js → extension-debug-page-CTppsTEi.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DHzmmr_N.js → extension-page-CHRTUvAa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BpJNtePi.js → extension-settings-page-z2UBx25A.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BAzLYTKZ.js → gateway-config-api-DzFPJTnm.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-VVcfd3sG.js → gateway-config-swr-CGpoH1gU.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-C5-aKkTp.js → gateway-settings-DBa2I6VM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-qAX_T2t2.js → gateway-startup-retry-Te-TREBt.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DyQGGdBu.js +1 -0
- package/dist/gateway/static/root/assets/home-page-EkT4eGeP.js +3 -0
- package/dist/gateway/static/root/assets/index-BpLqHdfz.css +2 -0
- package/dist/gateway/static/root/assets/index-CrwXzRpA.js +85 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-fpNjXnJK.js → keyboard-shortcuts-settings-fb0zS8pk.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CCC3Cvb8.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DBpQIfNd.js → local-apps-page-DFdheruU.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CbPVxonP.js → locale-store-CieddUjx.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BmXcJCKz.js → logs-page-B6jfkNDF.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-CiK7Xkvi.js → management-settings-D3PsQ612.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-DVgpcOze.js → markdown-split-x5K52Thz.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Dl-0_9JR.js → markdown-view-Cjjey5Y6.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DMj1lW-n.js → media-plugins-DNtEkRAh.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CySMn8WL.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-DvX1sTlf.js → notes-page-nWEqlwDw.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-QstkgWsW.js +4 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DvsLigha.js → preview-open-alternatives-CXcIKVi9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DbCraAI3.js → product-open-page-CZLJudPk.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cf1v94LO.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BRMZkNht.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-D55FTXZw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DzuUglQo.js → runtime-tools-settings-panel-RYjduQV6.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-plDnazVj.js → schema-form--1ZXg4qC.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C5Yy6eIn.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BqO_8bUh.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BwAxX_7e.js → settings-form-section-71-8j3zt.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-B3OiTnF9.js → settings-loading-skeleton-C5Jn1l0q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DvIWXBvp.js → settings-page-TYYGe6kZ.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DThKKjLV.js → setup-status-panel-jA5I-17g.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CFnoGHJb.js → share-preview-page-BMUQIGfk.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dru1a2rZ.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C8iqS6kF.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-B38fY22S.js → skills-page-BzZT1SKg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-vLIlk1c3.js → skills-page.utils-DnaBw5Ji.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DRV2wljT.js → system-settings-panel-DqiPQgVI.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DQP5vDr-.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Bc_eRUev.js → theme-store-BP3_RpaY.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DTu23D9J.js → use-autosave-BJkQ-vpu.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-DCwqzN03.js → user-context-page-BP8-sOPi.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CVDMesWc.js → voice-api-key-field-C6c8e7Mx.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-cyt93k0V.js → work-discovery-overlay-CCNjWKql.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DL_Ie0s2.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DrdcfX_N.js → workflow-run-setup-panel-DLO-dMSN.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B4-k2FHB.js +5 -0
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-CYWdZUJ5.js → working-directory-picker-modal-vWi33CZJ.js} +1 -1
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +11 -0
- package/dist/src/agent/agent-manager.js +36 -6
- package/dist/src/agent/service.d.ts +4 -1
- package/dist/src/agent/service.js +12 -0
- package/dist/src/agent/tools/xopc-use-tool.js +6 -2
- package/dist/src/automations/api/routes.js +8 -0
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +17 -12
- package/dist/src/automations/domain/validation.d.ts +30 -32
- package/dist/src/automations/domain/validation.js +8 -10
- package/dist/src/automations/draft/automation-draft-prompt.js +9 -5
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -8
- package/dist/src/automations/draft/automation-draft-validator.js +3 -3
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.js +13 -4
- package/dist/src/automations/service/automation-service.d.ts +5 -1
- package/dist/src/automations/service/automation-service.js +19 -12
- package/dist/src/automations/storage/automation-repository.js +8 -4
- package/dist/src/automations/storage/automation-run-repository.d.ts +5 -0
- package/dist/src/automations/storage/automation-run-repository.js +24 -8
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/gateway/automation-agent-session.d.ts +4 -0
- package/dist/src/gateway/automation-agent-session.js +40 -0
- package/dist/src/gateway/dreaming-automation-reconciler.js +3 -2
- package/dist/src/gateway/hono/routes/commands-skills.js +36 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -0
- package/dist/src/gateway/service/marketplace-service.d.ts +4 -1
- package/dist/src/gateway/service/marketplace-service.js +9 -0
- package/dist/src/gateway/service.js +19 -2
- package/dist/src/mobile/notification-service.js +7 -4
- package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +24 -0
- package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +18 -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.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/package.json +3 -2
- package/dist/gateway/static/root/assets/agents-DnFIy8Ye.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CONlVc-f.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DuG69tIj.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cvt-8fqE.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-yk3QkGBP.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-CaNnYUQo.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CZ5P9jbB.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DTpCnOsQ.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-Ly0TUflq.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CMZr1_Op.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CBG9Bk-1.js +0 -3
- package/dist/gateway/static/root/assets/index-BBw9QL0p.js +0 -85
- package/dist/gateway/static/root/assets/index-Dm-cvIpl.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bi_0Sknt.js +0 -2
- package/dist/gateway/static/root/assets/messages-9zCa8KkW.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CMyosgjY.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DkS-kbpj.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B3NxP6S4.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DwhrMhjl.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BOfXXmBL.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-sPrZfZVR.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Dvl13Udt.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-D9elkZOz.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Xd8PlB24.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page--DTi90d5.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DXyButkm.js +0 -5
|
@@ -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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./external-link-DjqjBmc3.js";import{t as c}from"./markdown-view-Cjjey5Y6.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{t as p}from"./button-CSEbl4zT.js";import{t as m}from"./messages-CySMn8WL.js";import{l as h,n as g,o as _,r as v,s as y}from"./locale-store-CieddUjx.js";import{a as b,i as x,o as S,r as C,s as w,t as T}from"./dist-BPoKqzeH.js";import{a as E,i as D}from"./vendor-swr-BIWyz7Rc.js";import{r as O}from"./settings-form-draft-Dy10ldo8.js";import{Aa as k,As as A,Cs as j,Es as M,Fa as N,Hl as ee,Ia as P,La as F,Ma as I,Pa as L,Ta as R,Va as z,Zs as B,as as te,is as ne,jl as V,xl as H}from"./index-CrwXzRpA.js";import{t as U}from"./page-tabs-BaEQMYm_.js";var W=e(t(),1),G=n();function K(e){return e===`builtin`||e===`user`?e:`marketplace`}async function q(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function re(e){let t=await _(v(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await _(v(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function Y(e){let t=await _(v(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function X(e){let t=await _(v(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Z=r();function ie(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Q={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function $({className:e}){let t=m(g(e=>e.language)).extensionsPage,n=h(e=>!!e.token),r=L(),{mutate:i}=E(),[a,o]=(0,W.useReducer)(O,Q),{q:s,debounced:c,detailPkg:u,rowBusy:d,actionError:p,restartHint:_}=a,b=n?`marketplace-${c}`:null;(0,W.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:x,isLoading:S,error:C}=D(b,async()=>y(c.length>0?v(`/api/marketplace?q=${encodeURIComponent(c)}`):v(`/api/marketplace`)),{revalidateOnFocus:!1}),w=(0,W.useCallback)(()=>{i(`gateway-extensions-list`),R()},[i]),T=(0,W.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await J({name:e,overwrite:n});w(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,w]),j=(0,W.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await X(e);w(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,w]),M=x?.extensions??[];return(0,Z.jsxs)(`div`,{className:f(`flex flex-col gap-4`,e),children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(A,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:s,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),C?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C instanceof Error?C.message:t.marketplaceLoadFailed}):null,p?(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:p}):null,_?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_}):null,S&&!x?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Z.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Z.jsx)(k,{className:`h-5 w-40`}),(0,Z.jsx)(k,{className:`h-4 w-full max-w-xl`}),(0,Z.jsx)(k,{className:`h-4 w-2/3 max-w-md`})]}),(0,Z.jsx)(k,{className:`h-8 w-20`})]})},e))}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:M.length===0?(0,Z.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):M.map(e=>{let n=ie(r,e.id),i=d===e.id;return(0,Z.jsx)(`li`,{className:`list-none`,children:(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:f(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Z.jsx)(H,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Z.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Z.jsx)(B,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Z.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Z.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&j(e.id).catch(()=>{})},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(te,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:f(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),u?(0,Z.jsx)(ae,{packageName:u,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:T,onUninstall:j}):null]})}function ae(e){let t=(0,G.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:u}=e,[p,m]=(0,W.useState)(!1),[g,_]=(0,W.useState)(!1),v=h(ue)?`ext-mp-detail-${n}`:null,y;t[0]===n?y=t[1]:(y=async()=>re(n),t[0]=n,t[1]=y);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1},t[2]=x):x=t[2];let{data:E,error:O,isLoading:A}=D(v,y,x),M;t[3]!==i||t[4]!==n?(M=ie(i,n),t[3]=i,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,F=E?.manifest?.permissions,I,L,R,z,B,V,H,U,K,q,J;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==E||t[29]!==O||t[30]!==N||t[31]!==A||t[32]!==o||t[33]!==F||t[34]!==g){let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==E?(n=E?.readme?.trim()||(E?.description?.trim()?`### ${E.name}\n\n${E.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=E,t[48]=n):n=t[48];let i=n;R=T,z=!0,t[49]===o?B=t[50]:(B=e=>!e&&o(),t[49]=o,t[50]=B),L=S,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=J):J=t[51],I=C,U=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,K=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ee,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let l;t[56]===r.marketplaceDetailTitle?l=t[57]:(l=(0,Z.jsx)(w,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=l);let u;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(d,{className:`size-5`}),t[58]=u):u=t[58];let f;t[59]!==r.detailClose||t[60]!==o?(f=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:u}),t[59]=r.detailClose,t[60]=o,t[61]=f):f=t[61],t[62]!==s||t[63]!==l||t[64]!==f?(q=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,l,f]}),t[62]=s,t[63]=l,t[64]=f,t[65]=q):q=t[65],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=A&&!E?(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Z.jsx)(k,{className:`h-6 w-48`}),(0,Z.jsx)(k,{className:`h-4 w-28`}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)(k,{className:`h-12`}),(0,Z.jsx)(k,{className:`h-12`})]}),(0,Z.jsx)(k,{className:`h-28 w-full`}),(0,Z.jsx)(k,{className:`h-36 w-full`})]}):O?(0,Z.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:O instanceof Error?O.message:r.marketplaceLoadFailed})]}):E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:E.name}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:E.id})}),(0,Z.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Z.jsx)(`dd`,{children:E.author.username})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Z.jsx)(`dd`,{children:E.latestVersion.version})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Z.jsx)(`dd`,{children:E.downloads})]})]}),N===`bundled`?null:(0,Z.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[E.installability.available?(0,Z.jsx)(j,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Z.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:E.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:E.installability.available?r.marketplaceCodeRisk:E.installability.reason??r.marketplaceUnavailableBody})]})]}),E.installability.available?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Z.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Z.jsx)(`dd`,{children:E.packageSummary?.dependencyCount??0})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,Z.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(E.packageSummary?.lifecycleScripts.length??0)>0?(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,E.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Z.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),E.readme?.trim()?(0,Z.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Z.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Z.jsx)(c,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=E,t[29]=O,t[30]=N,t[31]=A,t[32]=o,t[33]=F,t[34]=g,t[35]=I,t[36]=L,t[37]=R,t[38]=z,t[39]=B,t[40]=V,t[41]=H,t[42]=U,t[43]=K,t[44]=q,t[45]=J}else I=t[35],L=t[36],R=t[37],z=t[38],B=t[39],V=t[40],H=t[41],U=t[42],K=t[43],q=t[44],J=t[45];let Y;t[66]!==V||t[67]!==H?(Y=(0,Z.jsx)(`div`,{className:V,children:H}),t[66]=V,t[67]=H,t[68]=Y):Y=t[68];let X;t[69]!==p||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==E||t[78]!==N||t[79]!==o||t[80]!==s||t[81]!==u||t[82]!==n||t[83]!==g||t[84]!==P?(X=E?(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Z.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:p||!E.installability.available||!g,onClick:()=>{P&&!window.confirm(r.marketplaceReinstallConfirm)||(m(!0),s(n,P).catch(se).finally(()=>m(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[p?(0,Z.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?r.marketplaceReinstall:r.marketplaceInstall]}),P?(0,Z.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(m(!0),u(n).then(()=>o()).catch(oe).finally(()=>m(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Z.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=p,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=E,t[78]=N,t[79]=o,t[80]=s,t[81]=u,t[82]=n,t[83]=g,t[84]=P,t[85]=X):X=t[85];let Q;t[86]!==I||t[87]!==Y||t[88]!==X||t[89]!==U||t[90]!==K||t[91]!==q?(Q=(0,Z.jsxs)(I,{className:U,onOpenAutoFocus:K,children:[q,Y,X]}),t[86]=I,t[87]=Y,t[88]=X,t[89]=U,t[90]=K,t[91]=q,t[92]=Q):Q=t[92];let $;t[93]!==L||t[94]!==Q||t[95]!==J?($=(0,Z.jsxs)(L,{children:[J,Q]}),t[93]=L,t[94]=Q,t[95]=J,t[96]=$):$=t[96];let ae;return t[97]!==R||t[98]!==z||t[99]!==B||t[100]!==$?(ae=(0,Z.jsx)(R,{defaultOpen:z,onOpenChange:B,children:$}),t[97]=R,t[98]=z,t[99]=B,t[100]=$,t[101]=ae):ae=t[101],ae}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,Z.jsxs)(`li`,{className:`break-words`,children:[(0,Z.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=g(e=>e.language),t=m(e),n=z(e=>e.setPageHeader),r=z(e=>e.clearPageHeader),o=L(),s=N(),[c,l]=i(),d=K(c.get(`tab`)),f=c.get(`q`)??``,[h,_]=(0,W.useState)(d),[v,y]=(0,W.useState)(f),[b,x]=(0,W.useState)(null),S=c.toString(),C=(0,W.useRef)(S);if(C.current!==S){C.current=S;let e=K(c.get(`tab`)),t=c.get(`q`)??``;_(t=>t===e?t:e),y(e=>e===t?e:t)}(0,W.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=v.trim();return n?t.set(`q`,n):t.delete(`q`),h===`marketplace`?t.delete(`tab`):t.set(`tab`,h),t.toString()===e.toString()?e:t},{replace:!0})},[h,v,l]);let w=(0,W.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),T=(0,W.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),E=h===`builtin`?w:T,D=(0,W.useMemo)(()=>{let t=v.trim().toLowerCase(),n=E;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[E,v,e]);if((0,W.useEffect)(()=>{x(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,W.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(p,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Z.jsx)(V,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Z.jsx)(p,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps/new`,children:[(0,Z.jsx)(u,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&h!==`marketplace`)return(0,Z.jsx)(ye,{});let O=h!==`marketplace`&&E.length>0;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(U,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:w.length},{id:`user`,label:t.extensionsPage.tabUser,count:T.length}],activeTab:h,onChange:_,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,Z.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Z.jsx)(A,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:v,onChange:e=>y(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),h===`marketplace`?(0,Z.jsx)($,{}):h===`builtin`&&w.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):h===`user`&&T.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyUser}):D.length===0?(0,Z.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:D.map(e=>(0,Z.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:h===`user`,onOpen:()=>x(e)},e.id))})]}),b?(0,Z.jsx)(_e,{extension:b,copy:t.extensionsPage,onClose:()=>x(null)},b.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,G.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=fe(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let p=n.name||n.id,m;t[3]===p?m=t[4]:(m=p.charAt(0).toUpperCase(),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,Z.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,Z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Z.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Z.jsx)(u,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,Z.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,Z.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:d,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=E(),[i,o]=(0,W.useState)(!1),[c,u]=(0,W.useState)(null),[m,h]=(0,W.useState)(!1),g=e.activationEligible===!0,_=(0,W.useCallback)(async()=>{if(e.source===`bundled`){u(null),h(!1),o(!0);try{let{requiresGatewayRestart:t}=await Y({extensionId:e.id,enabled:!g});await r(`gateway-extensions-list`),R(),h(t)}catch(e){u(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[g,t.builtinToggleFailed,e.id,e.source,r]),v=e.ui?.contributions?.pages??[],y=e.ui?.contributions?.settingsPanels??[],D=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],k=v.find(e=>e.showInNav)??v[0],A=y[0],j=k?I(e.id,k):null,N=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||P(e)?`/settings/ext/${e.id}`:null;return(0,Z.jsx)(T,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Z.jsxs)(S,{children:[(0,Z.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Z.jsxs)(C,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Z.jsx)(ee,{className:`size-5`})}),(0,Z.jsx)(w,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Z.jsxs)(x,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Z.jsx)(d,{className:`size-5`})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Z.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Z.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Z.jsx)(p,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void _(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):g?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,m?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(v.length>0||y.length>0||D.length>0)?(0,Z.jsxs)(`section`,{className:`mt-8`,children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsx)(ve,{template:t.badgePages,count:v.length,hidden:v.length===0}),(0,Z.jsx)(ve,{template:t.badgeSettings,count:y.length,hidden:y.length===0}),(0,Z.jsx)(ve,{template:t.badgeWidgets,count:D.length,hidden:D.length===0}),(0,Z.jsx)(ve,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,F(e)&&(j||N)?(0,Z.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[j?(0,Z.jsxs)(a,{to:j,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(s,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,N?(0,Z.jsxs)(a,{to:N,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(M,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Z.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,G.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Z.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,G.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Z.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Z.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Z.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,Z.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,G.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-CRzXRXPE.js → archive-plugin-C7FqeJZD.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"./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-CySMn8WL.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-CXcIKVi9.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
|
package/dist/gateway/static/root/assets/{attachment-load-CYAAQ6Qi.js → attachment-load-DCYQgsYE.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-B2_kr5EA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-zJ_50EbN.js";import{Oa as t}from"./index-
|
|
2
|
+
import{t as e}from"./preload-helper-zJ_50EbN.js";import{Oa as t}from"./index-CrwXzRpA.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./markdown-view-Cjjey5Y6.js";import{t as l}from"./plus-Q2yW6OE7.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{t as p}from"./messages-CySMn8WL.js";import{n as m}from"./locale-store-CieddUjx.js";import{a as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{Aa as S,As as C,Cl as w,Cr as ee,Cs as te,Dl as ne,Dr as re,Go as T,Hs as E,Js as D,Ki as O,Ks as k,Lc as A,Ps as j,Qc as M,Sl as N,Sr as ie,Tl as ae,Tr as P,Va as F,Vn as oe,as as I,bl as se,ka as ce,ma as L,ql as R,sc as le,u as z,uc as B,v as V,vs as ue,wr as de}from"./index-CrwXzRpA.js";import{a as H,i as U,o as W,r as G}from"./cron-expression-hFSZZpvM.js";import{a as K,i as fe,n as pe,r as q,t as me}from"./workflow-run-setup-panel-DLO-dMSN.js";import{i as he,n as ge,r as _e,t as ve}from"./browser-workflow-inputs-cqVoDHyp.js";var J=e(t(),1),ye=n(),be=H();function xe(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function Se(e,t){let n=e===7?0:e;return new Date(Date.UTC(2023,0,1)+n*864e5).toLocaleDateString(t,{weekday:`short`,timeZone:`UTC`})}function Ce(e,t){return e.length<=1?e[0]??``:t.startsWith(`zh`)?e.join(`、`):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function Y(e){return e.length===5&&e.every((e,t)=>e===t+1)}function we(e){if(e.length!==2)return!1;let t=[...e].toSorted((e,t)=>e-t);return t[0]===0&&t[1]===6}function Te(e,t,n,r){try{let i=be.CronExpressionParser.parse(e,{...r?.timezone?{tz:r.timezone}:{}}).fields,a=G(i.minute.values),o=G(i.hour.values),s=G(i.dayOfWeek.values),c=G(i.dayOfMonth.values);if(a.length===60&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.everyMinute;if(!i.minute.isWildcard&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&a.length>1){let e=U(a);if(e!=null&&e>0)return n.everyNMinutes.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length>1&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard){let e=U(o);if(e!=null&&e>0)return n.everyNHours.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&o.length===24)return n.hourly;let l=!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length===1?xe(o[0],a[0],t):``;if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.dailyAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Y(s))return n.weekdaysAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&we(s))return n.weekendsAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length===1){let e=Se(s[0],t);return n.weeklyOn.replace(`{{day}}`,e).replace(`{{time}}`,l)}if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length>1){let e=Ce(s.map(e=>Se(e,t)),t);return n.daysAt.replace(`{{days}}`,e).replace(`{{time}}`,l)}return l&&!i.dayOfMonth.isWildcard&&c.length===1&&i.month.isWildcard&&i.dayOfWeek.isWildcard?n.monthlyAt.replace(`{{day}}`,String(c[0])).replace(`{{time}}`,l):n.customSchedule}catch{return null}}function Ee(e,t,n,r){let i=e.trim();return i?Te(i,t,n,r)||De(r?.nextRun,t)||n.customSchedule:De(r?.nextRun,t)||`—`}function De(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleString(t,{weekday:`short`,hour:`numeric`,minute:`2-digit`})}var Oe=1e3,X=60*Oe,ke=60*X,Ae=24*ke,je=7*Ae,Me=new Intl.ListFormat(`en-US`,{type:`conjunction`}),Ne=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),Pe={en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},Fe={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Ie={minute:X,hour:ke,day:Ae,week:je};function Le(e){return e===`zh`?`zh-CN`:`en-US`}function Re(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:Ne[String(t)].format(e)}function ze(e,t){return t===`zh`?e.join(` `):Me.format(e)}function Be(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(X,Math.round((Number.isFinite(n)&&n>0?n:1)*Ie[t]))}function Ve(e,t,n){let r=typeof e==`number`?e:Number.parseFloat(e),i=Number.isFinite(r)&&r>0?r:1;return String(Number.parseFloat((i*Ie[t]/Ie[n]).toFixed(6)))}function He(e,t){let n=Math.max(Oe,Math.round(e)),r=n===Ae?[{unit:`hour`,ms:ke}]:n>=je&&n%je===0?[{unit:`week`,ms:je}]:n>=Ae?[{unit:`day`,ms:Ae},{unit:`hour`,ms:ke},{unit:`minute`,ms:X},{unit:`second`,ms:Oe}]:n>=ke?[{unit:`hour`,ms:ke},{unit:`minute`,ms:X},{unit:`second`,ms:Oe}]:n>=X?[{unit:`minute`,ms:X},{unit:`second`,ms:Oe}]:[{unit:`second`,ms:Oe}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(Re(r,e,t)),i%=n)}return ze(a,t)}function Ue(e,t){let n=He(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function We(e,t){return Pe[t].format(new Date(e))}function Ge(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function Ke(e,t,n=Date.now()){let r=new Date(e),i=Math.round((Ge(r)-Ge(new Date(n)))/Ae),a=Fe[t].format(r);return i===0?t===`zh`?`今天 ${a}`:`today at ${a}`:i===1?t===`zh`?`明天 ${a}`:`tomorrow at ${a}`:i===-1?t===`zh`?`昨天 ${a}`:`yesterday at ${a}`:We(e,t)}function qe(e,t){return e.eventType===`task.attention_required.v2`&&e.payloadMatch?.reason===`blocked`?t.trigger.taskBlockedWhen:e.eventType===`note.created`?t.trigger.noteCreatedWhen:e.eventType===`workflow.run.completed`&&e.payloadMatch?.status===`failed`?t.trigger.workflowFailedWhen:e.eventType===`session.transcript.updated`?t.trigger.sessionUpdatedWhen:t.trigger.eventWithType.replace(`{type}`,e.eventType)}function Je(e,t,n,r){if(e.kind===`manual`)return t.trigger.manualWhen;if(e.kind===`webhook`)return t.trigger.webhookWhen;if(e.kind===`event`)return qe(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,Ke(Date.parse(i.at),r)):i.kind===`interval`?Ue(i.everyMs,r):Ee(i.expr,Le(r),n.scheduleBadge,{timezone:i.tz})}function Ye(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?Ke(e.state.nextRunAtMs,n,r):e.trigger.kind===`manual`?t.info.noAutomaticTrigger:e.trigger.kind===`event`||e.trigger.kind===`webhook`?t.info.waitingForTrigger:t.info.noUpcomingRun:t.info.pausedNoAutomaticRuns}function Xe(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=Ke(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var Ze={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserWorkflowId:``,browserWorkflowInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,completionWebhookUrl:``,disableAfterFailures:`3`},Qe=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function $e(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)o={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Be(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=q(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_recipe`?`auto_apply`:e.safetyMode,u;return u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{}}:e.actionMode===`browser_recipe`?{kind:`browser_recipe`,recipeId:e.browserWorkflowId.trim(),args:e.browserWorkflowInputs}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:o,action:u,safety:{mode:l},conversationMode:e.conversationMode,notificationPolicy:e.notificationPolicy,...l===`auto_apply`&&e.completionWebhookUrl.trim()?{completionWebhookUrl:e.completionWebhookUrl.trim()}:{},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function et(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:Ze.time,weekday:Ze.weekday,cronExpr:e}}function tt(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function nt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function rt(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function it(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function at(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function ot(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=rt(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=et(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...tt(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:nt(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?it(r.input):{},o=e.reliability?.executionTimeoutSeconds??r.timeoutSeconds??e.reliability?.timeoutSeconds??(r.kind===`browser_recipe`?600:1800);return{...Ze,...n,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:r.kind,agentId:r.kind===`browser_recipe`?``:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserWorkflowId:r.kind===`browser_recipe`?r.recipeId:``,browserWorkflowInputs:r.kind===`browser_recipe`?r.args??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?pe(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(o),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.notificationPolicy??`attention`,completionWebhookUrl:e.completionWebhookUrl??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function st(e,t,n){let r=$e(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;return e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId}:e.action.kind===`workflow`&&r.action.kind===`workflow`?a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}:e.action.kind===`browser_recipe`&&r.action.kind===`browser_recipe`&&(a={...e.action,...r.action}),{...r,description:t.description.trim(),projectId:t.projectId.trim(),completionWebhookUrl:t.completionWebhookUrl.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function ct(e,t,n){return e?We(e,n):t.never}function lt(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_recipe`?`Browser automation: ${e.recipeId}`:e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function ut(e){return e.safety?.mode??`auto_apply`}function dt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function ft(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function pt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function mt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function ht(e,t){if((e.state.consecutiveFailures??0)>0)return!0;let n=t.reduce((t,n)=>n.automationId===e.id&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0);return n?mt(n):!1}function gt(e,t){return e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`&&e.action.goal?.trim()||lt(e.action,t)}function _t(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function vt(e){return!!_t(e)}function yt(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function bt(e){return pt(e)?0:mt(e)?1:e.status===`succeeded`?2:3}function xt(e){return[...e].sort((e,t)=>{let n=bt(e)-bt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function St(){let e=(0,ye.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Z.jsx)(S,{className:`h-4 w-36`}),(0,Z.jsx)(S,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(S,{className:`h-7 w-20 rounded-full`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[t,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(Ct)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(S,{className:`h-4 w-32`}),i=(0,Z.jsx)(S,{className:`mt-4 h-24 rounded-lg`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[n,(0,Z.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[r,i,(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,Z.jsx)(S,{className:`h-12 rounded-lg`}),(0,Z.jsx)(S,{className:`h-12 rounded-lg`}),(0,Z.jsx)(S,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function Ct(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(S,{className:`size-4 rounded-full`}),(0,Z.jsx)(S,{className:`h-4 w-32`}),(0,Z.jsx)(S,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(S,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(S,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(S,{className:`h-8 w-24 rounded-md`})]})},t)}function wt(){let e=m(e=>e.language),t=p(e),n=t.automations,r=t.cron,a=F(e=>e.setPageHeader),c=F(e=>e.clearPageHeader),[S,w]=i(),te=S.get(`run`)?.trim()??``,ne=S.get(`automation`)?.trim()??``,E=S.get(`draft`)?.trim()??``,D=S.get(`action`)?.trim()??``,k=S.get(`projectId`)?.trim()??``,A=S.get(`autogenerate`)===`1`,j=(0,J.useRef)(``),[N,ae]=(0,J.useState)(`all`),[oe,I]=(0,J.useState)(``),[se,R]=(0,J.useState)(!1),[le,B]=(0,J.useState)(`blank`),[ue,H]=(0,J.useState)(null),[U,W]=(0,J.useState)(!1),[G,K]=(0,J.useState)(Ze),[pe,q]=(0,J.useState)(null),[me,_e]=(0,J.useState)(null),[ve,ye]=(0,J.useState)(!1),[be,xe]=(0,J.useState)(null),[Se,Ce]=(0,J.useState)(``),[Y,we]=(0,J.useState)(null),[Te,Ee]=(0,J.useState)(!1),[De,Oe]=(0,J.useState)(!1),[X,ke]=(0,J.useState)(k),[Ae,je]=(0,J.useState)(`new_session`),[Me,Ne]=(0,J.useState)(`attention`),[Pe,Fe]=(0,J.useState)(null),[Ie,Le]=(0,J.useState)(!1),[Re,ze]=(0,J.useState)(!1),[Be,Ve]=(0,J.useState)(!1),[He,Ue]=(0,J.useState)(null),We=x([`automations`,k],()=>z.list(k?{projectId:k}:void 0),{refreshInterval:15e3}),Ge=x([`automation-runs`,k],()=>z.runs(50,void 0,k?{projectId:k}:void 0),{refreshInterval:1e4}),Ke=x(me?`automation-run-events:${me}`:null,()=>z.runEvents(me),{refreshInterval:5e3}),qe=x(`automation-workflow-definitions`,V),Ye=x(`automation-browser-workflows`,()=>he.list()),Xe=x(`automation-chat-agents`,ce),Qe=x(`automation-projects`,()=>L({sortBy:`name`,sortOrder:`asc`,limit:200})),et=We.isLoading&&!We.data||Ge.isLoading&&!Ge.data,tt=We.data?.automations??[],nt=(0,J.useMemo)(()=>xt(Ge.data?.runs??[]),[Ge.data?.runs]),rt=(0,J.useMemo)(()=>tt.filter(e=>!vt(e)),[tt]),it=(0,J.useMemo)(()=>tt.filter(vt),[tt]),ct=(0,J.useMemo)(()=>new Set(it.map(e=>e.id)),[it]),lt=(0,J.useMemo)(()=>nt.filter(e=>!ct.has(e.automationId)),[nt,ct]),ut=(0,J.useMemo)(()=>nt.find(e=>e.id===me)??null,[nt,me]),dt=(0,J.useMemo)(()=>tt.find(e=>e.id===be)??null,[tt,be]),ft=(0,J.useMemo)(()=>tt.find(e=>e.id===ue)??null,[tt,ue]),mt=(0,J.useMemo)(()=>nt.filter(e=>e.automationId===be).sort((e,t)=>t.createdAtMs-e.createdAtMs),[nt,be]),ht=Ke.data?.events??[],_t=(0,J.useMemo)(()=>lt.filter(e=>!pt(e)&&e.readAtMs==null),[lt]),bt=oe.trim().toLocaleLowerCase(),Ct=(0,J.useMemo)(()=>(N===`system`?it:rt).filter(t=>N===`active`&&!t.enabled||N===`paused`&&t.enabled?!1:bt?[t.name,yt(t),gt(t,n),Je(t.trigger,n,r,e)].some(e=>e.toLocaleLowerCase().includes(bt)):!0),[r,N,n,e,bt,it,rt,lt]),wt=(0,J.useMemo)(()=>qe.data??[],[qe.data]),Et=(0,J.useMemo)(()=>(Ye.data?.workflows??[]).filter(e=>e.enabled),[Ye.data]),Dt=Xe.data?.items??[],Ot=Qe.data?.items??[],At=(0,J.useMemo)(()=>wt.find(e=>e.id===G.workflowId.trim())??null,[G.workflowId,wt]),jt=(0,J.useMemo)(()=>Et.find(e=>e.id===G.browserWorkflowId.trim())??null,[Et,G.browserWorkflowId]),Mt=G.actionMode===`workflow`&&(!G.workflowId.trim()||wt.length>0&&!wt.some(e=>e.id===G.workflowId)),Nt=G.actionMode===`workflow`&&At?!fe(At,G.workflowInput,G.workflowInputValid).valid:!1,It=!!G.name.trim()&&(G.triggerMode!==`once`||Number.isFinite(new Date(G.onceAt).getTime()))&&(G.triggerMode!==`event`||!!G.eventType.trim()&&at(G.eventPayloadMatch))&&(G.actionMode===`workflow`?!Mt&&!Nt:G.actionMode===`browser_recipe`?jt!==null&&ge(jt,G.browserWorkflowInputs):!!G.instruction.trim()),Lt=(0,J.useMemo)(()=>[{name:n.templates.dailyAgent.name,description:n.templates.dailyAgent.description,form:{...Ze,name:n.templates.dailyAgent.name,instruction:n.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:n.templates.morningWorkflow.name,description:n.templates.morningWorkflow.description,form:{...Ze,name:n.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:wt[0]?.id??``}},{name:n.templates.webhookAgent.name,description:n.templates.webhookAgent.description,form:{...Ze,name:n.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:n.templates.blockedTask.name,description:n.templates.blockedTask.description,form:{...Ze,name:n.templates.blockedTask.formName,triggerMode:`taskBlocked`,instruction:n.templates.blockedTask.instruction}},{name:n.templates.noteCreated.name,description:n.templates.noteCreated.description,form:{...Ze,name:n.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:n.templates.noteCreated.instruction}}],[n,wt]);(0,J.useEffect)(()=>{if(Ct.length===0){xe(null);return}be&&Ct.some(e=>e.id===be)||xe(Ct[0].id)},[Ct,be]);let Rt=(0,J.useCallback)(async()=>{await Promise.all([We.mutate(),Ge.mutate(),Ke.mutate()])},[We.mutate,Ke.mutate,Ge.mutate]),zt=(0,J.useCallback)(e=>{w(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),xe(null),_e(null)},[w]),Bt=(0,J.useCallback)(e=>{if(H(null),W(!1),B(e),R(!0),e===`blank`){K({...Ze,projectId:k});return}Ce(``),we(null),Oe(!1),ke(k),je(`new_session`),Ne(`attention`)},[k]),Vt=(0,J.useCallback)(e=>{K(ot(e,wt)),H(e.id),W(!1),xe(null),B(`blank`),R(!0)},[wt]),Ht=(0,J.useCallback)(()=>{Y&&(K({...ot(Y.automation,wt),projectId:X,conversationMode:Ae,notificationPolicy:Me}),H(null),W(!0),B(`blank`))},[Y,Ae,Me,X,wt]),Gt=(0,J.useCallback)(async()=>{Ve(!0),q(null);try{await Rt()}catch(e){q(e instanceof Error?e.message:String(e))}finally{Ve(!1)}},[n.feedback.actionFailed,Rt]);(0,J.useEffect)(()=>{if(!ne)return;let e=tt.find(e=>e.id===ne);e&&(ae(vt(e)?`system`:`all`),xe(e.id),w(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[ne,tt,w]),(0,J.useEffect)(()=>{D===`create`&&(Bt(`blank`),w(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[D,Bt,w]),(0,J.useEffect)(()=>{if(!E)return;let t=`${e}:${A?`auto`:`seed`}:${E}`;j.current!==t&&(j.current=t,Ce(E),we(null),Oe(!1),ke(k),B(`draft`),R(!0),w(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),A&&(q(null),Ee(!0),z.draft({prompt:E,language:e}).then(e=>{we(e.draft),Oe(!1)}).catch(e=>{q(e instanceof Error?e.message:String(e))}).finally(()=>{Ee(!1)})))},[A,E,e,k,w]);let Kt=(0,J.useCallback)(e=>{let t=nt.find(t=>t.id===e);if(!t||pt(t)||t.readAtMs!=null)return;let n=Date.now();Ge.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),z.markRunRead(e).catch(e=>{q(e instanceof Error?e.message:String(e)),Ge.mutate()})},[nt,Ge.mutate]),qt=(0,J.useCallback)(e=>{Kt(e),_e(e),ye(!0),w(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Kt,w]),$=(0,J.useCallback)(e=>{xe(e);let t=nt.find(t=>t.automationId===e);t&&t.readAtMs==null&&!pt(t)&&Kt(t.id)},[Kt,nt]);(0,J.useEffect)(()=>{te&&(Kt(te),_e(te),ye(!0))},[Kt,te]),(0,J.useEffect)(()=>{Fe(null),ze(!1)},[me]);async function Jt(){if(q(null),It){if(U&&Y){Ue(`draft:edit`);try{let e=$e(G,At),{simulation:t}=await z.simulate(e);we({...Y,automation:e,simulation:t}),ke(G.projectId),je(G.conversationMode),Ne(G.notificationPolicy),Oe(!1),W(!1),B(`draft`)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Ue(null)}return}if(ft){let e=ft.id;await Yt(`automation:${e}:edit`,()=>z.update(e,st(ft,G,At)))&&(R(!1),H(null),xe(e));return}try{let e=$e(G,At),{automation:t}=await z.create(e);K(Ze),R(!1),ae(`all`),I(``),zt(t.projectId??``),await Rt(),xe(t.id)}catch(e){q(e instanceof Error?e.message:String(e))}}}async function Yt(e,t){q(null),Ue(e);try{return await t(),await Rt(),!0}catch(e){return q(e instanceof Error?e.message:String(e)),!1}finally{Ue(null)}}async function Xt(){await Yt(`runs:read-all`,()=>z.markAllRunsRead(k||void 0))}async function Zt(){let t=Se.trim();if(t){q(null),Ee(!0);try{we((await z.draft({prompt:t,language:e})).draft),Oe(!1)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Ee(!1)}}}async function Qt(){if(!Y)return;let e=``,t=``;await Yt(`draft:publish`,async()=>{let{automation:n}=await z.create({...Y.automation,...X?{projectId:X}:{projectId:void 0},conversationMode:Ae,notificationPolicy:Me});we(null),Ce(``),Oe(!1),R(!1),ae(`all`),I(``),e=n.id,t=n.projectId??``})&&e&&(zt(t),xe(e))}async function $t(){if(!Y)return;let e=``,t=``,n=``;await Yt(`draft:test`,async()=>{let{automation:r}=await z.create({...Y.automation,...X?{projectId:X}:{projectId:void 0},conversationMode:Ae,notificationPolicy:Me,enabled:!1}),{run:i}=await z.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,we(null),Ce(``),Oe(!1),R(!1),ae(`all`),I(``)})&&e&&n&&(zt(t),xe(e),qt(n))}async function en(t){q(null),Le(!0),Fe(null),ze(!1);try{Fe((await z.repairDraft(t.id,{language:e})).repair)}catch(e){q(e instanceof Error?e.message:String(e))}finally{Le(!1)}}async function tn(e){Pe&&await Yt(`run:${e.id}:repair`,async()=>{await z.update(e.automationId,Pe.patch),Fe(null),ze(!1)})}let nn=(0,J.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(O,{className:`size-9 shrink-0 p-0`,loading:Be,label:n.refresh,onClick:Gt}),(0,Z.jsxs)(f,{variant:`primary`,onClick:()=>Bt(`draft`),children:[(0,Z.jsx)(l,{className:`size-4`}),n.new]})]}),[n.new,n.refresh,Bt,Be,Gt]);return(0,J.useLayoutEffect)(()=>(a({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:nn}),()=>c()),[c,nn,n.subtitle,n.title,a]),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-5 sm:px-5 xl:px-6`,children:[pe?(0,Z.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:pe}):null,et?(0,Z.jsx)(St,{}):(0,Z.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[20rem_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle p-3`,children:[(0,Z.jsxs)(o,{"aria-label":n.filters.project,className:Q,value:k,onChange:e=>zt(e.target.value),children:[(0,Z.jsx)(s,{value:``,children:n.filters.allProjects}),Ot.map(e=>(0,Z.jsx)(s,{value:e.id,children:e.name},e.id))]}),(0,Z.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg-muted focus-within:border-accent`,children:[(0,Z.jsx)(C,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:oe,onChange:e=>I(e.target.value),placeholder:n.filters.search})]}),(0,Z.jsxs)(`nav`,{className:`mt-3 flex items-center gap-1`,"aria-label":n.filters.status,children:[[{id:`all`,label:n.filters.all},{id:`active`,label:n.filters.active},{id:`paused`,label:n.paused}].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:d(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,N===e.id&&`bg-surface-hover text-fg`),onClick:()=>ae(e.id),children:e.label},e.id)),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(re,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:d(`ml-auto rounded-md p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,N===`system`&&`bg-surface-hover text-fg`),"aria-label":n.system.title,children:(0,Z.jsx)(M,{className:`size-4`})})}),(0,Z.jsx)(de,{children:(0,Z.jsx)(ie,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,Z.jsxs)(ee,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>ae(`system`),children:[n.system.title,` `,it.length]})})})]})]}),_t.length>0&&N!==`system`?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 rounded-md bg-accent/8 px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,Z.jsxs)(`span`,{children:[n.filters.unread,` · `,_t.length]}),(0,Z.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:He===`runs:read-all`,onClick:()=>void Xt(),children:n.filters.markAllRead})]}):null]}),(0,Z.jsx)(kt,{automations:Ct,runs:N===`system`?nt:lt,labels:n,cronLabels:r,language:e,selectedAutomationId:be,onOpenDetails:$})]}),dt?(0,Z.jsx)(Ft,{automation:dt,runs:mt,labels:n,cronLabels:r,language:e,projects:Ot,busyAction:He,onEdit:Vt,onSelectRun:qt,onAction:Yt}):(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(T,{className:`size-5`}),title:n.empty.filtered})]})]}),(0,Z.jsx)(b,{open:se,onOpenChange:e=>{R(e),e||(H(null),W(!1))},children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(y,{className:`text-base font-semibold text-fg`,children:le===`draft`?n.draft.title:ft?n.editTitle:U?n.draft.editTitle:n.createTitle}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(u,{className:`size-4`})})})]}),le===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(Tt,{labels:n,prompt:Se,draft:Y,loading:Te,approved:De,publishBusy:He===`draft:publish`,testBusy:He===`draft:test`,templates:Lt,projects:Ot,projectId:X,conversationMode:Ae,notificationPolicy:Me,onPromptChange:Ce,onGenerate:Zt,onEdit:Ht,onPublish:Qt,onTest:$t,onProjectChange:ke,onConversationModeChange:je,onNotificationPolicyChange:Ne,onApprovedChange:Oe,onDiscard:()=>{we(null),Oe(!1)},onTemplateSelect:e=>{K({...e,projectId:X}),B(`blank`)},onOpenAdvanced:()=>{K({...Ze,projectId:X,conversationMode:Ae,notificationPolicy:Me}),B(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wt,{form:G,labels:n,setForm:K,projects:Ot,workflowDefinitions:wt,selectedWorkflow:At,workflowsLoading:qe.isLoading,browserWorkflows:Et,selectedBrowserWorkflow:jt,browserWorkflowsLoading:Ye.isLoading,agentOptions:Dt,agentsLoading:Xe.isLoading,language:e}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[U?(0,Z.jsx)(f,{variant:`ghost`,onClick:()=>{W(!1),B(`draft`)},children:n.cancel}):(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,children:n.cancel})}),(0,Z.jsx)(f,{variant:`primary`,onClick:Jt,disabled:!It||He===`draft:edit`||!!(ft&&He),children:He===`draft:edit`||ft&&He===`automation:${ft.id}:edit`?n.feedback.working:ft||U?n.save:n.create})]})]})]})]})}),(0,Z.jsx)(b,{open:ve&&!!ut,onOpenChange:e=>{ye(e),!e&&w(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(_,{children:[(0,Z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(v,{className:`fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(y,{className:`truncate text-base font-semibold text-fg`,children:ut?.automationName??n.dashboard.result}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,"aria-label":n.close,children:(0,Z.jsx)(u,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(Pt,{className:`rounded-none border-0`,run:ut,events:ht,labels:n,cronLabels:r,language:e,loading:Ke.isLoading,repairDraft:Pe,repairLoading:Ie,repairApproved:Re,busyAction:He,onRepairApprovedChange:ze,onSuggestRepair:en,onApplyRepair:tn})})]})]})})]})}function Tt(e){let t=(0,ye.c)(112),{labels:n,prompt:r,draft:i,loading:a,approved:c,publishBusy:l,testBusy:u,templates:d,projects:p,projectId:m,conversationMode:h,notificationPolicy:g,onPromptChange:_,onGenerate:v,onEdit:y,onPublish:b,onTest:x,onProjectChange:S,onConversationModeChange:C,onNotificationPolicyChange:w,onApprovedChange:ee,onDiscard:te,onTemplateSelect:ne,onOpenAdvanced:re}=e,T=l===void 0?!1:l,D=u===void 0?!1:u,O=!!(i&&i.simulation.requiredConfirmations.length>0),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(ue,{className:`size-4 text-accent`}),t[0]=A):A=t[0];let j;t[1]===n.draft.title?j=t[2]:(j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[A,n.draft.title]}),t[1]=n.draft.title,t[2]=j);let M;t[3]===n.draft.subtitle?M=t[4]:(M=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=M);let N;t[5]!==j||t[6]!==M?(N=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),t[5]=j,t[6]=M,t[7]=N):N=t[7];let ie;t[8]!==a||t[9]!==r?(ie=a||!r.trim(),t[8]=a,t[9]=r,t[10]=ie):ie=t[10];let ae;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(ue,{className:`size-4`}),t[11]=ae):ae=t[11];let P=a?n.draft.generating:n.draft.generate,F;t[12]!==v||t[13]!==ie||t[14]!==P?(F=(0,Z.jsxs)(f,{variant:`primary`,onClick:v,disabled:ie,children:[ae,P]}),t[12]=v,t[13]=ie,t[14]=P,t[15]=F):F=t[15];let oe;t[16]!==F||t[17]!==N?(oe=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[N,F]}),t[16]=F,t[17]=N,t[18]=oe):oe=t[18];let I;t[19]===_?I=t[20]:(I=e=>_(e.target.value),t[19]=_,t[20]=I);let se;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==I?(se=(0,Z.jsx)(`textarea`,{className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:I,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=I,t[24]=se):se=t[24];let ce=n.draft.project,L;t[25]===S?L=t[26]:(L=e=>S(e.target.value),t[25]=S,t[26]=L);let R;t[27]===n.draft.noProject?R=t[28]:(R=(0,Z.jsx)(s,{value:``,children:n.draft.noProject}),t[27]=n.draft.noProject,t[28]=R);let le;t[29]===p?le=t[30]:(le=p.map(Et),t[29]=p,t[30]=le);let z;t[31]!==m||t[32]!==L||t[33]!==R||t[34]!==le?(z=(0,Z.jsxs)(o,{className:Q,value:m,onChange:L,children:[R,le]}),t[31]=m,t[32]=L,t[33]=R,t[34]=le,t[35]=z):z=t[35];let B;t[36]!==n.draft.project||t[37]!==z?(B=(0,Z.jsx)($,{label:ce,children:z}),t[36]=n.draft.project,t[37]=z,t[38]=B):B=t[38];let V;t[39]===C?V=t[40]:(V=e=>C(e.target.value),t[39]=C,t[40]=V);let de;t[41]===n.draft.newConversation?de=t[42]:(de=(0,Z.jsx)(s,{value:`new_session`,children:n.draft.newConversation}),t[41]=n.draft.newConversation,t[42]=de);let H;t[43]===n.draft.continuousConversation?H=t[44]:(H=(0,Z.jsx)(s,{value:`continuous`,children:n.draft.continuousConversation}),t[43]=n.draft.continuousConversation,t[44]=H);let U;t[45]!==h||t[46]!==V||t[47]!==de||t[48]!==H?(U=(0,Z.jsxs)(o,{className:Q,value:h,onChange:V,children:[de,H]}),t[45]=h,t[46]=V,t[47]=de,t[48]=H,t[49]=U):U=t[49];let W;t[50]!==n.draft.conversation||t[51]!==U?(W=(0,Z.jsx)($,{label:n.draft.conversation,children:U}),t[50]=n.draft.conversation,t[51]=U,t[52]=W):W=t[52];let G;t[53]===w?G=t[54]:(G=e=>w(e.target.value),t[53]=w,t[54]=G);let K;t[55]===n.draft.notifyAttention?K=t[56]:(K=(0,Z.jsx)(s,{value:`attention`,children:n.draft.notifyAttention}),t[55]=n.draft.notifyAttention,t[56]=K);let fe;t[57]===n.draft.notifyAll?fe=t[58]:(fe=(0,Z.jsx)(s,{value:`all`,children:n.draft.notifyAll}),t[57]=n.draft.notifyAll,t[58]=fe);let pe;t[59]===n.draft.notifyNone?pe=t[60]:(pe=(0,Z.jsx)(s,{value:`none`,children:n.draft.notifyNone}),t[59]=n.draft.notifyNone,t[60]=pe);let q;t[61]!==g||t[62]!==G||t[63]!==K||t[64]!==fe||t[65]!==pe?(q=(0,Z.jsxs)(o,{className:Q,value:g,onChange:G,children:[K,fe,pe]}),t[61]=g,t[62]=G,t[63]=K,t[64]=fe,t[65]=pe,t[66]=q):q=t[66];let me;t[67]!==n.draft.notifications||t[68]!==q?(me=(0,Z.jsx)($,{label:n.draft.notifications,children:q}),t[67]=n.draft.notifications,t[68]=q,t[69]=me):me=t[69];let he;t[70]!==B||t[71]!==W||t[72]!==me?(he=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[B,W,me]}),t[70]=B,t[71]=W,t[72]=me,t[73]=he):he=t[73];let ge;t[74]!==i||t[75]!==n.draft.advancedCreate||t[76]!==n.draft.suggestions||t[77]!==n.draft.suggestionsDescription||t[78]!==re||t[79]!==ne||t[80]!==d?(ge=i?null:(0,Z.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,Z.jsx)(f,{variant:`ghost`,onClick:re,children:n.draft.advancedCreate})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:d.slice(0,4).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>ne(e.form),children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]},e.name))})]}),t[74]=i,t[75]=n.draft.advancedCreate,t[76]=n.draft.suggestions,t[77]=n.draft.suggestionsDescription,t[78]=re,t[79]=ne,t[80]=d,t[81]=ge):ge=t[81];let _e;t[82]!==c||t[83]!==i||t[84]!==n.draft.approval||t[85]!==n.draft.assumptions||t[86]!==n.draft.discard||t[87]!==n.draft.edit||t[88]!==n.draft.publish||t[89]!==n.draft.review||t[90]!==n.draft.risks||t[91]!==n.draft.safety||t[92]!==n.draft.testOnce||t[93]!==n.draft.testing||t[94]!==n.feedback||t[95]!==n.info||t[96]!==n.none||t[97]!==ee||t[98]!==te||t[99]!==y||t[100]!==b||t[101]!==x||t[102]!==T||t[103]!==O||t[104]!==D?(_e=i?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,Z.jsx)(Ht,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(Ht,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,Z.jsx)(Dt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.risks,items:i.risks,empty:n.none}),O?(0,Z.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:c,onChange:e=>ee(e.target.checked)}),(0,Z.jsx)(`span`,{children:n.draft.approval})]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(f,{variant:`ghost`,onClick:te,children:n.draft.discard}),(0,Z.jsxs)(f,{variant:`secondary`,onClick:y,children:[(0,Z.jsx)(k,{className:`size-4`}),n.draft.edit]}),(0,Z.jsxs)(f,{variant:`secondary`,onClick:x,disabled:D||T||O&&!c,children:[(0,Z.jsx)(E,{className:`size-4`}),D?n.draft.testing:n.draft.testOnce]}),(0,Z.jsx)(f,{variant:`primary`,onClick:b,disabled:T||O&&!c,children:T?n.feedback.working:n.draft.publish})]})]})]}):null,t[82]=c,t[83]=i,t[84]=n.draft.approval,t[85]=n.draft.assumptions,t[86]=n.draft.discard,t[87]=n.draft.edit,t[88]=n.draft.publish,t[89]=n.draft.review,t[90]=n.draft.risks,t[91]=n.draft.safety,t[92]=n.draft.testOnce,t[93]=n.draft.testing,t[94]=n.feedback,t[95]=n.info,t[96]=n.none,t[97]=ee,t[98]=te,t[99]=y,t[100]=b,t[101]=x,t[102]=T,t[103]=O,t[104]=D,t[105]=_e):_e=t[105];let ve;return t[106]!==oe||t[107]!==se||t[108]!==he||t[109]!==ge||t[110]!==_e?(ve=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[oe,se,he,ge,_e]}),t[106]=oe,t[107]=se,t[108]=he,t[109]=ge,t[110]=_e,t[111]=ve):ve=t[111],ve}function Et(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function Dt(e){let t=(0,ye.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(Ot):(0,Z.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Ot(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function kt(e){let t=(0,ye.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:c}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(T,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,Z.jsx)(Ut,{icon:e,title:i.empty.filtered}),t[1]=i.empty.filtered,t[2]=n),n}let l;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(At),n=t.find(pt),l=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:d(`block w-full p-3 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,s===e.id&&`bg-surface-hover`),onClick:()=>c(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:d(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:ht(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),l&&l.readAtMs==null&&!pt(l)?(0,Z.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,Z.jsx)(`div`,{className:`mt-1 truncate pl-4 text-xs text-fg-muted`,children:Je(e.trigger,i,a,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center justify-between gap-2 pl-4 text-xs text-fg-subtle`,children:[(0,Z.jsx)(`span`,{className:d(`truncate`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.enabled?`${i.next}: ${ct(e.state.nextRunAtMs,i,o)}`:i.paused}),l?.status?(0,Z.jsx)(`span`,{className:d(`shrink-0 rounded-full px-1.5 py-0.5`,dt(l.status)),children:i.status[l.status]}):null]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=c,t[15]=r,t[16]=s,t[17]=e):e=t[17],l=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=s,t[10]=l}else l=t[10];let u;return t[18]===l?u=t[19]:(u=(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:l}),t[18]=l,t[19]=u),u}function At(e,t){return t.createdAtMs-e.createdAtMs}function jt(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`completion_hook.started`:return n.completionHookStarted;case`completion_hook.completed`:return n.completionHookCompleted;case`completion_hook.failed`:return n.completionHookFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Mt(e){let t=(0,ye.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,J.useState)(a===void 0?!1:a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
|
|
2
|
+
`),t[2]=l,t[3]=u);let f=u.length,p=l.length>720||f>18,m;t[4]!==p||t[5]!==l?(m=p?`${l.split(`
|
|
3
|
+
`).slice(0,10).join(`
|
|
4
|
+
`).trimEnd()}...`:l,t[4]=p,t[5]=l,t[6]=m):m=t[6];let h=m,g;t[7]!==o||t[8]!==p||t[9]!==r||t[10]!==i?(g=p?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Nt),"aria-expanded":o,children:[(0,Z.jsx)(`span`,{children:i}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,Z.jsx)(ae,{className:d(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=p,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=o||!p?l:h,v;t[12]===_?v=t[13]:(v=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let y;return t[14]!==g||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=y):y=t[16],y}function Nt(e){return!e}function Pt(e){let t=(0,ye.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:l,loading:u,repairDraft:p,repairLoading:m,repairApproved:h,busyAction:g,onRepairApprovedChange:_,onSuggestRepair:v,onApplyRepair:y}=e;if(!r){let e;t[0]===n?e=t[1]:(e=d(`flex min-h-64 flex-col justify-center rounded-lg border border-edge-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(R,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===o.selectRun?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`mt-2`,children:o.selectRun}),t[3]=o.selectRun,t[4]=i);let a;return t[5]!==e||t[6]!==i?(a=(0,Z.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=a):a=t[7],a}let b=r.error||r.summary,x=r.sessionKey?`/chat/${encodeURIComponent(r.sessionKey)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,C=r.sessionKey?o.runDetail.openConversation:o.runDetail.openWorkflow,ee=r.sessionKey?le:A,te=pt(r)?R:mt(r)?N:se,ne;t[8]===n?ne=t[9]:(ne=d(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=ne);let re;t[10]===r.automationName?re=t[11]:(re=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=re);let T;t[12]===r.id?T=t[13]:(T=r.id.slice(0,8),t[12]=r.id,t[13]=T);let E;t[14]===T?E=t[15]:(E=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:T}),t[14]=T,t[15]=E);let D;t[16]!==re||t[17]!==E?(D=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[re,E]}),t[16]=re,t[17]=E,t[18]=D):D=t[18];let O;t[19]===r.status?O=t[20]:(O=d(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(r.status)),t[19]=r.status,t[20]=O);let k=o.status[r.status],j;t[21]!==O||t[22]!==k?(j=(0,Z.jsx)(`span`,{className:O,children:k}),t[21]=O,t[22]=k,t[23]=j):j=t[23];let M;t[24]!==D||t[25]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[D,j]}),t[24]=D,t[25]=j,t[26]=M):M=t[26];let ie;t[27]!==o||t[28]!==l||t[29]!==r.createdAtMs?(ie=ct(r.createdAtMs,o,l),t[27]=o,t[28]=l,t[29]=r.createdAtMs,t[30]=ie):ie=t[30];let P;t[31]===ie?P=t[32]:(P=(0,Z.jsx)(`span`,{children:ie}),t[31]=ie,t[32]=P);let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=F):F=t[33];let oe=o.details.duration,I;t[34]!==o||t[35]!==r.durationMs?(I=ft(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=I):I=t[36];let ce;t[37]!==o.details.duration||t[38]!==I?(ce=(0,Z.jsxs)(`span`,{children:[oe,` `,I]}),t[37]=o.details.duration,t[38]=I,t[39]=ce):ce=t[39];let L;t[40]!==P||t[41]!==ce?(L=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[P,F,ce]}),t[40]=P,t[41]=ce,t[42]=L):L=t[42];let z;t[43]!==o.repair||t[44]!==v||t[45]!==m||t[46]!==r?(z=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(f,{variant:`secondary`,onClick:()=>v(r),disabled:m,children:[(0,Z.jsx)(ue,{className:`size-4`}),m?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=v,t[45]=m,t[46]=r,t[47]=z):z=t[47];let V;t[48]!==L||t[49]!==z||t[50]!==M?(V=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[M,L,z]}),t[48]=L,t[49]=z,t[50]=M,t[51]=V):V=t[51];let de;t[52]===r?de=t[53]:(de=pt(r)?`text-blue-500`:mt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=de);let H;t[54]===de?H=t[55]:(H=d(`size-4`,de),t[54]=de,t[55]=H);let U;t[56]!==te||t[57]!==H?(U=(0,Z.jsx)(te,{className:H}),t[56]=te,t[57]=H,t[58]=U):U=t[58];let W;t[59]!==o.runDetail.resultTitle||t[60]!==U?(W=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=U,t[61]=W):W=t[61];let G;t[62]!==ee||t[63]!==C||t[64]!==x?(G=x?(0,Z.jsx)(f,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:x,children:[(0,Z.jsx)(ee,{className:`size-3.5`}),C,(0,Z.jsx)(w,{className:`size-3.5`})]})}):null,t[62]=ee,t[63]=C,t[64]=x,t[65]=G):G=t[65];let K;t[66]!==W||t[67]!==G?(K=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[W,G]}),t[66]=W,t[67]=G,t[68]=K):K=t[68];let fe=r.error&&`border-red-500/25 bg-red-500/5`,pe;t[69]===fe?pe=t[70]:(pe=d(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,fe),t[69]=fe,t[70]=pe);let q;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==b||t[74]!==r?(q=b?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:b}):(0,Z.jsx)(c,{content:b,compact:!0,className:`text-sm`,openHttpLinksInNewTab:!0}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:pt(r)?o.runDetail.resultPending:o.runDetail.noResult}),t[71]=o.runDetail.noResult,t[72]=o.runDetail.resultPending,t[73]=b,t[74]=r,t[75]=q):q=t[75];let me;t[76]!==pe||t[77]!==q?(me=(0,Z.jsx)(`div`,{className:pe,children:q}),t[76]=pe,t[77]=q,t[78]=me):me=t[78];let he;t[79]!==K||t[80]!==me?(he=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[K,me]}),t[79]=K,t[80]=me,t[81]=he):he=t[81];let ge;t[82]===o.runDetail.runInfo?ge=t[83]:(ge=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=ge);let _e;t[84]!==s||t[85]!==o||t[86]!==l||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(_e=r.manual?o.trigger.manual:Je(r.triggerSnapshot,o,s,l),t[84]=s,t[85]=o,t[86]=l,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=_e):_e=t[89];let ve;t[90]!==o.explain.whyRan||t[91]!==_e?(ve=(0,Z.jsx)(Bt,{label:o.explain.whyRan,value:_e}),t[90]=o.explain.whyRan,t[91]=_e,t[92]=ve):ve=t[92];let J=o.details.started,be;t[93]!==o||t[94]!==l||t[95]!==r.startedAtMs?(be=ct(r.startedAtMs,o,l),t[93]=o,t[94]=l,t[95]=r.startedAtMs,t[96]=be):be=t[96];let xe;t[97]!==o.details.started||t[98]!==be?(xe=(0,Z.jsx)(Bt,{label:J,value:be}),t[97]=o.details.started,t[98]=be,t[99]=xe):xe=t[99];let Se;t[100]!==o.details.model||t[101]!==r.model?(Se=r.model?(0,Z.jsx)(Bt,{label:o.details.model,value:r.model}):null,t[100]=o.details.model,t[101]=r.model,t[102]=Se):Se=t[102];let Ce;t[103]!==ve||t[104]!==xe||t[105]!==Se?(Ce=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[ve,xe,Se]}),t[103]=ve,t[104]=xe,t[105]=Se,t[106]=Ce):Ce=t[106];let Y;t[107]!==ge||t[108]!==Ce?(Y=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ge,Ce]}),t[107]=ge,t[108]=Ce,t[109]=Y):Y=t[109];let we;t[110]!==g||t[111]!==o||t[112]!==y||t[113]!==_||t[114]!==h||t[115]!==p||t[116]!==r?(we=p?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:p.explanation}),p.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:p.expectedEffect}):null,(0,Z.jsx)(Dt,{title:o.repair.risks,items:p.risks,empty:o.none}),(0,Z.jsx)(Mt,{value:p.patch,labels:o,title:o.details.repairPatch}),p.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:h,onChange:e=>_(e.target.checked)}),(0,Z.jsx)(`span`,{children:o.repair.approval})]}):null,(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsx)(f,{variant:`primary`,onClick:()=>y(r),disabled:g===`run:${r.id}:repair`||p.requiresApproval&&!h,children:g===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=g,t[111]=o,t[112]=y,t[113]=_,t[114]=h,t[115]=p,t[116]=r,t[117]=we):we=t[117];let Te;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(B,{className:`size-4 shrink-0`}),t[118]=Te):Te=t[118];let Ee;t[119]===o.runDetail.technicalEvents?Ee=t[120]:(Ee=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[Te,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=Ee);let De;t[121]!==i.length||t[122]!==o.runDetail.eventCount?(De=o.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=o.runDetail.eventCount,t[123]=De):De=t[123];let Oe;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsx)(ae,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=Oe):Oe=t[124];let X;t[125]===De?X=t[126]:(X=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[De,Oe]}),t[125]=De,t[126]=X);let ke;t[127]!==Ee||t[128]!==X?(ke=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[Ee,X]}),t[127]=Ee,t[128]=X,t[129]=ke):ke=t[129];let Ae;t[130]===o.runDetail.technicalEventsDescription?Ae=t[131]:(Ae=(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:o.runDetail.technicalEventsDescription}),t[130]=o.runDetail.technicalEventsDescription,t[131]=Ae);let je;t[132]!==i||t[133]!==o||t[134]!==l||t[135]!==u?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:u?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":o.loading,children:[(0,Z.jsx)(S,{className:`h-10 w-full`}),(0,Z.jsx)(S,{className:`h-10 w-4/5`}),(0,Z.jsx)(S,{className:`h-10 w-11/12`})]}):i.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,Z.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,Z.jsx)(`span`,{className:d(`mt-1 size-2 rounded-full`,Vt(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:jt(e,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[ct(e.createdAtMs,o,l),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[o.details.eventData,(0,Z.jsx)(ae,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,Z.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=o,t[134]=l,t[135]=u,t[136]=je):je=t[136];let Me;t[137]!==ke||t[138]!==Ae||t[139]!==je?(Me=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[ke,Ae,je]}),t[137]=ke,t[138]=Ae,t[139]=je,t[140]=Me):Me=t[140];let Ne;return t[141]!==ne||t[142]!==V||t[143]!==he||t[144]!==Y||t[145]!==we||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:ne,children:[V,he,Y,we,Me]}),t[141]=ne,t[142]=V,t[143]=he,t[144]=Y,t[145]=we,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Ft(e){let t=(0,ye.c)(83),{automation:n,runs:r,labels:i,cronLabels:a,language:o,projects:s,busyAction:l,onEdit:u,onSelectRun:p,onAction:m}=e,h=l===`automation:${n.id}:run`,g=l===`automation:${n.id}:toggle`,_=l===`automation:${n.id}:delete`,v;t[0]===n?v=t[1]:(v=vt(n),t[0]=n,t[1]=v);let y=v,b;t[2]===n.name?b=t[3]:(b=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=b);let x=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,S;t[4]===x?S=t[5]:(S=d(`shrink-0 rounded-full px-2 py-0.5 text-xs`,x),t[4]=x,t[5]=S);let C=n.enabled?i.enabled:i.paused,w;t[6]!==S||t[7]!==C?(w=(0,Z.jsx)(`span`,{className:S,children:C}),t[6]=S,t[7]=C,t[8]=w):w=t[8];let te;t[9]!==b||t[10]!==w?(te=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[b,w]}),t[9]=b,t[10]=w,t[11]=te):te=t[11];let ne;t[12]===n?ne=t[13]:(ne=yt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:yt(n)}):null,t[12]=n,t[13]=ne);let T;t[14]!==te||t[15]!==ne?(T=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[te,ne]}),t[14]=te,t[15]=ne,t[16]=T):T=t[16];let O;t[17]!==n||t[18]!==l||t[19]!==_||t[20]!==i.dashboard.delete||t[21]!==i.dashboard.deleted||t[22]!==i.dashboard.pause||t[23]!==i.dashboard.resume||t[24]!==i.dashboard.resumed||t[25]!==i.dashboard.runNow||t[26]!==i.details||t[27]!==i.edit||t[28]!==i.feedback||t[29]!==m||t[30]!==u||t[31]!==y||t[32]!==h||t[33]!==g?(O=y?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(f,{variant:`secondary`,disabled:l!==null,onClick:()=>void m(`automation:${n.id}:toggle`,()=>n.enabled?z.pause(n.id):z.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[g?(0,Z.jsx)(j,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(D,{className:`size-4`}):(0,Z.jsx)(E,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(f,{variant:`primary`,disabled:l!==null,onClick:()=>void m(`automation:${n.id}:run`,()=>z.runNow(n.id),i.feedback.rerunQueued),children:[h?(0,Z.jsx)(j,{className:`size-4 animate-spin`}):(0,Z.jsx)(E,{className:`size-4`}),i.dashboard.runNow]}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(re,{asChild:!0,children:(0,Z.jsx)(f,{variant:`ghost`,className:`size-9 p-0`,"aria-label":i.details.moreActions,children:(0,Z.jsx)(M,{className:`size-4`})})}),(0,Z.jsx)(de,{children:(0,Z.jsxs)(ie,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(ee,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>u(n),children:[(0,Z.jsx)(k,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(ee,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-red-700 outline-none hover:bg-red-500/10 dark:text-red-300`,disabled:l!==null,onSelect:()=>void m(`automation:${n.id}:delete`,()=>z.remove(n.id),i.dashboard.deleted),children:[_?(0,Z.jsx)(j,{className:`size-4 animate-spin`}):(0,Z.jsx)(I,{className:`size-4`}),i.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=l,t[19]=_,t[20]=i.dashboard.delete,t[21]=i.dashboard.deleted,t[22]=i.dashboard.pause,t[23]=i.dashboard.resume,t[24]=i.dashboard.resumed,t[25]=i.dashboard.runNow,t[26]=i.details,t[27]=i.edit,t[28]=i.feedback,t[29]=m,t[30]=u,t[31]=y,t[32]=h,t[33]=g,t[34]=O):O=t[34];let A;t[35]!==O||t[36]!==T?(A=(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[T,O]}),t[35]=O,t[36]=T,t[37]=A):A=t[37];let N;t[38]===i.info.task?N=t[39]:(N=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.info.task}),t[38]=i.info.task,t[39]=N);let ae;t[40]!==n||t[41]!==i?(ae=gt(n,i),t[40]=n,t[41]=i,t[42]=ae):ae=t[42];let F;t[43]===ae?F=t[44]:(F=(0,Z.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsx)(c,{content:ae,compact:!0,openHttpLinksInNewTab:!0})}),t[43]=ae,t[44]=F);let oe;t[45]!==N||t[46]!==F?(oe=(0,Z.jsxs)(`section`,{children:[N,F]}),t[45]=N,t[46]=F,t[47]=oe):oe=t[47];let ce;t[48]!==n||t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==s?(ce=(0,Z.jsx)(Lt,{automation:n,labels:i,cronLabels:a,language:o,projects:s}),t[48]=n,t[49]=a,t[50]=i,t[51]=o,t[52]=s,t[53]=ce):ce=t[53];let L;t[54]===i.dashboard.runHistory?L=t[55]:(L=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),t[54]=i.dashboard.runHistory,t[55]=L);let le;t[56]===i.dashboard.runHistoryDescription?le=t[57]:(le=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription}),t[56]=i.dashboard.runHistoryDescription,t[57]=le);let B;t[58]!==L||t[59]!==le?(B=(0,Z.jsxs)(`div`,{children:[L,le]}),t[58]=L,t[59]=le,t[60]=B):B=t[60];let V;t[61]===r.length?V=t[62]:(V=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[61]=r.length,t[62]=V);let ue;t[63]!==B||t[64]!==V?(ue=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[B,V]}),t[63]=B,t[64]=V,t[65]=ue):ue=t[65];let H;t[66]!==i||t[67]!==o||t[68]!==p||t[69]!==r?(H=r.length===0?(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(R,{className:`size-5`}),title:i.empty.runs}):(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:r.slice(0,8).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`block w-full p-3 text-left hover:bg-surface-hover`,onClick:()=>p(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,Z.jsx)(se,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(R,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:ct(e.createdAtMs,i,o)})]}),(0,Z.jsx)(`span`,{className:d(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:d(`mt-1 line-clamp-2 pl-6 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||lt(e.actionSnapshot,i)})]},e.id))}),t[66]=i,t[67]=o,t[68]=p,t[69]=r,t[70]=H):H=t[70];let U;t[71]!==ue||t[72]!==H?(U=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[ue,H]}),t[71]=ue,t[72]=H,t[73]=U):U=t[73];let W;t[74]!==ce||t[75]!==U?(W=(0,Z.jsxs)(`div`,{className:`grid items-start gap-5 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[ce,U]}),t[74]=ce,t[75]=U,t[76]=W):W=t[76];let G;t[77]!==oe||t[78]!==W?(G=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[oe,W]}),t[77]=oe,t[78]=W,t[79]=G):G=t[79];let K;return t[80]!==A||t[81]!==G?(K=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[A,G]}),t[80]=A,t[81]=G,t[82]=K):K=t[82],K}function It(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Lt(e){let t=(0,ye.c)(146),{automation:n,labels:r,cronLabels:i,language:a,projects:o}=e,s,c,l,u,d,f,p,m,h,g,_;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=ut(n),o;t[15]!==n||t[16]!==r||t[17]!==a?(o=Ye(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=o):o=t[18];let v=o,y;t[19]!==n.state.nextRunAtMs||t[20]!==a?(y=n.state.nextRunAtMs?We(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=y):y=t[21];let b=y;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(_=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],_.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],_.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=We(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],_.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],_.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],_.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],_.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],_.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],_.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],_.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=_}else _=t[39];h=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?g=t[71]:(g=(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=g),f=`grid gap-4 p-4`;let x;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ne,{className:`size-4`,"aria-hidden":!0}),t[72]=x):x=t[72];let S=r.info.schedule,C;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(C=Je(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=C):C=t[77];let w=n.enabled?`${r.info.nextRun}:${v}`:v;t[78]!==r.info.schedule||t[79]!==b||t[80]!==C||t[81]!==w?(p=(0,Z.jsx)(zt,{icon:x,label:S,value:C,description:w,descriptionTitle:b}),t[78]=r.info.schedule,t[79]=b,t[80]=C,t[81]=w,t[82]=p):p=t[82];let ee;t[83]===n.action.kind?ee=t[84]:(ee=n.action.kind===`workflow`?(0,Z.jsx)(A,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_recipe`?(0,Z.jsx)(B,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=ee);let re=r.info.action,E;t[85]!==n.action||t[86]!==r?(E=lt(n.action,r),t[85]=n.action,t[86]=r,t[87]=E):E=t[87],t[88]!==r.info.action||t[89]!==ee||t[90]!==E?(m=(0,Z.jsx)(zt,{icon:ee,label:re,value:E}),t[88]=r.info.action,t[89]=ee,t[90]=E,t[91]=m):m=t[91],s=zt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[92]=c):c=t[92],l=r.info.permission,u=r.safety[e],d=It(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];let v;t[93]!==s||t[94]!==c||t[95]!==l||t[96]!==u||t[97]!==d?(v=(0,Z.jsx)(s,{icon:c,label:l,value:u,description:d}),t[93]=s,t[94]=c,t[95]=l,t[96]=u,t[97]=d,t[98]=v):v=t[98];let y;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(A,{className:`size-4`,"aria-hidden":!0}),t[99]=y):y=t[99];let b;t[100]!==n.projectId||t[101]!==r.info.noProject||t[102]!==o?(b=o.find(e=>e.id===n.projectId)?.name??r.info.noProject,t[100]=n.projectId,t[101]=r.info.noProject,t[102]=o,t[103]=b):b=t[103];let x;t[104]!==r.info.project||t[105]!==b?(x=(0,Z.jsx)(zt,{icon:y,label:r.info.project,value:b}),t[104]=r.info.project,t[105]=b,t[106]=x):x=t[106];let S;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(le,{className:`size-4`,"aria-hidden":!0}),t[107]=S):S=t[107];let C=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,w;t[108]!==r.info.conversation||t[109]!==C?(w=(0,Z.jsx)(zt,{icon:S,label:r.info.conversation,value:C}),t[108]=r.info.conversation,t[109]=C,t[110]=w):w=t[110];let ee;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[111]=ee):ee=t[111];let re=n.notificationPolicy===`all`?r.info.notifyAll:n.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,E;t[112]!==r.info.notifications||t[113]!==re?(E=(0,Z.jsx)(zt,{icon:ee,label:r.info.notifications,value:re}),t[112]=r.info.notifications,t[113]=re,t[114]=E):E=t[114];let D;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(R,{className:`size-4`,"aria-hidden":!0}),t[115]=D):D=t[115];let O=r.info.lastRun,k;t[116]!==n||t[117]!==r||t[118]!==a?(k=Xe(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=k):k=t[119];let j=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,M;t[120]!==r.info.lastRun||t[121]!==k||t[122]!==j?(M=(0,Z.jsx)(zt,{icon:D,label:O,value:k,valueTone:j}),t[120]=r.info.lastRun,t[121]=k,t[122]=j,t[123]=M):M=t[123];let ie;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(ie=n.state.consecutiveFailures?(0,Z.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[124]=n.state.consecutiveFailures,t[125]=n.state.lastError,t[126]=r.dashboard,t[127]=ie):ie=t[127];let P;t[128]!==r.info.technicalDetails||t[129]!==_?(P=_.length>0?(0,Z.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,Z.jsx)(`span`,{children:r.info.technicalDetails}),(0,Z.jsx)(ae,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:_.map(Rt)})]}):null,t[128]=r.info.technicalDetails,t[129]=_,t[130]=P):P=t[130];let F;t[131]!==v||t[132]!==x||t[133]!==w||t[134]!==E||t[135]!==M||t[136]!==ie||t[137]!==P||t[138]!==f||t[139]!==p||t[140]!==m?(F=(0,Z.jsxs)(`div`,{className:f,children:[p,m,v,x,w,E,M,ie,P]}),t[131]=v,t[132]=x,t[133]=w,t[134]=E,t[135]=M,t[136]=ie,t[137]=P,t[138]=f,t[139]=p,t[140]=m,t[141]=F):F=t[141];let oe;return t[142]!==F||t[143]!==h||t[144]!==g?(oe=(0,Z.jsxs)(`aside`,{className:h,children:[g,F]}),t[142]=F,t[143]=h,t[144]=g,t[145]=oe):oe=t[145],oe}function Rt(e){return(0,Z.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function zt(e){let t=(0,ye.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,c=s===void 0?`default`:s,l;t[0]===n?l=t[1]:(l=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=u);let f=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,p;t[4]===f?p=t[5]:(p=d(`mt-1 text-sm font-medium leading-5`,f),t[4]=f,t[5]=p);let m;t[6]!==p||t[7]!==i?(m=(0,Z.jsx)(`div`,{className:p,children:i}),t[6]=p,t[7]=i,t[8]=m):m=t[8];let h;t[9]!==a||t[10]!==o?(h=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=h):h=t[11];let g;t[12]!==u||t[13]!==m||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,m,h]}),t[12]=u,t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==l||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,g]}),t[16]=l,t[17]=g,t[18]=_):_=t[18],_}function Bt(e){let t=(0,ye.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Vt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Ht(e){let t=(0,ye.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ut(e){let t=(0,ye.c)(5),{icon:n,title:r}=e,i;t[0]===r?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex min-h-48 flex-col items-center justify-center rounded-lg border border-edge-subtle bg-surface-base text-fg-muted shadow-surface`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Wt(e){let t=(0,ye.c)(281),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:c,selectedWorkflow:l,workflowsLoading:u,browserWorkflows:f,selectedBrowserWorkflow:m,browserWorkflowsLoading:h,agentOptions:g,agentsLoading:_,language:v}=e,y=p(v).agentsSettings,b;t[0]===i?b=t[1]:(b=e=>i(t=>({...t,...e})),t[0]=i,t[1]=b);let x=b,S=Be(n.intervalValue,n.intervalUnit),C=Date.now(),w;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(w=[1,2,3],t[2]=w):w=t[2];let ee;t[3]!==S||t[4]!==C||t[5]!==v?(ee=w.map(e=>Ke(C+S*e,v,C)),t[3]=S,t[4]=C,t[5]=v,t[6]=ee):ee=t[6];let te=ee,ne,re;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==c?(ne=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=c[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},re=[n.actionMode,n.workflowId,i,c],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=c,t[11]=ne,t[12]=re):(ne=t[11],re=t[12]),(0,J.useEffect)(ne,re);let T,E;t[13]!==f||t[14]!==n.actionMode||t[15]!==n.browserWorkflowId||t[16]!==i?(T=()=>{if(n.actionMode!==`browser_recipe`||n.browserWorkflowId.trim())return;let e=f[0];e&&i(t=>({...t,browserWorkflowId:e.id,browserWorkflowInputs:_e(e)}))},E=[f,n.actionMode,n.browserWorkflowId,i],t[13]=f,t[14]=n.actionMode,t[15]=n.browserWorkflowId,t[16]=i,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,J.useEffect)(T,E);let D;t[19]===x?D=t[20]:(D=e=>x({name:e.target.value}),t[19]=x,t[20]=D);let O;t[21]!==n.name||t[22]!==D?(O=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:D}),t[21]=n.name,t[22]=D,t[23]=O):O=t[23];let k;t[24]!==r.form.name||t[25]!==O?(k=(0,Z.jsx)($,{label:r.form.name,children:O}),t[24]=r.form.name,t[25]=O,t[26]=k):k=t[26];let A;t[27]===x?A=t[28]:(A=e=>x({description:e.target.value}),t[27]=x,t[28]=A);let j;t[29]!==n.description||t[30]!==A?(j=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:A}),t[29]=n.description,t[30]=A,t[31]=j):j=t[31];let M;t[32]!==r.form.description||t[33]!==j?(M=(0,Z.jsx)($,{label:r.form.description,children:j}),t[32]=r.form.description,t[33]=j,t[34]=M):M=t[34];let N=r.form.project,ie=n.projectId,P;t[35]===x?P=t[36]:(P=e=>x({projectId:e.target.value}),t[35]=x,t[36]=P);let F;t[37]===r.form.noProject?F=t[38]:(F=(0,Z.jsx)(s,{value:``,children:r.form.noProject}),t[37]=r.form.noProject,t[38]=F);let I;t[39]===a?I=t[40]:(I=a.map(qt),t[39]=a,t[40]=I);let se;t[41]!==n.projectId||t[42]!==P||t[43]!==F||t[44]!==I?(se=(0,Z.jsxs)(o,{className:Q,value:ie,onChange:P,children:[F,I]}),t[41]=n.projectId,t[42]=P,t[43]=F,t[44]=I,t[45]=se):se=t[45];let ce;t[46]!==r.form.project||t[47]!==se?(ce=(0,Z.jsx)($,{label:N,children:se}),t[46]=r.form.project,t[47]=se,t[48]=ce):ce=t[48];let L;t[49]===r.form.trigger?L=t[50]:(L=(0,Z.jsx)(Jt,{title:r.form.trigger}),t[49]=r.form.trigger,t[50]=L);let R;t[51]===x?R=t[52]:(R=e=>x({triggerMode:e.target.value}),t[51]=x,t[52]=R);let le;t[53]===r.trigger.manual?le=t[54]:(le=(0,Z.jsx)(s,{value:`manual`,children:r.trigger.manual}),t[53]=r.trigger.manual,t[54]=le);let z;t[55]===r.trigger.once?z=t[56]:(z=(0,Z.jsx)(s,{value:`once`,children:r.trigger.once}),t[55]=r.trigger.once,t[56]=z);let B;t[57]===r.trigger.daily?B=t[58]:(B=(0,Z.jsx)(s,{value:`daily`,children:r.trigger.daily}),t[57]=r.trigger.daily,t[58]=B);let V;t[59]===r.trigger.weekly?V=t[60]:(V=(0,Z.jsx)(s,{value:`weekly`,children:r.trigger.weekly}),t[59]=r.trigger.weekly,t[60]=V);let ue;t[61]===r.trigger.interval?ue=t[62]:(ue=(0,Z.jsx)(s,{value:`interval`,children:r.trigger.interval}),t[61]=r.trigger.interval,t[62]=ue);let de;t[63]===r.trigger.customCron?de=t[64]:(de=(0,Z.jsx)(s,{value:`cron`,children:r.trigger.customCron}),t[63]=r.trigger.customCron,t[64]=de);let H;t[65]===r.trigger.webhook?H=t[66]:(H=(0,Z.jsx)(s,{value:`webhook`,children:r.trigger.webhook}),t[65]=r.trigger.webhook,t[66]=H);let U;t[67]===r.trigger.taskBlocked?U=t[68]:(U=(0,Z.jsx)(s,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[67]=r.trigger.taskBlocked,t[68]=U);let G;t[69]===r.trigger.noteCreated?G=t[70]:(G=(0,Z.jsx)(s,{value:`noteCreated`,children:r.trigger.noteCreated}),t[69]=r.trigger.noteCreated,t[70]=G);let fe;t[71]===r.trigger.workflowFailed?fe=t[72]:(fe=(0,Z.jsx)(s,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[71]=r.trigger.workflowFailed,t[72]=fe);let pe;t[73]===r.trigger.sessionUpdated?pe=t[74]:(pe=(0,Z.jsx)(s,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[73]=r.trigger.sessionUpdated,t[74]=pe);let q;t[75]===r.trigger.customEvent?q=t[76]:(q=(0,Z.jsx)(s,{value:`event`,children:r.trigger.customEvent}),t[75]=r.trigger.customEvent,t[76]=q);let he;t[77]!==n.triggerMode||t[78]!==R||t[79]!==le||t[80]!==z||t[81]!==B||t[82]!==V||t[83]!==ue||t[84]!==de||t[85]!==H||t[86]!==U||t[87]!==G||t[88]!==fe||t[89]!==pe||t[90]!==q?(he=(0,Z.jsxs)(o,{className:Q,value:n.triggerMode,onChange:R,children:[le,z,B,V,ue,de,H,U,G,fe,pe,q]}),t[77]=n.triggerMode,t[78]=R,t[79]=le,t[80]=z,t[81]=B,t[82]=V,t[83]=ue,t[84]=de,t[85]=H,t[86]=U,t[87]=G,t[88]=fe,t[89]=pe,t[90]=q,t[91]=he):he=t[91];let ge;t[92]!==n.onceAt||t[93]!==n.triggerMode||t[94]!==r.form.onceAt||t[95]!==x?(ge=n.triggerMode===`once`?(0,Z.jsx)($,{label:r.form.onceAt,children:(0,Z.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>x({onceAt:e.target.value})})}):null,t[92]=n.onceAt,t[93]=n.triggerMode,t[94]=r.form.onceAt,t[95]=x,t[96]=ge):ge=t[96];let be;t[97]!==n.time||t[98]!==n.triggerMode||t[99]!==n.weekday||t[100]!==r.form.day||t[101]!==r.form.time||t[102]!==r.weekdays||t[103]!==x?(be=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.time,children:(0,Z.jsx)(W,{value:n.time,onChange:e=>x({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(o,{className:Q,value:n.weekday,onChange:e=>x({weekday:e.target.value}),children:[(0,Z.jsx)(s,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(s,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(s,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(s,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(s,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(s,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(s,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[97]=n.time,t[98]=n.triggerMode,t[99]=n.weekday,t[100]=r.form.day,t[101]=r.form.time,t[102]=r.weekdays,t[103]=x,t[104]=be):be=t[104];let xe=n.triggerMode===`interval`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsx)($,{label:r.form.intervalEvery,children:(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Z.jsx)(`input`,{className:Q,type:`number`,min:6e4/Be(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>x({intervalValue:e.target.value})}),(0,Z.jsxs)(o,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;x({intervalValue:Ve(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(s,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(s,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(s,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(s,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Qe.map(e=>{let t=Be(e.value,e.unit),n=t===S;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:d(`rounded-full border px-2.5 py-1 text-xs transition-colors`,n?`border-accent bg-accent/10 text-accent`:`border-edge-subtle text-fg-muted hover:border-edge hover:bg-surface-hover hover:text-fg`),onClick:()=>x({intervalValue:e.value,intervalUnit:e.unit}),children:He(t,v)},`${e.value}:${e.unit}`)})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:Ue(S,v)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,te.join(v===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,Se;t[105]!==n.cronExpr||t[106]!==n.triggerMode||t[107]!==r.form.expression||t[108]!==x?(Se=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>x({cronExpr:e.target.value})})}):null,t[105]=n.cronExpr,t[106]=n.triggerMode,t[107]=r.form.expression,t[108]=x,t[109]=Se):Se=t[109];let Ce;t[110]!==n.triggerMode||t[111]!==n.webhookSecretId||t[112]!==r.form.secretId||t[113]!==x?(Ce=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>x({webhookSecretId:e.target.value})})}):null,t[110]=n.triggerMode,t[111]=n.webhookSecretId,t[112]=r.form.secretId,t[113]=x,t[114]=Ce):Ce=t[114];let Y;t[115]!==n.eventPayloadMatch||t[116]!==n.eventSource||t[117]!==n.eventType||t[118]!==n.triggerMode||t[119]!==r.form.eventPayloadMatch||t[120]!==r.form.eventSource||t[121]!==r.form.eventType||t[122]!==r.form.invalidJsonObject||t[123]!==x?(Y=n.triggerMode===`event`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.eventType,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>x({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>x({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:d(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>x({eventPayloadMatch:e.target.value}),placeholder:`{
|
|
5
|
+
"status": "blocked"
|
|
6
|
+
}`}),at(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[115]=n.eventPayloadMatch,t[116]=n.eventSource,t[117]=n.eventType,t[118]=n.triggerMode,t[119]=r.form.eventPayloadMatch,t[120]=r.form.eventSource,t[121]=r.form.eventType,t[122]=r.form.invalidJsonObject,t[123]=x,t[124]=Y):Y=t[124];let we;t[125]===r.form.action?we=t[126]:(we=(0,Z.jsx)(Jt,{title:r.form.action}),t[125]=r.form.action,t[126]=we);let Te;t[127]!==n.timeoutSeconds||t[128]!==n.workflowId||t[129]!==x||t[130]!==c?(Te=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);x({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_recipe`?`600`:`1800`}:{},...t===`browser_recipe`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&c[0]?{workflowId:c[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[127]=n.timeoutSeconds,t[128]=n.workflowId,t[129]=x,t[130]=c,t[131]=Te):Te=t[131];let Ee;t[132]===r.action.runAgent?Ee=t[133]:(Ee=(0,Z.jsx)(s,{value:`agent`,children:r.action.runAgent}),t[132]=r.action.runAgent,t[133]=Ee);let De;t[134]===r.action.runWorkflow?De=t[135]:(De=(0,Z.jsx)(s,{value:`workflow`,children:r.action.runWorkflow}),t[134]=r.action.runWorkflow,t[135]=De);let Oe=v===`zh`?`浏览器自动化`:`Browser automation`,X;t[136]===Oe?X=t[137]:(X=(0,Z.jsx)(s,{value:`browser_recipe`,children:Oe}),t[136]=Oe,t[137]=X);let ke;t[138]!==n.actionMode||t[139]!==Te||t[140]!==Ee||t[141]!==De||t[142]!==X?(ke=(0,Z.jsxs)(o,{className:Q,value:n.actionMode,onChange:Te,children:[Ee,De,X]}),t[138]=n.actionMode,t[139]=Te,t[140]=Ee,t[141]=De,t[142]=X,t[143]=ke):ke=t[143];let Ae=n.actionMode===`browser_recipe`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(o,{className:Q,value:n.agentId,onChange:e=>x({agentId:e.target.value}),children:[(0,Z.jsx)(s,{value:``,children:_?r.form.loadingAgents:r.form.defaultAgent}),g.map(e=>(0,Z.jsx)(s,{value:e.id,children:oe(e,y)},e.id))]})}),je;t[144]!==f||t[145]!==h||t[146]!==n.actionMode||t[147]!==n.agentId||t[148]!==n.browserWorkflowId||t[149]!==n.browserWorkflowInputs||t[150]!==n.description||t[151]!==n.instruction||t[152]!==n.name||t[153]!==n.triggerMode||t[154]!==n.workflowId||t[155]!==n.workflowInput||t[156]!==r.form.instruction||t[157]!==r.form.loadingWorkflows||t[158]!==r.form.noWorkflows||t[159]!==r.form.triggeredRun||t[160]!==r.form.workflow||t[161]!==v||t[162]!==m||t[163]!==l||t[164]!==x||t[165]!==c||t[166]!==u?(je=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(K,{value:n.instruction,onApply:e=>x({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:v,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:d(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>x({instruction:e.target.value})})]}):n.actionMode===`workflow`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(o,{className:Q,value:n.workflowId,onChange:e=>x({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:u||c.length===0,children:[u?(0,Z.jsx)(s,{value:``,children:r.form.loadingWorkflows}):null,!u&&c.length===0?(0,Z.jsx)(s,{value:``,children:r.form.noWorkflows}):null,c.map(Kt)]})}),l?(0,Z.jsx)(me,{definition:l,language:v,value:n.workflowInput,onChange:e=>x({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>x({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:l.id,workflowTitle:l.title,workflowDescription:l.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:v===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(o,{className:Q,value:n.browserWorkflowId,onChange:e=>{let t=f.find(t=>t.id===e.target.value);x({browserWorkflowId:e.target.value,browserWorkflowInputs:t?_e(t):{}})},disabled:h||f.length===0,children:[f.length===0?(0,Z.jsx)(s,{value:``,children:v===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,f.map(Gt)]})}),m&&Object.keys(m.inputs).length>0?(0,Z.jsx)($,{label:v===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(ve,{workflow:m,values:n.browserWorkflowInputs,language:v,onChange:e=>x({browserWorkflowInputs:e})})}):null]}),t[144]=f,t[145]=h,t[146]=n.actionMode,t[147]=n.agentId,t[148]=n.browserWorkflowId,t[149]=n.browserWorkflowInputs,t[150]=n.description,t[151]=n.instruction,t[152]=n.name,t[153]=n.triggerMode,t[154]=n.workflowId,t[155]=n.workflowInput,t[156]=r.form.instruction,t[157]=r.form.loadingWorkflows,t[158]=r.form.noWorkflows,t[159]=r.form.triggeredRun,t[160]=r.form.workflow,t[161]=v,t[162]=m,t[163]=l,t[164]=x,t[165]=c,t[166]=u,t[167]=je):je=t[167];let Me;t[168]===r.form.advancedDescription?Me=t[169]:(Me=(0,Z.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[168]=r.form.advancedDescription,t[169]=Me);let Ne;t[170]!==r.form.advanced||t[171]!==Me?(Ne=(0,Z.jsxs)(`span`,{children:[r.form.advanced,Me]}),t[170]=r.form.advanced,t[171]=Me,t[172]=Ne):Ne=t[172];let Pe;t[173]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(ae,{className:`size-4 transition-transform group-open:rotate-180`}),t[173]=Pe):Pe=t[173];let Fe;t[174]===Ne?Fe=t[175]:(Fe=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[Ne,Pe]}),t[174]=Ne,t[175]=Fe);let Ie;t[176]!==n.actionMode||t[177]!==n.safetyMode||t[178]!==r.form.safety||t[179]!==r.safety||t[180]!==x?(Ie=n.actionMode===`browser_recipe`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jt,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(o,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;x({safetyMode:t})},children:[(0,Z.jsx)(s,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(s,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(s,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription})]})]}),t[176]=n.actionMode,t[177]=n.safetyMode,t[178]=r.form.safety,t[179]=r.safety,t[180]=x,t[181]=Ie):Ie=t[181];let Le;t[182]===r.form.results?Le=t[183]:(Le=(0,Z.jsx)(Jt,{title:r.form.results}),t[182]=r.form.results,t[183]=Le);let Re;t[184]===x?Re=t[185]:(Re=e=>x({conversationMode:e.target.value}),t[184]=x,t[185]=Re);let ze;t[186]===r.form.newConversation?ze=t[187]:(ze=(0,Z.jsx)(s,{value:`new_session`,children:r.form.newConversation}),t[186]=r.form.newConversation,t[187]=ze);let We;t[188]===r.form.continuousConversation?We=t[189]:(We=(0,Z.jsx)(s,{value:`continuous`,children:r.form.continuousConversation}),t[188]=r.form.continuousConversation,t[189]=We);let Ge;t[190]!==n.conversationMode||t[191]!==Re||t[192]!==ze||t[193]!==We?(Ge=(0,Z.jsxs)(o,{className:Q,value:n.conversationMode,onChange:Re,children:[ze,We]}),t[190]=n.conversationMode,t[191]=Re,t[192]=ze,t[193]=We,t[194]=Ge):Ge=t[194];let qe;t[195]!==r.form.conversation||t[196]!==Ge?(qe=(0,Z.jsx)($,{label:r.form.conversation,children:Ge}),t[195]=r.form.conversation,t[196]=Ge,t[197]=qe):qe=t[197];let Je;t[198]===x?Je=t[199]:(Je=e=>x({notificationPolicy:e.target.value}),t[198]=x,t[199]=Je);let Ye;t[200]===r.form.notifyAttention?Ye=t[201]:(Ye=(0,Z.jsx)(s,{value:`attention`,children:r.form.notifyAttention}),t[200]=r.form.notifyAttention,t[201]=Ye);let Xe;t[202]===r.form.notifyAll?Xe=t[203]:(Xe=(0,Z.jsx)(s,{value:`all`,children:r.form.notifyAll}),t[202]=r.form.notifyAll,t[203]=Xe);let Ze;t[204]===r.form.notifyNone?Ze=t[205]:(Ze=(0,Z.jsx)(s,{value:`none`,children:r.form.notifyNone}),t[204]=r.form.notifyNone,t[205]=Ze);let $e;t[206]!==n.notificationPolicy||t[207]!==Je||t[208]!==Ye||t[209]!==Xe||t[210]!==Ze?($e=(0,Z.jsxs)(o,{className:Q,value:n.notificationPolicy,onChange:Je,children:[Ye,Xe,Ze]}),t[206]=n.notificationPolicy,t[207]=Je,t[208]=Ye,t[209]=Xe,t[210]=Ze,t[211]=$e):$e=t[211];let et;t[212]!==r.form.notifications||t[213]!==$e?(et=(0,Z.jsx)($,{label:r.form.notifications,children:$e}),t[212]=r.form.notifications,t[213]=$e,t[214]=et):et=t[214];let tt;t[215]!==n.completionWebhookUrl||t[216]!==n.safetyMode||t[217]!==r.form.completionWebhook||t[218]!==x?(tt=n.safetyMode===`auto_apply`?(0,Z.jsx)($,{label:r.form.completionWebhook,children:(0,Z.jsx)(`input`,{className:Q,value:n.completionWebhookUrl,onChange:e=>x({completionWebhookUrl:e.target.value})})}):null,t[215]=n.completionWebhookUrl,t[216]=n.safetyMode,t[217]=r.form.completionWebhook,t[218]=x,t[219]=tt):tt=t[219];let nt;t[220]===r.form.reliability?nt=t[221]:(nt=(0,Z.jsx)(Jt,{title:r.form.reliability}),t[220]=r.form.reliability,t[221]=nt);let rt;t[222]===x?rt=t[223]:(rt=e=>x({timeoutSeconds:e.target.value}),t[222]=x,t[223]=rt);let it;t[224]!==n.timeoutSeconds||t[225]!==rt?(it=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:rt}),t[224]=n.timeoutSeconds,t[225]=rt,t[226]=it):it=t[226];let ot;t[227]!==r.form.timeoutSeconds||t[228]!==it?(ot=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:it}),t[227]=r.form.timeoutSeconds,t[228]=it,t[229]=ot):ot=t[229];let st;t[230]===x?st=t[231]:(st=e=>x({disableAfterFailures:e.target.value}),t[230]=x,t[231]=st);let ct;t[232]!==n.disableAfterFailures||t[233]!==st?(ct=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:st}),t[232]=n.disableAfterFailures,t[233]=st,t[234]=ct):ct=t[234];let lt;t[235]!==r.form.disableAfterFailures||t[236]!==ct?(lt=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:ct}),t[235]=r.form.disableAfterFailures,t[236]=ct,t[237]=lt):lt=t[237];let ut;t[238]!==ot||t[239]!==lt?(ut=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ot,lt]}),t[238]=ot,t[239]=lt,t[240]=ut):ut=t[240];let dt;t[241]===r.form.effectivePolicy?dt=t[242]:(dt=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[241]=r.form.effectivePolicy,t[242]=dt);let ft=n.timeoutSeconds||`—`,pt;t[243]!==r.form.executionDeadline||t[244]!==ft?(pt=(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,ft,`s`]}),t[243]=r.form.executionDeadline,t[244]=ft,t[245]=pt):pt=t[245];let mt;t[246]===r.form.downstreamTimeoutHint?mt=t[247]:(mt=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[246]=r.form.downstreamTimeoutHint,t[247]=mt);let ht;t[248]!==dt||t[249]!==pt||t[250]!==mt?(ht=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-muted/40 px-3 py-2.5`,children:[dt,pt,mt]}),t[248]=dt,t[249]=pt,t[250]=mt,t[251]=ht):ht=t[251];let gt;t[252]!==Ie||t[253]!==Le||t[254]!==qe||t[255]!==et||t[256]!==tt||t[257]!==nt||t[258]!==ut||t[259]!==ht?(gt=(0,Z.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[Ie,Le,qe,et,tt,nt,ut,ht]}),t[252]=Ie,t[253]=Le,t[254]=qe,t[255]=et,t[256]=tt,t[257]=nt,t[258]=ut,t[259]=ht,t[260]=gt):gt=t[260];let _t;t[261]!==Fe||t[262]!==gt?(_t=(0,Z.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[Fe,gt]}),t[261]=Fe,t[262]=gt,t[263]=_t):_t=t[263];let vt;return t[264]!==k||t[265]!==M||t[266]!==ce||t[267]!==L||t[268]!==he||t[269]!==ge||t[270]!==be||t[271]!==xe||t[272]!==Se||t[273]!==Ce||t[274]!==Y||t[275]!==we||t[276]!==ke||t[277]!==Ae||t[278]!==je||t[279]!==_t?(vt=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[k,M,ce,L,he,ge,be,xe,Se,Ce,Y,we,ke,Ae,je,_t]})}),t[264]=k,t[265]=M,t[266]=ce,t[267]=L,t[268]=he,t[269]=ge,t[270]=be,t[271]=xe,t[272]=Se,t[273]=Ce,t[274]=Y,t[275]=we,t[276]=ke,t[277]=Ae,t[278]=je,t[279]=_t,t[280]=vt):vt=t[280],vt}function Gt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function Kt(e){return(0,Z.jsx)(s,{value:e.id,children:e.title||e.name},e.id)}function qt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}var Q=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,ye.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Jt(e){let t=(0,ye.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(A,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{wt as AutomationsPage};
|
package/dist/gateway/static/root/assets/{binary-plugins-CVR5cUmS.js → binary-plugins-Bf1WROsh.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-preview-renderer-Cmo-5BP5.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
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"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-9zCa8KkW.js";import{Da as o,Ea as s}from"./index-BBw9QL0p.js";import{t as c}from"./preview-open-alternatives-DvsLigha.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let c=(0,u.useRef)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(c.current?.(),c.current=null,d(null),p(!1),!t||!n||!o||!r)return;let l=!1;return _(o,g(e,n)),(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-Cmo-5BP5.js`),__vite__mapDeps([0,1,2]));if(l)return;let u=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(o,t,{loadingText:u.attachmentPreviewPdfRendering,loadMoreHint:u.attachmentPreviewPdfLoadMore,onPageCount:s});c.current=e}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(o,t,{truncationNotice:u.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});c.current=e,l||p(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(o,t);c.current=e}}catch(e){l||d(e instanceof Error?e.message:String(e))}})(),()=>{l=!0,c.current?.(),c.current=null}},[t,n,o,r,e,s]),{error:l,excelTruncated:f}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=o(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,s]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||s({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(31),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;if(t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T),f){let n;t[17]===e?n=t[18]:(n=b(e),t[17]=e,t[18]=n);let r;t[19]!==e||t[20]!==n?(r=(0,p.jsx)(y,{props:e,message:n}),t[19]=e,t[20]=n,t[21]=r):r=t[21];let i;t[22]===f?i=t[23]:(i=(0,p.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),t[22]=f,t[23]=i);let a;return t[24]!==r||t[25]!==i?(a=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[r,i]}),t[24]=r,t[25]=i,t[26]=a):a=t[26],a}if(e.kind===`excel`){let n=m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,r;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[27]=r):r=t[27];let i;return t[28]===n?i=t[29]:(i=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[n,r]}),t[28]=n,t[29]=i),i}let E;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[30]=E):E=t[30],E}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,o=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,s):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==o?(u=o?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=o,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==o?(f=o?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=o,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
|
|
2
|
+
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"./preload-helper-zJ_50EbN.js";import{t as a}from"./messages-CySMn8WL.js";import{Da as o,Ea as s}from"./index-CrwXzRpA.js";import{t as c}from"./preview-open-alternatives-CXcIKVi9.js";import{t as l}from"./use-blob-object-url-D4BFuzZB.js";var u=e(t(),1),d=n();function f(e){let t=e.trim(),n=t.match(/^<pptx\s+filename="([^"]*)">\s*/),r=t;n&&(r=t.slice(n[0].length),r=r.replace(/\s*<\/pptx>\s*$/u,``).trim());let i=[],a=/<slide number="(\d+)">([\s\S]*?)<\/slide>/gu,o;for(;(o=a.exec(r))!==null;){let e=Number.parseInt(o[1],10),t=o[2].trim();i.push({slideNumber:e,text:t})}let s=[],c=/<!--([\s\S]*?)-->/gu,l;for(;(l=c.exec(r))!==null;)s.push(l[1].trim());return i.length===0?{ok:!1,raw:e}:{ok:!0,slides:i,notes:s}}var p=r();function m(e){let t=(0,d.c)(13),{text:n,slideLabel:r,emptySlideLabel:i}=e,a;t[0]===n?a=t[1]:(a=f(n),t[0]=n,t[1]=a);let o=a;if(!o.ok){let e;return t[2]===o.raw?e=t[3]:(e=(0,p.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg`,children:o.raw}),t[2]=o.raw,t[3]=e),e}let s;if(t[4]!==i||t[5]!==o.notes||t[6]!==o.slides||t[7]!==r){let e=[];if(o.notes.length>0){let n;t[9]===o.notes?n=t[10]:(n=o.notes.map(h),t[9]=o.notes,t[10]=n);let r;t[11]===n?r=t[12]:(r=(0,p.jsx)(`div`,{className:`mb-2 border-b border-edge-subtle pb-2 dark:border-edge`,role:`status`,children:n},`notes`),t[11]=n,t[12]=r),e.push(r)}for(let t of o.slides)e.push((0,p.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 dark:border-edge`,children:[(0,p.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-fg`,children:r(t.slideNumber)}),(0,p.jsx)(`div`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-fg`,children:t.text.length>0?t.text:i})]},t.slideNumber));s=(0,p.jsx)(`div`,{className:`flex flex-col gap-3`,children:e}),t[4]=i,t[5]=o.notes,t[6]=o.slides,t[7]=r,t[8]=s}else s=t[8];return s}function h(e){return(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e},e)}function g(e,t){return t===`pdf`?a(e).chat.attachmentPreviewPdfRendering:e===`zh`?t===`excel`?`正在加载电子表格…`:`正在加载文档…`:t===`excel`?`Loading spreadsheet...`:`Loading document...`}function _(e,t){e.innerHTML=``;let n=document.createElement(`p`);n.className=`p-4 text-sm text-fg-muted`,n.textContent=t,e.appendChild(n)}function v({language:e,buffer:t,kind:n,fileKey:r,containerEl:o,onPdfPageCount:s}){let c=(0,u.useRef)(null),[l,d]=(0,u.useState)(null),[f,p]=(0,u.useState)(!1);return(0,u.useLayoutEffect)(()=>{if(c.current?.(),c.current=null,d(null),p(!1),!t||!n||!o||!r)return;let l=!1;return _(o,g(e,n)),(async()=>{try{let r=await i(()=>import(`./attachment-preview-renderer-Cmo-5BP5.js`),__vite__mapDeps([0,1,2]));if(l)return;let u=a(e).chat;if(n===`pdf`){let{cleanup:e}=await r.renderPdfInContainer(o,t,{loadingText:u.attachmentPreviewPdfRendering,loadMoreHint:u.attachmentPreviewPdfLoadMore,onPageCount:s});c.current=e}else if(n===`excel`){let{cleanup:e,truncated:n}=await r.renderExcelInContainer(o,t,{truncationNotice:u.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)});c.current=e,l||p(n)}else if(n===`docx`){let{cleanup:e}=await r.renderDocxInContainer(o,t);c.current=e}}catch(e){l||d(e instanceof Error?e.message:String(e))}})(),()=>{l=!0,c.current?.(),c.current=null}},[t,n,o,r,e,s]),{error:l,excelTruncated:f}}function y(e){let t=(0,d.c)(12),{props:n,message:r}=e,i;t[0]===n.language?i=t[1]:(i=a(n.language),t[0]=n.language,t[1]=i);let o=i,s=n.descriptor.context===`workspace`,l=!!n.actions.onOpenWithSystemApp&&(n.actions.canOpenWithSystemApp??!0)&&s,u=s?o.workspace.openSystemApp:void 0,f=s?o.workspace.chooseApp:void 0,m;return t[2]!==o.chat.attachmentPreviewDownloadFull||t[3]!==r||t[4]!==n.actions.canChooseOpenWithApp||t[5]!==n.actions.onChooseOpenWithApp||t[6]!==n.actions.onDownload||t[7]!==n.actions.onOpenWithSystemApp||t[8]!==l||t[9]!==u||t[10]!==f?(m=(0,p.jsx)(c,{message:r,downloadLabel:o.chat.attachmentPreviewDownloadFull,onDownload:n.actions.onDownload,openSystemLabel:u,onOpenWithSystemApp:n.actions.onOpenWithSystemApp,canOpenWithSystemApp:l,chooseAppLabel:f,onChooseOpenWithApp:n.actions.onChooseOpenWithApp,canChooseOpenWithApp:n.actions.canChooseOpenWithApp}),t[2]=o.chat.attachmentPreviewDownloadFull,t[3]=r,t[4]=n.actions.canChooseOpenWithApp,t[5]=n.actions.onChooseOpenWithApp,t[6]=n.actions.onDownload,t[7]=n.actions.onOpenWithSystemApp,t[8]=l,t[9]=u,t[10]=f,t[11]=m):m=t[11],m}function b(e){let t=a(e.language);return e.descriptor.context===`workspace`?t.workspace.openElsewhereHint:t.chat.attachmentPreviewOpenElsewhereHint}function x(e){let t=(0,d.c)(24),n;bb0:{if(!e.binaryBuffer){n=null;break bb0}let r;if(t[0]!==e.binaryBuffer||t[1]!==e.descriptor.fileName||t[2]!==e.descriptor.mimeType){let n=o(e.descriptor.fileName)??e.descriptor.mimeType??`image/png`;r=new Blob([e.binaryBuffer],{type:n}),t[0]=e.binaryBuffer,t[1]=e.descriptor.fileName,t[2]=e.descriptor.mimeType,t[3]=r}else r=t[3];n=r}let r=l(n),i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(i={x:0,y:0},t[4]=i):i=t[4];let[a,s]=(0,u.useState)(i),c=(0,u.useRef)(null),f=(0,u.useRef)(null),m=e.controls?.zoom??1,h=e.controls?.rotation??0,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{s({x:0,y:0})},t[5]=g):g=t[5];let _;if(t[6]!==e.descriptor.id||t[7]!==h?(_=[e.descriptor.id,h],t[6]=e.descriptor.id,t[7]=h,t[8]=_):_=t[8],(0,u.useEffect)(g,_),!r)return null;let v;t[9]!==a.x||t[10]!==a.y?(v=e=>{e.button===0&&(c.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,ox:a.x,oy:a.y},e.currentTarget.setPointerCapture(e.pointerId))},t[9]=a.x,t[10]=a.y,t[11]=v):v=t[11];let y,b,x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||s({x:t.ox+e.clientX-t.x,y:t.oy+e.clientY-t.y})},b=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},x=e=>{c.current?.pointerId===e.pointerId&&(c.current=null)},t[12]=y,t[13]=b,t[14]=x):(y=t[12],b=t[13],x=t[14]);let S=`translate(${a.x}px, ${a.y}px) scale(${m}) rotate(${h}deg)`,C=m>1?`grab`:`default`,w;t[15]!==S||t[16]!==C?(w={transform:S,cursor:C},t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==r||t[19]!==w?(T=(0,p.jsx)(`img`,{src:r,alt:``,draggable:!1,className:`max-h-full max-w-full select-none object-contain transition-transform duration-100`,style:w}),t[18]=r,t[19]=w,t[20]=T):T=t[20];let E;return t[21]!==T||t[22]!==v?(E=(0,p.jsx)(`div`,{ref:f,className:`flex min-h-0 flex-1 touch-none items-center justify-center overflow-hidden bg-surface-base px-3 py-4 dark:bg-surface-hover/20`,onPointerDown:v,onPointerMove:y,onPointerUp:b,onPointerCancel:x,children:T}),t[21]=T,t[22]=v,t[23]=E):E=t[23],E}function S(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`pdf`}),t[0]=e,t[1]=n),n}function C(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`docx`}),t[0]=e,t[1]=n),n}function w(e){let t=(0,d.c)(2),n;return t[0]===e?n=t[1]:(n=(0,p.jsx)(T,{...e,kind:`excel`}),t[0]=e,t[1]=n),n}function T(e){let t=(0,d.c)(31),n=(0,u.useRef)(null),[r,i]=(0,u.useState)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{n.current=e,i(e)},t[0]=o):o=t[0];let s=o,c=e.kind===`pdf`?e.controls?.setPageCount:void 0,l;t[1]!==r||t[2]!==e.binaryBuffer||t[3]!==e.descriptor.id||t[4]!==e.kind||t[5]!==e.language||t[6]!==c?(l={language:e.language,buffer:e.binaryBuffer,kind:e.kind,fileKey:e.descriptor.id,containerEl:r,onPdfPageCount:c},t[1]=r,t[2]=e.binaryBuffer,t[3]=e.descriptor.id,t[4]=e.kind,t[5]=e.language,t[6]=c,t[7]=l):l=t[7];let{error:f,excelTruncated:m}=v(l),h=a(e.language),g=e.kind===`pdf`?e.controls?.zoom??1:1,_=e.kind===`pdf`?e.controls?.rotation??0:0,x=e.kind===`pdf`?e.controls?.page??1:1,S,C;t[8]!==e.kind||t[9]!==_||t[10]!==g?(S=()=>{e.kind!==`pdf`||!n.current||(n.current.style.setProperty(`--xopc-preview-pdf-zoom`,String(g)),n.current.style.setProperty(`--xopc-preview-pdf-rotation`,`${_}deg`),n.current.querySelectorAll(`[data-pdf-page]`).forEach(e=>{let t=e.dataset.pdfBaseHeight??(e.offsetHeight>0?String(e.offsetHeight):void 0);t&&(e.dataset.pdfBaseHeight=t,e.style.height=`${Number(t)*g}px`),e.style.transformOrigin=`top center`,e.style.transform=`scale(${g}) rotate(${_}deg)`,e.style.marginBottom=g===1?``:`${Math.max(16,24*g)}px`}))},C=[e.kind,_,g],t[8]=e.kind,t[9]=_,t[10]=g,t[11]=S,t[12]=C):(S=t[11],C=t[12]),(0,u.useEffect)(S,C);let w,T;if(t[13]!==x||t[14]!==e.kind?(w=()=>{e.kind!==`pdf`||!n.current||n.current.querySelector(`[data-pdf-page="${x}"]`)?.scrollIntoView({block:`start`})},T=[x,e.kind],t[13]=x,t[14]=e.kind,t[15]=w,t[16]=T):(w=t[15],T=t[16]),(0,u.useEffect)(w,T),f){let n;t[17]===e?n=t[18]:(n=b(e),t[17]=e,t[18]=n);let r;t[19]!==e||t[20]!==n?(r=(0,p.jsx)(y,{props:e,message:n}),t[19]=e,t[20]=n,t[21]=r):r=t[21];let i;t[22]===f?i=t[23]:(i=(0,p.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:f}),t[22]=f,t[23]=i);let a;return t[24]!==r||t[25]!==i?(a=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[r,i]}),t[24]=r,t[25]=i,t[26]=a):a=t[26],a}if(e.kind===`excel`){let n=m?(0,p.jsx)(y,{props:e,message:h.chat.attachmentPreviewExcelTruncated.replaceAll(`{rows}`,`500`).replaceAll(`{cols}`,`64`)}):null,r;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[27]=r):r=t[27];let i;return t[28]===n?i=t[29]:(i=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[n,r]}),t[28]=n,t[29]=i),i}let E;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(`div`,{ref:s,className:`docx-preview-host min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-panel p-2 dark:border-edge`}),t[30]=E):E=t[30],E}function E(e){let t=(0,d.c)(23),n;t[0]===e.language?n=t[1]:(n=a(e.language),t[0]=e.language,t[1]=n);let r=n,i=e.extractedText||r.chat.attachmentPreviewNoText,o=!!e.extractedTextTruncated||i.length>3e5,c;t[2]===i?c=t[3]:(c=i.length>3e5?i.slice(0,s):i,t[2]=i,t[3]=c);let l=c,u;t[4]!==r.chat.attachmentPreviewOpenElsewhereTruncated||t[5]!==e||t[6]!==o?(u=o?(0,p.jsx)(y,{props:e,message:r.chat.attachmentPreviewOpenElsewhereTruncated}):null,t[4]=r.chat.attachmentPreviewOpenElsewhereTruncated,t[5]=e,t[6]=o,t[7]=u):u=t[7];let f;t[8]!==r.chat.attachmentPreviewPptxTruncated||t[9]!==o?(f=o?(0,p.jsx)(`p`,{className:`mb-2 border-b border-edge-subtle pb-2 text-xs text-fg-muted dark:border-edge`,children:r.chat.attachmentPreviewPptxTruncated}):null,t[8]=r.chat.attachmentPreviewPptxTruncated,t[9]=o,t[10]=f):f=t[10];let h;t[11]===r.chat.attachmentPreviewPptxSlide?h=t[12]:(h=e=>r.chat.attachmentPreviewPptxSlide.replaceAll(`{n}`,String(e)),t[11]=r.chat.attachmentPreviewPptxSlide,t[12]=h);let g;t[13]!==r.chat.attachmentPreviewPptxEmptySlide||t[14]!==h||t[15]!==l?(g=(0,p.jsx)(m,{text:l,slideLabel:h,emptySlideLabel:r.chat.attachmentPreviewPptxEmptySlide}),t[13]=r.chat.attachmentPreviewPptxEmptySlide,t[14]=h,t[15]=l,t[16]=g):g=t[16];let _;t[17]!==f||t[18]!==g?(_=(0,p.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[f,g]}),t[17]=f,t[18]=g,t[19]=_):_=t[19];let v;return t[20]!==u||t[21]!==_?(v=(0,p.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:[u,_]}),t[20]=u,t[21]=_,t[22]=v):v=t[22],v}export{C as DocxPreviewPluginView,x as InteractiveImagePreview,S as PdfPreviewPluginView,E as PptxPreviewPluginView,w as SpreadsheetPreviewPluginView};
|