@theowlops/boombot 1.1.0 → 1.1.2

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.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-BZrSD-64.js","assets/Textarea-DN3Zybl1.js","assets/ChatView-Cahbjez6.css","assets/SessionsView-DS0-aH2a.js","assets/SessionsView-C1dqdhxI.css","assets/SchedulesView-B22QmPR-.js","assets/Tooltip-MzV2Gqnc.js","assets/Tooltip-Bn2cqFPz.css","assets/SchedulesView-C6XK7A8a.css","assets/TasksView-ey0FLsW8.js","assets/TasksView-Dtasg4hd.css","assets/MemoryView-BfMq_6CD.js","assets/MemoryView-BJbXqqs7.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-DwrZXRTf.js","assets/Textarea-DjaaMDYP.js","assets/ChatView-CP16lYju.css","assets/SessionsView-DIaw3vEm.js","assets/SessionsView-C1dqdhxI.css","assets/SchedulesView-CgZHa7Zc.js","assets/Tooltip-DSXSVOvn.js","assets/Tooltip-Bn2cqFPz.css","assets/SchedulesView-C6XK7A8a.css","assets/TasksView-BIccQf95.js","assets/TasksView-Dtasg4hd.css","assets/MemoryView-GytJpeXY.js","assets/MemoryView-BJbXqqs7.css"])))=>i.map(i=>d[i]);
2
2
  var mp=Object.defineProperty;var gp=(a,i,c)=>i in a?mp(a,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[i]=c;var td=(a,i,c)=>gp(a,typeof i!="symbol"?i+"":i,c);function vp(a,i){for(var c=0;c<i.length;c++){const d=i[c];if(typeof d!="string"&&!Array.isArray(d)){for(const h in d)if(h!=="default"&&!(h in a)){const m=Object.getOwnPropertyDescriptor(d,h);m&&Object.defineProperty(a,h,m.get?m:{enumerable:!0,get:()=>d[h]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))d(h);new MutationObserver(h=>{for(const m of h)if(m.type==="childList")for(const f of m.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&d(f)}).observe(document,{childList:!0,subtree:!0});function c(h){const m={};return h.integrity&&(m.integrity=h.integrity),h.referrerPolicy&&(m.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?m.credentials="include":h.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function d(h){if(h.ep)return;h.ep=!0;const m=c(h);fetch(h.href,m)}})();function yp(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Ki={exports:{}},xo={},Hi={exports:{}},ye={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -70,4 +70,4 @@ Lưu vào bộ nhớ`,cancel:"Huỷ",redirectModalTitle:"Định hướng task",
70
70
  * LICENSE.md file in the root directory of this source tree.
71
71
  *
72
72
  * @license MIT
73
- */function Qa(){return Qa=Object.assign?Object.assign.bind():function(a){for(var i=1;i<arguments.length;i++){var c=arguments[i];for(var d in c)({}).hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},Qa.apply(null,arguments)}function th(a,i){if(a==null)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(i.indexOf(d)!==-1)continue;c[d]=a[d]}return c}function Om(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Fm(a,i){return a.button===0&&(!i||i==="_self")&&!Om(a)}const zm=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Bm=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Km="6";try{window.__reactRouterVersion=Km}catch{}const Hm=p.createContext({isTransitioning:!1}),Um="startTransition",kd=Cp[Um];function $m(a){let{basename:i,children:c,future:d,window:h}=a,m=p.useRef();m.current==null&&(m.current=Wp({window:h,v5Compat:!0}));let f=m.current,[y,k]=p.useState({action:f.action,location:f.location}),{v7_startTransition:N}=d||{},x=p.useCallback(j=>{N&&kd?kd(()=>k(j)):k(j)},[k,N]);return p.useLayoutEffect(()=>f.listen(x),[f,x]),p.useEffect(()=>Am(d),[d]),p.createElement(Im,{basename:i,children:c,location:y.location,navigationType:y.action,navigator:f,future:d})}const Vm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Wm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dl=p.forwardRef(function(i,c){let{onClick:d,relative:h,reloadDocument:m,replace:f,state:y,target:k,to:N,preventScrollReset:x,viewTransition:j}=i,A=th(i,zm),{basename:H}=p.useContext(an),_,C=!1;if(typeof N=="string"&&Wm.test(N)&&(_=N,Vm))try{let I=new URL(window.location.href),B=N.startsWith("//")?new URL(I.protocol+N):new URL(N),ue=br(B.pathname,H);B.origin===I.origin&&ue!=null?N=ue+B.search+B.hash:C=!0}catch{}let M=gm(N,{relative:h}),R=qm(N,{replace:f,state:y,target:k,preventScrollReset:x,relative:h,viewTransition:j});function L(I){d&&d(I),I.defaultPrevented||R(I)}return p.createElement("a",Qa({},A,{href:_||M,onClick:C||m?d:L,ref:c,target:k}))}),Mo=p.forwardRef(function(i,c){let{"aria-current":d="page",caseSensitive:h=!1,className:m="",end:f=!1,style:y,to:k,viewTransition:N,children:x}=i,j=th(i,Bm),A=Za(k,{relative:j.relative}),H=Rt(),_=p.useContext(Qd),{navigator:C,basename:M}=p.useContext(an),R=_!=null&&Qm(A)&&N===!0,L=C.encodeLocation?C.encodeLocation(A).pathname:A.pathname,I=H.pathname,B=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;h||(I=I.toLowerCase(),B=B?B.toLowerCase():null,L=L.toLowerCase()),B&&M&&(B=br(B,M)||B);const ue=L!=="/"&&L.endsWith("/")?L.length-1:L.length;let q=I===L||!f&&I.startsWith(L)&&I.charAt(ue)==="/",pe=B!=null&&(B===L||!f&&B.startsWith(L)&&B.charAt(L.length)==="/"),re={isActive:q,isPending:pe,isTransitioning:R},te=q?d:void 0,oe;typeof m=="function"?oe=m(re):oe=[m,q?"active":null,pe?"pending":null,R?"transitioning":null].filter(Boolean).join(" ");let xe=typeof y=="function"?y(re):y;return p.createElement(dl,Qa({},j,{"aria-current":te,className:oe,ref:c,style:xe,to:k,viewTransition:N}),typeof x=="function"?x(re):x)});var tl;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(tl||(tl={}));var xd;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(xd||(xd={}));function Gm(a){let i=p.useContext(Xa);return i||Fe(!1),i}function qm(a,i){let{target:c,replace:d,state:h,preventScrollReset:m,relative:f,viewTransition:y}=i===void 0?{}:i,k=sn(),N=Rt(),x=Za(a,{relative:f});return p.useCallback(j=>{if(Fm(j,c)){j.preventDefault();let A=d!==void 0?d:qa(N)===qa(x);k(a,{replace:A,state:h,preventScrollReset:m,relative:f,viewTransition:y})}},[N,k,x,d,h,c,a,m,f,y])}function Qm(a,i){i===void 0&&(i={});let c=p.useContext(Hm);c==null&&Fe(!1);let{basename:d}=Gm(tl.useViewTransitionState),h=Za(a,{relative:i.relative});if(!c.isTransitioning)return!1;let m=br(c.currentLocation.pathname,d)||c.currentLocation.pathname,f=br(c.nextLocation.pathname,d)||c.nextLocation.pathname;return Ji(h.pathname,f)!=null||Ji(h.pathname,m)!=null}const Xm="_badge_1l5mk_1",_d={badge:Xm,"tone-accent":"_tone-accent_1l5mk_16","tone-muted":"_tone-muted_1l5mk_21","tone-danger":"_tone-danger_1l5mk_26","tone-warn":"_tone-warn_1l5mk_31","tone-info":"_tone-info_1l5mk_36","tone-success":"_tone-success_1l5mk_41"};function gt({tone:a="muted",children:i,className:c}){return o.jsx("span",{className:[_d.badge,_d[`tone-${a}`],c??""].join(" ").trim(),children:i})}const Ym={chat:o.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"}),sessions:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M3 3v5h5"}),o.jsx("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 8"}),o.jsx("path",{d:"M12 7v5l4 2"})]}),cpu:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("rect",{x:"9",y:"9",width:"6",height:"6"}),o.jsx("path",{d:"M15 2v2M15 20v2M2 15h2M2 9h2M20 15h2M20 9h2M9 2v2M9 20v2"})]}),calendar:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),o.jsx("path",{d:"M16 2v4M8 2v4M3 10h18"})]}),database:o.jsxs(o.Fragment,{children:[o.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),o.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"}),o.jsx("path",{d:"M3 12c0 1.66 4 3 9 3s9-1.34 9-3"})]}),radio:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("path",{d:"M4.93 19.07a10 10 0 0 1 0-14.14"}),o.jsx("path",{d:"M7.76 16.24a6 6 0 0 1 0-8.49"}),o.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),gear:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"})]}),plus:o.jsx("path",{d:"M5 12h14M12 5v14"}),x:o.jsx("path",{d:"M18 6 6 18M6 6l12 12"}),check:o.jsx("path",{d:"M20 6 9 17l-5-5"}),warn:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),o.jsx("path",{d:"M12 9v4M12 17h.01"})]}),search:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("path",{d:"M21 21l-4.3-4.3"})]}),send:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M22 2 11 13"}),o.jsx("path",{d:"M22 2l-7 20-4-9-9-4 20-7z"})]}),dots:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"5",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"19",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"})]}),"chevron-down":o.jsx("path",{d:"M6 9l6 6 6-6"}),"chevron-right":o.jsx("path",{d:"M9 18l6-6-6-6"}),"chevron-left":o.jsx("path",{d:"M15 18l-6-6 6-6"}),bolt:o.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"}),shield:o.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),key:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"7.5",cy:"15.5",r:"4.5"}),o.jsx("path",{d:"M10.8 12.2 20 3"}),o.jsx("path",{d:"M16 7l3 3M13.5 9.5l2 2"})]}),link:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),unlink:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M5.17 11.75l-1.72 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),o.jsx("path",{d:"M8 8l8 8"})]}),play:o.jsx("path",{d:"M6 4l14 8-14 8V4z"}),pause:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),o.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]}),trash:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M3 6h18"}),o.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),o.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M10 11v6M14 11v6"})]}),edit:o.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z"}),refresh:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),o.jsx("path",{d:"M21 3v5h-5"})]}),wifi:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 20h.01"}),o.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),o.jsx("path",{d:"M5 12.86a10 10 0 0 1 14 0"}),o.jsx("path",{d:"M8.5 16.43a5 5 0 0 1 7 0"})]}),"wifi-off":o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M2 2l20 20"}),o.jsx("path",{d:"M8.5 16.43a5 5 0 0 1 7 0"}),o.jsx("path",{d:"M5 12.86a10 10 0 0 1 5.17-2.69"}),o.jsx("path",{d:"M2 8.82a15 15 0 0 1 4.17-2.65"}),o.jsx("path",{d:"M12 20h.01"})]}),info:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),copy:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),eye:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"eye-off":o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),o.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),o.jsx("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),o.jsx("path",{d:"M2 2l20 20"})]}),"arrow-left":o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M19 12H5"}),o.jsx("path",{d:"M12 19l-7-7 7-7"})]}),menu:o.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),clock:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:"M12 6v6l4 2"})]}),stop:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),providers:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("rect",{x:"9",y:"9",width:"6",height:"6"}),o.jsx("path",{d:"M9 1v3M15 1v3M9 20v3M15 20v3M1 9h3M1 15h3M20 9h3M20 15h3"})]}),schedules:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("polyline",{points:"12 6 12 12 16 14"})]}),memory:o.jsxs(o.Fragment,{children:[o.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),o.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"}),o.jsx("path",{d:"M3 12c0 1.66 4 3 9 3s9-1.34 9-3"})]}),channels:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("path",{d:"M4.93 19.07a10 10 0 0 1 0-14.14"}),o.jsx("path",{d:"M7.76 16.24a6 6 0 0 1 0-8.49"}),o.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),settings:o.jsxs(o.Fragment,{children:[o.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),o.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),o.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),o.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),o.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),o.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),o.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),o.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]}),sun:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"4"}),o.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}),moon:o.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"}),monitor:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),o.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),bell:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M18 8a6 6 0 1 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"}),o.jsx("path",{d:"M13.7 21a2 2 0 0 1-3.4 0"})]}),volume:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M11 5 6 9H2v6h4l5 4V5z"}),o.jsx("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),o.jsx("path",{d:"M18.5 5.5a9 9 0 0 1 0 13"})]}),palette:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.12a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.56-2.5 5.56-5.55C21.97 6.01 17.46 2 12 2z"}),o.jsx("circle",{cx:"13.5",cy:"6.5",r:".75",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"17.5",cy:"10.5",r:".75",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.5",cy:"7.5",r:".75",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"6.5",cy:"12.5",r:".75",fill:"currentColor",stroke:"none"})]}),plug:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 22v-5"}),o.jsx("path",{d:"M9 8V2"}),o.jsx("path",{d:"M15 8V2"}),o.jsx("path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z"})]}),globe:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"}),o.jsx("path",{d:"M2 12h20"})]})};function ve({name:a,size:i=20,className:c}){return o.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",className:c,children:Ym[a]})}const nl={telegram:{color:"#26A5E4",d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"},whatsapp:{color:"#25D366",d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"},discord:{color:"#5865F2",d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},slack:{color:"#E01E5A",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},zalo:{color:"#0068FF",d:"M12.49 10.2722v-.4496h1.3467v6.3218h-.7704a.576.576 0 01-.5763-.5729l-.0006.0005a3.273 3.273 0 01-1.9372.6321c-1.8138 0-3.2844-1.4697-3.2844-3.2823 0-1.8125 1.4706-3.2822 3.2844-3.2822a3.273 3.273 0 011.9372.6321l.0006.0005zM6.9188 7.7896v.205c0 .3823-.051.6944-.2995 1.0605l-.03.0343c-.0542.0615-.1815.206-.2421.2843L2.024 14.8h4.8948v.7682a.5764.5764 0 01-.5767.5761H0v-.3622c0-.4436.1102-.6414.2495-.8476L4.8582 9.23H.1922V7.7896h6.7266zm8.5513 8.3548a.4805.4805 0 01-.4803-.4798v-7.875h1.4416v8.3548H15.47zM20.6934 9.6C22.52 9.6 24 11.0807 24 12.9044c0 1.8252-1.4801 3.306-3.3066 3.306-1.8264 0-3.3066-1.4808-3.3066-3.306 0-1.8237 1.4802-3.3044 3.3066-3.3044zm-10.1412 5.253c1.0675 0 1.9324-.8645 1.9324-1.9312 0-1.065-.865-1.9295-1.9324-1.9295s-1.9324.8644-1.9324 1.9295c0 1.0667.865 1.9312 1.9324 1.9312zm10.1412-.0033c1.0737 0 1.945-.8707 1.945-1.9453 0-1.073-.8713-1.9436-1.945-1.9436-1.0753 0-1.945.8706-1.945 1.9436 0 1.0746.8697 1.9453 1.945 1.9453z"},messenger:{color:"#0084FF",d:"M12 0C5.24 0 0 4.952 0 11.64c0 3.499 1.434 6.521 3.769 8.61a.96.96 0 0 1 .323.683l.065 2.135a.96.96 0 0 0 1.347.85l2.381-1.053a.96.96 0 0 1 .641-.046A13 13 0 0 0 12 23.28c6.76 0 12-4.952 12-11.64S18.76 0 12 0m6.806 7.44c.522-.03.971.567.63 1.094l-4.178 6.457a.707.707 0 0 1-.977.208l-3.87-2.504a.44.44 0 0 0-.49.007l-4.363 3.01c-.637.438-1.415-.317-.995-.966l4.179-6.457a.706.706 0 0 1 .977-.21l3.87 2.505c.15.097.344.094.491-.007l4.362-3.008a.7.7 0 0 1 .364-.13"},tiktok:{color:"#000000",d:"M12.525.02c1.31-.02 2.61-.01 3.91-.04.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 2.26-.9 4.51-2.43 6.13-1.66 1.72-3.96 2.75-6.38 2.91-2.45.16-4.98-.3-7.05-1.55-2.07-1.25-3.57-3.23-4.21-5.54-.64-2.32-.47-4.85.5-7.01.97-2.15 2.65-3.89 4.74-4.91 2.1-.99 4.54-1.29 6.8-.82.16.03.32.07.48.11v4.13c-1.3-.23-2.65-.21-3.92.1-1.28.31-2.45.96-3.34 1.9-1.07 1.11-1.62 2.66-1.54 4.2.07 1.54.76 2.98 1.94 3.98 1.17 1 2.7 1.48 4.25 1.34 1.55-.14 2.98-.86 3.98-2.01 1.01-1.15 1.49-2.73 1.35-4.29V.02z"},feishu:{color:"#3370FF",d:"M23.16 6.55l-9.04-5.26c-.66-.39-1.48-.39-2.14 0l-9.04 5.26C2.28 6.94 1.8 7.77 1.8 8.54v10.51c0 .77.48 1.6 1.14 1.99l9.04 5.26c.66.39 1.48.39 2.14 0l9.04-5.26c.66-.39 1.14-1.22 1.14-1.99V8.54c0-.77-.48-1.6-1.14-1.99zM7.22 12.35l3.22-3.15c.57-.55 1.51-.55 2.08 0l4.25 4.14-4.25 4.15a1.47 1.47 0 0 1-2.08 0l-3.22-3.14V12.35z"},wechat:{color:"#07C160",d:"M17.16 9.61c-3.55 0-6.42 2.37-6.42 5.3 0 2.93 2.87 5.3 6.42 5.3 1.34 0 2.58-.35 3.61-.95.73.49 1.76.99 1.89 1.03.11.04.14-.07.1-.14l-.62-1.46c.92-1.04 1.44-2.36 1.44-3.78 0-2.93-2.87-5.3-6.42-5.3zm-1.64 3.03c.36 0 .66.3.66.66 0 .36-.3.66-.66.66-.36 0-.66-.3-.66-.66 0-.36.3-.66.66-.66zm3.28 0c.36 0 .66.3.66.66 0 .36-.3.66-.66.66-.36 0-.66-.3-.66-.66 0-.36.3-.66.66-.66zm-10.45 4.6l-.88 2.06c-.06.1-.02.26.15.2.19-.05 1.66-.75 2.75-1.48 1.5.85 3.25 1.35 5.14 1.35.34 0 .68-.02 1.01-.06-1.13-2.61-3.66-4.48-6.68-4.48-3.95 0-7.15 2.68-7.15 6.01 0 1.94.94 3.7 2.45 4.96.11.08.15.2.11.3l-.71 1.68c-.06.1.02.25.14.2.18-.06 1.63-.73 2.69-1.44 1.5.83 3.19 1.32 5 1.32 5.09 0 9.22-3.48 9.22-7.78 0-.41-.04-.81-.11-1.2-.55.07-1.1.11-1.67.11-4.7 0-8.52-3.13-8.52-6.99 0-.44.05-.88.14-1.3-.96-.13-1.95-.19-2.97-.19-5.09 0-9.22 3.48-9.22 7.78 0 2.27 1.13 4.31 2.92 5.76zM7.18 10.98c.45 0 .82.37.82.82 0 .45-.37.82-.82.82-.45 0-.82-.37-.82-.82 0-.45.37-.82.82-.82zm5.75 0c.45 0 .82.37.82.82 0 .45-.37.82-.82.82-.45 0-.82-.37-.82-.82 0-.45.37-.82.82-.82z"}};function Zm(a){return a in nl}function Jm({kind:a,size:i=24}){return Zm(a)?o.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:nl[a].color,"aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:nl[a].d})}):o.jsx(ve,{name:"channels",size:i})}const eg="_button_1p4is_1",tg="_label_1p4is_39",$a={button:eg,label:tg,"size-sm":"_size-sm_1p4is_46","size-md":"_size-md_1p4is_52","size-lg":"_size-lg_1p4is_58","variant-primary":"_variant-primary_1p4is_65","variant-secondary":"_variant-secondary_1p4is_78","variant-ghost":"_variant-ghost_1p4is_90","variant-danger":"_variant-danger_1p4is_101"},ng="_spinner_qbves_1",rg={spinner:ng};function Ga({size:a=16,label:i="Đang tải",className:c}){return o.jsx("span",{role:"status","aria-label":i,className:[rg.spinner,c??""].join(" ").trim(),style:{width:a,height:a}})}function fe({variant:a="primary",size:i="md",disabled:c=!1,loading:d=!1,type:h="button",children:m,className:f,...y}){const k=c||d;return o.jsxs("button",{type:h,disabled:k,"aria-disabled":k,"aria-busy":d||void 0,className:[$a.button,$a[`variant-${a}`],$a[`size-${i}`],f??""].join(" ").trim(),...y,children:[d&&o.jsx(Ga,{size:i==="sm"?14:16,label:"Đang xử lý"}),o.jsx("span",{className:$a.label,children:m})]})}const og="_card_e8wlu_1",ag="_hoverable_e8wlu_14",Cd={card:og,hoverable:ag};function sg({children:a,className:i,style:c,hoverable:d=!1,onClick:h}){return o.jsx("div",{className:[Cd.card,d?Cd.hoverable:"",i??""].join(" ").trim(),style:c,onClick:h,role:h?"button":void 0,tabIndex:h?0:void 0,onKeyDown:h?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),h())}:void 0,children:a})}const ig="_empty_17213_2",lg="_iconWrap_17213_17",cg="_mascot_17213_29",ug="_title_17213_33",dg="_message_17213_40",hg="_action_17213_48",jr={empty:ig,iconWrap:lg,mascot:cg,title:ug,message:dg,action:hg},Sd="(prefers-reduced-motion: reduce)";function fg(){const[a,i]=p.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(Sd).matches:!1);return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const c=window.matchMedia(Sd),d=h=>i(h.matches);return c.addEventListener("change",d),()=>c.removeEventListener("change",d)},[]),a}const nh=p.createContext("system");function pg({value:a,children:i}){return o.jsx(nh.Provider,{value:a,children:i})}function mg(){const a=fg();return p.useContext(nh)==="reduced"||a}const gg="_mascot_1sof1_9",vg={mascot:gg},Va=(a,i,c)=>a+(i-a)*c;function yg({active:a,gazeMode:i,followCursor:c,svgRef:d,motionRef:h,eyesRef:m,gazeRef:f}){p.useEffect(()=>{if(!a){h.current&&(h.current.style.transform=""),m.current&&(m.current.style.transform=""),f.current&&(f.current.style.transform="");return}let y=!1,k=0;const N=performance.now();let x=0,j=0,A=0,H=0,_=0,C=0,M=0,R=0;const L=re=>{if(i!=="full"||!c)return;const te=d.current;if(!te)return;const oe=te.getBoundingClientRect();if(oe.width===0)return;const xe=(re.clientX-(oe.left+oe.width/2))/oe.width,Z=(re.clientY-(oe.top+oe.height/2))/oe.height;_=Math.max(-8,Math.min(8,xe*16)),C=Math.max(-6,Math.min(6,Z*12))};window.addEventListener("mousemove",L);let I=0;const B=()=>{I=window.setTimeout(()=>{if(y||i!=="full"){B();return}const re=(Math.random()-.5)*7,te=(Math.random()-.5)*5,oe=performance.now(),xe=260,Z=W=>{if(y)return;const me=Math.min(1,(W-oe)/xe),Ne=me<.35?me/.35:1-(me-.35)/.65,je=Math.sin(Ne*Math.PI*.5);M=re*je,R=te*je,me<1?requestAnimationFrame(Z):(M=0,R=0,B())};requestAnimationFrame(Z)},1800+Math.random()*2600)};B();let ue=0;const q=()=>{ue=window.setTimeout(()=>{if(y){q();return}const re=m.current,te=performance.now(),oe=190,xe=Z=>{if(y)return;const W=Math.min(1,(Z-te)/oe),me=W<.4,Ne=me?W/.4:(W-.4)/.6,je=Math.sin(Ne*Math.PI*.5),_e=me?1-je*.93:.07+je*.93;re&&(re.style.transform=`scaleY(${_e.toFixed(3)})`),W<1?requestAnimationFrame(xe):(re&&(re.style.transform=""),q())};requestAnimationFrame(xe)},2200+Math.random()*2800)};q();const pe=re=>{if(y)return;const te=(re-N)/1e3,oe=Math.sin(te*1.35)*4.5+Math.sin(te*.52+1.3)*2,xe=Math.sin(te*.42+.6)*1.6;x=Va(x,oe,.055),j=Va(j,xe,.055),h.current&&(h.current.style.transform=`translateY(${x.toFixed(2)}px) rotate(${j.toFixed(2)}deg)`);const Z=i==="full",W=Z?_+M:0,me=Z?C+R:0;A=Va(A,W,.16),H=Va(H,me,.16),f.current&&(f.current.style.transform=`translate(${A.toFixed(2)}px, ${H.toFixed(2)}px)`),k=requestAnimationFrame(pe)};return k=requestAnimationFrame(pe),()=>{y=!0,cancelAnimationFrame(k),window.clearTimeout(I),window.clearTimeout(ue),window.removeEventListener("mousemove",L)}},[a,i,c,d,h,m,f])}const wg={idle:"Linh vật cú BoomBot",thinking:"BoomBot đang suy nghĩ",working:"BoomBot đang làm việc",happy:"Xong rồi!"};function kg({state:a="idle",size:i=64,className:c="",label:d,followCursor:h=!0}){const m=p.useRef(null),f=p.useRef(null),y=p.useRef(null),k=p.useRef(null),N=mg();return yg({active:(a==="idle"||a==="thinking")&&!N,gazeMode:a==="idle"?"full":"off",followCursor:h,svgRef:m,motionRef:f,eyesRef:y,gazeRef:k}),o.jsx("span",{className:[vg.mascot,c].filter(Boolean).join(" "),"data-state":a,style:{width:i,height:i,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:o.jsx("img",{src:"/logo.png",alt:d??wg[a],style:{width:"100%",height:"100%",objectFit:"contain",borderRadius:i>48?"16px":"8px",boxShadow:"0 0 20px rgba(129, 140, 248, 0.35)"}})})}function Nr({icon:a,title:i,message:c,action:d,mascot:h}){return o.jsxs("div",{className:jr.empty,children:[h?o.jsx(kg,{state:h,size:88,className:jr.mascot}):o.jsx("span",{className:jr.iconWrap,"aria-hidden":"true",children:o.jsx(ve,{name:a,size:28})}),o.jsx("h3",{className:jr.title,children:i}),c&&o.jsx("p",{className:jr.message,children:c}),d&&o.jsx("div",{className:jr.action,children:d})]})}const xg="_field_py9ew_1",_g="_label_py9ew_8",Cg="_required_py9ew_14",Sg="_hint_py9ew_18",jg="_error_py9ew_25",Tg="_control_py9ew_33",qn={field:xg,label:_g,required:Cg,hint:Sg,error:jg,control:Tg};function rh({id:a,label:i,error:c,hint:d,required:h=!1,children:m}){const f=`${a}-error`,y=`${a}-hint`;return o.jsxs("div",{className:qn.field,children:[i&&o.jsxs("label",{htmlFor:a,className:qn.label,children:[i,h&&o.jsx("span",{className:qn.required,"aria-hidden":"true",children:" *"})]}),m,d&&!c&&o.jsx("p",{id:y,className:qn.hint,children:d}),c&&o.jsx("p",{id:f,className:qn.error,role:"alert",children:c})]})}function oh(a,i,c){if(i)return`${a}-error`;if(c)return`${a}-hint`}const Eg="_iconButton_1lyp5_1",qi={iconButton:Eg,"size-sm":"_size-sm_1lyp5_39","variant-secondary":"_variant-secondary_1lyp5_43"};function Xn({icon:a,size:i="md",variant:c="ghost",className:d,type:h="button",...m}){return o.jsx("button",{type:h,className:[qi.iconButton,qi[`size-${i}`],qi[`variant-${c}`],d??""].join(" ").trim(),...m,children:o.jsx(ve,{name:a,size:i==="sm"?18:20})})}const Ng="_group_hiaao_5",bg="_key_hiaao_12",jd={group:Ng,key:bg};function ah({keys:a}){return o.jsx("span",{className:jd.group,"aria-label":a.join(" + "),children:a.map((i,c)=>o.jsx(p.Fragment,{children:o.jsx("kbd",{className:jd.key,children:i})},`${c}-${i}`))})}function _t({label:a,error:i,hint:c,id:d,required:h,...m}){const f=p.useId(),y=d??`input-${f}`;return o.jsx(rh,{id:y,label:a,error:i,hint:c,required:h,children:o.jsx("input",{id:y,className:qn.control,"aria-invalid":i?!0:void 0,"aria-describedby":oh(y,i,c),required:h,...m})})}const Lg="_overlay_eag6u_1",Mg="_closing_eag6u_16",Rg="_panel_eag6u_21",Pg="_header_eag6u_41",Ag="_title_eag6u_51",Ig="_body_eag6u_59",Dg="_footer_eag6u_64",En={overlay:Lg,closing:Mg,panel:Rg,header:Pg,title:Ag,body:Ig,footer:Dg},Og=150;function Td(a){const i=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(a.querySelectorAll(i)).filter(c=>c.offsetParent!==null||c===document.activeElement)}function Qn({open:a,onClose:i,title:c,children:d,footer:h,describedBy:m}){const[f,y]=p.useState(a),[k,N]=p.useState(!1),x=p.useRef(null),j=p.useRef(i);j.current=i;const A=p.useId(),H=p.useRef(null);p.useEffect(()=>{if(a){H.current=document.activeElement,y(!0),N(!1);return}if(!f)return;N(!0);const C=window.setTimeout(()=>{var M,R;y(!1),N(!1),(R=(M=H.current)==null?void 0:M.focus)==null||R.call(M)},Og);return()=>window.clearTimeout(C)},[a,f]);const _=p.useCallback(()=>{j.current()},[]);return p.useEffect(()=>{if(!f||k)return;const C=x.current;if(!C)return;(Td(C)[0]??C).focus();const R=I=>{if(I.key==="Escape"){I.stopPropagation(),_();return}if(I.key!=="Tab")return;const B=Td(C);if(B.length===0){I.preventDefault();return}const ue=B[0],q=B[B.length-1];I.shiftKey&&document.activeElement===ue?(I.preventDefault(),q.focus()):!I.shiftKey&&document.activeElement===q&&(I.preventDefault(),ue.focus())};document.addEventListener("keydown",R,!0);const L=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",R,!0),document.body.style.overflow=L}},[f,k,_]),f?ll.createPortal(o.jsx("div",{className:[En.overlay,k?En.closing:""].join(" ").trim(),onMouseDown:C=>{C.target===C.currentTarget&&_()},children:o.jsxs("div",{ref:x,role:"dialog","aria-modal":"true","aria-labelledby":A,"aria-describedby":m,tabIndex:-1,className:[En.panel,k?En.closing:""].join(" ").trim(),children:[o.jsxs("div",{className:En.header,children:[o.jsx("h2",{id:A,className:En.title,children:c}),o.jsx(Xn,{icon:"x","aria-label":"Đóng",onClick:_})]}),o.jsx("div",{className:En.body,children:d}),h&&o.jsx("div",{className:En.footer,children:h})]})}),document.body):null}const Fg="_header_37mfg_1",zg="_text_37mfg_11",Bg="_title_37mfg_15",Kg="_subtitle_37mfg_23",Hg="_actions_37mfg_31",So={header:Fg,text:zg,title:Bg,subtitle:Kg,actions:Hg};function Ug({title:a,subtitle:i,actions:c}){return o.jsxs("header",{className:So.header,children:[o.jsxs("div",{className:So.text,children:[o.jsx("h1",{className:So.title,children:a}),i&&o.jsx("p",{className:So.subtitle,children:i})]}),c&&o.jsx("div",{className:So.actions,children:c})]})}const $g="_group_zc09i_1",Vg="_option_zc09i_10",Wg="_selected_zc09i_41",Qi={group:$g,option:Vg,selected:Wg};function Bt({options:a,value:i,onChange:c,ariaLabel:d,iconOnly:h=!1,disabled:m=!1}){return o.jsx("div",{role:"group","aria-label":d,className:Qi.group,"data-icon-only":h||void 0,children:a.map(f=>{const y=f.value===i;return o.jsxs("button",{type:"button",disabled:m,"aria-pressed":y,"aria-label":h?f.label:void 0,title:h?f.label:void 0,onClick:()=>c(f.value),className:[Qi.option,y?Qi.selected:""].join(" ").trim(),children:[f.icon!==void 0&&o.jsx(ve,{name:f.icon,size:16}),!h&&o.jsx("span",{children:f.label})]},f.value)})})}function Gg({label:a,error:i,hint:c,id:d,required:h,children:m,...f}){const y=p.useId(),k=d??`select-${y}`;return o.jsx(rh,{id:k,label:a,error:i,hint:c,required:h,children:o.jsx("select",{id:k,className:qn.control,"aria-invalid":i?!0:void 0,"aria-describedby":oh(k,i,c),required:h,...f,children:m})})}const qg="_skeleton_1st85_1",Qg="_auroraShimmer_1st85_1",Ed={skeleton:qg,"variant-text":"_variant-text_1st85_9","variant-rect":"_variant-rect_1st85_15","variant-circle":"_variant-circle_1st85_21",auroraShimmer:Qg};function Eo({variant:a="rect",width:i,height:c,className:d}){return o.jsx("span",{"aria-hidden":"true",className:[Ed.skeleton,Ed[`variant-${a}`],d??""].join(" ").trim(),style:{width:i,height:c}})}const Xg="_wrapper_1fgop_1",Yg="_on_1fgop_32",Zg="_knob_1fgop_38",Jg="_label_1fgop_63",Tr={wrapper:Xg,switch:"_switch_1fgop_10",on:Yg,knob:Zg,label:Jg};function Nd({checked:a,onChange:i,label:c,ariaLabel:d,disabled:h=!1,id:m}){const f=o.jsx("button",{id:m,type:"button",role:"switch","aria-checked":a,"aria-label":d,disabled:h,onClick:()=>i(!a),className:[Tr.switch,a?Tr.on:""].join(" ").trim(),children:o.jsx("span",{className:Tr.knob,"aria-hidden":"true"})});return c===void 0?o.jsx("span",{className:Tr.wrapper,children:f}):o.jsxs("label",{className:Tr.wrapper,htmlFor:m,children:[f,o.jsx("span",{className:Tr.label,children:c})]})}const e1="_region_1h4m9_1",t1="_toast_1h4m9_13",n1="_leaving_1h4m9_33",r1="_icon_1h4m9_38",o1="_text_1h4m9_60",a1="_title_1h4m9_64",s1="_message_1h4m9_71",Nn={region:e1,toast:t1,"toast-in":"_toast-in_1h4m9_1",leaving:n1,icon:r1,"tone-info":"_tone-info_1h4m9_44","tone-success":"_tone-success_1h4m9_48","tone-warn":"_tone-warn_1h4m9_52","tone-error":"_tone-error_1h4m9_56",text:o1,title:a1,message:s1},i1=4e3,l1=200,c1={info:"info",success:"check",warn:"warn",error:"x"},sh=p.createContext(null);function Yn(){const a=p.useContext(sh);return a||{push:()=>{}}}function u1({toast:a,onDone:i}){return p.useEffect(()=>{const c=window.setTimeout(()=>i(a.id),i1);return()=>window.clearTimeout(c)},[a.id,i]),o.jsxs("div",{role:"status",className:[Nn.toast,Nn[`tone-${a.tone}`],a.leaving?Nn.leaving:""].join(" ").trim(),children:[o.jsx("span",{className:Nn.icon,"aria-hidden":"true",children:o.jsx(ve,{name:c1[a.tone],size:18})}),o.jsxs("div",{className:Nn.text,children:[o.jsx("p",{className:Nn.title,children:a.title}),a.message&&o.jsx("p",{className:Nn.message,children:a.message})]})]})}function d1({children:a}){const[i,c]=p.useState([]),d=p.useRef(0),h=p.useCallback(k=>{c(N=>N.filter(x=>x.id!==k))},[]),m=p.useCallback(k=>{c(N=>N.map(x=>x.id===k?{...x,leaving:!0}:x)),window.setTimeout(()=>h(k),l1)},[h]),f=p.useCallback(k=>{d.current+=1;const N=d.current;c(x=>[...x.slice(-3),{...k,id:N,leaving:!1}])},[]),y=p.useMemo(()=>({push:f}),[f]);return o.jsxs(sh.Provider,{value:y,children:[a,ll.createPortal(o.jsx("div",{className:Nn.region,"aria-live":"polite","aria-atomic":"false",children:i.map(k=>o.jsx(u1,{toast:k,onDone:m},k.id))}),document.body)]})}const h1={openai:{color:"#000000",darkColor:"#ffffff",d:"M22.28 10.95a10.87 10.87 0 00-.77-3.92 1.34 1.34 0 00-1.63-.79l-.26.06c-1.12.3-2.14.77-3.02 1.39l.1-1.39a10.8 10.8 0 00-2-6.52 1.34 1.34 0 00-1.74-.46l-2.07 1a10.88 10.88 0 00-4.32 4.43c-.47-.28-.97-.53-1.49-.74l-.24-.1a1.34 1.34 0 00-1.77.62 10.87 10.87 0 00-1.07 3.92 10.88 10.88 0 002.83 8.35 1.34 1.34 0 001.62.79l.26-.07c1.12-.3 2.13-.76 3.01-1.38l-.1 1.38a10.8 10.8 0 002.01 6.53 1.34 1.34 0 001.75.46l2.06-1a10.88 10.88 0 004.33-4.43c.47.28.97.53 1.5.74l.23.1a1.34 1.34 0 001.77-.62 10.88 10.88 0 001.07-3.93 10.88 10.88 0 00-2.84-8.35zm-5.71-3.66a8.88 8.88 0 011.66 2.05l-4.7 2.7-3.15-5.46a8.88 8.88 0 016.19.71zm-9.3 1.83a8.88 8.88 0 014.28-1l-1.57 5.24h-6.3a8.88 8.88 0 013.59-4.24zm-4.14 8.7a8.88 8.88 0 01-.15-2.61l4.72-2.73 3.14 5.46a8.88 8.88 0 01-7.71-.12zm2.84 5.76a8.88 8.88 0 01-1.66-2.05l4.72-2.73 3.14 5.45a8.88 8.88 0 01-6.2-.67zm9.3-1.82a8.88 8.88 0 01-4.28 1l1.56-5.24h6.3a8.88 8.88 0 01-3.58 4.24zm4.14-8.7a8.88 8.88 0 01.16 2.6l-4.72 2.73-3.14-5.45a8.88 8.88 0 017.7-.88zm-6.19 1.43h-4.3l2.15-3.73 2.15 3.73zm-4.63 2.68l2.15 3.72-4.3 0 2.15-3.72z"},anthropic:{color:"#D97706",darkColor:"#F59E0B",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"},google:{color:"#4285F4",d:"M23.64 12.20c0-.82-.07-1.62-.21-2.39H12v4.51h6.53c-.28 1.46-1.09 2.69-2.32 3.52v2.93h3.76c2.20-2.03 3.47-5.02 3.47-8.57zM12 24c3.27 0 6.01-1.09 8.01-2.94l-3.76-2.93c-1.08.73-2.47 1.16-4.25 1.16-3.27 0-6.04-2.21-7.03-5.18H1.14v3.02C3.14 21.08 7.21 24 12 24zM4.97 14.11c-.25-.75-.39-1.54-.39-2.36s.14-1.61.39-2.36V6.37H1.14C.42 7.82 0 9.47 0 11.25s.42 3.43 1.14 4.88l3.83-2.02zM12 4.79c1.78 0 3.37.61 4.63 1.81l3.47-3.47C18.01 1.09 15.27 0 12 0 7.21 0 3.14 2.92 1.14 6.37l3.83 3.02C5.96 7 8.73 4.79 12 4.79z"},xai:{color:"#000000",darkColor:"#ffffff",d:"M13.79 10.96l7.85-8.82h-1.86l-6.81 7.65-5.44-7.65H.54l8.22 11.57-8.24 9.25h1.86l7.19-8.08 5.76 8.08h6.98l-8.52-11.99zM15.42 20.4l-1.3-1.85L2.83 2.87H5.7l9.9 14.07 1.3 1.85 11.69 16.59h-2.87L15.42 20.4z"},deepseek:{color:"#0066FF",d:"M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45"},mistral:{color:"#FF7000",d:"M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z"},ollama:{color:"#10B981",darkColor:"#34D399",d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032z"},meta:{color:"#0081FB",d:"M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973a6.624 6.624 0 0 0 .265.86 5.297 5.297 0 0 0 .371.761c.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.756-1.339.186-.325c.061.1.121.196.183.3l2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843a3.743 3.743 0 0 0 .81-.973c.542-.939.861-2.127.861-3.745 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c.07-.109.141-.224.211-.327 1.12-1.667 2.118-2.602 3.358-2.602zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-.524 0-1.038-.237-1.383-.794-.263-.426-.464-1.13-.464-2.046 0-2.221.63-4.535 1.66-6.088.454-.687.964-1.226 1.533-1.533a2.264 2.264 0 0 1 1.088-.285z"},qwen:{color:"#615CED",d:"M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z"},"openai-compatible":{color:"#818CF8",d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm1 14.93V18a1 1 0 0 1-2 0v-1.07A7 7 0 0 1 5.07 11H6a1 1 0 0 1 0-2h-.93A7 7 0 0 1 11 3.07V4a1 1 0 0 1 2 0v-.93A7 7 0 0 1 18.93 9H18a1 1 0 0 1 0 2h.93A7 7 0 0 1 13 16.93zM12 7a5 5 0 1 0 5 5 5 5 0 0 0-5-5z"},local:{color:"#10B981",d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-1 14H5c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1zm-7-8h4v2h-4v-2zm-5 0h3v2H7v-2zm0 4h9v2H7v-2z"}};function f1({kind:a,size:i=24}){const c=document.documentElement.getAttribute("data-theme")!=="light",d=(a||"").toLowerCase().trim(),h=h1[d];if(!h)return o.jsx(ve,{name:"cpu",size:i});let m=h.color;return c&&h.darkColor&&(m=h.darkColor),o.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:m,"aria-hidden":"true",focusable:"false",style:h.scale?{transform:`scale(${h.scale})`}:void 0,children:o.jsx("path",{d:h.d})})}function p1(a,i){const c=a.toLowerCase(),d=i.toLowerCase();if(c.length===0)return 0;let h=0,m=0,f=-2,y=-1;for(let k=0;k<c.length;k++){const N=c.charAt(k),x=d.indexOf(N,m);if(x===-1)return-1/0;y===-1&&(y=x);let j=10;x===0?j+=20:m1(d,x)&&(j+=10),x===f+1&&(j+=12),j-=Math.max(0,x-m-1),h+=j,f=x,m=x+1}return y===0&&c.length===d.length&&(h+=30),h}function m1(a,i){const c=a[i-1];return c===" "||c==="-"||c==="_"||c==="/"||c==="."||c===":"||c==="("||c==="["}function g1(a,i){const c=i.trim();if(c==="")return a.slice();const d=a.map((h,m)=>{const f=[h.title,h.subtitle??"",h.keywords??""],y=Math.max(...f.map(k=>p1(c,k)));return{action:h,score:y,index:m}}).filter(h=>h.score>-1/0);return d.sort((h,m)=>m.score-h.score||h.index-m.index),d.map(h=>h.action)}function on(a,i,c,d,h,m,f){return{id:a,title:i,subtitle:h,hint:f,icon:d,keywords:m,run:y=>y.navigate(c)}}function v1(a){const i=c=>({title:a(`palette.actions.${c}.title`),subtitle:a(`palette.actions.${c}.subtitle`)});return[{id:"new-chat",...i("newChat"),icon:"plus",keywords:"new chat mới phiên mới",run:c=>c.navigate("/")},on("go-chat",a("palette.actions.goChat.title"),"/","chat",a("palette.actions.goChat.subtitle"),"chat trò chuyện open"),on("go-sessions",a("palette.actions.goSessions.title"),"/sessions","sessions",a("palette.actions.goSessions.subtitle"),"sessions phiên history lịch sử"),on("go-providers",a("palette.actions.goProviders.title"),"/settings/connection","cpu",a("palette.actions.goProviders.subtitle"),"providers model llm openai anthropic ket noi connection"),on("go-schedules",a("palette.actions.goSchedules.title"),"/schedules","calendar",a("palette.actions.goSchedules.subtitle"),"schedules lịch chạy cron schedule"),on("go-tasks",a("palette.actions.goTasks.title"),"/tasks","clock",a("palette.actions.goTasks.subtitle"),"tasks task nền background runner"),on("go-memory",a("palette.actions.goMemory.title"),"/memory","database",a("palette.actions.goMemory.subtitle"),"memory bộ nhớ nhớ recall"),on("go-channels",a("palette.actions.goChannels.title"),"/settings/connection","radio",a("palette.actions.goChannels.subtitle"),"channels kênh chat telegram zalo discord slack pair"),on("go-settings",a("palette.actions.goSettings.title"),"/settings","gear",a("palette.actions.goSettings.subtitle"),"settings cài đặt cấu hình config"),on("go-onboarding",a("palette.actions.goOnboarding.title"),"/welcome","bolt",a("palette.actions.goOnboarding.subtitle"),"onboarding welcome bắt đầu hướng dẫn start"),{id:"channel-pair",...i("channelPair"),icon:"link",keywords:"pair kênh channel kết nối telegram zalo",run:c=>c.navigate("/settings/connection")},{id:"schedule-now",...i("scheduleNow"),icon:"play",keywords:"schedule run now chạy ngay lịch",run:c=>c.navigate("/schedules")},{id:"reconnect-gateway",...i("reconnect"),icon:"refresh",keywords:"reconnect kết nối lại gateway retry",run:async c=>{const d=await c.saveCredentials(c.baseUrl,"");c.toast(d?{tone:"success",title:a("palette.toast.reconnectOk")}:{tone:"error",title:a("palette.toast.reconnectFail")})}},{id:"open-shortcuts",...i("openShortcuts"),hint:"?",icon:"key",keywords:"shortcuts phím tắt keyboard cheatsheet help",run:c=>c.openShortcuts()},{id:"session-delete",...i("sessionDelete"),icon:"trash",keywords:"delete xoá phiên session remove",run:async c=>{const d=c.pathname.match(/^\/chat\/([^/?#]+)/),h=d==null?void 0:d[1];if(!d||!h){c.toast({tone:"warn",title:a("palette.toast.noOpenSession")});return}const m=decodeURIComponent(h);if(!c.client){c.toast({tone:"warn",title:a("palette.toast.notConnected")});return}try{await c.client.sessionsDelete(m),c.toast({tone:"success",title:a("palette.toast.sessionDeleted")}),c.navigate("/")}catch(f){c.toast({tone:"error",title:a("palette.toast.sessionDeleteFail"),message:f instanceof Error?f.message:void 0})}}}]}const y1="_overlay_1inx0_3",w1="_panel_1inx0_19",k1="_searchRow_1inx0_31",x1="_searchInput_1inx0_40",_1="_list_1inx0_57",C1="_row_1inx0_65",S1="_rowIcon_1inx0_84",j1="_active_1inx0_91",T1="_rowText_1inx0_100",E1="_rowTitle_1inx0_108",N1="_rowSubtitle_1inx0_115",b1="_empty_1inx0_123",L1="_keycap_1inx0_131",M1="_footer_1inx0_150",R1="_footerHint_1inx0_160",Ue={overlay:y1,panel:w1,searchRow:k1,searchInput:x1,list:_1,row:C1,rowIcon:S1,active:j1,rowText:T1,rowTitle:E1,rowSubtitle:N1,empty:b1,keycap:L1,footer:M1,footerHint:R1};function P1({actions:a,initialQuery:i="",onClose:c,onRun:d}){const{t:h}=Be(),[m,f]=p.useState(i),[y,k]=p.useState(0),N=p.useRef(null),x=p.useRef(null),j=p.useRef(null),A=p.useId(),H=p.useMemo(()=>g1(a,m),[a,m]);p.useEffect(()=>{k(0)},[m]);const _=H[Math.min(y,Math.max(0,H.length-1))];p.useEffect(()=>{var L;return j.current=document.activeElement,(L=N.current)==null||L.focus(),()=>{const I=j.current;I instanceof HTMLElement&&I.focus({preventScroll:!0})}},[]),p.useEffect(()=>{var I;if(!_)return;const L=(I=x.current)==null?void 0:I.querySelector(`[data-palette-index="${Math.min(y,H.length-1)}"]`);L&&typeof L.scrollIntoView=="function"&&L.scrollIntoView({block:"nearest"})},[y,_,H.length]);const C=()=>{_&&d(_)},M=L=>{L.key==="ArrowDown"?(L.preventDefault(),k(I=>H.length===0?0:(I+1)%H.length)):L.key==="ArrowUp"?(L.preventDefault(),k(I=>H.length===0?0:(I-1+H.length)%H.length)):L.key==="Enter"?(L.preventDefault(),C()):L.key==="Escape"&&(L.preventDefault(),c())},R=_?`${A}-option-${_.id}`:void 0;return o.jsx("div",{className:Ue.overlay,onClick:c,children:o.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":h("palette.ariaLabel"),className:Ue.panel,onClick:L=>L.stopPropagation(),onKeyDown:M,children:[o.jsxs("div",{className:Ue.searchRow,children:[o.jsx(ve,{name:"search",size:18}),o.jsx("input",{ref:N,type:"text",role:"combobox","aria-expanded":"true","aria-controls":A,"aria-activedescendant":R,"aria-autocomplete":"list",className:Ue.searchInput,placeholder:h("palette.placeholder"),value:m,onChange:L=>f(L.target.value)}),m&&o.jsx("span",{className:Ue.keycap,"aria-hidden":"true",children:"esc"})]}),o.jsx("ul",{ref:x,id:A,role:"listbox","aria-label":h("palette.resultsLabel"),className:Ue.list,children:H.map((L,I)=>{const B=L.id===(_==null?void 0:_.id);return o.jsx("li",{role:"option",id:`${A}-option-${L.id}`,"aria-selected":B,children:o.jsxs("button",{type:"button","data-palette-index":I,className:[Ue.row,B?Ue.active:""].join(" ").trim(),onMouseEnter:()=>k(I),onClick:()=>d(L),children:[o.jsx("span",{className:Ue.rowIcon,"aria-hidden":"true",children:o.jsx(ve,{name:L.icon,size:18})}),o.jsxs("span",{className:Ue.rowText,children:[o.jsx("span",{className:Ue.rowTitle,children:L.title}),L.subtitle&&o.jsx("span",{className:Ue.rowSubtitle,children:L.subtitle})]}),L.hint&&o.jsx("span",{className:Ue.keycap,"aria-hidden":"true",children:L.hint})]})},L.id)})}),H.length===0&&o.jsx("div",{className:Ue.empty,children:h("palette.emptyTitle")}),o.jsxs("div",{className:Ue.footer,"aria-hidden":"true",children:[o.jsxs("span",{className:Ue.footerHint,children:[o.jsx("span",{className:Ue.keycap,children:"↑↓"})," ",h("palette.footerNav")]}),o.jsxs("span",{className:Ue.footerHint,children:[o.jsx("span",{className:Ue.keycap,children:"↵"})," ",h("palette.footerChoose")]}),o.jsxs("span",{className:Ue.footerHint,children:[o.jsx("span",{className:Ue.keycap,children:"esc"})," ",h("palette.footerClose")]})]})]})})}const A1="_groups_1gomu_1",I1="_groupTitle_1gomu_13",D1="_list_1gomu_27",O1="_row_1gomu_43",F1="_description_1gomu_69",z1="_note_1gomu_79",Gn={groups:A1,groupTitle:I1,list:D1,row:O1,description:F1,note:z1},B1=[{titleKey:"shortcuts.groupNav",items:[{keys:["g","c"],descKey:"shortcuts.goChat"},{keys:["g","s"],descKey:"shortcuts.goSessions"},{keys:["g","p"],descKey:"shortcuts.goProviders"},{keys:["g","d"],descKey:"shortcuts.goSchedules"},{keys:["g","t"],descKey:"shortcuts.goTasks"},{keys:["g","m"],descKey:"shortcuts.goMemory"},{keys:["g","h"],descKey:"shortcuts.goChannels"},{keys:["g","e"],descKey:"shortcuts.goSettings"},{keys:["g","o"],descKey:"shortcuts.goOnboarding"}]},{titleKey:"shortcuts.groupActions",items:[{keys:["n"],descKey:"shortcuts.newChat"},{keys:["/"],descKey:"shortcuts.focusComposer"},{keys:["j"],descKey:"shortcuts.listNext"},{keys:["k"],descKey:"shortcuts.listPrev"},{keys:["?"],descKey:"shortcuts.openCheatsheet"},{keys:["Esc"],descKey:"shortcuts.closeOverlay"}]}],K1={c:"/",s:"/sessions",p:"/settings/connection",d:"/schedules",t:"/tasks",m:"/memory",e:"/settings",o:"/welcome"},H1=800;function U1(a){return a instanceof HTMLElement?a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a.tagName==="SELECT"?!0:a.isContentEditable:!1}function $1(){const a=document.querySelector("[data-chat-input]");a==null||a.focus()}function bd(a){const i=document.activeElement,c=(i instanceof HTMLElement?i.closest("[data-nav-list]"):null)??document.querySelector("[data-nav-list]");if(!(c instanceof HTMLElement))return;const d=Array.from(c.querySelectorAll("[data-nav-item]"));if(d.length===0)return;const h=i instanceof HTMLElement?d.indexOf(i):-1,m=h===-1?a===1?0:d.length-1:(h+a+d.length)%d.length,f=d[m];f==null||f.focus()}function V1({navigate:a,onCheatsheet:i}){const[c,d]=p.useState(!1),h=p.useRef(null),m=p.useRef(a),f=p.useRef(i);m.current=a,f.current=i;const y=p.useCallback(()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null),d(!1)},[]);return p.useEffect(()=>{const k={current:!1},N=()=>{k.current=!0,d(!0),h.current=window.setTimeout(()=>{k.current=!1,h.current=null,d(!1)},H1)},x=j=>{if(j.metaKey||j.ctrlKey||j.altKey||U1(document.activeElement)||document.querySelector('[role="dialog"]'))return;const A=j.key;if(k.current){const H=A.toLowerCase(),_=K1[H];if(H==="g"){y(),N(),j.preventDefault();return}y(),_!==void 0&&(m.current(_),j.preventDefault());return}if(A==="?"){j.preventDefault(),f.current();return}if(A==="g"||A==="G"){N(),j.preventDefault();return}if(A==="n"||A==="N"){m.current("/"),j.preventDefault();return}if(A==="/"){$1(),j.preventDefault();return}if(A==="j"||A==="J"){bd(1);return}if(A==="k"||A==="K"){bd(-1);return}};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x),h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[y]),{awaitingChord:c}}function W1({open:a,onClose:i}){const{t:c}=Be();return o.jsxs(Qn,{open:a,onClose:i,title:c("shortcuts.title"),children:[o.jsx("div",{className:Gn.groups,children:B1.map(d=>o.jsxs("section",{className:Gn.group,children:[o.jsx("h3",{className:Gn.groupTitle,children:c(d.titleKey)}),o.jsx("ul",{className:Gn.list,children:d.items.map(h=>o.jsxs("li",{className:Gn.row,children:[o.jsx("span",{className:Gn.description,children:c(h.descKey)}),o.jsx(ah,{keys:h.keys})]},h.descKey))})]},d.titleKey))}),o.jsx("p",{className:Gn.note,children:c("shortcuts.note")})]})}const G1="_pendingHint_y36pa_9",q1="_pendingText_y36pa_43",Ld={pendingHint:G1,pendingText:q1},rl="boombot:open-shortcuts";function Q1(){const a=sn(),[i,c]=p.useState(!1),d=p.useCallback(()=>c(!0),[]),h=p.useCallback(()=>c(!1),[]),{awaitingChord:m}=V1({navigate:a,onCheatsheet:d});return p.useEffect(()=>{const f=()=>c(!0);return window.addEventListener(rl,f),()=>window.removeEventListener(rl,f)},[]),o.jsxs(o.Fragment,{children:[m&&o.jsxs("div",{className:Ld.pendingHint,role:"status","aria-live":"polite",children:[o.jsx(ah,{keys:["g"]}),o.jsx("span",{className:Ld.pendingText,children:"đang chờ phím…"})]}),o.jsx(W1,{open:i,onClose:h})]})}const X1=p.createContext(null);function Y1({children:a}){const[i,c]=p.useState(!1),[d,h]=p.useState(""),m=sn(),{pathname:f}=Rt(),{t:y}=Be(),{client:k,baseUrl:N,saveCredentials:x}=Mn(),{push:j}=Yn(),A=p.useCallback((L="")=>{h(L),c(!0)},[]),H=p.useCallback(()=>c(!1),[]),_=p.useCallback(()=>{window.dispatchEvent(new CustomEvent(rl))},[]);p.useEffect(()=>{const L=I=>{if((I.metaKey||I.ctrlKey)&&I.key.toLowerCase()==="k"){I.preventDefault(),c(B=>!B);return}I.key==="Escape"&&i&&H()};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[i,H]);const C=p.useMemo(()=>{const L=v1(y);return/^\/chat\/[^/?#]+/.test(f)?L:L.filter(B=>B.id!=="session-delete")},[y,f]),M=p.useCallback(L=>{const I={navigate:m,client:k,openShortcuts:_,toast:j,pathname:f,saveCredentials:x,baseUrl:N};H(),Promise.resolve().then(()=>L.run(I)).catch(B=>{j({tone:"error",title:y("palette.failedToast"),message:B instanceof Error?B.message:void 0})})},[m,k,_,j,f,x,N,H,y]),R=p.useMemo(()=>({openPalette:A,openShortcuts:_}),[A,_]);return o.jsxs(X1.Provider,{value:R,children:[a,i&&o.jsx(P1,{actions:C,initialQuery:d,onClose:H,onRun:M})]})}function Md(a){return new Promise(i=>setTimeout(i,a))}async function ih(a,i,c=15e3){const d=a();await i();const h=Date.now();let m=a();for(;m===d&&Date.now()-h<2e3;)await Md(100),m=a();const f=m??d;if(!f)throw new Error("Không khởi tạo được gateway client");return await Promise.race([f.health(),Md(c).then(()=>{throw new Error("Hết thời gian chờ phản hồi từ gateway")})])}function ol(a){const i=a.trim();if(i==="")return null;try{const c=new URL(i);return c.protocol!=="http:"&&c.protocol!=="https:"?"URL phải bắt đầu bằng http:// hoặc https://":null}catch{return"URL không hợp lệ — ví dụ: http://localhost:8787"}}const Z1="_page_1838v_7",J1="_stepper_1838v_26",ev="_step_1838v_26",tv="_dot_1838v_43",nv="_stepLabel_1838v_63",rv="_current_1838v_68",ov="_done_1838v_79",av="_progress_1838v_89",sv="_progressBar_1838v_96",iv="_stepBody_1838v_108",lv="_slideFwd_1838v_146",cv="_slideBack_1838v_150",uv="_owlMark_1838v_154",dv="_heading_1838v_161",hv="_lead_1838v_177",fv="_note_1838v_185",pv="_actions_1838v_202",mv="_form_1838v_217",gv="_keyRow_1838v_226",vv="_keyGrow_1838v_232",yv="_testRow_1838v_237",wv="_healthLine_1838v_244",kv="_mono_1838v_251",xv="_okIcon_1838v_257",_v="_errIcon_1838v_262",Cv="_errText_1838v_267",Sv="_hintCenter_1838v_271",jv="_successCheck_1838v_279",Tv="_summary_1838v_290",ke={page:Z1,stepper:J1,step:ev,dot:tv,stepLabel:nv,current:rv,done:ov,progress:av,progressBar:sv,stepBody:iv,slideFwd:lv,slideBack:cv,owlMark:uv,heading:dv,lead:hv,note:fv,actions:pv,form:mv,keyRow:gv,keyGrow:vv,testRow:yv,healthLine:wv,mono:kv,okIcon:xv,errIcon:_v,errText:Cv,hintCenter:Sv,successCheck:jv,summary:Tv};function Ev(){return o.jsxs("svg",{viewBox:"0 0 48 48",className:ke.owlMark,fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"24",cy:"24",r:"17"}),o.jsx("circle",{cx:"17.5",cy:"21",r:"4.2"}),o.jsx("circle",{cx:"30.5",cy:"21",r:"4.2"}),o.jsx("circle",{cx:"17.5",cy:"21",r:"1.2",fill:"currentColor"}),o.jsx("circle",{cx:"30.5",cy:"21",r:"1.2",fill:"currentColor"}),o.jsx("path",{d:"M21 30.5 24 28l3 2.5"})]})}function Nv(){const a=sn(),{t:i}=Be(),c=Mn(),d=Yn(),h=p.useRef(c.client);h.current=c.client;const m=[i("onboarding.stepWelcome"),i("onboarding.stepConnect"),i("onboarding.stepDone")],[f,y]=p.useState(0),[k,N]=p.useState(1),[x,j]=p.useState(c.baseUrl),[A,H]=p.useState(""),[_,C]=p.useState(!1),[M,R]=p.useState(null),[L,I]=p.useState(null),[B,ue]=p.useState(!1),[q,pe]=p.useState(null),re=p.useRef(null),te=W=>{N(W>f?1:-1),y(W)};p.useEffect(()=>{var W;(W=re.current)==null||W.focus()},[f]);const oe=W=>(q==null?void 0:q.ok)===!0,xe=async W=>{W.preventDefault();const me=ol(x);R(me);const je=!c.apiKeySaved&&A.trim()===""?i("onboarding.keyRequired"):null;if(I(je),!(me||je)){ue(!0),pe(null);try{const _e=await ih(()=>h.current,()=>c.saveCredentials(x.trim(),A.trim()));pe(_e),_e.ok&&d.push({tone:"success",title:i("onboarding.testOkToast")})}catch(_e){pe({ok:!1,error:_e instanceof Error?_e.message:i("onboarding.testFailDefault")})}finally{ue(!1)}}},Z=k===1?ke.slideFwd:ke.slideBack;return o.jsxs("div",{className:ke.page,children:[o.jsx(Ug,{title:i("onboarding.title"),subtitle:i("onboarding.subtitle")}),o.jsx("ol",{className:ke.stepper,"aria-label":i("onboarding.stepperAria"),children:m.map((W,me)=>{const Ne=me<f,je=me===f;return o.jsxs("li",{className:`${ke.step} ${Ne?ke.done:""} ${je?ke.current:""}`,"aria-current":je?"step":void 0,children:[o.jsx("span",{className:ke.dot,"aria-hidden":"true",children:Ne?o.jsx(ve,{name:"check",size:14}):o.jsx("span",{children:me+1})}),o.jsx("span",{className:ke.stepLabel,children:W})]},W)})}),o.jsx("div",{className:ke.progress,"aria-hidden":"true",children:o.jsx("div",{className:ke.progressBar,style:{transform:`scaleX(${(f+1)/m.length})`}})}),o.jsxs("div",{className:`${ke.stepBody} ${Z}`,children:[f===0&&o.jsxs("section",{"aria-labelledby":"ob-welcome",children:[o.jsx(Ev,{}),o.jsx("h2",{id:"ob-welcome",ref:re,tabIndex:-1,className:ke.heading,children:i("onboarding.welcomeHeading")}),o.jsx("p",{className:ke.lead,children:i("onboarding.welcomeLead")}),c.apiKeySaved&&o.jsxs("p",{className:ke.note,children:[o.jsx(ve,{name:"info",size:14}),i("onboarding.existingNote")]}),o.jsxs("div",{className:ke.actions,children:[o.jsxs(fe,{variant:"primary",onClick:()=>te(1),size:"lg",children:[i("onboarding.start"),o.jsx(ve,{name:"chevron-right",size:18})]}),c.apiKeySaved&&o.jsx(fe,{variant:"ghost",onClick:()=>a("/"),children:i("onboarding.skipToApp")})]})]}),f===1&&o.jsxs("section",{"aria-labelledby":"ob-connect",children:[o.jsx("h2",{id:"ob-connect",ref:re,tabIndex:-1,className:ke.heading,children:i("onboarding.connectHeading")}),o.jsx("p",{className:ke.lead,children:i("onboarding.connectLead")}),o.jsxs("form",{onSubmit:W=>void xe(W),noValidate:!0,className:ke.form,children:[o.jsx(_t,{label:i("onboarding.urlLabel"),value:x,onChange:W=>{j(W.target.value),M&&R(null),q&&pe(null)},onBlur:()=>R(ol(x)),error:M??void 0,hint:i("onboarding.urlHint"),placeholder:"http://localhost:8787",inputMode:"url",autoComplete:"url"}),o.jsxs("div",{className:ke.keyRow,children:[o.jsx("div",{className:ke.keyGrow,children:o.jsx(_t,{label:c.apiKeySaved?i("onboarding.keyLabelExisting"):i("onboarding.keyLabel"),type:_?"text":"password",value:A,onChange:W=>{H(W.target.value),L&&I(null),q&&pe(null)},error:L??void 0,hint:i("onboarding.keyHint"),placeholder:i("onboarding.keyPlaceholder"),autoComplete:"off"})}),o.jsx(Xn,{icon:_?"eye-off":"eye","aria-label":i(_?"onboarding.hideKeyAria":"onboarding.showKeyAria"),onClick:()=>C(W=>!W)})]}),o.jsxs("div",{className:ke.testRow,children:[o.jsx(fe,{type:"submit",variant:"secondary",loading:B,children:i("onboarding.test")}),q&&o.jsx("span",{className:ke.healthLine,role:"status",children:q.ok?o.jsxs(o.Fragment,{children:[o.jsx(ve,{name:"check",size:16,className:ke.okIcon}),o.jsxs("code",{className:ke.mono,children:[i("onboarding.connectedOk"),q.version?` · v${q.version}`:"",typeof q.wireVersion=="number"?` · wire v${q.wireVersion}`:""]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ve,{name:"warn",size:16,className:ke.errIcon}),o.jsx("span",{className:ke.errText,children:q.error??i("onboarding.unreachable")})]})})]})]}),o.jsxs("div",{className:ke.actions,children:[o.jsxs(fe,{variant:"ghost",onClick:()=>te(0),children:[o.jsx(ve,{name:"arrow-left",size:18}),i("onboarding.back")]}),o.jsxs(fe,{variant:"primary",onClick:()=>te(2),disabled:!oe(),children:[i("onboarding.next"),o.jsx(ve,{name:"chevron-right",size:18})]})]}),!oe()&&o.jsx("p",{className:ke.hintCenter,children:i("onboarding.testFirstHint")})]}),f===2&&o.jsxs("section",{"aria-labelledby":"ob-done",children:[o.jsx("span",{className:ke.successCheck,"aria-hidden":"true",children:o.jsx(ve,{name:"check",size:26})}),o.jsx("h2",{id:"ob-done",ref:re,tabIndex:-1,className:ke.heading,children:i("onboarding.doneHeading")}),o.jsxs("dl",{className:ke.summary,children:[o.jsxs("div",{children:[o.jsx("dt",{children:i("onboarding.summaryUrl")}),o.jsx("dd",{className:ke.mono,children:x.trim()===""?i("onboarding.sameOrigin"):x.trim()})]}),o.jsxs("div",{children:[o.jsx("dt",{children:i("onboarding.summaryKey")}),o.jsx("dd",{className:ke.mono,children:i("onboarding.summaryKeySaved")})]}),(q==null?void 0:q.version)&&o.jsxs("div",{children:[o.jsx("dt",{children:i("onboarding.summaryVersion")}),o.jsxs("dd",{className:ke.mono,children:["v",q.version,typeof q.wireVersion=="number"&&` · wire v${q.wireVersion}`]})]})]}),o.jsxs("div",{className:ke.actions,children:[o.jsxs(fe,{variant:"ghost",onClick:()=>te(1),children:[o.jsx(ve,{name:"arrow-left",size:18}),i("onboarding.back")]}),o.jsxs(fe,{variant:"primary",size:"lg",onClick:()=>a("/"),children:[i("onboarding.enterApp"),o.jsx(ve,{name:"chevron-right",size:18})]})]})]})]},f)]})}const lh="boombot.theme",ch="(prefers-color-scheme: dark)";function bv(){try{const a=localStorage.getItem(lh);if(a==="dark"||a==="light"||a==="system")return a}catch{}return"dark"}function Lv(){return typeof window<"u"&&window.matchMedia(ch).matches}const uh=p.createContext(null);function Mv(){const a=p.useContext(uh);if(!a)throw new Error("useTheme phải dùng trong <ThemeProvider>");return a}function Rv({children:a}){const[i,c]=p.useState(bv),[d,h]=p.useState(Lv);p.useEffect(()=>{const k=window.matchMedia(ch),N=x=>{h(x.matches)};return k.addEventListener("change",N),()=>k.removeEventListener("change",N)},[]);const m=i==="system"?d?"dark":"light":i;p.useEffect(()=>{document.documentElement.dataset.theme=m},[m]);const f=p.useCallback(k=>{c(k);try{localStorage.setItem(lh,k)}catch{}},[]),y=p.useMemo(()=>({mode:i,setMode:f,resolved:m}),[i,f,m]);return o.jsx(uh.Provider,{value:y,children:a})}function Pv(a,i){try{return localStorage.getItem(a)??i}catch{return i}}function Av(a,i){try{localStorage.setItem(a,i)}catch{}}const jo={density:"boombot.uiDensity",motion:"boombot.motion",chatFont:"boombot.chatFont",transcriptWidth:"boombot.transcriptWidth"},To={density:"comfortable",motion:"system",chatFont:"sans",transcriptWidth:"medium"},Iv=["comfortable","compact"],Dv=["sans","system","mono"],Ov=["narrow","medium","wide"],Fv=["system","reduced"];function Wa(a,i,c){const d=Pv(a,c);return i.includes(d)?d:c}function zv(){return{density:Wa(jo.density,Iv,To.density),motion:Wa(jo.motion,Fv,To.motion),chatFont:Wa(jo.chatFont,Dv,To.chatFont),transcriptWidth:Wa(jo.transcriptWidth,Ov,To.transcriptWidth)}}const Bv={...To,set:()=>{}},dh=p.createContext(Bv);function hh(){return p.useContext(dh)}function Kv({children:a}){const[i,c]=p.useState(zv),d=p.useCallback((m,f)=>{Av(jo[m],String(f)),c(y=>({...y,[m]:f}))},[]);p.useEffect(()=>{document.documentElement.dataset.uiDensity=i.density},[i.density]),p.useEffect(()=>{document.documentElement.dataset.chatFont=i.chatFont},[i.chatFont]),p.useEffect(()=>{document.documentElement.dataset.transcriptWidth=i.transcriptWidth},[i.transcriptWidth]),p.useEffect(()=>{const m=document.documentElement;i.motion==="reduced"?m.dataset.motion="reduced":delete m.dataset.motion},[i.motion]);const h=p.useMemo(()=>({...i,set:d}),[i,d]);return o.jsx(dh.Provider,{value:h,children:o.jsx(pg,{value:i.motion,children:a})})}const Hv="_page_granl_10",Uv="_card_granl_38",$v="_sectionHead_granl_61",Vv="_sectionIcon_granl_67",Wv="_sectionTitle_granl_79",Gv="_sectionHint_granl_86",qv="_paneHeader_granl_95",Qv="_paneTitle_granl_99",Xv="_paneSubtitle_granl_106",Yv="_statusRow_granl_115",Zv="_connError_granl_122",Jv="_fieldGrow_granl_133",e0="_keyFieldRow_granl_138",t0="_urlRow_granl_152",n0="_urlHint_granl_164",r0="_actions_granl_171",o0="_savedKeyRow_granl_182",a0="_maskedKey_granl_198",s0="_prefRow_granl_206",i0="_prefText_granl_220",l0="_prefLabel_granl_227",c0="_prefHint_granl_233",u0="_settingRow_granl_243",d0="_settingMain_granl_267",h0="_settingLabel_granl_274",f0="_settingHint_granl_288",p0="_settingControl_granl_294",m0="_serverGrid_granl_304",g0="_serverKey_granl_315",v0="_serverValue_granl_320",y0="_serverSnippet_granl_328",w0="_testResult_granl_349",k0="_mono_granl_358",x0="_testError_granl_364",_0="_footnote_granl_372",C0="_modalText_granl_394",ce={page:Hv,card:Uv,sectionHead:$v,sectionIcon:Vv,sectionTitle:Wv,sectionHint:Gv,paneHeader:qv,paneTitle:Qv,paneSubtitle:Xv,statusRow:Yv,connError:Zv,fieldGrow:Jv,keyFieldRow:e0,urlRow:t0,urlHint:n0,actions:r0,savedKeyRow:o0,maskedKey:a0,prefRow:s0,prefText:i0,prefLabel:l0,prefHint:c0,settingRow:u0,settingMain:d0,settingLabel:h0,settingHint:f0,settingControl:p0,serverGrid:m0,serverKey:g0,serverValue:v0,serverSnippet:y0,testResult:w0,mono:k0,testError:x0,footnote:_0,modalText:C0},S0="~/.boombot/config.json";function Lt({label:a,hint:i,children:c,status:d="real"}){const{t:h}=Be();return o.jsxs("div",{className:ce.settingRow,"data-status":d,children:[o.jsxs("div",{className:ce.settingMain,children:[o.jsxs("span",{className:ce.settingLabel,children:[a,d==="soon"&&o.jsx(gt,{tone:"muted",children:h("settings.statusSoon")})]}),i!==void 0&&o.jsx("span",{className:ce.settingHint,children:i})]}),c!==void 0&&o.jsx("div",{className:ce.settingControl,children:c})]})}function Xi({label:a,hint:i,envKey:c,configPath:d,allowed:h,defaultValue:m,snippet:f}){const{t:y}=Be(),k=Yn(),N=()=>{const x=typeof navigator>"u"?void 0:navigator.clipboard;if(typeof(x==null?void 0:x.writeText)!="function"){k.push({tone:"warn",title:y("settings.serverCopyFail")});return}x.writeText(f).then(()=>k.push({tone:"success",title:y("settings.serverCopiedToast")}),()=>k.push({tone:"warn",title:y("settings.serverCopyFail")}))};return o.jsxs("div",{className:ce.settingRow,"data-status":"server",children:[o.jsxs("div",{className:ce.settingMain,children:[o.jsxs("span",{className:ce.settingLabel,children:[a,o.jsx(gt,{tone:"info",children:y("settings.statusServer")})]}),i!==void 0&&o.jsx("span",{className:ce.settingHint,children:i})]}),o.jsxs("div",{className:ce.serverGrid,children:[o.jsx("span",{className:ce.serverKey,children:y("settings.serverEnvLabel")}),o.jsx("code",{className:ce.serverValue,children:c}),d!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:ce.serverKey,children:y("settings.serverConfigLabel")}),o.jsx("code",{className:ce.serverValue,children:d})]}),o.jsx("span",{className:ce.serverKey,children:y("settings.serverFileLabel")}),o.jsx("code",{className:ce.serverValue,children:S0}),h!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:ce.serverKey,children:y("settings.serverAllowedLabel")}),o.jsx("code",{className:ce.serverValue,children:h.join(" | ")})]}),o.jsx("span",{className:ce.serverKey,children:y("settings.serverDefaultLabel")}),o.jsx("code",{className:ce.serverValue,children:m})]}),o.jsxs("div",{className:ce.serverSnippet,children:[o.jsx("code",{children:f}),o.jsx(Xn,{icon:"copy","aria-label":`${y("settings.serverCopy")}: ${a}`,onClick:N})]}),o.jsxs("p",{className:ce.footnote,children:[o.jsx(ve,{name:"info",size:14}),y("settings.serverRestartNote")]})]})}function Mt({icon:a,title:i,hint:c,children:d}){const h=i!==void 0||c!==void 0;return o.jsxs("section",{className:ce.card,children:[h&&o.jsxs("div",{className:ce.sectionHead,children:[a!==void 0&&o.jsx("span",{className:ce.sectionIcon,children:o.jsx(ve,{name:a,size:18})}),o.jsxs("div",{children:[i!==void 0&&o.jsx("h2",{className:ce.sectionTitle,children:i}),c!==void 0&&o.jsx("p",{className:ce.sectionHint,children:c})]})]}),d]})}function j0(){const{t:a}=Be(),{mode:i,setMode:c}=Mv(),{density:d,motion:h,chatFont:m,set:f}=hh(),y=[{value:"dark",label:a("settings.themeDark"),icon:"moon"},{value:"light",label:a("settings.themeLight"),icon:"sun"},{value:"system",label:a("settings.themeSystem"),icon:"monitor"}],k=[{value:"comfortable",label:a("settings.densityComfortable")},{value:"compact",label:a("settings.densityCompact")}],N=[{value:"system",label:a("settings.motionSystem")},{value:"reduced",label:a("settings.motionReduced")}],x=[{value:"sans",label:a("settings.fontSans")},{value:"system",label:a("settings.fontSystem")},{value:"mono",label:a("settings.fontMono")}];return o.jsx("div",{children:o.jsxs(Mt,{children:[o.jsx(Lt,{label:a("settings.themeLabel"),hint:a("settings.themeHint"),children:o.jsx(Bt,{ariaLabel:a("settings.themeLabel"),iconOnly:!0,options:y,value:i,onChange:c})}),o.jsx(Lt,{label:a("settings.densityLabel"),hint:a("settings.densityHint"),children:o.jsx(Bt,{ariaLabel:a("settings.densityAria"),options:k,value:d,onChange:j=>f("density",j)})}),o.jsx(Lt,{label:a("settings.fontLabel"),hint:a("settings.fontHint"),children:o.jsx(Bt,{ariaLabel:a("settings.fontLabel"),options:x,value:m,onChange:j=>f("chatFont",j)})}),o.jsx(Lt,{label:a("settings.motionLabel"),hint:a("settings.motionHint"),children:o.jsx(Bt,{ariaLabel:a("settings.motionLabel"),options:N,value:h,onChange:j=>f("motion",j)})})]})})}function T0(){const{t:a}=Be(),{chatFont:i,transcriptWidth:c,set:d}=hh(),h=[{value:"sans",label:a("settings.fontSans")},{value:"system",label:a("settings.fontSystem")},{value:"mono",label:a("settings.fontMono")}],m=[{value:"narrow",label:a("settings.widthNarrow")},{value:"medium",label:a("settings.widthMedium")},{value:"wide",label:a("settings.widthWide")}];return o.jsx("div",{children:o.jsxs(Mt,{icon:"chat",title:a("settings.sectionChat"),hint:a("settings.sectionChatHint"),children:[o.jsx(Lt,{label:a("settings.chatFontLabel"),hint:a("settings.chatFontHint"),children:o.jsx(Bt,{ariaLabel:a("settings.chatFontLabel"),options:h,value:i,onChange:f=>d("chatFont",f)})}),o.jsx(Lt,{label:a("settings.transcriptWidthLabel"),hint:a("settings.transcriptWidthHint"),children:o.jsx(Bt,{ariaLabel:a("settings.transcriptWidthLabel"),options:m,value:c,onChange:f=>d("transcriptWidth",f)})})]})})}const E0="_enterStagger_s1e1t_23",N0="_sectionActions_s1e1t_29",b0="_grid_s1e1t_36",L0="_card_s1e1t_42",M0="_cardHead_s1e1t_49",R0="_brandMark_s1e1t_56",P0="_cardTitle_s1e1t_68",A0="_kind_s1e1t_81",I0="_blurb_s1e1t_87",D0="_cardActions_s1e1t_95",O0="_skeletonCard_s1e1t_105",F0="_centerRow_s1e1t_112",z0="_inlineError_s1e1t_127",B0="_pairBody_s1e1t_142",K0="_codeRow_s1e1t_148",H0="_pairCode_s1e1t_159",U0="_steps_s1e1t_168",$0="_stepNum_s1e1t_183",V0="_pollStatus_s1e1t_211",W0="_linkButton_s1e1t_231",G0="_successCheck_s1e1t_246",q0="_connectForm_s1e1t_259",Q0="_oauthWaiting_s1e1t_260",X0="_callbackUrl_s1e1t_273",Y0="_connectWarning_s1e1t_277",Z0="_connectActions_s1e1t_286",J0="_connectError_s1e1t_292",ey="_qrCode_s1e1t_301",ty="_unpairBody_s1e1t_311",ny="_brandContainer_s1e1t_351",ry="_brandGlow_s1e1t_377",oy="_cardConnected_s1e1t_393",we={enterStagger:E0,sectionActions:N0,grid:b0,card:L0,cardHead:M0,brandMark:R0,cardTitle:P0,kind:A0,blurb:I0,cardActions:D0,skeletonCard:O0,centerRow:F0,inlineError:z0,pairBody:B0,codeRow:K0,pairCode:H0,steps:U0,stepNum:$0,pollStatus:V0,linkButton:W0,successCheck:G0,connectForm:q0,oauthWaiting:Q0,callbackUrl:X0,connectWarning:Y0,connectActions:Z0,connectError:J0,qrCode:ey,unpairBody:ty,brandContainer:ny,brandGlow:ry,cardConnected:oy},ay={telegram:"channels.blurbTelegram",whatsapp:"channels.blurbWhatsapp",discord:"channels.blurbDiscord",slack:"channels.blurbSlack",zalo:"channels.blurbZalo"},Rd=["telegram","zalo","whatsapp","discord","slack","messenger","tiktok"];function sy(a,i){switch(a.status){case"connected":return{tone:"accent",label:i("channels.statusConnected")};case"pending":return{tone:"warn",label:i("channels.statusPending")};case"error":return{tone:"danger",label:i("channels.statusError")};default:return{tone:"muted",label:a.configured?i("channels.statusConfigured"):i("channels.statusNotConfigured")}}}const Pd=3e3,iy=100;function ly(){const a=sn(),{t:i}=Be(),{client:c}=Mn(),d=Yn(),[h,m]=p.useState(null),[f,y]=p.useState(!0),[k,N]=p.useState(null),[x,j]=p.useState(null),[A,H]=p.useState(!1),[_,C]=p.useState(null),[M,R]=p.useState(!1),[L,I]=p.useState(0),[B,ue]=p.useState(null),[q,pe]=p.useState(""),[re,te]=p.useState(null),[oe,xe]=p.useState(!1),[Z,W]=p.useState(null),[me,Ne]=p.useState(""),[je,_e]=p.useState(""),[$,ae]=p.useState(""),[V,S]=p.useState("oa"),[D,P]=p.useState(!1),[U,X]=p.useState(null),[he,Ce]=p.useState(null),[ge,be]=p.useState(null),[Ve,Rn]=p.useState(!1),Pr=p.useRef(null);Pr.current=x;const Ze=p.useCallback(async()=>{if(!c){y(!1);return}y(!0),N(null);try{const Se=[...await c.channelsList()].sort((Me,Ct)=>{const vt=Rd.indexOf(Me.kind),at=Rd.indexOf(Ct.kind);return(vt===-1?99:vt)-(at===-1?99:at)});m(Se)}catch(ne){N(ne instanceof Error?ne.message:i("channels.loadError"))}finally{y(!1)}},[c,i]);p.useEffect(()=>{Ze()},[Ze]);const Kt=p.useCallback(async ne=>{if(c){C(null),R(!1),I(0),H(!0);try{const{code:Se}=await c.channelsPair(ne.kind);j({channel:ne,code:Se,startedAt:Date.now(),done:!1})}catch(Se){C(Se instanceof Error?Se.message:i("channels.pairCreateError"))}finally{H(!1)}}},[c,i]),Zn=p.useCallback(()=>{j(null),C(null),R(!1),H(!1)},[]);p.useEffect(()=>{if(!x||x.done)return;const ne=window.setInterval(()=>{I(Math.floor((Date.now()-x.startedAt)/1e3))},1e3);return()=>window.clearInterval(ne)},[x]),p.useEffect(()=>{if(!x||x.done||!c)return;let ne=0,Se=!1;const Me=window.setInterval(async()=>{ne+=1;try{const Ct=await c.channelsList();if(Se)return;const vt=Ct.find(at=>at.id===x.channel.id);vt&&vt.status==="connected"?(window.clearInterval(Me),j(at=>at&&{...at,done:!0}),d.push({tone:"success",title:i("channels.pairedToast",{name:x.channel.name})}),Ze()):ne>=iy&&(window.clearInterval(Me),Se||R(!0))}catch{}},Pd);return()=>{Se=!0,window.clearInterval(Me)}},[x,c,Ze,d,i]);const Ro=p.useCallback(async()=>{var Se;const ne=(Se=Pr.current)==null?void 0:Se.code;if(ne)try{await navigator.clipboard.writeText(ne),d.push({tone:"success",title:i("channels.copiedToast")})}catch{const Me=document.createElement("textarea");Me.value=ne,document.body.appendChild(Me),Me.select();try{document.execCommand("copy"),d.push({tone:"success",title:i("channels.copiedToast")})}catch{d.push({tone:"error",title:i("channels.copyFailToast")})}document.body.removeChild(Me)}},[d,i]),Ar=p.useCallback(ne=>{W(ne),Ne(""),_e(""),ae(""),S("oa"),X(null),Ce(null),be(null),Rn(!1)},[]),Jn=p.useCallback(()=>{D||(W(null),Ce(null),be(null),X(null))},[D]),er=p.useCallback(async(ne="web")=>{if(!c||!Z)return;X(null),P(!0);let Se=null;Z.kind==="zalo"&&V==="oa"&&ne==="web"&&(Se=window.open("about:blank","boombot-zalo-oauth","popup,width=520,height=720"));try{const Me=Z.kind==="telegram"?await c.channelsConnect({channel:"telegram",botToken:me.trim()}):await c.channelsConnect(V==="personal"?{channel:"zalo",mode:"personal"}:{channel:"zalo",mode:"oa",appId:je.trim()||void 0,appSecret:$.trim()||void 0,redirectUri:new URL("/v1/channels/zalo/oauth/callback",c.baseUrl||window.location.origin).toString()});if(Me.status==="connected"){W(null),await Ze(),Z.kind==="telegram"&&await Kt(Z);return}if(Me.status==="qr_required"){Se==null||Se.close(),be(Me.qrDataUrl);return}if(Ce(Me.authorizationUrl),ne==="web"&&Se)Se.location.href=Me.authorizationUrl;else if(ne==="qr"){const{default:Ct}=await Lr(async()=>{const{default:vt}=await import("./browser-Bnt73-Ub.js").then(at=>at.b);return{default:vt}},[]);be(await Ct.toDataURL(Me.authorizationUrl,{width:240,margin:1}))}}catch(Me){Se==null||Se.close(),X(Me instanceof Error?Me.message:i("channels.connectFail"))}finally{P(!1)}},[me,c,Z,Ze,Kt,i,je,$,V]);p.useEffect(()=>{if(!he&&!ge||!Z||!c||Ve)return;const ne=window.setInterval(async()=>{try{const Se=(await c.channelsList()).find(Me=>Me.kind===Z.kind);if((Se==null?void 0:Se.status)!=="connected")return;window.clearInterval(ne),Rn(!0),d.push({tone:"success",title:i("channels.connectedToast",{name:Z.name})}),Ze(),Z.kind==="zalo"&&V==="personal"&&(W(null),Kt(Z))}catch{}},Pd);return()=>window.clearInterval(ne)},[he,c,Ve,Z,Ze,Kt,ge,i,d,V]);const Pn=p.useCallback(ne=>{ue(ne),pe(""),te(null)},[]),Qt=p.useCallback(()=>{oe||(ue(null),pe(""),te(null))},[oe]),Ir=p.useCallback(async()=>{if(!B||!c)return;const ne=q.trim();if(ne===""){te(i("channels.unpairRequired"));return}xe(!0),te(null);try{await c.channelsUnpair(B.kind,ne),d.push({tone:"success",title:i("channels.unpairedToast",{name:B.name})}),ue(null),pe(""),Ze()}catch(Se){te(Se instanceof Error?Se.message:i("channels.unpairFailDefault"))}finally{xe(!1)}},[c,B,q,d,Ze,i]);return c?o.jsxs(Mt,{icon:"channels",title:i("settings.sectionChannels"),hint:i("settings.sectionChannelsHint"),children:[o.jsx("div",{className:we.sectionActions,children:o.jsx(fe,{variant:"secondary",onClick:()=>void Ze(),disabled:f,children:i("channels.reload")})}),f&&o.jsx("div",{className:we.grid,"aria-busy":"true","aria-label":i("channels.loadingAria"),children:[0,1,2,3].map(ne=>o.jsx(Eo,{variant:"rect",className:we.skeletonCard},ne))}),k&&!f&&o.jsx(Nr,{icon:"warn",title:i("channels.loadErrorTitle"),message:k,action:o.jsx(fe,{variant:"secondary",onClick:()=>void Ze(),children:i("channels.reload")})}),h&&!f&&!k&&o.jsx("div",{className:we.grid,children:h.map((ne,Se)=>{const Me=sy(ne,i),Ct=ne.status==="connected",vt=ne.status==="pending";return o.jsxs(sg,{className:`${we.card} ${we.enterStagger} ${Ct?we.cardConnected:""}`,style:{"--i":Math.min(Se,7)},children:[o.jsxs("div",{className:we.cardHead,children:[o.jsxs("div",{className:we.brandContainer,children:[o.jsx("div",{className:we.brandGlow,style:{backgroundColor:`var(--brand-${ne.kind}, var(--color-accent))`}}),o.jsx("span",{className:we.brandMark,children:o.jsx(Jm,{kind:ne.kind,size:28})})]}),o.jsxs("div",{className:we.cardTitle,children:[o.jsx("h2",{children:ne.name}),o.jsx("span",{className:we.kind,children:ne.kind})]}),o.jsxs(gt,{tone:Me.tone,children:[o.jsx("span",{className:vt?"status-dot status-dot--pulse":"status-dot","aria-hidden":"true"}),Me.label]})]}),o.jsx("p",{className:we.blurb,children:i(ay[ne.kind]??"channels.blurbGeneric")}),o.jsx("div",{className:we.cardActions,children:Ct&&ne.kind==="telegram"?o.jsx(fe,{variant:"secondary",onClick:()=>Pn(ne),children:i("channels.unpairBtn")}):Ct?null:ne.kind==="telegram"||ne.kind==="zalo"?o.jsx(fe,{variant:"primary",onClick:()=>Ar(ne),children:i("channels.connectBtn")}):o.jsx(fe,{variant:"secondary",disabled:!0,children:i("channels.serverConfigBtn")})})]},ne.id)})}),o.jsxs(Qn,{open:Z!==null,onClose:Jn,title:Z?i("channels.connectModalTitle",{name:Z.name}):i("channels.connectBtn"),footer:o.jsx(fe,{variant:"ghost",onClick:Jn,disabled:D,children:i("channels.close")}),children:[Z&&!he&&!ge&&!Ve&&o.jsxs("form",{className:we.connectForm,onSubmit:ne=>{ne.preventDefault(),er("web")},children:[Z.kind==="telegram"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:i("channels.telegramConnectHelp")}),o.jsx("a",{href:"https://t.me/BotFather",target:"_blank",rel:"noreferrer",children:i("channels.openBotFather")}),o.jsx(_t,{label:i("channels.botTokenLabel"),type:"password",value:me,onChange:ne=>Ne(ne.target.value),autoComplete:"off",required:!0}),o.jsx(fe,{type:"submit",variant:"primary",loading:D,disabled:me.trim()==="",children:i("channels.connectBtn")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Bt,{ariaLabel:i("channels.zaloModeLabel"),value:V,onChange:S,options:[{value:"oa",label:i("channels.zaloModeOa")},{value:"personal",label:i("channels.zaloModePersonal")}]}),V==="oa"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:i("channels.zaloConnectHelp")}),o.jsxs("p",{children:[i("channels.zaloCallbackLabel")," ",o.jsx("code",{className:we.callbackUrl,children:new URL("/v1/channels/zalo/oauth/callback",c.baseUrl||window.location.origin).toString()})]}),o.jsx(_t,{label:i("channels.zaloAppIdLabel"),value:je,onChange:ne=>_e(ne.target.value),autoComplete:"off"}),o.jsx(_t,{label:i("channels.zaloAppSecretLabel"),type:"password",value:$,onChange:ne=>ae(ne.target.value),autoComplete:"off"}),o.jsxs("div",{className:we.connectActions,children:[o.jsx(fe,{type:"submit",variant:"primary",loading:D,children:i("channels.connectWebBtn")}),o.jsx(fe,{variant:"secondary",onClick:()=>void er("qr"),disabled:D,children:i("channels.showQrBtn")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:we.connectWarning,children:i("channels.zaloPersonalWarning")}),o.jsx(fe,{type:"submit",variant:"primary",loading:D,children:i("channels.zaloPersonalQrBtn")})]})]}),U&&o.jsx("p",{className:we.connectError,role:"alert",children:U})]}),Z&&(he||ge)&&!Ve&&o.jsxs("div",{className:we.oauthWaiting,role:"status","aria-live":"polite",children:[ge&&o.jsx("img",{className:we.qrCode,src:ge,alt:i(V==="personal"?"channels.personalQrAlt":"channels.qrAlt")}),o.jsx(Ga,{}),o.jsx("p",{children:i("channels.oauthWaiting")}),he&&o.jsx("a",{href:he,target:"_blank",rel:"noreferrer",children:i("channels.openZaloAuth")})]}),Z&&Ve&&o.jsxs("div",{className:we.centerRow,role:"status",children:[o.jsx("span",{className:we.successCheck,children:o.jsx(ve,{name:"check",size:22})}),o.jsx("p",{children:i("channels.connectedToast",{name:Z.name})}),o.jsx(fe,{variant:"primary",onClick:Jn,children:i("channels.done")})]})]}),o.jsxs(Qn,{open:x!==null,onClose:Zn,title:x?i("channels.pairModalTitle",{name:x.channel.name}):i("channels.pairModalGeneric"),footer:x&&!x.done?o.jsx(fe,{variant:"ghost",onClick:Zn,children:i("channels.close")}):void 0,children:[A&&o.jsxs("div",{className:we.centerRow,role:"status",children:[o.jsx(Ga,{}),o.jsx("p",{children:i("channels.creatingCode")})]}),_&&!A&&o.jsxs("div",{className:we.inlineError,role:"alert",children:[o.jsx(ve,{name:"warn",size:18}),o.jsx("p",{children:_}),x&&o.jsx(fe,{variant:"secondary",onClick:()=>void Kt(x.channel),children:i("channels.retry")})]}),x&&!A&&!_&&!x.done&&o.jsxs("div",{className:we.pairBody,children:[o.jsxs("div",{className:we.codeRow,children:[o.jsx("code",{className:we.pairCode,"aria-label":i("channels.codeAria",{code:x.code}),children:x.code}),o.jsx(Xn,{icon:"copy","aria-label":i("channels.copyAria"),onClick:()=>void Ro()})]}),o.jsxs("ol",{className:we.steps,children:[o.jsxs("li",{children:[o.jsx("span",{className:we.stepNum,children:"1"}),o.jsx("p",{children:i("channels.step1",{name:x.channel.name})})]}),o.jsxs("li",{children:[o.jsx("span",{className:we.stepNum,children:"2"}),o.jsxs("p",{children:[i("channels.step2Before")," ",o.jsx("code",{children:x.code})," ",i("channels.step2After")," ",o.jsx("em",{children:i("channels.step2Em")})," ",i("channels.step2Tail")]})]}),o.jsxs("li",{children:[o.jsx("span",{className:we.stepNum,children:"3"}),o.jsx("p",{children:i("channels.step3")})]})]}),o.jsx("div",{className:we.pollStatus,role:"status","aria-live":"polite",children:M?o.jsxs(o.Fragment,{children:[o.jsx(ve,{name:"warn",size:18}),o.jsxs("p",{children:[i("channels.expiredMessage")," ",o.jsx("button",{type:"button",className:we.linkButton,onClick:()=>void Kt(x.channel),children:i("channels.newCode")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ga,{}),o.jsxs("p",{children:[i("channels.waiting"),L>0&&` (${L}s)`]})]})})]}),x&&x.done&&o.jsxs("div",{className:we.centerRow,role:"status",children:[o.jsx("span",{className:we.successCheck,children:o.jsx(ve,{name:"check",size:22})}),o.jsx("p",{children:i("channels.successMessage",{name:x.channel.name})}),o.jsx(fe,{variant:"primary",onClick:Zn,children:i("channels.done")})]})]}),o.jsx(Qn,{open:B!==null,onClose:Qt,title:B?i("channels.unpairModalTitle",{name:B.name}):i("channels.unpairModalGeneric"),footer:o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",onClick:Qt,disabled:oe,children:i("channels.cancelBtn")}),o.jsx(fe,{variant:"danger",onClick:()=>void Ir(),loading:oe,children:i("channels.unpairBtn")})]}),children:B&&o.jsxs("div",{className:we.unpairBody,children:[o.jsx("p",{children:i("channels.unpairBody",{name:B.name})}),o.jsx(_t,{label:i("channels.unpairInputLabel"),value:q,onChange:ne=>{pe(ne.target.value),re&&te(null)},error:re??void 0,hint:i("channels.unpairInputHint"),placeholder:i("channels.unpairInputPh"),inputMode:"numeric",autoComplete:"off"})]})})]}):o.jsx(Mt,{icon:"channels",title:i("settings.sectionChannels"),hint:i("settings.sectionChannelsHint"),children:o.jsx(Nr,{icon:"wifi-off",title:i("channels.notConnectedTitle"),message:i("channels.notConnectedMessage"),action:o.jsx(fe,{variant:"primary",onClick:()=>a("/welcome"),children:i("channels.gotoOnboarding")})})})}const cy="_bar_1h70m_10",uy="_list_1h70m_18",dy="_row_1h70m_23",hy="_info_1h70m_38",fy="_titleRow_1h70m_46",py="_title_1h70m_46",my="_meta_1h70m_61",gy="_mono_1h70m_69",vy="_errorText_1h70m_75",yy="_testResult_1h70m_81",wy="_rowActions_1h70m_89",ky="_skeletons_1h70m_97",xy="_form_1h70m_105",_y="_passwordWrap_1h70m_111",Cy="_passwordToggle_1h70m_115",Sy="_formActions_1h70m_137",jy="_deleteWarn_1h70m_143",Ty="_rowActive_1h70m_198",Ey="_providerLogoBox_1h70m_206",qe={bar:cy,list:uy,row:dy,info:hy,titleRow:fy,title:py,meta:my,mono:gy,errorText:vy,testResult:yy,rowActions:wy,skeletons:ky,form:xy,passwordWrap:_y,passwordToggle:Cy,formActions:Sy,deleteWarn:jy,rowActive:Ty,providerLogoBox:Ey},Yi={openai:"providers.kindOpenai",anthropic:"providers.kindAnthropic",google:"providers.kindGoogle",mistral:"providers.kindMistral",xai:"providers.kindXai",deepseek:"providers.kindDeepseek","openai-compatible":"providers.kindOpenaiCompatible",local:"providers.kindLocal"},Ad={name:"",kind:"openai",baseUrl:"",apiKey:"",model:""};function Ny(){const a=sn(),{t:i}=Be(),{client:c,connected:d}=Mn(),h=Yn(),[m,f]=p.useState([]),[y,k]=p.useState(!0),[N,x]=p.useState(null),[j,A]=p.useState({}),[H,_]=p.useState(!1),[C,M]=p.useState(null),[R,L]=p.useState(Ad),[I,B]=p.useState({}),[ue,q]=p.useState(!1),[pe,re]=p.useState(!1),[te,oe]=p.useState(null),[xe,Z]=p.useState(""),[W,me]=p.useState(!1),Ne=p.useCallback(async()=>{if(c){k(!0),x(null);try{f(await c.providersList())}catch(P){x(P instanceof Error?P.message:i("providers.loadError"))}finally{k(!1)}}},[c,i]);p.useEffect(()=>{Ne()},[Ne]);const je=()=>{M(null),L(Ad),B({}),re(!1),_(!0)},_e=P=>{var U;M(P),L({name:P.name,kind:P.kind,baseUrl:P.baseUrl??"",apiKey:"",model:P.model??((U=P.models)==null?void 0:U[0])??""}),B({}),re(!1),_(!0)},$=p.useCallback(()=>{const P={};R.name.trim()||(P.name=i("providers.nameRequired"));const U=R.baseUrl.trim();if(!U&&(R.kind==="openai-compatible"||R.kind==="local"))P.baseUrl=i("providers.urlRequired");else if(U)try{const X=new URL(U);X.protocol!=="http:"&&X.protocol!=="https:"&&(P.baseUrl=i("providers.urlProtocol"))}catch{P.baseUrl=i("providers.urlInvalid")}return R.kind!=="local"&&!R.apiKey&&!(C!=null&&C.hasKey)&&(P.apiKey=i("providers.keyRequired")),R.model.trim()||(P.model=i("providers.modelRequired")),P},[C,R,i]),ae=async P=>{P.preventDefault();const U=$();if(B(U),!(Object.keys(U).length>0)&&c){q(!0);try{const X={id:C==null?void 0:C.id,name:R.name.trim(),kind:R.kind,baseUrl:R.baseUrl.trim()||void 0,model:R.model.trim()||void 0,apiKey:R.apiKey||void 0};await c.providersSave(X),await Ne(),_(!1),h.push({tone:"success",title:i(C?"providers.savedToast":"providers.addedToast")})}catch(X){h.push({tone:"error",title:i("providers.saveFailToast"),message:X instanceof Error?X.message:void 0})}finally{q(!1)}}},V=async P=>{var U;if(!(!c||((U=j[P.id])==null?void 0:U.status)==="pending")){A(X=>({...X,[P.id]:{status:"pending"}}));try{const X=await c.providersTest(P.id);A(he=>({...he,[P.id]:{status:"done",result:X}})),X.ok?h.push({tone:"success",title:i("providers.testOkToast",{ms:X.latencyMs})}):h.push({tone:"error",title:i("providers.testFailToast"),message:X.error??i("providers.testFailReason")})}catch(X){const he={ok:!1,latencyMs:0,error:X instanceof Error?X.message:i("providers.unknownError")};A(Ce=>({...Ce,[P.id]:{status:"done",result:he}})),h.push({tone:"error",title:i("providers.testFailToast")})}}},S=async P=>{if(c)try{P.active?(await c.providersDeactivate(P.id),f(U=>U.map(X=>X.id===P.id?{...X,active:!1}:X)),h.push({tone:"success",title:i("providers.deactivatedToast",{name:P.name})})):(await c.providersActivate(P.id),f(U=>U.map(X=>({...X,active:X.id===P.id}))),h.push({tone:"success",title:i("providers.activatedToast",{name:P.name})}))}catch(U){h.push({tone:"error",title:i("providers.toggleFailToast"),message:U instanceof Error?U.message:void 0})}},D=async()=>{if(!(!c||!te)){me(!0);try{await c.providersDelete(te.id),f(P=>P.filter(U=>U.id!==te.id)),oe(null),Z(""),h.push({tone:"success",title:i("providers.deletedToast",{name:te.name})})}catch(P){h.push({tone:"error",title:i("providers.deleteFailToast"),message:P instanceof Error?P.message:void 0})}finally{me(!1)}}};return d?o.jsxs(Mt,{icon:"cpu",title:i("providers.title"),hint:i("providers.subtitle"),children:[o.jsxs("div",{className:qe.bar,children:[o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void Ne(),disabled:y,children:i("providers.reload")}),o.jsx(fe,{variant:"primary",size:"sm",onClick:je,children:i("providers.add")})]}),y&&o.jsx("div",{className:qe.skeletons,"aria-busy":"true","aria-label":i("providers.loadingAria"),children:[0,1].map(P=>o.jsx(Eo,{variant:"rect",height:44},P))}),!y&&N&&o.jsx(Nr,{icon:"warn",title:i("providers.loadErrorTitle"),message:N,action:o.jsx(fe,{variant:"secondary",onClick:()=>void Ne(),children:i("providers.retry")})}),!y&&!N&&m.length===0&&o.jsx(Nr,{icon:"cpu",title:i("providers.emptyTitle"),message:i("providers.emptyMessage"),action:o.jsx(fe,{variant:"primary",onClick:je,children:i("providers.addEmptyCta")})}),!y&&!N&&m.length>0&&o.jsx("div",{className:qe.list,children:m.map(P=>{var X,he,Ce,ge;const U=j[P.id];return o.jsxs("article",{className:`${qe.row} ${P.active?qe.rowActive:""}`,children:[o.jsx("div",{className:qe.providerLogoBox,children:o.jsx(f1,{kind:P.kind,size:26})}),o.jsxs("div",{className:qe.info,children:[o.jsxs("div",{className:qe.titleRow,children:[o.jsx("h3",{className:qe.title,children:P.name}),P.active&&o.jsx(gt,{tone:"accent",children:i("providers.badgeActive")}),o.jsx(gt,{tone:"muted",children:i(Yi[P.kind])}),P.hasKey?o.jsx(gt,{tone:"info",children:i("providers.badgeHasKey")}):o.jsx(gt,{tone:"warn",children:i("providers.badgeNoKey")})]}),o.jsxs("p",{className:qe.meta,children:[P.model!==void 0||(X=P.models)!=null&&X.length?o.jsxs(o.Fragment,{children:[i("providers.metaModel",{model:P.model??((he=P.models)==null?void 0:he[0])??""}),P.model===void 0&&(((Ce=P.models)==null?void 0:Ce.length)??0)>1?` ${i("providers.metaMore",{n:(((ge=P.models)==null?void 0:ge.length)??1)-1})}`:""]}):i("providers.metaNoModel"),P.baseUrl?` · ${P.baseUrl}`:""]}),(U==null?void 0:U.status)==="done"&&o.jsxs("div",{className:qe.testResult,role:"status",children:[o.jsx(gt,{tone:U.result.ok?"accent":"danger",children:U.result.ok?i("providers.testOkBadge"):i("providers.testFailBadge")}),o.jsxs("span",{className:qe.mono,children:[U.result.latencyMs,"ms"]}),!U.result.ok&&U.result.error&&o.jsx("span",{className:qe.errorText,children:U.result.error})]})]}),o.jsxs("div",{className:qe.rowActions,children:[o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void V(P),loading:(U==null?void 0:U.status)==="pending",disabled:(U==null?void 0:U.status)==="pending",children:i("providers.testBtn")}),o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void S(P),children:P.active?i("providers.deactivate"):i("providers.activate")}),o.jsx(Xn,{icon:"edit","aria-label":i("providers.editAria",{name:P.name}),onClick:()=>_e(P)}),o.jsx(Xn,{icon:"trash","aria-label":i("providers.deleteAria",{name:P.name}),onClick:()=>{oe(P),Z("")}})]})]},P.id)})}),o.jsx(Qn,{open:H,onClose:()=>_(!1),title:i(C?"providers.modalEditTitle":"providers.modalAddTitle"),children:o.jsxs("form",{className:qe.form,onSubmit:P=>void ae(P),noValidate:!0,children:[o.jsx(_t,{label:i("providers.formName"),value:R.name,onChange:P=>L(U=>({...U,name:P.target.value})),error:I.name,placeholder:i("providers.formNamePh"),required:!0,autoComplete:"off"}),o.jsx(Gg,{label:i("providers.formKind"),value:R.kind,onChange:P=>L(U=>({...U,kind:P.target.value})),children:Object.keys(Yi).map(P=>o.jsx("option",{value:P,children:i(Yi[P])},P))}),o.jsx(_t,{label:i("providers.formBaseUrl"),value:R.baseUrl,onChange:P=>L(U=>({...U,baseUrl:P.target.value})),error:I.baseUrl,hint:i(R.kind==="openai-compatible"||R.kind==="local"?"providers.formBaseUrlRequiredHint":"providers.formBaseUrlHint"),placeholder:"https://api.openai.com/v1",inputMode:"url",autoComplete:"off"}),o.jsxs("div",{className:qe.passwordWrap,children:[o.jsx(_t,{label:i("providers.formApiKey"),type:pe?"text":"password",value:R.apiKey,onChange:P=>L(U=>({...U,apiKey:P.target.value})),error:I.apiKey,hint:i(C?"providers.formApiKeyEditHint":"providers.formApiKeyNewHint"),placeholder:C&&C.hasKey?i("providers.formKeySavedPh"):i("providers.formKeyPh"),autoComplete:"new-password",required:R.kind!=="local"&&!(C!=null&&C.hasKey)}),o.jsx("button",{type:"button",className:qe.passwordToggle,onClick:()=>re(P=>!P),"aria-label":i(pe?"providers.hideKeyAria":"providers.showKeyAria"),children:o.jsx(ve,{name:pe?"x":"key",size:18})})]}),o.jsx(_t,{label:i("providers.formModel"),value:R.model,onChange:P=>L(U=>({...U,model:P.target.value})),error:I.model,placeholder:i("providers.formModelPh"),autoComplete:"off",required:!0}),o.jsxs("div",{className:qe.formActions,children:[o.jsx(fe,{variant:"ghost",type:"button",onClick:()=>_(!1),children:i("providers.cancel")}),o.jsx(fe,{variant:"primary",type:"submit",loading:ue,disabled:ue,children:i(C?"providers.saveChanges":"providers.add")})]})]})}),o.jsx(Qn,{open:!!te,onClose:()=>oe(null),title:i("providers.deleteTitle"),footer:o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",onClick:()=>oe(null),children:i("providers.cancel")}),o.jsx(fe,{variant:"danger",onClick:()=>void D(),loading:W,disabled:W||te!=null&&xe.trim()!==te.name,children:i("providers.deleteForever")})]}),children:te&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:qe.deleteWarn,children:i("providers.deleteWarn",{name:te.name})}),o.jsx(_t,{label:i("providers.deleteInputLabel"),value:xe,onChange:P=>Z(P.target.value),placeholder:te.name,autoComplete:"off"})]})})]}):o.jsx(Mt,{icon:"cpu",title:i("providers.title"),hint:i("providers.subtitleDisconnected"),children:o.jsx(Nr,{icon:"warn",title:i("providers.notConnectedTitle"),message:i("providers.notConnectedMessage"),action:o.jsx(fe,{variant:"primary",onClick:()=>a("/welcome"),children:i("providers.gotoOnboarding")})})})}function by(){const{t:a}=Be(),i=Mn(),c=Yn(),d=p.useRef(i.client);d.current=i.client;const[h,m]=p.useState(i.baseUrl),[f,y]=p.useState(null),[k,N]=p.useState(!1),[x,j]=p.useState(null),[A,H]=p.useState(!1),[_,C]=p.useState(""),[M,R]=p.useState(null),[L,I]=p.useState(!1),[B,ue]=p.useState(!1),[q,pe]=p.useState(!1),re=()=>{const W=ol(h);return y(W),W===null},te=async W=>{if(W.preventDefault(),!!re()){H(!0);try{await i.saveCredentials(h.trim(),""),c.push({tone:"success",title:a("settings.savedToast")})}catch(me){c.push({tone:"error",title:a("settings.saveFailToast"),message:me instanceof Error?me.message:void 0})}finally{H(!1)}}},oe=async()=>{if(re()){N(!0),j(null);try{const W=await ih(()=>d.current,()=>i.saveCredentials(h.trim(),""));j(W),W.ok&&c.push({tone:"success",title:a("settings.testOkToast")})}catch(W){j({ok:!1,error:W instanceof Error?W.message:a("settings.testFailDefault")})}finally{N(!1)}}},xe=async W=>{W.preventDefault();const me=_.trim();if(me===""){R(a("settings.keyRequired"));return}ue(!0);try{await i.saveCredentials(i.baseUrl,me),C(""),I(!1),pe(!1),c.push({tone:"success",title:a("settings.keySavedToast")})}catch(Ne){R(Ne instanceof Error?Ne.message:a("settings.saveKeyFail"))}finally{ue(!1)}},Z=i.connecting?o.jsx(gt,{tone:"muted",children:a("settings.badgeChecking")}):i.connected?o.jsx(gt,{tone:"accent",children:a("settings.badgeConnected")}):o.jsx(gt,{tone:"warn",children:a("settings.badgeNotConnected")});return o.jsxs("div",{children:[o.jsxs(Mt,{icon:"wifi",title:a("settings.sectionConn"),hint:a("settings.sectionConnHint"),children:[o.jsxs("div",{className:ce.statusRow,children:[Z,i.error&&!i.connecting&&o.jsx("span",{className:ce.connError,role:"alert",children:i.error})]}),o.jsxs("form",{onSubmit:W=>void te(W),noValidate:!0,children:[o.jsxs("div",{className:ce.urlRow,children:[o.jsx("div",{className:ce.fieldGrow,children:o.jsx(_t,{label:a("settings.urlLabel"),value:h,onChange:W=>{m(W.target.value),f&&y(null),x&&j(null)},onBlur:re,error:f??void 0,placeholder:"http://localhost:8787",inputMode:"url",autoComplete:"url"})}),o.jsx(fe,{type:"submit",variant:"primary",size:"sm",loading:A,disabled:k,children:a("settings.save")}),o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void oe(),loading:k,disabled:A,children:a("settings.test")})]}),o.jsx("p",{className:ce.urlHint,children:a("settings.urlHint")})]}),x&&o.jsx("div",{className:ce.testResult,role:"status",children:x.ok?o.jsxs(o.Fragment,{children:[o.jsx(gt,{tone:"accent",children:"OK"}),o.jsxs("code",{className:ce.mono,children:[x.version?`v${x.version}`:"gateway",typeof x.wireVersion=="number"&&` · wire v${x.wireVersion}`]})]}):o.jsxs("span",{className:ce.testError,role:"alert",children:[o.jsx(ve,{name:"warn",size:16}),x.error??a("settings.unreachable")]})})]}),o.jsx(Mt,{icon:"key",title:a("settings.sectionKey"),hint:a("settings.sectionKeyHint"),children:i.apiKeySaved&&!q?o.jsxs("div",{className:ce.savedKeyRow,children:[o.jsx("code",{className:ce.maskedKey,"aria-label":a("settings.savedKeyAria"),children:"••••••••••"}),o.jsx(gt,{tone:"accent",children:a("settings.savedBadge")}),o.jsx("div",{className:ce.actions,children:o.jsx(fe,{variant:"secondary",onClick:()=>pe(!0),children:a("settings.reenter")})})]}):o.jsxs("form",{onSubmit:W=>void xe(W),noValidate:!0,children:[o.jsxs("div",{className:ce.keyFieldRow,children:[o.jsx("div",{className:ce.fieldGrow,children:o.jsx(_t,{label:a("settings.newKeyLabel"),type:L?"text":"password",value:_,onChange:W=>{C(W.target.value),M&&R(null)},error:M??void 0,hint:a("settings.newKeyHint"),placeholder:a("settings.newKeyPlaceholder"),autoComplete:"off"})}),o.jsx(Xn,{icon:L?"eye-off":"eye","aria-label":a(L?"settings.hideKeyAria":"settings.showKeyAria"),onClick:()=>I(W=>!W)})]}),o.jsxs("div",{className:ce.actions,children:[o.jsx(fe,{type:"submit",variant:"primary",loading:B,children:a("settings.saveKey")}),i.apiKeySaved&&o.jsx(fe,{variant:"ghost",onClick:()=>{pe(!1),C(""),R(null)},children:a("settings.cancel")})]})]})}),o.jsx(Ny,{}),o.jsx(ly,{})]})}function Ly(){const{t:a}=Be();return o.jsx("div",{children:o.jsxs(Mt,{children:[o.jsx(Lt,{status:"soon",label:a("settings.notifyTurnDoneLabel"),hint:a("settings.notifyTurnDoneHint"),children:o.jsx(Nd,{checked:!1,onChange:()=>{},ariaLabel:a("settings.notifyTurnDoneLabel"),disabled:!0})}),o.jsx(Lt,{status:"soon",label:a("settings.notifyErrorsLabel"),hint:a("settings.notifyErrorsHint"),children:o.jsx(Nd,{checked:!1,onChange:()=>{},ariaLabel:a("settings.notifyErrorsLabel"),disabled:!0})}),o.jsxs("p",{className:ce.footnote,children:[o.jsx(ve,{name:"info",size:14}),a("settings.notificationsFootnote")]})]})})}const Id=["strict","warn","off"];function My(){const{t:a}=Be(),i=Mn(),c=Yn(),[d,h]=p.useState(!1),[m,f]=p.useState(!1),y=async()=>{f(!0);try{await i.clearCredentials(),c.push({tone:"success",title:a("settings.credsDeletedToast")})}catch(k){c.push({tone:"error",title:a("settings.credsDeleteFailToast"),message:k instanceof Error?k.message:void 0})}finally{f(!1),h(!1)}};return o.jsxs("div",{children:[o.jsxs(Mt,{icon:"shield",title:a("settings.sectionGuard"),hint:a("settings.sectionGuardHint"),children:[o.jsx(Xi,{label:a("settings.guardModeLabel"),hint:a("settings.guardRowHint"),envKey:"BOOMBOT_REASONING_GUARD_MODE",configPath:"reasoningGuard.mode",allowed:Id,defaultValue:"warn",snippet:'{ "reasoningGuard": { "mode": "warn" } }'}),o.jsx(Xi,{label:a("settings.harnessGuardLabel"),hint:a("settings.harnessGuardRowHint"),envKey:"BOOMBOT_GUARD_MODE",configPath:"harnessGuard.mode",allowed:Id,defaultValue:"warn",snippet:'{ "harnessGuard": { "mode": "warn" } }'}),o.jsx(Xi,{label:a("settings.shellLabel"),hint:a("settings.shellRowHint"),envKey:"BOOMBOT_SHELL_ENABLED",configPath:"shell.enabled",allowed:["1","true"],defaultValue:"tắt (fail-closed)",snippet:'{ "shell": { "enabled": true } }'})]}),o.jsx(Mt,{icon:"warn",title:a("settings.sectionDanger"),hint:a("settings.sectionDangerHint"),children:o.jsxs("div",{className:ce.prefRow,children:[o.jsxs("div",{className:ce.prefText,children:[o.jsx("span",{className:ce.prefLabel,children:a("settings.dangerTitle")}),o.jsx("span",{className:ce.prefHint,children:a("settings.dangerHint")})]}),o.jsx(fe,{variant:"danger",onClick:()=>h(!0),children:a("settings.dangerTitle")})]})}),o.jsx(Qn,{open:d,onClose:()=>h(!1),title:a("settings.modalTitle"),footer:o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",onClick:()=>h(!1),disabled:m,children:a("settings.modalCancel")}),o.jsx(fe,{variant:"danger",onClick:()=>void y(),loading:m,children:a("settings.modalDelete")})]}),children:o.jsx("p",{className:ce.modalText,children:a("settings.modalBody")})})]})}function Ry(){const{t:a,lang:i,setLang:c}=Be(),d=[{value:"vi",label:a("settings.langVi")},{value:"en",label:a("settings.langEn")}],h=[{value:"vi",label:a("settings.langVi")},{value:"en",label:a("settings.langEn")}],m=[{value:"natural",label:a("settings.voiceStyleNatural")},{value:"formal",label:a("settings.voiceStyleFormal")},{value:"casual",label:a("settings.voiceStyleCasual")}],f=[{value:"slow",label:a("settings.voiceSpeedSlow")},{value:"normal",label:a("settings.voiceSpeedNormal")},{value:"fast",label:a("settings.voiceSpeedFast")}];return o.jsx("div",{children:o.jsxs(Mt,{hint:a("settings.sectionVoiceHint"),children:[o.jsx(Lt,{label:a("settings.languageLabel"),hint:a("settings.languageHint"),children:o.jsx(Bt,{ariaLabel:a("settings.languageLabel"),options:d,value:i,onChange:y=>c(y)})}),o.jsx(Lt,{status:"soon",label:a("settings.voiceLangLabel"),hint:a("settings.voiceLangHint"),children:o.jsx(Bt,{ariaLabel:a("settings.voiceLangLabel"),options:h,value:"vi",onChange:()=>{},disabled:!0})}),o.jsx(Lt,{status:"soon",label:a("settings.voiceStyleLabel"),hint:a("settings.voiceStyleHint"),children:o.jsx(Bt,{ariaLabel:a("settings.voiceStyleLabel"),options:m,value:"natural",onChange:()=>{},disabled:!0})}),o.jsx(Lt,{status:"soon",label:a("settings.voiceSpeedLabel"),hint:a("settings.voiceSpeedHint"),children:o.jsx(Bt,{ariaLabel:a("settings.voiceSpeedLabel"),options:f,value:"normal",onChange:()=>{},disabled:!0})})]})})}const Py="appearance",hl=[{id:"appearance",labelKey:"settings.navAppearance",subtitleKey:"settings.appearanceSubtitle",icon:"palette"},{id:"chat",labelKey:"settings.navChat",subtitleKey:"settings.chatSubtitle",icon:"chat"},{id:"voice",labelKey:"settings.navVoice",subtitleKey:"settings.voiceSubtitle",icon:"volume"},{id:"notifications",labelKey:"settings.navNotifications",subtitleKey:"settings.notificationsSubtitle",icon:"bell"},{id:"security",labelKey:"settings.navSecurity",subtitleKey:"settings.securitySubtitle",icon:"shield"},{id:"connection",labelKey:"settings.navConnection",subtitleKey:"settings.connectionSubtitle",icon:"plug"}];function fl(a){return`/settings/${a}`}function Ay(a){return hl.find(i=>i.id===a)}function Dd(a){return a.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").replace(/đ/gi,"d").toLocaleLowerCase().trim()}const Iy=[{section:"appearance",keywords:"giao dien theme chu de sang toi he thong dark light system mat do density appearance"},{section:"chat",keywords:"tro chuyen chat phong chu font be rong khung transcript width chuyen dong motion giam chuyen dong"},{section:"voice",keywords:"giong noi voice ngon ngu language toc do speed phong cach style am thanh"},{section:"notifications",keywords:"thong bao notifications nhac nho nhan tin xong turn done"},{section:"security",keywords:"bao mat security api key reasoning guard harness guard shell vung nguy hiem xoa credentials"},{section:"connection",keywords:"ket noi connection gateway url api key provider providers nha cung cap model llm openai anthropic kiem tra health phien ban version"}];function Dy(a,i){const c=Dd(a);return c===""?[]:hl.filter(d=>{if(Dd(`${i(d)} ${d.id}`).includes(c))return!0;const m=Iy.find(f=>f.section===d.id);return m!==void 0&&m.keywords.includes(c)})}const Oy={appearance:j0,chat:T0,voice:Ry,notifications:Ly,security:My,connection:by};function Fy(){const{t:a}=Be(),i=sn(),{section:c}=km(),d=Ay(c);if(!d)return o.jsx("div",{className:ce.page,children:o.jsx(Nr,{icon:"gear",title:a("settings.unknownSectionTitle"),message:a("settings.unknownSectionBody"),action:o.jsx(fe,{variant:"primary",onClick:()=>i(fl(Py),{replace:!0}),children:a("settings.navAppearance")})})});const h=Oy[d.id];return o.jsxs("div",{className:ce.page,children:[o.jsxs("header",{className:ce.paneHeader,children:[o.jsx("h1",{className:ce.paneTitle,children:a(d.labelKey)}),o.jsx("p",{className:ce.paneSubtitle,children:a(d.subtitleKey)})]}),o.jsx(h,{})]})}const zy="_macTrafficLights_5c42g_5",By="_trafficDot_5c42g_21",Ky="_trafficClose_5c42g_49",Hy="_trafficMin_5c42g_51",Uy="_trafficMax_5c42g_53",$y="_collapsed_5c42g_57",Vy="_shell_5c42g_69",Wy="_sidebar_5c42g_85",Gy="_brandRow_5c42g_131",qy="_brand_5c42g_131",Qy="_brandMark_5c42g_177",Xy="_brandName_5c42g_217",Yy="_collapseToggle_5c42g_231",Zy="_newChatBtn_5c42g_323",Jy="_newChatBtnCollapsed_5c42g_407",e2="_recentBlock_5c42g_481",t2="_recentLabel_5c42g_495",n2="_recentList_5c42g_515",r2="_recentItemWrap_5c42g_537",o2="_recentDeleteBtn_5c42g_561",a2="_recentItem_5c42g_537",s2="_recentActive_5c42g_695",i2="_recentDot_5c42g_705",l2="_recentTitle_5c42g_723",c2="_nav_5c42g_737",u2="_navGroup_5c42g_755",d2="_navGroupLabel_5c42g_773",h2="_navLink_5c42g_795",f2="_active_5c42g_873",p2="_mainWrap_5c42g_1223",m2="_topbar_5c42g_1239",g2="_breadcrumb_5c42g_1275",v2="_crumbLink_5c42g_1297",y2="_crumbCurrent_5c42g_1313",w2="_main_5c42g_1223",k2="_content_5c42g_1351",x2="_narrow_5c42g_1365",_2="_bottomNav_5c42g_1393",C2="_drawerRoot_5c42g_1401",S2="_bottomLink_5c42g_1473",j2="_bottomLabel_5c42g_1565",T2="_scrim_5c42g_1589",E2="_drawer_5c42g_1401",N2="_drawerHeader_5c42g_1633",b2="_drawerTitle_5c42g_1647",L2="_drawerClose_5c42g_1657",M2="_drawerList_5c42g_1693",se={macTrafficLights:zy,trafficDot:By,trafficClose:Ky,trafficMin:Hy,trafficMax:Uy,collapsed:$y,shell:Vy,sidebar:Wy,brandRow:Gy,brand:qy,brandMark:Qy,brandName:Xy,collapseToggle:Yy,newChatBtn:Zy,newChatBtnCollapsed:Jy,recentBlock:e2,recentLabel:t2,recentList:n2,recentItemWrap:r2,recentDeleteBtn:o2,recentItem:a2,recentActive:s2,recentDot:i2,recentTitle:l2,nav:c2,navGroup:u2,navGroupLabel:d2,navLink:h2,active:f2,mainWrap:p2,topbar:m2,breadcrumb:g2,crumbLink:v2,crumbCurrent:y2,main:w2,content:k2,narrow:x2,bottomNav:_2,drawerRoot:C2,bottomLink:S2,bottomLabel:j2,scrim:T2,drawer:E2,drawerHeader:N2,drawerTitle:b2,drawerClose:L2,drawerList:M2},R2="_fallback_15157_1",P2={fallback:R2};function al(){return o.jsxs("div",{className:P2.fallback,"aria-label":"Đang tải trang",children:[o.jsx(Eo,{variant:"rect",height:48}),o.jsx(Eo,{variant:"rect",height:120}),o.jsx(Eo,{variant:"rect",height:120})]})}const A2="_overlay_1q444_1",I2="_dialog_1q444_14",D2="_sidebar_1q444_55",O2="_search_1q444_62",F2="_sectionLabel_1q444_93",z2="_group_1q444_100",B2="_navList_1q444_108",K2="_navItem_1q444_117",H2="_active_1q444_139",U2="_content_1q444_151",$2="_close_1q444_158",lt={overlay:A2,dialog:I2,sidebar:D2,search:O2,sectionLabel:F2,group:z2,navList:B2,navItem:K2,active:H2,content:U2,close:$2},fh=[{id:"settings",labelKey:"shell.groupSettings",items:hl.map(a=>({path:fl(a.id),labelKey:a.labelKey,icon:a.icon}))},{id:"start",labelKey:"shell.groupGettingStarted",items:[{path:"/welcome",labelKey:"shell.navOnboarding",icon:"bolt"}]}],ph=fh.flatMap(a=>a.items),V2=[...ph.map(a=>a.path),"/settings","/channels","/providers"];function Lo(a){return V2.some(i=>a===i||a.startsWith(`${i}/`))}function W2({children:a,onClose:i}){const{t:c}=Be(),d=p.useRef(null),h=p.useRef(null),[m,f]=p.useState(""),y=p.useRef(i);p.useEffect(()=>{y.current=i},[i]);const k=m.trim(),N=p.useMemo(()=>{if(k==="")return null;const j=k.toLocaleLowerCase(),A=ph.filter(C=>c(C.labelKey).toLocaleLowerCase().includes(j)),H=Dy(k,C=>c(C.labelKey)).map(C=>({path:fl(C.id),labelKey:C.labelKey,icon:C.icon})),_=new Set;return[...H,...A].filter(C=>_.has(C.path)?!1:(_.add(C.path),!0))},[k,c]);p.useEffect(()=>{var _;const j=document.activeElement,A=document.body.style.overflow;document.body.style.overflow="hidden",(_=h.current)==null||_.focus();const H=C=>{const M=d.current;if(!M)return;if(C.key==="Escape"){C.preventDefault(),y.current();return}if(C.key!=="Tab")return;const R=Array.from(M.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),L=R[0],I=R.at(-1);if(!(!L||!I)){if(!M.contains(document.activeElement)){C.preventDefault(),L.focus();return}C.shiftKey&&document.activeElement===L?(C.preventDefault(),I.focus()):!C.shiftKey&&document.activeElement===I&&(C.preventDefault(),L.focus())}};return document.addEventListener("keydown",H),()=>{document.removeEventListener("keydown",H),document.body.style.overflow=A,j==null||j.focus()}},[]);const x=j=>o.jsx("li",{children:o.jsxs(Mo,{to:j.path,className:({isActive:A})=>[lt.navItem,A?lt.active:""].join(" ").trim(),children:[o.jsx(ve,{name:j.icon,size:19}),o.jsx("span",{children:c(j.labelKey)})]})},j.path);return ll.createPortal(o.jsx("div",{className:lt.overlay,onMouseDown:j=>{j.target===j.currentTarget&&i()},children:o.jsxs("div",{ref:d,className:lt.dialog,role:"dialog","aria-modal":"true","aria-label":c("shell.systemAria"),children:[o.jsxs("div",{className:lt.sidebar,children:[o.jsxs("label",{className:lt.search,children:[o.jsx(ve,{name:"search",size:18}),o.jsx("input",{ref:h,type:"search","aria-label":c("shell.systemSearch"),value:m,onChange:j=>f(j.target.value),placeholder:c("shell.systemSearch")})]}),o.jsx("nav",{"aria-label":c("shell.systemAria"),className:lt.modalNav,children:N?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:lt.sectionLabel,children:c("shell.systemResults")}),N.length===0?o.jsx("p",{className:lt.sectionLabel,role:"status",children:c("shell.systemNoResults")}):o.jsx("ul",{className:lt.navList,children:N.map(x)})]}):fh.map(j=>o.jsxs("div",{className:lt.group,children:[o.jsx("p",{className:lt.sectionLabel,children:c(j.labelKey)}),o.jsx("ul",{className:lt.navList,children:j.items.map(x)})]},j.id))})]}),o.jsx("section",{className:lt.content,children:a}),o.jsx("button",{type:"button",className:lt.close,onClick:i,"aria-label":c("shell.systemClose"),children:o.jsx(ve,{name:"x",size:20})})]})}),document.body)}const mh=[{labelKey:"",items:[{path:"/",labelKey:"shell.navChat",icon:"chat"},{path:"/sessions",labelKey:"shell.navSessions",icon:"sessions"},{path:"/schedules",labelKey:"shell.navSchedules",icon:"calendar"},{path:"/tasks",labelKey:"shell.navTasks",icon:"clock"},{path:"/memory",labelKey:"shell.navMemory",icon:"database"}]},{labelKey:"shell.groupSystem",items:[{path:"/settings",labelKey:"shell.navSettings",icon:"gear"}]}],pl=mh.flatMap(a=>a.items),G2=["/","/sessions","/schedules","/settings"],gh="boombot.sidebar";function q2(){try{return localStorage.getItem(gh)==="collapsed"}catch{return!1}}function Q2(){const{t:a}=Be(),{connected:i,connecting:c,client:d,errorCode:h}=Mn(),m=c?"warn":i?"success":d?"danger":"muted",f=m==="warn"||m==="danger",k=a(c?"shell.connChecking":i?"shell.connOk":!i&&!c&&h==="UNAUTHORIZED"?"shell.connAuthFailed":d?"shell.connLost":"shell.connNone");return o.jsxs(gt,{tone:m,children:[o.jsx("span",{className:f?"status-dot status-dot--pulse":"status-dot","aria-hidden":"true"}),k]})}function X2(){const{t:a}=Be(),{pathname:i}=Rt(),c=pl.find(d=>d.path==="/"?i==="/":i.startsWith(d.path));return o.jsx("nav",{"aria-label":a("shell.navAria"),className:se.breadcrumb,children:o.jsxs("ol",{children:[o.jsx("li",{children:o.jsx(dl,{to:"/",className:se.crumbLink,children:a("shell.breadcrumbRoot")})}),c&&c.path!=="/"&&o.jsxs("li",{"aria-current":"page",className:se.crumbCurrent,children:[o.jsx(ve,{name:"chevron-right",size:14}),o.jsx("span",{children:a(c.labelKey)})]})]})})}function Y2({collapsed:a}){const{t:i}=Be(),{pathname:c}=Rt();return o.jsx("nav",{"aria-label":i("shell.navAria"),className:se.nav,children:mh.map((d,h)=>o.jsxs("div",{className:se.navGroup,children:[d.labelKey!==""&&!a&&o.jsx("p",{className:se.navGroupLabel,id:`nav-group-${h}`,children:i(d.labelKey)}),o.jsx("ul",{"aria-labelledby":d.labelKey!==""&&!a?`nav-group-${h}`:void 0,children:d.items.map(m=>{const f=i(m.labelKey);return o.jsx("li",{children:o.jsxs(Mo,{to:m.path,end:m.path==="/",title:a?f:void 0,className:({isActive:y})=>[se.navLink,y||m.path==="/settings"&&Lo(c)?se.active:""].join(" ").trim(),children:[o.jsx(ve,{name:m.icon,size:18}),!a&&o.jsx("span",{children:f})]})},m.path)})})]},d.labelKey||`group-${h}`))})}function Z2({open:a,onClose:i}){const{t:c}=Be(),{pathname:d}=Rt(),h=p.useRef(null);return p.useEffect(()=>{var f;if(!a)return;(f=h.current)==null||f.focus();const m=y=>{y.key==="Escape"&&i()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a,i]),a?o.jsxs("div",{className:se.drawerRoot,children:[o.jsx("div",{className:se.scrim,onClick:i,"aria-hidden":"true"}),o.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":c("shell.drawerAria"),className:se.drawer,children:[o.jsxs("div",{className:se.drawerHeader,children:[o.jsx("span",{className:se.drawerTitle,children:c("shell.drawerTitle")}),o.jsx("button",{ref:h,type:"button",onClick:i,"aria-label":c("shell.drawerClose"),className:se.drawerClose,children:o.jsx(ve,{name:"x",size:20})})]}),o.jsx("ul",{className:se.drawerList,children:pl.map(m=>o.jsx("li",{children:o.jsxs(Mo,{to:m.path,end:m.path==="/",onClick:i,className:({isActive:f})=>[se.navLink,f||m.path==="/settings"&&Lo(d)?se.active:""].join(" ").trim(),children:[o.jsx(ve,{name:m.icon,size:20}),o.jsx("span",{children:c(m.labelKey)})]})},m.path))})]})]}):null}function J2(){const{t:a}=Be(),{pathname:i}=Rt(),[c,d]=p.useState(!1),h=pl.filter(m=>G2.includes(m.path));return o.jsxs(o.Fragment,{children:[o.jsxs("nav",{"aria-label":a("shell.navAria"),className:se.bottomNav,children:[h.map(m=>o.jsxs(Mo,{to:m.path,end:m.path==="/",className:({isActive:f})=>[se.bottomLink,f||m.path==="/settings"&&Lo(i)?se.active:""].join(" ").trim(),children:[o.jsx(ve,{name:m.icon,size:22}),o.jsx("span",{className:se.bottomLabel,children:a(m.labelKey)})]},m.path)),o.jsxs("button",{type:"button",className:se.bottomLink,"aria-expanded":c,"aria-haspopup":"dialog",onClick:()=>d(!0),children:[o.jsx(ve,{name:"dots",size:22}),o.jsx("span",{className:se.bottomLabel,children:a("shell.more")})]})]}),o.jsx(Z2,{open:c,onClose:()=>d(!1)})]})}function ew(){const{t:a}=Be(),{pathname:i}=Rt(),c=sn(),{client:d,connected:h}=Mn(),m=p.useRef(null),f=p.useRef(null),y=p.useRef("/"),k=i==="/"||i.startsWith("/chat"),N=Lo(i),[x,j]=p.useState(q2),[A,H]=p.useState([]);p.useEffect(()=>{N||(y.current=i)},[i,N]),p.useEffect(()=>{const R=f.current;R&&(R.inert=N)},[N]);const _=p.useCallback(()=>{const R=y.current;c(Lo(R)?"/":R,{replace:!0})},[c]);p.useEffect(()=>{if(!h||!d){H([]);return}let R=!0;const L=()=>{d.sessionsList().then(B=>{R&&H(B.slice(0,8))}).catch(()=>{R&&H([])})};L();const I=window.setInterval(L,3e4);return()=>{R=!1,window.clearInterval(I)}},[d,h,i]);const C=async(R,L)=>{if(R.preventDefault(),R.stopPropagation(),!!d)try{await d.sessionsDelete(L),H(I=>I.filter(B=>B.id!==L)),i===`/chat/${L}`&&c("/chat/new")}catch(I){console.error("Failed to delete session:",I)}},M=p.useCallback(()=>{j(R=>{const L=!R;try{localStorage.setItem(gh,L?"collapsed":"expanded")}catch{}return L})},[]);return p.useEffect(()=>{var R;(R=m.current)==null||R.focus({preventScroll:!0})},[i]),o.jsxs("div",{ref:f,className:[se.shell,x?se.collapsed:""].join(" ").trim(),"aria-hidden":N||void 0,children:[o.jsx("a",{href:"#main-content",className:"skip-link",children:a("shell.skipToContent")}),o.jsxs("aside",{className:se.sidebar,children:[o.jsxs("div",{className:se.macTrafficLights,"aria-hidden":"true",children:[o.jsx("span",{className:`${se.trafficDot} ${se.trafficClose}`}),o.jsx("span",{className:`${se.trafficDot} ${se.trafficMin}`}),o.jsx("span",{className:`${se.trafficDot} ${se.trafficMax}`})]}),o.jsxs("div",{className:se.brandRow,children:[o.jsxs(dl,{to:"/",className:se.brand,"aria-label":a("shell.brandAria"),children:[o.jsx("span",{className:se.brandMark,"aria-hidden":"true",children:o.jsx("img",{src:"/logo.png",alt:"BoomBot",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"6px"}})}),!x&&o.jsx("span",{className:se.brandName,children:"BoomBot"})]}),o.jsx("button",{type:"button",className:se.collapseToggle,onClick:M,"aria-label":a(x?"shell.expandAria":"shell.collapseAria"),"aria-pressed":x,children:o.jsx(ve,{name:x?"chevron-right":"chevron-left",size:16})})]}),o.jsxs("button",{type:"button",className:x?se.newChatBtnCollapsed:se.newChatBtn,onClick:()=>c("/chat/new"),title:x?a("shell.newChat"):void 0,children:[o.jsx(ve,{name:"plus",size:16}),!x&&o.jsx("span",{children:a("shell.newChat")})]}),o.jsx(Y2,{collapsed:x}),!x&&A.length>0&&o.jsxs("div",{className:se.recentBlock,children:[o.jsx("p",{className:se.recentLabel,id:"recent-chats-label",children:a("shell.recentChats")}),o.jsx("ul",{className:se.recentList,"aria-labelledby":"recent-chats-label",children:A.map(R=>o.jsxs("li",{className:se.recentItemWrap,children:[o.jsxs(Mo,{to:`/chat/${R.id}`,title:R.title,className:({isActive:L})=>[se.recentItem,L?se.recentActive:""].join(" ").trim(),children:[o.jsx("span",{className:se.recentDot,"aria-hidden":"true"}),o.jsx("span",{className:se.recentTitle,children:R.title||a("chat.fallbackTitle")})]}),o.jsx("button",{type:"button",className:se.recentDeleteBtn,onClick:L=>C(L,R.id),title:"Delete chat","aria-label":"Delete chat",children:o.jsx(ve,{name:"trash",size:13})})]},R.id))})]})]}),o.jsxs("div",{className:se.mainWrap,children:[o.jsxs("header",{className:se.topbar,children:[o.jsx(X2,{}),o.jsx(Q2,{})]}),o.jsx("main",{id:"main-content",ref:m,tabIndex:-1,className:[se.main,k?se.narrow:""].join(" ").trim(),children:o.jsx("div",{className:se.content,children:!N&&o.jsx(p.Suspense,{fallback:o.jsx(al,{}),children:o.jsx(wd,{})})})})]}),o.jsx(J2,{}),N&&o.jsx(W2,{onClose:_,children:o.jsx(p.Suspense,{fallback:o.jsx(al,{}),children:o.jsx(wd,{})})})]})}const Od=p.lazy(()=>Lr(()=>import("./ChatView-BZrSD-64.js"),__vite__mapDeps([0,1,2]))),tw=p.lazy(()=>Lr(()=>import("./SessionsView-DS0-aH2a.js"),__vite__mapDeps([3,4]))),nw=p.lazy(()=>Lr(()=>import("./SchedulesView-B22QmPR-.js"),__vite__mapDeps([5,1,6,7,8]))),rw=p.lazy(()=>Lr(()=>import("./TasksView-ey0FLsW8.js"),__vite__mapDeps([9,1,6,7,10]))),ow=p.lazy(()=>Lr(()=>import("./MemoryView-BfMq_6CD.js"),__vite__mapDeps([11,1,12])));function aw(){return o.jsx($m,{children:o.jsx(Dp,{children:o.jsxs(d1,{children:[o.jsx(Q1,{}),o.jsx(Y1,{children:o.jsx(p.Suspense,{fallback:o.jsx(al,{}),children:o.jsx(Dm,{children:o.jsxs(mt,{element:o.jsx(ew,{}),children:[o.jsx(mt,{path:"/",element:o.jsx(Od,{})}),o.jsx(mt,{path:"/chat/:id",element:o.jsx(Od,{})}),o.jsx(mt,{path:"/sessions",element:o.jsx(tw,{})}),o.jsx(mt,{path:"/providers",element:o.jsx(Ua,{to:"/settings/connection",replace:!0})}),o.jsx(mt,{path:"/schedules",element:o.jsx(nw,{})}),o.jsx(mt,{path:"/tasks",element:o.jsx(rw,{})}),o.jsx(mt,{path:"/memory",element:o.jsx(ow,{})}),o.jsx(mt,{path:"/channels",element:o.jsx(Ua,{to:"/settings/connection",replace:!0})}),o.jsx(mt,{path:"/settings",element:o.jsx(Ua,{to:"/settings/appearance",replace:!0})}),o.jsx(mt,{path:"/settings/:section",element:o.jsx(Fy,{})}),o.jsx(mt,{path:"/welcome",element:o.jsx(Nv,{})}),o.jsx(mt,{path:"*",element:o.jsx(Ua,{to:"/",replace:!0})})]})})})})]})})})}const vh=document.getElementById("root");if(!vh)throw new Error("Không tìm thấy phần tử #root");Fp();Np.createRoot(vh).render(o.jsx(p.StrictMode,{children:o.jsx(Kv,{children:o.jsx(Rv,{children:o.jsx(Up,{children:o.jsx(aw,{})})})})}));export{fe as B,Nr as E,rh as F,ve as I,Qn as M,kg as O,Ug as P,Ga as S,Mn as a,Yn as b,Eo as c,km as d,sn as e,mg as f,Pv as g,Gg as h,_t as i,o as j,Xn as k,gt as l,Nd as m,qn as n,oh as o,yp as p,p as r,fl as s,Be as u,Av as w};
73
+ */function Qa(){return Qa=Object.assign?Object.assign.bind():function(a){for(var i=1;i<arguments.length;i++){var c=arguments[i];for(var d in c)({}).hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},Qa.apply(null,arguments)}function th(a,i){if(a==null)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(i.indexOf(d)!==-1)continue;c[d]=a[d]}return c}function Om(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Fm(a,i){return a.button===0&&(!i||i==="_self")&&!Om(a)}const zm=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Bm=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Km="6";try{window.__reactRouterVersion=Km}catch{}const Hm=p.createContext({isTransitioning:!1}),Um="startTransition",kd=Cp[Um];function $m(a){let{basename:i,children:c,future:d,window:h}=a,m=p.useRef();m.current==null&&(m.current=Wp({window:h,v5Compat:!0}));let f=m.current,[y,k]=p.useState({action:f.action,location:f.location}),{v7_startTransition:N}=d||{},x=p.useCallback(j=>{N&&kd?kd(()=>k(j)):k(j)},[k,N]);return p.useLayoutEffect(()=>f.listen(x),[f,x]),p.useEffect(()=>Am(d),[d]),p.createElement(Im,{basename:i,children:c,location:y.location,navigationType:y.action,navigator:f,future:d})}const Vm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Wm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dl=p.forwardRef(function(i,c){let{onClick:d,relative:h,reloadDocument:m,replace:f,state:y,target:k,to:N,preventScrollReset:x,viewTransition:j}=i,A=th(i,zm),{basename:H}=p.useContext(an),_,C=!1;if(typeof N=="string"&&Wm.test(N)&&(_=N,Vm))try{let I=new URL(window.location.href),B=N.startsWith("//")?new URL(I.protocol+N):new URL(N),ue=br(B.pathname,H);B.origin===I.origin&&ue!=null?N=ue+B.search+B.hash:C=!0}catch{}let M=gm(N,{relative:h}),R=qm(N,{replace:f,state:y,target:k,preventScrollReset:x,relative:h,viewTransition:j});function L(I){d&&d(I),I.defaultPrevented||R(I)}return p.createElement("a",Qa({},A,{href:_||M,onClick:C||m?d:L,ref:c,target:k}))}),Mo=p.forwardRef(function(i,c){let{"aria-current":d="page",caseSensitive:h=!1,className:m="",end:f=!1,style:y,to:k,viewTransition:N,children:x}=i,j=th(i,Bm),A=Za(k,{relative:j.relative}),H=Rt(),_=p.useContext(Qd),{navigator:C,basename:M}=p.useContext(an),R=_!=null&&Qm(A)&&N===!0,L=C.encodeLocation?C.encodeLocation(A).pathname:A.pathname,I=H.pathname,B=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;h||(I=I.toLowerCase(),B=B?B.toLowerCase():null,L=L.toLowerCase()),B&&M&&(B=br(B,M)||B);const ue=L!=="/"&&L.endsWith("/")?L.length-1:L.length;let q=I===L||!f&&I.startsWith(L)&&I.charAt(ue)==="/",pe=B!=null&&(B===L||!f&&B.startsWith(L)&&B.charAt(L.length)==="/"),re={isActive:q,isPending:pe,isTransitioning:R},te=q?d:void 0,oe;typeof m=="function"?oe=m(re):oe=[m,q?"active":null,pe?"pending":null,R?"transitioning":null].filter(Boolean).join(" ");let xe=typeof y=="function"?y(re):y;return p.createElement(dl,Qa({},j,{"aria-current":te,className:oe,ref:c,style:xe,to:k,viewTransition:N}),typeof x=="function"?x(re):x)});var tl;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(tl||(tl={}));var xd;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(xd||(xd={}));function Gm(a){let i=p.useContext(Xa);return i||Fe(!1),i}function qm(a,i){let{target:c,replace:d,state:h,preventScrollReset:m,relative:f,viewTransition:y}=i===void 0?{}:i,k=sn(),N=Rt(),x=Za(a,{relative:f});return p.useCallback(j=>{if(Fm(j,c)){j.preventDefault();let A=d!==void 0?d:qa(N)===qa(x);k(a,{replace:A,state:h,preventScrollReset:m,relative:f,viewTransition:y})}},[N,k,x,d,h,c,a,m,f,y])}function Qm(a,i){i===void 0&&(i={});let c=p.useContext(Hm);c==null&&Fe(!1);let{basename:d}=Gm(tl.useViewTransitionState),h=Za(a,{relative:i.relative});if(!c.isTransitioning)return!1;let m=br(c.currentLocation.pathname,d)||c.currentLocation.pathname,f=br(c.nextLocation.pathname,d)||c.nextLocation.pathname;return Ji(h.pathname,f)!=null||Ji(h.pathname,m)!=null}const Xm="_badge_1l5mk_1",_d={badge:Xm,"tone-accent":"_tone-accent_1l5mk_16","tone-muted":"_tone-muted_1l5mk_21","tone-danger":"_tone-danger_1l5mk_26","tone-warn":"_tone-warn_1l5mk_31","tone-info":"_tone-info_1l5mk_36","tone-success":"_tone-success_1l5mk_41"};function gt({tone:a="muted",children:i,className:c}){return o.jsx("span",{className:[_d.badge,_d[`tone-${a}`],c??""].join(" ").trim(),children:i})}const Ym={chat:o.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"}),sessions:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M3 3v5h5"}),o.jsx("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 8"}),o.jsx("path",{d:"M12 7v5l4 2"})]}),cpu:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("rect",{x:"9",y:"9",width:"6",height:"6"}),o.jsx("path",{d:"M15 2v2M15 20v2M2 15h2M2 9h2M20 15h2M20 9h2M9 2v2M9 20v2"})]}),calendar:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),o.jsx("path",{d:"M16 2v4M8 2v4M3 10h18"})]}),database:o.jsxs(o.Fragment,{children:[o.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),o.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"}),o.jsx("path",{d:"M3 12c0 1.66 4 3 9 3s9-1.34 9-3"})]}),radio:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("path",{d:"M4.93 19.07a10 10 0 0 1 0-14.14"}),o.jsx("path",{d:"M7.76 16.24a6 6 0 0 1 0-8.49"}),o.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),gear:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"})]}),plus:o.jsx("path",{d:"M5 12h14M12 5v14"}),x:o.jsx("path",{d:"M18 6 6 18M6 6l12 12"}),check:o.jsx("path",{d:"M20 6 9 17l-5-5"}),warn:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),o.jsx("path",{d:"M12 9v4M12 17h.01"})]}),search:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"11",cy:"11",r:"8"}),o.jsx("path",{d:"M21 21l-4.3-4.3"})]}),send:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M22 2 11 13"}),o.jsx("path",{d:"M22 2l-7 20-4-9-9-4 20-7z"})]}),dots:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"5",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"19",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"})]}),"chevron-down":o.jsx("path",{d:"M6 9l6 6 6-6"}),"chevron-right":o.jsx("path",{d:"M9 18l6-6-6-6"}),"chevron-left":o.jsx("path",{d:"M15 18l-6-6 6-6"}),bolt:o.jsx("path",{d:"M13 2 3 14h9l-1 8 10-12h-9l1-8z"}),shield:o.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}),key:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"7.5",cy:"15.5",r:"4.5"}),o.jsx("path",{d:"M10.8 12.2 20 3"}),o.jsx("path",{d:"M16 7l3 3M13.5 9.5l2 2"})]}),link:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),unlink:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M18.84 12.25l1.72-1.71a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o.jsx("path",{d:"M5.17 11.75l-1.72 1.71a5 5 0 0 0 7.07 7.07l1.71-1.71"}),o.jsx("path",{d:"M8 8l8 8"})]}),play:o.jsx("path",{d:"M6 4l14 8-14 8V4z"}),pause:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),o.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]}),trash:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M3 6h18"}),o.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),o.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),o.jsx("path",{d:"M10 11v6M14 11v6"})]}),edit:o.jsx("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z"}),refresh:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),o.jsx("path",{d:"M21 3v5h-5"})]}),wifi:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 20h.01"}),o.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),o.jsx("path",{d:"M5 12.86a10 10 0 0 1 14 0"}),o.jsx("path",{d:"M8.5 16.43a5 5 0 0 1 7 0"})]}),"wifi-off":o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M2 2l20 20"}),o.jsx("path",{d:"M8.5 16.43a5 5 0 0 1 7 0"}),o.jsx("path",{d:"M5 12.86a10 10 0 0 1 5.17-2.69"}),o.jsx("path",{d:"M2 8.82a15 15 0 0 1 4.17-2.65"}),o.jsx("path",{d:"M12 20h.01"})]}),info:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:"M12 16v-4M12 8h.01"})]}),copy:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),eye:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7z"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"eye-off":o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),o.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),o.jsx("path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),o.jsx("path",{d:"M2 2l20 20"})]}),"arrow-left":o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M19 12H5"}),o.jsx("path",{d:"M12 19l-7-7 7-7"})]}),menu:o.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"}),clock:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:"M12 6v6l4 2"})]}),stop:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),providers:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"}),o.jsx("rect",{x:"9",y:"9",width:"6",height:"6"}),o.jsx("path",{d:"M9 1v3M15 1v3M9 20v3M15 20v3M1 9h3M1 15h3M20 9h3M20 15h3"})]}),schedules:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("polyline",{points:"12 6 12 12 16 14"})]}),memory:o.jsxs(o.Fragment,{children:[o.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),o.jsx("path",{d:"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"}),o.jsx("path",{d:"M3 12c0 1.66 4 3 9 3s9-1.34 9-3"})]}),channels:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"2"}),o.jsx("path",{d:"M4.93 19.07a10 10 0 0 1 0-14.14"}),o.jsx("path",{d:"M7.76 16.24a6 6 0 0 1 0-8.49"}),o.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}),settings:o.jsxs(o.Fragment,{children:[o.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),o.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),o.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),o.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),o.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),o.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),o.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),o.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]}),sun:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"4"}),o.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})]}),moon:o.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"}),monitor:o.jsxs(o.Fragment,{children:[o.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),o.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),bell:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M18 8a6 6 0 1 0-12 0c0 7-3 9-3 9h18s-3-2-3-9"}),o.jsx("path",{d:"M13.7 21a2 2 0 0 1-3.4 0"})]}),volume:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M11 5 6 9H2v6h4l5 4V5z"}),o.jsx("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),o.jsx("path",{d:"M18.5 5.5a9 9 0 0 1 0 13"})]}),palette:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.12a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.56-2.5 5.56-5.55C21.97 6.01 17.46 2 12 2z"}),o.jsx("circle",{cx:"13.5",cy:"6.5",r:".75",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"17.5",cy:"10.5",r:".75",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"8.5",cy:"7.5",r:".75",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"6.5",cy:"12.5",r:".75",fill:"currentColor",stroke:"none"})]}),plug:o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M12 22v-5"}),o.jsx("path",{d:"M9 8V2"}),o.jsx("path",{d:"M15 8V2"}),o.jsx("path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z"})]}),globe:o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"}),o.jsx("path",{d:"M2 12h20"})]})};function ve({name:a,size:i=20,className:c}){return o.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",className:c,children:Ym[a]})}const nl={telegram:{color:"#26A5E4",d:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"},whatsapp:{color:"#25D366",d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"},discord:{color:"#5865F2",d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},slack:{color:"#E01E5A",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},zalo:{color:"#0068FF",d:"M12.49 10.2722v-.4496h1.3467v6.3218h-.7704a.576.576 0 01-.5763-.5729l-.0006.0005a3.273 3.273 0 01-1.9372.6321c-1.8138 0-3.2844-1.4697-3.2844-3.2823 0-1.8125 1.4706-3.2822 3.2844-3.2822a3.273 3.273 0 011.9372.6321l.0006.0005zM6.9188 7.7896v.205c0 .3823-.051.6944-.2995 1.0605l-.03.0343c-.0542.0615-.1815.206-.2421.2843L2.024 14.8h4.8948v.7682a.5764.5764 0 01-.5767.5761H0v-.3622c0-.4436.1102-.6414.2495-.8476L4.8582 9.23H.1922V7.7896h6.7266zm8.5513 8.3548a.4805.4805 0 01-.4803-.4798v-7.875h1.4416v8.3548H15.47zM20.6934 9.6C22.52 9.6 24 11.0807 24 12.9044c0 1.8252-1.4801 3.306-3.3066 3.306-1.8264 0-3.3066-1.4808-3.3066-3.306 0-1.8237 1.4802-3.3044 3.3066-3.3044zm-10.1412 5.253c1.0675 0 1.9324-.8645 1.9324-1.9312 0-1.065-.865-1.9295-1.9324-1.9295s-1.9324.8644-1.9324 1.9295c0 1.0667.865 1.9312 1.9324 1.9312zm10.1412-.0033c1.0737 0 1.945-.8707 1.945-1.9453 0-1.073-.8713-1.9436-1.945-1.9436-1.0753 0-1.945.8706-1.945 1.9436 0 1.0746.8697 1.9453 1.945 1.9453z"},messenger:{color:"#0084FF",d:"M12 0C5.24 0 0 4.952 0 11.64c0 3.499 1.434 6.521 3.769 8.61a.96.96 0 0 1 .323.683l.065 2.135a.96.96 0 0 0 1.347.85l2.381-1.053a.96.96 0 0 1 .641-.046A13 13 0 0 0 12 23.28c6.76 0 12-4.952 12-11.64S18.76 0 12 0m6.806 7.44c.522-.03.971.567.63 1.094l-4.178 6.457a.707.707 0 0 1-.977.208l-3.87-2.504a.44.44 0 0 0-.49.007l-4.363 3.01c-.637.438-1.415-.317-.995-.966l4.179-6.457a.706.706 0 0 1 .977-.21l3.87 2.505c.15.097.344.094.491-.007l4.362-3.008a.7.7 0 0 1 .364-.13"},tiktok:{color:"#000000",d:"M12.525.02c1.31-.02 2.61-.01 3.91-.04.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 2.26-.9 4.51-2.43 6.13-1.66 1.72-3.96 2.75-6.38 2.91-2.45.16-4.98-.3-7.05-1.55-2.07-1.25-3.57-3.23-4.21-5.54-.64-2.32-.47-4.85.5-7.01.97-2.15 2.65-3.89 4.74-4.91 2.1-.99 4.54-1.29 6.8-.82.16.03.32.07.48.11v4.13c-1.3-.23-2.65-.21-3.92.1-1.28.31-2.45.96-3.34 1.9-1.07 1.11-1.62 2.66-1.54 4.2.07 1.54.76 2.98 1.94 3.98 1.17 1 2.7 1.48 4.25 1.34 1.55-.14 2.98-.86 3.98-2.01 1.01-1.15 1.49-2.73 1.35-4.29V.02z"},feishu:{color:"#3370FF",d:"M23.16 6.55l-9.04-5.26c-.66-.39-1.48-.39-2.14 0l-9.04 5.26C2.28 6.94 1.8 7.77 1.8 8.54v10.51c0 .77.48 1.6 1.14 1.99l9.04 5.26c.66.39 1.48.39 2.14 0l9.04-5.26c.66-.39 1.14-1.22 1.14-1.99V8.54c0-.77-.48-1.6-1.14-1.99zM7.22 12.35l3.22-3.15c.57-.55 1.51-.55 2.08 0l4.25 4.14-4.25 4.15a1.47 1.47 0 0 1-2.08 0l-3.22-3.14V12.35z"},wechat:{color:"#07C160",d:"M17.16 9.61c-3.55 0-6.42 2.37-6.42 5.3 0 2.93 2.87 5.3 6.42 5.3 1.34 0 2.58-.35 3.61-.95.73.49 1.76.99 1.89 1.03.11.04.14-.07.1-.14l-.62-1.46c.92-1.04 1.44-2.36 1.44-3.78 0-2.93-2.87-5.3-6.42-5.3zm-1.64 3.03c.36 0 .66.3.66.66 0 .36-.3.66-.66.66-.36 0-.66-.3-.66-.66 0-.36.3-.66.66-.66zm3.28 0c.36 0 .66.3.66.66 0 .36-.3.66-.66.66-.36 0-.66-.3-.66-.66 0-.36.3-.66.66-.66zm-10.45 4.6l-.88 2.06c-.06.1-.02.26.15.2.19-.05 1.66-.75 2.75-1.48 1.5.85 3.25 1.35 5.14 1.35.34 0 .68-.02 1.01-.06-1.13-2.61-3.66-4.48-6.68-4.48-3.95 0-7.15 2.68-7.15 6.01 0 1.94.94 3.7 2.45 4.96.11.08.15.2.11.3l-.71 1.68c-.06.1.02.25.14.2.18-.06 1.63-.73 2.69-1.44 1.5.83 3.19 1.32 5 1.32 5.09 0 9.22-3.48 9.22-7.78 0-.41-.04-.81-.11-1.2-.55.07-1.1.11-1.67.11-4.7 0-8.52-3.13-8.52-6.99 0-.44.05-.88.14-1.3-.96-.13-1.95-.19-2.97-.19-5.09 0-9.22 3.48-9.22 7.78 0 2.27 1.13 4.31 2.92 5.76zM7.18 10.98c.45 0 .82.37.82.82 0 .45-.37.82-.82.82-.45 0-.82-.37-.82-.82 0-.45.37-.82.82-.82zm5.75 0c.45 0 .82.37.82.82 0 .45-.37.82-.82.82-.45 0-.82-.37-.82-.82 0-.45.37-.82.82-.82z"}};function Zm(a){return a in nl}function Jm({kind:a,size:i=24}){return Zm(a)?o.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:nl[a].color,"aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:nl[a].d})}):o.jsx(ve,{name:"channels",size:i})}const eg="_button_1p4is_1",tg="_label_1p4is_39",$a={button:eg,label:tg,"size-sm":"_size-sm_1p4is_46","size-md":"_size-md_1p4is_52","size-lg":"_size-lg_1p4is_58","variant-primary":"_variant-primary_1p4is_65","variant-secondary":"_variant-secondary_1p4is_78","variant-ghost":"_variant-ghost_1p4is_90","variant-danger":"_variant-danger_1p4is_101"},ng="_spinner_qbves_1",rg={spinner:ng};function Ga({size:a=16,label:i="Đang tải",className:c}){return o.jsx("span",{role:"status","aria-label":i,className:[rg.spinner,c??""].join(" ").trim(),style:{width:a,height:a}})}function fe({variant:a="primary",size:i="md",disabled:c=!1,loading:d=!1,type:h="button",children:m,className:f,...y}){const k=c||d;return o.jsxs("button",{type:h,disabled:k,"aria-disabled":k,"aria-busy":d||void 0,className:[$a.button,$a[`variant-${a}`],$a[`size-${i}`],f??""].join(" ").trim(),...y,children:[d&&o.jsx(Ga,{size:i==="sm"?14:16,label:"Đang xử lý"}),o.jsx("span",{className:$a.label,children:m})]})}const og="_card_e8wlu_1",ag="_hoverable_e8wlu_14",Cd={card:og,hoverable:ag};function sg({children:a,className:i,style:c,hoverable:d=!1,onClick:h}){return o.jsx("div",{className:[Cd.card,d?Cd.hoverable:"",i??""].join(" ").trim(),style:c,onClick:h,role:h?"button":void 0,tabIndex:h?0:void 0,onKeyDown:h?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),h())}:void 0,children:a})}const ig="_empty_17213_2",lg="_iconWrap_17213_17",cg="_mascot_17213_29",ug="_title_17213_33",dg="_message_17213_40",hg="_action_17213_48",jr={empty:ig,iconWrap:lg,mascot:cg,title:ug,message:dg,action:hg},Sd="(prefers-reduced-motion: reduce)";function fg(){const[a,i]=p.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(Sd).matches:!1);return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const c=window.matchMedia(Sd),d=h=>i(h.matches);return c.addEventListener("change",d),()=>c.removeEventListener("change",d)},[]),a}const nh=p.createContext("system");function pg({value:a,children:i}){return o.jsx(nh.Provider,{value:a,children:i})}function mg(){const a=fg();return p.useContext(nh)==="reduced"||a}const gg="_mascot_1sof1_9",vg={mascot:gg},Va=(a,i,c)=>a+(i-a)*c;function yg({active:a,gazeMode:i,followCursor:c,svgRef:d,motionRef:h,eyesRef:m,gazeRef:f}){p.useEffect(()=>{if(!a){h.current&&(h.current.style.transform=""),m.current&&(m.current.style.transform=""),f.current&&(f.current.style.transform="");return}let y=!1,k=0;const N=performance.now();let x=0,j=0,A=0,H=0,_=0,C=0,M=0,R=0;const L=re=>{if(i!=="full"||!c)return;const te=d.current;if(!te)return;const oe=te.getBoundingClientRect();if(oe.width===0)return;const xe=(re.clientX-(oe.left+oe.width/2))/oe.width,Z=(re.clientY-(oe.top+oe.height/2))/oe.height;_=Math.max(-8,Math.min(8,xe*16)),C=Math.max(-6,Math.min(6,Z*12))};window.addEventListener("mousemove",L);let I=0;const B=()=>{I=window.setTimeout(()=>{if(y||i!=="full"){B();return}const re=(Math.random()-.5)*7,te=(Math.random()-.5)*5,oe=performance.now(),xe=260,Z=W=>{if(y)return;const me=Math.min(1,(W-oe)/xe),Ne=me<.35?me/.35:1-(me-.35)/.65,je=Math.sin(Ne*Math.PI*.5);M=re*je,R=te*je,me<1?requestAnimationFrame(Z):(M=0,R=0,B())};requestAnimationFrame(Z)},1800+Math.random()*2600)};B();let ue=0;const q=()=>{ue=window.setTimeout(()=>{if(y){q();return}const re=m.current,te=performance.now(),oe=190,xe=Z=>{if(y)return;const W=Math.min(1,(Z-te)/oe),me=W<.4,Ne=me?W/.4:(W-.4)/.6,je=Math.sin(Ne*Math.PI*.5),_e=me?1-je*.93:.07+je*.93;re&&(re.style.transform=`scaleY(${_e.toFixed(3)})`),W<1?requestAnimationFrame(xe):(re&&(re.style.transform=""),q())};requestAnimationFrame(xe)},2200+Math.random()*2800)};q();const pe=re=>{if(y)return;const te=(re-N)/1e3,oe=Math.sin(te*1.35)*4.5+Math.sin(te*.52+1.3)*2,xe=Math.sin(te*.42+.6)*1.6;x=Va(x,oe,.055),j=Va(j,xe,.055),h.current&&(h.current.style.transform=`translateY(${x.toFixed(2)}px) rotate(${j.toFixed(2)}deg)`);const Z=i==="full",W=Z?_+M:0,me=Z?C+R:0;A=Va(A,W,.16),H=Va(H,me,.16),f.current&&(f.current.style.transform=`translate(${A.toFixed(2)}px, ${H.toFixed(2)}px)`),k=requestAnimationFrame(pe)};return k=requestAnimationFrame(pe),()=>{y=!0,cancelAnimationFrame(k),window.clearTimeout(I),window.clearTimeout(ue),window.removeEventListener("mousemove",L)}},[a,i,c,d,h,m,f])}const wg={idle:"Linh vật cú BoomBot",thinking:"BoomBot đang suy nghĩ",working:"BoomBot đang làm việc",happy:"Xong rồi!"};function kg({state:a="idle",size:i=64,className:c="",label:d,followCursor:h=!0}){const m=p.useRef(null),f=p.useRef(null),y=p.useRef(null),k=p.useRef(null),N=mg();return yg({active:(a==="idle"||a==="thinking")&&!N,gazeMode:a==="idle"?"full":"off",followCursor:h,svgRef:m,motionRef:f,eyesRef:y,gazeRef:k}),o.jsx("span",{className:[vg.mascot,c].filter(Boolean).join(" "),"data-state":a,style:{width:i,height:i,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:o.jsx("img",{src:"/logo.png",alt:d??wg[a],style:{width:"100%",height:"100%",objectFit:"contain",borderRadius:i>48?"16px":"8px",boxShadow:"0 0 20px rgba(129, 140, 248, 0.35)"}})})}function Nr({icon:a,title:i,message:c,action:d,mascot:h}){return o.jsxs("div",{className:jr.empty,children:[h?o.jsx(kg,{state:h,size:88,className:jr.mascot}):o.jsx("span",{className:jr.iconWrap,"aria-hidden":"true",children:o.jsx(ve,{name:a,size:28})}),o.jsx("h3",{className:jr.title,children:i}),c&&o.jsx("p",{className:jr.message,children:c}),d&&o.jsx("div",{className:jr.action,children:d})]})}const xg="_field_py9ew_1",_g="_label_py9ew_8",Cg="_required_py9ew_14",Sg="_hint_py9ew_18",jg="_error_py9ew_25",Tg="_control_py9ew_33",qn={field:xg,label:_g,required:Cg,hint:Sg,error:jg,control:Tg};function rh({id:a,label:i,error:c,hint:d,required:h=!1,children:m}){const f=`${a}-error`,y=`${a}-hint`;return o.jsxs("div",{className:qn.field,children:[i&&o.jsxs("label",{htmlFor:a,className:qn.label,children:[i,h&&o.jsx("span",{className:qn.required,"aria-hidden":"true",children:" *"})]}),m,d&&!c&&o.jsx("p",{id:y,className:qn.hint,children:d}),c&&o.jsx("p",{id:f,className:qn.error,role:"alert",children:c})]})}function oh(a,i,c){if(i)return`${a}-error`;if(c)return`${a}-hint`}const Eg="_iconButton_1lyp5_1",qi={iconButton:Eg,"size-sm":"_size-sm_1lyp5_39","variant-secondary":"_variant-secondary_1lyp5_43"};function Xn({icon:a,size:i="md",variant:c="ghost",className:d,type:h="button",...m}){return o.jsx("button",{type:h,className:[qi.iconButton,qi[`size-${i}`],qi[`variant-${c}`],d??""].join(" ").trim(),...m,children:o.jsx(ve,{name:a,size:i==="sm"?18:20})})}const Ng="_group_hiaao_5",bg="_key_hiaao_12",jd={group:Ng,key:bg};function ah({keys:a}){return o.jsx("span",{className:jd.group,"aria-label":a.join(" + "),children:a.map((i,c)=>o.jsx(p.Fragment,{children:o.jsx("kbd",{className:jd.key,children:i})},`${c}-${i}`))})}function _t({label:a,error:i,hint:c,id:d,required:h,...m}){const f=p.useId(),y=d??`input-${f}`;return o.jsx(rh,{id:y,label:a,error:i,hint:c,required:h,children:o.jsx("input",{id:y,className:qn.control,"aria-invalid":i?!0:void 0,"aria-describedby":oh(y,i,c),required:h,...m})})}const Lg="_overlay_eag6u_1",Mg="_closing_eag6u_16",Rg="_panel_eag6u_21",Pg="_header_eag6u_41",Ag="_title_eag6u_51",Ig="_body_eag6u_59",Dg="_footer_eag6u_64",En={overlay:Lg,closing:Mg,panel:Rg,header:Pg,title:Ag,body:Ig,footer:Dg},Og=150;function Td(a){const i=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(a.querySelectorAll(i)).filter(c=>c.offsetParent!==null||c===document.activeElement)}function Qn({open:a,onClose:i,title:c,children:d,footer:h,describedBy:m}){const[f,y]=p.useState(a),[k,N]=p.useState(!1),x=p.useRef(null),j=p.useRef(i);j.current=i;const A=p.useId(),H=p.useRef(null);p.useEffect(()=>{if(a){H.current=document.activeElement,y(!0),N(!1);return}if(!f)return;N(!0);const C=window.setTimeout(()=>{var M,R;y(!1),N(!1),(R=(M=H.current)==null?void 0:M.focus)==null||R.call(M)},Og);return()=>window.clearTimeout(C)},[a,f]);const _=p.useCallback(()=>{j.current()},[]);return p.useEffect(()=>{if(!f||k)return;const C=x.current;if(!C)return;(Td(C)[0]??C).focus();const R=I=>{if(I.key==="Escape"){I.stopPropagation(),_();return}if(I.key!=="Tab")return;const B=Td(C);if(B.length===0){I.preventDefault();return}const ue=B[0],q=B[B.length-1];I.shiftKey&&document.activeElement===ue?(I.preventDefault(),q.focus()):!I.shiftKey&&document.activeElement===q&&(I.preventDefault(),ue.focus())};document.addEventListener("keydown",R,!0);const L=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",R,!0),document.body.style.overflow=L}},[f,k,_]),f?ll.createPortal(o.jsx("div",{className:[En.overlay,k?En.closing:""].join(" ").trim(),onMouseDown:C=>{C.target===C.currentTarget&&_()},children:o.jsxs("div",{ref:x,role:"dialog","aria-modal":"true","aria-labelledby":A,"aria-describedby":m,tabIndex:-1,className:[En.panel,k?En.closing:""].join(" ").trim(),children:[o.jsxs("div",{className:En.header,children:[o.jsx("h2",{id:A,className:En.title,children:c}),o.jsx(Xn,{icon:"x","aria-label":"Đóng",onClick:_})]}),o.jsx("div",{className:En.body,children:d}),h&&o.jsx("div",{className:En.footer,children:h})]})}),document.body):null}const Fg="_header_37mfg_1",zg="_text_37mfg_11",Bg="_title_37mfg_15",Kg="_subtitle_37mfg_23",Hg="_actions_37mfg_31",So={header:Fg,text:zg,title:Bg,subtitle:Kg,actions:Hg};function Ug({title:a,subtitle:i,actions:c}){return o.jsxs("header",{className:So.header,children:[o.jsxs("div",{className:So.text,children:[o.jsx("h1",{className:So.title,children:a}),i&&o.jsx("p",{className:So.subtitle,children:i})]}),c&&o.jsx("div",{className:So.actions,children:c})]})}const $g="_group_zc09i_1",Vg="_option_zc09i_10",Wg="_selected_zc09i_41",Qi={group:$g,option:Vg,selected:Wg};function Bt({options:a,value:i,onChange:c,ariaLabel:d,iconOnly:h=!1,disabled:m=!1}){return o.jsx("div",{role:"group","aria-label":d,className:Qi.group,"data-icon-only":h||void 0,children:a.map(f=>{const y=f.value===i;return o.jsxs("button",{type:"button",disabled:m,"aria-pressed":y,"aria-label":h?f.label:void 0,title:h?f.label:void 0,onClick:()=>c(f.value),className:[Qi.option,y?Qi.selected:""].join(" ").trim(),children:[f.icon!==void 0&&o.jsx(ve,{name:f.icon,size:16}),!h&&o.jsx("span",{children:f.label})]},f.value)})})}function Gg({label:a,error:i,hint:c,id:d,required:h,children:m,...f}){const y=p.useId(),k=d??`select-${y}`;return o.jsx(rh,{id:k,label:a,error:i,hint:c,required:h,children:o.jsx("select",{id:k,className:qn.control,"aria-invalid":i?!0:void 0,"aria-describedby":oh(k,i,c),required:h,...f,children:m})})}const qg="_skeleton_1st85_1",Qg="_auroraShimmer_1st85_1",Ed={skeleton:qg,"variant-text":"_variant-text_1st85_9","variant-rect":"_variant-rect_1st85_15","variant-circle":"_variant-circle_1st85_21",auroraShimmer:Qg};function Eo({variant:a="rect",width:i,height:c,className:d}){return o.jsx("span",{"aria-hidden":"true",className:[Ed.skeleton,Ed[`variant-${a}`],d??""].join(" ").trim(),style:{width:i,height:c}})}const Xg="_wrapper_1fgop_1",Yg="_on_1fgop_32",Zg="_knob_1fgop_38",Jg="_label_1fgop_63",Tr={wrapper:Xg,switch:"_switch_1fgop_10",on:Yg,knob:Zg,label:Jg};function Nd({checked:a,onChange:i,label:c,ariaLabel:d,disabled:h=!1,id:m}){const f=o.jsx("button",{id:m,type:"button",role:"switch","aria-checked":a,"aria-label":d,disabled:h,onClick:()=>i(!a),className:[Tr.switch,a?Tr.on:""].join(" ").trim(),children:o.jsx("span",{className:Tr.knob,"aria-hidden":"true"})});return c===void 0?o.jsx("span",{className:Tr.wrapper,children:f}):o.jsxs("label",{className:Tr.wrapper,htmlFor:m,children:[f,o.jsx("span",{className:Tr.label,children:c})]})}const e1="_region_1h4m9_1",t1="_toast_1h4m9_13",n1="_leaving_1h4m9_33",r1="_icon_1h4m9_38",o1="_text_1h4m9_60",a1="_title_1h4m9_64",s1="_message_1h4m9_71",Nn={region:e1,toast:t1,"toast-in":"_toast-in_1h4m9_1",leaving:n1,icon:r1,"tone-info":"_tone-info_1h4m9_44","tone-success":"_tone-success_1h4m9_48","tone-warn":"_tone-warn_1h4m9_52","tone-error":"_tone-error_1h4m9_56",text:o1,title:a1,message:s1},i1=4e3,l1=200,c1={info:"info",success:"check",warn:"warn",error:"x"},sh=p.createContext(null);function Yn(){const a=p.useContext(sh);return a||{push:()=>{}}}function u1({toast:a,onDone:i}){return p.useEffect(()=>{const c=window.setTimeout(()=>i(a.id),i1);return()=>window.clearTimeout(c)},[a.id,i]),o.jsxs("div",{role:"status",className:[Nn.toast,Nn[`tone-${a.tone}`],a.leaving?Nn.leaving:""].join(" ").trim(),children:[o.jsx("span",{className:Nn.icon,"aria-hidden":"true",children:o.jsx(ve,{name:c1[a.tone],size:18})}),o.jsxs("div",{className:Nn.text,children:[o.jsx("p",{className:Nn.title,children:a.title}),a.message&&o.jsx("p",{className:Nn.message,children:a.message})]})]})}function d1({children:a}){const[i,c]=p.useState([]),d=p.useRef(0),h=p.useCallback(k=>{c(N=>N.filter(x=>x.id!==k))},[]),m=p.useCallback(k=>{c(N=>N.map(x=>x.id===k?{...x,leaving:!0}:x)),window.setTimeout(()=>h(k),l1)},[h]),f=p.useCallback(k=>{d.current+=1;const N=d.current;c(x=>[...x.slice(-3),{...k,id:N,leaving:!1}])},[]),y=p.useMemo(()=>({push:f}),[f]);return o.jsxs(sh.Provider,{value:y,children:[a,ll.createPortal(o.jsx("div",{className:Nn.region,"aria-live":"polite","aria-atomic":"false",children:i.map(k=>o.jsx(u1,{toast:k,onDone:m},k.id))}),document.body)]})}const h1={openai:{color:"#000000",darkColor:"#ffffff",d:"M22.28 10.95a10.87 10.87 0 00-.77-3.92 1.34 1.34 0 00-1.63-.79l-.26.06c-1.12.3-2.14.77-3.02 1.39l.1-1.39a10.8 10.8 0 00-2-6.52 1.34 1.34 0 00-1.74-.46l-2.07 1a10.88 10.88 0 00-4.32 4.43c-.47-.28-.97-.53-1.49-.74l-.24-.1a1.34 1.34 0 00-1.77.62 10.87 10.87 0 00-1.07 3.92 10.88 10.88 0 002.83 8.35 1.34 1.34 0 001.62.79l.26-.07c1.12-.3 2.13-.76 3.01-1.38l-.1 1.38a10.8 10.8 0 002.01 6.53 1.34 1.34 0 001.75.46l2.06-1a10.88 10.88 0 004.33-4.43c.47.28.97.53 1.5.74l.23.1a1.34 1.34 0 001.77-.62 10.88 10.88 0 001.07-3.93 10.88 10.88 0 00-2.84-8.35zm-5.71-3.66a8.88 8.88 0 011.66 2.05l-4.7 2.7-3.15-5.46a8.88 8.88 0 016.19.71zm-9.3 1.83a8.88 8.88 0 014.28-1l-1.57 5.24h-6.3a8.88 8.88 0 013.59-4.24zm-4.14 8.7a8.88 8.88 0 01-.15-2.61l4.72-2.73 3.14 5.46a8.88 8.88 0 01-7.71-.12zm2.84 5.76a8.88 8.88 0 01-1.66-2.05l4.72-2.73 3.14 5.45a8.88 8.88 0 01-6.2-.67zm9.3-1.82a8.88 8.88 0 01-4.28 1l1.56-5.24h6.3a8.88 8.88 0 01-3.58 4.24zm4.14-8.7a8.88 8.88 0 01.16 2.6l-4.72 2.73-3.14-5.45a8.88 8.88 0 017.7-.88zm-6.19 1.43h-4.3l2.15-3.73 2.15 3.73zm-4.63 2.68l2.15 3.72-4.3 0 2.15-3.72z"},anthropic:{color:"#D97706",darkColor:"#F59E0B",d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"},google:{color:"#4285F4",d:"M23.64 12.20c0-.82-.07-1.62-.21-2.39H12v4.51h6.53c-.28 1.46-1.09 2.69-2.32 3.52v2.93h3.76c2.20-2.03 3.47-5.02 3.47-8.57zM12 24c3.27 0 6.01-1.09 8.01-2.94l-3.76-2.93c-1.08.73-2.47 1.16-4.25 1.16-3.27 0-6.04-2.21-7.03-5.18H1.14v3.02C3.14 21.08 7.21 24 12 24zM4.97 14.11c-.25-.75-.39-1.54-.39-2.36s.14-1.61.39-2.36V6.37H1.14C.42 7.82 0 9.47 0 11.25s.42 3.43 1.14 4.88l3.83-2.02zM12 4.79c1.78 0 3.37.61 4.63 1.81l3.47-3.47C18.01 1.09 15.27 0 12 0 7.21 0 3.14 2.92 1.14 6.37l3.83 3.02C5.96 7 8.73 4.79 12 4.79z"},xai:{color:"#000000",darkColor:"#ffffff",d:"M13.79 10.96l7.85-8.82h-1.86l-6.81 7.65-5.44-7.65H.54l8.22 11.57-8.24 9.25h1.86l7.19-8.08 5.76 8.08h6.98l-8.52-11.99zM15.42 20.4l-1.3-1.85L2.83 2.87H5.7l9.9 14.07 1.3 1.85 11.69 16.59h-2.87L15.42 20.4z"},deepseek:{color:"#0066FF",d:"M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45"},mistral:{color:"#FF7000",d:"M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z"},ollama:{color:"#10B981",darkColor:"#34D399",d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032z"},meta:{color:"#0081FB",d:"M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973a6.624 6.624 0 0 0 .265.86 5.297 5.297 0 0 0 .371.761c.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.756-1.339.186-.325c.061.1.121.196.183.3l2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843a3.743 3.743 0 0 0 .81-.973c.542-.939.861-2.127.861-3.745 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c.07-.109.141-.224.211-.327 1.12-1.667 2.118-2.602 3.358-2.602zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-.524 0-1.038-.237-1.383-.794-.263-.426-.464-1.13-.464-2.046 0-2.221.63-4.535 1.66-6.088.454-.687.964-1.226 1.533-1.533a2.264 2.264 0 0 1 1.088-.285z"},qwen:{color:"#615CED",d:"M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z"},"openai-compatible":{color:"#818CF8",d:"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm1 14.93V18a1 1 0 0 1-2 0v-1.07A7 7 0 0 1 5.07 11H6a1 1 0 0 1 0-2h-.93A7 7 0 0 1 11 3.07V4a1 1 0 0 1 2 0v-.93A7 7 0 0 1 18.93 9H18a1 1 0 0 1 0 2h.93A7 7 0 0 1 13 16.93zM12 7a5 5 0 1 0 5 5 5 5 0 0 0-5-5z"},local:{color:"#10B981",d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-1 14H5c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v10c0 .55-.45 1-1 1zm-7-8h4v2h-4v-2zm-5 0h3v2H7v-2zm0 4h9v2H7v-2z"}};function f1({kind:a,size:i=24}){const c=document.documentElement.getAttribute("data-theme")!=="light",d=(a||"").toLowerCase().trim(),h=h1[d];if(!h)return o.jsx(ve,{name:"cpu",size:i});let m=h.color;return c&&h.darkColor&&(m=h.darkColor),o.jsx("svg",{width:i,height:i,viewBox:"0 0 24 24",fill:m,"aria-hidden":"true",focusable:"false",style:h.scale?{transform:`scale(${h.scale})`}:void 0,children:o.jsx("path",{d:h.d})})}function p1(a,i){const c=a.toLowerCase(),d=i.toLowerCase();if(c.length===0)return 0;let h=0,m=0,f=-2,y=-1;for(let k=0;k<c.length;k++){const N=c.charAt(k),x=d.indexOf(N,m);if(x===-1)return-1/0;y===-1&&(y=x);let j=10;x===0?j+=20:m1(d,x)&&(j+=10),x===f+1&&(j+=12),j-=Math.max(0,x-m-1),h+=j,f=x,m=x+1}return y===0&&c.length===d.length&&(h+=30),h}function m1(a,i){const c=a[i-1];return c===" "||c==="-"||c==="_"||c==="/"||c==="."||c===":"||c==="("||c==="["}function g1(a,i){const c=i.trim();if(c==="")return a.slice();const d=a.map((h,m)=>{const f=[h.title,h.subtitle??"",h.keywords??""],y=Math.max(...f.map(k=>p1(c,k)));return{action:h,score:y,index:m}}).filter(h=>h.score>-1/0);return d.sort((h,m)=>m.score-h.score||h.index-m.index),d.map(h=>h.action)}function on(a,i,c,d,h,m,f){return{id:a,title:i,subtitle:h,hint:f,icon:d,keywords:m,run:y=>y.navigate(c)}}function v1(a){const i=c=>({title:a(`palette.actions.${c}.title`),subtitle:a(`palette.actions.${c}.subtitle`)});return[{id:"new-chat",...i("newChat"),icon:"plus",keywords:"new chat mới phiên mới",run:c=>c.navigate("/")},on("go-chat",a("palette.actions.goChat.title"),"/","chat",a("palette.actions.goChat.subtitle"),"chat trò chuyện open"),on("go-sessions",a("palette.actions.goSessions.title"),"/sessions","sessions",a("palette.actions.goSessions.subtitle"),"sessions phiên history lịch sử"),on("go-providers",a("palette.actions.goProviders.title"),"/settings/connection","cpu",a("palette.actions.goProviders.subtitle"),"providers model llm openai anthropic ket noi connection"),on("go-schedules",a("palette.actions.goSchedules.title"),"/schedules","calendar",a("palette.actions.goSchedules.subtitle"),"schedules lịch chạy cron schedule"),on("go-tasks",a("palette.actions.goTasks.title"),"/tasks","clock",a("palette.actions.goTasks.subtitle"),"tasks task nền background runner"),on("go-memory",a("palette.actions.goMemory.title"),"/memory","database",a("palette.actions.goMemory.subtitle"),"memory bộ nhớ nhớ recall"),on("go-channels",a("palette.actions.goChannels.title"),"/settings/connection","radio",a("palette.actions.goChannels.subtitle"),"channels kênh chat telegram zalo discord slack pair"),on("go-settings",a("palette.actions.goSettings.title"),"/settings","gear",a("palette.actions.goSettings.subtitle"),"settings cài đặt cấu hình config"),on("go-onboarding",a("palette.actions.goOnboarding.title"),"/welcome","bolt",a("palette.actions.goOnboarding.subtitle"),"onboarding welcome bắt đầu hướng dẫn start"),{id:"channel-pair",...i("channelPair"),icon:"link",keywords:"pair kênh channel kết nối telegram zalo",run:c=>c.navigate("/settings/connection")},{id:"schedule-now",...i("scheduleNow"),icon:"play",keywords:"schedule run now chạy ngay lịch",run:c=>c.navigate("/schedules")},{id:"reconnect-gateway",...i("reconnect"),icon:"refresh",keywords:"reconnect kết nối lại gateway retry",run:async c=>{const d=await c.saveCredentials(c.baseUrl,"");c.toast(d?{tone:"success",title:a("palette.toast.reconnectOk")}:{tone:"error",title:a("palette.toast.reconnectFail")})}},{id:"open-shortcuts",...i("openShortcuts"),hint:"?",icon:"key",keywords:"shortcuts phím tắt keyboard cheatsheet help",run:c=>c.openShortcuts()},{id:"session-delete",...i("sessionDelete"),icon:"trash",keywords:"delete xoá phiên session remove",run:async c=>{const d=c.pathname.match(/^\/chat\/([^/?#]+)/),h=d==null?void 0:d[1];if(!d||!h){c.toast({tone:"warn",title:a("palette.toast.noOpenSession")});return}const m=decodeURIComponent(h);if(!c.client){c.toast({tone:"warn",title:a("palette.toast.notConnected")});return}try{await c.client.sessionsDelete(m),c.toast({tone:"success",title:a("palette.toast.sessionDeleted")}),c.navigate("/")}catch(f){c.toast({tone:"error",title:a("palette.toast.sessionDeleteFail"),message:f instanceof Error?f.message:void 0})}}}]}const y1="_overlay_1inx0_3",w1="_panel_1inx0_19",k1="_searchRow_1inx0_31",x1="_searchInput_1inx0_40",_1="_list_1inx0_57",C1="_row_1inx0_65",S1="_rowIcon_1inx0_84",j1="_active_1inx0_91",T1="_rowText_1inx0_100",E1="_rowTitle_1inx0_108",N1="_rowSubtitle_1inx0_115",b1="_empty_1inx0_123",L1="_keycap_1inx0_131",M1="_footer_1inx0_150",R1="_footerHint_1inx0_160",Ue={overlay:y1,panel:w1,searchRow:k1,searchInput:x1,list:_1,row:C1,rowIcon:S1,active:j1,rowText:T1,rowTitle:E1,rowSubtitle:N1,empty:b1,keycap:L1,footer:M1,footerHint:R1};function P1({actions:a,initialQuery:i="",onClose:c,onRun:d}){const{t:h}=Be(),[m,f]=p.useState(i),[y,k]=p.useState(0),N=p.useRef(null),x=p.useRef(null),j=p.useRef(null),A=p.useId(),H=p.useMemo(()=>g1(a,m),[a,m]);p.useEffect(()=>{k(0)},[m]);const _=H[Math.min(y,Math.max(0,H.length-1))];p.useEffect(()=>{var L;return j.current=document.activeElement,(L=N.current)==null||L.focus(),()=>{const I=j.current;I instanceof HTMLElement&&I.focus({preventScroll:!0})}},[]),p.useEffect(()=>{var I;if(!_)return;const L=(I=x.current)==null?void 0:I.querySelector(`[data-palette-index="${Math.min(y,H.length-1)}"]`);L&&typeof L.scrollIntoView=="function"&&L.scrollIntoView({block:"nearest"})},[y,_,H.length]);const C=()=>{_&&d(_)},M=L=>{L.key==="ArrowDown"?(L.preventDefault(),k(I=>H.length===0?0:(I+1)%H.length)):L.key==="ArrowUp"?(L.preventDefault(),k(I=>H.length===0?0:(I-1+H.length)%H.length)):L.key==="Enter"?(L.preventDefault(),C()):L.key==="Escape"&&(L.preventDefault(),c())},R=_?`${A}-option-${_.id}`:void 0;return o.jsx("div",{className:Ue.overlay,onClick:c,children:o.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":h("palette.ariaLabel"),className:Ue.panel,onClick:L=>L.stopPropagation(),onKeyDown:M,children:[o.jsxs("div",{className:Ue.searchRow,children:[o.jsx(ve,{name:"search",size:18}),o.jsx("input",{ref:N,type:"text",role:"combobox","aria-expanded":"true","aria-controls":A,"aria-activedescendant":R,"aria-autocomplete":"list",className:Ue.searchInput,placeholder:h("palette.placeholder"),value:m,onChange:L=>f(L.target.value)}),m&&o.jsx("span",{className:Ue.keycap,"aria-hidden":"true",children:"esc"})]}),o.jsx("ul",{ref:x,id:A,role:"listbox","aria-label":h("palette.resultsLabel"),className:Ue.list,children:H.map((L,I)=>{const B=L.id===(_==null?void 0:_.id);return o.jsx("li",{role:"option",id:`${A}-option-${L.id}`,"aria-selected":B,children:o.jsxs("button",{type:"button","data-palette-index":I,className:[Ue.row,B?Ue.active:""].join(" ").trim(),onMouseEnter:()=>k(I),onClick:()=>d(L),children:[o.jsx("span",{className:Ue.rowIcon,"aria-hidden":"true",children:o.jsx(ve,{name:L.icon,size:18})}),o.jsxs("span",{className:Ue.rowText,children:[o.jsx("span",{className:Ue.rowTitle,children:L.title}),L.subtitle&&o.jsx("span",{className:Ue.rowSubtitle,children:L.subtitle})]}),L.hint&&o.jsx("span",{className:Ue.keycap,"aria-hidden":"true",children:L.hint})]})},L.id)})}),H.length===0&&o.jsx("div",{className:Ue.empty,children:h("palette.emptyTitle")}),o.jsxs("div",{className:Ue.footer,"aria-hidden":"true",children:[o.jsxs("span",{className:Ue.footerHint,children:[o.jsx("span",{className:Ue.keycap,children:"↑↓"})," ",h("palette.footerNav")]}),o.jsxs("span",{className:Ue.footerHint,children:[o.jsx("span",{className:Ue.keycap,children:"↵"})," ",h("palette.footerChoose")]}),o.jsxs("span",{className:Ue.footerHint,children:[o.jsx("span",{className:Ue.keycap,children:"esc"})," ",h("palette.footerClose")]})]})]})})}const A1="_groups_1gomu_1",I1="_groupTitle_1gomu_13",D1="_list_1gomu_27",O1="_row_1gomu_43",F1="_description_1gomu_69",z1="_note_1gomu_79",Gn={groups:A1,groupTitle:I1,list:D1,row:O1,description:F1,note:z1},B1=[{titleKey:"shortcuts.groupNav",items:[{keys:["g","c"],descKey:"shortcuts.goChat"},{keys:["g","s"],descKey:"shortcuts.goSessions"},{keys:["g","p"],descKey:"shortcuts.goProviders"},{keys:["g","d"],descKey:"shortcuts.goSchedules"},{keys:["g","t"],descKey:"shortcuts.goTasks"},{keys:["g","m"],descKey:"shortcuts.goMemory"},{keys:["g","h"],descKey:"shortcuts.goChannels"},{keys:["g","e"],descKey:"shortcuts.goSettings"},{keys:["g","o"],descKey:"shortcuts.goOnboarding"}]},{titleKey:"shortcuts.groupActions",items:[{keys:["n"],descKey:"shortcuts.newChat"},{keys:["/"],descKey:"shortcuts.focusComposer"},{keys:["j"],descKey:"shortcuts.listNext"},{keys:["k"],descKey:"shortcuts.listPrev"},{keys:["?"],descKey:"shortcuts.openCheatsheet"},{keys:["Esc"],descKey:"shortcuts.closeOverlay"}]}],K1={c:"/",s:"/sessions",p:"/settings/connection",d:"/schedules",t:"/tasks",m:"/memory",e:"/settings",o:"/welcome"},H1=800;function U1(a){return a instanceof HTMLElement?a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement||a.tagName==="SELECT"?!0:a.isContentEditable:!1}function $1(){const a=document.querySelector("[data-chat-input]");a==null||a.focus()}function bd(a){const i=document.activeElement,c=(i instanceof HTMLElement?i.closest("[data-nav-list]"):null)??document.querySelector("[data-nav-list]");if(!(c instanceof HTMLElement))return;const d=Array.from(c.querySelectorAll("[data-nav-item]"));if(d.length===0)return;const h=i instanceof HTMLElement?d.indexOf(i):-1,m=h===-1?a===1?0:d.length-1:(h+a+d.length)%d.length,f=d[m];f==null||f.focus()}function V1({navigate:a,onCheatsheet:i}){const[c,d]=p.useState(!1),h=p.useRef(null),m=p.useRef(a),f=p.useRef(i);m.current=a,f.current=i;const y=p.useCallback(()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null),d(!1)},[]);return p.useEffect(()=>{const k={current:!1},N=()=>{k.current=!0,d(!0),h.current=window.setTimeout(()=>{k.current=!1,h.current=null,d(!1)},H1)},x=j=>{if(j.metaKey||j.ctrlKey||j.altKey||U1(document.activeElement)||document.querySelector('[role="dialog"]'))return;const A=j.key;if(k.current){const H=A.toLowerCase(),_=K1[H];if(H==="g"){y(),N(),j.preventDefault();return}y(),_!==void 0&&(m.current(_),j.preventDefault());return}if(A==="?"){j.preventDefault(),f.current();return}if(A==="g"||A==="G"){N(),j.preventDefault();return}if(A==="n"||A==="N"){m.current("/"),j.preventDefault();return}if(A==="/"){$1(),j.preventDefault();return}if(A==="j"||A==="J"){bd(1);return}if(A==="k"||A==="K"){bd(-1);return}};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x),h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[y]),{awaitingChord:c}}function W1({open:a,onClose:i}){const{t:c}=Be();return o.jsxs(Qn,{open:a,onClose:i,title:c("shortcuts.title"),children:[o.jsx("div",{className:Gn.groups,children:B1.map(d=>o.jsxs("section",{className:Gn.group,children:[o.jsx("h3",{className:Gn.groupTitle,children:c(d.titleKey)}),o.jsx("ul",{className:Gn.list,children:d.items.map(h=>o.jsxs("li",{className:Gn.row,children:[o.jsx("span",{className:Gn.description,children:c(h.descKey)}),o.jsx(ah,{keys:h.keys})]},h.descKey))})]},d.titleKey))}),o.jsx("p",{className:Gn.note,children:c("shortcuts.note")})]})}const G1="_pendingHint_y36pa_9",q1="_pendingText_y36pa_43",Ld={pendingHint:G1,pendingText:q1},rl="boombot:open-shortcuts";function Q1(){const a=sn(),[i,c]=p.useState(!1),d=p.useCallback(()=>c(!0),[]),h=p.useCallback(()=>c(!1),[]),{awaitingChord:m}=V1({navigate:a,onCheatsheet:d});return p.useEffect(()=>{const f=()=>c(!0);return window.addEventListener(rl,f),()=>window.removeEventListener(rl,f)},[]),o.jsxs(o.Fragment,{children:[m&&o.jsxs("div",{className:Ld.pendingHint,role:"status","aria-live":"polite",children:[o.jsx(ah,{keys:["g"]}),o.jsx("span",{className:Ld.pendingText,children:"đang chờ phím…"})]}),o.jsx(W1,{open:i,onClose:h})]})}const X1=p.createContext(null);function Y1({children:a}){const[i,c]=p.useState(!1),[d,h]=p.useState(""),m=sn(),{pathname:f}=Rt(),{t:y}=Be(),{client:k,baseUrl:N,saveCredentials:x}=Mn(),{push:j}=Yn(),A=p.useCallback((L="")=>{h(L),c(!0)},[]),H=p.useCallback(()=>c(!1),[]),_=p.useCallback(()=>{window.dispatchEvent(new CustomEvent(rl))},[]);p.useEffect(()=>{const L=I=>{if((I.metaKey||I.ctrlKey)&&I.key.toLowerCase()==="k"){I.preventDefault(),c(B=>!B);return}I.key==="Escape"&&i&&H()};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[i,H]);const C=p.useMemo(()=>{const L=v1(y);return/^\/chat\/[^/?#]+/.test(f)?L:L.filter(B=>B.id!=="session-delete")},[y,f]),M=p.useCallback(L=>{const I={navigate:m,client:k,openShortcuts:_,toast:j,pathname:f,saveCredentials:x,baseUrl:N};H(),Promise.resolve().then(()=>L.run(I)).catch(B=>{j({tone:"error",title:y("palette.failedToast"),message:B instanceof Error?B.message:void 0})})},[m,k,_,j,f,x,N,H,y]),R=p.useMemo(()=>({openPalette:A,openShortcuts:_}),[A,_]);return o.jsxs(X1.Provider,{value:R,children:[a,i&&o.jsx(P1,{actions:C,initialQuery:d,onClose:H,onRun:M})]})}function Md(a){return new Promise(i=>setTimeout(i,a))}async function ih(a,i,c=15e3){const d=a();await i();const h=Date.now();let m=a();for(;m===d&&Date.now()-h<2e3;)await Md(100),m=a();const f=m??d;if(!f)throw new Error("Không khởi tạo được gateway client");return await Promise.race([f.health(),Md(c).then(()=>{throw new Error("Hết thời gian chờ phản hồi từ gateway")})])}function ol(a){const i=a.trim();if(i==="")return null;try{const c=new URL(i);return c.protocol!=="http:"&&c.protocol!=="https:"?"URL phải bắt đầu bằng http:// hoặc https://":null}catch{return"URL không hợp lệ — ví dụ: http://localhost:8787"}}const Z1="_page_1838v_7",J1="_stepper_1838v_26",ev="_step_1838v_26",tv="_dot_1838v_43",nv="_stepLabel_1838v_63",rv="_current_1838v_68",ov="_done_1838v_79",av="_progress_1838v_89",sv="_progressBar_1838v_96",iv="_stepBody_1838v_108",lv="_slideFwd_1838v_146",cv="_slideBack_1838v_150",uv="_owlMark_1838v_154",dv="_heading_1838v_161",hv="_lead_1838v_177",fv="_note_1838v_185",pv="_actions_1838v_202",mv="_form_1838v_217",gv="_keyRow_1838v_226",vv="_keyGrow_1838v_232",yv="_testRow_1838v_237",wv="_healthLine_1838v_244",kv="_mono_1838v_251",xv="_okIcon_1838v_257",_v="_errIcon_1838v_262",Cv="_errText_1838v_267",Sv="_hintCenter_1838v_271",jv="_successCheck_1838v_279",Tv="_summary_1838v_290",ke={page:Z1,stepper:J1,step:ev,dot:tv,stepLabel:nv,current:rv,done:ov,progress:av,progressBar:sv,stepBody:iv,slideFwd:lv,slideBack:cv,owlMark:uv,heading:dv,lead:hv,note:fv,actions:pv,form:mv,keyRow:gv,keyGrow:vv,testRow:yv,healthLine:wv,mono:kv,okIcon:xv,errIcon:_v,errText:Cv,hintCenter:Sv,successCheck:jv,summary:Tv};function Ev(){return o.jsxs("svg",{viewBox:"0 0 48 48",className:ke.owlMark,fill:"none",stroke:"currentColor",strokeWidth:2.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"24",cy:"24",r:"17"}),o.jsx("circle",{cx:"17.5",cy:"21",r:"4.2"}),o.jsx("circle",{cx:"30.5",cy:"21",r:"4.2"}),o.jsx("circle",{cx:"17.5",cy:"21",r:"1.2",fill:"currentColor"}),o.jsx("circle",{cx:"30.5",cy:"21",r:"1.2",fill:"currentColor"}),o.jsx("path",{d:"M21 30.5 24 28l3 2.5"})]})}function Nv(){const a=sn(),{t:i}=Be(),c=Mn(),d=Yn(),h=p.useRef(c.client);h.current=c.client;const m=[i("onboarding.stepWelcome"),i("onboarding.stepConnect"),i("onboarding.stepDone")],[f,y]=p.useState(0),[k,N]=p.useState(1),[x,j]=p.useState(c.baseUrl),[A,H]=p.useState(""),[_,C]=p.useState(!1),[M,R]=p.useState(null),[L,I]=p.useState(null),[B,ue]=p.useState(!1),[q,pe]=p.useState(null),re=p.useRef(null),te=W=>{N(W>f?1:-1),y(W)};p.useEffect(()=>{var W;(W=re.current)==null||W.focus()},[f]);const oe=W=>(q==null?void 0:q.ok)===!0,xe=async W=>{W.preventDefault();const me=ol(x);R(me);const je=!c.apiKeySaved&&A.trim()===""?i("onboarding.keyRequired"):null;if(I(je),!(me||je)){ue(!0),pe(null);try{const _e=await ih(()=>h.current,()=>c.saveCredentials(x.trim(),A.trim()));pe(_e),_e.ok&&d.push({tone:"success",title:i("onboarding.testOkToast")})}catch(_e){pe({ok:!1,error:_e instanceof Error?_e.message:i("onboarding.testFailDefault")})}finally{ue(!1)}}},Z=k===1?ke.slideFwd:ke.slideBack;return o.jsxs("div",{className:ke.page,children:[o.jsx(Ug,{title:i("onboarding.title"),subtitle:i("onboarding.subtitle")}),o.jsx("ol",{className:ke.stepper,"aria-label":i("onboarding.stepperAria"),children:m.map((W,me)=>{const Ne=me<f,je=me===f;return o.jsxs("li",{className:`${ke.step} ${Ne?ke.done:""} ${je?ke.current:""}`,"aria-current":je?"step":void 0,children:[o.jsx("span",{className:ke.dot,"aria-hidden":"true",children:Ne?o.jsx(ve,{name:"check",size:14}):o.jsx("span",{children:me+1})}),o.jsx("span",{className:ke.stepLabel,children:W})]},W)})}),o.jsx("div",{className:ke.progress,"aria-hidden":"true",children:o.jsx("div",{className:ke.progressBar,style:{transform:`scaleX(${(f+1)/m.length})`}})}),o.jsxs("div",{className:`${ke.stepBody} ${Z}`,children:[f===0&&o.jsxs("section",{"aria-labelledby":"ob-welcome",children:[o.jsx(Ev,{}),o.jsx("h2",{id:"ob-welcome",ref:re,tabIndex:-1,className:ke.heading,children:i("onboarding.welcomeHeading")}),o.jsx("p",{className:ke.lead,children:i("onboarding.welcomeLead")}),c.apiKeySaved&&o.jsxs("p",{className:ke.note,children:[o.jsx(ve,{name:"info",size:14}),i("onboarding.existingNote")]}),o.jsxs("div",{className:ke.actions,children:[o.jsxs(fe,{variant:"primary",onClick:()=>te(1),size:"lg",children:[i("onboarding.start"),o.jsx(ve,{name:"chevron-right",size:18})]}),c.apiKeySaved&&o.jsx(fe,{variant:"ghost",onClick:()=>a("/"),children:i("onboarding.skipToApp")})]})]}),f===1&&o.jsxs("section",{"aria-labelledby":"ob-connect",children:[o.jsx("h2",{id:"ob-connect",ref:re,tabIndex:-1,className:ke.heading,children:i("onboarding.connectHeading")}),o.jsx("p",{className:ke.lead,children:i("onboarding.connectLead")}),o.jsxs("form",{onSubmit:W=>void xe(W),noValidate:!0,className:ke.form,children:[o.jsx(_t,{label:i("onboarding.urlLabel"),value:x,onChange:W=>{j(W.target.value),M&&R(null),q&&pe(null)},onBlur:()=>R(ol(x)),error:M??void 0,hint:i("onboarding.urlHint"),placeholder:"http://localhost:8787",inputMode:"url",autoComplete:"url"}),o.jsxs("div",{className:ke.keyRow,children:[o.jsx("div",{className:ke.keyGrow,children:o.jsx(_t,{label:c.apiKeySaved?i("onboarding.keyLabelExisting"):i("onboarding.keyLabel"),type:_?"text":"password",value:A,onChange:W=>{H(W.target.value),L&&I(null),q&&pe(null)},error:L??void 0,hint:i("onboarding.keyHint"),placeholder:i("onboarding.keyPlaceholder"),autoComplete:"off"})}),o.jsx(Xn,{icon:_?"eye-off":"eye","aria-label":i(_?"onboarding.hideKeyAria":"onboarding.showKeyAria"),onClick:()=>C(W=>!W)})]}),o.jsxs("div",{className:ke.testRow,children:[o.jsx(fe,{type:"submit",variant:"secondary",loading:B,children:i("onboarding.test")}),q&&o.jsx("span",{className:ke.healthLine,role:"status",children:q.ok?o.jsxs(o.Fragment,{children:[o.jsx(ve,{name:"check",size:16,className:ke.okIcon}),o.jsxs("code",{className:ke.mono,children:[i("onboarding.connectedOk"),q.version?` · v${q.version}`:"",typeof q.wireVersion=="number"?` · wire v${q.wireVersion}`:""]})]}):o.jsxs(o.Fragment,{children:[o.jsx(ve,{name:"warn",size:16,className:ke.errIcon}),o.jsx("span",{className:ke.errText,children:q.error??i("onboarding.unreachable")})]})})]})]}),o.jsxs("div",{className:ke.actions,children:[o.jsxs(fe,{variant:"ghost",onClick:()=>te(0),children:[o.jsx(ve,{name:"arrow-left",size:18}),i("onboarding.back")]}),o.jsxs(fe,{variant:"primary",onClick:()=>te(2),disabled:!oe(),children:[i("onboarding.next"),o.jsx(ve,{name:"chevron-right",size:18})]})]}),!oe()&&o.jsx("p",{className:ke.hintCenter,children:i("onboarding.testFirstHint")})]}),f===2&&o.jsxs("section",{"aria-labelledby":"ob-done",children:[o.jsx("span",{className:ke.successCheck,"aria-hidden":"true",children:o.jsx(ve,{name:"check",size:26})}),o.jsx("h2",{id:"ob-done",ref:re,tabIndex:-1,className:ke.heading,children:i("onboarding.doneHeading")}),o.jsxs("dl",{className:ke.summary,children:[o.jsxs("div",{children:[o.jsx("dt",{children:i("onboarding.summaryUrl")}),o.jsx("dd",{className:ke.mono,children:x.trim()===""?i("onboarding.sameOrigin"):x.trim()})]}),o.jsxs("div",{children:[o.jsx("dt",{children:i("onboarding.summaryKey")}),o.jsx("dd",{className:ke.mono,children:i("onboarding.summaryKeySaved")})]}),(q==null?void 0:q.version)&&o.jsxs("div",{children:[o.jsx("dt",{children:i("onboarding.summaryVersion")}),o.jsxs("dd",{className:ke.mono,children:["v",q.version,typeof q.wireVersion=="number"&&` · wire v${q.wireVersion}`]})]})]}),o.jsxs("div",{className:ke.actions,children:[o.jsxs(fe,{variant:"ghost",onClick:()=>te(1),children:[o.jsx(ve,{name:"arrow-left",size:18}),i("onboarding.back")]}),o.jsxs(fe,{variant:"primary",size:"lg",onClick:()=>a("/"),children:[i("onboarding.enterApp"),o.jsx(ve,{name:"chevron-right",size:18})]})]})]})]},f)]})}const lh="boombot.theme",ch="(prefers-color-scheme: dark)";function bv(){try{const a=localStorage.getItem(lh);if(a==="dark"||a==="light"||a==="system")return a}catch{}return"dark"}function Lv(){return typeof window<"u"&&window.matchMedia(ch).matches}const uh=p.createContext(null);function Mv(){const a=p.useContext(uh);if(!a)throw new Error("useTheme phải dùng trong <ThemeProvider>");return a}function Rv({children:a}){const[i,c]=p.useState(bv),[d,h]=p.useState(Lv);p.useEffect(()=>{const k=window.matchMedia(ch),N=x=>{h(x.matches)};return k.addEventListener("change",N),()=>k.removeEventListener("change",N)},[]);const m=i==="system"?d?"dark":"light":i;p.useEffect(()=>{document.documentElement.dataset.theme=m},[m]);const f=p.useCallback(k=>{c(k);try{localStorage.setItem(lh,k)}catch{}},[]),y=p.useMemo(()=>({mode:i,setMode:f,resolved:m}),[i,f,m]);return o.jsx(uh.Provider,{value:y,children:a})}function Pv(a,i){try{return localStorage.getItem(a)??i}catch{return i}}function Av(a,i){try{localStorage.setItem(a,i)}catch{}}const jo={density:"boombot.uiDensity",motion:"boombot.motion",chatFont:"boombot.chatFont",transcriptWidth:"boombot.transcriptWidth"},To={density:"comfortable",motion:"system",chatFont:"sans",transcriptWidth:"medium"},Iv=["comfortable","compact"],Dv=["sans","system","mono"],Ov=["narrow","medium","wide"],Fv=["system","reduced"];function Wa(a,i,c){const d=Pv(a,c);return i.includes(d)?d:c}function zv(){return{density:Wa(jo.density,Iv,To.density),motion:Wa(jo.motion,Fv,To.motion),chatFont:Wa(jo.chatFont,Dv,To.chatFont),transcriptWidth:Wa(jo.transcriptWidth,Ov,To.transcriptWidth)}}const Bv={...To,set:()=>{}},dh=p.createContext(Bv);function hh(){return p.useContext(dh)}function Kv({children:a}){const[i,c]=p.useState(zv),d=p.useCallback((m,f)=>{Av(jo[m],String(f)),c(y=>({...y,[m]:f}))},[]);p.useEffect(()=>{document.documentElement.dataset.uiDensity=i.density},[i.density]),p.useEffect(()=>{document.documentElement.dataset.chatFont=i.chatFont},[i.chatFont]),p.useEffect(()=>{document.documentElement.dataset.transcriptWidth=i.transcriptWidth},[i.transcriptWidth]),p.useEffect(()=>{const m=document.documentElement;i.motion==="reduced"?m.dataset.motion="reduced":delete m.dataset.motion},[i.motion]);const h=p.useMemo(()=>({...i,set:d}),[i,d]);return o.jsx(dh.Provider,{value:h,children:o.jsx(pg,{value:i.motion,children:a})})}const Hv="_page_granl_10",Uv="_card_granl_38",$v="_sectionHead_granl_61",Vv="_sectionIcon_granl_67",Wv="_sectionTitle_granl_79",Gv="_sectionHint_granl_86",qv="_paneHeader_granl_95",Qv="_paneTitle_granl_99",Xv="_paneSubtitle_granl_106",Yv="_statusRow_granl_115",Zv="_connError_granl_122",Jv="_fieldGrow_granl_133",e0="_keyFieldRow_granl_138",t0="_urlRow_granl_152",n0="_urlHint_granl_164",r0="_actions_granl_171",o0="_savedKeyRow_granl_182",a0="_maskedKey_granl_198",s0="_prefRow_granl_206",i0="_prefText_granl_220",l0="_prefLabel_granl_227",c0="_prefHint_granl_233",u0="_settingRow_granl_243",d0="_settingMain_granl_267",h0="_settingLabel_granl_274",f0="_settingHint_granl_288",p0="_settingControl_granl_294",m0="_serverGrid_granl_304",g0="_serverKey_granl_315",v0="_serverValue_granl_320",y0="_serverSnippet_granl_328",w0="_testResult_granl_349",k0="_mono_granl_358",x0="_testError_granl_364",_0="_footnote_granl_372",C0="_modalText_granl_394",ce={page:Hv,card:Uv,sectionHead:$v,sectionIcon:Vv,sectionTitle:Wv,sectionHint:Gv,paneHeader:qv,paneTitle:Qv,paneSubtitle:Xv,statusRow:Yv,connError:Zv,fieldGrow:Jv,keyFieldRow:e0,urlRow:t0,urlHint:n0,actions:r0,savedKeyRow:o0,maskedKey:a0,prefRow:s0,prefText:i0,prefLabel:l0,prefHint:c0,settingRow:u0,settingMain:d0,settingLabel:h0,settingHint:f0,settingControl:p0,serverGrid:m0,serverKey:g0,serverValue:v0,serverSnippet:y0,testResult:w0,mono:k0,testError:x0,footnote:_0,modalText:C0},S0="~/.boombot/config.json";function Lt({label:a,hint:i,children:c,status:d="real"}){const{t:h}=Be();return o.jsxs("div",{className:ce.settingRow,"data-status":d,children:[o.jsxs("div",{className:ce.settingMain,children:[o.jsxs("span",{className:ce.settingLabel,children:[a,d==="soon"&&o.jsx(gt,{tone:"muted",children:h("settings.statusSoon")})]}),i!==void 0&&o.jsx("span",{className:ce.settingHint,children:i})]}),c!==void 0&&o.jsx("div",{className:ce.settingControl,children:c})]})}function Xi({label:a,hint:i,envKey:c,configPath:d,allowed:h,defaultValue:m,snippet:f}){const{t:y}=Be(),k=Yn(),N=()=>{const x=typeof navigator>"u"?void 0:navigator.clipboard;if(typeof(x==null?void 0:x.writeText)!="function"){k.push({tone:"warn",title:y("settings.serverCopyFail")});return}x.writeText(f).then(()=>k.push({tone:"success",title:y("settings.serverCopiedToast")}),()=>k.push({tone:"warn",title:y("settings.serverCopyFail")}))};return o.jsxs("div",{className:ce.settingRow,"data-status":"server",children:[o.jsxs("div",{className:ce.settingMain,children:[o.jsxs("span",{className:ce.settingLabel,children:[a,o.jsx(gt,{tone:"info",children:y("settings.statusServer")})]}),i!==void 0&&o.jsx("span",{className:ce.settingHint,children:i})]}),o.jsxs("div",{className:ce.serverGrid,children:[o.jsx("span",{className:ce.serverKey,children:y("settings.serverEnvLabel")}),o.jsx("code",{className:ce.serverValue,children:c}),d!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:ce.serverKey,children:y("settings.serverConfigLabel")}),o.jsx("code",{className:ce.serverValue,children:d})]}),o.jsx("span",{className:ce.serverKey,children:y("settings.serverFileLabel")}),o.jsx("code",{className:ce.serverValue,children:S0}),h!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:ce.serverKey,children:y("settings.serverAllowedLabel")}),o.jsx("code",{className:ce.serverValue,children:h.join(" | ")})]}),o.jsx("span",{className:ce.serverKey,children:y("settings.serverDefaultLabel")}),o.jsx("code",{className:ce.serverValue,children:m})]}),o.jsxs("div",{className:ce.serverSnippet,children:[o.jsx("code",{children:f}),o.jsx(Xn,{icon:"copy","aria-label":`${y("settings.serverCopy")}: ${a}`,onClick:N})]}),o.jsxs("p",{className:ce.footnote,children:[o.jsx(ve,{name:"info",size:14}),y("settings.serverRestartNote")]})]})}function Mt({icon:a,title:i,hint:c,children:d}){const h=i!==void 0||c!==void 0;return o.jsxs("section",{className:ce.card,children:[h&&o.jsxs("div",{className:ce.sectionHead,children:[a!==void 0&&o.jsx("span",{className:ce.sectionIcon,children:o.jsx(ve,{name:a,size:18})}),o.jsxs("div",{children:[i!==void 0&&o.jsx("h2",{className:ce.sectionTitle,children:i}),c!==void 0&&o.jsx("p",{className:ce.sectionHint,children:c})]})]}),d]})}function j0(){const{t:a}=Be(),{mode:i,setMode:c}=Mv(),{density:d,motion:h,chatFont:m,set:f}=hh(),y=[{value:"dark",label:a("settings.themeDark"),icon:"moon"},{value:"light",label:a("settings.themeLight"),icon:"sun"},{value:"system",label:a("settings.themeSystem"),icon:"monitor"}],k=[{value:"comfortable",label:a("settings.densityComfortable")},{value:"compact",label:a("settings.densityCompact")}],N=[{value:"system",label:a("settings.motionSystem")},{value:"reduced",label:a("settings.motionReduced")}],x=[{value:"sans",label:a("settings.fontSans")},{value:"system",label:a("settings.fontSystem")},{value:"mono",label:a("settings.fontMono")}];return o.jsx("div",{children:o.jsxs(Mt,{children:[o.jsx(Lt,{label:a("settings.themeLabel"),hint:a("settings.themeHint"),children:o.jsx(Bt,{ariaLabel:a("settings.themeLabel"),iconOnly:!0,options:y,value:i,onChange:c})}),o.jsx(Lt,{label:a("settings.densityLabel"),hint:a("settings.densityHint"),children:o.jsx(Bt,{ariaLabel:a("settings.densityAria"),options:k,value:d,onChange:j=>f("density",j)})}),o.jsx(Lt,{label:a("settings.fontLabel"),hint:a("settings.fontHint"),children:o.jsx(Bt,{ariaLabel:a("settings.fontLabel"),options:x,value:m,onChange:j=>f("chatFont",j)})}),o.jsx(Lt,{label:a("settings.motionLabel"),hint:a("settings.motionHint"),children:o.jsx(Bt,{ariaLabel:a("settings.motionLabel"),options:N,value:h,onChange:j=>f("motion",j)})})]})})}function T0(){const{t:a}=Be(),{chatFont:i,transcriptWidth:c,set:d}=hh(),h=[{value:"sans",label:a("settings.fontSans")},{value:"system",label:a("settings.fontSystem")},{value:"mono",label:a("settings.fontMono")}],m=[{value:"narrow",label:a("settings.widthNarrow")},{value:"medium",label:a("settings.widthMedium")},{value:"wide",label:a("settings.widthWide")}];return o.jsx("div",{children:o.jsxs(Mt,{icon:"chat",title:a("settings.sectionChat"),hint:a("settings.sectionChatHint"),children:[o.jsx(Lt,{label:a("settings.chatFontLabel"),hint:a("settings.chatFontHint"),children:o.jsx(Bt,{ariaLabel:a("settings.chatFontLabel"),options:h,value:i,onChange:f=>d("chatFont",f)})}),o.jsx(Lt,{label:a("settings.transcriptWidthLabel"),hint:a("settings.transcriptWidthHint"),children:o.jsx(Bt,{ariaLabel:a("settings.transcriptWidthLabel"),options:m,value:c,onChange:f=>d("transcriptWidth",f)})})]})})}const E0="_enterStagger_s1e1t_23",N0="_sectionActions_s1e1t_29",b0="_grid_s1e1t_36",L0="_card_s1e1t_42",M0="_cardHead_s1e1t_49",R0="_brandMark_s1e1t_56",P0="_cardTitle_s1e1t_68",A0="_kind_s1e1t_81",I0="_blurb_s1e1t_87",D0="_cardActions_s1e1t_95",O0="_skeletonCard_s1e1t_105",F0="_centerRow_s1e1t_112",z0="_inlineError_s1e1t_127",B0="_pairBody_s1e1t_142",K0="_codeRow_s1e1t_148",H0="_pairCode_s1e1t_159",U0="_steps_s1e1t_168",$0="_stepNum_s1e1t_183",V0="_pollStatus_s1e1t_211",W0="_linkButton_s1e1t_231",G0="_successCheck_s1e1t_246",q0="_connectForm_s1e1t_259",Q0="_oauthWaiting_s1e1t_260",X0="_callbackUrl_s1e1t_273",Y0="_connectWarning_s1e1t_277",Z0="_connectActions_s1e1t_286",J0="_connectError_s1e1t_292",ey="_qrCode_s1e1t_301",ty="_unpairBody_s1e1t_311",ny="_brandContainer_s1e1t_351",ry="_brandGlow_s1e1t_377",oy="_cardConnected_s1e1t_393",we={enterStagger:E0,sectionActions:N0,grid:b0,card:L0,cardHead:M0,brandMark:R0,cardTitle:P0,kind:A0,blurb:I0,cardActions:D0,skeletonCard:O0,centerRow:F0,inlineError:z0,pairBody:B0,codeRow:K0,pairCode:H0,steps:U0,stepNum:$0,pollStatus:V0,linkButton:W0,successCheck:G0,connectForm:q0,oauthWaiting:Q0,callbackUrl:X0,connectWarning:Y0,connectActions:Z0,connectError:J0,qrCode:ey,unpairBody:ty,brandContainer:ny,brandGlow:ry,cardConnected:oy},ay={telegram:"channels.blurbTelegram",whatsapp:"channels.blurbWhatsapp",discord:"channels.blurbDiscord",slack:"channels.blurbSlack",zalo:"channels.blurbZalo"},Rd=["telegram","zalo","whatsapp","discord","slack","messenger","tiktok"];function sy(a,i){switch(a.status){case"connected":return{tone:"accent",label:i("channels.statusConnected")};case"pending":return{tone:"warn",label:i("channels.statusPending")};case"error":return{tone:"danger",label:i("channels.statusError")};default:return{tone:"muted",label:a.configured?i("channels.statusConfigured"):i("channels.statusNotConfigured")}}}const Pd=3e3,iy=100;function ly(){const a=sn(),{t:i}=Be(),{client:c}=Mn(),d=Yn(),[h,m]=p.useState(null),[f,y]=p.useState(!0),[k,N]=p.useState(null),[x,j]=p.useState(null),[A,H]=p.useState(!1),[_,C]=p.useState(null),[M,R]=p.useState(!1),[L,I]=p.useState(0),[B,ue]=p.useState(null),[q,pe]=p.useState(""),[re,te]=p.useState(null),[oe,xe]=p.useState(!1),[Z,W]=p.useState(null),[me,Ne]=p.useState(""),[je,_e]=p.useState(""),[$,ae]=p.useState(""),[V,S]=p.useState("oa"),[D,P]=p.useState(!1),[U,X]=p.useState(null),[he,Ce]=p.useState(null),[ge,be]=p.useState(null),[Ve,Rn]=p.useState(!1),Pr=p.useRef(null);Pr.current=x;const Ze=p.useCallback(async()=>{if(!c){y(!1);return}y(!0),N(null);try{const Se=[...await c.channelsList()].sort((Me,Ct)=>{const vt=Rd.indexOf(Me.kind),at=Rd.indexOf(Ct.kind);return(vt===-1?99:vt)-(at===-1?99:at)});m(Se)}catch(ne){N(ne instanceof Error?ne.message:i("channels.loadError"))}finally{y(!1)}},[c,i]);p.useEffect(()=>{Ze()},[Ze]);const Kt=p.useCallback(async ne=>{if(c){C(null),R(!1),I(0),H(!0);try{const{code:Se}=await c.channelsPair(ne.kind);j({channel:ne,code:Se,startedAt:Date.now(),done:!1})}catch(Se){C(Se instanceof Error?Se.message:i("channels.pairCreateError"))}finally{H(!1)}}},[c,i]),Zn=p.useCallback(()=>{j(null),C(null),R(!1),H(!1)},[]);p.useEffect(()=>{if(!x||x.done)return;const ne=window.setInterval(()=>{I(Math.floor((Date.now()-x.startedAt)/1e3))},1e3);return()=>window.clearInterval(ne)},[x]),p.useEffect(()=>{if(!x||x.done||!c)return;let ne=0,Se=!1;const Me=window.setInterval(async()=>{ne+=1;try{const Ct=await c.channelsList();if(Se)return;const vt=Ct.find(at=>at.id===x.channel.id);vt&&vt.status==="connected"?(window.clearInterval(Me),j(at=>at&&{...at,done:!0}),d.push({tone:"success",title:i("channels.pairedToast",{name:x.channel.name})}),Ze()):ne>=iy&&(window.clearInterval(Me),Se||R(!0))}catch{}},Pd);return()=>{Se=!0,window.clearInterval(Me)}},[x,c,Ze,d,i]);const Ro=p.useCallback(async()=>{var Se;const ne=(Se=Pr.current)==null?void 0:Se.code;if(ne)try{await navigator.clipboard.writeText(ne),d.push({tone:"success",title:i("channels.copiedToast")})}catch{const Me=document.createElement("textarea");Me.value=ne,document.body.appendChild(Me),Me.select();try{document.execCommand("copy"),d.push({tone:"success",title:i("channels.copiedToast")})}catch{d.push({tone:"error",title:i("channels.copyFailToast")})}document.body.removeChild(Me)}},[d,i]),Ar=p.useCallback(ne=>{W(ne),Ne(""),_e(""),ae(""),S("oa"),X(null),Ce(null),be(null),Rn(!1)},[]),Jn=p.useCallback(()=>{D||(W(null),Ce(null),be(null),X(null))},[D]),er=p.useCallback(async(ne="web")=>{if(!c||!Z)return;X(null),P(!0);let Se=null;Z.kind==="zalo"&&V==="oa"&&ne==="web"&&(Se=window.open("about:blank","boombot-zalo-oauth","popup,width=520,height=720"));try{const Me=Z.kind==="telegram"?await c.channelsConnect({channel:"telegram",botToken:me.trim()}):await c.channelsConnect(V==="personal"?{channel:"zalo",mode:"personal"}:{channel:"zalo",mode:"oa",appId:je.trim()||void 0,appSecret:$.trim()||void 0,redirectUri:new URL("/v1/channels/zalo/oauth/callback",c.baseUrl||window.location.origin).toString()});if(Me.status==="connected"){W(null),await Ze(),Z.kind==="telegram"&&await Kt(Z);return}if(Me.status==="qr_required"){Se==null||Se.close(),be(Me.qrDataUrl);return}if(Ce(Me.authorizationUrl),ne==="web"&&Se)Se.location.href=Me.authorizationUrl;else if(ne==="qr"){const{default:Ct}=await Lr(async()=>{const{default:vt}=await import("./browser-BfCCGa0f.js").then(at=>at.b);return{default:vt}},[]);be(await Ct.toDataURL(Me.authorizationUrl,{width:240,margin:1}))}}catch(Me){Se==null||Se.close(),X(Me instanceof Error?Me.message:i("channels.connectFail"))}finally{P(!1)}},[me,c,Z,Ze,Kt,i,je,$,V]);p.useEffect(()=>{if(!he&&!ge||!Z||!c||Ve)return;const ne=window.setInterval(async()=>{try{const Se=(await c.channelsList()).find(Me=>Me.kind===Z.kind);if((Se==null?void 0:Se.status)!=="connected")return;window.clearInterval(ne),Rn(!0),d.push({tone:"success",title:i("channels.connectedToast",{name:Z.name})}),Ze(),Z.kind==="zalo"&&V==="personal"&&(W(null),Kt(Z))}catch{}},Pd);return()=>window.clearInterval(ne)},[he,c,Ve,Z,Ze,Kt,ge,i,d,V]);const Pn=p.useCallback(ne=>{ue(ne),pe(""),te(null)},[]),Qt=p.useCallback(()=>{oe||(ue(null),pe(""),te(null))},[oe]),Ir=p.useCallback(async()=>{if(!B||!c)return;const ne=q.trim();if(ne===""){te(i("channels.unpairRequired"));return}xe(!0),te(null);try{await c.channelsUnpair(B.kind,ne),d.push({tone:"success",title:i("channels.unpairedToast",{name:B.name})}),ue(null),pe(""),Ze()}catch(Se){te(Se instanceof Error?Se.message:i("channels.unpairFailDefault"))}finally{xe(!1)}},[c,B,q,d,Ze,i]);return c?o.jsxs(Mt,{icon:"channels",title:i("settings.sectionChannels"),hint:i("settings.sectionChannelsHint"),children:[o.jsx("div",{className:we.sectionActions,children:o.jsx(fe,{variant:"secondary",onClick:()=>void Ze(),disabled:f,children:i("channels.reload")})}),f&&o.jsx("div",{className:we.grid,"aria-busy":"true","aria-label":i("channels.loadingAria"),children:[0,1,2,3].map(ne=>o.jsx(Eo,{variant:"rect",className:we.skeletonCard},ne))}),k&&!f&&o.jsx(Nr,{icon:"warn",title:i("channels.loadErrorTitle"),message:k,action:o.jsx(fe,{variant:"secondary",onClick:()=>void Ze(),children:i("channels.reload")})}),h&&!f&&!k&&o.jsx("div",{className:we.grid,children:h.map((ne,Se)=>{const Me=sy(ne,i),Ct=ne.status==="connected",vt=ne.status==="pending";return o.jsxs(sg,{className:`${we.card} ${we.enterStagger} ${Ct?we.cardConnected:""}`,style:{"--i":Math.min(Se,7)},children:[o.jsxs("div",{className:we.cardHead,children:[o.jsxs("div",{className:we.brandContainer,children:[o.jsx("div",{className:we.brandGlow,style:{backgroundColor:`var(--brand-${ne.kind}, var(--color-accent))`}}),o.jsx("span",{className:we.brandMark,children:o.jsx(Jm,{kind:ne.kind,size:28})})]}),o.jsxs("div",{className:we.cardTitle,children:[o.jsx("h2",{children:ne.name}),o.jsx("span",{className:we.kind,children:ne.kind})]}),o.jsxs(gt,{tone:Me.tone,children:[o.jsx("span",{className:vt?"status-dot status-dot--pulse":"status-dot","aria-hidden":"true"}),Me.label]})]}),o.jsx("p",{className:we.blurb,children:i(ay[ne.kind]??"channels.blurbGeneric")}),o.jsx("div",{className:we.cardActions,children:Ct&&ne.kind==="telegram"?o.jsx(fe,{variant:"secondary",onClick:()=>Pn(ne),children:i("channels.unpairBtn")}):Ct?null:ne.kind==="telegram"||ne.kind==="zalo"?o.jsx(fe,{variant:"primary",onClick:()=>Ar(ne),children:i("channels.connectBtn")}):o.jsx(fe,{variant:"secondary",disabled:!0,children:i("channels.serverConfigBtn")})})]},ne.id)})}),o.jsxs(Qn,{open:Z!==null,onClose:Jn,title:Z?i("channels.connectModalTitle",{name:Z.name}):i("channels.connectBtn"),footer:o.jsx(fe,{variant:"ghost",onClick:Jn,disabled:D,children:i("channels.close")}),children:[Z&&!he&&!ge&&!Ve&&o.jsxs("form",{className:we.connectForm,onSubmit:ne=>{ne.preventDefault(),er("web")},children:[Z.kind==="telegram"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:i("channels.telegramConnectHelp")}),o.jsx("a",{href:"https://t.me/BotFather",target:"_blank",rel:"noreferrer",children:i("channels.openBotFather")}),o.jsx(_t,{label:i("channels.botTokenLabel"),type:"password",value:me,onChange:ne=>Ne(ne.target.value),autoComplete:"off",required:!0}),o.jsx(fe,{type:"submit",variant:"primary",loading:D,disabled:me.trim()==="",children:i("channels.connectBtn")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Bt,{ariaLabel:i("channels.zaloModeLabel"),value:V,onChange:S,options:[{value:"oa",label:i("channels.zaloModeOa")},{value:"personal",label:i("channels.zaloModePersonal")}]}),V==="oa"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:i("channels.zaloConnectHelp")}),o.jsxs("p",{children:[i("channels.zaloCallbackLabel")," ",o.jsx("code",{className:we.callbackUrl,children:new URL("/v1/channels/zalo/oauth/callback",c.baseUrl||window.location.origin).toString()})]}),o.jsx(_t,{label:i("channels.zaloAppIdLabel"),value:je,onChange:ne=>_e(ne.target.value),autoComplete:"off"}),o.jsx(_t,{label:i("channels.zaloAppSecretLabel"),type:"password",value:$,onChange:ne=>ae(ne.target.value),autoComplete:"off"}),o.jsxs("div",{className:we.connectActions,children:[o.jsx(fe,{type:"submit",variant:"primary",loading:D,children:i("channels.connectWebBtn")}),o.jsx(fe,{variant:"secondary",onClick:()=>void er("qr"),disabled:D,children:i("channels.showQrBtn")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:we.connectWarning,children:i("channels.zaloPersonalWarning")}),o.jsx(fe,{type:"submit",variant:"primary",loading:D,children:i("channels.zaloPersonalQrBtn")})]})]}),U&&o.jsx("p",{className:we.connectError,role:"alert",children:U})]}),Z&&(he||ge)&&!Ve&&o.jsxs("div",{className:we.oauthWaiting,role:"status","aria-live":"polite",children:[ge&&o.jsx("img",{className:we.qrCode,src:ge,alt:i(V==="personal"?"channels.personalQrAlt":"channels.qrAlt")}),o.jsx(Ga,{}),o.jsx("p",{children:i("channels.oauthWaiting")}),he&&o.jsx("a",{href:he,target:"_blank",rel:"noreferrer",children:i("channels.openZaloAuth")})]}),Z&&Ve&&o.jsxs("div",{className:we.centerRow,role:"status",children:[o.jsx("span",{className:we.successCheck,children:o.jsx(ve,{name:"check",size:22})}),o.jsx("p",{children:i("channels.connectedToast",{name:Z.name})}),o.jsx(fe,{variant:"primary",onClick:Jn,children:i("channels.done")})]})]}),o.jsxs(Qn,{open:x!==null,onClose:Zn,title:x?i("channels.pairModalTitle",{name:x.channel.name}):i("channels.pairModalGeneric"),footer:x&&!x.done?o.jsx(fe,{variant:"ghost",onClick:Zn,children:i("channels.close")}):void 0,children:[A&&o.jsxs("div",{className:we.centerRow,role:"status",children:[o.jsx(Ga,{}),o.jsx("p",{children:i("channels.creatingCode")})]}),_&&!A&&o.jsxs("div",{className:we.inlineError,role:"alert",children:[o.jsx(ve,{name:"warn",size:18}),o.jsx("p",{children:_}),x&&o.jsx(fe,{variant:"secondary",onClick:()=>void Kt(x.channel),children:i("channels.retry")})]}),x&&!A&&!_&&!x.done&&o.jsxs("div",{className:we.pairBody,children:[o.jsxs("div",{className:we.codeRow,children:[o.jsx("code",{className:we.pairCode,"aria-label":i("channels.codeAria",{code:x.code}),children:x.code}),o.jsx(Xn,{icon:"copy","aria-label":i("channels.copyAria"),onClick:()=>void Ro()})]}),o.jsxs("ol",{className:we.steps,children:[o.jsxs("li",{children:[o.jsx("span",{className:we.stepNum,children:"1"}),o.jsx("p",{children:i("channels.step1",{name:x.channel.name})})]}),o.jsxs("li",{children:[o.jsx("span",{className:we.stepNum,children:"2"}),o.jsxs("p",{children:[i("channels.step2Before")," ",o.jsx("code",{children:x.code})," ",i("channels.step2After")," ",o.jsx("em",{children:i("channels.step2Em")})," ",i("channels.step2Tail")]})]}),o.jsxs("li",{children:[o.jsx("span",{className:we.stepNum,children:"3"}),o.jsx("p",{children:i("channels.step3")})]})]}),o.jsx("div",{className:we.pollStatus,role:"status","aria-live":"polite",children:M?o.jsxs(o.Fragment,{children:[o.jsx(ve,{name:"warn",size:18}),o.jsxs("p",{children:[i("channels.expiredMessage")," ",o.jsx("button",{type:"button",className:we.linkButton,onClick:()=>void Kt(x.channel),children:i("channels.newCode")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ga,{}),o.jsxs("p",{children:[i("channels.waiting"),L>0&&` (${L}s)`]})]})})]}),x&&x.done&&o.jsxs("div",{className:we.centerRow,role:"status",children:[o.jsx("span",{className:we.successCheck,children:o.jsx(ve,{name:"check",size:22})}),o.jsx("p",{children:i("channels.successMessage",{name:x.channel.name})}),o.jsx(fe,{variant:"primary",onClick:Zn,children:i("channels.done")})]})]}),o.jsx(Qn,{open:B!==null,onClose:Qt,title:B?i("channels.unpairModalTitle",{name:B.name}):i("channels.unpairModalGeneric"),footer:o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",onClick:Qt,disabled:oe,children:i("channels.cancelBtn")}),o.jsx(fe,{variant:"danger",onClick:()=>void Ir(),loading:oe,children:i("channels.unpairBtn")})]}),children:B&&o.jsxs("div",{className:we.unpairBody,children:[o.jsx("p",{children:i("channels.unpairBody",{name:B.name})}),o.jsx(_t,{label:i("channels.unpairInputLabel"),value:q,onChange:ne=>{pe(ne.target.value),re&&te(null)},error:re??void 0,hint:i("channels.unpairInputHint"),placeholder:i("channels.unpairInputPh"),inputMode:"numeric",autoComplete:"off"})]})})]}):o.jsx(Mt,{icon:"channels",title:i("settings.sectionChannels"),hint:i("settings.sectionChannelsHint"),children:o.jsx(Nr,{icon:"wifi-off",title:i("channels.notConnectedTitle"),message:i("channels.notConnectedMessage"),action:o.jsx(fe,{variant:"primary",onClick:()=>a("/welcome"),children:i("channels.gotoOnboarding")})})})}const cy="_bar_1h70m_10",uy="_list_1h70m_18",dy="_row_1h70m_23",hy="_info_1h70m_38",fy="_titleRow_1h70m_46",py="_title_1h70m_46",my="_meta_1h70m_61",gy="_mono_1h70m_69",vy="_errorText_1h70m_75",yy="_testResult_1h70m_81",wy="_rowActions_1h70m_89",ky="_skeletons_1h70m_97",xy="_form_1h70m_105",_y="_passwordWrap_1h70m_111",Cy="_passwordToggle_1h70m_115",Sy="_formActions_1h70m_137",jy="_deleteWarn_1h70m_143",Ty="_rowActive_1h70m_198",Ey="_providerLogoBox_1h70m_206",qe={bar:cy,list:uy,row:dy,info:hy,titleRow:fy,title:py,meta:my,mono:gy,errorText:vy,testResult:yy,rowActions:wy,skeletons:ky,form:xy,passwordWrap:_y,passwordToggle:Cy,formActions:Sy,deleteWarn:jy,rowActive:Ty,providerLogoBox:Ey},Yi={openai:"providers.kindOpenai",anthropic:"providers.kindAnthropic",google:"providers.kindGoogle",mistral:"providers.kindMistral",xai:"providers.kindXai",deepseek:"providers.kindDeepseek","openai-compatible":"providers.kindOpenaiCompatible",local:"providers.kindLocal"},Ad={name:"",kind:"openai",baseUrl:"",apiKey:"",model:""};function Ny(){const a=sn(),{t:i}=Be(),{client:c,connected:d}=Mn(),h=Yn(),[m,f]=p.useState([]),[y,k]=p.useState(!0),[N,x]=p.useState(null),[j,A]=p.useState({}),[H,_]=p.useState(!1),[C,M]=p.useState(null),[R,L]=p.useState(Ad),[I,B]=p.useState({}),[ue,q]=p.useState(!1),[pe,re]=p.useState(!1),[te,oe]=p.useState(null),[xe,Z]=p.useState(""),[W,me]=p.useState(!1),Ne=p.useCallback(async()=>{if(c){k(!0),x(null);try{f(await c.providersList())}catch(P){x(P instanceof Error?P.message:i("providers.loadError"))}finally{k(!1)}}},[c,i]);p.useEffect(()=>{Ne()},[Ne]);const je=()=>{M(null),L(Ad),B({}),re(!1),_(!0)},_e=P=>{var U;M(P),L({name:P.name,kind:P.kind,baseUrl:P.baseUrl??"",apiKey:"",model:P.model??((U=P.models)==null?void 0:U[0])??""}),B({}),re(!1),_(!0)},$=p.useCallback(()=>{const P={};R.name.trim()||(P.name=i("providers.nameRequired"));const U=R.baseUrl.trim();if(!U&&(R.kind==="openai-compatible"||R.kind==="local"))P.baseUrl=i("providers.urlRequired");else if(U)try{const X=new URL(U);X.protocol!=="http:"&&X.protocol!=="https:"&&(P.baseUrl=i("providers.urlProtocol"))}catch{P.baseUrl=i("providers.urlInvalid")}return R.kind!=="local"&&!R.apiKey&&!(C!=null&&C.hasKey)&&(P.apiKey=i("providers.keyRequired")),R.model.trim()||(P.model=i("providers.modelRequired")),P},[C,R,i]),ae=async P=>{P.preventDefault();const U=$();if(B(U),!(Object.keys(U).length>0)&&c){q(!0);try{const X={id:C==null?void 0:C.id,name:R.name.trim(),kind:R.kind,baseUrl:R.baseUrl.trim()||void 0,model:R.model.trim()||void 0,apiKey:R.apiKey||void 0};await c.providersSave(X),await Ne(),_(!1),h.push({tone:"success",title:i(C?"providers.savedToast":"providers.addedToast")})}catch(X){h.push({tone:"error",title:i("providers.saveFailToast"),message:X instanceof Error?X.message:void 0})}finally{q(!1)}}},V=async P=>{var U;if(!(!c||((U=j[P.id])==null?void 0:U.status)==="pending")){A(X=>({...X,[P.id]:{status:"pending"}}));try{const X=await c.providersTest(P.id);A(he=>({...he,[P.id]:{status:"done",result:X}})),X.ok?h.push({tone:"success",title:i("providers.testOkToast",{ms:X.latencyMs})}):h.push({tone:"error",title:i("providers.testFailToast"),message:X.error??i("providers.testFailReason")})}catch(X){const he={ok:!1,latencyMs:0,error:X instanceof Error?X.message:i("providers.unknownError")};A(Ce=>({...Ce,[P.id]:{status:"done",result:he}})),h.push({tone:"error",title:i("providers.testFailToast")})}}},S=async P=>{if(c)try{P.active?(await c.providersDeactivate(P.id),f(U=>U.map(X=>X.id===P.id?{...X,active:!1}:X)),h.push({tone:"success",title:i("providers.deactivatedToast",{name:P.name})})):(await c.providersActivate(P.id),f(U=>U.map(X=>({...X,active:X.id===P.id}))),h.push({tone:"success",title:i("providers.activatedToast",{name:P.name})}))}catch(U){h.push({tone:"error",title:i("providers.toggleFailToast"),message:U instanceof Error?U.message:void 0})}},D=async()=>{if(!(!c||!te)){me(!0);try{await c.providersDelete(te.id),f(P=>P.filter(U=>U.id!==te.id)),oe(null),Z(""),h.push({tone:"success",title:i("providers.deletedToast",{name:te.name})})}catch(P){h.push({tone:"error",title:i("providers.deleteFailToast"),message:P instanceof Error?P.message:void 0})}finally{me(!1)}}};return d?o.jsxs(Mt,{icon:"cpu",title:i("providers.title"),hint:i("providers.subtitle"),children:[o.jsxs("div",{className:qe.bar,children:[o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void Ne(),disabled:y,children:i("providers.reload")}),o.jsx(fe,{variant:"primary",size:"sm",onClick:je,children:i("providers.add")})]}),y&&o.jsx("div",{className:qe.skeletons,"aria-busy":"true","aria-label":i("providers.loadingAria"),children:[0,1].map(P=>o.jsx(Eo,{variant:"rect",height:44},P))}),!y&&N&&o.jsx(Nr,{icon:"warn",title:i("providers.loadErrorTitle"),message:N,action:o.jsx(fe,{variant:"secondary",onClick:()=>void Ne(),children:i("providers.retry")})}),!y&&!N&&m.length===0&&o.jsx(Nr,{icon:"cpu",title:i("providers.emptyTitle"),message:i("providers.emptyMessage"),action:o.jsx(fe,{variant:"primary",onClick:je,children:i("providers.addEmptyCta")})}),!y&&!N&&m.length>0&&o.jsx("div",{className:qe.list,children:m.map(P=>{var X,he,Ce,ge;const U=j[P.id];return o.jsxs("article",{className:`${qe.row} ${P.active?qe.rowActive:""}`,children:[o.jsx("div",{className:qe.providerLogoBox,children:o.jsx(f1,{kind:P.kind,size:26})}),o.jsxs("div",{className:qe.info,children:[o.jsxs("div",{className:qe.titleRow,children:[o.jsx("h3",{className:qe.title,children:P.name}),P.active&&o.jsx(gt,{tone:"accent",children:i("providers.badgeActive")}),o.jsx(gt,{tone:"muted",children:i(Yi[P.kind])}),P.hasKey?o.jsx(gt,{tone:"info",children:i("providers.badgeHasKey")}):o.jsx(gt,{tone:"warn",children:i("providers.badgeNoKey")})]}),o.jsxs("p",{className:qe.meta,children:[P.model!==void 0||(X=P.models)!=null&&X.length?o.jsxs(o.Fragment,{children:[i("providers.metaModel",{model:P.model??((he=P.models)==null?void 0:he[0])??""}),P.model===void 0&&(((Ce=P.models)==null?void 0:Ce.length)??0)>1?` ${i("providers.metaMore",{n:(((ge=P.models)==null?void 0:ge.length)??1)-1})}`:""]}):i("providers.metaNoModel"),P.baseUrl?` · ${P.baseUrl}`:""]}),(U==null?void 0:U.status)==="done"&&o.jsxs("div",{className:qe.testResult,role:"status",children:[o.jsx(gt,{tone:U.result.ok?"accent":"danger",children:U.result.ok?i("providers.testOkBadge"):i("providers.testFailBadge")}),o.jsxs("span",{className:qe.mono,children:[U.result.latencyMs,"ms"]}),!U.result.ok&&U.result.error&&o.jsx("span",{className:qe.errorText,children:U.result.error})]})]}),o.jsxs("div",{className:qe.rowActions,children:[o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void V(P),loading:(U==null?void 0:U.status)==="pending",disabled:(U==null?void 0:U.status)==="pending",children:i("providers.testBtn")}),o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void S(P),children:P.active?i("providers.deactivate"):i("providers.activate")}),o.jsx(Xn,{icon:"edit","aria-label":i("providers.editAria",{name:P.name}),onClick:()=>_e(P)}),o.jsx(Xn,{icon:"trash","aria-label":i("providers.deleteAria",{name:P.name}),onClick:()=>{oe(P),Z("")}})]})]},P.id)})}),o.jsx(Qn,{open:H,onClose:()=>_(!1),title:i(C?"providers.modalEditTitle":"providers.modalAddTitle"),children:o.jsxs("form",{className:qe.form,onSubmit:P=>void ae(P),noValidate:!0,children:[o.jsx(_t,{label:i("providers.formName"),value:R.name,onChange:P=>L(U=>({...U,name:P.target.value})),error:I.name,placeholder:i("providers.formNamePh"),required:!0,autoComplete:"off"}),o.jsx(Gg,{label:i("providers.formKind"),value:R.kind,onChange:P=>L(U=>({...U,kind:P.target.value})),children:Object.keys(Yi).map(P=>o.jsx("option",{value:P,children:i(Yi[P])},P))}),o.jsx(_t,{label:i("providers.formBaseUrl"),value:R.baseUrl,onChange:P=>L(U=>({...U,baseUrl:P.target.value})),error:I.baseUrl,hint:i(R.kind==="openai-compatible"||R.kind==="local"?"providers.formBaseUrlRequiredHint":"providers.formBaseUrlHint"),placeholder:"https://api.openai.com/v1",inputMode:"url",autoComplete:"off"}),o.jsxs("div",{className:qe.passwordWrap,children:[o.jsx(_t,{label:i("providers.formApiKey"),type:pe?"text":"password",value:R.apiKey,onChange:P=>L(U=>({...U,apiKey:P.target.value})),error:I.apiKey,hint:i(C?"providers.formApiKeyEditHint":"providers.formApiKeyNewHint"),placeholder:C&&C.hasKey?i("providers.formKeySavedPh"):i("providers.formKeyPh"),autoComplete:"new-password",required:R.kind!=="local"&&!(C!=null&&C.hasKey)}),o.jsx("button",{type:"button",className:qe.passwordToggle,onClick:()=>re(P=>!P),"aria-label":i(pe?"providers.hideKeyAria":"providers.showKeyAria"),children:o.jsx(ve,{name:pe?"x":"key",size:18})})]}),o.jsx(_t,{label:i("providers.formModel"),value:R.model,onChange:P=>L(U=>({...U,model:P.target.value})),error:I.model,placeholder:i("providers.formModelPh"),autoComplete:"off",required:!0}),o.jsxs("div",{className:qe.formActions,children:[o.jsx(fe,{variant:"ghost",type:"button",onClick:()=>_(!1),children:i("providers.cancel")}),o.jsx(fe,{variant:"primary",type:"submit",loading:ue,disabled:ue,children:i(C?"providers.saveChanges":"providers.add")})]})]})}),o.jsx(Qn,{open:!!te,onClose:()=>oe(null),title:i("providers.deleteTitle"),footer:o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",onClick:()=>oe(null),children:i("providers.cancel")}),o.jsx(fe,{variant:"danger",onClick:()=>void D(),loading:W,disabled:W||te!=null&&xe.trim()!==te.name,children:i("providers.deleteForever")})]}),children:te&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:qe.deleteWarn,children:i("providers.deleteWarn",{name:te.name})}),o.jsx(_t,{label:i("providers.deleteInputLabel"),value:xe,onChange:P=>Z(P.target.value),placeholder:te.name,autoComplete:"off"})]})})]}):o.jsx(Mt,{icon:"cpu",title:i("providers.title"),hint:i("providers.subtitleDisconnected"),children:o.jsx(Nr,{icon:"warn",title:i("providers.notConnectedTitle"),message:i("providers.notConnectedMessage"),action:o.jsx(fe,{variant:"primary",onClick:()=>a("/welcome"),children:i("providers.gotoOnboarding")})})})}function by(){const{t:a}=Be(),i=Mn(),c=Yn(),d=p.useRef(i.client);d.current=i.client;const[h,m]=p.useState(i.baseUrl),[f,y]=p.useState(null),[k,N]=p.useState(!1),[x,j]=p.useState(null),[A,H]=p.useState(!1),[_,C]=p.useState(""),[M,R]=p.useState(null),[L,I]=p.useState(!1),[B,ue]=p.useState(!1),[q,pe]=p.useState(!1),re=()=>{const W=ol(h);return y(W),W===null},te=async W=>{if(W.preventDefault(),!!re()){H(!0);try{await i.saveCredentials(h.trim(),""),c.push({tone:"success",title:a("settings.savedToast")})}catch(me){c.push({tone:"error",title:a("settings.saveFailToast"),message:me instanceof Error?me.message:void 0})}finally{H(!1)}}},oe=async()=>{if(re()){N(!0),j(null);try{const W=await ih(()=>d.current,()=>i.saveCredentials(h.trim(),""));j(W),W.ok&&c.push({tone:"success",title:a("settings.testOkToast")})}catch(W){j({ok:!1,error:W instanceof Error?W.message:a("settings.testFailDefault")})}finally{N(!1)}}},xe=async W=>{W.preventDefault();const me=_.trim();if(me===""){R(a("settings.keyRequired"));return}ue(!0);try{await i.saveCredentials(i.baseUrl,me),C(""),I(!1),pe(!1),c.push({tone:"success",title:a("settings.keySavedToast")})}catch(Ne){R(Ne instanceof Error?Ne.message:a("settings.saveKeyFail"))}finally{ue(!1)}},Z=i.connecting?o.jsx(gt,{tone:"muted",children:a("settings.badgeChecking")}):i.connected?o.jsx(gt,{tone:"accent",children:a("settings.badgeConnected")}):o.jsx(gt,{tone:"warn",children:a("settings.badgeNotConnected")});return o.jsxs("div",{children:[o.jsxs(Mt,{icon:"wifi",title:a("settings.sectionConn"),hint:a("settings.sectionConnHint"),children:[o.jsxs("div",{className:ce.statusRow,children:[Z,i.error&&!i.connecting&&o.jsx("span",{className:ce.connError,role:"alert",children:i.error})]}),o.jsxs("form",{onSubmit:W=>void te(W),noValidate:!0,children:[o.jsxs("div",{className:ce.urlRow,children:[o.jsx("div",{className:ce.fieldGrow,children:o.jsx(_t,{label:a("settings.urlLabel"),value:h,onChange:W=>{m(W.target.value),f&&y(null),x&&j(null)},onBlur:re,error:f??void 0,placeholder:"http://localhost:8787",inputMode:"url",autoComplete:"url"})}),o.jsx(fe,{type:"submit",variant:"primary",size:"sm",loading:A,disabled:k,children:a("settings.save")}),o.jsx(fe,{variant:"secondary",size:"sm",onClick:()=>void oe(),loading:k,disabled:A,children:a("settings.test")})]}),o.jsx("p",{className:ce.urlHint,children:a("settings.urlHint")})]}),x&&o.jsx("div",{className:ce.testResult,role:"status",children:x.ok?o.jsxs(o.Fragment,{children:[o.jsx(gt,{tone:"accent",children:"OK"}),o.jsxs("code",{className:ce.mono,children:[x.version?`v${x.version}`:"gateway",typeof x.wireVersion=="number"&&` · wire v${x.wireVersion}`]})]}):o.jsxs("span",{className:ce.testError,role:"alert",children:[o.jsx(ve,{name:"warn",size:16}),x.error??a("settings.unreachable")]})})]}),o.jsx(Mt,{icon:"key",title:a("settings.sectionKey"),hint:a("settings.sectionKeyHint"),children:i.apiKeySaved&&!q?o.jsxs("div",{className:ce.savedKeyRow,children:[o.jsx("code",{className:ce.maskedKey,"aria-label":a("settings.savedKeyAria"),children:"••••••••••"}),o.jsx(gt,{tone:"accent",children:a("settings.savedBadge")}),o.jsx("div",{className:ce.actions,children:o.jsx(fe,{variant:"secondary",onClick:()=>pe(!0),children:a("settings.reenter")})})]}):o.jsxs("form",{onSubmit:W=>void xe(W),noValidate:!0,children:[o.jsxs("div",{className:ce.keyFieldRow,children:[o.jsx("div",{className:ce.fieldGrow,children:o.jsx(_t,{label:a("settings.newKeyLabel"),type:L?"text":"password",value:_,onChange:W=>{C(W.target.value),M&&R(null)},error:M??void 0,hint:a("settings.newKeyHint"),placeholder:a("settings.newKeyPlaceholder"),autoComplete:"off"})}),o.jsx(Xn,{icon:L?"eye-off":"eye","aria-label":a(L?"settings.hideKeyAria":"settings.showKeyAria"),onClick:()=>I(W=>!W)})]}),o.jsxs("div",{className:ce.actions,children:[o.jsx(fe,{type:"submit",variant:"primary",loading:B,children:a("settings.saveKey")}),i.apiKeySaved&&o.jsx(fe,{variant:"ghost",onClick:()=>{pe(!1),C(""),R(null)},children:a("settings.cancel")})]})]})}),o.jsx(Ny,{}),o.jsx(ly,{})]})}function Ly(){const{t:a}=Be();return o.jsx("div",{children:o.jsxs(Mt,{children:[o.jsx(Lt,{status:"soon",label:a("settings.notifyTurnDoneLabel"),hint:a("settings.notifyTurnDoneHint"),children:o.jsx(Nd,{checked:!1,onChange:()=>{},ariaLabel:a("settings.notifyTurnDoneLabel"),disabled:!0})}),o.jsx(Lt,{status:"soon",label:a("settings.notifyErrorsLabel"),hint:a("settings.notifyErrorsHint"),children:o.jsx(Nd,{checked:!1,onChange:()=>{},ariaLabel:a("settings.notifyErrorsLabel"),disabled:!0})}),o.jsxs("p",{className:ce.footnote,children:[o.jsx(ve,{name:"info",size:14}),a("settings.notificationsFootnote")]})]})})}const Id=["strict","warn","off"];function My(){const{t:a}=Be(),i=Mn(),c=Yn(),[d,h]=p.useState(!1),[m,f]=p.useState(!1),y=async()=>{f(!0);try{await i.clearCredentials(),c.push({tone:"success",title:a("settings.credsDeletedToast")})}catch(k){c.push({tone:"error",title:a("settings.credsDeleteFailToast"),message:k instanceof Error?k.message:void 0})}finally{f(!1),h(!1)}};return o.jsxs("div",{children:[o.jsxs(Mt,{icon:"shield",title:a("settings.sectionGuard"),hint:a("settings.sectionGuardHint"),children:[o.jsx(Xi,{label:a("settings.guardModeLabel"),hint:a("settings.guardRowHint"),envKey:"BOOMBOT_REASONING_GUARD_MODE",configPath:"reasoningGuard.mode",allowed:Id,defaultValue:"warn",snippet:'{ "reasoningGuard": { "mode": "warn" } }'}),o.jsx(Xi,{label:a("settings.harnessGuardLabel"),hint:a("settings.harnessGuardRowHint"),envKey:"BOOMBOT_GUARD_MODE",configPath:"harnessGuard.mode",allowed:Id,defaultValue:"warn",snippet:'{ "harnessGuard": { "mode": "warn" } }'}),o.jsx(Xi,{label:a("settings.shellLabel"),hint:a("settings.shellRowHint"),envKey:"BOOMBOT_SHELL_ENABLED",configPath:"shell.enabled",allowed:["1","true"],defaultValue:"tắt (fail-closed)",snippet:'{ "shell": { "enabled": true } }'})]}),o.jsx(Mt,{icon:"warn",title:a("settings.sectionDanger"),hint:a("settings.sectionDangerHint"),children:o.jsxs("div",{className:ce.prefRow,children:[o.jsxs("div",{className:ce.prefText,children:[o.jsx("span",{className:ce.prefLabel,children:a("settings.dangerTitle")}),o.jsx("span",{className:ce.prefHint,children:a("settings.dangerHint")})]}),o.jsx(fe,{variant:"danger",onClick:()=>h(!0),children:a("settings.dangerTitle")})]})}),o.jsx(Qn,{open:d,onClose:()=>h(!1),title:a("settings.modalTitle"),footer:o.jsxs(o.Fragment,{children:[o.jsx(fe,{variant:"ghost",onClick:()=>h(!1),disabled:m,children:a("settings.modalCancel")}),o.jsx(fe,{variant:"danger",onClick:()=>void y(),loading:m,children:a("settings.modalDelete")})]}),children:o.jsx("p",{className:ce.modalText,children:a("settings.modalBody")})})]})}function Ry(){const{t:a,lang:i,setLang:c}=Be(),d=[{value:"vi",label:a("settings.langVi")},{value:"en",label:a("settings.langEn")}],h=[{value:"vi",label:a("settings.langVi")},{value:"en",label:a("settings.langEn")}],m=[{value:"natural",label:a("settings.voiceStyleNatural")},{value:"formal",label:a("settings.voiceStyleFormal")},{value:"casual",label:a("settings.voiceStyleCasual")}],f=[{value:"slow",label:a("settings.voiceSpeedSlow")},{value:"normal",label:a("settings.voiceSpeedNormal")},{value:"fast",label:a("settings.voiceSpeedFast")}];return o.jsx("div",{children:o.jsxs(Mt,{hint:a("settings.sectionVoiceHint"),children:[o.jsx(Lt,{label:a("settings.languageLabel"),hint:a("settings.languageHint"),children:o.jsx(Bt,{ariaLabel:a("settings.languageLabel"),options:d,value:i,onChange:y=>c(y)})}),o.jsx(Lt,{status:"soon",label:a("settings.voiceLangLabel"),hint:a("settings.voiceLangHint"),children:o.jsx(Bt,{ariaLabel:a("settings.voiceLangLabel"),options:h,value:"vi",onChange:()=>{},disabled:!0})}),o.jsx(Lt,{status:"soon",label:a("settings.voiceStyleLabel"),hint:a("settings.voiceStyleHint"),children:o.jsx(Bt,{ariaLabel:a("settings.voiceStyleLabel"),options:m,value:"natural",onChange:()=>{},disabled:!0})}),o.jsx(Lt,{status:"soon",label:a("settings.voiceSpeedLabel"),hint:a("settings.voiceSpeedHint"),children:o.jsx(Bt,{ariaLabel:a("settings.voiceSpeedLabel"),options:f,value:"normal",onChange:()=>{},disabled:!0})})]})})}const Py="appearance",hl=[{id:"appearance",labelKey:"settings.navAppearance",subtitleKey:"settings.appearanceSubtitle",icon:"palette"},{id:"chat",labelKey:"settings.navChat",subtitleKey:"settings.chatSubtitle",icon:"chat"},{id:"voice",labelKey:"settings.navVoice",subtitleKey:"settings.voiceSubtitle",icon:"volume"},{id:"notifications",labelKey:"settings.navNotifications",subtitleKey:"settings.notificationsSubtitle",icon:"bell"},{id:"security",labelKey:"settings.navSecurity",subtitleKey:"settings.securitySubtitle",icon:"shield"},{id:"connection",labelKey:"settings.navConnection",subtitleKey:"settings.connectionSubtitle",icon:"plug"}];function fl(a){return`/settings/${a}`}function Ay(a){return hl.find(i=>i.id===a)}function Dd(a){return a.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").replace(/đ/gi,"d").toLocaleLowerCase().trim()}const Iy=[{section:"appearance",keywords:"giao dien theme chu de sang toi he thong dark light system mat do density appearance"},{section:"chat",keywords:"tro chuyen chat phong chu font be rong khung transcript width chuyen dong motion giam chuyen dong"},{section:"voice",keywords:"giong noi voice ngon ngu language toc do speed phong cach style am thanh"},{section:"notifications",keywords:"thong bao notifications nhac nho nhan tin xong turn done"},{section:"security",keywords:"bao mat security api key reasoning guard harness guard shell vung nguy hiem xoa credentials"},{section:"connection",keywords:"ket noi connection gateway url api key provider providers nha cung cap model llm openai anthropic kiem tra health phien ban version"}];function Dy(a,i){const c=Dd(a);return c===""?[]:hl.filter(d=>{if(Dd(`${i(d)} ${d.id}`).includes(c))return!0;const m=Iy.find(f=>f.section===d.id);return m!==void 0&&m.keywords.includes(c)})}const Oy={appearance:j0,chat:T0,voice:Ry,notifications:Ly,security:My,connection:by};function Fy(){const{t:a}=Be(),i=sn(),{section:c}=km(),d=Ay(c);if(!d)return o.jsx("div",{className:ce.page,children:o.jsx(Nr,{icon:"gear",title:a("settings.unknownSectionTitle"),message:a("settings.unknownSectionBody"),action:o.jsx(fe,{variant:"primary",onClick:()=>i(fl(Py),{replace:!0}),children:a("settings.navAppearance")})})});const h=Oy[d.id];return o.jsxs("div",{className:ce.page,children:[o.jsxs("header",{className:ce.paneHeader,children:[o.jsx("h1",{className:ce.paneTitle,children:a(d.labelKey)}),o.jsx("p",{className:ce.paneSubtitle,children:a(d.subtitleKey)})]}),o.jsx(h,{})]})}const zy="_macTrafficLights_5c42g_5",By="_trafficDot_5c42g_21",Ky="_trafficClose_5c42g_49",Hy="_trafficMin_5c42g_51",Uy="_trafficMax_5c42g_53",$y="_collapsed_5c42g_57",Vy="_shell_5c42g_69",Wy="_sidebar_5c42g_85",Gy="_brandRow_5c42g_131",qy="_brand_5c42g_131",Qy="_brandMark_5c42g_177",Xy="_brandName_5c42g_217",Yy="_collapseToggle_5c42g_231",Zy="_newChatBtn_5c42g_323",Jy="_newChatBtnCollapsed_5c42g_407",e2="_recentBlock_5c42g_481",t2="_recentLabel_5c42g_495",n2="_recentList_5c42g_515",r2="_recentItemWrap_5c42g_537",o2="_recentDeleteBtn_5c42g_561",a2="_recentItem_5c42g_537",s2="_recentActive_5c42g_695",i2="_recentDot_5c42g_705",l2="_recentTitle_5c42g_723",c2="_nav_5c42g_737",u2="_navGroup_5c42g_755",d2="_navGroupLabel_5c42g_773",h2="_navLink_5c42g_795",f2="_active_5c42g_873",p2="_mainWrap_5c42g_1223",m2="_topbar_5c42g_1239",g2="_breadcrumb_5c42g_1275",v2="_crumbLink_5c42g_1297",y2="_crumbCurrent_5c42g_1313",w2="_main_5c42g_1223",k2="_content_5c42g_1351",x2="_narrow_5c42g_1365",_2="_bottomNav_5c42g_1393",C2="_drawerRoot_5c42g_1401",S2="_bottomLink_5c42g_1473",j2="_bottomLabel_5c42g_1565",T2="_scrim_5c42g_1589",E2="_drawer_5c42g_1401",N2="_drawerHeader_5c42g_1633",b2="_drawerTitle_5c42g_1647",L2="_drawerClose_5c42g_1657",M2="_drawerList_5c42g_1693",se={macTrafficLights:zy,trafficDot:By,trafficClose:Ky,trafficMin:Hy,trafficMax:Uy,collapsed:$y,shell:Vy,sidebar:Wy,brandRow:Gy,brand:qy,brandMark:Qy,brandName:Xy,collapseToggle:Yy,newChatBtn:Zy,newChatBtnCollapsed:Jy,recentBlock:e2,recentLabel:t2,recentList:n2,recentItemWrap:r2,recentDeleteBtn:o2,recentItem:a2,recentActive:s2,recentDot:i2,recentTitle:l2,nav:c2,navGroup:u2,navGroupLabel:d2,navLink:h2,active:f2,mainWrap:p2,topbar:m2,breadcrumb:g2,crumbLink:v2,crumbCurrent:y2,main:w2,content:k2,narrow:x2,bottomNav:_2,drawerRoot:C2,bottomLink:S2,bottomLabel:j2,scrim:T2,drawer:E2,drawerHeader:N2,drawerTitle:b2,drawerClose:L2,drawerList:M2},R2="_fallback_15157_1",P2={fallback:R2};function al(){return o.jsxs("div",{className:P2.fallback,"aria-label":"Đang tải trang",children:[o.jsx(Eo,{variant:"rect",height:48}),o.jsx(Eo,{variant:"rect",height:120}),o.jsx(Eo,{variant:"rect",height:120})]})}const A2="_overlay_1q444_1",I2="_dialog_1q444_14",D2="_sidebar_1q444_55",O2="_search_1q444_62",F2="_sectionLabel_1q444_93",z2="_group_1q444_100",B2="_navList_1q444_108",K2="_navItem_1q444_117",H2="_active_1q444_139",U2="_content_1q444_151",$2="_close_1q444_158",lt={overlay:A2,dialog:I2,sidebar:D2,search:O2,sectionLabel:F2,group:z2,navList:B2,navItem:K2,active:H2,content:U2,close:$2},fh=[{id:"settings",labelKey:"shell.groupSettings",items:hl.map(a=>({path:fl(a.id),labelKey:a.labelKey,icon:a.icon}))},{id:"start",labelKey:"shell.groupGettingStarted",items:[{path:"/welcome",labelKey:"shell.navOnboarding",icon:"bolt"}]}],ph=fh.flatMap(a=>a.items),V2=[...ph.map(a=>a.path),"/settings","/channels","/providers"];function Lo(a){return V2.some(i=>a===i||a.startsWith(`${i}/`))}function W2({children:a,onClose:i}){const{t:c}=Be(),d=p.useRef(null),h=p.useRef(null),[m,f]=p.useState(""),y=p.useRef(i);p.useEffect(()=>{y.current=i},[i]);const k=m.trim(),N=p.useMemo(()=>{if(k==="")return null;const j=k.toLocaleLowerCase(),A=ph.filter(C=>c(C.labelKey).toLocaleLowerCase().includes(j)),H=Dy(k,C=>c(C.labelKey)).map(C=>({path:fl(C.id),labelKey:C.labelKey,icon:C.icon})),_=new Set;return[...H,...A].filter(C=>_.has(C.path)?!1:(_.add(C.path),!0))},[k,c]);p.useEffect(()=>{var _;const j=document.activeElement,A=document.body.style.overflow;document.body.style.overflow="hidden",(_=h.current)==null||_.focus();const H=C=>{const M=d.current;if(!M)return;if(C.key==="Escape"){C.preventDefault(),y.current();return}if(C.key!=="Tab")return;const R=Array.from(M.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')),L=R[0],I=R.at(-1);if(!(!L||!I)){if(!M.contains(document.activeElement)){C.preventDefault(),L.focus();return}C.shiftKey&&document.activeElement===L?(C.preventDefault(),I.focus()):!C.shiftKey&&document.activeElement===I&&(C.preventDefault(),L.focus())}};return document.addEventListener("keydown",H),()=>{document.removeEventListener("keydown",H),document.body.style.overflow=A,j==null||j.focus()}},[]);const x=j=>o.jsx("li",{children:o.jsxs(Mo,{to:j.path,className:({isActive:A})=>[lt.navItem,A?lt.active:""].join(" ").trim(),children:[o.jsx(ve,{name:j.icon,size:19}),o.jsx("span",{children:c(j.labelKey)})]})},j.path);return ll.createPortal(o.jsx("div",{className:lt.overlay,onMouseDown:j=>{j.target===j.currentTarget&&i()},children:o.jsxs("div",{ref:d,className:lt.dialog,role:"dialog","aria-modal":"true","aria-label":c("shell.systemAria"),children:[o.jsxs("div",{className:lt.sidebar,children:[o.jsxs("label",{className:lt.search,children:[o.jsx(ve,{name:"search",size:18}),o.jsx("input",{ref:h,type:"search","aria-label":c("shell.systemSearch"),value:m,onChange:j=>f(j.target.value),placeholder:c("shell.systemSearch")})]}),o.jsx("nav",{"aria-label":c("shell.systemAria"),className:lt.modalNav,children:N?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:lt.sectionLabel,children:c("shell.systemResults")}),N.length===0?o.jsx("p",{className:lt.sectionLabel,role:"status",children:c("shell.systemNoResults")}):o.jsx("ul",{className:lt.navList,children:N.map(x)})]}):fh.map(j=>o.jsxs("div",{className:lt.group,children:[o.jsx("p",{className:lt.sectionLabel,children:c(j.labelKey)}),o.jsx("ul",{className:lt.navList,children:j.items.map(x)})]},j.id))})]}),o.jsx("section",{className:lt.content,children:a}),o.jsx("button",{type:"button",className:lt.close,onClick:i,"aria-label":c("shell.systemClose"),children:o.jsx(ve,{name:"x",size:20})})]})}),document.body)}const mh=[{labelKey:"",items:[{path:"/",labelKey:"shell.navChat",icon:"chat"},{path:"/sessions",labelKey:"shell.navSessions",icon:"sessions"},{path:"/schedules",labelKey:"shell.navSchedules",icon:"calendar"},{path:"/tasks",labelKey:"shell.navTasks",icon:"clock"},{path:"/memory",labelKey:"shell.navMemory",icon:"database"}]},{labelKey:"shell.groupSystem",items:[{path:"/settings",labelKey:"shell.navSettings",icon:"gear"}]}],pl=mh.flatMap(a=>a.items),G2=["/","/sessions","/schedules","/settings"],gh="boombot.sidebar";function q2(){try{return localStorage.getItem(gh)==="collapsed"}catch{return!1}}function Q2(){const{t:a}=Be(),{connected:i,connecting:c,client:d,errorCode:h}=Mn(),m=c?"warn":i?"success":d?"danger":"muted",f=m==="warn"||m==="danger",k=a(c?"shell.connChecking":i?"shell.connOk":!i&&!c&&h==="UNAUTHORIZED"?"shell.connAuthFailed":d?"shell.connLost":"shell.connNone");return o.jsxs(gt,{tone:m,children:[o.jsx("span",{className:f?"status-dot status-dot--pulse":"status-dot","aria-hidden":"true"}),k]})}function X2(){const{t:a}=Be(),{pathname:i}=Rt(),c=pl.find(d=>d.path==="/"?i==="/":i.startsWith(d.path));return o.jsx("nav",{"aria-label":a("shell.navAria"),className:se.breadcrumb,children:o.jsxs("ol",{children:[o.jsx("li",{children:o.jsx(dl,{to:"/",className:se.crumbLink,children:a("shell.breadcrumbRoot")})}),c&&c.path!=="/"&&o.jsxs("li",{"aria-current":"page",className:se.crumbCurrent,children:[o.jsx(ve,{name:"chevron-right",size:14}),o.jsx("span",{children:a(c.labelKey)})]})]})})}function Y2({collapsed:a}){const{t:i}=Be(),{pathname:c}=Rt();return o.jsx("nav",{"aria-label":i("shell.navAria"),className:se.nav,children:mh.map((d,h)=>o.jsxs("div",{className:se.navGroup,children:[d.labelKey!==""&&!a&&o.jsx("p",{className:se.navGroupLabel,id:`nav-group-${h}`,children:i(d.labelKey)}),o.jsx("ul",{"aria-labelledby":d.labelKey!==""&&!a?`nav-group-${h}`:void 0,children:d.items.map(m=>{const f=i(m.labelKey);return o.jsx("li",{children:o.jsxs(Mo,{to:m.path,end:m.path==="/",title:a?f:void 0,className:({isActive:y})=>[se.navLink,y||m.path==="/settings"&&Lo(c)?se.active:""].join(" ").trim(),children:[o.jsx(ve,{name:m.icon,size:18}),!a&&o.jsx("span",{children:f})]})},m.path)})})]},d.labelKey||`group-${h}`))})}function Z2({open:a,onClose:i}){const{t:c}=Be(),{pathname:d}=Rt(),h=p.useRef(null);return p.useEffect(()=>{var f;if(!a)return;(f=h.current)==null||f.focus();const m=y=>{y.key==="Escape"&&i()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a,i]),a?o.jsxs("div",{className:se.drawerRoot,children:[o.jsx("div",{className:se.scrim,onClick:i,"aria-hidden":"true"}),o.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":c("shell.drawerAria"),className:se.drawer,children:[o.jsxs("div",{className:se.drawerHeader,children:[o.jsx("span",{className:se.drawerTitle,children:c("shell.drawerTitle")}),o.jsx("button",{ref:h,type:"button",onClick:i,"aria-label":c("shell.drawerClose"),className:se.drawerClose,children:o.jsx(ve,{name:"x",size:20})})]}),o.jsx("ul",{className:se.drawerList,children:pl.map(m=>o.jsx("li",{children:o.jsxs(Mo,{to:m.path,end:m.path==="/",onClick:i,className:({isActive:f})=>[se.navLink,f||m.path==="/settings"&&Lo(d)?se.active:""].join(" ").trim(),children:[o.jsx(ve,{name:m.icon,size:20}),o.jsx("span",{children:c(m.labelKey)})]})},m.path))})]})]}):null}function J2(){const{t:a}=Be(),{pathname:i}=Rt(),[c,d]=p.useState(!1),h=pl.filter(m=>G2.includes(m.path));return o.jsxs(o.Fragment,{children:[o.jsxs("nav",{"aria-label":a("shell.navAria"),className:se.bottomNav,children:[h.map(m=>o.jsxs(Mo,{to:m.path,end:m.path==="/",className:({isActive:f})=>[se.bottomLink,f||m.path==="/settings"&&Lo(i)?se.active:""].join(" ").trim(),children:[o.jsx(ve,{name:m.icon,size:22}),o.jsx("span",{className:se.bottomLabel,children:a(m.labelKey)})]},m.path)),o.jsxs("button",{type:"button",className:se.bottomLink,"aria-expanded":c,"aria-haspopup":"dialog",onClick:()=>d(!0),children:[o.jsx(ve,{name:"dots",size:22}),o.jsx("span",{className:se.bottomLabel,children:a("shell.more")})]})]}),o.jsx(Z2,{open:c,onClose:()=>d(!1)})]})}function ew(){const{t:a}=Be(),{pathname:i}=Rt(),c=sn(),{client:d,connected:h}=Mn(),m=p.useRef(null),f=p.useRef(null),y=p.useRef("/"),k=i==="/"||i.startsWith("/chat"),N=Lo(i),[x,j]=p.useState(q2),[A,H]=p.useState([]);p.useEffect(()=>{N||(y.current=i)},[i,N]),p.useEffect(()=>{const R=f.current;R&&(R.inert=N)},[N]);const _=p.useCallback(()=>{const R=y.current;c(Lo(R)?"/":R,{replace:!0})},[c]);p.useEffect(()=>{if(!h||!d){H([]);return}let R=!0;const L=()=>{d.sessionsList().then(B=>{R&&H(B.slice(0,8))}).catch(()=>{R&&H([])})};L();const I=window.setInterval(L,3e4);return()=>{R=!1,window.clearInterval(I)}},[d,h,i]);const C=async(R,L)=>{if(R.preventDefault(),R.stopPropagation(),!!d)try{await d.sessionsDelete(L),H(I=>I.filter(B=>B.id!==L)),i===`/chat/${L}`&&c("/chat/new")}catch(I){console.error("Failed to delete session:",I)}},M=p.useCallback(()=>{j(R=>{const L=!R;try{localStorage.setItem(gh,L?"collapsed":"expanded")}catch{}return L})},[]);return p.useEffect(()=>{var R;(R=m.current)==null||R.focus({preventScroll:!0})},[i]),o.jsxs("div",{ref:f,className:[se.shell,x?se.collapsed:""].join(" ").trim(),"aria-hidden":N||void 0,children:[o.jsx("a",{href:"#main-content",className:"skip-link",children:a("shell.skipToContent")}),o.jsxs("aside",{className:se.sidebar,children:[o.jsxs("div",{className:se.macTrafficLights,"aria-hidden":"true",children:[o.jsx("span",{className:`${se.trafficDot} ${se.trafficClose}`}),o.jsx("span",{className:`${se.trafficDot} ${se.trafficMin}`}),o.jsx("span",{className:`${se.trafficDot} ${se.trafficMax}`})]}),o.jsxs("div",{className:se.brandRow,children:[o.jsxs(dl,{to:"/",className:se.brand,"aria-label":a("shell.brandAria"),children:[o.jsx("span",{className:se.brandMark,"aria-hidden":"true",children:o.jsx("img",{src:"/logo.png",alt:"BoomBot",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"6px"}})}),!x&&o.jsx("span",{className:se.brandName,children:"BoomBot"})]}),o.jsx("button",{type:"button",className:se.collapseToggle,onClick:M,"aria-label":a(x?"shell.expandAria":"shell.collapseAria"),"aria-pressed":x,children:o.jsx(ve,{name:x?"chevron-right":"chevron-left",size:16})})]}),o.jsxs("button",{type:"button",className:x?se.newChatBtnCollapsed:se.newChatBtn,onClick:()=>c("/chat/new"),title:x?a("shell.newChat"):void 0,children:[o.jsx(ve,{name:"plus",size:16}),!x&&o.jsx("span",{children:a("shell.newChat")})]}),o.jsx(Y2,{collapsed:x}),!x&&A.length>0&&o.jsxs("div",{className:se.recentBlock,children:[o.jsx("p",{className:se.recentLabel,id:"recent-chats-label",children:a("shell.recentChats")}),o.jsx("ul",{className:se.recentList,"aria-labelledby":"recent-chats-label",children:A.map(R=>o.jsxs("li",{className:se.recentItemWrap,children:[o.jsxs(Mo,{to:`/chat/${R.id}`,title:R.title,className:({isActive:L})=>[se.recentItem,L?se.recentActive:""].join(" ").trim(),children:[o.jsx("span",{className:se.recentDot,"aria-hidden":"true"}),o.jsx("span",{className:se.recentTitle,children:R.title||a("chat.fallbackTitle")})]}),o.jsx("button",{type:"button",className:se.recentDeleteBtn,onClick:L=>C(L,R.id),title:"Delete chat","aria-label":"Delete chat",children:o.jsx(ve,{name:"trash",size:13})})]},R.id))})]})]}),o.jsxs("div",{className:se.mainWrap,children:[o.jsxs("header",{className:se.topbar,children:[o.jsx(X2,{}),o.jsx(Q2,{})]}),o.jsx("main",{id:"main-content",ref:m,tabIndex:-1,className:[se.main,k?se.narrow:""].join(" ").trim(),children:o.jsx("div",{className:se.content,children:!N&&o.jsx(p.Suspense,{fallback:o.jsx(al,{}),children:o.jsx(wd,{})})})})]}),o.jsx(J2,{}),N&&o.jsx(W2,{onClose:_,children:o.jsx(p.Suspense,{fallback:o.jsx(al,{}),children:o.jsx(wd,{})})})]})}const Od=p.lazy(()=>Lr(()=>import("./ChatView-DwrZXRTf.js"),__vite__mapDeps([0,1,2]))),tw=p.lazy(()=>Lr(()=>import("./SessionsView-DIaw3vEm.js"),__vite__mapDeps([3,4]))),nw=p.lazy(()=>Lr(()=>import("./SchedulesView-CgZHa7Zc.js"),__vite__mapDeps([5,1,6,7,8]))),rw=p.lazy(()=>Lr(()=>import("./TasksView-BIccQf95.js"),__vite__mapDeps([9,1,6,7,10]))),ow=p.lazy(()=>Lr(()=>import("./MemoryView-GytJpeXY.js"),__vite__mapDeps([11,1,12])));function aw(){return o.jsx($m,{children:o.jsx(Dp,{children:o.jsxs(d1,{children:[o.jsx(Q1,{}),o.jsx(Y1,{children:o.jsx(p.Suspense,{fallback:o.jsx(al,{}),children:o.jsx(Dm,{children:o.jsxs(mt,{element:o.jsx(ew,{}),children:[o.jsx(mt,{path:"/",element:o.jsx(Od,{})}),o.jsx(mt,{path:"/chat/:id",element:o.jsx(Od,{})}),o.jsx(mt,{path:"/sessions",element:o.jsx(tw,{})}),o.jsx(mt,{path:"/providers",element:o.jsx(Ua,{to:"/settings/connection",replace:!0})}),o.jsx(mt,{path:"/schedules",element:o.jsx(nw,{})}),o.jsx(mt,{path:"/tasks",element:o.jsx(rw,{})}),o.jsx(mt,{path:"/memory",element:o.jsx(ow,{})}),o.jsx(mt,{path:"/channels",element:o.jsx(Ua,{to:"/settings/connection",replace:!0})}),o.jsx(mt,{path:"/settings",element:o.jsx(Ua,{to:"/settings/appearance",replace:!0})}),o.jsx(mt,{path:"/settings/:section",element:o.jsx(Fy,{})}),o.jsx(mt,{path:"/welcome",element:o.jsx(Nv,{})}),o.jsx(mt,{path:"*",element:o.jsx(Ua,{to:"/",replace:!0})})]})})})})]})})})}const vh=document.getElementById("root");if(!vh)throw new Error("Không tìm thấy phần tử #root");Fp();Np.createRoot(vh).render(o.jsx(p.StrictMode,{children:o.jsx(Kv,{children:o.jsx(Rv,{children:o.jsx(Up,{children:o.jsx(aw,{})})})})}));export{fe as B,Nr as E,rh as F,ve as I,Qn as M,kg as O,Ug as P,Ga as S,Mn as a,Yn as b,Eo as c,km as d,sn as e,mg as f,Pv as g,Gg as h,_t as i,o as j,Xn as k,gt as l,Nd as m,qn as n,oh as o,yp as p,p as r,fl as s,Be as u,Av as w};