tide-commander 1.96.0 → 1.98.0

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.
Files changed (74) hide show
  1. package/dist/assets/{BossLogsModal-BFy6Rxdn.js → BossLogsModal-P6MiZVuY.js} +1 -1
  2. package/dist/assets/{BossSpawnModal-KQyJYj_B.js → BossSpawnModal-DZJ1Ngsz.js} +1 -1
  3. package/dist/assets/{ControlsModal-W_ghuG_Q.js → ControlsModal-BjV0a1kc.js} +1 -1
  4. package/dist/assets/{DockerLogsModal-valTcuRy.js → DockerLogsModal-DtddubKa.js} +1 -1
  5. package/dist/assets/EmbeddedEditor-ByRepTwR.js +33 -0
  6. package/dist/assets/{GmailOAuthSetup-AcW1zAlk.js → GmailOAuthSetup-DS6NmxUi.js} +1 -1
  7. package/dist/assets/{GoogleOAuthSetup-C9uZ46Oe.js → GoogleOAuthSetup-kQyKInRW.js} +1 -1
  8. package/dist/assets/{IframeModal-CmWv7GXl.js → IframeModal-BuTPDTx1.js} +1 -1
  9. package/dist/assets/{IntegrationsPanel-CNvzosgx.js → IntegrationsPanel-Bm19ZAd6.js} +2 -2
  10. package/dist/assets/{LogViewerModal-imTE-619.js → LogViewerModal-DFlUtkDD.js} +1 -1
  11. package/dist/assets/{MonitoringModal-DLxBY738.js → MonitoringModal-BEEPwGu5.js} +1 -1
  12. package/dist/assets/{PM2LogsModal-S4n0D11V.js → PM2LogsModal-Di5MjyxZ.js} +1 -1
  13. package/dist/assets/{RestoreArchivedAreaModal-B32sqCxN.js → RestoreArchivedAreaModal-CNjmR7BX.js} +1 -1
  14. package/dist/assets/{Scene2DCanvas-bEu0UPUm.js → Scene2DCanvas-CA29sh9R.js} +1 -1
  15. package/dist/assets/{SceneManager-Ce3X0awy.js → SceneManager-duyCA_TD.js} +1 -1
  16. package/dist/assets/{SkillsPanel-Dj22nDU8.js → SkillsPanel-CkV4ci4Q.js} +1 -1
  17. package/dist/assets/SlackMultiInstanceSetup-iHZNQX3B.js +2 -0
  18. package/dist/assets/{SpawnModal-F9nspdWd.js → SpawnModal-bzQlnSQy.js} +1 -1
  19. package/dist/assets/{SubordinateAssignmentModal-DT31CkPr.js → SubordinateAssignmentModal-D6Ak_XQ1.js} +1 -1
  20. package/dist/assets/TriggerManagerPanel-CT8aMQ5P.js +9 -0
  21. package/dist/assets/{WorkflowEditorPanel-BYRi0cU9.js → WorkflowEditorPanel-DcV9ErU4.js} +1 -1
  22. package/dist/assets/{index-ByfAbkqv.js → index-BQQV5Xax.js} +1 -1
  23. package/dist/assets/index-Ba8umpS_.js +1 -0
  24. package/dist/assets/{index-B9G4hrFR.js → index-C0fIrrTS.js} +1 -1
  25. package/dist/assets/index-CDHzSAgq.js +1 -0
  26. package/dist/assets/index-CK8NcQSU.css +1 -0
  27. package/dist/assets/{index-CLr8DpLX.js → index-Cirz97EK.js} +2 -2
  28. package/dist/assets/index-Cnj2pM08.js +19 -0
  29. package/dist/assets/{index-DqZhHROd.js → index-D2L5oc5D.js} +1 -1
  30. package/dist/assets/{index-DkjWoHhy.js → index-DR7uaDtK.js} +1 -1
  31. package/dist/assets/{index-BmjrPptb.js → index-Dww2MWLN.js} +1 -1
  32. package/dist/assets/main-CD03IZnY.css +1 -0
  33. package/dist/assets/main-XbhAPjbi.js +214 -0
  34. package/dist/assets/{web-D-a3phls.js → web-C-JnApw7.js} +1 -1
  35. package/dist/assets/{web-CLuvtqCm.js → web-C4LpSGoH.js} +1 -1
  36. package/dist/assets/{web-DM2bFWBN.js → web-CaPUSaID.js} +1 -1
  37. package/dist/index.html +2 -2
  38. package/dist/locales/en/config.json +44 -0
  39. package/dist/locales/en/terminal.json +10 -0
  40. package/dist/src/packages/server/claude/backend.js +42 -0
  41. package/dist/src/packages/server/claude/permission-prompt-server.mjs +188 -0
  42. package/dist/src/packages/server/claude/runner/process-lifecycle.js +3 -0
  43. package/dist/src/packages/server/claude/runner/stdout-pipeline.js +8 -0
  44. package/dist/src/packages/server/claude/runner/tmux-helper.js +14 -0
  45. package/dist/src/packages/server/data/event-queries.js +143 -1
  46. package/dist/src/packages/server/data/migrations/007_whatsapp_messages.sql +48 -0
  47. package/dist/src/packages/server/index.js +1 -0
  48. package/dist/src/packages/server/integrations/gmail/gmail-client.js +139 -24
  49. package/dist/src/packages/server/integrations/gmail/gmail-routes.js +162 -0
  50. package/dist/src/packages/server/integrations/slack/slack-config.js +13 -0
  51. package/dist/src/packages/server/integrations/slack/slack-trigger-handler.js +12 -4
  52. package/dist/src/packages/server/integrations/whatsapp/whatsapp-routes.js +81 -0
  53. package/dist/src/packages/server/integrations/whatsapp/whatsapp-trigger-handler.js +29 -0
  54. package/dist/src/packages/server/routes/agent-prompt.js +57 -0
  55. package/dist/src/packages/server/routes/index.js +6 -1
  56. package/dist/src/packages/server/routes/skills.js +193 -0
  57. package/dist/src/packages/server/routes/trigger-routes.js +74 -17
  58. package/dist/src/packages/server/routes/webhook-signatures.js +20 -7
  59. package/dist/src/packages/server/services/agent-prompt-service.js +100 -0
  60. package/dist/src/packages/server/services/index.js +1 -0
  61. package/dist/src/packages/server/websocket/handler.js +2 -1
  62. package/dist/src/packages/server/websocket/listeners/agent-prompt-listeners.js +13 -0
  63. package/dist/src/packages/server/websocket/listeners/index.js +2 -0
  64. package/dist/src/packages/shared/whatsapp-types.js +1 -0
  65. package/package.json +2 -2
  66. package/dist/assets/EmbeddedEditor-CIsFWo6A.js +0 -1
  67. package/dist/assets/SlackMultiInstanceSetup-J9NdRY0U.js +0 -2
  68. package/dist/assets/TriggerManagerPanel-CVJ9ozHz.js +0 -9
  69. package/dist/assets/index-BPy8NE5B.js +0 -51
  70. package/dist/assets/index-BdGz_GAe.css +0 -1
  71. package/dist/assets/index-C5wC_Xis.js +0 -1
  72. package/dist/assets/index-DJm7oMXk.js +0 -1
  73. package/dist/assets/main-9uTEp9Lr.js +0 -214
  74. package/dist/assets/main-BfT_95fk.css +0 -1
@@ -0,0 +1 @@
1
+ import{u as J,a as Z,r,s as h,j as e,D as de,I as H,C as oe,b as me,c as be,d as ue,g as he,e as _e,Q as pe,R as xe}from"./main-XbhAPjbi.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const fe=({building:a,connections:x,activeConnectionId:l,activeDatabase:c,collapsed:y,onToggleCollapse:f,onConnectionChange:Q,onDatabaseChange:S,onInsertTable:A,onSelectTableQuery:M})=>{const{t:m}=J(["terminal"]),w=Z(a.id),[P,R]=r.useState(new Set),[k,n]=r.useState(""),[d,g]=r.useState(""),[$,q]=r.useState(!1),[U,F]=r.useState(null),K=r.useRef(null),C=r.useRef(null),O=r.useRef(null),N=l?w.databases.get(l)??[]:[],I=l&&c?`${l}:${c}`:"",j=I?w.tables.get(I)??[]:[],p=l?w.connectionStatus.get(l):void 0,D=r.useMemo(()=>{if(!k.trim())return N;const t=k.toLowerCase();return N.filter(o=>o.toLowerCase().includes(t))},[N,k]),b=r.useMemo(()=>{if(!d.trim())return j;const t=d.toLowerCase();return j.filter(o=>o.name.toLowerCase().includes(t))},[j,d]);r.useEffect(()=>{const t=o=>{C.current&&!C.current.contains(o.target)&&q(!1)};return $&&document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[$]),r.useEffect(()=>{l&&!p&&h.testDatabaseConnection(a.id,l)},[a.id,l,p]),r.useEffect(()=>{l&&(p!=null&&p.connected)&&N.length===0&&h.listDatabases(a.id,l)},[a.id,l,p==null?void 0:p.connected,N.length]),r.useEffect(()=>{l&&c&&j.length===0&&h.listTables(a.id,l,c)},[a.id,l,c,j.length]),r.useEffect(()=>{F(null),g("")},[l,c]);const _=r.useCallback(t=>{R(o=>{const T=new Set(o);if(T.has(t))T.delete(t);else if(T.add(t),l&&c){const v=`${l}:${c}:${t}`;w.tableSchemas.has(v)||h.getTableSchema(a.id,l,c,t)}return T})},[a.id,l,c,w.tableSchemas]),z=t=>{if(!l||!c)return null;const o=`${l}:${c}:${t}`;return w.tableSchemas.get(o)};return y?e.jsx("div",{className:"database-sidebar database-sidebar--collapsed",children:e.jsx("button",{className:"database-sidebar__toggle",onClick:f,title:m("terminal:database.expandSidebar"),children:"»"})}):e.jsxs("div",{className:"database-sidebar",children:[e.jsxs("div",{className:"database-sidebar__header",children:[e.jsx("span",{children:m("terminal:database.explorer")}),e.jsx("button",{className:"database-sidebar__toggle",onClick:f,title:m("terminal:database.collapseSidebar"),children:"«"})]}),e.jsxs("div",{className:"database-sidebar__section",children:[e.jsx("div",{className:"database-sidebar__section-title",children:m("terminal:database.connection")}),e.jsx("select",{className:"database-sidebar__select",value:l||"",onChange:t=>Q(t.target.value),children:x.length===0?e.jsx("option",{value:"",children:m("terminal:database.noConnections")}):x.map(t=>{var o;return e.jsxs("option",{value:t.id,children:[((o=de[t.engine])==null?void 0:o.icon)??"🗄️"," ",t.name]},t.id)})}),p&&e.jsx("div",{className:`database-sidebar__status ${p.connected?"database-sidebar__status--connected":"database-sidebar__status--error"}`,children:p.connected?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"database-sidebar__status-icon",children:"✓"}),m("terminal:database.connected"),p.serverVersion&&e.jsxs("span",{className:"database-sidebar__version",children:["(",p.serverVersion,")"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"database-sidebar__status-icon",children:"✗"}),p.error||m("terminal:database.disconnected")]})})]}),N.length>0&&e.jsxs("div",{className:"database-sidebar__section",children:[e.jsx("div",{className:"database-sidebar__section-title",children:m("terminal:database.databaseTitle")}),e.jsxs("div",{className:"database-sidebar__searchable-select",ref:C,children:[e.jsx("input",{ref:K,className:"database-sidebar__search-input",type:"text",value:$?k:c||"",placeholder:m("terminal:database.selectDatabase"),onChange:t=>{n(t.target.value),$||q(!0)},onFocus:()=>{q(!0),n("")},onKeyDown:t=>{var o,T;t.key==="Escape"?(q(!1),n(""),(o=K.current)==null||o.blur()):t.key==="Enter"&&D.length===1&&(S(D[0]),q(!1),n(""),(T=K.current)==null||T.blur())}}),$&&e.jsx("div",{className:"database-sidebar__dropdown",children:D.length===0?e.jsx("div",{className:"database-sidebar__dropdown-empty",children:"No matches"}):D.map(t=>e.jsx("div",{className:`database-sidebar__dropdown-item ${t===c?"database-sidebar__dropdown-item--active":""}`,onMouseDown:o=>{o.preventDefault(),S(t),q(!1),n("")},children:t},t))})]})]}),j.length>0&&e.jsxs("div",{className:"database-sidebar__section database-sidebar__section--tables",children:[e.jsx("div",{className:"database-sidebar__section-title",children:d.trim()?m("terminal:database.tablesCount",{count:b.length})+` / ${j.length}`:m("terminal:database.tablesCount",{count:j.length})}),e.jsxs("div",{className:"database-sidebar__table-filter",children:[e.jsx("input",{ref:O,className:"database-sidebar__table-filter-input",type:"text",value:d,placeholder:m("terminal:database.filterTables"),onChange:t=>g(t.target.value),onKeyDown:t=>{var o;t.key==="Escape"&&(d?g(""):(o=O.current)==null||o.blur(),t.stopPropagation())}}),d&&e.jsx("button",{className:"database-sidebar__table-filter-clear",onClick:()=>{var t;g(""),(t=O.current)==null||t.focus()},title:"Clear filter",children:"×"})]}),e.jsxs("div",{className:"database-sidebar__tables",children:[d.trim()&&b.length===0&&e.jsx("div",{className:"database-sidebar__tables-empty",children:m("terminal:database.noTablesMatch")}),b.map(t=>{const o=P.has(t.name),T=o?z(t.name):null;return e.jsxs("div",{className:"database-sidebar__table",children:[e.jsxs("div",{className:"database-sidebar__table-header",children:[e.jsx("button",{className:"database-sidebar__table-expand",onClick:()=>_(t.name),title:o?"Collapse table schema":"Expand table schema",children:e.jsx(H,{name:o?"caret-down":"caret-right",size:10})}),e.jsx("span",{className:"database-sidebar__table-icon",children:e.jsx(H,{name:t.type==="view"?"eye":"clipboard",size:12})}),e.jsx("span",{className:`database-sidebar__table-name ${U===t.name?"database-sidebar__table-name--selected":""}`,onClick:()=>F(t.name),onDoubleClick:()=>{F(t.name),M(t.name)},children:t.name}),e.jsx("button",{className:"database-sidebar__table-insert",onClick:v=>{v.stopPropagation(),A(t.name)},title:m("terminal:database.insertTableName"),children:"+"})]}),o&&T&&e.jsx("div",{className:"database-sidebar__table-columns",children:T.columns.map(v=>e.jsxs("div",{className:"database-sidebar__column",onClick:()=>A(v.name),title:`${v.type}${v.nullable?" NULL":" NOT NULL"}${v.primaryKey?" PK":""}`,children:[e.jsx("span",{className:"database-sidebar__column-icon",children:v.primaryKey?e.jsx(H,{name:"key",size:11}):null}),e.jsx("span",{className:"database-sidebar__column-name",children:v.name}),e.jsx("span",{className:"database-sidebar__column-type",children:v.type})]},v.name))})]},t.name)})]})]})]})},je=({buildingId:a,history:x,onLoadQuery:l})=>{const{t:c}=J(["terminal","common"]),[y,f]=r.useState(""),[Q,S]=r.useState(!1),[A,M]=r.useState(!1),m=r.useMemo(()=>{let n=x;if(Q&&(n=n.filter(d=>d.favorite)),y.trim()){const d=y.toLowerCase();n=n.filter(g=>g.query.toLowerCase().includes(d)||g.database.toLowerCase().includes(d))}return n},[x,Q,y]),w=n=>{const d=new Date(n),$=new Date().getTime()-d.getTime();return $<1440*60*1e3?d.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):$<10080*60*1e3?d.toLocaleDateString([],{weekday:"short"})+" "+d.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):d.toLocaleDateString([],{month:"short",day:"numeric"})},P=r.useCallback((n,d)=>{d.stopPropagation(),h.toggleQueryFavorite(a,n)},[a]),R=r.useCallback((n,d)=>{d.stopPropagation(),h.deleteQueryFromHistory(a,n)},[a]),k=r.useCallback(()=>{M(!0)},[]);return x.length===0?e.jsxs("div",{className:"query-history query-history--empty",children:[e.jsx("p",{children:c("terminal:database.noHistory")}),e.jsx("p",{children:c("terminal:database.queriesAppearHere")})]}):e.jsxs("div",{className:"query-history",children:[e.jsxs("div",{className:"query-history__toolbar",children:[e.jsx("input",{type:"text",className:"query-history__search",placeholder:c("terminal:database.searchQueries"),value:y,onChange:n=>f(n.target.value)}),e.jsxs("label",{className:"query-history__filter",children:[e.jsx("input",{type:"checkbox",checked:Q,onChange:n=>S(n.target.checked)}),c("terminal:database.favoritesOnly")]}),e.jsx("button",{className:"query-history__clear",onClick:k,title:c("terminal:database.clearAll"),children:c("terminal:database.clearAll")})]}),e.jsxs("div",{className:"query-history__list",children:[m.map(n=>e.jsxs("div",{className:`query-history__item ${n.status==="error"?"query-history__item--error":""}`,onClick:()=>l(n.query),children:[e.jsxs("div",{className:"query-history__item-header",children:[e.jsx("span",{className:`query-history__status ${n.status==="success"?"query-history__status--success":"query-history__status--error"}`,children:e.jsx(H,{name:n.status==="success"?"check":"cross",size:12})}),e.jsx("span",{className:"query-history__database",children:n.database}),e.jsx("span",{className:"query-history__date",children:w(n.executedAt)}),e.jsxs("span",{className:"query-history__duration",children:[n.duration,"ms"]}),n.rowCount!==void 0&&e.jsx("span",{className:"query-history__row-count",children:c("terminal:database.rowCount",{count:n.rowCount})})]}),e.jsx("div",{className:"query-history__query",children:e.jsx("code",{children:n.query.length>200?n.query.substring(0,200)+"...":n.query})}),n.error&&e.jsx("div",{className:"query-history__error",children:n.error}),e.jsxs("div",{className:"query-history__actions",children:[e.jsx("button",{className:`query-history__favorite ${n.favorite?"query-history__favorite--active":""}`,onClick:d=>P(n.id,d),title:n.favorite?c("terminal:database.removeFromFavorites"):c("terminal:database.addToFavorites"),children:e.jsx(H,{name:"star",size:12,weight:n.favorite?"fill":"regular",color:n.favorite?"#facc15":void 0})}),e.jsx("button",{className:"query-history__delete",onClick:d=>R(n.id,d),title:c("terminal:database.deleteFromHistory"),children:e.jsx(H,{name:"trash",size:12})})]})]},n.id)),m.length===0&&e.jsx("div",{className:"query-history__no-results",children:c("terminal:database.noQueriesMatch")})]}),e.jsx(oe,{isOpen:A,title:c("terminal:database.clearAll"),message:c("terminal:database.confirmClearHistory"),confirmLabel:c("terminal:database.clearAll"),cancelLabel:c("common:buttons.cancel"),variant:"danger",onConfirm:()=>h.clearQueryHistory(a),onClose:()=>M(!1)})]})},ye=({tabs:a,activeTabId:x,onTabClick:l,onTabClose:c})=>{const{t:y}=J(["terminal"]);return e.jsx("div",{className:"database-tabs",children:a.map(f=>e.jsxs("div",{className:`database-tabs__tab ${x===f.id?"database-tabs__tab--active":""}`,children:[e.jsxs("button",{className:"database-tabs__tab-label",onClick:()=>l(f),title:`${f.connectionName} / ${f.database}`,children:[f.database,e.jsx("span",{className:"database-tabs__tab-connection",children:f.connectionName})]}),e.jsx("button",{className:"database-tabs__tab-close",onClick:()=>c(f.id),title:y("terminal:database.closeTab"),"aria-label":`Close ${f.database} tab`,children:"×"})]},f.id))})},ee=a=>`db-panel-${a}`;function Ne(a){try{const x=localStorage.getItem(ee(a));return x?JSON.parse(x):{}}catch{return{}}}function ve(a,x){try{localStorage.setItem(ee(a),JSON.stringify(x))}catch{}}const ge=({building:a,onClose:x})=>{var B,Y,W,X;const{t:l}=J(["terminal","common"]),c=Z(a.id),y=me(a.id),f=be(a.id),Q=ue(a.id),S=r.useRef(Ne(a.id)),A=r.useRef(null),M=r.useRef(0),m=((B=a.database)==null?void 0:B.connections)??[],w=(s,i)=>`${s}:${i}`,P=s=>s?(S.current.queries??{})[s]??"":S.current.generalQuery??"",[R,k]=r.useState("results"),[n,d]=r.useState(0),[g,$]=r.useState(!1),[q,U]=r.useState(!1),[F,K]=r.useState(()=>(S.current.openTabs??[]).map(i=>{var u;return{id:`${i.connectionId}:${i.database}`,connectionId:i.connectionId,connectionName:((u=m.find(L=>L.id===i.connectionId))==null?void 0:u.name)??i.connectionId,database:i.database}})),[C,O]=r.useState(S.current.activeTabId??null),[N,I]=r.useState(()=>{const s=S.current.queries??{};return S.current.generalQuery,s}),[j,p]=r.useState(P(C)),D=r.useCallback(s=>{p(i=>{const u=typeof s=="function"?s(i):s;return I(L=>{const E={...L};return C&&(E[C]=u),E}),u})},[C]),b=c.activeConnectionId??S.current.connectionId??((Y=a.database)==null?void 0:Y.activeConnectionId)??((W=m[0])==null?void 0:W.id),_=c.activeDatabase??S.current.database??((X=a.database)==null?void 0:X.activeDatabase),z=m.find(s=>s.id===b),t=b&&_?`${b}:${_}`:"",o=t?c.tables.get(t)??[]:[],T=r.useMemo(()=>{const s=new Map;return!b||!_||o.forEach(i=>{const u=c.tableSchemas.get(`${b}:${_}:${i.name}`);u&&s.set(i.name,{columns:u.columns})}),s},[b,_,o,c.tableSchemas]),v=r.useCallback((s,i)=>{var E;const u=w(s,i),L=((E=m.find(G=>G.id===s))==null?void 0:E.name)??s;K(G=>{if(G.some(ie=>ie.id===u))return G;const ce={id:u,connectionId:s,connectionName:L,database:i};return[...G,ce]}),O(u),p(N[u]??""),h.setActiveConnection(a.id,s),h.setActiveDatabase(a.id,i)},[a.id,m,N]),ae=r.useCallback(s=>{K(i=>i.filter(u=>u.id!==s)),C===s&&K(i=>{if(i.length>0){const u=i[0];O(u.id),p(N[u.id]??""),h.setActiveConnection(a.id,u.connectionId),h.setActiveDatabase(a.id,u.database)}else O(null),p("");return i})},[C,a.id,N]),se=r.useCallback(s=>{O(s.id),p(N[s.id]??""),h.setActiveConnection(a.id,s.connectionId),h.setActiveDatabase(a.id,s.database)},[a.id,N]);r.useEffect(()=>{if(!q&&m.length>0){const s=S.current;s.connectionId&&m.some(i=>i.id===s.connectionId)&&(h.setActiveConnection(a.id,s.connectionId),h.listDatabases(a.id,s.connectionId),s.database&&(h.setActiveDatabase(a.id,s.database),h.listTables(a.id,s.connectionId,s.database))),U(!0)}},[a.id,m,q]),r.useEffect(()=>{h.requestQueryHistory(a.id)},[a.id]),r.useEffect(()=>{const s=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),x())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[x]),r.useEffect(()=>{q&&b&&ve(a.id,{connectionId:b,database:_,lastQuery:j,queries:N,generalQuery:"",openTabs:F.map(s=>({connectionId:s.connectionId,database:s.database})),activeTabId:C??void 0})},[a.id,b,_,j,q,F,C,N]);const te=r.useCallback(s=>{var i;if(!(!b||!_||!j.trim()||Q))if(s==="cursor"){const u=(i=A.current)==null?void 0:i.querySelector(".query-editor__textarea"),L=(u==null?void 0:u.selectionStart)??M.current,E=he(j,L);E&&h.executeQuery(a.id,b,_,E)}else{const u=_e(j);u.length<=1?h.executeQuery(a.id,b,_,j.trim()):u.forEach((L,E)=>{setTimeout(()=>{h.executeQuery(a.id,b,_,L.sql)},E*150)})}},[a.id,b,_,j,Q]),ne=r.useCallback(s=>{D(s),k("results")},[]),re=r.useCallback(s=>{h.setActiveConnection(a.id,s),h.listDatabases(a.id,s)},[a.id]),le=r.useCallback(s=>{b&&(v(b,s),h.listTables(a.id,b,s))},[a.id,b,v]),V=y[n];return m.length===0?e.jsxs("div",{className:"database-panel",ref:A,children:[e.jsxs("div",{className:"database-panel__header",children:[e.jsxs("div",{className:"database-panel__title",children:[e.jsx("span",{className:"database-panel__icon",children:e.jsx(H,{name:"database",size:16})}),e.jsx("span",{className:"database-panel__name",children:a.name})]}),e.jsx("button",{className:"database-panel__close",onClick:x,children:"×"})]}),e.jsx("div",{className:"database-panel__body",children:e.jsxs("div",{className:"database-panel__no-connections",children:[e.jsx("div",{className:"database-panel__no-connections-icon",children:e.jsx(H,{name:"plug",size:32})}),e.jsx("h3",{children:l("terminal:database.noConnections")}),e.jsx("p",{children:l("terminal:database.noConnectionsDesc")}),e.jsx("p",{children:l("terminal:database.toGetStarted")}),e.jsxs("ol",{children:[e.jsx("li",{children:l("terminal:database.step1Close")}),e.jsx("li",{children:l("terminal:database.step2Settings")}),e.jsx("li",{children:l("terminal:database.step3AddConnection")}),e.jsx("li",{children:l("terminal:database.step4Reopen")})]})]})})]}):e.jsxs("div",{className:"database-panel",ref:A,children:[e.jsxs("div",{className:"database-panel__header",children:[e.jsxs("div",{className:"database-panel__title",children:[e.jsx("span",{className:"database-panel__icon",children:(z==null?void 0:z.engine)==="mysql"?"🐬":"🐘"}),e.jsx("span",{className:"database-panel__name",children:a.name}),z&&e.jsxs("span",{className:"database-panel__connection-info",children:[z.name," / ",_||l("terminal:database.noDatabaseSelected")]})]}),e.jsx("button",{className:"database-panel__close",onClick:x,children:"×"})]}),e.jsxs("div",{className:"database-panel__body",children:[e.jsx(fe,{building:a,connections:m,activeConnectionId:b,activeDatabase:_,collapsed:g,onToggleCollapse:()=>$(!g),onConnectionChange:re,onDatabaseChange:le,onInsertTable:s=>D(i=>i+` ${s}`),onSelectTableQuery:s=>{const i=`SELECT * FROM ${s}`;D(i),b&&_&&h.executeQuery(a.id,b,_,i)}}),e.jsxs("div",{className:"database-panel__main",children:[F.length>0&&e.jsx(ye,{tabs:F,activeTabId:C,onTabClick:se,onTabClose:ae}),e.jsx(pe,{query:j,onChange:D,onExecute:te,isExecuting:Q,disabled:!b||!_,tables:o,tableSchemas:T,onRequestTableSchema:s=>{b&&_&&h.getTableSchema(a.id,b,_,s)}}),e.jsxs("div",{className:"database-panel__tabs",children:[e.jsxs("button",{className:`database-panel__tab ${R==="results"?"database-panel__tab--active":""}`,onClick:()=>k("results"),children:[l("terminal:database.results"),y.length>0&&e.jsx("span",{className:"database-panel__tab-badge",children:y.length})]}),e.jsxs("button",{className:`database-panel__tab ${R==="history"?"database-panel__tab--active":""}`,onClick:()=>k("history"),children:[l("terminal:database.history"),f.length>0&&e.jsx("span",{className:"database-panel__tab-badge",children:f.length})]}),R==="results"&&y.length>1&&e.jsxs("div",{className:"database-panel__result-nav",children:[e.jsxs("button",{disabled:n>=y.length-1,onClick:()=>d(s=>s+1),children:["← ",l("terminal:database.older")]}),e.jsxs("span",{children:[n+1," / ",y.length]}),e.jsxs("button",{disabled:n<=0,onClick:()=>d(s=>s-1),children:[l("terminal:database.newer")," →"]})]})]}),e.jsx("div",{className:"database-panel__tab-content",children:R==="results"?V?e.jsx(xe,{result:V,buildingId:a.id,building:a}):e.jsxs("div",{className:"database-panel__empty",children:[e.jsx("p",{children:l("terminal:database.noResultsYet")}),e.jsx("p",{children:l("terminal:database.selectDbAndRun")})]}):e.jsx(je,{buildingId:a.id,history:f,onLoadQuery:ne})})]})]})]})};export{ge as DatabasePanel,fe as DatabaseSidebar,ye as DatabaseTabs,pe as QueryEditor,je as QueryHistoryPanel,xe as ResultsTable};
@@ -1,4 +1,4 @@
1
- import{bg as ta,u as B,j as e,aL as j,bj as Ms,bk as Fs,aM as Ue,s as D,bl as $s,r as d,D as Z,I as F,a2 as Us,aV as Ve,f as na,bm as la,J as ia,S as oa,h as ra,bn as Ks,aW as He}from"./main-9uTEp9Lr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const ca=[{value:"",labelKey:"terminal:building.colorDefault"},{value:"#2a2a3a",labelKey:"terminal:building.colorDarkGray"},{value:"#3a2a2a",labelKey:"terminal:building.colorDarkRed"},{value:"#2a3a2a",labelKey:"terminal:building.colorDarkGreen"},{value:"#2a2a4a",labelKey:"terminal:building.colorDarkBlue"},{value:"#3a3a2a",labelKey:"terminal:building.colorDarkYellow"},{value:"#3a2a3a",labelKey:"terminal:building.colorDarkPurple"},{value:"#2a3a3a",labelKey:"terminal:building.colorDarkCyan"},{value:"#4a3a3a",labelKey:"terminal:building.colorWarmBrown"},{value:"#3a4a4a",labelKey:"terminal:building.colorCoolSteel"}];function ma(o){return ta.t(o)}function qe(o){if(o===0)return"0 B";const p=1024,u=["B","KB","MB","GB"],x=Math.floor(Math.log(o)/Math.log(p));return parseFloat((o/Math.pow(p,x)).toFixed(1))+" "+u[x]}function da(o){const u=Date.now()-o,x=Math.floor(u/(1e3*60*60)),n=Math.floor(u%(1e3*60*60)/(1e3*60));return x>0?`${x}h ${n}m`:`${n}m`}const Hs={30:"#1a1a1a",31:"#e74c3c",32:"#2ecc71",33:"#f39c12",34:"#3498db",35:"#9b59b6",36:"#00bcd4",37:"#ecf0f1",90:"#7f8c8d",91:"#ff6b6b",92:"#4ade80",93:"#fbbf24",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"};function Vs(o){const p=[],u=/\x1B\[([0-9;]*)m/g;let x=0,n=null,y;for(;(y=u.exec(o))!==null;){if(y.index>x){const g=o.slice(x,y.index);n?p.push(e.jsx("span",{style:{color:n},children:g},p.length)):p.push(g)}const C=y[1].split(";").map(Number);for(const g of C)g===0||g===39?n=null:Hs[g]&&(n=Hs[g]);x=u.lastIndex}if(x<o.length){const C=o.slice(x);n?p.push(e.jsx("span",{style:{color:n},children:C},p.length)):p.push(C)}return p.length>0?p:[o]}function ua({buildingName:o,onClose:p,onConfirm:u}){const{t:x}=B(["terminal","common"]);return e.jsx("div",{className:"modal-overlay visible",onClick:p,children:e.jsxs("div",{className:"modal confirm-modal",onClick:n=>n.stopPropagation(),children:[e.jsx("div",{className:"modal-header",children:x("terminal:building.deleteBuilding")}),e.jsxs("div",{className:"modal-body confirm-modal-body",children:[e.jsx("p",{children:x("terminal:building.deleteConfirm",{name:o})}),e.jsx("p",{className:"confirm-modal-note",children:x("terminal:building.deleteNote")})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("button",{className:"btn btn-secondary",onClick:p,children:x("common:buttons.cancel")}),e.jsx("button",{className:"btn btn-danger",onClick:u,autoFocus:!0,children:x("common:buttons.delete")})]})]})})}function pa({usePM2:o,setUsePM2:p}){const{t:u}=B(["terminal"]);return e.jsxs("div",{className:"form-section pm2-toggle-section",children:[e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",className:"toggle-input",checked:o,onChange:x=>p(x.target.checked)}),e.jsx("span",{className:"toggle-track",children:e.jsx("span",{className:"toggle-thumb"})}),e.jsxs("span",{className:"toggle-label",children:[e.jsx("span",{className:"pm2-badge",children:"PM2"}),u("terminal:building.usePM2")]})]}),e.jsx("div",{className:"form-hint",children:u("terminal:building.pm2Hint")})]})}function ha({usePM2:o,pm2Script:p,setPm2Script:u,pm2Args:x,setPm2Args:n,pm2Interpreter:y,setPm2Interpreter:C,pm2InterpreterArgs:g,setPm2InterpreterArgs:v,pm2Env:s,setPm2Env:h,isEditMode:a,building:t,handleCommand:r}){var N;const{t:i}=B(["terminal","common"]);return o?e.jsxs("div",{className:"form-section pm2-config-section",children:[e.jsx("label",{className:"form-label",children:i("terminal:building.pm2Configuration")}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Script"),e.jsx(j,{text:i("terminal:building.helpPm2Script"),title:i("terminal:building.pm2Script"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:p,onChange:b=>u(b.target.value),placeholder:"npm, java, python, ./app.js",required:o})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Arguments"),e.jsx(j,{text:i("terminal:building.helpPm2Arguments"),title:i("terminal:building.pm2Arguments"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:x,onChange:b=>n(b.target.value),placeholder:"run dev, -jar app.jar, app.py"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Interpreter"),e.jsx(j,{text:i("terminal:building.helpPm2Interpreter"),title:i("terminal:building.pm2Interpreter"),position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:y,onChange:b=>C(b.target.value),children:Object.keys(Ms).map(b=>e.jsx("option",{value:b,children:Ms[b].label},b))})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2InterpArgs"),e.jsx(j,{text:i("terminal:building.helpPm2InterpArgs"),title:i("terminal:building.pm2InterpArgs"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:g,onChange:b=>v(b.target.value),placeholder:"-jar (for Java)"})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Environment"),e.jsx(j,{text:i("terminal:building.helpPm2Environment"),title:i("terminal:building.pm2Environment"),position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:s,onChange:b=>h(b.target.value),placeholder:`KEY=value
1
+ import{bg as ta,u as B,j as e,aL as j,bj as Ms,bk as Fs,aM as Ue,s as D,bl as $s,r as d,D as Z,I as F,a2 as Us,aV as Ve,f as na,bm as la,J as ia,S as oa,h as ra,bn as Ks,aW as He}from"./main-XbhAPjbi.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const ca=[{value:"",labelKey:"terminal:building.colorDefault"},{value:"#2a2a3a",labelKey:"terminal:building.colorDarkGray"},{value:"#3a2a2a",labelKey:"terminal:building.colorDarkRed"},{value:"#2a3a2a",labelKey:"terminal:building.colorDarkGreen"},{value:"#2a2a4a",labelKey:"terminal:building.colorDarkBlue"},{value:"#3a3a2a",labelKey:"terminal:building.colorDarkYellow"},{value:"#3a2a3a",labelKey:"terminal:building.colorDarkPurple"},{value:"#2a3a3a",labelKey:"terminal:building.colorDarkCyan"},{value:"#4a3a3a",labelKey:"terminal:building.colorWarmBrown"},{value:"#3a4a4a",labelKey:"terminal:building.colorCoolSteel"}];function ma(o){return ta.t(o)}function qe(o){if(o===0)return"0 B";const p=1024,u=["B","KB","MB","GB"],x=Math.floor(Math.log(o)/Math.log(p));return parseFloat((o/Math.pow(p,x)).toFixed(1))+" "+u[x]}function da(o){const u=Date.now()-o,x=Math.floor(u/(1e3*60*60)),n=Math.floor(u%(1e3*60*60)/(1e3*60));return x>0?`${x}h ${n}m`:`${n}m`}const Hs={30:"#1a1a1a",31:"#e74c3c",32:"#2ecc71",33:"#f39c12",34:"#3498db",35:"#9b59b6",36:"#00bcd4",37:"#ecf0f1",90:"#7f8c8d",91:"#ff6b6b",92:"#4ade80",93:"#fbbf24",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"};function Vs(o){const p=[],u=/\x1B\[([0-9;]*)m/g;let x=0,n=null,y;for(;(y=u.exec(o))!==null;){if(y.index>x){const g=o.slice(x,y.index);n?p.push(e.jsx("span",{style:{color:n},children:g},p.length)):p.push(g)}const C=y[1].split(";").map(Number);for(const g of C)g===0||g===39?n=null:Hs[g]&&(n=Hs[g]);x=u.lastIndex}if(x<o.length){const C=o.slice(x);n?p.push(e.jsx("span",{style:{color:n},children:C},p.length)):p.push(C)}return p.length>0?p:[o]}function ua({buildingName:o,onClose:p,onConfirm:u}){const{t:x}=B(["terminal","common"]);return e.jsx("div",{className:"modal-overlay visible",onClick:p,children:e.jsxs("div",{className:"modal confirm-modal",onClick:n=>n.stopPropagation(),children:[e.jsx("div",{className:"modal-header",children:x("terminal:building.deleteBuilding")}),e.jsxs("div",{className:"modal-body confirm-modal-body",children:[e.jsx("p",{children:x("terminal:building.deleteConfirm",{name:o})}),e.jsx("p",{className:"confirm-modal-note",children:x("terminal:building.deleteNote")})]}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("button",{className:"btn btn-secondary",onClick:p,children:x("common:buttons.cancel")}),e.jsx("button",{className:"btn btn-danger",onClick:u,autoFocus:!0,children:x("common:buttons.delete")})]})]})})}function pa({usePM2:o,setUsePM2:p}){const{t:u}=B(["terminal"]);return e.jsxs("div",{className:"form-section pm2-toggle-section",children:[e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",className:"toggle-input",checked:o,onChange:x=>p(x.target.checked)}),e.jsx("span",{className:"toggle-track",children:e.jsx("span",{className:"toggle-thumb"})}),e.jsxs("span",{className:"toggle-label",children:[e.jsx("span",{className:"pm2-badge",children:"PM2"}),u("terminal:building.usePM2")]})]}),e.jsx("div",{className:"form-hint",children:u("terminal:building.pm2Hint")})]})}function ha({usePM2:o,pm2Script:p,setPm2Script:u,pm2Args:x,setPm2Args:n,pm2Interpreter:y,setPm2Interpreter:C,pm2InterpreterArgs:g,setPm2InterpreterArgs:v,pm2Env:s,setPm2Env:h,isEditMode:a,building:t,handleCommand:r}){var N;const{t:i}=B(["terminal","common"]);return o?e.jsxs("div",{className:"form-section pm2-config-section",children:[e.jsx("label",{className:"form-label",children:i("terminal:building.pm2Configuration")}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Script"),e.jsx(j,{text:i("terminal:building.helpPm2Script"),title:i("terminal:building.pm2Script"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:p,onChange:b=>u(b.target.value),placeholder:"npm, java, python, ./app.js",required:o})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Arguments"),e.jsx(j,{text:i("terminal:building.helpPm2Arguments"),title:i("terminal:building.pm2Arguments"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:x,onChange:b=>n(b.target.value),placeholder:"run dev, -jar app.jar, app.py"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Interpreter"),e.jsx(j,{text:i("terminal:building.helpPm2Interpreter"),title:i("terminal:building.pm2Interpreter"),position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:y,onChange:b=>C(b.target.value),children:Object.keys(Ms).map(b=>e.jsx("option",{value:b,children:Ms[b].label},b))})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2InterpArgs"),e.jsx(j,{text:i("terminal:building.helpPm2InterpArgs"),title:i("terminal:building.pm2InterpArgs"),position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:g,onChange:b=>v(b.target.value),placeholder:"-jar (for Java)"})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:[i("terminal:building.pm2Environment"),e.jsx(j,{text:i("terminal:building.helpPm2Environment"),title:i("terminal:building.pm2Environment"),position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:s,onChange:b=>h(b.target.value),placeholder:`KEY=value
2
2
  SERVER_PORT=7201
3
3
  NODE_ENV=production`,rows:3})]}),e.jsx("div",{className:"pm2-examples",children:e.jsxs("details",{children:[e.jsx("summary",{children:i("terminal:building.pm2Examples")}),e.jsxs("div",{className:"pm2-examples-content",children:[e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Node.js:"})," Script: ",e.jsx("code",{children:"npm"}),", Args: ",e.jsx("code",{children:"run dev"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Symfony:"})," Script: ",e.jsx("code",{children:"symfony"}),", Args: ",e.jsx("code",{children:"serve --no-daemon"}),", Interpreter: ",e.jsx("code",{children:"None"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Java JAR:"})," Script: ",e.jsx("code",{children:"app.jar"}),", Interpreter: ",e.jsx("code",{children:"Java"}),", Interp. Args: ",e.jsx("code",{children:"-jar"})]}),e.jsxs("div",{className:"pm2-example",children:[e.jsx("strong",{children:"Python:"})," Script: ",e.jsx("code",{children:"app.py"}),", Interpreter: ",e.jsx("code",{children:"Python 3"})]})]})]})}),a&&(t==null?void 0:t.pm2Status)&&e.jsx("div",{className:"pm2-status-display",children:e.jsxs("div",{className:"pm2-status-row",children:[e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"PID"}),e.jsx("span",{className:"pm2-metric-value",children:t.pm2Status.pid||"-"})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"CPU"}),e.jsxs("span",{className:"pm2-metric-value",children:[((N=t.pm2Status.cpu)==null?void 0:N.toFixed(1))||"0","%"]})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"MEM"}),e.jsx("span",{className:"pm2-metric-value",children:qe(t.pm2Status.memory||0)})]}),e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"Restarts"}),e.jsx("span",{className:"pm2-metric-value",children:t.pm2Status.restarts||0})]}),t.pm2Status.uptime&&e.jsxs("span",{className:"pm2-metric",children:[e.jsx("span",{className:"pm2-metric-label",children:"Uptime"}),e.jsx("span",{className:"pm2-metric-value",children:da(t.pm2Status.uptime)})]})]})}),a&&e.jsxs("div",{className:"pm2-actions",children:[e.jsx("button",{type:"button",className:"btn btn-sm btn-success",onClick:()=>r("start"),children:i("common:buttons.start")}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>r("stop"),children:i("common:buttons.stop")}),e.jsx("button",{type:"button",className:"btn btn-sm btn-warning",onClick:()=>r("restart"),children:i("terminal:buildingAction.restart")}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>r("logs"),children:i("terminal:logs.title")})]})]}):null}function xa({dockerMode:o,setDockerMode:p,dockerImage:u,setDockerImage:x,dockerContainerName:n,setDockerContainerName:y,dockerCommand:C,setDockerCommand:g,dockerPorts:v,setDockerPorts:s,dockerVolumes:h,setDockerVolumes:a,dockerNetwork:t,setDockerNetwork:r,dockerRestart:i,setDockerRestart:N,dockerPull:b,setDockerPull:L,dockerEnv:T,setDockerEnv:A,dockerComposePath:$,setDockerComposePath:R,dockerComposeProject:K,setDockerComposeProject:I,dockerComposeServices:H,setDockerComposeServices:O,selectedExistingContainer:c,setSelectedExistingContainer:E,dockerContainersList:V,isEditMode:q,building:k,handleCommand:_}){const{t:M}=B(["config","common"]);return e.jsxs("div",{className:"form-section docker-config-section",children:[e.jsx("label",{className:"form-label",children:M("config:buildings.dockerConfig")}),e.jsxs("div",{className:"docker-mode-selector",children:[e.jsxs("label",{className:`docker-mode-option ${o==="container"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"container",checked:o==="container",onChange:()=>p("container")}),e.jsx("span",{className:"docker-mode-icon",children:"📦"}),e.jsx("span",{className:"docker-mode-label",children:"Container"}),e.jsx("span",{className:"docker-mode-desc",children:"Create a new container"})]}),e.jsxs("label",{className:`docker-mode-option ${o==="compose"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"compose",checked:o==="compose",onChange:()=>p("compose")}),e.jsx("span",{className:"docker-mode-icon",children:"🛠"}),e.jsx("span",{className:"docker-mode-label",children:"Compose"}),e.jsx("span",{className:"docker-mode-desc",children:"Manage multiple services"})]}),e.jsxs("label",{className:`docker-mode-option ${o==="existing"?"active":""}`,children:[e.jsx("input",{type:"radio",name:"dockerMode",value:"existing",checked:o==="existing",onChange:()=>p("existing")}),e.jsx("span",{className:"docker-mode-icon",children:"🔎"}),e.jsx("span",{className:"docker-mode-label",children:"Existing"}),e.jsx("span",{className:"docker-mode-desc",children:"Adopt existing container"})]})]}),o==="container"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Image:",e.jsx(j,{text:"Docker image to run, e.g., nginx:latest, redis:alpine, my-app:v1",title:"Image",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:u,onChange:l=>x(l.target.value),placeholder:"nginx:latest",required:!0})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Container Name:",e.jsx(j,{text:"Custom name for the container. If empty, auto-generated based on building name.",title:"Container Name",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:n,onChange:l=>y(l.target.value),placeholder:"Auto-generated (tc-{name}-{id})"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Command:",e.jsx(j,{text:"Override the default container command. Leave empty to use image's CMD.",title:"Command Override",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:C,onChange:l=>g(l.target.value),placeholder:"Optional command override"})]}),e.jsxs("div",{className:"form-section docker-ports-section",children:[e.jsxs("label",{className:"form-label",children:["Port Mappings",e.jsx("button",{type:"button",className:"btn btn-sm btn-add",onClick:()=>s([...v,""]),children:"+ Add"})]}),v.map((l,S)=>e.jsxs("div",{className:"docker-mapping-row",children:[e.jsx("input",{type:"text",className:"form-input",value:l,onChange:U=>{const z=[...v];z[S]=U.target.value,s(z)},placeholder:"8080:80 or 3000"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>s(v.filter((U,z)=>z!==S)),children:"x"})]},S)),v.length===0&&e.jsx("div",{className:"form-hint",children:"Format: host:container (e.g., 8080:80) or same port (e.g., 3000)"})]}),e.jsxs("div",{className:"form-section docker-volumes-section",children:[e.jsxs("label",{className:"form-label",children:["Volume Mounts",e.jsx("button",{type:"button",className:"btn btn-sm btn-add",onClick:()=>a([...h,""]),children:"+ Add"})]}),h.map((l,S)=>e.jsxs("div",{className:"docker-mapping-row",children:[e.jsx("input",{type:"text",className:"form-input",value:l,onChange:U=>{const z=[...h];z[S]=U.target.value,a(z)},placeholder:"./data:/app/data or /host/path:/container/path"}),e.jsx("button",{type:"button",className:"btn btn-sm btn-danger",onClick:()=>a(h.filter((U,z)=>z!==S)),children:"x"})]},S)),h.length===0&&e.jsx("div",{className:"form-hint",children:"Format: host_path:container_path (relative paths resolved from working directory)"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Network:",e.jsx(j,{text:"Docker network to connect to. Leave empty for default bridge network.",title:"Network",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:t,onChange:l=>r(l.target.value),placeholder:"bridge (default)"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Restart Policy:",e.jsx(j,{text:"When should Docker restart the container automatically?",title:"Restart Policy",position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:i,onChange:l=>N(l.target.value),children:Object.keys(Fs).map(l=>e.jsx("option",{value:l,children:Fs[l].label},l))})]})]}),o==="compose"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Compose File:",e.jsx(j,{text:"Path to docker-compose.yml file, relative to working directory.",title:"Compose File",position:"top",size:"sm"})]}),e.jsx(Ue,{value:$,onChange:R,placeholder:"docker-compose.yml",className:"form-input",directoriesOnly:!1})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Project Name:",e.jsx(j,{text:"Override the compose project name. Leave empty for auto-generated name.",title:"Project Name",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:K,onChange:l=>I(l.target.value),placeholder:"Auto-generated"})]}),e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Services:",e.jsx(j,{text:"Specific services to manage (comma-separated). Leave empty for all services.",title:"Services",position:"top",size:"sm"})]}),e.jsx("input",{type:"text",className:"form-input",value:H,onChange:l=>O(l.target.value),placeholder:"All services (or: api, db, redis)"})]})]}),o==="existing"&&e.jsxs("div",{className:"docker-existing-section",children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Select Container:",e.jsx(j,{text:"Choose an existing Docker container to monitor and control. The container will not be deleted when removing the building.",title:"Existing Container",position:"top",size:"sm"})]}),e.jsxs("div",{className:"docker-existing-select-wrapper",children:[e.jsxs("select",{className:"form-input form-select",value:c,onChange:l=>E(l.target.value),required:o==="existing",children:[e.jsx("option",{value:"",children:"Select a container..."}),V.map(l=>e.jsxs("option",{value:l.name,children:[l.name," (",l.image,") - ",l.state]},l.id))]}),e.jsx("button",{type:"button",className:"btn btn-sm",onClick:()=>D.requestDockerContainersList(),title:"Refresh container list",children:"↻"})]})]}),V.length===0&&e.jsx("div",{className:"form-hint docker-existing-hint",children:"No containers found. Make sure Docker is running and you have containers available."}),c&&e.jsx("div",{className:"docker-existing-info",children:(()=>{const l=V.find(S=>S.name===c);return l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Image:"}),e.jsx("span",{className:"docker-existing-info-value",children:l.image})]}),e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Status:"}),e.jsx("span",{className:`docker-existing-info-value docker-status-${l.status}`,children:l.state})]}),e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"ID:"}),e.jsx("span",{className:"docker-existing-info-value",children:l.id.slice(0,12)})]}),l.ports.length>0&&e.jsxs("div",{className:"docker-existing-info-row",children:[e.jsx("span",{className:"docker-existing-info-label",children:"Ports:"}),e.jsx("span",{className:"docker-existing-info-value",children:l.ports.map(S=>`${S.host}:${S.container}/${S.protocol}`).join(", ")})]})]}):null})()}),e.jsx("div",{className:"form-hint",children:"Note: Existing containers will not be deleted when you remove this building."})]}),o!=="existing"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"command-row",children:[e.jsxs("span",{className:"command-label",children:["Pull Policy:",e.jsx(j,{text:"When to pull images: always, only if missing, or never.",title:"Pull Policy",position:"top",size:"sm"})]}),e.jsx("select",{className:"form-input form-select",value:b,onChange:l=>L(l.target.value),children:Object.keys($s).map(l=>e.jsx("option",{value:l,children:$s[l].label},l))})]}),e.jsxs("div",{className:"command-row env-row",children:[e.jsxs("span",{className:"command-label",children:["Environment:",e.jsx(j,{text:"Environment variables in KEY=value format, one per line.",title:"Environment Variables",position:"top",size:"sm"})]}),e.jsx("textarea",{className:"form-input form-textarea",value:T,onChange:l=>A(l.target.value),placeholder:`KEY=value
4
4
  DATABASE_URL=postgres://...
@@ -0,0 +1 @@
1
+ import{r as l,aT as Re,aU as Ye,j as e,I,u as Y,aV as ts,a2 as ns,f as Ve,s as _,aW as hs,k as us,l as me,aX as Z,aY as ms,aM as gs,aZ as fs,C as ge,a_ as X,aJ as ke,a$ as xs,b0 as bs,b1 as js,b2 as ws,b3 as Se,b4 as is,b5 as ys,b6 as Me,b7 as vs,b8 as Ns,b9 as ks,ba as Ss,bb as Cs,bc as As,bd as Ts,aF as _s,J as Es,S as Ne,be as Is,bf as Ps,aH as Ls,bg as ze,K as Pe,aQ as $s,bh as Ue,bi as Ds}from"./main-XbhAPjbi.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const Ke="deivid11/tide-commander",Fs=`https://api.github.com/repos/${Ke}/releases/latest`,Os=`https://api.github.com/repos/${Ke}/releases?per_page=3`,Rs=3600*1e3,Je="app_update_dismissed_version",Ze="1.98.0";function zs(){var x,y;const[s,n]=l.useState({isChecking:!1,updateAvailable:!1,updateInfo:null,recentReleases:[],error:null,currentVersion:Ze}),a=((y=(x=Re)==null?void 0:x.getPlatform)==null?void 0:y.call(x))==="android"||!1,o=h=>h.replace(/^v/,"").split(".").map(g=>parseInt(g,10)||0),r=(h,f)=>{const g=o(h),v=o(f),b=Math.max(g.length,v.length);for(let p=0;p<b;p++){const L=g[p]||0,M=v[p]||0;if(L>M)return 1;if(L<M)return-1}return 0},d=async h=>{var g,v;if(Re&&Ye&&((v=(g=Re).isNativePlatform)==null?void 0:v.call(g))===!0){const b=await Ye.get({url:h,headers:{Accept:"application/vnd.github.v3+json"}});return{data:b.data,status:b.status}}else{const b=await fetch(h,{headers:{Accept:"application/vnd.github.v3+json"}});return b.ok?{data:await b.json(),status:b.status}:{data:null,status:b.status}}},c=l.useCallback(async(h=!1)=>{n(f=>({...f,isChecking:!0,error:null}));try{const[f,g]=await Promise.all([d(Fs),d(Os)]);if(f.status!==200)throw new Error(`GitHub API error: ${f.status}`);const v=f.data,b=v.tag_name;let p=[];g.status===200&&g.data&&(p=g.data.map(T=>({version:T.tag_name,name:T.name,publishedAt:T.published_at,releaseUrl:T.html_url})));const L=localStorage.getItem(Je);if(!h&&L===b)return n(T=>({...T,isChecking:!1,updateAvailable:!1,recentReleases:p})),null;if(!(r(b,Ze)>0))return n(T=>({...T,isChecking:!1,updateAvailable:!1,recentReleases:p})),null;const R=v.assets.find(T=>T.name.endsWith(".apk")&&T.content_type==="application/vnd.android.package-archive"),k={version:b,name:v.name,changelog:v.body,releaseUrl:v.html_url,apkUrl:(R==null?void 0:R.browser_download_url)||null,apkSize:(R==null?void 0:R.size)||null,publishedAt:v.published_at};return n(T=>({...T,isChecking:!1,updateAvailable:!0,updateInfo:k,recentReleases:p})),k}catch(f){const g=f instanceof Error?f.message:"Failed to check for updates";return n(v=>({...v,isChecking:!1,error:g})),null}},[]),i=l.useCallback(async()=>{var h,f,g;if(!((h=s.updateInfo)!=null&&h.apkUrl)){(f=s.updateInfo)!=null&&f.releaseUrl&&window.open(s.updateInfo.releaseUrl,"_blank");return}if(!a){(g=s.updateInfo)!=null&&g.releaseUrl&&window.open(s.updateInfo.releaseUrl,"_blank");return}try{window.open(s.updateInfo.apkUrl,"_system"),n(v=>({...v,error:null}))}catch(v){const b=v instanceof Error?v.message:"Failed to open download";n(p=>({...p,error:b}))}},[s.updateInfo,a]),u=l.useCallback(()=>{s.updateInfo&&localStorage.setItem(Je,s.updateInfo.version),n(h=>({...h,updateAvailable:!1,updateInfo:null}))},[s.updateInfo]),S=l.useCallback(()=>{var h;(h=s.updateInfo)!=null&&h.releaseUrl?window.open(s.updateInfo.releaseUrl,"_blank"):window.open(`https://github.com/${Ke}/releases`,"_blank")},[s.updateInfo]);return l.useEffect(()=>{if(!a)return;const h=setTimeout(()=>{c()},5e3),f=setInterval(()=>{c()},Rs);return()=>{clearTimeout(h),clearInterval(f)}},[a,c]),{...s,isAndroid:a,checkForUpdate:c,downloadAndInstall:i,dismissUpdate:u,openReleasePage:S}}const os="tide-toolbox-collapse";function Us(s,n){try{const a=localStorage.getItem(`${os}-${s}`);if(a!==null)return a==="true"}catch{}return n}function Bs(s,n){try{localStorage.setItem(`${os}-${s}`,String(n))}catch{}}function W({title:s,storageKey:n,defaultOpen:a=!1,forceOpen:o=!1,children:r,headerExtra:d}){const[c,i]=l.useState(()=>n?Us(n,a):a),u=()=>{const x=!c;i(x),n&&Bs(n,x)},S=o||c;return e.jsxs("div",{className:`collapsible-section ${S?"open":"collapsed"}`,children:[e.jsxs("button",{className:"collapsible-header",onClick:u,children:[e.jsx("span",{className:"collapsible-title",children:s}),e.jsxs("span",{className:"collapsible-header-right",children:[d,e.jsx("span",{className:"collapsible-arrow",children:e.jsx(I,{name:S?"caret-down":"caret-right",size:10})})]})]}),S&&e.jsx("div",{className:"collapsible-content",children:r})]})}function Ms({area:s,isSelected:n,onClick:a,onDelete:o}){const{t:r}=Y(["config","common"]),d=s.assignedAgentIds.length,c=s.type==="rectangle"?r("config:areas.rect"):r("config:areas.circle");return e.jsxs("div",{className:`area-item ${n?"selected":""}`,onClick:a,children:[e.jsx("div",{className:"area-color-dot",style:{backgroundColor:s.color}}),e.jsxs("div",{className:"area-info",children:[e.jsx("div",{className:"area-name",children:s.name}),e.jsxs("div",{className:"area-meta",children:[c," ",d>0&&`• ${d} ${d>1?r("common:labels.agents").toLowerCase():r("common:labels.agent").toLowerCase()}`]})]}),e.jsx("button",{className:"area-delete-btn",onClick:o,title:r("config:areas.deleteArea"),children:"×"})]})}function Vs({building:s,isSelected:n,onClick:a,onEdit:o}){var i;const{t:r}=Y(["config"]),d=((i=s.pm2Status)==null?void 0:i.ports)||[],c=(u,S)=>{u.stopPropagation(),window.open(`http://${window.location.hostname}:${S}`,"_blank")};return e.jsxs("div",{className:`building-item ${n?"selected":""}`,onClick:a,children:[e.jsx("div",{className:"building-status-dot",style:{backgroundColor:ts[s.status]},title:s.status}),e.jsx("div",{className:"building-icon",children:e.jsx(I,{name:ns(s.type),size:16})}),e.jsxs("div",{className:"building-info",children:[e.jsx("div",{className:"building-name",children:s.name}),e.jsxs("div",{className:"building-meta",children:[s.type,d.length>0&&e.jsx("span",{className:"building-ports",children:d.map(u=>e.jsxs("a",{href:`http://${window.location.hostname}:${u}`,className:"building-port-link",onClick:S=>c(S,u),title:`Open :${u}`,children:[":",u]},u))})]})]}),e.jsx("button",{className:"building-edit-btn",onClick:u=>{u.stopPropagation(),o()},title:r("config:buildings.editBuilding"),children:e.jsx(I,{name:"gear",size:14})})]})}function Ks({building:s,onClose:n,onOpenModal:a}){var S,x,y,h,f,g,v,b;const{t:o}=Y(["config","common"]),{buildingLogs:r}=Ve(),d=_.getBuildingLogs(s.id),c=hs[s.style||"server-rack"],i=p=>{_.sendBuildingCommand(s.id,p)},u=p=>{window.open(p,"_blank")};return e.jsxs("div",{className:"building-editor",children:[e.jsxs("div",{className:"building-editor-header",children:[e.jsxs("div",{className:"building-editor-title-row",children:[e.jsx("span",{className:"building-editor-icon",children:e.jsx(I,{name:ns(s.type),size:18})}),e.jsx("span",{className:"building-editor-title",children:s.name}),e.jsx("span",{className:"building-editor-status",style:{backgroundColor:ts[s.status]},children:s.status})]}),e.jsx("button",{className:"building-editor-close",onClick:n,children:"×"})]}),e.jsx("div",{className:"building-editor-section",children:e.jsxs("div",{className:"building-editor-info-grid",children:[e.jsxs("div",{className:"building-editor-info-item",children:[e.jsx("span",{className:"building-editor-info-label",children:o("common:labels.type")}),e.jsx("span",{className:"building-editor-info-value",children:s.type})]}),e.jsxs("div",{className:"building-editor-info-item",children:[e.jsx("span",{className:"building-editor-info-label",children:o("config:buildings.style")}),e.jsx("span",{className:"building-editor-info-value",children:c.label})]}),s.cwd&&e.jsxs("div",{className:"building-editor-info-item building-editor-info-wide",children:[e.jsx("span",{className:"building-editor-info-label",children:o("config:buildings.directory")}),e.jsx("span",{className:"building-editor-info-value building-editor-cwd",title:s.cwd,children:s.cwd.split("/").pop()||s.cwd})]})]})}),s.type==="server"&&e.jsxs("div",{className:"building-editor-section",children:[e.jsx("div",{className:"building-editor-section-title",children:o("config:buildings.actions")}),e.jsxs("div",{className:"building-editor-actions",children:[e.jsxs("button",{className:"building-editor-action-btn start",onClick:()=>i("start"),disabled:!((S=s.commands)!=null&&S.start)||s.status==="running",title:((x=s.commands)==null?void 0:x.start)||o("config:buildings.noStartCommand"),children:[e.jsx(I,{name:"play",size:12})," ",o("common:buttons.start")]}),e.jsxs("button",{className:"building-editor-action-btn stop",onClick:()=>i("stop"),disabled:!((y=s.commands)!=null&&y.stop)||s.status==="stopped",title:((h=s.commands)==null?void 0:h.stop)||o("config:buildings.noStopCommand"),children:[e.jsx(I,{name:"stop",size:12,weight:"fill"})," ",o("common:buttons.stop")]}),e.jsxs("button",{className:"building-editor-action-btn restart",onClick:()=>i("restart"),disabled:!((f=s.commands)!=null&&f.restart),title:((g=s.commands)==null?void 0:g.restart)||o("config:buildings.noRestartCommand"),children:[e.jsx(I,{name:"refresh",size:12})," ",o("common:buttons.retry")]}),e.jsxs("button",{className:"building-editor-action-btn health",onClick:()=>i("healthCheck"),disabled:!((v=s.commands)!=null&&v.healthCheck),title:((b=s.commands)==null?void 0:b.healthCheck)||o("config:buildings.noHealthCheck"),children:[e.jsx(I,{name:"heart",size:12})," Health"]})]})]}),s.urls&&s.urls.length>0&&e.jsxs("div",{className:"building-editor-section",children:[e.jsx("div",{className:"building-editor-section-title",children:o("config:buildings.links")}),e.jsx("div",{className:"building-editor-links",children:s.urls.map((p,L)=>e.jsxs("button",{className:"building-editor-link",onClick:()=>u(p.url),title:p.url,children:[e.jsx(I,{name:"link",size:12})," ",p.label||p.url]},L))})]}),d.length>0&&e.jsxs("div",{className:"building-editor-section",children:[e.jsxs("div",{className:"building-editor-section-title",children:[o("config:buildings.recentLogs"),e.jsx("button",{className:"building-editor-clear-logs",onClick:()=>_.clearBuildingLogs(s.id),title:o("common:buttons.clear"),children:o("common:buttons.clear")})]}),e.jsx("div",{className:"building-editor-logs",children:d.slice(-5).map((p,L)=>e.jsx("div",{className:"building-editor-log-entry",children:p},L))})]}),e.jsx("div",{className:"building-editor-footer",children:e.jsxs("button",{className:"building-editor-edit-btn",onClick:a,children:[e.jsx(I,{name:"gear",size:12})," ",o("config:buildings.fullSettings")]})})]})}async function Hs(s,n){const a=Z(),o=await fetch(me(`/api/areas/${s}/logo`),{method:"POST",headers:{"Content-Type":n.type||"image/png","X-Filename":encodeURIComponent(n.name),...a?{Authorization:`Bearer ${a}`}:{}},body:n});if(!o.ok){const r=await o.json().catch(()=>({error:o.statusText}));throw new Error(r.error||`Upload failed: ${o.statusText}`)}return o.json()}async function Ws(s){const n=Z(),a=await fetch(me(`/api/areas/${s}/logo`),{method:"DELETE",headers:{...n?{Authorization:`Bearer ${n}`}:{}}});if(!a.ok)throw new Error(`Failed to delete logo: ${a.statusText}`)}function qs(s){return us(me(`/api/areas/logos/${s}`))}const Gs=[{key:"center",labelKey:"posCenter"},{key:"top-left",labelKey:"posTopLeft"},{key:"top-right",labelKey:"posTopRight"},{key:"bottom-left",labelKey:"posBottomLeft"},{key:"bottom-right",labelKey:"posBottomRight"}];function Ys({area:s,onClose:n,onOpenFolder:a}){var ce;const{t:o}=Y(["config","common"]),[r,d]=l.useState(s.name),[c,i]=l.useState(s.prompt||""),[u,S]=l.useState(!1),[x,y]=l.useState(""),[h,f]=l.useState(!1),g=l.useRef(null);l.useEffect(()=>{d(s.name)},[s.id,s.name]),l.useEffect(()=>{i(s.prompt||"")},[s.id,s.prompt]);const v=N=>{const D=N.target.value;d(D),_.updateArea(s.id,{name:D})},b=N=>{_.updateArea(s.id,{color:N})},p=N=>{const D=N.target.value;i(D),_.updateArea(s.id,{prompt:D})},L=()=>{x.trim()&&(_.addDirectoryToArea(s.id,x.trim()),y(""),S(!1))},M=(N,D)=>{D.stopPropagation(),_.removeDirectoryFromArea(s.id,N)},R=()=>{_.bringAreaToFront(s.id)},k=()=>{_.sendAreaToBack(s.id)},T=l.useCallback(()=>{let N=2,D=2;s.type==="rectangle"&&s.width&&s.height?(N=s.width,D=s.height):s.type==="circle"&&s.radius&&(N=s.radius*1.414,D=s.radius*1.414);const B=Math.min(N,D)*.4;return{width:Math.round(B*10)/10,height:Math.round(B*10)/10}},[s.type,s.width,s.height,s.radius]),V=async N=>{var B;const D=(B=N.target.files)==null?void 0:B[0];if(D){f(!0);try{const j=await Hs(s.id,D),$=T();_.updateArea(s.id,{logo:{filename:j.filename,position:"center",width:$.width,height:$.height,keepAspectRatio:!0,opacity:.8}})}catch(j){console.error("Failed to upload logo:",j)}finally{f(!1),g.current&&(g.current.value="")}}},U=async()=>{try{await Ws(s.id),_.updateArea(s.id,{logo:void 0})}catch(N){console.error("Failed to remove logo:",N)}},K=N=>{s.logo&&_.updateArea(s.id,{logo:{...s.logo,position:N}})},w=N=>{if(!s.logo)return;const D=parseFloat(N.target.value)||.1;if(s.logo.keepAspectRatio&&s.logo.width>0){const B=s.logo.height/s.logo.width;_.updateArea(s.id,{logo:{...s.logo,width:D,height:Math.round(D*B*10)/10}})}else _.updateArea(s.id,{logo:{...s.logo,width:D}})},C=N=>{if(!s.logo)return;const D=parseFloat(N.target.value)||.1;if(s.logo.keepAspectRatio&&s.logo.height>0){const B=s.logo.width/s.logo.height;_.updateArea(s.id,{logo:{...s.logo,height:D,width:Math.round(D*B*10)/10}})}else _.updateArea(s.id,{logo:{...s.logo,height:D}})},H=()=>{s.logo&&_.updateArea(s.id,{logo:{...s.logo,keepAspectRatio:!s.logo.keepAspectRatio}})},J=N=>{s.logo&&_.updateArea(s.id,{logo:{...s.logo,opacity:parseFloat(N.target.value)}})};return e.jsxs("div",{className:"area-editor",children:[e.jsxs("div",{className:"area-editor-header",children:[e.jsx("span",{className:"area-editor-title",children:o("config:areas.editArea")}),e.jsx("button",{className:"area-editor-close",onClick:n,children:"×"})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("common:labels.name")}),e.jsx("input",{type:"text",className:"area-editor-input",value:r,onChange:v,placeholder:o("config:areas.areaName")})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("config:areas.color")}),e.jsx("div",{className:"color-picker-row",children:ms.map(N=>e.jsx("div",{className:`color-swatch ${s.color===N?"selected":""}`,style:{backgroundColor:N},onClick:()=>b(N)},N))})]}),e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("config:areas.layer")}),e.jsxs("div",{className:"area-layer-buttons",children:[e.jsxs("button",{className:"area-layer-btn",onClick:R,title:o("config:areas.bringToFront"),children:[e.jsx(I,{name:"arrow-up",size:12})," ",o("config:areas.front")]}),e.jsxs("button",{className:"area-layer-btn",onClick:k,title:o("config:areas.sendToBack"),children:[e.jsx(I,{name:"arrow-down",size:12})," ",o("config:areas.back")]})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:o("config:areas.logo")}),e.jsxs("div",{className:"area-logo-section",children:[(ce=s.logo)!=null&&ce.filename?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"area-logo-preview",children:[e.jsx("img",{src:qs(s.logo.filename),alt:"Logo",className:"area-logo-thumbnail"}),e.jsx("button",{className:"area-logo-remove-btn",onClick:U,children:o("config:areas.removeLogo")}),e.jsx("button",{className:"area-logo-replace-btn",onClick:()=>{var N;return(N=g.current)==null?void 0:N.click()},disabled:h,children:h?"...":e.jsx(I,{name:"refresh",size:12})})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:o("config:areas.logoPosition")}),e.jsx("div",{className:"area-logo-position-row",children:Gs.map(({key:N,labelKey:D})=>{var B;return e.jsx("button",{className:`area-logo-pos-btn ${((B=s.logo)==null?void 0:B.position)===N?"active":""}`,onClick:()=>K(N),children:o(`config:areas.${D}`)},N)})})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:o("config:areas.logoSize")}),e.jsxs("div",{className:"area-logo-size-row",children:[e.jsxs("label",{className:"area-logo-size-field",children:[e.jsx("span",{children:o("config:areas.logoWidth")}),e.jsx("input",{type:"number",className:"area-logo-size-input",value:s.logo.width,onChange:w,min:.1,step:.1})]}),e.jsxs("label",{className:"area-logo-size-field",children:[e.jsx("span",{children:o("config:areas.logoHeight")}),e.jsx("input",{type:"number",className:"area-logo-size-input",value:s.logo.height,onChange:C,min:.1,step:.1})]}),e.jsxs("label",{className:"area-logo-aspect-label",title:o("config:areas.keepAspectRatio"),children:[e.jsx("input",{type:"checkbox",checked:s.logo.keepAspectRatio,onChange:H}),o("config:areas.keepAspectRatio")]})]})]}),e.jsxs("div",{className:"area-logo-config-row",children:[e.jsx("span",{className:"area-logo-config-label",children:o("config:areas.logoOpacity")}),e.jsxs("div",{className:"area-logo-opacity-row",children:[e.jsx("input",{type:"range",min:0,max:1,step:.05,value:s.logo.opacity??.8,onChange:J,className:"area-logo-opacity-slider"}),e.jsxs("span",{className:"area-logo-opacity-value",children:[Math.round((s.logo.opacity??.8)*100),"%"]})]})]})]}):e.jsx("button",{className:"area-logo-upload-btn",onClick:()=>{var N;return(N=g.current)==null?void 0:N.click()},disabled:h,children:h?"...":o("config:areas.uploadLogo")}),e.jsx("input",{ref:g,type:"file",accept:"image/*",style:{display:"none"},onChange:V})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:o("config:areas.folders",{count:s.directories.length})}),e.jsxs("div",{className:"area-folders-list",children:[s.directories.map(N=>e.jsxs("div",{className:"area-folder-item",title:N,children:[e.jsx("span",{className:"area-folder-icon clickable",onClick:()=>a==null?void 0:a(s.id),title:o("config:areas.openFolder"),children:e.jsx(I,{name:"folder",size:14})}),e.jsx("span",{className:"area-folder-path",children:N.split("/").pop()||N}),e.jsx("button",{className:"area-folder-remove",onClick:D=>M(N,D),title:o("config:areas.removeFolder"),children:"×"})]},N)),u?e.jsxs("div",{className:"area-add-folder-inline",children:[e.jsx(gs,{value:x,onChange:y,onSubmit:L,placeholder:o("config:areas.folderPlaceholder"),className:"area-add-folder-input",directoriesOnly:!0,autoFocus:!0}),e.jsx("button",{className:"area-add-folder-confirm",onClick:L,children:"+"})]}):e.jsx("button",{className:"area-add-folder-btn",onClick:()=>S(!0),children:o("config:areas.addFolder")})]})]}),e.jsxs("div",{className:"area-editor-row",style:{flexDirection:"column",alignItems:"stretch"},children:[e.jsx("div",{className:"area-editor-label",style:{marginBottom:6},children:o("config:areas.prompt","Prompt")}),e.jsx("textarea",{className:"area-editor-input",value:c,onChange:p,placeholder:o("config:areas.promptPlaceholder","System prompt for agents in this area..."),rows:4,style:{resize:"vertical",fontFamily:"monospace",fontSize:12}}),e.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4},children:o("config:areas.promptHint","This prompt is injected into agents assigned to this area. Takes effect on next context refresh.")})]}),s.assignedAgentIds.length>0&&e.jsxs("div",{className:"area-editor-row",children:[e.jsx("div",{className:"area-editor-label",children:o("config:areas.assignedAgents",{count:s.assignedAgentIds.length})}),e.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:o("config:areas.rightClickUnassign")})]})]})}function Js(){const{t:s}=Y(["config","common"]),n=fs(),[a,o]=l.useState(!1),[r,d]=l.useState(null),[c,i]=l.useState({name:"",key:"",value:"",description:""}),[u,S]=l.useState(null),x=()=>{o(!0),d(null),i({name:"",key:"",value:"",description:""})},y=p=>{d(p.id),o(!1),i({name:p.name,key:p.key,value:p.value,description:p.description||""})},h=()=>{o(!1),d(null),i({name:"",key:"",value:"",description:""})},f=()=>{!c.name.trim()||!c.key.trim()||(r?_.updateSecret(r,{name:c.name.trim(),key:c.key.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_"),value:c.value,description:c.description.trim()||void 0}):_.createSecret({name:c.name.trim(),key:c.key.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_"),value:c.value,description:c.description.trim()||void 0}),h())},g=p=>{S(p)},v=()=>{u&&(_.deleteSecret(u),r===u&&h())},b=p=>{navigator.clipboard.writeText(`{{${p}}}`)};return e.jsxs("div",{className:"secrets-section",children:[e.jsx("div",{className:"secrets-description",children:s("config:secrets.description",{placeholder:"{{KEY}}"})}),e.jsx("div",{className:"secrets-list",children:n.length===0&&!a?e.jsx("div",{className:"secrets-empty",children:s("config:secrets.noSecrets")}):n.map(p=>e.jsxs("div",{className:`secret-item ${r===p.id?"editing":""}`,children:[e.jsxs("div",{className:"secret-item-header",children:[e.jsxs("div",{className:"secret-item-info",children:[e.jsx("span",{className:"secret-item-name",children:p.name}),e.jsx("code",{className:"secret-item-key",onClick:()=>b(p.key),title:s("config:secrets.copyPlaceholder"),children:`{{${p.key}}}`})]}),e.jsxs("div",{className:"secret-item-actions",children:[e.jsx("button",{className:"secret-item-btn edit",onClick:()=>y(p),title:s("common:buttons.edit"),children:e.jsx(I,{name:"edit",size:12})}),e.jsx("button",{className:"secret-item-btn delete",onClick:()=>g(p.id),title:s("common:buttons.delete"),children:"×"})]})]}),p.description&&e.jsx("div",{className:"secret-item-description",children:p.description})]},p.id))}),(a||r)&&e.jsxs("div",{className:"secret-form",children:[e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("common:labels.name")}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.namePlaceholder"),value:c.name,onChange:p=>i({...c,name:p.target.value}),autoFocus:!0})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:"Key"}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.keyPlaceholder"),value:c.key,onChange:p=>i({...c,key:p.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"")})}),e.jsx("span",{className:"secret-form-hint",children:s("config:secrets.usedAs",{placeholder:`{{${c.key||"KEY"}}}`})})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("config:secrets.secretValue")}),e.jsx("input",{type:"password",className:"secret-form-input",placeholder:s("config:secrets.valuePlaceholder"),value:c.value,onChange:p=>i({...c,value:p.target.value})})]}),e.jsxs("div",{className:"secret-form-row",children:[e.jsx("label",{className:"secret-form-label",children:s("common:labels.description")}),e.jsx("input",{type:"text",className:"secret-form-input",placeholder:s("config:secrets.descriptionPlaceholder"),value:c.description,onChange:p=>i({...c,description:p.target.value})})]}),e.jsxs("div",{className:"secret-form-actions",children:[e.jsx("button",{className:"secret-form-btn cancel",onClick:h,children:s("common:buttons.cancel")}),e.jsx("button",{className:"secret-form-btn save",onClick:f,disabled:!c.name.trim()||!c.key.trim(),children:s(r?"config:secrets.update":"common:buttons.add")})]})]}),!a&&!r&&e.jsx("button",{className:"secrets-add-btn",onClick:x,children:s("config:secrets.addSecret")}),e.jsx(ge,{isOpen:u!==null,title:s("common:buttons.delete"),message:s("config:secrets.deleteConfirm"),confirmLabel:s("common:buttons.delete"),cancelLabel:s("common:buttons.cancel"),variant:"danger",onConfirm:v,onClose:()=>S(null)})]})}async function Zs(){const s=Z(),n=await fetch(`${X()}/api/agents/system-settings/prompt`,{headers:{Authorization:`Bearer ${s}`}});if(!n.ok)throw new Error(`Failed to fetch system prompt: ${n.statusText}`);return(await n.json()).prompt||""}async function Xs(s){const n=Z(),a=await fetch(`${X()}/api/agents/system-settings/prompt`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({prompt:s})});if(!a.ok)throw new Error(`Failed to update system prompt: ${a.statusText}`)}async function Qs(){const s=Z(),n=await fetch(`${X()}/api/agents/system-settings/prompt`,{method:"DELETE",headers:{Authorization:`Bearer ${s}`}});if(!n.ok)throw new Error(`Failed to clear system prompt: ${n.statusText}`)}async function ea(){const s=Z(),n=await fetch(`${X()}/api/agents/system-settings/echo-prompt`,{headers:{Authorization:`Bearer ${s}`}});if(!n.ok)throw new Error(`Failed to fetch echo prompt setting: ${n.statusText}`);return(await n.json()).enabled||!1}async function sa(s){const n=Z(),a=await fetch(`${X()}/api/agents/system-settings/echo-prompt`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({enabled:s})});if(!a.ok)throw new Error(`Failed to update echo prompt setting: ${a.statusText}`)}async function aa(){const s=Z(),n=await fetch(`${X()}/api/agents/system-settings/codex-binary`,{headers:{Authorization:`Bearer ${s}`}});if(!n.ok)throw new Error(`Failed to fetch codex binary path: ${n.statusText}`);return(await n.json()).path||""}async function ta(s){const n=Z(),a=await fetch(`${X()}/api/agents/system-settings/codex-binary`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({path:s})});if(!a.ok)throw new Error(`Failed to update codex binary path: ${a.statusText}`)}async function na(){const s=Z(),n=await fetch(`${X()}/api/agents/system-settings/tmux-mode`,{headers:{Authorization:`Bearer ${s}`}});if(!n.ok)throw new Error(`Failed to fetch tmux mode setting: ${n.statusText}`);return(await n.json()).enabled||!1}async function ia(s){const n=Z(),a=await fetch(`${X()}/api/agents/system-settings/tmux-mode`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({enabled:s})});if(!a.ok)throw new Error(`Failed to update tmux mode setting: ${a.statusText}`)}async function oa(){const s=Z(),n=await fetch(`${X()}/api/agents/system-settings/backup`,{headers:{Authorization:`Bearer ${s}`}});if(!n.ok)throw new Error(`Failed to fetch backup status: ${n.statusText}`);return n.json()}async function la(s){const n=Z(),a=await fetch(`${X()}/api/agents/system-settings/backup`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({enabled:s})});if(!a.ok){const o=await a.json().catch(()=>({}));throw new Error(o.error||`Failed to update backup setting: ${a.statusText}`)}return a.json()}function ca({checked:s,onChange:n,disabled:a}){return e.jsxs("label",{className:"config-toggle",children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:s,disabled:a,onChange:o=>n(o.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})}function ra(){const{t:s}=Y(["config","common"]),[n,a]=l.useState([]),[o,r]=l.useState(new Set),[d,c]=l.useState(new Set),[i,u]=l.useState(!1),[S,x]=l.useState(!1),[y,h]=l.useState(null),[f,g]=l.useState(null),[v,b]=l.useState(null),[p,L]=l.useState(null),[M,R]=l.useState(!1),[k,T]=l.useState(null);l.useEffect(()=>{ke(me("/api/config/categories")).then(j=>j.json()).then(j=>{const $=Array.isArray(j)?j:[];a($),r(new Set($.map(F=>F.id)))}).catch(j=>console.error("Failed to fetch config categories:",j))},[]),l.useEffect(()=>{oa().then(L).catch(j=>{console.error("Failed to fetch backup status:",j),T(j.message||"Failed to fetch backup status")})},[]);const V=async j=>{if(!M){R(!0),T(null);try{const $=await la(j);L($)}catch($){T($.message||"Failed to update backup setting")}finally{R(!1)}}},U=j=>{r($=>{const F=new Set($);return F.has(j)?F.delete(j):F.add(j),F})},K=j=>{c($=>{const F=new Set($);return F.has(j)?F.delete(j):F.add(j),F})},w=()=>r(new Set(n.map(j=>j.id))),C=()=>r(new Set),H=()=>{f&&c(new Set(f.categories.map(j=>j.id)))},J=()=>c(new Set),ce=async()=>{var j;if(o.size!==0){u(!0),b(null);try{const $=Array.from(o).join(","),F=await ke(me(`/api/config/export?categories=${$}`));if(!F.ok)throw new Error("Export failed");const Q=await F.blob(),ae=window.URL.createObjectURL(Q),ee=document.createElement("a");ee.href=ae;const A=F.headers.get("Content-Disposition"),q=((j=A==null?void 0:A.match(/filename="(.+)"/))==null?void 0:j[1])||"tide-commander-config.zip";ee.download=q,document.body.appendChild(ee),ee.click(),document.body.removeChild(ee),window.URL.revokeObjectURL(ae),b({type:"success",text:s("config:data.exportSuccess")})}catch($){b({type:"error",text:$.message||"Export failed"})}finally{u(!1)}}},N=async j=>{var F;const $=(F=j.target.files)==null?void 0:F[0];if($){h($),b(null),g(null),c(new Set);try{const Q=await ke(me("/api/config/preview"),{method:"POST",headers:{"Content-Type":"application/zip"},body:await $.arrayBuffer()});if(!Q.ok){const A=await Q.json();throw new Error(A.error||"Failed to preview config file")}const ae=await Q.json(),ee=Array.isArray(ae.categories)?ae.categories:[];g({...ae,categories:ee}),c(new Set(ee.map(A=>A.id)))}catch(Q){b({type:"error",text:Q.message||"Failed to read config file"}),h(null)}}},D=async()=>{if(!(!y||d.size===0)){x(!0),b(null);try{const j=Array.from(d).join(","),$=await ke(me(`/api/config/import?categories=${j}`),{method:"POST",headers:{"Content-Type":"application/zip"},body:await y.arrayBuffer()}),F=await $.json();if(!$.ok)throw new Error(F.error||"Import failed");b({type:"success",text:F.message||s("config:data.importSuccess")}),h(null),g(null),c(new Set)}catch(j){b({type:"error",text:j.message||"Import failed"})}finally{x(!1)}}},B=()=>{h(null),g(null),c(new Set),b(null)};return e.jsxs("div",{className:"data-section",children:[v&&e.jsx("div",{className:`data-message data-message-${v.type}`,children:v.text}),e.jsxs("div",{className:"data-subsection",children:[e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-title",children:"Hourly Backups"}),e.jsx(ca,{checked:!!(p!=null&&p.enabled),disabled:M||!p,onChange:V})]}),e.jsxs("div",{className:"data-backup-info",children:[p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:["Saves a compressed snapshot of your data every hour to"," ",e.jsx("code",{children:p.backupDir}),". Identical snapshots are skipped. Keeps the 8 newest plus one from each of the 2 most recent prior days."]}),!p.scriptExists&&e.jsxs("div",{style:{marginTop:6,color:"var(--dracula-red, #ff5555)"},children:["Backup script not found at ",e.jsx("code",{children:p.scriptPath})]}),p.lastRunAt&&e.jsxs("div",{style:{marginTop:6},children:["Last run: ",new Date(p.lastRunAt).toLocaleString(),p.lastRunOk===!0&&" — ok",p.lastRunOk===!1&&p.lastRunError&&e.jsxs("span",{style:{color:"var(--dracula-red, #ff5555)"},children:[" — ",p.lastRunError]})]})]}):e.jsx("div",{children:"Loading backup status…"}),k&&e.jsx("div",{className:"data-message data-message-error",style:{marginTop:6},children:k})]})]}),e.jsxs("div",{className:"data-subsection",children:[e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-title",children:s("config:data.exportData")}),e.jsxs("div",{className:"data-select-controls",children:[e.jsx("button",{className:"data-select-btn",onClick:w,children:s("common:labels.all")}),e.jsx("button",{className:"data-select-btn",onClick:C,children:s("common:labels.none")})]})]}),e.jsx("div",{className:"data-category-list",children:n.map(j=>e.jsxs("label",{className:"data-category-item",children:[e.jsx("input",{type:"checkbox",checked:o.has(j.id),onChange:()=>U(j.id)}),e.jsx("span",{className:"data-category-name",children:j.name})]},j.id))}),e.jsx("button",{className:"data-action-btn export",onClick:ce,disabled:i||o.size===0,children:i?s("config:data.exporting"):s("config:data.exportCount",{count:o.size})})]}),e.jsxs("div",{className:"data-subsection",children:[e.jsx("div",{className:"data-subsection-header",children:e.jsx("span",{className:"data-subsection-title",children:s("config:data.importData")})}),y?f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"data-import-info",children:[e.jsx("div",{className:"data-import-file",children:y.name}),e.jsxs("div",{className:"data-import-date",children:[s("config:data.exported"),": ",new Date(f.exportedAt).toLocaleDateString()]})]}),e.jsxs("div",{className:"data-subsection-header",children:[e.jsx("span",{className:"data-subsection-subtitle",children:s("config:data.selectToImport")}),e.jsxs("div",{className:"data-select-controls",children:[e.jsx("button",{className:"data-select-btn",onClick:H,children:s("common:labels.all")}),e.jsx("button",{className:"data-select-btn",onClick:J,children:s("common:labels.none")})]})]}),e.jsx("div",{className:"data-category-list",children:f.categories.map(j=>e.jsxs("label",{className:"data-category-item",children:[e.jsx("input",{type:"checkbox",checked:d.has(j.id),onChange:()=>K(j.id)}),e.jsx("span",{className:"data-category-name",children:j.name}),j.fileCount&&e.jsxs("span",{className:"data-category-count",children:["(",j.fileCount," ",s("config:data.files"),")"]})]},j.id))}),e.jsxs("div",{className:"data-import-actions",children:[e.jsx("button",{className:"data-action-btn cancel",onClick:B,children:s("common:buttons.cancel")}),e.jsx("button",{className:"data-action-btn import",onClick:D,disabled:S||d.size===0,children:S?s("config:data.importing"):s("config:data.importCount",{count:d.size})})]})]}):e.jsx("div",{className:"data-loading",children:s("config:data.readingFile")}):e.jsxs("label",{className:"data-file-input",children:[e.jsx("input",{type:"file",accept:".zip",onChange:N,style:{display:"none"}}),e.jsx("span",{className:"data-file-input-label",children:s("config:data.selectFile")})]})]})]})}function da(){const[s,n]=l.useState(()=>xs()),a=o=>{n(o);const r=js(o);ws(r)};return e.jsx("div",{className:"theme-selector",children:e.jsx("div",{className:"theme-selector-grid",children:bs.map(o=>e.jsxs("button",{className:`theme-option ${s===o.id?"active":""}`,onClick:()=>a(o.id),title:o.description,children:[e.jsx("div",{className:"theme-preview",children:e.jsxs("div",{className:"theme-preview-bg",style:{backgroundColor:o.colors.bgPrimary},children:[e.jsx("div",{className:"theme-preview-accent",style:{backgroundColor:o.colors.accentBlue}}),e.jsx("div",{className:"theme-preview-claude",style:{backgroundColor:o.colors.accentClaude}})]})}),e.jsx("span",{className:"theme-name",children:o.name})]},o.id))})})}function pa(){const{t:s}=Y(["config"]),{updateAvailable:n,updateInfo:a,recentReleases:o,isChecking:r,error:d,currentVersion:c,isAndroid:i,checkForUpdate:u,downloadAndInstall:S,openReleasePage:x}=zs(),y=f=>f?`${(f/(1024*1024)).toFixed(1)} MB`:"",h=f=>new Date(f).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return e.jsxs("div",{className:"about-section",children:[e.jsxs("div",{className:"about-logo",children:[e.jsx("span",{className:"about-logo-icon",children:e.jsx(I,{name:"waves",size:24})}),e.jsx("span",{className:"about-logo-text",children:"Tide Commander"})]}),e.jsxs("div",{className:"about-version",children:[e.jsx("span",{className:"about-version-label",children:s("config:about.version")}),e.jsxs("div",{className:"about-version-info",children:[e.jsx("span",{className:"about-version-value",children:c}),n&&a?e.jsx("span",{className:"about-version-update-badge",onClick:x,title:`Update available: ${a.version}`,children:a.version}):e.jsxs("a",{href:"https://github.com/deivid11/tide-commander/releases",target:"_blank",rel:"noopener noreferrer",className:"about-version-status",children:["(",s("config:about.updated"),")"]})]})]}),e.jsxs("div",{className:"about-update",children:[n&&a?e.jsxs("div",{className:"about-update-available",children:[e.jsxs("div",{className:"about-update-header",children:[e.jsx("span",{className:"about-update-badge",children:s("config:about.updateAvailable")}),e.jsx("span",{className:"about-update-version",children:a.version})]}),a.apkSize&&e.jsxs("div",{className:"about-update-size",children:[s("config:about.sizeLabel"),": ",y(a.apkSize)]}),d&&e.jsx("div",{className:"about-update-error",children:d}),e.jsxs("div",{className:"about-update-actions",children:[e.jsx("button",{className:"about-update-btn changelog",onClick:x,children:s("config:about.changelog")}),i&&a.apkUrl?e.jsx("button",{className:"about-update-btn download",onClick:S,children:s("config:about.downloadAPK")}):e.jsx("button",{className:"about-update-btn download",onClick:x,children:s("config:about.viewRelease")})]})]}):e.jsxs("div",{className:"about-update-check",children:[e.jsx("span",{className:"about-update-status",children:s(r?"config:about.checkingUpdates":"config:about.upToDate")}),e.jsx("button",{className:"about-update-btn check",onClick:()=>u(!0),disabled:r,children:r?"...":s("config:about.check")})]}),o.length>0&&e.jsxs("div",{className:"about-releases",children:[e.jsx("div",{className:"about-releases-title",children:s("config:about.recentReleases")}),e.jsx("div",{className:"about-releases-list",children:o.map(f=>e.jsxs("a",{href:f.releaseUrl,target:"_blank",rel:"noopener noreferrer",className:`about-release-item ${f.version===`v${c}`||f.version===c?"current":""}`,children:[e.jsx("span",{className:"about-release-version",children:f.version}),e.jsx("span",{className:"about-release-date",children:h(f.publishedAt)})]},f.version))})]})]}),e.jsx("div",{className:"about-description",children:s("config:about.tagline")}),e.jsxs("div",{className:"about-principles",children:[e.jsx("div",{className:"about-principles-title",children:s("config:about.corePrinciples")}),e.jsxs("ul",{className:"about-principles-list",children:[e.jsx("li",{children:s("config:about.principle1")}),e.jsx("li",{children:s("config:about.principle2")}),e.jsx("li",{children:s("config:about.principle3")}),e.jsx("li",{children:s("config:about.principle4")})]})]}),e.jsx("div",{className:"about-links",children:e.jsxs("a",{href:"https://github.com/deivid11/tide-commander",target:"_blank",rel:"noopener noreferrer",className:"about-link",children:[e.jsx("span",{className:"about-link-icon",children:e.jsx(I,{name:"package",size:14})}),e.jsx("span",{children:s("config:about.repository")})]})}),e.jsxs("div",{className:"about-credits",children:[e.jsx("div",{className:"about-credits-title",children:s("config:about.specialThanks")}),e.jsxs("div",{className:"about-credit-item",children:[e.jsx("a",{href:"https://kenney.nl",target:"_blank",rel:"noopener noreferrer",className:"about-credit-link",children:"Kenney.nl"}),e.jsx("span",{className:"about-credit-desc",children:s("config:about.kenneyCredit")})]}),e.jsxs("div",{className:"about-credit-item",children:[e.jsx("a",{href:"https://claude.ai/code",target:"_blank",rel:"noopener noreferrer",className:"about-credit-link",children:"Claude Code"}),e.jsx("span",{className:"about-credit-desc",children:s("config:about.claudeCodeCredit")})]})]})]})}const ha={gmail:"✉️",slack:"💬",jira:"📋","google-calendar":"📅",docx:"📄",whatsapp:"📱"};function ua({onOpenModal:s}){const[n,a]=l.useState([]),[o,r]=l.useState(!0),d=l.useCallback(async()=>{try{const c=await ke(me("/api/integrations"));if(!c.ok)return;const i=await c.json();a(i)}catch{}finally{r(!1)}},[]);return l.useEffect(()=>{d()},[d]),o?e.jsx("div",{style:{color:"var(--text-secondary, #a6adc8)",fontSize:12,padding:"4px 0"},children:"Loading..."}):n.length===0?e.jsx("div",{style:{color:"var(--text-secondary, #a6adc8)",fontSize:12,padding:"4px 0"},children:"No integrations available."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[n.map(c=>{const i=ha[c.id]||"🔌",u=!!c.status.error,S=c.status.connected,x=u?"#f38ba8":S?"#a6e3a1":"#fab387",y=u?"Error":S?"Connected":"Setup Required",h=u?"✗":S?"✓":"⚠";return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",borderRadius:4,background:"var(--surface-1, #181825)",border:"1px solid var(--border, #313244)",fontSize:12,minHeight:26},children:[e.jsx("span",{style:{fontSize:13,flexShrink:0},children:i}),e.jsx("span",{style:{flex:1,minWidth:0,color:"var(--text-primary, #cdd6f4)",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.name}),e.jsx("span",{style:{color:x,fontSize:10,fontWeight:500,whiteSpace:"nowrap"},title:y,children:h}),e.jsx("button",{onClick:()=>s(c.id),title:`Configure ${c.name}`,style:{background:"none",border:"none",cursor:"pointer",padding:"1px 3px",fontSize:12,color:"var(--text-secondary, #a6adc8)",borderRadius:3,flexShrink:0,lineHeight:1},onMouseEnter:f=>{f.target.style.color="var(--text-primary, #cdd6f4)"},onMouseLeave:f=>{f.target.style.color="var(--text-secondary, #a6adc8)"},children:"⚙️"})]},c.id)}),e.jsx("button",{onClick:()=>s(),style:{background:"none",border:"1px dashed var(--border, #313244)",borderRadius:4,padding:"3px 8px",cursor:"pointer",color:"var(--text-secondary, #a6adc8)",fontSize:11,textAlign:"center",marginTop:2},onMouseEnter:c=>{c.target.style.borderColor="var(--accent, #89b4fa)",c.target.style.color="var(--accent, #89b4fa)"},onMouseLeave:c=>{c.target.style.borderColor="var(--border, #313244)",c.target.style.color="var(--text-secondary, #a6adc8)"},children:"Manage All Integrations"})]})}function ma({isOpen:s,onClose:n}){const{t:a}=Y(["config"]),[o,r]=l.useState(""),[d,c]=l.useState(""),[i,u]=l.useState(!0),[S,x]=l.useState(null),[y,h]=l.useState(null),[f,g]=l.useState(!1),[v,b]=l.useState(!1),[p,L]=l.useState(!1);l.useEffect(()=>{s&&M()},[s]);const M=async()=>{try{u(!0),x(null),h(null);const C=await Zs();r(C),c(C),g(!1)}catch(C){x(C instanceof Error?C.message:"Failed to load system prompt")}finally{u(!1)}},R=C=>{const H=C.target.value;r(H),g(H!==d),x(null),h(null)},k=async()=>{try{x(null),h(null),await Xs(o),c(o),g(!1),h(a("config:systemPrompt.saved"))}catch(C){x(C instanceof Error?C.message:"Failed to save system prompt")}},T=()=>{b(!0)},V=async()=>{try{x(null),h(null),await Qs(),r(""),c(""),g(!1),h(a("config:systemPrompt.cleared"))}catch(C){x(C instanceof Error?C.message:"Failed to clear system prompt")}},U=()=>{r(d),g(!1),x(null),h(null)},K=()=>{if(f){L(!0);return}n()},w=C=>{C.key==="Escape"&&(C.preventDefault(),K())};return s?e.jsxs(Se,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:K,children:e.jsxs("div",{className:"system-prompt-modal",onClick:C=>C.stopPropagation(),onKeyDown:w,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:a("config:systemPrompt.title")}),e.jsx("button",{className:"modal-close",onClick:K,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:i?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:"Loading system prompt..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:a("config:systemPrompt.description")}),S&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"warn",size:14})}),S]}),y&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"check",size:14})}),y]}),e.jsxs("div",{className:"editor-wrapper",children:[e.jsxs("div",{className:"editor-header",children:[e.jsx("label",{htmlFor:"prompt-input",className:"editor-label",children:a("config:systemPrompt.editPrompt")}),e.jsxs("span",{className:"char-count",children:[o.length," ",a("config:systemPrompt.characters")]})]}),e.jsx("textarea",{id:"prompt-input",className:"prompt-editor",value:o,onChange:R,placeholder:a("config:systemPrompt.placeholder"),rows:18,autoFocus:!0}),e.jsx("div",{className:"editor-hint",children:a("config:systemPrompt.hint")})]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left",children:e.jsx("button",{className:"btn btn-danger",onClick:T,disabled:!o||i,children:a("config:systemPrompt.clear")})}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:K,children:"Close"}),e.jsx("button",{className:"btn btn-secondary",onClick:U,disabled:!f||i,children:a("config:systemPrompt.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:k,disabled:!f||i,children:a("config:systemPrompt.save")})]})]})]})}),e.jsx(ge,{isOpen:v,title:a("config:systemPrompt.clear"),message:a("config:systemPrompt.confirmClear"),confirmLabel:a("config:systemPrompt.clear"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{V()},onClose:()=>b(!1)}),e.jsx(ge,{isOpen:p,title:"Unsaved Changes",message:"You have unsaved changes. Close anyway?",confirmLabel:"Close anyway",cancelLabel:"Keep editing",variant:"danger",onConfirm:n,onClose:()=>L(!1)})]}):null}const Xe={enabled:!1,baseUrl:"",defaultSessionId:"",webhookVerifyToken:"",showIncomingToasts:!0},ga=2500,fa=12e4;function Qe(s){return{enabled:s.enabled??!1,baseUrl:s.baseUrl??"",defaultSessionId:s.defaultSessionId??"",webhookVerifyToken:s.webhookVerifyToken??"",showIncomingToasts:s.showIncomingToasts??!0}}function xa(s,n){return s.enabled===n.enabled&&s.baseUrl===n.baseUrl&&s.defaultSessionId===n.defaultSessionId&&s.webhookVerifyToken===n.webhookVerifyToken&&s.showIncomingToasts===n.showIncomingToasts}function ba({isOpen:s,onClose:n}){const{t:a}=Y(["config"]),[o,r]=l.useState(Xe),[d,c]=l.useState(Xe),[i,u]=l.useState(!1),[S,x]=l.useState([]),[y,h]=l.useState(!0),[f,g]=l.useState(null),[v,b]=l.useState(null),[p,L]=l.useState(""),[M,R]=l.useState(!1),[k,T]=l.useState(""),[V,U]=l.useState(null),[K,w]=l.useState(null),[C,H]=l.useState(null),J=l.useRef(null),ce=l.useRef(0),[N,D]=l.useState(""),[B,j]=l.useState(""),[$,F]=l.useState(null),[Q,ae]=l.useState(!1),[ee,A]=l.useState(!1),[q,ne]=l.useState(!1),[re,te]=l.useState(!1),[he,we]=l.useState(null),ye=!xa(o,d),ie=l.useCallback(()=>{J.current&&(clearTimeout(J.current),J.current=null)},[]),P=l.useCallback(async()=>{try{h(!0),g(null),b(null);const[m,z]=await Promise.all([is(),ys()]),oe=Qe(m);if(r(oe),c(oe),u(!!z.configured),z.configured)try{const fe=await Me();x(Array.isArray(fe)?fe:[])}catch{x([])}else x([])}catch(m){g(m instanceof Error?m.message:a("config:whatsapp.errors.loadFailed"))}finally{h(!1)}},[a]),ue=l.useCallback(async()=>{try{const m=await Me();x(Array.isArray(m)?m:[])}catch{}},[]);l.useEffect(()=>(s?P():(ie(),U(null),w(null),H(null),L(""),R(!1),F(null)),()=>{ie()}),[s,P,ie]);const se=(m,z)=>{r(oe=>({...oe,[m]:z})),g(null),b(null)},$e=async()=>{try{g(null),b(null);const m=await Cs({enabled:o.enabled,baseUrl:o.baseUrl.trim(),defaultSessionId:o.defaultSessionId.trim(),webhookVerifyToken:o.webhookVerifyToken,showIncomingToasts:o.showIncomingToasts});window.dispatchEvent(new CustomEvent("tide:whatsapp-config-updated"));const z=Qe(m);r(z),c(z),b(a("config:whatsapp.saved"))}catch(m){g(m instanceof Error?m.message:a("config:whatsapp.errors.saveFailed"))}},Ce=()=>{r(d),g(null),b(null)},be=()=>{if(ye){A(!0);return}n()},De=m=>{m.key==="Escape"&&(m.preventDefault(),be())},Ae=async()=>{const m=p.trim();if(m)try{g(null),b(null),await Ns(m),L(""),R(!1),u(!0),b(a("config:whatsapp.apiKeySaved"))}catch(z){g(z instanceof Error?z.message:a("config:whatsapp.errors.apiKeySaveFailed"))}},Fe=()=>{ne(!0)},Te=async()=>{try{g(null),b(null),await As(),u(!1),b(a("config:whatsapp.apiKeyCleared"))}catch(m){g(m instanceof Error?m.message:a("config:whatsapp.errors.apiKeyClearFailed"))}},_e=l.useCallback(async m=>{if(Date.now()>ce.current){H(a("config:whatsapp.pairingTimeout")),U(null),w(null),ie(),ue();return}try{const z=await vs(m);if(z.status&&["connected","paired","open","ready"].includes(z.status.toLowerCase())){H(a("config:whatsapp.pairingSuccess")),U(null),w(null),ie(),ue();return}const fe=z.qrUrl??z.qr??null;fe&&w(fe)}catch(z){H(z instanceof Error?z.message:a("config:whatsapp.errors.qrFetchFailed"))}J.current=setTimeout(()=>{_e(m)},ga)},[ue,ie,a]),Ee=async()=>{const m=k.trim();if(m)try{g(null),b(null),H(null),w(null),ie(),await ks(m),T(""),U(m),ce.current=Date.now()+fa,_e(m),ue()}catch(z){g(z instanceof Error?z.message:a("config:whatsapp.errors.sessionCreateFailed"))}},ve=()=>{ie(),U(null),w(null),H(null)},Oe=m=>{we(m),te(!0)},Ie=async()=>{if(he)try{g(null),b(null),await Ts(he),V===he&&ve(),ue(),b(a("config:whatsapp.sessionDeleted"))}catch(m){g(m instanceof Error?m.message:a("config:whatsapp.errors.sessionDeleteFailed"))}finally{we(null)}},pe=async()=>{const m=N.trim(),z=B.trim();if(!(!m||!z))try{ae(!0),F(null);const oe=o.defaultSessionId.trim()||void 0;await Ss(m,z,oe),F({kind:"success",text:a("config:whatsapp.testSent")})}catch(oe){F({kind:"error",text:oe instanceof Error?oe.message:a("config:whatsapp.errors.testSendFailed")})}finally{ae(!1)}};return s?e.jsxs(Se,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:be,children:e.jsxs("div",{className:"whatsapp-config-modal",onClick:m=>m.stopPropagation(),onKeyDown:De,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:a("config:whatsapp.title")}),e.jsx("button",{className:"modal-close",onClick:be,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:y?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:a("config:whatsapp.loading")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:a("config:whatsapp.description")}),f&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"warn",size:14})}),f]}),v&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"check",size:14})}),v]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.general")}),e.jsxs("div",{className:"wa-field wa-field-row",children:[e.jsx("label",{htmlFor:"wa-enabled",className:"wa-label",children:a("config:whatsapp.enabled")}),e.jsxs("label",{className:"wa-toggle",children:[e.jsx("input",{id:"wa-enabled",type:"checkbox",checked:o.enabled,onChange:m=>se("enabled",m.target.checked)}),e.jsx("span",{className:"wa-toggle-track",children:e.jsx("span",{className:"wa-toggle-thumb"})})]})]}),e.jsxs("div",{className:"wa-field wa-field-row",children:[e.jsx("label",{htmlFor:"wa-show-toasts",className:"wa-label",children:a("config:whatsapp.showIncomingToasts")}),e.jsxs("label",{className:"wa-toggle",children:[e.jsx("input",{id:"wa-show-toasts",type:"checkbox",checked:o.showIncomingToasts,onChange:m=>se("showIncomingToasts",m.target.checked)}),e.jsx("span",{className:"wa-toggle-track",children:e.jsx("span",{className:"wa-toggle-thumb"})})]})]}),e.jsx("span",{className:"wa-hint",children:a("config:whatsapp.showIncomingToastsHelp")}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-base-url",className:"wa-label",children:a("config:whatsapp.baseUrl")}),e.jsx("input",{id:"wa-base-url",type:"text",className:"wa-input",placeholder:"http://localhost:3007",value:o.baseUrl,onChange:m=>se("baseUrl",m.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-default-session",className:"wa-label",children:a("config:whatsapp.defaultSessionId")}),e.jsx("input",{id:"wa-default-session",type:"text",className:"wa-input",placeholder:a("config:whatsapp.defaultSessionIdPlaceholder"),value:o.defaultSessionId,onChange:m=>se("defaultSessionId",m.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-webhook-token",className:"wa-label",children:a("config:whatsapp.webhookVerifyToken")}),e.jsx("input",{id:"wa-webhook-token",type:"text",className:"wa-input",placeholder:a("config:whatsapp.webhookVerifyTokenPlaceholder"),value:o.webhookVerifyToken,onChange:m=>se("webhookVerifyToken",m.target.value)})]})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.apiKey")}),e.jsx("div",{className:"wa-key-status",children:i?e.jsxs("span",{className:"wa-status wa-status-ok",children:[e.jsx(I,{name:"check",size:12})," ",a("config:whatsapp.configured")]}):e.jsxs("span",{className:"wa-status wa-status-warn",children:[e.jsx(I,{name:"warn",size:12})," ",a("config:whatsapp.notConfigured")]})}),e.jsxs("div",{className:"wa-field wa-field-inline",children:[e.jsx("input",{type:M?"text":"password",className:"wa-input",placeholder:a("config:whatsapp.apiKeyPlaceholder"),value:p,onChange:m=>L(m.target.value)}),e.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>R(m=>!m),title:a(M?"config:whatsapp.hideKey":"config:whatsapp.showKey"),children:e.jsx(I,{name:M?"eye-closed":"eye",size:14})}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:Ae,disabled:!p.trim(),children:a("config:whatsapp.saveKey")}),e.jsx("button",{type:"button",className:"btn btn-danger",onClick:Fe,disabled:!i,children:a("config:whatsapp.clearKey")})]}),e.jsx("span",{className:"wa-hint",children:a("config:whatsapp.apiKeyHint")})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.sessions")}),e.jsx("div",{className:"wa-sessions-list",children:!Array.isArray(S)||S.length===0?e.jsx("div",{className:"wa-empty",children:a("config:whatsapp.noSessions")}):S.map(m=>e.jsxs("div",{className:"wa-session-row",children:[e.jsxs("div",{className:"wa-session-info",children:[e.jsx("span",{className:"wa-session-id",children:m.id}),e.jsx("span",{className:`wa-session-status status-${(m.status??"unknown").toLowerCase()}`,children:m.status||"—"}),m.pairedNumber&&e.jsx("span",{className:"wa-session-paired",children:m.pairedNumber})]}),e.jsx("button",{type:"button",className:"btn btn-danger btn-sm",onClick:()=>Oe(m.id),children:a("config:whatsapp.deleteSession")})]},m.id))}),e.jsxs("div",{className:"wa-field wa-field-inline",children:[e.jsx("input",{type:"text",className:"wa-input",placeholder:a("config:whatsapp.addSessionPlaceholder"),value:k,onChange:m=>T(m.target.value),onKeyDown:m=>{m.key==="Enter"&&Ee()}}),e.jsx("button",{type:"button",className:"btn btn-primary",onClick:Ee,disabled:!k.trim()||V!==null,children:a("config:whatsapp.addSession")})]}),V&&e.jsxs("div",{className:"wa-qr-panel",children:[e.jsxs("div",{className:"wa-qr-header",children:[e.jsx("span",{children:a("config:whatsapp.qrPrompt",{id:V})}),e.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:ve,children:a("config:whatsapp.cancelPairing")})]}),K?e.jsx("div",{className:"wa-qr-image",children:e.jsx("img",{src:K,alt:"WhatsApp pairing QR code"})}):e.jsxs("div",{className:"wa-qr-loading",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:a("config:whatsapp.waitingForQr")})]})]}),C&&!V&&e.jsx("div",{className:"wa-pairing-message",children:C})]}),e.jsxs("section",{className:"wa-section",children:[e.jsx("h3",{className:"wa-section-title",children:a("config:whatsapp.sections.testMessage")}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-test-to",className:"wa-label",children:a("config:whatsapp.testTo")}),e.jsx("input",{id:"wa-test-to",type:"text",className:"wa-input",placeholder:a("config:whatsapp.testToPlaceholder"),value:N,onChange:m=>D(m.target.value)})]}),e.jsxs("div",{className:"wa-field",children:[e.jsx("label",{htmlFor:"wa-test-message",className:"wa-label",children:a("config:whatsapp.testMessageBody")}),e.jsx("textarea",{id:"wa-test-message",className:"wa-textarea",rows:4,placeholder:a("config:whatsapp.testMessageBodyPlaceholder"),value:B,onChange:m=>j(m.target.value)})]}),e.jsx("div",{className:"wa-field-inline wa-field-end",children:e.jsx("button",{type:"button",className:"btn btn-primary",onClick:pe,disabled:!N.trim()||!B.trim()||Q,children:a(Q?"config:whatsapp.sending":"config:whatsapp.sendTest")})}),$&&e.jsxs("div",{className:`alert ${$.kind==="success"?"alert-success":"alert-error"}`,children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:$.kind==="success"?"check":"warn",size:14})}),$.text]})]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left"}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:be,children:a("config:whatsapp.close")}),e.jsx("button",{className:"btn btn-secondary",onClick:Ce,disabled:!ye||y,children:a("config:whatsapp.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:$e,disabled:!ye||y,children:a("config:whatsapp.save")})]})]})]})}),e.jsx(ge,{isOpen:ee,title:a("config:whatsapp.unsavedTitle"),message:a("config:whatsapp.unsavedMessage"),confirmLabel:a("config:whatsapp.closeAnyway"),cancelLabel:a("config:whatsapp.keepEditing"),variant:"danger",onConfirm:()=>{A(!1),n()},onClose:()=>A(!1)}),e.jsx(ge,{isOpen:q,title:a("config:whatsapp.clearKey"),message:a("config:whatsapp.confirmClearKey"),confirmLabel:a("config:whatsapp.clearKey"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{Te()},onClose:()=>ne(!1)}),e.jsx(ge,{isOpen:re,title:a("config:whatsapp.deleteSession"),message:a("config:whatsapp.confirmDeleteSession",{id:he??""}),confirmLabel:a("config:whatsapp.deleteSession"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{Ie()},onClose:()=>{te(!1),we(null)}})]}):null}const ls=["messages","statusChanges","taskComplete","errors","planReady","agentSpawned","agentStopped"];function He(s=!1){const n=Z(),a={};return n&&(a.Authorization=`Bearer ${n}`),s&&(a["Content-Type"]="application/json"),a}async function We(s,n){try{const a=await s.json();if(a&&typeof a.error=="string")return a.error;if(a&&typeof a.message=="string")return a.message}catch{}return`${n}: ${s.statusText}`}async function ja(){const s=await fetch(`${X()}/api/whatsapp/notification-config`,{headers:He()});if(!s.ok)throw new Error(await We(s,"Failed to fetch WhatsApp notification config"));return s.json()}async function wa(s){const n=await fetch(`${X()}/api/whatsapp/notification-config`,{method:"PATCH",headers:He(!0),body:JSON.stringify(s)});if(!n.ok)throw new Error(await We(n,"Failed to update WhatsApp notification config"));return n.json()}async function ya(){const s=await fetch(`${X()}/api/whatsapp/notification-config`,{method:"DELETE",headers:He()});if(!s.ok)throw new Error(await We(s,"Failed to reset WhatsApp notification config"));return s.json()}const Le={messages:!0,statusChanges:!0,taskComplete:!0,errors:!0,planReady:!0,agentSpawned:!0,agentStopped:!0},es={filter:{...Le},recipient:""};function va(s,n){if(s.recipient!==n.recipient)return!1;for(const a of ls)if(s.filter[a]!==n.filter[a])return!1;return!0}function Na({isOpen:s,onClose:n}){const{t:a}=Y(["config"]),[o,r]=l.useState(es),[d,c]=l.useState(es),[i,u]=l.useState(!0),[S,x]=l.useState(null),[y,h]=l.useState(null),[f,g]=l.useState(!1),[v,b]=l.useState(!1),p=!va(o,d),L=l.useCallback(async()=>{try{u(!0),x(null),h(null);const w=await ja(),C={filter:{...Le,...w.filter},recipient:w.recipient??""};r(C),c(C)}catch(w){x(w instanceof Error?w.message:a("config:whatsappNotifications.errors.loadFailed"))}finally{u(!1)}},[a]);l.useEffect(()=>{s&&L()},[s,L]);const M=(w,C)=>{r(H=>({...H,filter:{...H.filter,[w]:C}})),x(null),h(null)},R=w=>{r(C=>({...C,recipient:w})),x(null),h(null)},k=async()=>{try{x(null),h(null);const w=await wa({filter:o.filter,recipient:o.recipient.trim()}),C={filter:{...Le,...w.filter},recipient:w.recipient??""};r(C),c(C),h(a("config:whatsappNotifications.saved"))}catch(w){x(w instanceof Error?w.message:a("config:whatsappNotifications.errors.saveFailed"))}},T=()=>{r(d),x(null),h(null)},V=async()=>{try{x(null),h(null);const w=await ya(),C={filter:{...Le,...w.filter},recipient:w.recipient??""};r(C),c(C),h(a("config:whatsappNotifications.resetDone"))}catch(w){x(w instanceof Error?w.message:a("config:whatsappNotifications.errors.resetFailed"))}},U=()=>{if(p){g(!0);return}n()},K=w=>{w.key==="Escape"&&(w.preventDefault(),U())};return s?e.jsxs(Se,{children:[e.jsx("div",{className:`modal-overlay ${s?"visible":""}`,onClick:U,children:e.jsxs("div",{className:"whatsapp-notifications-modal",onClick:w=>w.stopPropagation(),onKeyDown:K,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:a("config:whatsappNotifications.title")}),e.jsx("button",{className:"modal-close",onClick:U,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsx("div",{className:"modal-body",children:i?e.jsxs("div",{className:"loading-state",children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{children:a("config:whatsappNotifications.loading")})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"modal-description",children:a("config:whatsappNotifications.description")}),S&&e.jsxs("div",{className:"alert alert-error",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"warn",size:14})}),S]}),y&&e.jsxs("div",{className:"alert alert-success",children:[e.jsx("span",{className:"alert-icon",children:e.jsx(I,{name:"check",size:14})}),y]}),e.jsxs("section",{className:"wan-section",children:[e.jsx("h3",{className:"wan-section-title",children:a("config:whatsappNotifications.sections.recipient")}),e.jsxs("div",{className:"wan-field",children:[e.jsx("label",{htmlFor:"wan-recipient",className:"wan-label",children:a("config:whatsappNotifications.recipientLabel")}),e.jsx("input",{id:"wan-recipient",type:"text",className:"wan-input",placeholder:a("config:whatsappNotifications.recipientPlaceholder"),value:o.recipient,onChange:w=>R(w.target.value)}),e.jsx("span",{className:"wan-hint",children:a("config:whatsappNotifications.recipientHint")})]})]}),e.jsxs("section",{className:"wan-section",children:[e.jsx("h3",{className:"wan-section-title",children:a("config:whatsappNotifications.sections.events")}),e.jsx("p",{className:"wan-section-hint",children:a("config:whatsappNotifications.eventsHint")}),ls.map(w=>e.jsxs("div",{className:"wan-toggle-row",children:[e.jsxs("div",{className:"wan-toggle-info",children:[e.jsx("span",{className:"wan-toggle-title",children:a(`config:whatsappNotifications.events.${w}.title`)}),e.jsx("span",{className:"wan-toggle-help",children:a(`config:whatsappNotifications.events.${w}.help`)})]}),e.jsxs("label",{className:"wan-toggle",children:[e.jsx("input",{type:"checkbox",checked:o.filter[w],onChange:C=>M(w,C.target.checked)}),e.jsx("span",{className:"wan-toggle-track",children:e.jsx("span",{className:"wan-toggle-thumb"})})]})]},w))]})]})}),e.jsxs("div",{className:"modal-footer",children:[e.jsx("div",{className:"footer-buttons-left",children:e.jsx("button",{className:"btn btn-danger",onClick:()=>b(!0),disabled:i,children:a("config:whatsappNotifications.resetToDefaults")})}),e.jsxs("div",{className:"footer-buttons-right",children:[e.jsx("button",{className:"btn btn-secondary",onClick:U,children:a("config:whatsappNotifications.close")}),e.jsx("button",{className:"btn btn-secondary",onClick:T,disabled:!p||i,children:a("config:whatsappNotifications.reset")}),e.jsx("button",{className:"btn btn-primary",onClick:k,disabled:!p||i,children:a("config:whatsappNotifications.save")})]})]})]})}),e.jsx(ge,{isOpen:f,title:a("config:whatsappNotifications.unsavedTitle"),message:a("config:whatsappNotifications.unsavedMessage"),confirmLabel:a("config:whatsappNotifications.closeAnyway"),cancelLabel:a("config:whatsappNotifications.keepEditing"),variant:"danger",onConfirm:()=>{g(!1),n()},onClose:()=>g(!1)}),e.jsx(ge,{isOpen:v,title:a("config:whatsappNotifications.resetToDefaults"),message:a("config:whatsappNotifications.confirmReset"),confirmLabel:a("config:whatsappNotifications.resetToDefaults"),cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{V(),b(!1)},onClose:()=>b(!1)})]}):null}function cs(s){const n=s.replace(/@.*$/,"");return/^\d{10,15}$/.test(n)?n.startsWith("521")&&n.length===13?`+52 1 ${n.slice(3,5)} ${n.slice(5,9)} ${n.slice(9)}`:n.startsWith("52")&&n.length===12?`+52 ${n.slice(2,4)} ${n.slice(4,8)} ${n.slice(8)}`:n.startsWith("1")&&n.length===11?`+1 ${n.slice(1,4)} ${n.slice(4,7)} ${n.slice(7)}`:`+${n}`:s}function ka(s,n=Date.now()){const a=s*1e3,o=n-a;if(o<0)return ss(a);const r=Math.floor(o/6e4);if(r<1)return"now";if(r<60)return`${r}m`;const d=Math.floor(r/60);if(d<24)return`${d}h`;const c=Math.floor(d/24);return c===1?"yesterday":c<7?`${c}d`:ss(a)}function ss(s){return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Sa(s){const n=s*1e3;return new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function rs(s){switch(s){case"image":return"📷";case"audio":return"🎤";case"video":return"📹";case"document":return"📎";case"location":return"📍";case"contact":return"👤";case"sticker":return"🌟";case"reaction":return"👍";case"unknown":return"❓";case"text":default:return null}}function Ca(s,n){return s.length<=n?s:s.slice(0,Math.max(0,n-1)).trimEnd()+"…"}function Aa({chats:s,selectedChatId:n,loading:a,error:o,onSelect:r,onRefresh:d,now:c}){const{t:i}=Y(["config","common"]);return e.jsxs("div",{className:"whatsapp-history-chatlist",children:[e.jsxs("div",{className:"whatsapp-history-chatlist__header",children:[e.jsx("span",{className:"whatsapp-history-chatlist__title",children:i("config:whatsappHistory.chats")}),e.jsx("button",{type:"button",className:"whatsapp-history-chatlist__refresh",onClick:d,disabled:a,"aria-label":i("config:whatsappHistory.refresh"),title:i("config:whatsappHistory.refresh"),children:"⟳"})]}),o&&e.jsx("div",{className:"whatsapp-history-chatlist__error",children:o}),a&&s.length===0&&e.jsxs("div",{className:"whatsapp-history-chatlist__loading",children:[e.jsx("span",{className:"spinner"}),e.jsx("span",{children:i("config:whatsappHistory.loadingChats")})]}),!a&&!o&&s.length===0&&e.jsx("div",{className:"whatsapp-history-chatlist__empty",children:i("config:whatsappHistory.emptyChats")}),e.jsx("ul",{className:"whatsapp-history-chatlist__items",children:s.map(u=>{const S=rs(u.lastMessageType),x=u.lastMessagePreview||`[${u.lastMessageType}]`,y=u.chatId===n;return e.jsx("li",{className:`whatsapp-history-chatlist__item ${y?"is-selected":""}`,children:e.jsxs("button",{type:"button",className:"whatsapp-history-chatlist__button",onClick:()=>r(u.chatId),children:[e.jsxs("div",{className:"whatsapp-history-chatlist__row",children:[e.jsx("span",{className:"whatsapp-history-chatlist__name",children:cs(u.chatId)}),e.jsx("span",{className:"whatsapp-history-chatlist__time",children:ka(u.lastTimestamp,c)})]}),e.jsxs("div",{className:"whatsapp-history-chatlist__row whatsapp-history-chatlist__row--secondary",children:[e.jsxs("span",{className:"whatsapp-history-chatlist__preview",children:[u.lastDirection==="outbound"&&e.jsx("span",{className:"whatsapp-history-chatlist__direction",children:"↗ "}),S&&e.jsxs("span",{className:"whatsapp-history-chatlist__preview-icon",children:[S," "]}),Ca(x,40)]}),u.unreadCount>0&&e.jsx("span",{className:"whatsapp-history-chatlist__unread",children:u.unreadCount})]})]})},u.chatId)})})]})}function Ta({message:s}){const n=s.direction==="outbound"?"outbound":"inbound",a=rs(s.messageType),o=(s.body??"").trim(),r=o.length>0,d=r?null:`[${s.messageType}]`;return e.jsx("div",{className:`whatsapp-history-bubble whatsapp-history-bubble--${n}`,children:e.jsxs("div",{className:"whatsapp-history-bubble__inner",children:[a&&e.jsx("span",{className:"whatsapp-history-bubble__type-icon",title:s.messageType,children:a}),r?e.jsx("span",{className:"whatsapp-history-bubble__body",children:o}):e.jsx("span",{className:"whatsapp-history-bubble__placeholder",children:d}),s.audioTranscription&&e.jsxs("span",{className:"whatsapp-history-bubble__transcription",children:["“",s.audioTranscription,"”"]}),s.mediaPath&&e.jsx("a",{className:"whatsapp-history-bubble__media-link",href:s.mediaPath,target:"_blank",rel:"noopener noreferrer",children:s.mediaFilename||"open media"}),e.jsx("span",{className:"whatsapp-history-bubble__time",children:Sa(s.timestamp)})]})})}const _a=["all","inbound","outbound"],Ea=["all","text","image","audio","video","document","sticker","location","contact","reaction","unknown"];function Ia({direction:s,type:n,onDirectionChange:a,onTypeChange:o,disabled:r}){const{t:d}=Y(["config"]);return e.jsxs("div",{className:"whatsapp-history-filters",children:[e.jsxs("label",{className:"whatsapp-history-filters__field",children:[e.jsx("span",{children:d("config:whatsappHistory.direction")}),e.jsx("select",{value:s,onChange:c=>a(c.target.value),disabled:r,children:_a.map(c=>e.jsx("option",{value:c,children:d(`config:whatsappHistory.directionValues.${c}`)},c))})]}),e.jsxs("label",{className:"whatsapp-history-filters__field",children:[e.jsx("span",{children:d("config:whatsappHistory.type")}),e.jsx("select",{value:n,onChange:c=>o(c.target.value),disabled:r,children:Ea.map(c=>e.jsx("option",{value:c,children:d(`config:whatsappHistory.typeValues.${c}`)},c))})]})]})}function Pa({chatId:s,messages:n,loading:a,loadingMore:o,error:r,hasMore:d,direction:c,type:i,onDirectionChange:u,onTypeChange:S,onLoadMore:x}){const{t:y}=Y(["config"]),h=l.useRef(null),f=l.useRef(null);return l.useEffect(()=>{h.current&&f.current!==s&&(f.current=s,h.current.scrollTop=h.current.scrollHeight)},[s,n.length]),s?e.jsxs("div",{className:"whatsapp-history-messages",children:[e.jsxs("div",{className:"whatsapp-history-messages__header",children:[e.jsx("div",{className:"whatsapp-history-messages__title",children:cs(s)}),e.jsx(Ia,{direction:c,type:i,onDirectionChange:u,onTypeChange:S,disabled:a})]}),e.jsxs("div",{className:"whatsapp-history-messages__scroll",ref:h,children:[d&&e.jsx("div",{className:"whatsapp-history-messages__load-more-row",children:e.jsx("button",{type:"button",className:"whatsapp-history-messages__load-more",onClick:x,disabled:o||a,children:y(o?"config:whatsappHistory.loadingOlder":"config:whatsappHistory.loadOlder")})}),r&&e.jsx("div",{className:"whatsapp-history-messages__error",children:r}),a&&n.length===0&&e.jsxs("div",{className:"whatsapp-history-messages__loading",children:[e.jsx("span",{className:"spinner"}),e.jsx("span",{children:y("config:whatsappHistory.loadingMessages")})]}),!a&&!r&&n.length===0&&e.jsx("div",{className:"whatsapp-history-messages__empty",children:y("config:whatsappHistory.emptyMessages")}),n.map(g=>e.jsx(Ta,{message:g},La(g)))]})]}):e.jsx("div",{className:"whatsapp-history-messages whatsapp-history-messages--empty",children:e.jsx("div",{className:"whatsapp-history-messages__placeholder",children:y("config:whatsappHistory.selectChat")})})}function La(s){return typeof s.id=="number"?`id:${s.id}`:s.messageId?`mid:${s.messageId}`:`t:${s.timestamp}:${s.fromJid}:${(s.body??"").slice(0,16)}`}function ds(){const s=Z(),n={};return s&&(n.Authorization=`Bearer ${s}`),n}async function ps(s,n){try{const a=await s.json();if(a&&typeof a.error=="string")return a.error;if(a&&typeof a.message=="string")return a.message}catch{}return`${n}: ${s.statusText}`}async function $a(s){const n=`${X()}/api/whatsapp/chats/${encodeURIComponent(s)}`,a=await fetch(n,{headers:ds()});if(!a.ok)throw new Error(await ps(a,"Failed to fetch WhatsApp chats"));return a.json()}async function as(s,n,a={}){const o=new URLSearchParams;a.cursor&&o.set("cursor",a.cursor),typeof a.limit=="number"&&o.set("limit",String(a.limit)),a.direction&&o.set("direction",a.direction),a.type&&o.set("type",a.type);const r=o.toString(),d=`${X()}/api/whatsapp/chats/${encodeURIComponent(s)}/${encodeURIComponent(n)}/messages${r?`?${r}`:""}`,c=await fetch(d,{headers:ds()});if(!c.ok)throw new Error(await ps(c,"Failed to fetch WhatsApp messages"));return c.json()}const Da=50;function Fa({isOpen:s,onClose:n}){const{t:a}=Y(["config"]),[o,r]=l.useState([]),[d,c]=l.useState(null),[i,u]=l.useState(null),[S,x]=l.useState([]),[y,h]=l.useState(!1),[f,g]=l.useState(null),[v,b]=l.useState(null),[p,L]=l.useState([]),[M,R]=l.useState(!1),[k,T]=l.useState(!1),[V,U]=l.useState(null),[K,w]=l.useState(null),[C,H]=l.useState("all"),[J,ce]=l.useState("all"),[N,D]=l.useState(()=>Date.now()),B=l.useRef(0);l.useEffect(()=>{if(!s)return;const A=window.setInterval(()=>D(Date.now()),6e4);return()=>window.clearInterval(A)},[s]),l.useEffect(()=>{if(!s)return;let A=!1;return(async()=>{var q;try{u(null);const[ne,re]=await Promise.all([Me().catch(()=>[]),is().catch(()=>null)]);if(A)return;r(ne);const te=(re==null?void 0:re.defaultSessionId)||((q=ne[0])==null?void 0:q.id)||null;c(he=>he??te)}catch(ne){if(A)return;u(ne instanceof Error?ne.message:String(ne))}})(),()=>{A=!0}},[s]);const j=l.useCallback(async A=>{h(!0),g(null);try{const q=await $a(A);x(q.chats)}catch(q){g(q instanceof Error?q.message:String(q))}finally{h(!1)}},[]);l.useEffect(()=>{!s||!d||(b(null),L([]),w(null),j(d))},[s,d,j]);const $=l.useMemo(()=>{const A={limit:Da};return C!=="all"&&(A.direction=C),J!=="all"&&(A.type=J),A},[C,J]),F=l.useCallback(async(A,q,ne)=>{const re=++B.current;R(!0),U(null),L([]),w(null);try{const te=await as(A,q,ne);if(re!==B.current)return;L([...te.messages].reverse()),w(te.nextCursor)}catch(te){if(re!==B.current)return;U(te instanceof Error?te.message:String(te))}finally{re===B.current&&R(!1)}},[]);l.useEffect(()=>{!s||!d||!v||F(d,v,$)},[s,d,v,$,F]);const Q=l.useCallback(async()=>{if(!(!d||!v||!K)){T(!0),U(null);try{const A=await as(d,v,{...$,cursor:K});L(q=>[...[...A.messages].reverse(),...q]),w(A.nextCursor)}catch(A){U(A instanceof Error?A.message:String(A))}finally{T(!1)}}},[d,v,K,$]),ae=l.useCallback(()=>{d&&j(d)},[d,j]),ee=l.useCallback(A=>{A.key==="Escape"&&(A.preventDefault(),n())},[n]);return s?e.jsx(Se,{children:e.jsx("div",{className:"modal-overlay visible",onClick:n,children:e.jsxs("div",{className:"whatsapp-history-modal",onClick:A=>A.stopPropagation(),onKeyDown:ee,children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h2",{children:a("config:whatsappHistory.title")}),e.jsx("div",{className:"whatsapp-history-modal__session",children:e.jsxs("label",{children:[e.jsx("span",{children:a("config:whatsappHistory.session")}),e.jsxs("select",{value:d??"",onChange:A=>c(A.target.value||null),disabled:o.length===0,children:[o.length===0&&e.jsx("option",{value:"",children:a("config:whatsappHistory.noSessions")}),o.map(A=>e.jsxs("option",{value:A.id,children:[A.id,A.pairedNumber?` (${A.pairedNumber})`:""]},A.id))]})]})}),e.jsx("button",{className:"modal-close",onClick:n,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),i&&e.jsx("div",{className:"whatsapp-history-modal__alert",children:i}),e.jsxs("div",{className:"whatsapp-history-modal__body",children:[e.jsx(Aa,{chats:S,selectedChatId:v,loading:y,error:f,onSelect:b,onRefresh:ae,now:N}),e.jsx(Pa,{chatId:v,messages:p,loading:M,loadingMore:k,error:V,hasMore:K!==null,direction:C,type:J,onDirectionChange:H,onTypeChange:ce,onLoadMore:Q})]})]})})}):null}function Oa({isOpen:s,onClose:n,onOpenConfig:a,onOpenNotifications:o,onOpenHistory:r}){const{t:d}=Y(["config"]);if(l.useEffect(()=>{if(!s)return;const i=u=>{u.key==="Escape"&&(u.preventDefault(),n())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[s,n]),!s)return null;const c=i=>{n(),i()};return e.jsx(Se,{children:e.jsx("div",{className:"modal-overlay visible",onClick:n,children:e.jsxs("div",{className:"whatsapp-hub-modal",onClick:i=>i.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsxs("h2",{children:[e.jsx("span",{className:"whatsapp-hub-modal__icon",children:"📱"}),d("config:whatsappHub.title",{defaultValue:"WhatsApp"})]}),e.jsx("button",{className:"modal-close",onClick:n,"aria-label":"Close",children:e.jsx(I,{name:"close",size:16})})]}),e.jsxs("div",{className:"modal-body",children:[e.jsx("p",{className:"whatsapp-hub-modal__intro",children:d("config:whatsappHub.intro",{defaultValue:"Pick what you want to manage for the WhatsApp integration."})}),e.jsxs("div",{className:"whatsapp-hub-modal__options",children:[e.jsxs("button",{type:"button",className:"whatsapp-hub-modal__option",onClick:()=>c(a),children:[e.jsx("span",{className:"whatsapp-hub-modal__option-icon",children:e.jsx(I,{name:"gear",size:18})}),e.jsxs("span",{className:"whatsapp-hub-modal__option-text",children:[e.jsx("span",{className:"whatsapp-hub-modal__option-title",children:d("config:whatsappHub.config",{defaultValue:"Integration config"})}),e.jsx("span",{className:"whatsapp-hub-modal__option-desc",children:d("config:whatsappHub.configDesc",{defaultValue:"Server URL, API key, sessions and pairing."})})]})]}),e.jsxs("button",{type:"button",className:"whatsapp-hub-modal__option",onClick:()=>c(o),children:[e.jsx("span",{className:"whatsapp-hub-modal__option-icon",children:e.jsx(I,{name:"bell",size:18})}),e.jsxs("span",{className:"whatsapp-hub-modal__option-text",children:[e.jsx("span",{className:"whatsapp-hub-modal__option-title",children:d("config:whatsappHub.notifications",{defaultValue:"Notifications"})}),e.jsx("span",{className:"whatsapp-hub-modal__option-desc",children:d("config:whatsappHub.notificationsDesc",{defaultValue:"Which agent events get forwarded and to whom."})})]})]}),e.jsxs("button",{type:"button",className:"whatsapp-hub-modal__option",onClick:()=>c(r),children:[e.jsx("span",{className:"whatsapp-hub-modal__option-icon",children:e.jsx(I,{name:"hourglass",size:18})}),e.jsxs("span",{className:"whatsapp-hub-modal__option-text",children:[e.jsx("span",{className:"whatsapp-hub-modal__option-title",children:d("config:whatsappHub.history",{defaultValue:"History"})}),e.jsx("span",{className:"whatsapp-hub-modal__option-desc",children:d("config:whatsappHub.historyDesc",{defaultValue:"Browse persisted chats and messages."})})]})]})]})]})]})})})}const Ra=[{value:"auto",label:"Auto",icon:"🕐"},{value:"dawn",label:"Dawn",icon:"🌅"},{value:"day",label:"Day",icon:"☀️"},{value:"dusk",label:"Dusk",icon:"🌇"},{value:"night",label:"Night",icon:"🌙"}],za=[{value:"none",label:"Grass",icon:"🌱"},{value:"concrete",label:"Concrete",icon:"🏗️"},{value:"galactic",label:"Galactic",icon:"🌌"},{value:"metal",label:"Metal",icon:"⚙️"},{value:"hex",label:"Hex",icon:"⬡"},{value:"circuit",label:"Circuit",icon:"🔌"},{value:"pokemon-stadium",label:"Pokemon",icon:"🔴"}],Ua=[{value:"static",label:"Static",icon:"🧍"},{value:"idle",label:"Idle",icon:"🚶"},{value:"walk",label:"Walk",icon:"🚶‍♂️"},{value:"sprint",label:"Sprint",icon:"🏃"},{value:"jump",label:"Jump",icon:"⬆️"},{value:"fall",label:"Fall",icon:"⬇️"},{value:"crouch",label:"Crouch",icon:"🧎"},{value:"sit",label:"Sit",icon:"🪑"},{value:"die",label:"Die",icon:"💀"},{value:"emote-yes",label:"Yes",icon:"👍"},{value:"emote-no",label:"No",icon:"👎"}],Ba=[{value:"normal",label:"Normal",icon:"🎨"},{value:"bw",label:"B&W",icon:"⬛"},{value:"sepia",label:"Sepia",icon:"🟤"},{value:"cool",label:"Cool",icon:"❄️"},{value:"warm",label:"Warm",icon:"🔥"},{value:"neon",label:"Neon",icon:"💜"}],Ma=[{key:"showTrees",icon:"🌳",label:"Trees"},{key:"showBushes",icon:"🌿",label:"Bushes"},{key:"showHouse",icon:"🏠",label:"House"},{key:"showLamps",icon:"💡",label:"Lamps"},{key:"showGrass",icon:"🟩",label:"Grass"},{key:"showClouds",icon:"☁️",label:"Clouds"}],Va=[{value:null,label:"Auto",color:"linear-gradient(135deg, #4a90d9 0%, #0a1a2a 100%)"},{value:"#4a90d9",label:"Day Blue",color:"#4a90d9"},{value:"#0a1a2a",label:"Night",color:"#0a1a2a"},{value:"#ff6b35",label:"Sunset",color:"#ff6b35"},{value:"#1a0a2e",label:"Purple",color:"#1a0a2e"},{value:"#2d5a27",label:"Matrix",color:"#2d5a27"},{value:"#8b0000",label:"Blood",color:"#8b0000"},{value:"#000000",label:"Void",color:"#000000"}],Ka={showTrees:"trees",showBushes:"bushes",showHouse:"house",showLamps:"lamps",showGrass:"grass",showClouds:"clouds"},Ha={none:"grass","pokemon-stadium":"pokemon"},Wa={"emote-yes":"yes","emote-no":"no"},qa={"":"auto","#4a90d9":"dayBlue","#0a1a2a":"night","#ff6b35":"sunset","#1a0a2e":"purple","#2d5a27":"matrix","#8b0000":"blood","#000000":"void"};function le({checked:s,onChange:n}){return e.jsxs("label",{className:"config-toggle",children:[e.jsx("input",{type:"checkbox",className:"config-toggle-input",checked:s,onChange:a=>n(a.target.checked)}),e.jsx("span",{className:"config-toggle-track",children:e.jsx("span",{className:"config-toggle-thumb"})})]})}function je({options:s,value:n,onChange:a,iconOnly:o=!1}){return e.jsx("div",{className:"chip-selector",children:s.map(r=>e.jsxs("button",{className:`chip ${n===r.value?"active":""}`,onClick:()=>a(r.value),title:r.label,children:[e.jsx("span",{className:"chip-icon",children:r.icon}),!o&&e.jsx("span",{className:"chip-label",children:r.label})]},r.value))})}function E({text:s,query:n}){if(!n.trim())return e.jsx(e.Fragment,{children:s});const a=s.toLowerCase(),o=n.toLowerCase(),r=a.indexOf(o);if(r===-1)return e.jsx(e.Fragment,{children:s});const d=s.slice(0,r),c=s.slice(r,r+n.length),i=s.slice(r+n.length);return e.jsxs(e.Fragment,{children:[d,e.jsx("mark",{className:"search-highlight",children:c}),i]})}const Ga=[{id:"general",title:"General",keywords:["history","hide costs","grid","fps","power saving","performance","limit","editor","external editor","language","idioma","语言","vibration","haptic","intensity","tab title","tmux","process persistence"]},{id:"agentNames",title:"Agent Names",keywords:["agent","names","custom","characters","rename"]},{id:"defaultClass",title:"Default Spawn Class",keywords:["default","class","spawn","agent","scout","builder","random"]},{id:"appearance",title:"Appearance",keywords:["theme","appearance","color","dark","light","style","look"]},{id:"connection",title:"Connection",keywords:["backend","url","auth","token","reconnect","server","api","connect","codex","opencode","binary","path"]},{id:"scene",title:"Scene",keywords:["character","size","indicator","scale","time","dawn","day","dusk","night","auto"]},{id:"terrain",title:"Terrain",keywords:["trees","bushes","house","lamps","grass","clouds","fog","brightness","floor","sky","color","environment","battlefield","size","grid","simple","minimal","dark","clean"]},{id:"modelStyle",title:"Agent Model Style",keywords:["saturation","roughness","metalness","glow","emissive","reflections","wireframe","color mode","material","shader"]},{id:"animations",title:"Animations",keywords:["idle","working","animation","walk","run","sprint","jump","sit","crouch"]},{id:"secrets",title:"Secrets",keywords:["secrets","api","key","password","credentials","env","environment"]},{id:"systemPrompt",title:"System Prompt",keywords:["system","prompt","global","instructions","ai","agent","rules","guidelines"]},{id:"data",title:"Data",keywords:["export","import","backup","restore","save","load","json"]},{id:"integrations",title:"Integrations",keywords:["integrations","integraciones","plugins","gmail","slack","jira","calendar","docx","email","whatsapp","notifications","notification","baileys","history","historial","chat","messages","inbox","config","setup"]},{id:"workflows",title:"Workflows",keywords:["workflow","automation","state machine","editor","actions","transitions","pipeline"]},{id:"triggers",title:"Triggers",keywords:["trigger","event","webhook","cron","slack","email","jira","matching","fire"]},{id:"monitoring",title:"Monitoring",keywords:["monitoring","logs","triggers","events","history","workflow","traces","audit","timeline"]},{id:"experimental",title:"Experimental",keywords:["experimental","2d","view","voice","assistant","speech","tts","text to speech","echo","prompt","duplicate"]},{id:"about",title:"About",keywords:["about","version","update","credits","github","releases"]}],Be=[{value:"auto",label:"Auto",icon:"🌐"},{value:"en",label:"English",icon:"🇺🇸"},{value:"zh-CN",label:"中文",icon:"🇨🇳"},{value:"es",label:"Español",icon:"🇪🇸"},{value:"hi",label:"हिन्दी",icon:"🇮🇳"},{value:"pt",label:"Português",icon:"🇧🇷"},{value:"ru",label:"Русский",icon:"🇷🇺"},{value:"ja",label:"日本語",icon:"🇯🇵"},{value:"de",label:"Deutsch",icon:"🇩🇪"},{value:"fr",label:"Français",icon:"🇫🇷"},{value:"it",label:"Italiano",icon:"🇮🇹"}];function Ya({config:s,onChange:n,searchQuery:a="",onOpenIntegrationsModal:o,onOpenMonitoringModal:r,onOpenWorkflowEditor:d,onOpenTriggerManager:c}){var qe;const{t:i}=Y(["config","common"]),u=Ve(),S=_s(),[x,y]=l.useState(()=>Es(Ne.DEFAULT_AGENT_CLASS)||"scout"),[h,f]=l.useState(u.settings.historyLimit),[g,v]=l.useState(()=>Is()),[b,p]=l.useState(!1),[L,M]=l.useState(""),[R,k]=l.useState(()=>Z()),[T,V]=l.useState(!1),[U,K]=l.useState(!1),[w,C]=l.useState(""),[H,J]=l.useState(!1),[ce,N]=l.useState(!1),[D,B]=l.useState(!1),[j,$]=l.useState(!1),[F,Q]=l.useState(!1),[ae,ee]=l.useState(""),[A,q]=l.useState(!1);l.useEffect(()=>{aa().then(ee).catch(()=>{})},[]),l.useEffect(()=>{ea().then(t=>{t!==u.settings.experimentalEchoPrompt&&_.updateSettings({experimentalEchoPrompt:t})}).catch(()=>{})},[]),l.useEffect(()=>{na().then(t=>{t!==u.settings.tmuxMode&&_.updateSettings({tmuxMode:t})}).catch(()=>{})},[]),l.useEffect(()=>Ps(t=>{v(t),p(!1)}),[]);const ne=Ra.map(t=>({...t,label:i(`config:time.${t.value}`)})),re=za.map(t=>({...t,label:i(`config:floor.${Ha[t.value]||t.value}`)})),te=Ua.map(t=>({...t,label:i(`config:animation.${Wa[t.value]||t.value}`)})),he=Ba.map(t=>({...t,label:i(`config:colorMode.${t.value}`)})),we=Ma.map(t=>({...t,label:i(`config:terrain.${Ka[t.key]}`)})),ye=Va.map(t=>({...t,label:i(`config:sky.${qa[t.value??""]}`)})),ie=a.trim()?Ga.filter(t=>{const O=a.toLowerCase();return t.title.toLowerCase().includes(O)||t.keywords.some(de=>de.toLowerCase().includes(O))}).map(t=>t.id):null,P=t=>ie?ie.includes(t):!0,ue=P("integrations"),se=u.settings.customAgentNames||[],$e=se.length>0?se:Ls,Ce=()=>{const t=w.trim();t&&!se.includes(t)&&(_.updateSettings({customAgentNames:[...se,t]}),C(""))},be=t=>{_.updateSettings({customAgentNames:se.filter(O=>O!==t)})},De=()=>{_.updateSettings({customAgentNames:[]})},Ae=()=>{const t=L.trim();if(t){if(g.includes(t)){M("");return}v([...g,t]),p(!0),M("")}},Fe=t=>{v(g.filter((O,de)=>de!==t)),p(!0)},Te=(t,O)=>{const de=t+O;if(de<0||de>=g.length)return;const xe=g.slice();[xe[t],xe[de]]=[xe[de],xe[t]],v(xe),p(!0)},_e=()=>{Ds(g),p(!1),Ue()},Ee=t=>{k(t),V(!0)},ve=()=>{Pe(Ne.AUTH_TOKEN,R),V(!1),Ue()},Oe=t=>{ee(t),q(!0)},Ie=()=>{ta(ae).catch(()=>{}),q(!1)},pe=t=>{n({...s,terrain:{...s.terrain,...t}})},m=t=>{n({...s,modelStyle:{...s.modelStyle,...t}})},z=t=>{n({...s,animations:{...s.animations,...t}})},oe=t=>{f(t),_.updateSettings({historyLimit:t})},fe=t=>{const O=s.terrain[t];typeof O=="boolean"&&pe({[t]:!O})},G=a.trim().length>0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"config-section",children:[ie&&ie.length===0&&e.jsx("div",{className:"config-no-results",children:i("config:noResults",{query:a})}),P("general")&&e.jsxs(W,{title:i("config:sections.general"),storageKey:"general",defaultOpen:!0,forceOpen:G&&P("general"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.history"),query:a})}),e.jsx("input",{type:"number",className:"config-input config-input-sm",value:h,onChange:t=>oe(parseInt(t.target.value)||100),min:50,max:2e3,step:50})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.hideCosts"),query:a})}),e.jsx(le,{checked:u.settings.hideCost,onChange:t=>_.updateSettings({hideCost:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.grid"),query:a})}),e.jsx(le,{checked:s.gridVisible,onChange:t=>n({...s,gridVisible:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.showFPS"),query:a})}),e.jsx(le,{checked:u.settings.showFPS,onChange:t=>_.updateSettings({showFPS:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.fpsLimit"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"120",step:"10",value:s.fpsLimit,onChange:t=>n({...s,fpsLimit:parseInt(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.fpsLimit===0?"∞":s.fpsLimit})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Experimental: Reduce FPS when idle to save power",children:[e.jsx(E,{text:i("config:general.powerSaving"),query:a})," ",e.jsx(I,{name:"bolt",size:12})]}),e.jsx(le,{checked:u.settings.powerSaving,onChange:t=>_.updateSettings({powerSaving:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",title:"Wrap agent processes in tmux sessions so they survive server restarts (requires tmux installed)",children:e.jsx(E,{text:i("config:general.tmuxMode"),query:a})}),e.jsx(le,{checked:u.settings.tmuxMode,onChange:async t=>{_.updateSettings({tmuxMode:t});try{await ia(t)}catch(O){console.error("Failed to sync tmux mode setting to server:",O)}}})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.vibrationIntensity"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"5",step:"1",value:u.settings.vibrationIntensity,onChange:t=>_.updateSettings({vibrationIntensity:parseInt(t.target.value)})}),e.jsx("span",{className:"config-value",children:u.settings.vibrationIntensity===0?i("config:vibrationValues.off"):u.settings.vibrationIntensity===1?i("config:vibrationValues.ultraLight"):u.settings.vibrationIntensity===2?i("config:vibrationValues.veryLight"):u.settings.vibrationIntensity===3?i("config:vibrationValues.light"):u.settings.vibrationIntensity===4?i("config:vibrationValues.medium"):i("config:vibrationValues.heavy")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.externalEditor"),query:a})}),e.jsx("input",{type:"text",className:"config-input",placeholder:i("config:general.externalEditorPlaceholder"),value:u.settings.externalEditorCommand||"",onChange:t=>_.updateSettings({externalEditorCommand:t.target.value})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.tabTitle"),query:a})}),e.jsx("input",{type:"text",className:"config-input",placeholder:i("config:general.tabTitlePlaceholder"),value:u.settings.tabTitle||"",onChange:t=>_.updateSettings({tabTitle:t.target.value})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:general.language"),query:a})}),e.jsx(je,{options:Be,value:localStorage.getItem("tide-commander-language-mode")==="manual"?((qe=Be.find(t=>t.value!=="auto"&&ze.language.startsWith(t.value.split("-")[0])))==null?void 0:qe.value)||"en":"auto",onChange:t=>{var O;if(t==="auto"){localStorage.setItem("tide-commander-language-mode","auto");const de=navigator.language,xe=((O=Be.find(Ge=>Ge.value!=="auto"&&de.startsWith(Ge.value.split("-")[0])))==null?void 0:O.value)||"en";ze.changeLanguage(xe)}else localStorage.setItem("tide-commander-language-mode","manual"),ze.changeLanguage(t)}})]})]}),P("agentNames")&&e.jsx(W,{title:i("config:sections.agentNames"),storageKey:"agentNames",defaultOpen:!1,forceOpen:G&&P("agentNames"),children:e.jsxs("div",{className:"agent-names-section",children:[e.jsx("span",{className:"config-hint",children:se.length>0?i("config:agentNames.customConfigured",{count:se.length}):i("config:agentNames.usingDefaults")}),e.jsxs("div",{className:"agent-names-input-row",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",placeholder:i("config:agentNames.addPlaceholder"),value:w,onChange:t=>C(t.target.value),onKeyDown:t=>{t.key==="Enter"&&Ce()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:Ce,disabled:!w.trim(),title:i("config:agentNames.addName"),children:"+"})]}),e.jsx("div",{className:"agent-names-list",children:$e.map((t,O)=>e.jsxs("div",{className:"agent-name-chip",children:[e.jsx("span",{className:"agent-name-text",children:t}),se.length>0&&e.jsx("button",{className:"agent-name-remove",onClick:()=>be(t),title:i("common:buttons.remove"),children:"x"})]},`${t}-${O}`))}),se.length>0&&e.jsx("button",{className:"config-btn config-btn-link",onClick:De,children:i("common:buttons.resetToDefaults")})]})}),P("defaultClass")&&e.jsx(W,{title:"Default Spawn Class",storageKey:"defaultClass",defaultOpen:!1,forceOpen:G&&P("defaultClass"),children:e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-hint",children:'Class pre-selected when the spawn modal opens. "Random" picks a different class each time.'}),e.jsxs("div",{className:"agent-names-list",style:{flexWrap:"wrap",gap:"6px",marginTop:"8px"},children:[e.jsx("div",{className:`agent-name-chip${x==="random"?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{y("random"),Pe(Ne.DEFAULT_AGENT_CLASS,"random")},children:e.jsx("span",{className:"agent-name-text",children:"🎲 Random"})}),Object.entries($s).map(([t,O])=>e.jsx("div",{className:`agent-name-chip${x===t?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{y(t),Pe(Ne.DEFAULT_AGENT_CLASS,t)},children:e.jsxs("span",{className:"agent-name-text",children:[O.icon," ",t.charAt(0).toUpperCase()+t.slice(1)]})},t)),S.map(t=>e.jsx("div",{className:`agent-name-chip${x===t.id?" agent-name-chip--selected":""}`,style:{cursor:"pointer",userSelect:"none"},onClick:()=>{y(t.id),Pe(Ne.DEFAULT_AGENT_CLASS,t.id)},children:e.jsxs("span",{className:"agent-name-text",children:[t.icon," ",t.name]})},t.id))]})]})}),P("appearance")&&e.jsx(W,{title:i("config:sections.appearance"),storageKey:"appearance",defaultOpen:!1,forceOpen:G&&P("appearance"),children:e.jsx(da,{})}),P("connection")&&e.jsxs(W,{title:i("config:sections.connection"),storageKey:"connection",defaultOpen:!1,forceOpen:G&&P("connection"),children:[e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:connection.backendUrl"),query:a})}),e.jsx("div",{className:"backend-urls-list",children:g.map((t,O)=>e.jsxs("div",{className:"backend-url-row",children:[e.jsx("span",{className:"backend-url-priority",title:i("config:connection.priorityLabel",{defaultValue:"Priority"}),children:O+1}),e.jsx("span",{className:"backend-url-text",title:t,children:t}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>Te(O,-1),disabled:O===0,title:i("config:connection.moveUp",{defaultValue:"Move up"}),children:"↑"}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>Te(O,1),disabled:O===g.length-1,title:i("config:connection.moveDown",{defaultValue:"Move down"}),children:"↓"}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>Fe(O),title:i("common:buttons.remove"),children:"x"})]},`${t}-${O}`))}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",value:L,onChange:t=>M(t.target.value),placeholder:i("config:connection.addUrlPlaceholder",{defaultValue:"http://host:port"}),onKeyDown:t=>{t.key==="Enter"&&Ae()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:Ae,disabled:!L.trim(),title:i("config:connection.addUrl",{defaultValue:"Add URL"}),children:"+"}),b&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:_e,title:i("config:connection.saveAndReconnect"),children:i("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:i("config:connection.urlsHint",{defaultValue:"Tried in order on connect; the first reachable host wins. Leave empty for auto-detect."})})]}),e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:connection.authToken"),query:a})}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:U?"text":"password",className:"config-input config-input-full",value:R,onChange:t=>Ee(t.target.value),placeholder:i("config:connection.tokenPlaceholder"),onKeyDown:t=>{t.key==="Enter"&&T&&ve()}}),e.jsx("button",{className:"config-btn config-btn-sm",onClick:()=>K(!U),title:i(U?"config:connection.hideToken":"config:connection.showToken"),children:e.jsx(I,{name:U?"eye-closed":"eye",size:14})}),T&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:ve,title:i("config:connection.saveAndReconnect"),children:i("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:i("config:connection.tokenRequired")})]}),e.jsxs("div",{className:"config-row config-row-stacked",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:connection.codexBinaryPath"),query:a})}),e.jsxs("div",{className:"config-input-group",children:[e.jsx("input",{type:"text",className:"config-input config-input-full",value:ae,onChange:t=>Oe(t.target.value),placeholder:i("config:connection.codexBinaryPathPlaceholder"),onKeyDown:t=>{t.key==="Enter"&&A&&Ie()}}),A&&e.jsx("button",{className:"config-btn config-btn-sm",onClick:Ie,children:i("common:buttons.apply")})]}),e.jsx("span",{className:"config-hint",children:i("config:connection.codexBinaryPathHint")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("common:buttons.reconnect"),query:a})}),e.jsx("button",{className:"config-btn",onClick:()=>Ue(),title:"Force reconnect to server",children:i("common:buttons.reconnect")})]})]}),P("scene")&&e.jsxs(W,{title:i("config:sections.scene"),storageKey:"scene",defaultOpen:!1,forceOpen:G&&P("scene"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:scene.characterSize"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"3.0",step:"0.1",value:s.characterScale,onChange:t=>n({...s,characterScale:parseFloat(t.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.characterScale.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:scene.scale2d",{defaultValue:"2D Scale"}),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"2.0",step:"0.1",value:s.scale2d,onChange:t=>n({...s,scale2d:parseFloat(t.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.scale2d.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:scene.scale3d",{defaultValue:"3D Scale"}),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.3",max:"2.0",step:"0.1",value:s.scale3d,onChange:t=>n({...s,scale3d:parseFloat(t.target.value)})}),e.jsxs("span",{className:"config-value",children:[s.scale3d.toFixed(1),"x"]})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:scene.show2DTaskLabels",{defaultValue:"Show 2D task labels"}),query:a})}),e.jsx(le,{checked:s.show2DTaskLabels,onChange:t=>n({...s,show2DTaskLabels:t})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:scene.time"),query:a})}),e.jsx(je,{options:ne,value:s.timeMode,onChange:t=>n({...s,timeMode:t}),iconOnly:!0})]})]}),P("terrain")&&e.jsxs(W,{title:i("config:sections.terrain"),storageKey:"terrain",defaultOpen:!1,forceOpen:G&&P("terrain"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:terrainSettings.simpleMode",{defaultValue:"Simple Mode"}),query:a})}),e.jsx(le,{checked:s.terrain.simpleMode??!1,onChange:t=>pe({simpleMode:t})})]}),e.jsx("div",{className:"terrain-icons",style:{opacity:s.terrain.simpleMode?.4:1,pointerEvents:s.terrain.simpleMode?"none":"auto"},children:we.map(t=>e.jsx("button",{className:`terrain-icon-btn ${s.terrain[t.key]?"active":""}`,onClick:()=>fe(t.key),title:t.label,children:t.icon},t.key))}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:terrainSettings.fog"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"2",step:"0.1",value:s.terrain.fogDensity,onChange:t=>pe({fogDensity:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.fogDensity===0?i("config:fogValues.off"):s.terrain.fogDensity<=1?i("config:fogValues.low"):i("config:fogValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:terrainSettings.brightness"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0.2",max:"2",step:"0.1",value:s.terrain.brightness,onChange:t=>pe({brightness:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.brightness<=.5?i("config:brightnessValues.dark"):s.terrain.brightness<=1.2?i("config:brightnessValues.normal"):i("config:brightnessValues.bright")})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:terrainSettings.floor"),query:a})}),e.jsx(je,{options:re,value:s.terrain.floorStyle,onChange:t=>pe({floorStyle:t}),iconOnly:!0})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:terrainSettings.sky"),query:a})}),e.jsx("div",{className:"sky-color-selector",children:ye.map(t=>e.jsx("button",{className:`sky-color-btn ${s.terrain.skyColor===t.value?"active":""}`,onClick:()=>pe({skyColor:t.value}),title:t.label,style:{background:t.color}},t.value??"auto"))})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:terrainSettings.battlefieldSize"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"30",max:"200",step:"10",value:s.terrain.battlefieldSize,onChange:t=>pe({battlefieldSize:parseInt(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.terrain.battlefieldSize})]})]}),P("modelStyle")&&e.jsxs(W,{title:i("config:sections.modelStyle"),storageKey:"modelStyle",defaultOpen:!1,forceOpen:G&&P("modelStyle"),children:[e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:modelStyleSettings.saturation"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"2",step:"0.1",value:s.modelStyle.saturation,onChange:t=>m({saturation:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.saturation<=.3?i("config:saturationValues.gray"):s.modelStyle.saturation<=1.2?i("config:saturationValues.normal"):i("config:saturationValues.vivid")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:modelStyleSettings.roughness"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"1",step:"0.1",value:s.modelStyle.roughness,onChange:t=>m({roughness:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.roughness<0?i("config:roughnessValues.auto"):s.modelStyle.roughness<=.3?i("config:roughnessValues.glossy"):s.modelStyle.roughness<=.7?i("config:roughnessValues.normal"):i("config:roughnessValues.matte")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:modelStyleSettings.metalness"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"1",step:"0.1",value:s.modelStyle.metalness,onChange:t=>m({metalness:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.metalness<0?i("config:metalnessValues.auto"):s.modelStyle.metalness<=.3?i("config:metalnessValues.plastic"):s.modelStyle.metalness<=.7?i("config:metalnessValues.mixed"):i("config:metalnessValues.metal")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:modelStyleSettings.glow"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"0",max:"1",step:"0.05",value:s.modelStyle.emissiveBoost,onChange:t=>m({emissiveBoost:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.emissiveBoost<=.1?i("config:glowValues.off"):s.modelStyle.emissiveBoost<=.4?i("config:glowValues.low"):s.modelStyle.emissiveBoost<=.7?i("config:glowValues.med"):i("config:glowValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:modelStyleSettings.reflections"),query:a})}),e.jsx("input",{type:"range",className:"config-slider",min:"-1",max:"2",step:"0.1",value:s.modelStyle.envMapIntensity,onChange:t=>m({envMapIntensity:parseFloat(t.target.value)})}),e.jsx("span",{className:"config-value",children:s.modelStyle.envMapIntensity<0?i("config:reflectionValues.auto"):s.modelStyle.envMapIntensity<=.3?i("config:reflectionValues.low"):s.modelStyle.envMapIntensity<=1?i("config:reflectionValues.normal"):i("config:reflectionValues.high")})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:modelStyleSettings.wireframe"),query:a})}),e.jsx(le,{checked:s.modelStyle.wireframe,onChange:t=>m({wireframe:t})})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:modelStyleSettings.colorMode"),query:a})}),e.jsx(je,{options:he,value:s.modelStyle.colorMode,onChange:t=>m({colorMode:t}),iconOnly:!0})]})]}),P("animations")&&e.jsxs(W,{title:i("config:sections.animations"),storageKey:"animations",defaultOpen:!1,forceOpen:G&&P("animations"),children:[e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:animationSettings.idle"),query:a})}),e.jsx(je,{options:te,value:s.animations.idleAnimation,onChange:t=>z({idleAnimation:t}),iconOnly:!0})]}),e.jsxs("div",{className:"config-group",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:animationSettings.working"),query:a})}),e.jsx(je,{options:te,value:s.animations.workingAnimation,onChange:t=>z({workingAnimation:t}),iconOnly:!0})]})]}),P("secrets")&&e.jsx(W,{title:i("config:sections.secrets"),storageKey:"secrets",defaultOpen:!1,forceOpen:G&&P("secrets"),children:e.jsx(Js,{})}),P("systemPrompt")&&e.jsx(W,{title:i("config:sections.systemPrompt"),storageKey:"systemPrompt",defaultOpen:!1,forceOpen:G&&P("systemPrompt"),children:e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",children:e.jsx(E,{text:i("config:systemPrompt.title"),query:a})}),e.jsx("button",{className:"config-button",onClick:()=>J(!0),children:i("config:systemPrompt.editPrompt")})]})}),P("data")&&e.jsx(W,{title:i("config:sections.data"),storageKey:"data",defaultOpen:!1,forceOpen:G&&P("data"),children:e.jsx(ra,{})}),ue&&e.jsx(W,{title:i("config:sections.integrations"),storageKey:"integrations",defaultOpen:!1,forceOpen:G&&ue,children:e.jsx(ua,{onOpenModal:t=>{t==="whatsapp"?Q(!0):o==null||o(t)}})}),P("workflows")&&e.jsxs(W,{title:"Workflows",storageKey:"workflows",defaultOpen:!1,forceOpen:G&&P("workflows"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(E,{text:"Create and manage automated workflow pipelines with visual state machine editor",query:a})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>d==null?void 0:d(),children:"Open Workflow Editor"})})]}),P("triggers")&&e.jsxs(W,{title:"Triggers",storageKey:"triggers",defaultOpen:!1,forceOpen:G&&P("triggers"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(E,{text:"Create and manage event-driven triggers that fire agents with templates",query:a})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>c==null?void 0:c(),children:"Open Trigger Manager"})})]}),P("monitoring")&&e.jsxs(W,{title:"Monitoring",storageKey:"monitoring",defaultOpen:!1,forceOpen:G&&P("monitoring"),children:[e.jsx("div",{className:"config-row",children:e.jsx("span",{className:"config-label",children:e.jsx(E,{text:"View event logs, trigger history, workflow traces, and system stats",query:a})})}),e.jsx("div",{className:"config-row",children:e.jsx("button",{className:"config-button",onClick:()=>r==null?void 0:r(),children:"Open Monitoring & Logs"})})]}),P("experimental")&&e.jsxs(W,{title:i("config:sections.experimental"),storageKey:"experimental",defaultOpen:!1,forceOpen:G&&P("experimental"),children:[e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Lightweight 2D top-down view for better performance",children:[e.jsx(E,{text:i("config:experimental.2dView"),query:a})," ",e.jsx(I,{name:"map",size:12})]}),e.jsx(le,{checked:u.settings.experimental2DView,onChange:t=>_.updateSettings({experimental2DView:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Voice assistant for hands-free agent control",children:[e.jsx(E,{text:i("config:experimental.voiceAssistant"),query:a})," ",e.jsx(I,{name:"microphone",size:12})]}),e.jsx(le,{checked:u.settings.experimentalVoiceAssistant,onChange:t=>_.updateSettings({experimentalVoiceAssistant:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsxs("span",{className:"config-label",title:"Text-to-speech for reading agent responses",children:[e.jsx(E,{text:i("config:experimental.tts"),query:a})," ",e.jsx(I,{name:"speaker-on",size:12})]}),e.jsx(le,{checked:u.settings.experimentalTTS,onChange:t=>_.updateSettings({experimentalTTS:t})})]}),e.jsxs("div",{className:"config-row",children:[e.jsx("span",{className:"config-label",title:"Duplicate system prompt for improved LLM attention coverage. Increases input token usage.",children:e.jsx(E,{text:i("config:experimental.echoPrompt"),query:a})}),e.jsx(le,{checked:u.settings.experimentalEchoPrompt,onChange:async t=>{_.updateSettings({experimentalEchoPrompt:t});try{await sa(t)}catch(O){console.error("Failed to sync echo prompt setting to server:",O)}}})]}),e.jsx("span",{className:"config-hint",children:i("config:experimental.hint")})]}),P("about")&&e.jsx(W,{title:i("config:sections.about"),storageKey:"about",defaultOpen:!1,forceOpen:G&&P("about"),children:e.jsx(pa,{})})]}),e.jsx(ma,{isOpen:H,onClose:()=>J(!1)}),e.jsx(ba,{isOpen:ce,onClose:()=>N(!1)}),e.jsx(Na,{isOpen:D,onClose:()=>B(!1)}),e.jsx(Fa,{isOpen:j,onClose:()=>$(!1)}),e.jsx(Oa,{isOpen:F,onClose:()=>Q(!1),onOpenConfig:()=>N(!0),onOpenNotifications:()=>B(!0),onOpenHistory:()=>$(!0)})]})}function Qa({onConfigChange:s,onToolChange:n,config:a,isOpen:o,onClose:r,onOpenBuildingModal:d,onOpenAreaExplorer:c,onOpenIntegrationsModal:i,onOpenMonitoringModal:u,onOpenWorkflowEditor:S,onOpenTriggerManager:x}){const{t:y}=Y(["config","common"]),h=Ve(),f=Array.from(h.areas.values()),g=Array.from(h.buildings.values()),[v,b]=l.useState(""),p=l.useRef(null);if(l.useEffect(()=>{const k=T=>{T.key==="Escape"&&o&&r()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[o,r]),l.useEffect(()=>{if(o&&p.current){if(typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches)return;const T=setTimeout(()=>{var V;(V=p.current)==null||V.focus()},50);return()=>clearTimeout(T)}},[o]),!o)return null;const L=k=>{const T=h.activeTool===k?null:k;n(T)},M=k=>{_.selectArea(h.selectedAreaId===k?null:k),n("select")},R=(k,T)=>{k.stopPropagation(),_.deleteArea(T)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"toolbox-backdrop",onClick:r}),e.jsxs("aside",{className:"toolbox",children:[e.jsxs("div",{className:"toolbox-header",children:[e.jsx("span",{children:y("config:title")}),e.jsx("button",{className:"toolbox-close-btn",onClick:r,title:y("common:buttons.close"),children:"×"})]}),e.jsxs("div",{className:"toolbox-search",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"M21 21l-4.35-4.35"})]}),e.jsx("input",{ref:p,type:"text",placeholder:y("config:searchPlaceholder"),value:v,onChange:k=>b(k.target.value),className:"toolbox-search-input"}),v&&e.jsx("button",{className:"toolbox-search-clear",onClick:()=>b(""),children:"×"})]}),e.jsxs("div",{className:"toolbox-content",children:[e.jsx("div",{className:"toolbox-section toolbox-section-collapsible",children:e.jsxs(W,{title:y("config:areas.title",{count:f.length}),storageKey:"areas",children:[e.jsxs("div",{className:"tool-buttons",children:[e.jsx("button",{className:`tool-btn ${h.activeTool==="select"?"active":""}`,onClick:()=>L("select"),title:y("config:tools.select"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"})})})}),e.jsx("button",{className:`tool-btn ${h.activeTool==="rectangle"?"active":""}`,onClick:()=>L("rectangle"),title:y("config:tools.rectangle"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"})})})}),e.jsx("button",{className:`tool-btn ${h.activeTool==="circle"?"active":""}`,onClick:()=>L("circle"),title:y("config:tools.circle"),children:e.jsx("span",{children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("circle",{cx:"12",cy:"12",r:"9"})})})})]}),e.jsx("div",{className:"areas-list",children:f.length===0?e.jsx("div",{className:"areas-empty",children:y("config:areas.drawToCreate")}):f.map(k=>e.jsx(Ms,{area:k,isSelected:h.selectedAreaId===k.id,onClick:()=>M(k.id),onDelete:T=>R(T,k.id)},k.id))})]})}),h.selectedAreaId&&e.jsx(Ys,{area:h.areas.get(h.selectedAreaId),onClose:()=>_.selectArea(null),onOpenFolder:c}),e.jsx("div",{className:"toolbox-section toolbox-section-collapsible",children:e.jsx(W,{title:y("config:buildings.title",{count:g.length}),storageKey:"buildings",headerExtra:e.jsx("button",{className:"add-building-btn",onClick:k=>{k.stopPropagation(),d==null||d()},title:y("config:buildings.addBuilding"),children:"+"}),children:e.jsx("div",{className:"buildings-list",children:g.length===0?e.jsx("div",{className:"buildings-empty",children:y("config:buildings.clickToAdd")}):g.map(k=>e.jsx(Vs,{building:k,isSelected:h.selectedBuildingIds.has(k.id),onClick:()=>{_.selectBuilding(h.selectedBuildingIds.has(k.id)?null:k.id)},onEdit:()=>d==null?void 0:d(k.id)},k.id))})})}),h.selectedBuildingIds.size===1&&(()=>{const k=Array.from(h.selectedBuildingIds)[0],T=h.buildings.get(k);return T?e.jsx(Ks,{building:T,onClose:()=>_.selectBuilding(null),onOpenModal:()=>d==null?void 0:d(k)}):null})(),e.jsx(Ya,{config:a,onChange:s,searchQuery:v,onOpenIntegrationsModal:i,onOpenMonitoringModal:u,onOpenWorkflowEditor:S,onOpenTriggerManager:x})]})]})]})}export{Qa as Toolbox};
@@ -0,0 +1 @@
1
+ .system-prompt-modal{width:720px;max-width:95vw;max-height:85vh;display:flex;flex-direction:column;padding:0;background:#14141e;border:1px solid #2a2a3a;border-radius:12px;overflow:hidden}.system-prompt-modal .modal-header{padding:14px 20px;margin-bottom:0;border-bottom:1px solid #2a2a3a;font-size:16px;font-weight:600;display:flex;justify-content:space-between;align-items:center;gap:12px}.system-prompt-modal .modal-header h2{margin:0;font-size:16px}.system-prompt-modal .modal-footer{padding:12px 20px;border-top:1px solid #2a2a3a;display:flex;justify-content:space-between;align-items:center;gap:12px}.modal-close{background:transparent;border:none;color:#8a8a98;font-size:24px;line-height:1;cursor:pointer;padding:4px 8px;border-radius:4px;transition:all .15s;flex-shrink:0}.modal-close:hover{background:#d45a5a26;color:#d45a5a}.modal-body{flex:1;overflow-y:auto;padding:20px;min-height:0;display:flex;flex-direction:column;gap:12px}.modal-description{margin:0;font-size:12px;color:#8a8a98;line-height:1.5}.loading-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:48px 24px}.loading-state .spinner{width:32px;height:32px;border:3px solid rgba(42,42,58,.5);border-top-color:#5a8fd4;border-radius:50%;animation:spin .8s linear infinite}.loading-state p{color:#8a8a98;margin:0;font-size:13px}@keyframes spin{to{transform:rotate(360deg)}}.alert{padding:10px 12px;border-radius:4px;display:flex;gap:8px;align-items:flex-start;font-size:12px;line-height:1.4}.alert .alert-icon{flex-shrink:0;font-size:14px}.alert.alert-error{background:#d45a5a1a;border:1px solid rgba(212,90,90,.25);color:#d45a5a}.alert.alert-success{background:#5cb88a1a;border:1px solid rgba(92,184,138,.25);color:#5cb88a}.editor-wrapper{display:flex;flex-direction:column;gap:6px;flex:1}.editor-header{display:flex;justify-content:space-between;align-items:center;gap:8px}.editor-label{font-size:11px;font-weight:600;color:#8a8a98;text-transform:uppercase;letter-spacing:.3px}.char-count{font-size:10px;color:#606070;flex-shrink:0}.prompt-editor{padding:10px 12px;border:1px solid #2a2a3a;border-radius:4px;background:#1c1c28;color:#d0d0d8;font-family:JetBrains Mono,SF Mono,Fira Code,Consolas,monospace;font-size:12px;line-height:1.6;resize:vertical;min-height:14rem;flex:1;max-height:28rem;outline:none;transition:all .15s}.prompt-editor:focus{border-color:#5a8fd4;background:#1c1c28cc}.prompt-editor::placeholder{color:#606070;white-space:pre-line}.editor-hint{font-size:10px;color:#606070;font-style:italic;padding:0 2px}.footer-buttons-left{display:flex;gap:6px}.footer-buttons-right{display:flex;gap:6px;margin-left:auto}.btn{padding:8px 14px;border:1px solid #2a2a3a;border-radius:4px;font-size:12px;font-weight:500;cursor:pointer;transition:all .15s;white-space:nowrap;background:#1c1c28;color:#d0d0d8}.whatsapp-config-modal{width:900px;max-width:95vw;max-height:85vh;display:flex;flex-direction:column;padding:0;background:#14141e;border:1px solid #2a2a3a;border-radius:12px;overflow:hidden}.whatsapp-config-modal .modal-header{padding:14px 20px;margin-bottom:0;border-bottom:1px solid #2a2a3a;font-size:16px;font-weight:600;display:flex;justify-content:space-between;align-items:center;gap:12px}.whatsapp-config-modal .modal-header h2{margin:0;font-size:16px}.whatsapp-config-modal .modal-footer{padding:12px 20px;border-top:1px solid #2a2a3a;display:flex;justify-content:space-between;align-items:center;gap:12px}.whatsapp-config-modal .modal-body{flex:1;overflow-y:auto;padding:20px;min-height:0;display:flex;flex-direction:column;gap:16px}.whatsapp-config-modal .modal-description{margin:0;font-size:12px;color:#8a8a98;line-height:1.5}.whatsapp-config-modal .loading-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:48px 24px}.whatsapp-config-modal .loading-state .spinner{width:32px;height:32px;border:3px solid rgba(42,42,58,.5);border-top-color:#5a8fd4;border-radius:50%;animation:wa-spin .8s linear infinite}.whatsapp-config-modal .loading-state p{color:#8a8a98;margin:0;font-size:13px}.whatsapp-config-modal .alert{padding:10px 12px;border-radius:4px;display:flex;gap:8px;align-items:flex-start;font-size:12px;line-height:1.4}.whatsapp-config-modal .alert .alert-icon{flex-shrink:0;font-size:14px}.whatsapp-config-modal .alert.alert-error{background:#d45a5a1a;border:1px solid rgba(212,90,90,.25);color:#d45a5a}.whatsapp-config-modal .alert.alert-success{background:#5cb88a1a;border:1px solid rgba(92,184,138,.25);color:#5cb88a}.whatsapp-config-modal .footer-buttons-left{display:flex;gap:6px}.whatsapp-config-modal .footer-buttons-right{display:flex;gap:6px;margin-left:auto}@keyframes wa-spin{to{transform:rotate(360deg)}}.wa-section{display:flex;flex-direction:column;gap:10px;padding:14px 14px 16px;border:1px solid #2a2a3a;border-radius:8px;background:#1c1c2873}.wa-section-title{margin:0 0 4px;font-size:12px;font-weight:600;color:#8a8a98;text-transform:uppercase;letter-spacing:.5px}.wa-field{display:flex;flex-direction:column;gap:4px}.wa-field.wa-field-row{flex-direction:row;align-items:center;justify-content:space-between}.wa-field.wa-field-inline{flex-direction:row;align-items:center;gap:8px;flex-wrap:wrap}.wa-field.wa-field-inline .wa-input{flex:1 1 220px;min-width:160px}.wa-field.wa-field-end{justify-content:flex-end}.wa-label{font-size:11px;font-weight:600;color:#8a8a98;text-transform:uppercase;letter-spacing:.3px}.wa-hint{font-size:10px;color:#606070;font-style:italic}.wa-input,.wa-textarea{padding:8px 10px;border:1px solid #2a2a3a;border-radius:4px;background:#1c1c28;color:#d0d0d8;font-family:JetBrains Mono,SF Mono,Fira Code,Consolas,monospace;font-size:12px;line-height:1.5;outline:none;transition:all .15s;width:100%;box-sizing:border-box}.wa-input:focus,.wa-textarea:focus{border-color:#5a8fd4;background:#1c1c28cc}.wa-input::placeholder,.wa-textarea::placeholder{color:#606070}.wa-textarea{resize:vertical;min-height:6rem;max-height:14rem}.wa-toggle{position:relative;display:inline-flex;align-items:center;cursor:pointer;flex-shrink:0}.wa-toggle input{position:absolute;opacity:0;pointer-events:none}.wa-toggle .wa-toggle-track{width:32px;height:18px;background:#1c1c28;border:1px solid #2a2a3a;border-radius:9px;transition:background .15s,border-color .15s;position:relative;display:inline-block}.wa-toggle .wa-toggle-thumb{position:absolute;top:1px;left:1px;width:14px;height:14px;background:#8a8a98;border-radius:50%;transition:transform .15s,background .15s}.wa-toggle input:checked+.wa-toggle-track{background:#5a8fd459;border-color:#5a8fd4}.wa-toggle input:checked+.wa-toggle-track .wa-toggle-thumb{transform:translate(14px);background:#5a8fd4}.wa-key-status{display:flex;align-items:center;gap:8px}.wa-status{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:4px;font-size:11px;font-weight:500}.wa-status.wa-status-ok{background:#5cb88a1f;color:#5cb88a;border:1px solid rgba(92,184,138,.3)}.wa-status.wa-status-warn{background:#d4a05a1f;color:#d4a05a;border:1px solid rgba(212,160,90,.3)}.wa-sessions-list{display:flex;flex-direction:column;gap:6px}.wa-empty{font-size:12px;color:#606070;font-style:italic;padding:8px 0}.wa-session-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 10px;border:1px solid #2a2a3a;border-radius:4px;background:#1c1c28}.wa-session-info{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.wa-session-id{font-family:JetBrains Mono,SF Mono,Fira Code,Consolas,monospace;font-size:12px;color:#d0d0d8;font-weight:500}.wa-session-status{font-size:11px;padding:2px 6px;border-radius:4px;background:#60607026;color:#8a8a98;text-transform:uppercase;letter-spacing:.3px}.wa-session-status.status-connected,.wa-session-status.status-paired,.wa-session-status.status-open,.wa-session-status.status-ready{background:#5cb88a26;color:#5cb88a}.wa-session-status.status-pairing,.wa-session-status.status-connecting,.wa-session-status.status-qr{background:#5a8fd426;color:#5a8fd4}.wa-session-status.status-error,.wa-session-status.status-disconnected,.wa-session-status.status-failed{background:#d45a5a26;color:#d45a5a}.wa-session-paired{font-size:11px;color:#606070}.wa-qr-panel{margin-top:8px;padding:12px;border:1px dashed #2a2a3a;border-radius:6px;background:#0d0d1480;display:flex;flex-direction:column;gap:10px}.wa-qr-header{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:#8a8a98}.wa-qr-image{display:flex;justify-content:center;padding:12px;background:#fff;border-radius:4px}.wa-qr-image img{width:240px;height:240px;image-rendering:pixelated}.wa-qr-loading{display:flex;flex-direction:column;align-items:center;gap:8px;padding:24px}.wa-qr-loading .spinner{width:24px;height:24px;border:3px solid rgba(42,42,58,.5);border-top-color:#5a8fd4;border-radius:50%;animation:wa-spin .8s linear infinite}.wa-qr-loading p{margin:0;font-size:12px;color:#8a8a98}.wa-pairing-message{font-size:12px;color:#8a8a98;font-style:italic}.btn{padding:8px 14px;border:1px solid #2a2a3a;border-radius:4px;font-size:12px;font-weight:500;cursor:pointer;transition:all .15s;white-space:nowrap;background:#1c1c28;color:#d0d0d8;display:inline-flex;align-items:center;gap:6px}.btn:disabled{opacity:.5;cursor:not-allowed}.btn:active:not(:disabled){transform:scale(.98)}.btn:hover:not(:disabled){border-color:#8a8a98;background:#1c1c28cc}.btn.btn-sm{padding:5px 10px;font-size:11px}.btn.btn-primary{background:#5a8fd4;color:#fff;border-color:#5a8fd4}.btn.btn-primary:hover:not(:disabled){background:#5a8fd4e6;box-shadow:0 0 0 2px #5a8fd433}.btn.btn-secondary{background:#1c1c28;color:#d0d0d8;border-color:#2a2a3a}.btn.btn-secondary:hover:not(:disabled){border-color:#8a8a98;background:#1c1c28cc}.btn.btn-danger{background:#d45a5a26;color:#d45a5a;border-color:#d45a5a4d}.btn.btn-danger:hover:not(:disabled){background:#d45a5a40;border-color:#d45a5a80}.whatsapp-notifications-modal{width:720px;max-width:95vw;max-height:85vh;display:flex;flex-direction:column;padding:0;background:#14141e;border:1px solid #2a2a3a;border-radius:12px;overflow:hidden}.whatsapp-notifications-modal .modal-header{padding:14px 20px;border-bottom:1px solid #2a2a3a;font-size:16px;font-weight:600;display:flex;justify-content:space-between;align-items:center;gap:12px}.whatsapp-notifications-modal .modal-header h2{margin:0;font-size:16px}.whatsapp-notifications-modal .modal-footer{padding:12px 20px;border-top:1px solid #2a2a3a;display:flex;justify-content:space-between;align-items:center;gap:12px}.whatsapp-notifications-modal .modal-footer .footer-buttons-right{display:flex;gap:8px}.whatsapp-notifications-modal .modal-body{flex:1;overflow-y:auto;padding:20px;min-height:0;display:flex;flex-direction:column;gap:16px}.whatsapp-notifications-modal .modal-description{margin:0;font-size:12px;color:#8a8a98;line-height:1.5}.whatsapp-notifications-modal .loading-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:48px 24px}.whatsapp-notifications-modal .loading-state .spinner{width:32px;height:32px;border:3px solid rgba(42,42,58,.5);border-top-color:#5a8fd4;border-radius:50%;animation:wan-spin .8s linear infinite}.whatsapp-notifications-modal .loading-state p{color:#8a8a98;margin:0;font-size:13px}.whatsapp-notifications-modal .alert{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:6px;font-size:12px}.whatsapp-notifications-modal .alert.alert-error{background:#dc26261a;color:#f87171;border:1px solid rgba(220,38,38,.3)}.whatsapp-notifications-modal .alert.alert-success{background:#22c55e1a;color:#4ade80;border:1px solid rgba(34,197,94,.3)}.whatsapp-notifications-modal .wan-section{display:flex;flex-direction:column;gap:10px;padding:12px;border:1px solid #2a2a3a;border-radius:8px;background:#0d0d14}.whatsapp-notifications-modal .wan-section-title{margin:0;font-size:13px;font-weight:600;color:#d0d0d8}.whatsapp-notifications-modal .wan-section-hint{margin:0;font-size:11px;color:#8a8a98;line-height:1.4}.whatsapp-notifications-modal .wan-field{display:flex;flex-direction:column;gap:4px}.whatsapp-notifications-modal .wan-label{font-size:12px;font-weight:500;color:#8a8a98}.whatsapp-notifications-modal .wan-input{padding:8px 10px;background:#14141e;color:#d0d0d8;border:1px solid #2a2a3a;border-radius:6px;font-size:13px}.whatsapp-notifications-modal .wan-input:focus{outline:none;border-color:#5a8fd4}.whatsapp-notifications-modal .wan-hint{font-size:11px;color:#8a8a98}.whatsapp-notifications-modal .wan-toggle-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:8px 0;border-bottom:1px solid rgba(42,42,58,.5)}.whatsapp-notifications-modal .wan-toggle-row:last-child{border-bottom:none}.whatsapp-notifications-modal .wan-toggle-info{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.whatsapp-notifications-modal .wan-toggle-title{font-size:13px;color:#d0d0d8;font-weight:500}.whatsapp-notifications-modal .wan-toggle-help{font-size:11px;color:#8a8a98;line-height:1.4}.whatsapp-notifications-modal .wan-toggle{position:relative;display:inline-block;width:36px;height:20px;flex-shrink:0;cursor:pointer}.whatsapp-notifications-modal .wan-toggle input{opacity:0;width:0;height:0}.whatsapp-notifications-modal .wan-toggle input:checked+.wan-toggle-track{background:#5a8fd4}.whatsapp-notifications-modal .wan-toggle input:checked+.wan-toggle-track .wan-toggle-thumb{transform:translate(16px)}.whatsapp-notifications-modal .wan-toggle-track{position:absolute;top:0;right:0;bottom:0;left:0;background:#2a2a3a99;border-radius:999px;transition:background .15s ease}.whatsapp-notifications-modal .wan-toggle-thumb{position:absolute;top:2px;left:2px;width:16px;height:16px;background:#fff;border-radius:50%;transition:transform .15s ease}@media(max-width:600px){.whatsapp-notifications-modal{width:100%;max-width:100vw}.whatsapp-notifications-modal .modal-footer{flex-direction:column;align-items:stretch}.whatsapp-notifications-modal .modal-footer .footer-buttons-left,.whatsapp-notifications-modal .modal-footer .footer-buttons-right{width:100%;justify-content:stretch}.whatsapp-notifications-modal .modal-footer .footer-buttons-left .btn,.whatsapp-notifications-modal .modal-footer .footer-buttons-right .btn{flex:1}}@keyframes wan-spin{to{transform:rotate(360deg)}}.whatsapp-history-modal{position:relative;display:flex;flex-direction:column;width:min(1200px,96vw);height:min(820px,92vh);background:#0d0d14;border:1px solid #2a2a3a;border-radius:6px;box-shadow:0 16px 48px #0006;overflow:hidden}.whatsapp-history-modal .modal-header{display:flex;align-items:center;gap:16px;padding:12px 16px;border-bottom:1px solid #2a2a3a;background:#14141e}.whatsapp-history-modal .modal-header h2{margin:0;font-size:14px;font-weight:600;color:#d0d0d8;flex-shrink:0}.whatsapp-history-modal .modal-header .modal-close{margin-left:auto;background:transparent;border:none;color:#606070;cursor:pointer;padding:4px;border-radius:4px}.whatsapp-history-modal .modal-header .modal-close:hover{background:#d0d0d814;color:#d0d0d8}.whatsapp-history-modal__session{display:flex;align-items:center;gap:8px}.whatsapp-history-modal__session label{display:flex;align-items:center;gap:6px;font-size:11px;color:#606070}.whatsapp-history-modal__session label select{background:#1c1c28;border:1px solid #2a2a3a;color:#d0d0d8;font-size:11px;padding:4px 6px;border-radius:4px;min-width:140px}.whatsapp-history-modal__alert{padding:8px 16px;background:#d45a5a1f;color:#d45a5a;border-bottom:1px solid rgba(212,90,90,.3);font-size:12px}.whatsapp-history-modal__body{flex:1;display:grid;grid-template-columns:320px 1fr;min-height:0;background:#0d0d14}.whatsapp-history-chatlist{display:flex;flex-direction:column;min-height:0;border-right:1px solid #2a2a3a;background:#14141e}.whatsapp-history-chatlist__header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid #2a2a3a}.whatsapp-history-chatlist__title{font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:#606070}.whatsapp-history-chatlist__refresh{background:transparent;border:1px solid #2a2a3a;color:#606070;border-radius:4px;padding:2px 8px;cursor:pointer;font-size:12px}.whatsapp-history-chatlist__refresh:hover:not(:disabled){background:#d0d0d80f;color:#d0d0d8}.whatsapp-history-chatlist__refresh:disabled{opacity:.5;cursor:not-allowed}.whatsapp-history-chatlist__error{padding:8px 12px;color:#d45a5a;font-size:12px;background:#d45a5a14}.whatsapp-history-chatlist__loading,.whatsapp-history-chatlist__empty{display:flex;align-items:center;gap:8px;padding:16px 12px;color:#606070;font-size:12px}.whatsapp-history-chatlist__items{list-style:none;margin:0;padding:0;overflow-y:auto;flex:1}.whatsapp-history-chatlist__item{border-bottom:1px solid rgba(42,42,58,.4)}.whatsapp-history-chatlist__item.is-selected .whatsapp-history-chatlist__button{background:#5ab8c81a;border-left:3px solid #5ab8c8}.whatsapp-history-chatlist__button{width:100%;text-align:left;background:transparent;border:none;border-left:3px solid transparent;padding:10px 12px;cursor:pointer;color:#d0d0d8;display:flex;flex-direction:column;gap:3px}.whatsapp-history-chatlist__button:hover{background:#d0d0d80a}.whatsapp-history-chatlist__row{display:flex;align-items:center;justify-content:space-between;gap:8px}.whatsapp-history-chatlist__row--secondary{font-size:11px;color:#606070}.whatsapp-history-chatlist__name{font-size:12px;font-weight:500;color:#d0d0d8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whatsapp-history-chatlist__time{font-size:10px;color:#606070;flex-shrink:0}.whatsapp-history-chatlist__preview{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whatsapp-history-chatlist__direction{color:#606070}.whatsapp-history-chatlist__preview-icon{margin-right:2px}.whatsapp-history-chatlist__unread{background:#5cb88a;color:#0d0d14;border-radius:10px;padding:1px 6px;font-size:10px;font-weight:600;flex-shrink:0}.whatsapp-history-messages{display:flex;flex-direction:column;min-height:0;background:#0d0d14}.whatsapp-history-messages--empty{align-items:center;justify-content:center}.whatsapp-history-messages__header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid #2a2a3a;background:#14141e}.whatsapp-history-messages__title{font-size:13px;font-weight:600;color:#d0d0d8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whatsapp-history-messages__scroll{flex:1;overflow-y:auto;padding:14px 16px 18px;display:flex;flex-direction:column;gap:6px;background:#0d0d14}.whatsapp-history-messages__load-more-row{display:flex;justify-content:center;margin:6px 0 10px}.whatsapp-history-messages__load-more{background:#1c1c28;border:1px solid #2a2a3a;color:#8a8a98;border-radius:4px;padding:4px 12px;font-size:11px;cursor:pointer}.whatsapp-history-messages__load-more:hover:not(:disabled){background:#d0d0d80f;color:#d0d0d8}.whatsapp-history-messages__load-more:disabled{opacity:.6;cursor:not-allowed}.whatsapp-history-messages__error{color:#d45a5a;background:#d45a5a14;padding:8px 12px;border-radius:4px;font-size:12px;align-self:center}.whatsapp-history-messages__loading,.whatsapp-history-messages__empty,.whatsapp-history-messages__placeholder{display:flex;align-items:center;justify-content:center;gap:8px;color:#606070;font-size:12px;padding:30px 16px}.whatsapp-history-messages__placeholder{font-size:13px}.whatsapp-history-filters{display:flex;gap:10px;flex-shrink:0}.whatsapp-history-filters__field{display:flex;align-items:center;gap:6px;font-size:11px;color:#606070}.whatsapp-history-filters__field select{background:#1c1c28;border:1px solid #2a2a3a;color:#d0d0d8;font-size:11px;padding:3px 6px;border-radius:4px}.whatsapp-history-filters__field select:disabled{opacity:.6}.whatsapp-history-bubble{display:flex;width:100%}.whatsapp-history-bubble--inbound{justify-content:flex-start}.whatsapp-history-bubble--outbound{justify-content:flex-end}.whatsapp-history-bubble__inner{display:inline-flex;flex-direction:column;gap:2px;max-width:70%;padding:7px 11px 5px;border-radius:10px;font-size:13px;line-height:1.45;word-break:break-word;box-shadow:0 1px 1px #0003}.whatsapp-history-bubble--inbound .whatsapp-history-bubble__inner{background:#ffffff0f;color:#d0d0d8;border-top-left-radius:2px}.whatsapp-history-bubble--outbound .whatsapp-history-bubble__inner{background:#25d3662e;color:#d0d0d8;border-top-right-radius:2px}.whatsapp-history-bubble__type-icon{font-size:12px;color:#606070;margin-right:4px}.whatsapp-history-bubble__body{white-space:pre-wrap}.whatsapp-history-bubble__placeholder{font-style:italic;color:#606070}.whatsapp-history-bubble__transcription{font-size:11px;color:#606070;font-style:italic}.whatsapp-history-bubble__media-link{font-size:11px;color:#5ab8c8;text-decoration:underline}.whatsapp-history-bubble__media-link:hover{opacity:.85}.whatsapp-history-bubble__time{align-self:flex-end;font-size:10px;color:#606070;margin-top:2px}:root{--bg-primary: #0d0d14;--bg-secondary: #14141e;--bg-tertiary: #1c1c28;--border-color: #2a2a3a;--text-primary: #d0d0d8;--text-secondary: #8a8a98;--text-muted: #606070;--accent-blue: #5a8fd4;--accent-green: #5cb88a;--accent-orange: #d4a05a;--accent-red: #d45a5a;--accent-purple: #8a6fbf;--accent-cyan: #5ab8c8;--accent-claude: #a06848;--accent-claude-light: #c8896a;--accent-pink: #5a8fd4;--accent-yellow: #d0d0d8;--font-size-base: 14px;--line-height-base: 1.5;--msg-user-bg: color-mix(in srgb, #5ab8c8 8%, transparent);--msg-user-border: #5ab8c8;--msg-user-text: #d0d0d8;--msg-assistant-bg: color-mix(in srgb, #5cb88a 8%, transparent);--msg-assistant-border: #5cb88a;--msg-assistant-text: #d0d0d8;--tool-use-bg: color-mix(in srgb, #d4a05a 8%, transparent);--tool-use-border: #d4a05a;--tool-use-text: #d4a05a;--tool-use-name: #d4a05a;--tool-result-bg: color-mix(in srgb, #8a6fbf 6%, transparent);--tool-result-border: #8a6fbf;--tool-result-text: #5cb88a;--context-bar-bg: #1c1c28;--context-bar-fill: #8a6fbf;--output-line-bg: transparent;--task-label-color: #5ab8c8}.whatsapp-hub-modal{position:relative;width:min(520px,92vw);background:#0d0d14;border:1px solid #2a2a3a;border-radius:6px;box-shadow:0 16px 48px #0006;overflow:hidden}.whatsapp-hub-modal .modal-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid #2a2a3a;background:#14141e}.whatsapp-hub-modal .modal-header h2{margin:0;font-size:14px;font-weight:600;color:#d0d0d8;display:inline-flex;align-items:center;gap:8px}.whatsapp-hub-modal .modal-header .modal-close{background:transparent;border:none;color:#606070;cursor:pointer;padding:4px;border-radius:4px}.whatsapp-hub-modal .modal-header .modal-close:hover{background:#d0d0d814;color:#d0d0d8}.whatsapp-hub-modal__icon{font-size:18px;line-height:1}.whatsapp-hub-modal .modal-body{padding:14px 16px 16px;display:flex;flex-direction:column;gap:12px}.whatsapp-hub-modal__intro{margin:0;color:#8a8a98;font-size:12px;line-height:1.45}.whatsapp-hub-modal__options{display:flex;flex-direction:column;gap:6px}.whatsapp-hub-modal__option{display:flex;align-items:flex-start;gap:12px;padding:10px 12px;background:#14141e;border:1px solid #2a2a3a;border-radius:4px;color:#d0d0d8;cursor:pointer;text-align:left;transition:background .12s ease,border-color .12s ease}.whatsapp-hub-modal__option:hover{background:#d0d0d80d;border-color:#5ab8c8}.whatsapp-hub-modal__option:focus-visible{outline:1px solid #5ab8c8;outline-offset:2px}.whatsapp-hub-modal__option-icon{flex-shrink:0;width:28px;height:28px;border-radius:6px;background:#5ab8c81f;color:#5ab8c8;display:inline-flex;align-items:center;justify-content:center}.whatsapp-hub-modal__option-text{display:flex;flex-direction:column;gap:2px;min-width:0}.whatsapp-hub-modal__option-title{font-size:13px;font-weight:600;color:#d0d0d8}.whatsapp-hub-modal__option-desc{font-size:11px;color:#606070;line-height:1.4}
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-CLuvtqCm.js","assets/main-9uTEp9Lr.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-BfT_95fk.css"])))=>i.map(i=>d[i]);
2
- import{c9 as e,bC as o}from"./main-9uTEp9Lr.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";var i;(function(r){r.Heavy="HEAVY",r.Medium="MEDIUM",r.Light="LIGHT"})(i||(i={}));var t;(function(r){r.Success="SUCCESS",r.Warning="WARNING",r.Error="ERROR"})(t||(t={}));const c=e("Haptics",{web:()=>o(()=>import("./web-CLuvtqCm.js"),__vite__mapDeps([0,1,2,3,4])).then(r=>new r.HapticsWeb)});export{c as Haptics,i as ImpactStyle,t as NotificationType};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/web-C4LpSGoH.js","assets/main-XbhAPjbi.js","assets/vendor-react--Eh9ivFN.js","assets/vendor-three-Chj50gSY.js","assets/main-CD03IZnY.css"])))=>i.map(i=>d[i]);
2
+ import{c9 as e,bC as o}from"./main-XbhAPjbi.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";var i;(function(r){r.Heavy="HEAVY",r.Medium="MEDIUM",r.Light="LIGHT"})(i||(i={}));var t;(function(r){r.Success="SUCCESS",r.Warning="WARNING",r.Error="ERROR"})(t||(t={}));const c=e("Haptics",{web:()=>o(()=>import("./web-C4LpSGoH.js"),__vite__mapDeps([0,1,2,3,4])).then(r=>new r.HapticsWeb)});export{c as Haptics,i as ImpactStyle,t as NotificationType};