jinn-cli 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/jimmy.js +0 -0
- package/dist/src/cli/status.d.ts.map +1 -1
- package/dist/src/cli/status.js +10 -1
- package/dist/src/cli/status.js.map +1 -1
- package/dist/src/connectors/discord/format.d.ts +3 -0
- package/dist/src/connectors/discord/format.d.ts.map +1 -0
- package/dist/src/connectors/discord/format.js +33 -0
- package/dist/src/connectors/discord/format.js.map +1 -0
- package/dist/src/connectors/discord/index.d.ts +41 -0
- package/dist/src/connectors/discord/index.d.ts.map +1 -0
- package/dist/src/connectors/discord/index.js +302 -0
- package/dist/src/connectors/discord/index.js.map +1 -0
- package/dist/src/connectors/discord/remote.d.ts +33 -0
- package/dist/src/connectors/discord/remote.d.ts.map +1 -0
- package/dist/src/connectors/discord/remote.js +89 -0
- package/dist/src/connectors/discord/remote.js.map +1 -0
- package/dist/src/connectors/discord/threads.d.ts +5 -0
- package/dist/src/connectors/discord/threads.d.ts.map +1 -0
- package/dist/src/connectors/discord/threads.js +22 -0
- package/dist/src/connectors/discord/threads.js.map +1 -0
- package/dist/src/connectors/whatsapp/format.d.ts +2 -0
- package/dist/src/connectors/whatsapp/format.d.ts.map +1 -0
- package/dist/src/connectors/whatsapp/format.js +22 -0
- package/dist/src/connectors/whatsapp/format.js.map +1 -0
- package/dist/src/connectors/whatsapp/index.d.ts +42 -0
- package/dist/src/connectors/whatsapp/index.d.ts.map +1 -0
- package/dist/src/connectors/whatsapp/index.js +279 -0
- package/dist/src/connectors/whatsapp/index.js.map +1 -0
- package/dist/src/engines/claude.d.ts +5 -0
- package/dist/src/engines/claude.d.ts.map +1 -1
- package/dist/src/engines/claude.js +192 -22
- package/dist/src/engines/claude.js.map +1 -1
- package/dist/src/gateway/api.d.ts +1 -0
- package/dist/src/gateway/api.d.ts.map +1 -1
- package/dist/src/gateway/api.js +705 -18
- package/dist/src/gateway/api.js.map +1 -1
- package/dist/src/gateway/lifecycle.d.ts.map +1 -1
- package/dist/src/gateway/lifecycle.js +32 -15
- package/dist/src/gateway/lifecycle.js.map +1 -1
- package/dist/src/gateway/project-tagger.d.ts +20 -0
- package/dist/src/gateway/project-tagger.d.ts.map +1 -0
- package/dist/src/gateway/project-tagger.js +55 -0
- package/dist/src/gateway/project-tagger.js.map +1 -0
- package/dist/src/gateway/project-tagger.test.d.ts +2 -0
- package/dist/src/gateway/project-tagger.test.d.ts.map +1 -0
- package/dist/src/gateway/project-tagger.test.js +110 -0
- package/dist/src/gateway/project-tagger.test.js.map +1 -0
- package/dist/src/gateway/projects.d.ts +15 -0
- package/dist/src/gateway/projects.d.ts.map +1 -0
- package/dist/src/gateway/projects.js +48 -0
- package/dist/src/gateway/projects.js.map +1 -0
- package/dist/src/gateway/projects.test.d.ts +2 -0
- package/dist/src/gateway/projects.test.d.ts.map +1 -0
- package/dist/src/gateway/projects.test.js +85 -0
- package/dist/src/gateway/projects.test.js.map +1 -0
- package/dist/src/gateway/server.d.ts.map +1 -1
- package/dist/src/gateway/server.js +90 -2
- package/dist/src/gateway/server.js.map +1 -1
- package/dist/src/gateway/tasks.d.ts +14 -0
- package/dist/src/gateway/tasks.d.ts.map +1 -0
- package/dist/src/gateway/tasks.js +51 -0
- package/dist/src/gateway/tasks.js.map +1 -0
- package/dist/src/gateway/tasks.test.d.ts +2 -0
- package/dist/src/gateway/tasks.test.d.ts.map +1 -0
- package/dist/src/gateway/tasks.test.js +131 -0
- package/dist/src/gateway/tasks.test.js.map +1 -0
- package/dist/src/sessions/callbacks.d.ts +29 -0
- package/dist/src/sessions/callbacks.d.ts.map +1 -0
- package/dist/src/sessions/callbacks.js +110 -0
- package/dist/src/sessions/callbacks.js.map +1 -0
- package/dist/src/sessions/context.js +4 -3
- package/dist/src/sessions/context.js.map +1 -1
- package/dist/src/sessions/engine-override.d.ts +3 -0
- package/dist/src/sessions/engine-override.d.ts.map +1 -0
- package/dist/src/sessions/engine-override.js +42 -0
- package/dist/src/sessions/engine-override.js.map +1 -0
- package/dist/src/sessions/manager.d.ts.map +1 -1
- package/dist/src/sessions/manager.js +385 -40
- package/dist/src/sessions/manager.js.map +1 -1
- package/dist/src/sessions/queue.d.ts +19 -2
- package/dist/src/sessions/queue.d.ts.map +1 -1
- package/dist/src/sessions/queue.js +44 -13
- package/dist/src/sessions/queue.js.map +1 -1
- package/dist/src/sessions/registry.d.ts +21 -1
- package/dist/src/sessions/registry.d.ts.map +1 -1
- package/dist/src/sessions/registry.js +62 -0
- package/dist/src/sessions/registry.js.map +1 -1
- package/dist/src/shared/rateLimit.d.ts +13 -0
- package/dist/src/shared/rateLimit.d.ts.map +1 -0
- package/dist/src/shared/rateLimit.js +30 -0
- package/dist/src/shared/rateLimit.js.map +1 -0
- package/dist/src/shared/types.d.ts +46 -3
- package/dist/src/shared/types.d.ts.map +1 -1
- package/dist/src/shared/usageAwareness.d.ts +10 -0
- package/dist/src/shared/usageAwareness.d.ts.map +1 -0
- package/dist/src/shared/usageAwareness.js +62 -0
- package/dist/src/shared/usageAwareness.js.map +1 -0
- package/dist/web/404.html +1 -1
- package/dist/web/_next/static/chunks/184-5a617386af9a1dd3.js +1 -0
- package/dist/web/_next/static/chunks/700-ad04a2a5b3c8880f.js +1 -0
- package/dist/web/_next/static/chunks/app/chat/page-36edb6fc1d1e880b.js +1 -0
- package/dist/web/_next/static/chunks/app/costs/{page-7940c2fe7e3dace1.js → page-6c5cd46a6b3cde21.js} +1 -1
- package/dist/web/_next/static/chunks/app/cron/{page-f81a986689712af7.js → page-210d9d333a7eed94.js} +1 -1
- package/dist/web/_next/static/chunks/app/kanban/page-c32370bcd6a7c841.js +1 -0
- package/dist/web/_next/static/chunks/app/layout-3ad6b73a0904c24b.js +1 -0
- package/dist/web/_next/static/chunks/app/logs/page-7322a6789e16dca4.js +1 -0
- package/dist/web/_next/static/chunks/app/org/{page-3d44d51e94edb85e.js → page-02263c5702e0fd3e.js} +1 -1
- package/dist/web/_next/static/chunks/app/{page-7ac43789d477a51f.js → page-b68dcf7b8802c704.js} +1 -1
- package/dist/web/_next/static/chunks/app/sessions/page-bf7ad2fac281c7d6.js +1 -0
- package/dist/web/_next/static/chunks/app/settings/page-d3b89563c42be2e5.js +1 -0
- package/dist/web/_next/static/chunks/app/skills/{page-26b727333df9db45.js → page-194f4e97f29ab581.js} +1 -1
- package/dist/web/_next/static/css/b809b6af2d241fc8.css +1 -0
- package/dist/web/chat.html +1 -1
- package/dist/web/chat.txt +4 -4
- package/dist/web/costs.html +2 -2
- package/dist/web/costs.txt +4 -4
- package/dist/web/cron.html +1 -1
- package/dist/web/cron.txt +4 -4
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +4 -4
- package/dist/web/kanban.html +1 -1
- package/dist/web/kanban.txt +4 -4
- package/dist/web/logs.html +2 -2
- package/dist/web/logs.txt +4 -4
- package/dist/web/org.html +1 -1
- package/dist/web/org.txt +4 -4
- package/dist/web/sessions.html +1 -1
- package/dist/web/sessions.txt +14 -17
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +4 -4
- package/dist/web/skills.html +1 -1
- package/dist/web/skills.txt +4 -4
- package/package.json +6 -1
- package/dist/web/_next/static/chunks/282-4e9c26e9a600c58e.js +0 -1
- package/dist/web/_next/static/chunks/700-a7cbf54fe1fbf4bc.js +0 -1
- package/dist/web/_next/static/chunks/app/chat/page-757fcd211d059cb7.js +0 -1
- package/dist/web/_next/static/chunks/app/kanban/page-6ab8586b063ca3ac.js +0 -1
- package/dist/web/_next/static/chunks/app/layout-c24e2d25774ff71a.js +0 -1
- package/dist/web/_next/static/chunks/app/logs/page-388b787cb847ca97.js +0 -1
- package/dist/web/_next/static/chunks/app/sessions/page-18757fcd067b7e9d.js +0 -1
- package/dist/web/_next/static/chunks/app/settings/page-f62176848534f90a.js +0 -1
- package/dist/web/_next/static/css/bd612b1ca9b40306.css +0 -1
- package/dist/web/app-build-manifest.json +0 -3
- package/dist/web/build-manifest.json +0 -17
- package/dist/web/react-loadable-manifest.json +0 -1
- package/dist/web/server/app-paths-manifest.json +0 -1
- package/dist/web/server/interception-route-rewrite-manifest.js +0 -1
- package/dist/web/server/middleware-build-manifest.js +0 -19
- package/dist/web/server/middleware-manifest.json +0 -6
- package/dist/web/server/middleware-react-loadable-manifest.js +0 -1
- package/dist/web/server/next-font-manifest.js +0 -1
- package/dist/web/server/next-font-manifest.json +0 -1
- package/dist/web/server/pages-manifest.json +0 -1
- package/dist/web/server/server-reference-manifest.js +0 -1
- package/dist/web/server/server-reference-manifest.json +0 -5
- package/dist/web/static/development/_buildManifest.js +0 -1
- package/dist/web/static/development/_ssgManifest.js +0 -1
- package/dist/web/types/cache-life.d.ts +0 -141
- package/dist/web/types/package.json +0 -1
- package/dist/web/types/routes.d.ts +0 -66
- package/dist/web/types/validator.ts +0 -142
- /package/dist/web/_next/static/{J4YFiPdzNcFHieP2FIPPe → QrKxazgwMrykF2yLwDvUM}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{J4YFiPdzNcFHieP2FIPPe → QrKxazgwMrykF2yLwDvUM}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[700],{1298:(e,t,a)=>{a.d(t,{E:()=>r});function r(e,t){let a="".concat("https:"===window.location.protocol?"wss:":"ws:","//").concat(window.location.host,"/ws"),r=null,n=null,i=!1;return!function o(){i||((r=new WebSocket(a)).onopen=()=>{var e;null==t||null==(e=t.onOpen)||e.call(t)},r.onmessage=t=>{try{let a=JSON.parse(t.data);e(a.event,a.payload)}catch(e){}},r.onclose=()=>{var e;null==t||null==(e=t.onClose)||e.call(t),i||(n=setTimeout(o,3e3))},r.onerror=()=>null==r?void 0:r.close())}(),{close:()=>{i=!0,n&&clearTimeout(n),null==r||r.close()}}}},2755:(e,t,a)=>{a.d(t,{Qc:()=>u,Z6:()=>d,t0:()=>p});var r=a(8111),n=a(5271);let i={accentColor:null,portalName:null,portalSubtitle:null,portalEmoji:null,portalIcon:null,iconBgHidden:!1,emojiOnly:!1,operatorName:null,language:"English",employeeOverrides:{}},o="jinn-settings";function l(e){localStorage.setItem(o,JSON.stringify(e))}var s=a(3176);let c=(0,n.createContext)({settings:{accentColor:null,portalName:null,portalSubtitle:null,portalEmoji:null,portalIcon:null,iconBgHidden:!1,emojiOnly:!1,operatorName:null,language:"English",employeeOverrides:{}},setAccentColor:()=>{},setPortalName:()=>{},setPortalSubtitle:()=>{},setPortalEmoji:()=>{},setPortalIcon:()=>{},setIconBgHidden:()=>{},setEmojiOnly:()=>{},setOperatorName:()=>{},setLanguage:()=>{},setEmployeeOverride:()=>{},clearEmployeeOverride:()=>{},getEmployeeDisplay:e=>({emoji:e.emoji}),resetAll:()=>{}});function d(e){let{children:t}=e,[a,d]=(0,n.useState)({...i});(0,n.useEffect)(()=>{let e=function(){try{let e=localStorage.getItem(o);if(!e)return{...i};let t=JSON.parse(e);return{...i,...t}}catch(e){return{...i}}}();d(e),s.F.getOnboarding().then(t=>{if(t.portalName||t.operatorName){let a={...e,...t.portalName&&{portalName:t.portalName},...t.operatorName&&{operatorName:t.operatorName}};d(a),l(a)}}).catch(()=>{})},[]),(0,n.useEffect)(()=>{let e=document.documentElement.style;a.accentColor?(e.setProperty("--accent",a.accentColor),e.setProperty("--accent-fill",function(e){let t=parseInt(e.slice(1,3),16),a=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return"rgba(".concat(t,",").concat(a,",").concat(r,",0.15)")}(a.accentColor)),e.setProperty("--accent-contrast",function(e){let t=parseInt(e.slice(1,3),16)/255,a=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,n=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return .2126*n(t)+.7152*n(a)+.0722*n(r)>.4?"#000":"#fff"}(a.accentColor))):(e.removeProperty("--accent"),e.removeProperty("--accent-fill"),e.removeProperty("--accent-contrast"))},[a.accentColor]);let p=(0,n.useCallback)(e=>{d(t=>{let a=e(t);return l(a),a})},[]),u=(0,n.useCallback)(e=>{p(t=>({...t,accentColor:e}))},[p]),h=(0,n.useCallback)(e=>{p(t=>({...t,portalName:e||null}))},[p]),g=(0,n.useCallback)(e=>{p(t=>({...t,portalSubtitle:e||null}))},[p]),x=(0,n.useCallback)(e=>{p(t=>({...t,portalEmoji:e||null}))},[p]),m=(0,n.useCallback)(e=>{p(t=>({...t,portalIcon:e}))},[p]),f=(0,n.useCallback)(e=>{p(t=>({...t,iconBgHidden:e}))},[p]),v=(0,n.useCallback)(e=>{p(t=>({...t,emojiOnly:e}))},[p]),y=(0,n.useCallback)(e=>{p(t=>({...t,operatorName:e||null}))},[p]),b=(0,n.useCallback)(e=>{p(t=>({...t,language:e||"English"}))},[p]),j=(0,n.useCallback)((e,t)=>{p(a=>{let r=a.employeeOverrides[e]||{};return{...a,employeeOverrides:{...a.employeeOverrides,[e]:{...r,...t}}}})},[p]),k=(0,n.useCallback)(e=>{p(t=>{let{[e]:a,...r}=t.employeeOverrides;return{...t,employeeOverrides:r}})},[p]),w=(0,n.useCallback)(e=>{let t=a.employeeOverrides[e.id];return{emoji:(null==t?void 0:t.emoji)||e.emoji,profileImage:null==t?void 0:t.profileImage,emojiOnly:a.emojiOnly}},[a.employeeOverrides,a.emojiOnly]),S=(0,n.useCallback)(()=>{p(()=>({accentColor:null,portalName:null,portalSubtitle:null,portalEmoji:null,portalIcon:null,iconBgHidden:!1,emojiOnly:!1,operatorName:null,language:"English",employeeOverrides:{}}))},[p]);return(0,r.jsx)(c.Provider,{value:{settings:a,setAccentColor:u,setPortalName:h,setPortalSubtitle:g,setPortalEmoji:x,setPortalIcon:m,setIconBgHidden:f,setEmojiOnly:v,setOperatorName:y,setLanguage:b,setEmployeeOverride:j,clearEmployeeOverride:k,getEmployeeDisplay:w,resetAll:S},children:t})}let p=()=>(0,n.useContext)(c);function u(){let{settings:e}=p(),t=(0,n.useRef)(e.portalName);return t.current=e.portalName,(0,n.useEffect)(()=>{function e(){let e=t.current||"Jinn",a="".concat(e," - AI Gateway");document.title!==a&&(document.title=a)}e();let a=document.querySelector("title");if(!a)return;let r=new MutationObserver(()=>e());return r.observe(a,{childList:!0,characterData:!0,subtree:!0}),()=>r.disconnect()},[e.portalName]),null}},3176:(e,t,a)=>{a.d(t,{F:()=>c});let r=window.location.origin;async function n(e){try{let t=await e.json();if(t.error)return String(t.error);if(t.message)return String(t.message)}catch(e){}return"API error: ".concat(e.status)}async function i(e){let t=await fetch("".concat(r).concat(e));if(!t.ok)throw Error(await n(t));return t.json()}async function o(e,t){let a=await fetch("".concat(r).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:t?JSON.stringify(t):void 0});if(!a.ok)throw Error(await n(a));return a.json()}async function l(e){let t=await fetch("".concat(r).concat(e),{method:"DELETE"});if(!t.ok)throw Error(await n(t));return t.json()}async function s(e,t){let a=await fetch("".concat(r).concat(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw Error(await n(a));return a.json()}let c={getStatus:()=>i("/api/status"),getSessions:()=>i("/api/sessions"),getSession:e=>i("/api/sessions/".concat(e)),getSessionChildren:e=>i("/api/sessions/".concat(e,"/children")),deleteSession:e=>l("/api/sessions/".concat(e)),bulkDeleteSessions:e=>o("/api/sessions/bulk-delete",{ids:e}),createSession:e=>o("/api/sessions",e),createStubSession:e=>o("/api/sessions/stub",e),sendMessage:(e,t)=>o("/api/sessions/".concat(e,"/message"),t),getCronJobs:()=>i("/api/cron"),getCronRuns:e=>i("/api/cron/".concat(e,"/runs")),updateCronJob:(e,t)=>s("/api/cron/".concat(e),t),triggerCronJob:e=>o("/api/cron/".concat(e,"/trigger"),{}),getOrg:()=>i("/api/org"),getEmployee:e=>i("/api/org/employees/".concat(e)),getDepartmentBoard:e=>i("/api/org/departments/".concat(e,"/board")),getSkills:()=>i("/api/skills"),getSkill:e=>i("/api/skills/".concat(e)),getConfig:()=>i("/api/config"),updateConfig:e=>s("/api/config",e),getLogs:e=>i("/api/logs".concat(e?"?n=".concat(e):"")),getOnboarding:()=>i("/api/onboarding"),completeOnboarding:e=>o("/api/onboarding",e),getActivity:()=>i("/api/activity"),updateDepartmentBoard:(e,t)=>s("/api/org/departments/".concat(e,"/board"),t),sttStatus:()=>i("/api/stt/status"),sttDownload:()=>o("/api/stt/download",{}),sttTranscribe:async(e,t)=>{let a=t?"?language=".concat(encodeURIComponent(t)):"",n=new AbortController,i=setTimeout(()=>n.abort(),3e5);try{let t=await fetch("".concat(r,"/api/stt/transcribe").concat(a),{method:"POST",headers:{"Content-Type":e.type||"audio/webm"},body:e,signal:n.signal});if(!t.ok)throw Error("API error: ".concat(t.status));return t.json()}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw Error("Transcription timed out (5 min)");throw e}finally{clearTimeout(i)}},sttUpdateConfig:e=>s("/api/stt/config",{languages:e})}},3841:(e,t,a)=>{a.d(t,{E$:()=>l,V2:()=>o,uW:()=>i});var r=a(5271);let n="jinn-notif-prompted";function i(){"Notification"in window&&"default"===Notification.permission&&(localStorage.getItem(n)||setTimeout(()=>{"default"===Notification.permission&&(Notification.requestPermission(),localStorage.setItem(n,"1"))},1e4))}let o=(0,r.createContext)({notifications:[],unreadCount:0,toasts:[],pushFromEvent:()=>{},dismissToast:()=>{},markAllRead:()=>{},markRead:()=>{},clearAll:()=>{}});function l(){return(0,r.useContext)(o)}},4263:(e,t,a)=>{a.d(t,{G:()=>i});var r=a(5271),n=a(1298);function i(){let[e,t]=(0,r.useState)([]),[a,i]=(0,r.useState)(!1),[o,l]=(0,r.useState)(0),[s,c]=(0,r.useState)(0);return(0,r.useEffect)(()=>{let e=(0,n.E)((e,a)=>{t(t=>[...t.slice(-99),{event:e,payload:a}]),"skills:changed"===e&&c(e=>e+1)},{onOpen:()=>{i(!0),l(e=>e+1)},onClose:()=>{i(!1)}});return()=>e.close()},[]),{events:e,connected:a,connectionSeq:o,skillsVersion:s}}},5310:(e,t,a)=>{a.d(t,{b:()=>c,w:()=>s});var r=a(8111),n=a(5271);let i={info:"var(--system-green)",warn:"var(--system-orange)",error:"var(--system-red)",debug:"var(--text-tertiary)"},o={info:"rgba(48,209,88,0.12)",warn:"rgba(255,159,10,0.12)",error:"rgba(255,69,58,0.12)",debug:"var(--fill-secondary)"},l=[{key:"all",label:"All"},{key:"info",label:"Info"},{key:"warn",label:"Warn"},{key:"error",label:"Errors"}];function s(e,t){let a=e.match(/^(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+\[(\w+)\]\s*(.*)$/);return a?{id:"log-".concat(t),timestamp:a[1],level:a[2].toLowerCase(),message:a[3]}:{id:"log-".concat(t),timestamp:"",level:"info",message:e}}function c(e){let{lines:t}=e,[a,c]=(0,n.useState)("all"),[d,p]=(0,n.useState)(""),[u,h]=(0,n.useState)(null),g=t.map(s),x=g.filter(e=>("all"===a||e.level===a)&&(!d||!!e.message.toLowerCase().includes(d.toLowerCase()))),m={all:g.length,info:g.filter(e=>"info"===e.level).length,warn:g.filter(e=>"warn"===e.level).length,error:g.filter(e=>"error"===e.level).length};return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center flex-wrap",style:{gap:"var(--space-2)",marginBottom:"var(--space-3)"},children:[l.map(e=>{let t=a===e.key;return(0,r.jsxs)("button",{onClick:()=>c(e.key),className:"focus-ring flex items-center flex-shrink-0",style:{borderRadius:20,padding:"6px 14px",fontSize:"var(--text-footnote)",fontWeight:"var(--weight-medium)",border:"none",cursor:"pointer",gap:"var(--space-2)",transition:"all 200ms var(--ease-smooth)",...t?{background:"var(--accent-fill)",color:"var(--accent)",boxShadow:"0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent)"}:{background:"var(--fill-secondary)",color:"var(--text-primary)"}},children:[(0,r.jsx)("span",{children:e.label}),(0,r.jsx)("span",{style:{fontWeight:"var(--weight-semibold)",color:t?"var(--accent)":"var(--text-secondary)"},children:m[e.key]})]},e.key)}),(0,r.jsx)("input",{type:"text",placeholder:"Search logs...",value:d,onChange:e=>p(e.target.value),className:"focus-ring",style:{marginLeft:"auto",padding:"6px 12px",fontSize:"var(--text-footnote)",borderRadius:"var(--radius-sm)",border:"1px solid var(--separator)",background:"var(--fill-secondary)",color:"var(--text-primary)",outline:"none",minWidth:160,maxWidth:240}})]}),0===x.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center",style:{height:200,color:"var(--text-secondary)",gap:"var(--space-2)"},children:[(0,r.jsx)("span",{style:{fontSize:"var(--text-subheadline)",fontWeight:"var(--weight-medium)"},children:0===g.length?"No log entries found":"No entries match this filter"}),(0,r.jsx)("span",{style:{fontSize:"var(--text-footnote)",color:"var(--text-tertiary)"},children:0===g.length?"Log entries will appear here when available":"Try adjusting your filter or search"})]}):(0,r.jsx)("div",{style:{borderRadius:"var(--radius-md)",overflow:"hidden",background:"var(--material-regular)",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:x.map((e,t)=>{var a,n;let l=u===e.id,s=null!=(a=i[e.level])?a:"var(--text-tertiary)",c=e.message.length>120;return(0,r.jsxs)("div",{children:[t>0&&(0,r.jsx)("div",{style:{height:1,background:"var(--separator)",marginLeft:"var(--space-4)",marginRight:"var(--space-4)"}}),(0,r.jsxs)("div",{role:"button",tabIndex:0,"aria-expanded":c?l:void 0,onClick:()=>c&&h(l?null:e.id),onKeyDown:t=>{c&&("Enter"===t.key||" "===t.key)&&(t.preventDefault(),h(l?null:e.id))},className:"flex items-center hover-bg focus-ring",style:{minHeight:44,padding:"0 var(--space-4)",cursor:c?"pointer":"default",background:"error"===e.level?"rgba(255,69,58,0.06)":void 0},children:[(0,r.jsx)("span",{className:"flex-shrink-0 rounded-full",style:{width:8,height:8,background:s}}),e.timestamp&&(0,r.jsx)("span",{className:"flex-shrink-0 font-mono",style:{fontSize:"var(--text-caption1)",color:"var(--text-tertiary)",marginLeft:"var(--space-3)",minWidth:130},children:e.timestamp}),(0,r.jsx)("span",{className:"flex-shrink-0",style:{fontSize:"var(--text-caption2)",fontWeight:"var(--weight-semibold)",padding:"1px 6px",borderRadius:4,background:null!=(n=o[e.level])?n:"var(--fill-secondary)",color:s,marginLeft:"var(--space-2)",letterSpacing:"0.04em",textTransform:"uppercase"},children:e.level}),(0,r.jsx)("span",{className:"truncate",style:{fontSize:"var(--text-footnote)",color:"var(--text-primary)",marginLeft:"var(--space-3)",flex:1,minWidth:0},children:c&&!l?e.message.slice(0,117)+"...":e.message}),c&&(0,r.jsx)("span",{"aria-hidden":"true",style:{fontSize:"var(--text-footnote)",color:"var(--text-tertiary)",transition:"transform 200ms var(--ease-smooth)",transform:l?"rotate(90deg)":"rotate(0deg)",display:"inline-block",marginLeft:"var(--space-2)"},children:"›"})]}),l&&c&&(0,r.jsx)("div",{className:"animate-slide-down",style:{padding:"0 var(--space-4) var(--space-4) var(--space-4)"},children:(0,r.jsx)("div",{style:{borderRadius:"var(--radius-sm)",background:"var(--fill-secondary)",padding:"var(--space-3)",marginTop:"var(--space-2)"},children:(0,r.jsx)("pre",{className:"font-mono",style:{fontSize:"var(--text-caption2)",color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0,maxHeight:300,overflow:"auto",lineHeight:"var(--leading-relaxed)"},children:e.message})})})]},e.id)})})]})}},7460:(e,t,a)=>{a.d(t,{D:()=>l,N:()=>o});var r=a(8111),n=a(5271);let i=(0,n.createContext)({theme:"dark",setTheme:()=>{}});function o(e){let{children:t}=e,[a,o]=(0,n.useState)("dark"),l=(0,n.useCallback)(e=>{o(e),localStorage.setItem("jinn-theme",e);let t=document.documentElement;if(t.removeAttribute("data-theme"),"system"===e){let e=window.matchMedia("(prefers-color-scheme: dark)").matches;t.setAttribute("data-theme",e?"dark":"light")}else t.setAttribute("data-theme",e)},[]);return(0,n.useEffect)(()=>{let e=localStorage.getItem("jinn-theme");e&&l(e)},[l]),(0,n.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)");function t(){"system"===localStorage.getItem("jinn-theme")&&document.documentElement.setAttribute("data-theme",e.matches?"dark":"light")}return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,r.jsx)(i.Provider,{value:{theme:a,setTheme:l},children:t})}function l(){return(0,n.useContext)(i)}},8700:(e,t,a)=>{a.d(t,{M:()=>eg});var r=a(8111),n=a(1251),i=a.n(n),o=a(5271),l=a(5935),s=a.n(l),c=a(4736),d=a(2755),p=a(5275),u=a(9006),h=a(4206),g=a(7460),x=a(9834),m=a(8193),f=a(6778),v=a(7549),y=a(2265),b=a(6808),j=a(1935),k=a(6361),w=a(4514),S=a(9026),C=a(3254);let z=[{href:"/",label:"Home",icon:m.A},{href:"/chat",label:"Chat",icon:f.A},{href:"/sessions",label:"Sessions",icon:v.A},{href:"/org",label:"Organization",icon:y.A},{href:"/kanban",label:"Kanban",icon:b.A},{href:"/cron",label:"Cron",icon:j.A},{href:"/costs",label:"Costs",icon:k.A},{href:"/logs",label:"Activity",icon:w.A},{href:"/skills",label:"Skills",icon:S.A},{href:"/settings",label:"Settings",icon:C.A}];function N(e){let{theme:t}=e;switch(t){case"light":return(0,r.jsx)(p.A,{size:18});case"dark":return(0,r.jsx)(u.A,{size:18});default:return(0,r.jsx)(h.A,{size:18})}}function A(){var e,t;let a=(0,c.usePathname)(),{theme:n,setTheme:i}=(0,g.D)(),{settings:l}=(0,d.t0)(),[p,u]=(0,o.useState)(!1),h=null!=(e=l.portalEmoji)?e:"\uD83E\uDD16",m=null!=(t=l.portalName)?t:"Jinn";return(0,r.jsxs)("aside",{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{position:"fixed",left:0,top:0,bottom:0,width:p?200:56,background:"var(--bg-secondary)",borderRight:"1px solid var(--separator)",flexDirection:"column",zIndex:50,transition:"width 200ms var(--ease-smooth)",overflow:"hidden"},className:"hidden lg:flex",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"16px 14px 12px",minHeight:56,flexShrink:0},children:[(0,r.jsx)("span",{style:{fontSize:24,lineHeight:1,flexShrink:0,width:28,textAlign:"center"},children:h}),(0,r.jsx)("span",{style:{fontSize:17,fontWeight:600,color:"var(--text-primary)",whiteSpace:"nowrap",opacity:+!!p,transition:"opacity 200ms var(--ease-smooth)"},children:m})]}),(0,r.jsx)("nav",{style:{flex:1,display:"flex",flexDirection:"column",gap:2,padding:"0 8px"},children:z.map(e=>{let t="/"===e.href?"/"===a:a.startsWith(e.href),n=e.icon;return(0,r.jsxs)(s(),{href:e.href,className:"nav-item","aria-label":e.label,"aria-current":t?"page":void 0,style:{display:"flex",alignItems:"center",gap:10,height:40,padding:"0 12px",textDecoration:"none",color:t?"var(--accent)":"var(--text-secondary)",background:t?"var(--accent-fill)":"transparent",fontWeight:t?600:400,fontSize:13,whiteSpace:"nowrap"},children:[(0,r.jsx)(n,{size:18,style:{flexShrink:0,color:t?"var(--accent)":"var(--text-secondary)"}}),(0,r.jsx)("span",{style:{opacity:+!!p,transition:"opacity 200ms var(--ease-smooth)"},children:e.label})]},e.href)})}),(0,r.jsx)("div",{style:{padding:"8px 8px 12px",flexShrink:0},children:(0,r.jsxs)("button",{onClick:function(){let e=x.z.map(e=>e.id),t=e.indexOf(n);i(e[(t+1)%e.length])},className:"nav-item","aria-label":"Theme: ".concat(n,". Click to cycle."),style:{display:"flex",alignItems:"center",gap:10,height:40,padding:"0 12px",width:"100%",border:"none",background:"transparent",color:"var(--text-secondary)",cursor:"pointer",fontSize:13,whiteSpace:"nowrap"},children:[(0,r.jsx)("span",{style:{flexShrink:0},children:(0,r.jsx)(N,{theme:n})}),(0,r.jsx)("span",{style:{opacity:+!!p,transition:"opacity 200ms var(--ease-smooth)",textTransform:"capitalize"},children:n})]})})]})}var E=a(8067);let I=window.location.origin,W=[{id:"page-home",label:"Dashboard",icon:(0,r.jsx)(m.A,{size:16}),href:"/",category:"Pages"},{id:"page-chat",label:"Chat",icon:(0,r.jsx)(f.A,{size:16}),href:"/chat",category:"Pages"},{id:"page-sessions",label:"Sessions",icon:(0,r.jsx)(v.A,{size:16}),href:"/sessions",category:"Pages"},{id:"page-org",label:"Organization",icon:(0,r.jsx)(y.A,{size:16}),href:"/org",category:"Pages"},{id:"page-kanban",label:"Kanban",icon:(0,r.jsx)(b.A,{size:16}),href:"/kanban",category:"Pages"},{id:"page-cron",label:"Cron",icon:(0,r.jsx)(j.A,{size:16}),href:"/cron",category:"Pages"},{id:"page-costs",label:"Costs",icon:(0,r.jsx)(k.A,{size:16}),href:"/costs",category:"Pages"},{id:"page-logs",label:"Activity",icon:(0,r.jsx)(w.A,{size:16}),href:"/logs",category:"Pages"},{id:"page-skills",label:"Skills",icon:(0,r.jsx)(S.A,{size:16}),href:"/skills",category:"Pages"},{id:"page-settings",label:"Settings",icon:(0,r.jsx)(C.A,{size:16}),href:"/settings",category:"Pages"}];function R(e,t){return t.toLowerCase().includes(e.toLowerCase())}function D(){var e;let{settings:t}=(0,d.t0)(),a=null!=(e=t.portalName)?e:"Jinn",[n,i]=(0,o.useState)(!1),[l,s]=(0,o.useState)(""),[p,u]=(0,o.useState)(0),[h,g]=(0,o.useState)([]),[x,m]=(0,o.useState)([]),f=(0,o.useRef)(null),v=(0,o.useRef)(null),b=(0,c.useRouter)();(0,o.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),i(e=>!e))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),(0,o.useEffect)(()=>{n&&(s(""),u(0),fetch("".concat(I,"/api/org")).then(e=>{if(!e.ok)throw Error("HTTP ".concat(e.status));return e.json()}).then(e=>{if(Array.isArray(e))g(e);else if(e&&"object"==typeof e&&"employees"in e){var t;g(null!=(t=e.employees)?t:[])}}).catch(()=>g([])),fetch("".concat(I,"/api/cron")).then(e=>{if(!e.ok)throw Error("HTTP ".concat(e.status));return e.json()}).then(e=>{if(Array.isArray(e))m(e);else if(e&&"object"==typeof e&&"crons"in e){var t;m(null!=(t=e.crons)?t:[])}}).catch(()=>m([])))},[n]),(0,o.useEffect)(()=>{n&&requestAnimationFrame(()=>{var e;return null==(e=f.current)?void 0:e.focus()})},[n]),(0,o.useEffect)(()=>(n?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[n]);let k=(0,o.useMemo)(()=>{let e=[...W];return(h.forEach(t=>{e.push({id:"emp-".concat(t.id),label:t.name,subtitle:t.title,icon:(0,r.jsx)(y.A,{size:16}),href:"/org",category:"Employees"})}),x.forEach(t=>{e.push({id:"cron-".concat(t.id),label:t.name,subtitle:t.schedule,icon:(0,r.jsx)(j.A,{size:16}),href:"/cron",category:"Cron Jobs"})}),l.trim())?e.filter(e=>R(l,e.label)||e.subtitle&&R(l,e.subtitle)):e},[l,h,x]),w=(0,o.useMemo)(()=>{let e=[];for(let t of["Pages","Employees","Cron Jobs"]){let a=k.filter(e=>e.category===t);a.length>0&&e.push({category:t,items:a})}return e},[k]),S=(0,o.useMemo)(()=>w.flatMap(e=>e.items),[w]),C=(0,o.useCallback)(e=>{i(!1),b.push(e.href)},[b]),z=(0,o.useCallback)(e=>{if("Escape"===e.key){e.preventDefault(),i(!1);return}if("ArrowDown"===e.key){e.preventDefault(),u(e=>Math.min(e+1,S.length-1));return}if("ArrowUp"===e.key){e.preventDefault(),u(e=>Math.max(e-1,0));return}if("Enter"===e.key){e.preventDefault(),S[p]&&C(S[p]);return}},[p,S,C]);if((0,o.useEffect)(()=>{u(0)},[l]),(0,o.useEffect)(()=>{if(!v.current)return;let e=v.current.querySelector('[data-active="true"]');e&&e.scrollIntoView({block:"nearest"})},[p]),!n)return null;let N=0;return(0,r.jsxs)("div",{style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"20vh"},children:[(0,r.jsx)("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:()=>i(!1),"aria-hidden":"true"}),(0,r.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Search ".concat(a),className:"animate-scale-in",onKeyDown:z,style:{position:"relative",width:"100%",maxWidth:560,margin:"0 16px",borderRadius:"var(--radius-xl)",background:"var(--bg-secondary)",border:"1px solid var(--separator)",boxShadow:"var(--shadow-overlay)",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:480},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px",borderBottom:"1px solid var(--separator)"},children:[(0,r.jsx)(E.A,{size:18,style:{color:"var(--text-tertiary)",flexShrink:0},"aria-hidden":"true"}),(0,r.jsx)("input",{ref:f,type:"text",value:l,onChange:e=>s(e.target.value),placeholder:"Search ".concat(a,"..."),"aria-label":"Search ".concat(a),style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:15,color:"var(--text-primary)",fontFamily:"inherit"}}),(0,r.jsx)("kbd",{style:{fontSize:11,fontFamily:"var(--font-mono)",padding:"2px 6px",borderRadius:4,background:"var(--fill-quaternary)",color:"var(--text-quaternary)",border:"1px solid var(--separator)",lineHeight:"16px"},children:"esc"})]}),(0,r.jsxs)("div",{ref:v,role:"listbox","aria-label":"Search results",style:{flex:1,overflowY:"auto",padding:8},children:[0===S.length&&l.trim()&&(0,r.jsxs)("div",{style:{padding:"24px 16px",textAlign:"center",color:"var(--text-tertiary)",fontSize:13},children:["No results for “",l,"”"]}),w.map(e=>(0,r.jsxs)("div",{style:{marginBottom:4},children:[(0,r.jsx)("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-tertiary)",padding:"6px 8px 4px"},children:e.category}),e.items.map(e=>{let t=N++,a=t===p;return(0,r.jsxs)("button",{role:"option","aria-selected":a,"data-active":a,onClick:()=>C(e),onMouseEnter:()=>u(t),style:{display:"flex",alignItems:"center",gap:10,width:"100%",minHeight:40,padding:"8px 10px",borderRadius:"var(--radius-sm)",border:"none",background:a?"var(--accent-fill)":"transparent",cursor:"pointer",textAlign:"left",transition:"background 80ms var(--ease-smooth)",outline:"none",color:"var(--text-primary)",fontFamily:"inherit",fontSize:13},children:[(0,r.jsx)("span",{style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"var(--fill-quaternary)",flexShrink:0,color:"var(--text-secondary)"},children:e.icon}),(0,r.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,r.jsx)("div",{style:{fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),e.subtitle&&(0,r.jsx)("div",{style:{fontSize:11,color:"var(--text-tertiary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.subtitle})]})]},e.id)})]},e.category))]}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"8px 16px",borderTop:"1px solid var(--separator)",fontSize:11,color:"var(--text-quaternary)"},children:[(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{style:{fontFamily:"var(--font-mono)"},children:"↑↓"})," Navigate"]}),(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{style:{fontFamily:"var(--font-mono)"},children:"↵"})," Open"]}),(0,r.jsxs)("span",{children:[(0,r.jsx)("kbd",{style:{fontFamily:"var(--font-mono)"},children:"esc"})," Close"]})]})]})]})}var O=a(6650),B=a(4640),T=a(1061),P=a(3176),F=a(4263),L=a(5310);let H="open-live-stream",M={info:{bg:"rgba(48,209,88,0.12)",color:"var(--system-green)",label:"INF"},warn:{bg:"rgba(255,159,10,0.12)",color:"var(--system-orange)",label:"WRN"},error:{bg:"rgba(255,69,58,0.12)",color:"var(--system-red)",label:"ERR"},debug:{bg:"var(--fill-secondary)",color:"var(--text-tertiary)",label:"DBG"}};function J(e){return"[".concat(e.timestamp,"] [").concat(e.level.toUpperCase(),"] ").concat(e.message)}function q(e){var t;let{entry:a}=e,[n,i]=(0,o.useState)(!1),l=null!=(t=M[a.level])?t:M.debug,s=a.message.length>100;return(0,r.jsxs)("div",{style:{borderBottom:"1px solid var(--separator)",background:"error"===a.level?"rgba(255,69,58,0.03)":void 0},children:[(0,r.jsxs)("button",{onClick:()=>s&&i(e=>!e),style:{display:"flex",alignItems:"center",width:"100%",padding:"5px 12px",gap:8,border:"none",background:"transparent",cursor:s?"pointer":"default",textAlign:"left"},children:[s?(0,r.jsx)("span",{style:{fontSize:10,color:"var(--text-tertiary)",flexShrink:0,transition:"transform 150ms var(--ease-smooth)",transform:n?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"›"}):(0,r.jsx)("span",{style:{width:10,flexShrink:0}}),(0,r.jsx)("span",{className:"font-mono",style:{color:"var(--text-tertiary)",fontSize:10,flexShrink:0,minWidth:58},children:function(e){if(!e)return"";let t=e.split(" ");return t.length>1?t[1]:e}(a.timestamp)}),(0,r.jsx)("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.5px",padding:"1px 5px",borderRadius:3,background:l.bg,color:l.color,flexShrink:0,lineHeight:"14px"},children:l.label}),(0,r.jsx)("span",{className:"font-mono",style:{color:"error"===a.level?"var(--system-red)":"var(--text-secondary)",fontSize:10,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:a.message})]}),n&&s&&(0,r.jsx)("div",{style:{padding:"6px 12px 8px 30px",borderTop:"1px solid var(--separator)",background:"var(--fill-secondary)"},children:(0,r.jsx)("pre",{className:"font-mono",style:{fontSize:9,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:a.message})})]})}function G(){let[e,t]=(0,o.useState)("hidden"),[a,n]=(0,o.useState)([]),[i,l]=(0,o.useState)(!0),[s,c]=(0,o.useState)(!1),[d,p]=(0,o.useState)(null),u=(0,o.useRef)(null),h=(0,o.useRef)(0),{events:g}=(0,F.G)();(0,o.useEffect)(()=>{i&&u.current&&(u.current.scrollTop=u.current.scrollHeight)},[a,i]);let x=(0,o.useCallback)(()=>{if(!u.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:a}=u.current;t-e-a<40?l(!0):l(!1)},[]);(0,o.useEffect)(()=>{"expanded"===e&&P.F.getLogs(50).then(e=>{var t;n((null!=(t=e.lines)?t:[]).map(L.w)),p(null)}).catch(e=>{p(e instanceof Error?e.message:"Failed to load logs")})},[e]),(0,o.useEffect)(()=>{if("hidden"===e||0===g.length)return;let t=g[g.length-1];if("log"===t.event&&"object"==typeof t.payload&&null!==t.payload){let e=t.payload,a=e.line||e.message||JSON.stringify(t.payload),r=(0,L.w)(a,h.current++);n(e=>[...e,r].slice(-500))}},[g,e]);let m=(0,o.useCallback)(()=>{t("hidden")},[]),f=(0,o.useCallback)(async()=>{let e=a.map(J).join("\n");await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)},[a]);return((0,o.useEffect)(()=>{function e(){t("expanded")}return window.addEventListener(H,e),()=>window.removeEventListener(H,e)},[]),"hidden"===e)?null:"collapsed"===e?(0,r.jsxs)("button",{onClick:()=>t("expanded"),className:"focus-ring flex items-center",style:{position:"fixed",bottom:20,right:20,zIndex:50,padding:"8px 14px",borderRadius:"var(--radius-pill)",border:"1px solid var(--separator)",background:"var(--material-regular)",backdropFilter:"blur(40px) saturate(180%)",WebkitBackdropFilter:"blur(40px) saturate(180%)",cursor:"pointer",gap:8,boxShadow:"0 4px 24px rgba(0,0,0,0.25)"},children:[(0,r.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",background:"var(--system-green)",animation:"lsw-pulse 2s ease-in-out infinite",flexShrink:0}}),(0,r.jsx)("span",{style:{fontSize:"var(--text-caption1)",color:"var(--text-secondary)",fontWeight:"var(--weight-medium)"},children:"Live Stream"}),a.length>0&&(0,r.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",background:"var(--fill-secondary)",padding:"1px 6px",borderRadius:"var(--radius-sm)"},children:a.length}),(0,r.jsx)("style",{children:"@keyframes lsw-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }"})]}):(0,r.jsxs)("div",{className:"panel-slide-in",style:{position:"fixed",bottom:20,right:20,zIndex:50,width:440,height:400,borderRadius:"var(--radius-lg)",border:"1px solid var(--separator)",background:"var(--material-regular)",backdropFilter:"blur(40px) saturate(180%)",WebkitBackdropFilter:"blur(40px) saturate(180%)",boxShadow:"0 8px 40px rgba(0,0,0,0.35)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,r.jsxs)("div",{className:"flex items-center flex-shrink-0",style:{padding:"10px 14px",borderBottom:"1px solid var(--separator)",gap:8},children:[(0,r.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",background:"var(--system-green)",animation:"lsw-pulse 2s ease-in-out infinite",flexShrink:0}}),(0,r.jsx)("span",{style:{fontSize:"var(--text-footnote)",fontWeight:"var(--weight-semibold)",color:"var(--text-primary)"},children:"Live Stream"}),a.length>0&&(0,r.jsxs)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)"},children:[a.length," line",1!==a.length?"s":""]}),(0,r.jsxs)("div",{style:{marginLeft:"auto",display:"flex",gap:4},children:[(0,r.jsx)("button",{onClick:f,className:"focus-ring",title:"Copy all logs",disabled:0===a.length,style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-sm)",border:"none",background:s?"var(--accent-fill)":"transparent",color:s?"var(--accent)":"var(--text-tertiary)",cursor:0===a.length?"default":"pointer",opacity:0===a.length?.3:1,transition:"all 150ms var(--ease-smooth)"},children:(0,r.jsx)(O.A,{size:14})}),(0,r.jsx)("button",{onClick:()=>t("collapsed"),className:"focus-ring",title:"Minimize",style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-sm)",border:"none",background:"transparent",color:"var(--text-tertiary)",cursor:"pointer",transition:"color 150ms var(--ease-smooth)"},children:(0,r.jsx)(B.A,{size:14})}),(0,r.jsx)("button",{onClick:m,className:"focus-ring",title:"Close",style:{width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-sm)",border:"none",background:"transparent",color:"var(--text-tertiary)",cursor:"pointer",transition:"color 150ms var(--ease-smooth)"},children:(0,r.jsx)(T.A,{size:14})})]})]}),d&&(0,r.jsx)("div",{style:{padding:"6px 14px",background:"rgba(255,69,58,0.06)",borderBottom:"1px solid rgba(255,69,58,0.15)",fontSize:"var(--text-caption2)",color:"var(--system-red)",flexShrink:0},children:d}),(0,r.jsx)("div",{ref:u,onScroll:x,style:{flex:1,minHeight:0,overflowY:"auto",overflowX:"hidden"},children:0===a.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center",style:{height:"100%",color:"var(--text-secondary)",gap:"var(--space-2)",padding:"var(--space-4)"},children:[(0,r.jsx)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-tertiary)"},children:(0,r.jsx)("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),(0,r.jsx)("span",{style:{fontSize:"var(--text-caption1)",fontWeight:"var(--weight-medium)"},children:"Waiting for log data..."})]}):(0,r.jsx)("div",{children:a.map(e=>(0,r.jsx)(q,{entry:e},e.id))})}),(0,r.jsx)("div",{className:"flex items-center flex-shrink-0",style:{padding:"8px 14px",borderTop:"1px solid var(--separator)",gap:8},children:!i&&a.length>0&&(0,r.jsx)("button",{onClick:()=>l(!0),className:"focus-ring",style:{padding:"4px 10px",borderRadius:"var(--radius-sm)",border:"none",cursor:"pointer",fontSize:"var(--text-caption2)",fontWeight:"var(--weight-medium)",background:"var(--fill-secondary)",color:"var(--text-secondary)"},children:"Scroll to bottom"})}),(0,r.jsx)("style",{children:"@keyframes lsw-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }"})]})}var K=a(4430),Y=a(1509),U=a(8146),V=a(2407),$=a(5136);let _=[{label:"Red",value:"#EF4444"},{label:"Orange",value:"#F97316"},{label:"Amber",value:"#F59E0B"},{label:"Yellow",value:"#EAB308"},{label:"Lime",value:"#84CC16"},{label:"Green",value:"#22C55E"},{label:"Emerald",value:"#10B981"},{label:"Cyan",value:"#06B6D4"},{label:"Blue",value:"#3B82F6"},{label:"Indigo",value:"#6366F1"},{label:"Violet",value:"#8B5CF6"},{label:"Pink",value:"#EC4899"}],Q=[{icon:f.A,name:"Chat",desc:"Direct conversations with any employee"},{icon:y.A,name:"Organization",desc:"Visual org chart of your AI team"},{icon:K.A,name:"Kanban",desc:"Task boards for work management"},{icon:j.A,name:"Cron",desc:"Scheduled jobs with status monitoring"},{icon:k.A,name:"Costs",desc:"Token usage and cost tracking"},{icon:w.A,name:"Activity",desc:"Real-time logs and event stream"}];function X(e){var t;let{forceOpen:a,onClose:n}=e,{settings:i,setPortalName:l,setOperatorName:s,setAccentColor:p,setLanguage:u}=(0,d.t0)(),{theme:h,setTheme:m}=(0,g.D)(),f=(0,c.useRouter)(),[v,y]=(0,o.useState)(!1),[b,j]=(0,o.useState)(0),[k,w]=(0,o.useState)("forward"),[S,C]=(0,o.useState)(""),[z,N]=(0,o.useState)(""),[A,E]=(0,o.useState)(null!=(t=i.language)?t:"English");(0,o.useEffect)(()=>{if(a){var e,t;C(null!=(e=i.portalName)?e:""),N(null!=(t=i.operatorName)?t:""),y(!0);return}localStorage.getItem("jinn-onboarded")||y(!0)},[a]);let I=(0,o.useCallback)(()=>{0===b&&(l(S||null),s(z||null),u(A||"English")),b<3?(w("forward"),j(b+1)):(P.F.completeOnboarding({portalName:S||void 0,operatorName:z||void 0,language:A||void 0}).catch(()=>{}),a||localStorage.setItem("jinn-onboarded","true"),y(!1),null==n||n(),f.push("/chat"))},[b,S,z,a,n,l,s,f]),W=(0,o.useCallback)(()=>{b>0&&(w("back"),j(b-1))},[b]);return v?(0,r.jsx)("div",{style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.6)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:(0,r.jsxs)("div",{className:"animate-fade-in",style:{width:"100%",maxWidth:520,margin:"0 var(--space-4)",background:"var(--material-regular)",borderRadius:"var(--radius-lg)",border:"1px solid var(--separator)",boxShadow:"0 24px 48px rgba(0,0,0,0.3)",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"90vh"},children:[(0,r.jsx)("div",{style:{display:"flex",justifyContent:"center",gap:8,padding:"var(--space-4) var(--space-4) 0"},children:Array.from({length:4}).map((e,t)=>(0,r.jsx)("div",{style:{width:t===b?24:8,height:8,borderRadius:4,background:t===b||t<b?"var(--accent)":"var(--fill-tertiary)",opacity:t<b?.5:1,transition:"all 200ms var(--ease-smooth)"}},t))}),(0,r.jsxs)("div",{style:{padding:"var(--space-5) var(--space-5) var(--space-4)",overflowY:"auto",flex:1},children:[0===b&&(0,r.jsxs)("div",{className:"animate-fade-in",style:{textAlign:"center"},children:[(0,r.jsx)("div",{style:{fontSize:56,marginBottom:"var(--space-3)",lineHeight:1},children:"\ud83e\udd16"}),(0,r.jsxs)("h2",{style:{fontSize:"var(--text-large-title)",fontWeight:"var(--weight-bold)",letterSpacing:"var(--tracking-tight)",color:"var(--text-primary)",marginBottom:"var(--space-2)"},children:["Welcome to ",S||"Jinn"]}),(0,r.jsx)("p",{style:{fontSize:"var(--text-body)",color:"var(--text-secondary)",lineHeight:"var(--leading-relaxed)",maxWidth:400,margin:"0 auto var(--space-5)"},children:"Your AI team management portal. Let's get you set up."}),(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-3)",textAlign:"left"},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{style:{display:"block",fontSize:"var(--text-caption1)",color:"var(--text-tertiary)",marginBottom:"var(--space-1)"},children:"Portal Name"}),(0,r.jsx)("input",{type:"text",className:"apple-input",placeholder:"Jinn",value:S,onChange:e=>C(e.target.value),autoFocus:!0,style:{width:"100%",background:"var(--bg-secondary)",border:"1px solid var(--separator)",borderRadius:"var(--radius-sm)",padding:"8px 12px",fontSize:"var(--text-body)",color:"var(--text-primary)"}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{style:{display:"block",fontSize:"var(--text-caption1)",color:"var(--text-tertiary)",marginBottom:"var(--space-1)"},children:"What should we call you?"}),(0,r.jsx)("input",{type:"text",className:"apple-input",placeholder:"Your Name",value:z,onChange:e=>N(e.target.value),style:{width:"100%",background:"var(--bg-secondary)",border:"1px solid var(--separator)",borderRadius:"var(--radius-sm)",padding:"8px 12px",fontSize:"var(--text-body)",color:"var(--text-primary)"}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{style:{display:"block",fontSize:"var(--text-caption1)",color:"var(--text-tertiary)",marginBottom:"var(--space-1)"},children:"Preferred Language"}),(0,r.jsxs)("select",{value:A,onChange:e=>E(e.target.value),style:{width:"100%",background:"var(--bg-secondary)",border:"1px solid var(--separator)",borderRadius:"var(--radius-sm)",padding:"8px 12px",fontSize:"var(--text-body)",color:"var(--text-primary)",cursor:"pointer"},children:[(0,r.jsx)("option",{value:"English",children:"English"}),(0,r.jsx)("option",{value:"Spanish",children:"Spanish"}),(0,r.jsx)("option",{value:"French",children:"French"}),(0,r.jsx)("option",{value:"German",children:"German"}),(0,r.jsx)("option",{value:"Portuguese",children:"Portuguese"}),(0,r.jsx)("option",{value:"Italian",children:"Italian"}),(0,r.jsx)("option",{value:"Dutch",children:"Dutch"}),(0,r.jsx)("option",{value:"Russian",children:"Russian"}),(0,r.jsx)("option",{value:"Chinese",children:"Chinese"}),(0,r.jsx)("option",{value:"Japanese",children:"Japanese"}),(0,r.jsx)("option",{value:"Korean",children:"Korean"}),(0,r.jsx)("option",{value:"Arabic",children:"Arabic"}),(0,r.jsx)("option",{value:"Hindi",children:"Hindi"}),(0,r.jsx)("option",{value:"Bulgarian",children:"Bulgarian"})]})]})]})]},"step-0"),1===b&&(0,r.jsxs)("div",{className:"animate-fade-in",children:[(0,r.jsx)("h2",{style:{fontSize:"var(--text-title1)",fontWeight:"var(--weight-bold)",letterSpacing:"var(--tracking-tight)",color:"var(--text-primary)",marginBottom:"var(--space-1)"},children:"Choose your theme"}),(0,r.jsx)("p",{style:{fontSize:"var(--text-subheadline)",color:"var(--text-tertiary)",marginBottom:"var(--space-4)"},children:"Pick the look that suits you. This applies live."}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(130px, 1fr))",gap:"var(--space-3)"},children:x.z.map(e=>{let t=h===e.id;return(0,r.jsxs)("button",{onClick:()=>m(e.id),style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--space-2)",padding:"var(--space-4) var(--space-3)",borderRadius:"var(--radius-md)",background:"var(--fill-quaternary)",border:t?"2px solid var(--accent)":"2px solid var(--separator)",cursor:"pointer",transition:"all 150ms var(--ease-smooth)"},children:[(0,r.jsx)("span",{style:{fontSize:28},children:e.emoji}),(0,r.jsx)("span",{style:{fontSize:"var(--text-footnote)",fontWeight:t?"var(--weight-semibold)":"var(--weight-medium)",color:t?"var(--accent)":"var(--text-secondary)"},children:e.label})]},e.id)})})]},"step-1"),2===b&&(0,r.jsxs)("div",{className:"animate-fade-in",children:[(0,r.jsx)("h2",{style:{fontSize:"var(--text-title1)",fontWeight:"var(--weight-bold)",letterSpacing:"var(--tracking-tight)",color:"var(--text-primary)",marginBottom:"var(--space-1)"},children:"Pick an accent color"}),(0,r.jsx)("p",{style:{fontSize:"var(--text-subheadline)",color:"var(--text-tertiary)",marginBottom:"var(--space-4)"},children:"Personalize with your favorite color."}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"var(--space-3)",justifyItems:"center"},children:_.map(e=>{let t=i.accentColor===e.value;return(0,r.jsx)("button",{onClick:()=>p(e.value),"aria-label":e.label,title:e.label,style:{width:40,height:40,borderRadius:"50%",background:e.value,border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",outline:t?"3px solid ".concat(e.value):"none",outlineOffset:3,transition:"all 100ms var(--ease-smooth)"},children:t&&(0,r.jsx)(Y.A,{size:18,color:"#fff",strokeWidth:3})},e.value)})})]},"step-2"),3===b&&(0,r.jsxs)("div",{className:"animate-fade-in",children:[(0,r.jsx)("h2",{style:{fontSize:"var(--text-title1)",fontWeight:"var(--weight-bold)",letterSpacing:"var(--tracking-tight)",color:"var(--text-primary)",marginBottom:"var(--space-1)"},children:"You're all set!"}),(0,r.jsx)("p",{style:{fontSize:"var(--text-subheadline)",color:"var(--text-tertiary)",marginBottom:"var(--space-4)"},children:"Here's what you can do."}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2)"},children:Q.map(e=>{let t=e.icon;return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-3)",borderRadius:"var(--radius-md)",background:"var(--fill-quaternary)",border:"1px solid var(--separator)"},children:[(0,r.jsx)("div",{style:{width:36,height:36,borderRadius:8,background:"var(--accent-fill)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,r.jsx)(t,{size:18,style:{color:"var(--accent)"}})}),(0,r.jsxs)("div",{style:{minWidth:0},children:[(0,r.jsx)("div",{style:{fontSize:"var(--text-subheadline)",fontWeight:"var(--weight-semibold)",color:"var(--text-primary)"},children:e.name}),(0,r.jsx)("div",{style:{fontSize:"var(--text-caption1)",color:"var(--text-tertiary)"},children:e.desc})]})]},e.name)})})]},"step-3")]}),(0,r.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"var(--space-3) var(--space-5) var(--space-5)",gap:"var(--space-3)"},children:[b>0?(0,r.jsxs)("button",{onClick:W,style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",color:"var(--text-secondary)",border:"none",cursor:"pointer",fontSize:"var(--text-subheadline)",fontWeight:"var(--weight-medium)",transition:"all 150ms var(--ease-smooth)",display:"inline-flex",alignItems:"center",gap:6},children:[(0,r.jsx)(U.A,{size:16}),"Back"]}):(0,r.jsx)("div",{}),(0,r.jsxs)("button",{onClick:I,style:{padding:"var(--space-2) var(--space-6)",borderRadius:"var(--radius-md)",background:"var(--accent)",color:"var(--accent-contrast)",border:"none",cursor:"pointer",fontSize:"var(--text-subheadline)",fontWeight:"var(--weight-semibold)",transition:"all 150ms var(--ease-smooth)",display:"inline-flex",alignItems:"center",gap:6},children:[0===b?"Next":3===b?"Get Started":"Next",3===b?(0,r.jsx)(V.A,{size:16}):(0,r.jsx)($.A,{size:16})]})]})]})}):null}var Z=a(5337),ee=a(7250),et=a(4752),ea=a(311),er=a(9350),en=a(5896),ei=a(3841);let eo={success:Z.A,error:ee.A,warning:et.A,info:ea.A},el={success:"var(--system-green)",error:"var(--system-red)",warning:"var(--system-orange)",info:"var(--system-blue)"};function es(){let{notifications:e,unreadCount:t,markAllRead:a,markRead:n,clearAll:i}=(0,ei.E$)(),[l,s]=(0,o.useState)(!1),c=(0,o.useRef)(null);return(0,o.useEffect)(()=>{if(l)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){c.current&&!c.current.contains(e.target)&&s(!1)}},[l]),(0,r.jsxs)("div",{ref:c,style:{position:"relative"},children:[(0,r.jsxs)("button",{onClick:()=>s(e=>!e),"aria-label":"Notifications".concat(t>0?" (".concat(t," unread)"):""),className:"nav-item",style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:36,height:36,background:"transparent",border:"none",cursor:"pointer",color:"var(--text-secondary)",borderRadius:"var(--radius-sm)"},children:[(0,r.jsx)(er.A,{size:18}),t>0&&(0,r.jsx)("span",{style:{position:"absolute",top:4,right:4,minWidth:16,height:16,borderRadius:8,background:"var(--system-red)",color:"#fff",fontSize:10,fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",padding:"0 4px",lineHeight:1},children:t>99?"99+":t})]}),l&&(0,r.jsxs)("div",{className:"animate-scale-up",style:{position:"absolute",top:"calc(100% + 8px)",right:0,width:360,maxHeight:480,display:"flex",flexDirection:"column",background:"var(--material-thick)",backdropFilter:"blur(40px) saturate(180%)",WebkitBackdropFilter:"blur(40px) saturate(180%)",border:"1px solid var(--separator)",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-overlay)",overflow:"hidden",zIndex:200},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--separator)",flexShrink:0},children:[(0,r.jsx)("span",{style:{fontSize:15,fontWeight:600,color:"var(--text-primary)"},children:"Notifications"}),(0,r.jsxs)("div",{style:{display:"flex",gap:4},children:[t>0&&(0,r.jsxs)("button",{onClick:a,title:"Mark all as read",style:{display:"flex",alignItems:"center",gap:4,background:"transparent",border:"none",cursor:"pointer",color:"var(--system-blue)",fontSize:12,fontWeight:500,padding:"4px 8px",borderRadius:"var(--radius-sm)"},className:"hover-bg",children:[(0,r.jsx)(Y.A,{size:14}),"Read all"]}),e.length>0&&(0,r.jsx)("button",{onClick:()=>{i(),s(!1)},title:"Clear all",style:{display:"flex",alignItems:"center",gap:4,background:"transparent",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:12,fontWeight:500,padding:"4px 8px",borderRadius:"var(--radius-sm)"},className:"hover-bg",children:(0,r.jsx)(en.A,{size:14})})]})]}),(0,r.jsx)("div",{style:{flex:1,overflowY:"auto"},children:0===e.length?(0,r.jsx)("div",{style:{padding:"32px 16px",textAlign:"center",color:"var(--text-tertiary)",fontSize:13},children:"No notifications yet"}):e.map(e=>{let t=eo[e.type],a=el[e.type];return(0,r.jsxs)("div",{onClick:()=>n(e.id),style:{display:"flex",alignItems:"flex-start",gap:10,padding:"10px 16px",borderBottom:"1px solid var(--separator)",cursor:"pointer",background:e.read?"transparent":"var(--material-ultra-thin)",transition:"background 150ms ease"},className:"hover-bg",children:[(0,r.jsx)(t,{size:16,style:{color:a,flexShrink:0,marginTop:2}}),(0,r.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,r.jsx)("div",{style:{fontSize:13,fontWeight:e.read?400:600,color:"var(--text-primary)",lineHeight:1.3},children:e.title}),(0,r.jsx)("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:2,lineHeight:1.3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.message})]}),(0,r.jsx)("span",{style:{fontSize:11,color:"var(--text-quaternary)",whiteSpace:"nowrap",flexShrink:0,marginTop:2},children:function(e){let t=Math.floor((Date.now()-e)/1e3);return t<60?"just now":t<3600?"".concat(Math.floor(t/60),"m ago"):t<86400?"".concat(Math.floor(t/3600),"h ago"):"".concat(Math.floor(t/86400),"d ago")}(e.timestamp)}),!e.read&&(0,r.jsx)("span",{style:{width:8,height:8,borderRadius:4,background:"var(--system-blue)",flexShrink:0,marginTop:5}})]},e.id)})})]})]})}let ec={success:Z.A,error:ee.A,warning:et.A,info:ea.A},ed={success:"var(--system-green)",error:"var(--system-red)",warning:"var(--system-orange)",info:"var(--system-blue)"};function ep(){let{toasts:e,dismissToast:t}=(0,ei.E$)();return 0===e.length?null:(0,r.jsx)("div",{style:{position:"fixed",top:16,right:16,zIndex:9999,display:"flex",flexDirection:"column",gap:8,maxWidth:380,width:"100%",pointerEvents:"none"},children:e.map(e=>{let a=ec[e.type],n=ed[e.type];return(0,r.jsxs)("div",{className:"animate-slide-down",style:{pointerEvents:"auto",display:"flex",alignItems:"flex-start",gap:10,padding:"12px 14px",background:"var(--material-thick)",backdropFilter:"blur(40px) saturate(180%)",WebkitBackdropFilter:"blur(40px) saturate(180%)",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",boxShadow:"var(--shadow-overlay)"},children:[(0,r.jsx)(a,{size:18,style:{color:n,flexShrink:0,marginTop:1}}),(0,r.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,r.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",lineHeight:1.3},children:e.title}),(0,r.jsx)("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:2,lineHeight:1.3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.message}),(0,r.jsx)("div",{style:{fontSize:11,color:"var(--text-quaternary)",marginTop:4},children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,r.jsx)("button",{onClick:()=>t(e.id),"aria-label":"Dismiss",style:{background:"transparent",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:2,flexShrink:0},children:(0,r.jsx)(T.A,{size:14})})]},e.id)})})}var eu=a(7836);function eh(){var e,t;let[a,n]=(0,o.useState)(!1),l=(0,c.usePathname)(),{settings:p}=(0,d.t0)(),u=null!=(e=p.portalEmoji)?e:"\uD83E\uDD16",h=null!=(t=p.portalName)?t:"Jinn";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{style:{height:48,display:"flex",alignItems:"center",padding:"0 12px",borderBottom:"1px solid var(--separator)",background:"var(--material-thick)",flexShrink:0,position:"relative",zIndex:60},className:"jsx-906cbf20b7aa1777 lg:hidden",children:[(0,r.jsx)("button",{onClick:()=>n(!0),"aria-label":"Open menu",style:{width:36,height:36,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)"},className:"jsx-906cbf20b7aa1777",children:(0,r.jsx)(eu.A,{size:20})}),(0,r.jsxs)("div",{style:{flex:1,textAlign:"center"},className:"jsx-906cbf20b7aa1777",children:[(0,r.jsx)("span",{style:{fontSize:18,marginRight:6},className:"jsx-906cbf20b7aa1777",children:u}),(0,r.jsx)("span",{style:{fontSize:15,fontWeight:600,color:"var(--text-primary)"},className:"jsx-906cbf20b7aa1777",children:h})]}),(0,r.jsx)(es,{})]}),a&&(0,r.jsxs)("div",{style:{position:"fixed",inset:0,zIndex:100},className:"jsx-906cbf20b7aa1777 lg:hidden",children:[(0,r.jsx)("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.5)"},onClick:()=>n(!1),className:"jsx-906cbf20b7aa1777"}),(0,r.jsxs)("nav",{style:{position:"absolute",top:0,left:0,bottom:0,width:260,background:"var(--bg-secondary)",borderRight:"1px solid var(--separator)",display:"flex",flexDirection:"column",animation:"slideInLeft 200ms ease"},className:"jsx-906cbf20b7aa1777",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 14px",borderBottom:"1px solid var(--separator)"},className:"jsx-906cbf20b7aa1777",children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},className:"jsx-906cbf20b7aa1777",children:[(0,r.jsx)("span",{style:{fontSize:22},className:"jsx-906cbf20b7aa1777",children:u}),(0,r.jsx)("span",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)"},className:"jsx-906cbf20b7aa1777",children:h})]}),(0,r.jsx)("button",{onClick:()=>n(!1),"aria-label":"Close menu",style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-secondary)"},className:"jsx-906cbf20b7aa1777",children:(0,r.jsx)(T.A,{size:18})})]}),(0,r.jsx)("div",{style:{flex:1,padding:"8px",display:"flex",flexDirection:"column",gap:2},className:"jsx-906cbf20b7aa1777",children:z.map(e=>{let t="/"===e.href?"/"===l:l.startsWith(e.href),a=e.icon;return(0,r.jsxs)(s(),{href:e.href,onClick:()=>n(!1),style:{display:"flex",alignItems:"center",gap:12,height:44,padding:"0 14px",borderRadius:10,textDecoration:"none",color:t?"var(--accent)":"var(--text-secondary)",background:t?"var(--accent-fill)":"transparent",fontWeight:t?600:400,fontSize:15},children:[(0,r.jsx)(a,{size:18,style:{flexShrink:0},className:"jsx-906cbf20b7aa1777"}),e.label]},e.href)})})]})]}),(0,r.jsx)(i(),{id:"906cbf20b7aa1777",children:"@keyframes slideInLeft{from{transform:translatex(-100%)}to{transform:translatex(0)}}"})]})}function eg(e){let{children:t}=e;return(0,r.jsxs)("div",{className:"flex h-dvh overflow-hidden",style:{background:"var(--bg)"},children:[(0,r.jsx)(A,{}),(0,r.jsx)(D,{}),(0,r.jsxs)("main",{className:"flex-1 overflow-hidden lg:ml-[56px]",children:[(0,r.jsx)(eh,{}),(0,r.jsx)("div",{className:"hidden lg:flex",style:{position:"fixed",top:12,right:16,zIndex:60,alignItems:"center"},children:(0,r.jsx)(es,{})}),t]}),(0,r.jsx)(ep,{}),(0,r.jsx)(G,{}),(0,r.jsx)(X,{})]})}},9834:(e,t,a)=>{a.d(t,{z:()=>r});let r=[{id:"dark",label:"Dark",emoji:"\uD83C\uDF11"},{id:"glass",label:"Glass",emoji:"\uD83E\uDE9F"},{id:"color",label:"Color",emoji:"\uD83C\uDFA8"},{id:"light",label:"Light",emoji:"☀️"},{id:"system",label:"System",emoji:"⚙️"}]}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[457],{3095:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>N});var n=r(8111),a=r(5271),i=r(4736),s=r(3176),o=r(4263),l=r(8700),d=r(2755);let c="jinn-sidebar-collapsed",u="jinn-pinned-sessions";function p(){try{let e=localStorage.getItem("jinn-read-sessions");return e?new Set(JSON.parse(e)):new Set}catch(e){return new Set}}function h(e){try{localStorage.setItem(u,JSON.stringify(Array.from(e)))}catch(e){}}function g(e){return"cron"===e.source||(e.sourceRef||"").startsWith("cron:")}function v(e,t){let r=(e,t)=>{let r=e.lastActivity||e.createdAt||"";return(t.lastActivity||t.createdAt||"").localeCompare(r)};return[...e.filter(e=>t.has(e.id)).sort(r),...e.filter(e=>!t.has(e.id)).sort(r)]}function x(e){var t;let{selectedId:r,onSelect:i,onNewChat:o,onDelete:l,refreshKey:x,connectionSeq:m,onSessionsLoaded:y,events:f}=e,{settings:b}=(0,d.t0)(),j=null!=(t=b.portalName)?t:"Jinn",k=j.toLowerCase(),[w,S]=(0,a.useState)([]),[C,I]=(0,a.useState)(!0),[R,L]=(0,a.useState)(""),[W,z]=(0,a.useState)(null),[D,T]=(0,a.useState)(null),[M,B]=(0,a.useState)(null),[E,A]=(0,a.useState)(null),[U,N]=(0,a.useState)(new Set),[F,H]=(0,a.useState)(new Set),[O,P]=(0,a.useState)(new Set),[V,q]=(0,a.useState)(new Map),J=(0,a.useRef)(null);(0,a.useEffect)(()=>{N(p()),H(function(){try{let e=localStorage.getItem(u);return e?new Set(JSON.parse(e)):new Set}catch(e){return new Set}}()),P(function(){try{let e=localStorage.getItem(c);return e?new Set(JSON.parse(e)):new Set}catch(e){return new Set}}()),s.F.getOrg().then(async e=>{let t=new Map;await Promise.all(e.employees.map(async e=>{try{let r=await s.F.getEmployee(e);r.emoji&&t.set(e,r.emoji)}catch(e){}})),q(t)}).catch(()=>{})},[]),(0,a.useEffect)(()=>{if(r){let e=p();e.add(r);let t=Array.from(e);t.length>500&&t.splice(0,t.length-500),localStorage.setItem("jinn-read-sessions",JSON.stringify(t)),N(e=>{let t=new Set(e);return t.add(r),t})}},[r]);let _=(0,a.useCallback)(()=>{s.F.getSessions().then(e=>{let t=e.filter(e=>"web"===e.source||"cron"===e.source||!e.source);t.sort((e,t)=>{let r=e.lastActivity||e.createdAt||"";return(t.lastActivity||t.createdAt||"").localeCompare(r)}),S(t),null==y||y(t)}).catch(()=>S([])).finally(()=>I(!1))},[y]);(0,a.useEffect)(()=>{I(!0),_()},[x,_]),(0,a.useEffect)(()=>{m&&_()},[m,_]),(0,a.useEffect)(()=>{if(!f||0===f.length)return;let e=f[f.length-1],t="".concat(e.event,":").concat(JSON.stringify(e.payload));t!==J.current&&(J.current=t,("session:started"===e.event||"session:completed"===e.event||"session:deleted"===e.event||"session:error"===e.event)&&_())},[f,_]);let K=(0,a.useCallback)(e=>{P(t=>{let r=new Set(t);r.has(e)?r.delete(e):r.add(e);try{localStorage.setItem(c,JSON.stringify(Array.from(r)))}catch(e){}return r})},[]),Y=(0,a.useCallback)(e=>{H(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),h(r),r})},[]);async function X(e){let t=e.sessions.map(e=>e.id);try{await s.F.bulkDeleteSessions(t),S(e=>e.filter(e=>!t.includes(e.id))),H(e=>{let r=new Set(e);for(let e of t)r.delete(e);return h(r),r}),r&&t.includes(r)&&o()}catch(e){}T(null)}async function G(e){try{await s.F.deleteSession(e),S(t=>t.filter(t=>t.id!==e)),H(t=>{if(!t.has(e))return t;let r=new Set(t);return r.delete(e),h(r),r}),l?l(e):r===e&&o()}catch(e){}z(null)}let $=function(e,t,r,n){let a=[],i=[],s=new Map;for(let t of e)if(g(t))i.push(t);else if(g(t)||t.employee&&t.employee!==r){let e=t.employee;s.has(e)||s.set(e,[]),s.get(e).push(t)}else a.push(t);let o=[];for(let e of(a.length>0&&o.push({key:"direct",label:"Direct",emoji:"\uD83D\uDCAC",sessions:v(a,n),sortOrder:0}),Array.from(s.keys()).sort())){let r=s.get(e);o.push({key:"emp:".concat(e),label:e,emoji:t.get(e)||"\uD83E\uDD16",sessions:v(r,n),sortOrder:1})}return i.length>0&&o.push({key:"cron",label:"Cron",emoji:"⏰",sessions:v(i,n),sortOrder:2}),o}(R.trim()?w.filter(e=>{let t=R.toLowerCase();return e.id.toLowerCase().includes(t)||e.employee&&e.employee.toLowerCase().includes(t)||e.title&&e.title.toLowerCase().includes(t)}):w,V,k,F);return(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--sidebar-bg)",borderRight:"1px solid var(--separator)"},children:[(0,n.jsxs)("div",{style:{padding:"var(--space-4) var(--space-4) var(--space-3)",borderBottom:"1px solid var(--separator)",background:"var(--material-thick)",flexShrink:0},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"var(--space-3)"},children:[(0,n.jsx)("h2",{style:{fontSize:"var(--text-title3)",fontWeight:"var(--weight-bold)",letterSpacing:"-0.5px",color:"var(--text-primary)",margin:0},children:"Chats"}),(0,n.jsxs)("button",{onClick:o,"aria-label":"New chat",style:{padding:"var(--space-1) var(--space-3)",fontSize:"var(--text-footnote)",fontWeight:"var(--weight-semibold)",color:"var(--accent-contrast)",background:"var(--accent)",border:"none",borderRadius:"var(--radius-md)",cursor:"pointer",display:"flex",alignItems:"center",gap:"var(--space-1)"},children:[(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,n.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,n.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New"]})]}),(0,n.jsxs)("div",{style:{background:"var(--fill-tertiary)",borderRadius:"var(--radius-md)",padding:"7px var(--space-3)",display:"flex",alignItems:"center",gap:"var(--space-2)"},children:[(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},"aria-hidden":"true",children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,n.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),(0,n.jsx)("input",{type:"text",value:R,onChange:e=>L(e.target.value),placeholder:"Search sessions...","aria-label":"Search sessions",style:{flex:1,fontSize:"var(--text-footnote)",color:"var(--text-primary)",background:"transparent",border:"none",outline:"none",padding:0,margin:0,lineHeight:1.4}}),R.trim()&&(0,n.jsx)("button",{onClick:()=>L(""),"aria-label":"Clear search",style:{padding:2,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:"transparent",border:"none",cursor:"pointer",color:"var(--text-tertiary)"},children:(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,n.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,n.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),(0,n.jsx)("div",{style:{flex:1,overflowY:"auto",padding:"var(--space-1) 0"},children:C?(0,n.jsx)("div",{style:{padding:"var(--space-8) var(--space-4)",textAlign:"center"},children:(0,n.jsx)("span",{style:{fontSize:"var(--text-caption1)",color:"var(--text-quaternary)"},children:"Loading sessions..."})}):0===$.length?(0,n.jsx)("div",{style:{padding:"var(--space-8) var(--space-4)",textAlign:"center"},children:(0,n.jsx)("span",{style:{fontSize:"var(--text-caption1)",color:"var(--text-quaternary)"},children:R.trim()?"No matching sessions":"No conversations yet"})}):$.map(e=>{let t=O.has(e.key);return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{onMouseEnter:()=>A(e.key),onMouseLeave:()=>A(null),style:{display:"flex",alignItems:"center",marginTop:"var(--space-1)"},children:[(0,n.jsxs)("button",{onClick:()=>K(e.key),style:{flex:1,display:"flex",alignItems:"center",gap:"var(--space-2)",padding:"var(--space-2) var(--space-4)",paddingRight:"var(--space-1)",background:"transparent",border:"none",cursor:"pointer",textAlign:"left"},children:[(0,n.jsx)("span",{style:{fontSize:"var(--text-caption1)"},children:e.emoji}),(0,n.jsx)("span",{style:{fontSize:"var(--text-caption1)",fontWeight:"var(--weight-semibold)",color:"var(--text-secondary)",letterSpacing:"0.3px",textTransform:"uppercase",flex:1},children:e.label}),(0,n.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",background:"var(--fill-tertiary)",borderRadius:"var(--radius-sm)",padding:"0 5px",lineHeight:"18px",minWidth:18,textAlign:"center"},children:e.sessions.length}),(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,transition:"transform 150ms ease",transform:t?"rotate(-90deg)":"rotate(0deg)"},children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),E===e.key&&(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),T(e)},"aria-label":"Delete all sessions in ".concat(e.label),style:{padding:4,marginRight:"var(--space-3)",borderRadius:"var(--radius-sm)",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-tertiary)",display:"flex",alignItems:"center",flexShrink:0,transition:"color 150ms ease"},onMouseEnter:e=>e.currentTarget.style.color="var(--system-red)",onMouseLeave:e=>e.currentTarget.style.color="var(--text-tertiary)",children:(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,n.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]}),!t&&e.sessions.map(e=>{var t,a;let s,o=e.id===r,l=e.id===M,d="running"===e.status,c=U.has(e.id),u="error"===e.status,p=F.has(e.id),h=function(e){if(!e)return"";let t=new Date(e),r=Date.now()-t.getTime();return r<6e4?"now":r<36e5?"".concat(Math.floor(r/6e4),"m"):r<864e5?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"})}(e.lastActivity||e.createdAt);return s=d?"var(--system-blue)":u?"var(--system-red)":c?"var(--text-quaternary)":"var(--system-green)",(0,n.jsxs)("button",{onClick:()=>i(e.id),onMouseEnter:()=>B(e.id),onMouseLeave:()=>B(null),style:{width:"100%",display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-3) var(--space-4)",paddingLeft:"calc(var(--space-4) + 8px)",background:o?"var(--fill-secondary)":"transparent",border:"none",cursor:"pointer",textAlign:"left",borderLeft:o?"2px solid var(--accent)":"2px solid transparent",position:"relative"},children:[(0,n.jsx)("div",{style:{width:8,height:8,borderRadius:"50%",background:s,flexShrink:0,animation:d?"sidebar-pulse 2s ease-in-out infinite":"none",boxShadow:d?"0 0 6px ".concat(s):"none"}}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:2},children:[(0,n.jsx)("span",{style:{fontSize:"var(--text-footnote)",fontWeight:c&&!o?"var(--weight-medium)":"var(--weight-semibold)",color:"var(--text-primary)",letterSpacing:"-0.2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0},children:(t=e.title,a=e.employee,t?"Jinn"!==j&&t.startsWith("Jinn - ")?j+t.slice(4):t:a||j)}),(0,n.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",flexShrink:0,marginLeft:"var(--space-1)"},children:h})]}),(0,n.jsx)("div",{style:{fontSize:"var(--text-caption1)",color:"var(--text-tertiary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.employee||j})]}),p&&!l&&(0,n.jsx)("span",{style:{fontSize:11,flexShrink:0,opacity:.5},children:"\uD83D\uDCCC"}),l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),Y(e.id)},"aria-label":p?"Unpin session":"Pin session",style:{padding:4,borderRadius:"var(--radius-sm)",background:"transparent",border:"none",cursor:"pointer",color:p?"var(--accent)":"var(--text-tertiary)",display:"flex",alignItems:"center",flexShrink:0,transition:"color 150ms ease"},onMouseEnter:e=>{p||(e.currentTarget.style.color="var(--accent)")},onMouseLeave:e=>{p||(e.currentTarget.style.color="var(--text-tertiary)")},children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:p?"currentColor":"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M12 17v5"}),(0,n.jsx)("path",{d:"M9 2h6l-1 7h4l-2 4H8l-2-4h4L9 2z"})]})}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),z(e.id)},"aria-label":"Delete session",style:{padding:4,borderRadius:"var(--radius-sm)",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-tertiary)",display:"flex",alignItems:"center",flexShrink:0,transition:"color 150ms ease"},onMouseEnter:e=>e.currentTarget.style.color="var(--system-red)",onMouseLeave:e=>e.currentTarget.style.color="var(--text-tertiary)",children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,n.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]},e.id)})]},e.key)})}),W&&(0,n.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",zIndex:60,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>z(null),children:(0,n.jsxs)("div",{style:{background:"var(--bg)",borderRadius:"var(--radius-lg)",padding:"var(--space-6)",maxWidth:400,width:"90%",boxShadow:"var(--shadow-overlay)"},onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h3",{style:{fontSize:"var(--text-headline)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)",marginBottom:"var(--space-2)"},children:"Delete Session?"}),(0,n.jsx)("p",{style:{fontSize:"var(--text-body)",color:"var(--text-secondary)",marginBottom:"var(--space-5)"},children:"This will permanently delete the session and all its messages."}),(0,n.jsxs)("div",{style:{display:"flex",gap:"var(--space-3)",justifyContent:"flex-end"},children:[(0,n.jsx)("button",{onClick:()=>z(null),style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",color:"var(--text-primary)",border:"none",cursor:"pointer",fontSize:"var(--text-body)"},children:"Cancel"}),(0,n.jsx)("button",{onClick:()=>G(W),style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--system-red)",color:"#fff",border:"none",cursor:"pointer",fontSize:"var(--text-body)",fontWeight:"var(--weight-semibold)"},children:"Delete"})]})]})}),D&&(0,n.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",zIndex:60,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>T(null),children:(0,n.jsxs)("div",{style:{background:"var(--bg)",borderRadius:"var(--radius-lg)",padding:"var(--space-6)",maxWidth:400,width:"90%",boxShadow:"var(--shadow-overlay)"},onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h3",{style:{fontSize:"var(--text-headline)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)",marginBottom:"var(--space-2)"},children:"Delete Group?"}),(0,n.jsxs)("p",{style:{fontSize:"var(--text-body)",color:"var(--text-secondary)",marginBottom:"var(--space-5)"},children:["Delete all ",D.sessions.length," chats in “",D.label,"”? This cannot be undone."]}),(0,n.jsxs)("div",{style:{display:"flex",gap:"var(--space-3)",justifyContent:"flex-end"},children:[(0,n.jsx)("button",{onClick:()=>T(null),style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",color:"var(--text-primary)",border:"none",cursor:"pointer",fontSize:"var(--text-body)"},children:"Cancel"}),(0,n.jsxs)("button",{onClick:()=>X(D),style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--system-red)",color:"#fff",border:"none",cursor:"pointer",fontSize:"var(--text-body)",fontWeight:"var(--weight-semibold)"},children:["Delete ",D.sessions.length," Chats"]})]})]})}),(0,n.jsx)("style",{children:"\n @keyframes sidebar-pulse {\n 0%, 100% { opacity: 1; transform: scale(1); }\n 50% { opacity: 0.5; transform: scale(0.85); }\n }\n "})]})}let m="jinn-intermediate-";function y(e){try{localStorage.removeItem("".concat(m).concat(e))}catch(e){}}function f(e){let{name:t,size:r,mimeType:a,url:i,isUser:s}=e;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-3) var(--space-4)",borderRadius:"var(--radius-lg)",background:s?"var(--accent)":"var(--material-thin)",border:s?"none":"1px solid var(--separator)",maxWidth:280,minWidth:180},children:[(0,n.jsx)("div",{style:{width:36,height:36,borderRadius:"var(--radius-sm)",background:s?"rgba(0,0,0,0.15)":"var(--fill-tertiary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:s?"#000":"var(--text-secondary)"},children:function(e,t){var r;let a=(null==t||null==(r=t.split(".").pop())?void 0:r.toLowerCase())||"",i="application/pdf"===e||"pdf"===a,s=["doc","docx"].includes(a)||(null==e?void 0:e.includes("wordprocessingml")),o=["txt","csv","json","md"].includes(a)||(null==e?void 0:e.startsWith("text/")),l=["zip","tar","gz","rar","7z"].includes(a);return i?(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,n.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,n.jsx)("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}):s?(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,n.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,n.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),(0,n.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),(0,n.jsx)("polyline",{points:"10 9 9 9 8 9"})]}):o?(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,n.jsx)("polyline",{points:"14 2 14 8 20 8"})]}):l?(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 8v13H3V8"}),(0,n.jsx)("path",{d:"M1 3h22v5H1z"}),(0,n.jsx)("path",{d:"M10 12h4"})]}):(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),(0,n.jsx)("polyline",{points:"13 2 13 9 20 9"})]})}(a,t)}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:"var(--text-footnote)",fontWeight:"var(--weight-medium)",color:s?"#000":"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),null!=r&&(0,n.jsx)("div",{style:{fontSize:"var(--text-caption2)",color:s?"rgba(0,0,0,0.5)":"var(--text-tertiary)",marginTop:1},children:r<1024?"".concat(r," B"):r<1048576?"".concat((r/1024).toFixed(0)," KB"):"".concat((r/1048576).toFixed(1)," MB")})]}),(0,n.jsx)("a",{href:i,download:t,"aria-label":"Download ".concat(t),style:{width:28,height:28,borderRadius:"50%",background:s?"rgba(0,0,0,0.15)":"var(--fill-secondary)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:s?"#000":"var(--text-secondary)",textDecoration:"none"},children:(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,n.jsx)("polyline",{points:"7 10 12 15 17 10"}),(0,n.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})})]})}function b(e){let{src:t,duration:r,waveform:i,isUser:s}=e,o=(0,a.useRef)(null),[l,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(0),[p,h]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=new Audio(t);return o.current=e,e.addEventListener("timeupdate",()=>{e.duration&&isFinite(e.duration)&&(u(e.currentTime/e.duration),h(e.currentTime))}),e.addEventListener("ended",()=>{d(!1),u(0),h(0)}),e.addEventListener("pause",()=>d(!1)),e.addEventListener("play",()=>d(!0)),()=>{e.pause(),e.src=""}},[t]);let g=(0,a.useCallback)(()=>{let e=o.current;e&&(l?e.pause():e.play().catch(()=>{}))},[l]),v=i.length>0?i:Array(50).fill(.1),x=l?p:r;return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-3)",padding:"var(--space-3) var(--space-4)",borderRadius:"var(--radius-lg)",background:s?"var(--accent)":"var(--material-thin)",border:s?"none":"1px solid var(--separator)",maxWidth:280,minWidth:200},children:[(0,n.jsx)("button",{onClick:g,"aria-label":l?"Pause":"Play",style:{width:28,height:28,borderRadius:"50%",background:s?"rgba(0,0,0,0.2)":"var(--fill-secondary)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:s?"#000":"var(--text-primary)"},children:l?(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,n.jsx)("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),(0,n.jsx)("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]}):(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:(0,n.jsx)("polygon",{points:"6,4 20,12 6,20"})})}),(0,n.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",gap:2,height:28},children:v.map((e,t)=>{let r=t/v.length<=c;return(0,n.jsx)("div",{style:{width:3,borderRadius:1.5,height:"".concat(Math.max(4,24*e),"px"),background:s?r?"rgba(0,0,0,0.7)":"rgba(0,0,0,0.25)":r?"var(--accent)":"var(--fill-primary)",transition:"background 100ms ease",flexShrink:0}},t)})}),(0,n.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:s?"rgba(0,0,0,0.6)":"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",flexShrink:0,minWidth:28,textAlign:"right"},children:function(e){let t=Math.floor(e/60),r=Math.floor(e%60);return"".concat(t,":").concat(r.toString().padStart(2,"0"))}(x)})]})}function j(e){let{msgs:t,isActive:r}=e,[i,s]=(0,a.useState)(!1),o=t.every(e=>e.content.startsWith("Used ")),l=r&&!o?"".concat(t.length," tool").concat(1!==t.length?"s":""," running…"):"".concat(t.length," tool").concat(1!==t.length?"s":""," used");return(0,n.jsxs)("div",{style:{padding:"0 var(--space-4)",marginBottom:"var(--space-1)"},children:[(0,n.jsxs)("button",{onClick:()=>s(e=>!e),style:{display:"flex",alignItems:"center",gap:"var(--space-2)",padding:"5px var(--space-3)",borderRadius:"var(--radius-full, 999px)",background:"var(--fill-secondary)",border:"1px solid var(--separator)",fontSize:"var(--text-caption1)",color:"var(--text-secondary)",cursor:"pointer",transition:"background 150ms ease"},onMouseEnter:e=>e.currentTarget.style.background="var(--fill-tertiary)",onMouseLeave:e=>e.currentTarget.style.background="var(--fill-secondary)",children:[(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:.6},children:(0,n.jsx)("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),l,r&&!o&&(0,n.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--system-blue)",animation:"jinn-pulse 1.4s infinite"}}),(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:i?"rotate(180deg)":"rotate(0deg)",transition:"transform 150ms ease",opacity:.5},children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),i&&(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"var(--space-1)",marginTop:"var(--space-1)",paddingLeft:"var(--space-1)"},children:t.map(e=>(0,n.jsx)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:"var(--radius-full, 999px)",background:"var(--fill-tertiary)",border:"1px solid var(--separator)",fontSize:"var(--text-caption2)",color:"var(--text-tertiary)"},children:e.toolCall},e.id))})]})}function k(e){let t,r=[],a=/(https?:\/\/[^\s<]+[^\s<.,;:!?)}\]'"])|(\*\*(.+?)\*\*)|(`([^`]+)`)|\*([^*]+)\*/g,i=0;for(;null!==(t=a.exec(e));)t.index>i&&r.push(e.slice(i,t.index)),t[1]?r.push((0,n.jsx)("a",{href:t[1],target:"_blank",rel:"noopener noreferrer",style:{color:"var(--system-blue)",textDecoration:"underline",textUnderlineOffset:2},children:t[1]},t.index)):t[2]?r.push((0,n.jsx)("strong",{style:{fontWeight:"var(--weight-bold)"},children:t[3]},t.index)):t[4]?r.push((0,n.jsx)("code",{style:{background:"var(--fill-secondary)",border:"1px solid var(--separator)",borderRadius:5,padding:"1px 5px",fontSize:"0.88em",fontFamily:'"SF Mono", Menlo, monospace',color:"var(--accent)"},children:t[5]},t.index)):t[6]&&r.push((0,n.jsx)("em",{style:{fontStyle:"italic",opacity:.85},children:t[6]},t.index)),i=t.index+t[0].length;return i<e.length&&r.push(e.slice(i)),1===r.length?r[0]:(0,n.jsx)(n.Fragment,{children:r})}function w(e){let{code:t,keyProp:r}=e,[i,s]=(0,a.useState)(!1);return(0,n.jsxs)("div",{style:{position:"relative",margin:"8px 0"},children:[(0,n.jsx)("button",{onClick:function(){navigator.clipboard.writeText(t).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},"aria-label":"Copy code",style:{position:"absolute",top:8,right:8,padding:"2px 8px",fontSize:11,borderRadius:"var(--radius-sm)",background:"var(--fill-secondary)",color:"var(--text-secondary)",border:"1px solid var(--separator)",cursor:"pointer"},children:i?"Copied!":"Copy"}),(0,n.jsx)("pre",{className:"code-block",style:{background:"var(--fill-tertiary)",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",padding:"var(--space-3) var(--space-4)",overflowX:"auto",fontSize:13,lineHeight:1.5,fontFamily:'"SF Mono", Menlo, monospace',color:"var(--text-primary)"},children:(0,n.jsx)("code",{children:t})})]},r)}function S(e){return/^\|[\s:|-]+\|$/.test(e.trim())}function C(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function I(e){let{headerLine:t,rows:r,keyProp:a}=e,i=C(t),s=r.map(C);return(0,n.jsx)("div",{style:{margin:"10px 0",borderRadius:10,border:"1px solid var(--separator)",overflow:"hidden"},children:(0,n.jsx)("div",{style:{overflowX:"auto",WebkitOverflowScrolling:"touch"},children:(0,n.jsxs)("table",{style:{borderCollapse:"collapse",fontSize:"var(--text-footnote)",lineHeight:1.6,width:"100%",minWidth:"max-content"},children:[(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{style:{background:"var(--fill-tertiary)"},children:i.map((e,t)=>(0,n.jsx)("th",{style:{textAlign:"left",padding:"10px 16px",fontWeight:600,color:"var(--text-primary)",borderBottom:"1px solid var(--separator)",maxWidth:280,wordBreak:"break-word"},children:k(e)},t))})}),(0,n.jsx)("tbody",{children:s.map((e,t)=>(0,n.jsx)("tr",{style:{background:t%2==1?"var(--fill-quaternary, transparent)":"transparent"},children:e.map((e,r)=>(0,n.jsx)("td",{style:{padding:"10px 16px",borderBottom:t<s.length-1?"1px solid var(--separator)":"none",color:"var(--text-primary)",maxWidth:280,wordBreak:"break-word"},children:k(e)},r))},t))})]})})},a)}function R(e){if(!e)return null;let t=e.split("\n"),r=[],a=!1,i=[];for(let e=0;e<t.length;e++){let o=t[e];if(o.startsWith("```")){a?(a=!1,r.push((0,n.jsx)(w,{keyProp:e,code:i.join("\n")},e))):a=!0,i=[];continue}if(a){i.push(o);continue}if(o.trim().startsWith("|")&&o.trim().endsWith("|")&&e+1<t.length&&S(t[e+1])){e++;let a=[];for(;e+1<t.length&&t[e+1].trim().startsWith("|")&&t[e+1].trim().endsWith("|")&&!S(t[e+1]);)e++,a.push(t[e]);r.push((0,n.jsx)(I,{keyProp:e,headerLine:o,rows:a},"table-".concat(e)));continue}if(""===o.trim()){r.push((0,n.jsx)("div",{style:{height:6}},"space-".concat(e)));continue}if(o.match(/^[-*] /)){r.push((0,n.jsxs)("div",{style:{display:"flex",gap:"var(--space-2)",marginBottom:2},children:[(0,n.jsx)("span",{style:{color:"var(--accent)",flexShrink:0,marginTop:1},children:"•"}),(0,n.jsx)("span",{children:k(o.slice(2))})]},e));continue}if(o.match(/^\d+\. /)){var s;let t=null==(s=o.match(/^(\d+)\. /))?void 0:s[1];r.push((0,n.jsxs)("div",{style:{display:"flex",gap:"var(--space-2)",marginBottom:2},children:[(0,n.jsxs)("span",{style:{color:"var(--accent)",flexShrink:0,fontWeight:"var(--weight-semibold)",minWidth:16},children:[t,"."]}),(0,n.jsx)("span",{children:k(o.replace(/^\d+\. /,""))})]},e));continue}if(o.startsWith("### ")){r.push((0,n.jsx)("div",{style:{fontWeight:"var(--weight-semibold)",fontSize:"var(--text-footnote)",marginTop:"var(--space-2)",marginBottom:2},children:k(o.slice(4))},e));continue}if(o.startsWith("## ")){r.push((0,n.jsx)("div",{style:{fontWeight:"var(--weight-bold)",fontSize:"var(--text-subheadline)",marginTop:"var(--space-3)",marginBottom:3},children:k(o.slice(3))},e));continue}if(o.startsWith("# ")){r.push((0,n.jsx)("div",{style:{fontWeight:"var(--weight-bold)",fontSize:"var(--text-body)",marginTop:"var(--space-3)",marginBottom:"var(--space-1)"},children:k(o.slice(2))},e));continue}r.push((0,n.jsx)("div",{style:{marginBottom:1},children:k(o)},e))}return a&&i.length>0&&r.push((0,n.jsx)(w,{keyProp:999,code:i.join("\n")},"trailing-code")),(0,n.jsx)(n.Fragment,{children:r})}function L(e){let t=new Date,r=new Date(e),n=t.toDateString()===r.toDateString(),a=new Date(t);a.setDate(a.getDate()-1);let i=a.toDateString()===r.toDateString(),s=r.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});return n?"Today ".concat(s):i?"Yesterday ".concat(s):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})+" ".concat(s)}function W(e,t){return 0===t||e[t].timestamp-e[t-1].timestamp>3e5}function z(e,t){let r=e.filter(e=>"image"===e.type),a=e.filter(e=>"audio"===e.type),i=e.filter(e=>"file"===e.type);return(0,n.jsxs)(n.Fragment,{children:[r.map((e,t)=>(0,n.jsx)("div",{style:{marginTop:"var(--space-2)",borderRadius:"var(--radius-lg)",overflow:"hidden",maxWidth:280},children:(0,n.jsx)("img",{src:e.url,alt:e.name||"Image",style:{width:"100%",display:"block",borderRadius:"var(--radius-lg)",cursor:"pointer"},onClick:()=>window.open(e.url,"_blank")})},"img-".concat(t))),a.map((e,r)=>(0,n.jsx)("div",{style:{marginTop:"var(--space-2)"},children:(0,n.jsx)(b,{src:e.url,duration:e.duration||0,waveform:e.waveform||[],isUser:t})},"audio-".concat(r))),i.map((e,r)=>(0,n.jsx)("div",{style:{marginTop:"var(--space-2)"},children:(0,n.jsx)(f,{name:e.name||"File",size:e.size,mimeType:e.mimeType,url:e.url,isUser:t})},"file-".concat(r)))]})}function D(e){var t,r;let{messages:i,loading:s,streamingText:o}=e,l=(0,a.useRef)(null),d=(0,a.useRef)(0);return((0,a.useEffect)(()=>{var e;let t=0===d.current&&i.length>0;null==(e=l.current)||e.scrollIntoView({behavior:t?"instant":"smooth"}),d.current=i.length},[i,s]),0!==i.length||s)?(0,n.jsxs)("div",{className:"chat-messages-scroll",style:{flex:1,overflowY:"auto",overflowX:"hidden",padding:"var(--space-3) 0 var(--space-6) 0",background:"var(--bg)",minHeight:0},children:[(function(e){let t=[],r=0;for(;r<e.length;)if("assistant"===e[r].role&&e[r].toolCall){let n=[],a=r;for(;r<e.length&&"assistant"===e[r].role&&e[r].toolCall;)n.push(e[r]),r++;t.push({kind:"tool-group",msgs:n,startIndex:a})}else t.push({kind:"message",msg:e[r],index:r}),r++;return t})(i).map(e=>{if("tool-group"===e.kind){let t=e.msgs[0],r=W(i,e.startIndex),a=e.startIndex>0?i[e.startIndex-1]:null,o=s&&e.startIndex+e.msgs.length===i.length;return(0,n.jsxs)("div",{children:[r&&(0,n.jsx)("div",{style:{textAlign:"center",padding:"var(--space-3) 0",fontSize:"var(--text-caption2)",color:"var(--text-tertiary)"},children:L(t.timestamp)}),!r&&a&&(0,n.jsx)("div",{style:{height:"assistant"!==a.role?"var(--space-4)":"var(--space-1)"}}),(0,n.jsx)(j,{msgs:e.msgs,isActive:o})]},"tg-".concat(e.startIndex))}let{msg:t,index:r}=e,a="user"===t.role,o=W(i,r),l=t.media||function(e){let t,r=[],n=/!\[([^\]]*)\]\((https?:\/\/[^)]+\.(jpg|jpeg|png|gif|webp|svg)(\?[^)]*)?)\)/gi;for(;null!==(t=n.exec(e));)r.push({type:"image",url:t[2],name:t[1]||"Image"});let a=RegExp("(?<!\\]\\()https?:\\/\\/\\S+\\.(jpg|jpeg|png|gif|webp)(\\?\\S*)?\\b","gi");for(;null!==(t=a.exec(e));){let e=t[0];r.find(t=>t.url===e)||r.push({type:"image",url:e})}let i=/https?:\/\/\S+\.(mp3|wav|ogg|m4a|aac)(\?\S*)?\b/gi;for(;null!==(t=i.exec(e));)r.push({type:"audio",url:t[0],name:t[0].split("/").pop()});return r}(t.content),d=t.content;return l.length>0&&!t.media&&(l.forEach(e=>{d=(d=d.replace(e.url,"")).replace(/!\[[^\]]*\]\([^)]+\)/g,"")}),d=d.trim()),t.media&&t.media.length>0&&d.startsWith("[")&&d.endsWith("]")&&(d=""),(0,n.jsxs)("div",{children:[o&&(0,n.jsx)("div",{style:{textAlign:"center",padding:"var(--space-3) 0",fontSize:"var(--text-caption2)",color:"var(--text-tertiary)"},children:L(t.timestamp)}),!o&&r>0&&(0,n.jsx)("div",{style:{height:i[r-1].role!==t.role?"var(--space-4)":"var(--space-1)"}}),a&&(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",padding:"0 var(--space-4)",marginBottom:"var(--space-1)"},children:[d&&(0,n.jsx)("div",{className:"user-msg-bubble",style:{padding:"var(--space-3) var(--space-4)",borderRadius:"var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg)",background:"var(--accent)",color:"var(--accent-contrast)",fontSize:"var(--text-subheadline)",lineHeight:"var(--leading-relaxed)",fontWeight:"var(--weight-medium)",boxShadow:"var(--shadow-subtle)"},children:R(d)}),l.length>0&&(0,n.jsx)("div",{className:"user-msg-bubble",children:z(l,!0)})]}),!a&&(0,n.jsx)("div",{className:"assistant-msg-row",style:{display:"flex",justifyContent:"flex-start",padding:"0 var(--space-4)",marginBottom:"var(--space-1)"},children:(0,n.jsxs)("div",{className:"assistant-msg-bubble",style:{display:"flex",flexDirection:"column"},children:[d&&(0,n.jsx)("div",{style:{padding:"var(--space-3) var(--space-4)",borderRadius:"var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg)",background:"var(--material-thin)",border:"1px solid var(--separator)",color:"var(--text-primary)",fontSize:"var(--text-subheadline)",lineHeight:"var(--leading-relaxed)"},children:R(d)}),l.length>0&&z(l,!1)]})})]},t.id||r)}),o&&(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-start",padding:"0 var(--space-4)",marginBottom:"var(--space-1)"},className:"assistant-msg-row",children:(0,n.jsx)("div",{className:"assistant-msg-bubble",style:{display:"flex",flexDirection:"column"},children:(0,n.jsx)("div",{style:{padding:"var(--space-3) var(--space-4)",borderRadius:"var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg)",background:"var(--material-thin)",border:"1px solid var(--separator)",color:"var(--text-primary)",fontSize:"var(--text-subheadline)",lineHeight:"var(--leading-relaxed)"},children:R(function(e){let t=e,r=(t.match(/```/g)||[]).length;if(r%2!=0&&(t+="\n```"),r%2==0){let e=t.replace(/```[\s\S]*?```/g,"");(e.match(/`/g)||[]).length%2!=0&&(t+="`"),(e.match(/\*\*/g)||[]).length%2!=0&&(t+="**")}return t}(o))})})}),s&&!o&&i.length>0&&((null==(t=i[i.length-1])?void 0:t.role)==="user"||(null==(r=i[i.length-1])?void 0:r.toolCall))&&(0,n.jsx)("div",{style:{display:"flex",justifyContent:"flex-start",padding:"0 var(--space-4)",marginTop:"var(--space-2)"},children:(0,n.jsx)("div",{style:{padding:"var(--space-3) var(--space-4)",borderRadius:"var(--radius-sm) var(--radius-lg) var(--radius-lg) var(--radius-lg)",background:"var(--material-thin)",border:"1px solid var(--separator)"},children:(0,n.jsxs)("div",{style:{display:"flex",gap:4,alignItems:"center",height:16},children:[(0,n.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--text-quaternary)",animation:"jinn-pulse 1.4s infinite",animationDelay:"0ms"}}),(0,n.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--text-quaternary)",animation:"jinn-pulse 1.4s infinite",animationDelay:"200ms"}}),(0,n.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--text-quaternary)",animation:"jinn-pulse 1.4s infinite",animationDelay:"400ms"}})]})})}),(0,n.jsx)("div",{ref:l}),(0,n.jsx)("style",{children:"\n @keyframes jinn-pulse {\n 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }\n 40% { opacity: 1; transform: scale(1); }\n }\n .assistant-msg-bubble { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }\n .user-msg-bubble { max-width: 90%; overflow-wrap: break-word; word-break: break-word; }\n .assistant-msg-row { padding: 0 var(--space-2) !important; }\n @media (min-width: 1024px) {\n .assistant-msg-bubble { max-width: 75%; }\n .user-msg-bubble { max-width: 75%; }\n .assistant-msg-row { padding: 0 var(--space-4) !important; }\n }\n /* User message contrast fixes — ensure all child elements are visible on accent background */\n .user-msg-bubble code {\n background: rgba(255,255,255,0.2) !important;\n border-color: rgba(255,255,255,0.3) !important;\n color: inherit !important;\n }\n .user-msg-bubble .code-block,\n .user-msg-bubble pre {\n background: rgba(0,0,0,0.2) !important;\n border-color: rgba(255,255,255,0.15) !important;\n color: rgba(255,255,255,0.95) !important;\n }\n .user-msg-bubble a {\n color: inherit !important;\n text-decoration-color: rgba(255,255,255,0.6) !important;\n }\n .user-msg-bubble strong { color: inherit !important; }\n .user-msg-bubble em { color: inherit !important; opacity: 0.9; }\n .user-msg-bubble span { color: inherit !important; }\n .user-msg-bubble div { color: inherit !important; }\n .user-msg-bubble th, .user-msg-bubble td { color: inherit !important; }\n .user-msg-bubble table { border-color: rgba(255,255,255,0.2) !important; }\n .user-msg-bubble th { border-color: rgba(255,255,255,0.2) !important; }\n .user-msg-bubble td { border-color: rgba(255,255,255,0.15) !important; }\n .user-msg-bubble tr { background: transparent !important; }\n .user-msg-bubble thead tr { background: rgba(255,255,255,0.1) !important; }\n /* Selection visibility for user messages */\n .user-msg-bubble ::selection {\n background: rgba(255,255,255,0.35);\n color: inherit;\n }\n .user-msg-bubble ::-moz-selection {\n background: rgba(255,255,255,0.35);\n color: inherit;\n }\n "})]}):(0,n.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsxs)("div",{style:{textAlign:"center"},children:[(0,n.jsx)("div",{style:{fontSize:"var(--text-title3)",fontWeight:"var(--weight-semibold)",color:"var(--text-tertiary)"},children:"Start a conversation"}),(0,n.jsx)("div",{style:{fontSize:"var(--text-footnote)",color:"var(--text-quaternary)",marginTop:"var(--space-2)"},children:"Send a message or use /new to begin"})]})})}function T(e){let{attachments:t,onRemove:r}=e;return 0===t.length?null:(0,n.jsx)("div",{style:{display:"flex",gap:"var(--space-2)",padding:"var(--space-2) var(--space-3)",overflowX:"auto",overflowY:"hidden"},children:t.map((e,t)=>{var a,i;return(0,n.jsxs)("div",{style:{position:"relative",width:56,height:56,flexShrink:0,borderRadius:"var(--radius-sm)",overflow:"hidden",background:"var(--fill-tertiary)",border:"1px solid var(--separator)"},children:["image"===e.type?(0,n.jsx)("img",{src:e.url,alt:e.name||"Preview",style:{width:"100%",height:"100%",objectFit:"cover"}}):(0,n.jsxs)("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:4},children:["audio"===e.type?(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,n.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,n.jsx)("circle",{cx:"18",cy:"16",r:"3"})]}):(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),(0,n.jsx)("polyline",{points:"13 2 13 9 20 9"})]}),(0,n.jsx)("span",{style:{fontSize:8,color:"var(--text-quaternary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%",textAlign:"center"},children:(null==(i=e.name)||null==(a=i.split(".").pop())?void 0:a.toUpperCase())||e.type.toUpperCase()})]}),(0,n.jsx)("button",{onClick:()=>r(t),"aria-label":"Remove attachment",style:{position:"absolute",top:2,right:2,width:18,height:18,borderRadius:"50%",background:"rgba(0,0,0,0.6)",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:11,lineHeight:1,padding:0},children:(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",children:[(0,n.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,n.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},t)})})}function M(e){let{open:t,progress:r,onDownload:a,onCancel:i}=e;if(!t)return null;let s=null!==r;return(0,n.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",zIndex:60,display:"flex",alignItems:"center",justifyContent:"center"},onClick:s?void 0:i,children:(0,n.jsxs)("div",{style:{background:"var(--bg)",borderRadius:"var(--radius-lg)",padding:"var(--space-6)",maxWidth:400,width:"90%",boxShadow:"var(--shadow-overlay)"},onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("div",{style:{width:48,height:48,borderRadius:"var(--radius-md)",background:"var(--fill-secondary)",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"var(--space-4)"},children:(0,n.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),(0,n.jsx)("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),(0,n.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),(0,n.jsx)("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}),(0,n.jsx)("h3",{style:{fontSize:"var(--text-headline)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)",marginBottom:"var(--space-2)"},children:"Enable voice input?"}),(0,n.jsx)("p",{style:{fontSize:"var(--text-body)",color:"var(--text-secondary)",marginBottom:"var(--space-5)",lineHeight:"var(--leading-relaxed)"},children:"This will download a speech recognition model (~500MB). Transcription runs locally on your server — no data leaves your network."}),s&&(0,n.jsxs)("div",{style:{marginBottom:"var(--space-5)"},children:[(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"var(--space-2)",fontSize:"var(--text-footnote)",color:"var(--text-tertiary)"},children:[(0,n.jsx)("span",{children:"Downloading model…"}),(0,n.jsxs)("span",{children:[r,"%"]})]}),(0,n.jsx)("div",{style:{height:6,borderRadius:3,background:"var(--fill-tertiary)",overflow:"hidden"},children:(0,n.jsx)("div",{style:{height:"100%",width:"".concat(r,"%"),borderRadius:3,background:"var(--accent)",transition:"width 300ms ease"}})})]}),(0,n.jsxs)("div",{style:{display:"flex",gap:"var(--space-3)",justifyContent:"flex-end"},children:[!s&&(0,n.jsx)("button",{onClick:i,style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",color:"var(--text-primary)",border:"none",cursor:"pointer",fontSize:"var(--text-body)"},children:"Cancel"}),(0,n.jsx)("button",{onClick:a,disabled:s,style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:s?"var(--fill-tertiary)":"var(--accent)",color:s?"var(--text-tertiary)":"#000",border:"none",cursor:s?"default":"pointer",fontSize:"var(--text-body)",fontWeight:"var(--weight-semibold)"},children:s?"Downloading…":"Download"})]})]})})}function B(e){let{analyser:t,width:r=64,height:i=32,color:s="var(--system-red)"}=e,o=(0,a.useRef)(null),l=(0,a.useRef)(0);return(0,a.useEffect)(()=>{let e=o.current;if(!e||!t)return;let n=e.getContext("2d");if(!n)return;let a=t.frequencyBinCount,d=new Uint8Array(a),c=(r-22)/12;return!function e(){l.current=requestAnimationFrame(e),t.getByteFrequencyData(d),n.clearRect(0,0,r,i);for(let e=0;e<12;e++){let t=Math.max(3,d[Math.floor(e/12*(.6*a))]/255*i),r=e*(c+2),o=(i-t)/2;n.fillStyle=s,n.beginPath(),n.roundRect(r,o,c,t,1.5),n.fill()}}(),()=>{cancelAnimationFrame(l.current)}},[t,r,i,s]),(0,n.jsx)("canvas",{ref:o,width:r,height:i,style:{width:r,height:i,display:"block"}})}let E=[{name:"new",description:"Start a new chat session"},{name:"status",description:"Show current session info"}];async function A(e){let t,r=e.type.startsWith("image/"),n=e.type.startsWith("audio/");if(r)t=await new Promise((t,r)=>{let n=new Image,a=URL.createObjectURL(e);n.onload=()=>{URL.revokeObjectURL(a);let{width:i,height:s}=n;if(i>1200||s>1200){let e=1200/Math.max(i,s);i=Math.round(i*e),s=Math.round(s*e)}let o=document.createElement("canvas");o.width=i,o.height=s;let l=o.getContext("2d");if(!l)return void r(Error("no canvas context"));l.drawImage(n,0,0,i,s);let d=e.size>5e4?"image/jpeg":"image/png";t(o.toDataURL(d,"image/jpeg"===d?.85:void 0))},n.onerror=()=>{URL.revokeObjectURL(a),r(Error("image load failed"))},n.src=a});else t=await new Promise((t,r)=>{let n=new FileReader;n.onloadend=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)});return{type:r?"image":n?"audio":"file",url:t,name:e.name,mimeType:e.type,size:t.length}}function U(e){let{disabled:t,loading:r,onSend:i,onInterrupt:o,onNewSession:l,onStatusRequest:d,skillsVersion:c,events:u}=e,[p,h]=(0,a.useState)(""),[g,v]=(0,a.useState)([]),[x,m]=(0,a.useState)(!1),[y,f]=(0,a.useState)(""),[b,j]=(0,a.useState)(0),[k,w]=(0,a.useState)(E),[S,C]=(0,a.useState)(!1),[I,R]=(0,a.useState)(""),[L,W]=(0,a.useState)(0),[z,D]=(0,a.useState)([]),U=(0,a.useRef)(null),N=(0,a.useRef)(null),F=(0,a.useRef)(new Map),H=function(e,t){let[r,n]=(0,a.useState)("idle"),[i,o]=(0,a.useState)(null),[l,d]=(0,a.useState)(null),[c,u]=(0,a.useState)(null),[p,h]=(0,a.useState)(["en"]),[g,v]=(0,a.useState)(null),[x,m]=(0,a.useState)(()=>localStorage.getItem("stt-language")||"en"),y=(0,a.useRef)(x);y.current=x;let f=(0,a.useRef)(null),b=(0,a.useRef)(null),j=(0,a.useRef)(null),k=(0,a.useRef)([]),w=(0,a.useRef)(null),S=(0,a.useRef)(null),C=(0,a.useRef)(t);C.current=t,(0,a.useEffect)(()=>{if(!e||0===e.length)return;let t=e[e.length-1];if(!t.event.startsWith("stt:"))return;let r=t.payload;"stt:download:progress"===t.event&&d(Number(r.progress)||0),"stt:download:complete"===t.event&&(d(null),o(!0),n("idle")),"stt:download:error"===t.event&&(d(null),n("idle"))},[e]);let I=(0,a.useCallback)(()=>{var e,t;null==(e=j.current)||e.getTracks().forEach(e=>e.stop()),j.current=null,null==(t=b.current)||t.close().catch(()=>{}),b.current=null,u(null),f.current=null},[]);(0,a.useEffect)(()=>()=>{var e,t,r;w.current&&clearTimeout(w.current),(null==(e=f.current)?void 0:e.state)==="recording"&&f.current.stop(),null==(t=j.current)||t.getTracks().forEach(e=>e.stop()),null==(r=b.current)||r.close().catch(()=>{})},[]);let R=(0,a.useCallback)(async()=>{try{var e;let t=await s.F.sttStatus();return o(t.available),t.downloading&&d(t.progress),(null==(e=t.languages)?void 0:e.length)>0&&(h(t.languages),m(e=>{if(!t.languages.includes(e)){let e=t.languages[0];return localStorage.setItem("stt-language",e),e}return e})),t.available}catch(e){return o(!1),!1}},[]),L=(0,a.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});j.current=e;let t=new AudioContext;b.current=t;let r=t.createMediaStreamSource(e),a=t.createAnalyser();a.fftSize=128,r.connect(a),u(a);let i=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/mp4")?"audio/mp4":"",o=new MediaRecorder(e,i?{mimeType:i}:void 0);f.current=o,k.current=[],o.ondataavailable=e=>{e.data.size>0&&k.current.push(e.data)},o.onstop=async()=>{I(),n("transcribing");let e=new Blob(k.current,{type:o.mimeType||"audio/webm"});if(k.current=[],0===e.size){var t;n("idle"),null==(t=S.current)||t.call(S,null),S.current=null;return}try{let t=(await s.F.sttTranscribe(e,y.current)).text||null;n("idle"),v(null),S.current?(S.current(t),S.current=null):t&&C.current&&C.current(t)}catch(t){let e=t instanceof Error?t.message:"Transcription failed";v(e),n("error"),S.current&&(S.current(null),S.current=null)}},o.start(5e3),n("recording"),w.current=setTimeout(()=>{var e;(null==(e=f.current)?void 0:e.state)==="recording"&&f.current.stop()},18e5)}catch(e){I(),n("idle")}},[I]),W=(0,a.useCallback)(async()=>{"recording"!==r&&"transcribing"!==r&&("error"===r&&(v(null),n("idle")),await R()?await L():n("no-model"))},[r,R,L]),z=(0,a.useCallback)(async()=>{await L()},[L]),D=(0,a.useCallback)(async()=>f.current&&"inactive"!==f.current.state?(w.current&&(clearTimeout(w.current),w.current=null),new Promise(e=>{var t;S.current=e,(null==(t=f.current)?void 0:t.state)==="recording"?f.current.stop():(I(),n("idle"),S.current=null,e(null))})):(n("idle"),null),[I]),T=(0,a.useCallback)(()=>{var e;w.current&&(clearTimeout(w.current),w.current=null),(null==(e=f.current)?void 0:e.state)==="recording"&&f.current.stop(),I(),k.current=[],n("idle")},[I]),M=(0,a.useCallback)(()=>{d(0),s.F.sttDownload().catch(()=>{d(null)})},[]),B=(0,a.useCallback)(()=>{n("idle"),d(null)},[]),E=(0,a.useCallback)(()=>{n("idle"),v(null)},[]),A=(0,a.useCallback)(()=>{m(e=>{let t=p.indexOf(e),r=p[(t+1)%p.length];return localStorage.setItem("stt-language",r),r})},[p]);return{state:r,available:i,downloadProgress:l,analyser:c,languages:p,selectedLanguage:x,error:g,cycleLanguage:A,handleMicClick:W,startRecording:z,stopRecording:D,cancelRecording:T,startDownload:M,dismissDownload:B,dismissError:E}}(u,e=>{e&&h(t=>t?t+" "+e:e)});(0,a.useEffect)(()=>{s.F.getOrg().then(async e=>{let t=e.employees;Array.isArray(t)&&v(await Promise.all(t.map(async e=>{try{let t=await s.F.getEmployee(e);return{name:t.name,displayName:t.displayName,department:t.department,rank:t.rank,engine:t.engine}}catch(t){return{name:e}}})))}).catch(()=>{})},[]),(0,a.useEffect)(()=>{s.F.getSkills().then(e=>{if(!Array.isArray(e))return;let t=e.filter(e=>!E.some(t=>t.name===e.name)).map(e=>({name:e.name,description:e.description||"",needsEmployee:"sync"===e.name}));w([...E,...t])}).catch(()=>{})},[c]);let O=(0,a.useCallback)(e=>{var t;let r=p.lastIndexOf("@");-1!==r&&h(p.slice(0,r)+"@"+e+" "),m(!1),null==(t=U.current)||t.focus()},[p]),P=(0,a.useCallback)(e=>{var t;e.needsEmployee?(h("/"+e.name+" @"),C(!1),f(""),j(0),m(!0)):(h("/"+e.name),C(!1)),null==(t=U.current)||t.focus()},[]);function V(){let e=p.trim(),r=z.length>0;if(!e&&!r||t)return;if("/new"===e){h(""),l();return}if("/status"===e){h(""),d();return}let n=r?[...z]:void 0;h(""),D([]),m(!1),C(!1),U.current&&(U.current.style.height="auto"),i(e,n,!1)}async function q(e){let t=e.target.files;if(!t||0===t.length)return;let r=[];for(let e=0;e<t.length;e++)r.push(await A(t[e]));D(e=>[...e,...r]),e.target.value=""}async function J(e){var t;let r=null==(t=e.clipboardData)?void 0:t.items;if(r){for(let t=0;t<r.length;t++)if(r[t].type.startsWith("image/")){e.preventDefault();let n=r[t].getAsFile();if(n){let e=await A(n);D(t=>[...t,e])}return}}}let _=(0,a.useCallback)(e=>{e&&h(t=>t?t+" "+e:e)},[]);async function K(){if("recording"===H.state){var e;let t=await H.stopRecording();_(null!=t?t:""),null==(e=U.current)||e.focus()}else"transcribing"===H.state||H.handleMicClick()}(0,a.useEffect)(()=>{U.current&&(U.current.style.height="auto",U.current.style.height=Math.min(U.current.scrollHeight,120)+"px")},[p]);let Y=k.filter(e=>e.name.toLowerCase().startsWith(I)),X=g.filter(e=>e.name.toLowerCase().includes(y)),G=p.trim().length>0||z.length>0;return(0,n.jsxs)("div",{className:"px-3 sm:px-4",style:{paddingTop:"var(--space-3)",paddingBottom:"var(--space-3)",borderTop:"1px solid var(--separator)",background:"var(--material-regular)",flexShrink:0,position:"relative"},children:[S&&Y.length>0&&(0,n.jsx)("div",{style:{position:"absolute",bottom:"100%",left:"var(--space-4)",right:"var(--space-4)",marginBottom:4,background:"var(--bg)",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",boxShadow:"var(--shadow-lg)",maxHeight:240,overflowY:"auto",zIndex:10},children:Y.map((e,t)=>{let r=t===L;return(0,n.jsxs)("button",{ref:e=>{r&&e&&e.scrollIntoView({block:"nearest"})},onClick:()=>P(e),style:{width:"100%",textAlign:"left",padding:"var(--space-2) var(--space-3)",fontSize:"var(--text-footnote)",background:r?"var(--fill-secondary)":"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"var(--space-2)",color:"var(--text-primary)"},children:[(0,n.jsxs)("span",{style:{fontFamily:"var(--font-mono)",fontWeight:"var(--weight-semibold)",color:"var(--accent)",fontSize:"var(--text-footnote)"},children:["/",e.name]}),(0,n.jsx)("span",{style:{color:"var(--text-tertiary)",fontSize:"var(--text-caption1)"},children:e.description})]},e.name)})}),x&&X.length>0&&(0,n.jsx)("div",{style:{position:"absolute",bottom:"100%",left:"var(--space-4)",right:"var(--space-4)",marginBottom:4,background:"var(--bg)",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",boxShadow:"var(--shadow-lg)",maxHeight:160,overflowY:"auto",zIndex:10},children:X.slice(0,8).map((e,t)=>{let r=t===b;return(0,n.jsxs)("button",{ref:e=>{e?F.current.set(t,e):F.current.delete(t),r&&e&&e.scrollIntoView({block:"nearest"})},onClick:()=>O(e.name),style:{width:"100%",textAlign:"left",padding:"var(--space-2) var(--space-3)",fontSize:"var(--text-footnote)",background:r?"var(--fill-secondary)":"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"var(--space-2)",color:"var(--text-primary)"},children:[(0,n.jsx)("span",{style:{fontSize:16,lineHeight:1},children:{executive:"\uD83C\uDFAF",manager:"\uD83D\uDCCB",senior:"⭐",employee:"\uD83D\uDC64"}[e.rank||"employee"]||"\uD83D\uDC64"}),(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)"},children:[(0,n.jsx)("span",{style:{fontWeight:"var(--weight-semibold)"},children:e.displayName||e.name}),(0,n.jsxs)("span",{style:{fontFamily:"var(--font-mono)",fontSize:"var(--text-caption2)",color:"var(--text-tertiary)"},children:["@",e.name]})]}),e.department&&(0,n.jsxs)("div",{style:{fontSize:"var(--text-caption2)",color:"var(--text-quaternary)",display:"flex",gap:"var(--space-2)",marginTop:1},children:[(0,n.jsx)("span",{children:e.department}),e.engine&&(0,n.jsx)("span",{style:{color:"var(--accent)",fontWeight:"var(--weight-medium)"},children:e.engine})]})]})]},e.name)})}),z.length>0&&(0,n.jsx)("div",{style:{marginBottom:"var(--space-2)"},children:(0,n.jsx)(T,{attachments:z,onRemove:function(e){D(t=>t.filter((t,r)=>r!==e))}})}),(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",background:"var(--fill-secondary)",borderRadius:"var(--radius-lg)",padding:"6px var(--space-3)",border:r?"1px solid var(--accent)":"1px solid var(--separator)",minHeight:44,transition:"border-color 200ms ease"},children:[(0,n.jsx)("button",{"aria-label":"Attach file",onClick:()=>{var e;return null==(e=N.current)?void 0:e.click()},style:{width:32,height:32,flexShrink:0,borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-secondary)",marginBottom:0},children:(0,n.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}),(0,n.jsx)("input",{ref:N,type:"file",accept:"image/*,audio/*,.pdf,.doc,.docx,.txt,.csv,.json,.zip",multiple:!0,style:{display:"none"},onChange:q}),(0,n.jsx)("textarea",{ref:U,value:p,onChange:function(e){let t=e.target.value;if(h(t),t.startsWith("/")&&!t.includes(" ")){R(t.slice(1).toLowerCase()),W(0),C(!0),m(!1);return}C(!1);let r=t.lastIndexOf("@");if(-1!==r){let e=t.slice(r+1);if(!e.includes(" ")&&!e.includes("\n")){f(e.toLowerCase()),j(0),m(!0);return}}m(!1)},onKeyDown:function(e){if(S&&Y.length>0){let t=Y.length;if("ArrowDown"===e.key){e.preventDefault(),W(e=>(e+1)%t);return}if("ArrowUp"===e.key){e.preventDefault(),W(e=>(e-1+t)%t);return}if("Tab"===e.key||"Enter"===e.key){e.preventDefault(),P(Y[L]);return}if("Escape"===e.key){e.preventDefault(),C(!1);return}}if(x&&X.length>0){let t=Math.min(X.length,8);if("ArrowDown"===e.key){e.preventDefault(),j(e=>(e+1)%t);return}if("ArrowUp"===e.key){e.preventDefault(),j(e=>(e-1+t)%t);return}if("Tab"===e.key||"Enter"===e.key){e.preventDefault(),O(X[b].name);return}if("Escape"===e.key){e.preventDefault(),m(!1);return}}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),V())},onPaste:J,placeholder:t?"Waiting for response...":"Type a message...",rows:1,disabled:t,style:{flex:1,background:"transparent",border:"none",outline:"none",resize:"none",color:"var(--text-primary)",fontSize:"var(--text-subheadline)",lineHeight:"20px",maxHeight:120,minHeight:20,height:20,padding:0,margin:0,opacity:t?.5:1},onInput:e=>{let t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"}}),H.languages.length>1&&(0,n.jsx)("button",{"aria-label":"STT language: ".concat(H.selectedLanguage.toUpperCase(),". Click to switch."),onClick:H.cycleLanguage,style:{height:24,padding:"0 6px",flexShrink:0,borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--fill-tertiary)",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontWeight:600,fontFamily:"var(--font-mono)",letterSpacing:"0.5px",textTransform:"uppercase",transition:"all 150ms ease"},title:"Transcription language: ".concat(H.selectedLanguage.toUpperCase(),". Click to cycle."),children:H.selectedLanguage}),(0,n.jsx)("button",{"aria-label":"recording"===H.state?"Stop recording":"transcribing"===H.state?"Transcribing…":"Voice input",onClick:K,disabled:"transcribing"===H.state,style:{width:32,height:32,flexShrink:0,borderRadius:"recording"===H.state?"999px":"var(--radius-sm)",display:"flex",alignItems:"center",justifyContent:"center",background:"recording"===H.state?"var(--system-red)":"transparent",border:"none",cursor:"transcribing"===H.state?"wait":"pointer",color:"recording"===H.state?"#fff":"var(--text-secondary)",transition:"all 150ms ease"},title:"recording"===H.state?"Stop recording":"transcribing"===H.state?"Transcribing…":"Voice input",children:"transcribing"===H.state?(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{animation:"stt-spin 1s linear infinite"},children:(0,n.jsx)("path",{d:"M12 2a10 10 0 0 1 10 10"})}):(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),(0,n.jsx)("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),(0,n.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),(0,n.jsx)("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}),"recording"===H.state&&H.analyser&&(0,n.jsx)(B,{analyser:H.analyser,width:64,height:28}),r&&o&&(0,n.jsx)("button",{onClick:o,"aria-label":"Stop",style:{width:32,height:32,borderRadius:"50%",background:"var(--system-red)",color:"#fff",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 150ms ease"},children:(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",children:(0,n.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"})})}),(0,n.jsx)("button",{onClick:V,disabled:!G||t,"aria-label":"Send message",style:{width:32,height:32,borderRadius:"50%",background:G?"var(--accent)":"var(--fill-tertiary)",color:G?"var(--accent-contrast)":"var(--text-quaternary)",border:"none",cursor:G?"pointer":"default",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:"all 150ms ease"},children:(0,n.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),(0,n.jsx)("polyline",{points:"5 12 12 5 19 12"})]})})]}),(0,n.jsxs)("div",{className:"hidden sm:flex",style:{fontSize:"var(--text-caption2)",color:"var(--text-quaternary)",textAlign:"center",marginTop:"var(--space-1)",justifyContent:"center",gap:"var(--space-3)"},children:[(0,n.jsx)("span",{children:"Enter to send"}),(0,n.jsx)("span",{children:"/ - commands"}),(0,n.jsx)("span",{children:"@name - mention"})]}),"error"===H.state&&H.error&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",marginTop:"var(--space-2)",padding:"var(--space-2) var(--space-3)",background:"color-mix(in srgb, var(--system-red) 12%, transparent)",borderRadius:"var(--radius-sm)",fontSize:"var(--text-caption1)",color:"var(--system-red)"},children:[(0,n.jsxs)("span",{style:{flex:1},children:["Voice input error: ",H.error]}),(0,n.jsx)("button",{onClick:H.dismissError,style:{background:"none",border:"none",cursor:"pointer",color:"var(--system-red)",fontSize:"var(--text-caption1)",fontWeight:600,padding:"2px 6px"},children:"Dismiss"})]}),(0,n.jsx)(M,{open:"no-model"===H.state,progress:H.downloadProgress,onDownload:H.startDownload,onCancel:H.dismissDownload}),(0,n.jsx)("style",{children:"\n @keyframes stt-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n "})]})}function N(){return(0,n.jsx)(a.Suspense,{fallback:(0,n.jsx)(l.M,{children:(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-tertiary)"},children:"Loading..."})}),children:(0,n.jsx)(F,{})})}function F(){var e;let{settings:t}=(0,d.t0)(),r=null!=(e=t.portalName)?e:"Jinn",[c,u]=(0,a.useState)(null),[p,h]=(0,a.useState)([]),[g,v]=(0,a.useState)(!1),[f,b]=(0,a.useState)(0),[j,k]=(0,a.useState)("sidebar"),[w,S]=(0,a.useState)(null),C=(0,a.useRef)(""),[I,R]=(0,a.useState)(""),L=(0,a.useRef)(-1),W=(0,a.useRef)(!1),[z,T]=(0,a.useState)(!1),[M,B]=(0,a.useState)(null),[E,A]=(0,a.useState)(!1),N=(0,a.useRef)(null),{events:F,connectionSeq:H,skillsVersion:O}=(0,o.G)(),P=(0,i.useSearchParams)(),V=(0,a.useRef)(!1),q=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(z)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){N.current&&!N.current.contains(e.target)&&T(!1)}},[z]);let J=(0,a.useCallback)((e,t)=>{navigator.clipboard.writeText(e),B(t),T(!1),setTimeout(()=>B(null),1500)},[]);function _(){s.F.createStubSession({greeting:"Hey! \uD83D\uDC4B Say hi when you're ready to get started.",title:"Welcome"}).then(e=>{let t=String(e.id);q.current=!0,u(t),b(e=>e+1)}).catch(()=>{})}(0,a.useEffect)(()=>{V.current||("1"===P.get("onboarding")?(V.current=!0,_()):s.F.getOnboarding().then(e=>{e.needed&&!V.current&&(V.current=!0,_())}).catch(()=>{}))},[P]);let K=(0,a.useCallback)((e,t)=>{if(!t)return;let r=L.current;if(r<0)return;let n=e.slice(r);n.length>0&&function(e,t){try{localStorage.setItem("".concat(m).concat(e),JSON.stringify(t))}catch(e){}}(t,n)},[]);(0,a.useEffect)(()=>{if(0===F.length)return;let e=F[F.length-1],t=e.payload;if(c&&t.sessionId===c){if("session:delta"===e.event){let e=String(t.type||"text");if("text"===e){let e=String(t.content||"");C.current+=e,R(C.current)}else if("tool_use"===e){if(C.current){let e=C.current;C.current="",R(""),h(r=>{L.current<0&&(L.current=r.length);let n=[...r,{id:crypto.randomUUID(),role:"assistant",content:e,timestamp:Date.now()}];return K(n,c||t.sessionId),n})}let e=String(t.toolName||"tool");h(r=>{L.current<0&&(L.current=r.length);let n=[...r,{id:crypto.randomUUID(),role:"assistant",content:"Using ".concat(e),timestamp:Date.now(),toolCall:e}];return K(n,c||t.sessionId),n})}else"tool_result"===e&&h(e=>{let r=[...e],n=r[r.length-1];return n&&"assistant"===n.role&&n.toolCall&&(r[r.length-1]={...n,content:"Used ".concat(n.toolCall)}),K(r,c||t.sessionId),r})}if("session:interrupted"===e.event&&(C.current="",R("")),"session:completed"===e.event){C.current="",R(""),v(!1),L.current=-1;let e=c||(t.sessionId?String(t.sessionId):null);e&&y(e),t.result&&h(e=>{let r=[...e],n=r[r.length-1];return n&&"assistant"===n.role&&!n.toolCall&&r.pop(),[...r,{id:crypto.randomUUID(),role:"assistant",content:String(t.result),timestamp:Date.now()}]}),t.error&&!t.result&&h(e=>[...e,{id:crypto.randomUUID(),role:"assistant",content:"Error: ".concat(t.error),timestamp:Date.now()}]),b(e=>e+1)}}},[F,c,K]);let Y=(0,a.useCallback)(async e=>{try{let t=await s.F.getSession(e);S({engine:t.engine?String(t.engine):void 0,engineSessionId:t.engineSessionId?String(t.engineSessionId):void 0,model:t.model?String(t.model):void 0,title:t.title?String(t.title):void 0,employee:t.employee?String(t.employee):void 0});let r=t.messages||t.history||[],n=Array.isArray(r)?r.map(e=>({id:crypto.randomUUID(),role:e.role||"assistant",content:String(e.content||e.text||""),timestamp:e.timestamp?Number(e.timestamp):Date.now()})):[];if("error"===t.status&&t.lastError){let e=n[n.length-1],r="Error: ".concat(String(t.lastError));e&&"assistant"===e.role&&e.content===r||n.push({id:crypto.randomUUID(),role:"assistant",content:r,timestamp:Date.now()})}if("running"===t.status){let t=function(e){try{let t=localStorage.getItem("".concat(m).concat(e));return t?JSON.parse(t):[]}catch(e){return[]}}(e);t.length>0?(L.current=n.length,h([...n,...t])):(L.current=n.length,h(n)),v(!0)}else y(e),L.current=-1,h(n)}catch(e){h([]),S(null),L.current=-1}},[]);(0,a.useEffect)(()=>{H&&c&&Y(c)},[H,c,Y]),(0,a.useEffect)(()=>{if(!c||!g)return;let e=setInterval(async()=>{try{let e=await s.F.getSession(c);"running"!==e.status&&(await Y(c),v(!1))}catch(e){}},5e3);return()=>clearInterval(e)},[c,g,Y]);let X=(0,a.useCallback)(e=>{W.current=!1,u(e),h([]),v(!1),k("chat"),Y(e)},[Y]),G=(0,a.useCallback)(()=>{W.current=!0,u(null),h([]),v(!1),S(null),k("chat"),L.current=-1},[]),$=(0,a.useCallback)(e=>{c||V.current||W.current||!(e.length>0)||X(e[0].id)},[c,X]),Q=(0,a.useCallback)(async()=>{if(c)try{await s.F.sendMessage(c,{message:"",interrupt:!0})}catch(e){}},[c]),Z=(0,a.useCallback)(async(e,t,n)=>{let a={id:crypto.randomUUID(),role:"user",content:e,timestamp:Date.now(),media:t};h(e=>(L.current=e.length+1,[...e,a])),v(!0);try{let t=c;if(t&&q.current){q.current=!1;let n="This is your first time being activated. The user just set up ".concat(r," and opened the web dashboard for the first time.\n\nRead your CLAUDE.md instructions and the onboarding skill at ~/.jinn/skills/onboarding/SKILL.md, then follow the onboarding flow:\n- Greet the user warmly and introduce yourself as ").concat(r,"\n- Briefly explain what you can do (manage cron jobs, hire AI employees, connect to Slack, etc.)\n- Ask the user what they'd like to set up first\n\nThe user said: \"").concat(e,'"');await s.F.sendMessage(t,{message:n}),b(e=>e+1)}else if(t)await s.F.sendMessage(t,{message:e,interrupt:n||void 0}),b(e=>e+1);else{let r=await s.F.createSession({source:"web",prompt:e});t=String(r.id),u(t),b(e=>e+1)}}catch(e){v(!1),h(t=>[...t,{id:crypto.randomUUID(),role:"assistant",content:"Error: ".concat(e instanceof Error?e.message:"Failed to send message"),timestamp:Date.now()}])}},[c,r]),ee=(0,a.useCallback)(async e=>{try{await s.F.deleteSession(e),c===e&&(u(null),h([]),v(!1),S(null),C.current="",R(""),L.current=-1),y(e),b(e=>e+1)}catch(e){}A(!1),T(!1)},[c]),et=(0,a.useCallback)(async()=>{if(!c)return void h(e=>[...e,{id:crypto.randomUUID(),role:"assistant",content:"No active session. Send a message to start one.",timestamp:Date.now()}]);try{let e=await s.F.getSession(c),t=["**Session Info**","ID: `".concat(e.id,"`"),"Status: ".concat(e.status||"unknown"),e.employee?"Employee: ".concat(e.employee):null,e.engine?"Engine: ".concat(e.engine):null,e.model?"Model: ".concat(e.model):null,e.createdAt?"Created: ".concat(e.createdAt):null].filter(Boolean).join("\n");h(e=>[...e,{id:crypto.randomUUID(),role:"assistant",content:t,timestamp:Date.now()}])}catch(e){h(e=>[...e,{id:crypto.randomUUID(),role:"assistant",content:"Failed to fetch session status.",timestamp:Date.now()}])}},[c]);return(0,n.jsxs)(l.M,{children:[(0,n.jsxs)("div",{className:"h-[calc(100%-48px)] lg:h-full",style:{display:"flex",overflow:"hidden"},children:[(0,n.jsx)("div",{className:"hidden lg:block",style:{width:280,flexShrink:0,height:"100%"},children:(0,n.jsx)(x,{selectedId:c,onSelect:X,onNewChat:G,onDelete:ee,refreshKey:f,connectionSeq:H,onSessionsLoaded:$,events:F})}),(0,n.jsx)("div",{className:"sidebar"===j?"block lg:hidden":"hidden",style:{width:"100%",height:"100%"},children:(0,n.jsx)(x,{selectedId:c,onSelect:X,onNewChat:G,onDelete:ee,refreshKey:f,connectionSeq:H,onSessionsLoaded:$,events:F})}),(0,n.jsxs)("div",{style:{flex:1,flexDirection:"column",height:"100%",background:"var(--bg)",minWidth:0,overflow:"hidden"},className:"sidebar"===j?"hidden lg:flex":"flex",children:[(0,n.jsxs)("div",{style:{height:52,display:"flex",alignItems:"center",padding:"0 var(--space-4)",borderBottom:"1px solid var(--separator)",background:"var(--material-thick)",flexShrink:0},children:[(0,n.jsxs)("button",{className:"flex lg:hidden",onClick:()=>k("sidebar"),"aria-label":"Back to sessions",style:{padding:"var(--space-1) var(--space-2)",borderRadius:"var(--radius-sm)",marginRight:"var(--space-2)",fontSize:"var(--text-subheadline)",alignItems:"center",gap:"var(--space-1)",background:"transparent",border:"none",cursor:"pointer",color:"var(--accent)"},children:[(0,n.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"15 18 9 12 15 6"})}),"Back"]}),(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)("div",{style:{fontSize:"var(--text-subheadline)",fontWeight:"var(--weight-semibold)",color:"var(--text-primary)",letterSpacing:"-0.2px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c?(null==w?void 0:w.title)||(null==w?void 0:w.employee)||r:"New Chat"})}),M&&(0,n.jsx)("div",{style:{fontSize:"var(--text-caption1)",color:"var(--accent)",marginRight:"var(--space-2)",whiteSpace:"nowrap"},children:"Copied!"}),c&&(0,n.jsxs)("div",{ref:N,style:{position:"relative"},children:[(0,n.jsx)("button",{onClick:()=>T(e=>!e),"aria-label":"More options",style:{background:"transparent",border:"none",cursor:"pointer",padding:"var(--space-1)",borderRadius:"var(--radius-sm)",color:"var(--text-secondary)",display:"flex",alignItems:"center",transition:"color 150ms ease"},onMouseEnter:e=>e.currentTarget.style.color="var(--text-primary)",onMouseLeave:e=>e.currentTarget.style.color="var(--text-secondary)",children:(0,n.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,n.jsx)("circle",{cx:"12",cy:"5",r:"2"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,n.jsx)("circle",{cx:"12",cy:"19",r:"2"})]})}),z&&(0,n.jsxs)("div",{style:{position:"absolute",top:"100%",right:0,marginTop:4,background:"var(--material-thick)",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:100,minWidth:200,overflow:"hidden"},children:[(0,n.jsx)("button",{onClick:()=>J(c,"id"),style:{display:"block",width:"100%",padding:"var(--space-2) var(--space-3)",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-subheadline)",color:"var(--text-primary)"},onMouseEnter:e=>e.currentTarget.style.background="var(--fill-tertiary)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:"Copy Session ID"}),(null==w?void 0:w.engineSessionId)&&(0,n.jsx)("button",{onClick:()=>{let e="codex"===w.engine?"codex":"claude";J("".concat(e," --resume ").concat(w.engineSessionId),"cli")},style:{display:"block",width:"100%",padding:"var(--space-2) var(--space-3)",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-subheadline)",color:"var(--text-primary)"},onMouseEnter:e=>e.currentTarget.style.background="var(--fill-tertiary)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:"Copy CLI Resume Command"}),(0,n.jsx)("div",{style:{borderTop:"1px solid var(--separator)",margin:"2px 0"}}),(0,n.jsxs)("button",{onClick:()=>{T(!1),A(!0)},style:{display:"flex",alignItems:"center",gap:"var(--space-2)",width:"100%",padding:"var(--space-2) var(--space-3)",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",fontSize:"var(--text-subheadline)",color:"var(--system-red)"},onMouseEnter:e=>e.currentTarget.style.background="var(--fill-tertiary)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,n.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),"Delete Session"]})]})]})]}),(0,n.jsx)(D,{messages:p,loading:g,streamingText:I}),(0,n.jsx)(U,{disabled:!1,loading:g,onSend:Z,onInterrupt:Q,onNewSession:G,onStatusRequest:et,skillsVersion:O,events:F})]})]}),E&&c&&(0,n.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0,0,0,0.5)",zIndex:60,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>A(!1),children:(0,n.jsxs)("div",{style:{background:"var(--bg)",borderRadius:"var(--radius-lg)",padding:"var(--space-6)",maxWidth:400,width:"90%",boxShadow:"var(--shadow-overlay)"},onClick:e=>e.stopPropagation(),children:[(0,n.jsx)("h3",{style:{fontSize:"var(--text-headline)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)",marginBottom:"var(--space-2)"},children:"Delete Session?"}),(0,n.jsx)("p",{style:{fontSize:"var(--text-body)",color:"var(--text-secondary)",marginBottom:"var(--space-5)"},children:"This will permanently delete the session and all its messages."}),(0,n.jsxs)("div",{style:{display:"flex",gap:"var(--space-3)",justifyContent:"flex-end"},children:[(0,n.jsx)("button",{onClick:()=>A(!1),style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",color:"var(--text-primary)",border:"none",cursor:"pointer",fontSize:"var(--text-body)"},children:"Cancel"}),(0,n.jsx)("button",{onClick:()=>ee(c),style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--system-red)",color:"#fff",border:"none",cursor:"pointer",fontSize:"var(--text-body)",fontWeight:"var(--weight-semibold)"},children:"Delete"})]})]})})]})}},7906:(e,t,r)=>{Promise.resolve().then(r.bind(r,3095))}},e=>{e.O(0,[282,700,814,743,358],()=>e(e.s=7906)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[636],{543:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>R});var a=r(8111),i=r(5271);let n=(0,r(1983).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);var o=r(3176);let s="jinn-kanban",l=new Set(["backlog","todo","in-progress","review","done"]),d=new Set(["low","medium","high"]),c=new Set(["idle","starting","working","done","failed"]);function p(e,t,r){let a=e[t];return a?{...e,[t]:{...a,...r,updatedAt:Date.now()}}:e}var u=r(8700),v=r(1240);let x=[{id:"backlog",title:"Backlog"},{id:"todo",title:"To Do"},{id:"in-progress",title:"In Progress"},{id:"review",title:"Review"},{id:"done",title:"Done"}],f={low:"var(--system-green)",medium:"var(--system-orange)",high:"var(--system-red)"};function g(e){let{column:t,tickets:r,onDrop:o,onCreateTicket:s,renderTicket:l}=e,[d,c]=(0,i.useState)(!1);return(0,a.jsxs)("div",{onDragOver:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move",c(!0)},onDragLeave:function(e){e.currentTarget.contains(e.relatedTarget)||c(!1)},onDrop:function(e){e.preventDefault(),c(!1);let r=e.dataTransfer.getData("text/plain");r&&o(r,t.id)},style:{display:"flex",flexDirection:"column",minWidth:280,maxWidth:320,flex:"1 0 280px",height:"100%",borderRadius:"var(--radius-lg)",background:d?"var(--fill-secondary)":"var(--fill-tertiary)",border:d?"2px dashed var(--accent)":"2px dashed transparent",transition:"background 200ms var(--ease-smooth), border-color 200ms var(--ease-smooth)"},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"var(--space-3) var(--space-4)",flexShrink:0},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)"},children:[(0,a.jsx)("span",{style:{fontSize:"var(--text-footnote)",fontWeight:"var(--weight-semibold)",color:"var(--text-primary)",letterSpacing:"-0.01em"},children:t.title}),(0,a.jsx)("span",{style:{fontSize:"var(--text-caption2)",fontWeight:"var(--weight-medium)",color:"var(--text-tertiary)",background:"var(--fill-secondary)",borderRadius:"var(--radius-sm)",padding:"1px 6px",minWidth:20,textAlign:"center"},children:r.length})]}),"backlog"===t.id&&s&&(0,a.jsx)("button",{onClick:s,"aria-label":"Create new ticket",style:{display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:"var(--radius-sm)",border:"none",background:"transparent",color:"var(--text-secondary)",cursor:"pointer",padding:0,transition:"color 150ms var(--ease-smooth)"},children:(0,a.jsx)(n,{size:16})})]}),(0,a.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"0 var(--space-2) var(--space-2)",display:"flex",flexDirection:"column",gap:"var(--space-2)"},children:[r.map(e=>(0,a.jsx)("div",{children:l(e)},e.id)),0===r.length&&(0,a.jsx)("div",{style:{padding:"var(--space-8) var(--space-4)",textAlign:"center",fontSize:"var(--text-caption1)",color:"var(--text-tertiary)"},children:"No tickets"})]})]})}var h=r(5896);let m={low:"Low",medium:"Med",high:"High"};function y(e){let{ticket:t,assigneeName:r,onClick:n,onDelete:o}=e,[s,l]=(0,i.useState)(!1),[d,c]=(0,i.useState)(!1);return(0,a.jsxs)("div",{draggable:!0,onDragStart:function(e){e.dataTransfer.setData("text/plain",t.id),e.dataTransfer.effectAllowed="move",l(!0)},onDragEnd:function(){l(!1)},onClick:n,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),n())},style:{position:"relative",background:"var(--material-regular)",borderRadius:"var(--radius-md)",padding:"var(--space-3)",cursor:s?"grabbing":"grab",opacity:s?.6:1,border:"1px solid var(--separator)",borderLeft:"3px solid ".concat(f[t.priority]),display:"flex",flexDirection:"column",gap:"var(--space-2)",userSelect:"none",transition:"opacity 150ms var(--ease-smooth)"},children:[d&&o&&(0,a.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},"aria-label":"Delete ticket",title:"Delete ticket",style:{position:"absolute",top:6,right:6,width:24,height:24,borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",justifyContent:"center",background:"color-mix(in srgb, var(--system-red) 12%, transparent)",color:"var(--system-red)",border:"none",cursor:"pointer",padding:0,zIndex:1},children:(0,a.jsx)(h.A,{size:13})}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"var(--space-2)"},children:[(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:"var(--text-caption2)",fontWeight:600,color:f[t.priority],flexShrink:0,marginTop:2},children:[(0,a.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:f[t.priority]}}),m[t.priority]]}),(0,a.jsx)("span",{style:{fontSize:"var(--text-footnote)",fontWeight:"var(--weight-semibold)",color:"var(--text-primary)",lineHeight:1.3,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:t.title})]}),t.description&&(0,a.jsx)("div",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",wordBreak:"break-word"},children:t.description}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",flexWrap:"wrap"},children:[r&&(0,a.jsx)("span",{style:{fontSize:"var(--text-caption2)",fontWeight:"var(--weight-medium)",color:"var(--text-secondary)",background:"var(--fill-tertiary)",borderRadius:"var(--radius-sm)",padding:"1px var(--space-2)",lineHeight:1.5},children:r}),(0,a.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-quaternary)",marginLeft:"auto"},title:new Date(t.createdAt).toLocaleString(),children:function(e){let t=Math.floor((Date.now()-e)/6e4);if(t<1)return"just now";if(t<60)return"".concat(t,"m ago");let r=Math.floor(t/60);if(r<24)return"".concat(r,"h ago");let a=Math.floor(r/24);return a<30?"".concat(a,"d ago"):"".concat(Math.floor(a/30),"mo ago")}(t.createdAt)})]})]})}function b(e){let{tickets:t,employees:r,onTicketClick:i,onMoveTicket:n,onCreateTicket:o,onDeleteTicket:s,filterEmployeeId:l}=e;return(0,a.jsx)("div",{style:{display:"flex",gap:"var(--space-3)",height:"100%",overflowX:"auto",overflowY:"hidden",padding:"var(--space-2) 0",WebkitOverflowScrolling:"touch"},children:x.map(e=>{var d;let c=(d=e.id,Object.values(t).filter(e=>e.status===d).sort((e,t)=>t.updatedAt-e.updatedAt)),p=l?c.filter(e=>e.assigneeId===l):c;return(0,a.jsx)(g,{column:e,tickets:p,onDrop:n,onCreateTicket:"backlog"===e.id?o:void 0,renderTicket:e=>{var t;let n=r.find(t=>t.name===e.assigneeId);return(0,a.jsx)(y,{ticket:e,assigneeName:null!=(t=null==n?void 0:n.displayName)?t:null,onClick:()=>i(e),onDelete:s?()=>s(e):void 0})}},e.id)})})}let k={executive:"Exec",manager:"Mgr",senior:"Sr",employee:""};function j(e){var t;let{employees:r,value:n,onChange:o}=e,[s,l]=(0,i.useState)(!1),[d,c]=(0,i.useState)(""),[p,u]=(0,i.useState)(0),v=(0,i.useRef)(null),x=(0,i.useRef)(null),f=(0,i.useRef)(null),g=null!=(t=r.find(e=>e.name===n))?t:null,h=d.trim()?r.filter(e=>{let t=d.toLowerCase();return e.name.toLowerCase().includes(t)||e.displayName.toLowerCase().includes(t)||e.department.toLowerCase().includes(t)}):r,m=!d.trim()||"unassigned".includes(d.toLowerCase());(0,i.useEffect)(()=>{u(0)},[d]),(0,i.useEffect)(()=>{s?setTimeout(()=>{var e;return null==(e=x.current)?void 0:e.focus()},0):c("")},[s]),(0,i.useEffect)(()=>{if(s)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){v.current&&!v.current.contains(e.target)&&l(!1)}},[s]),(0,i.useEffect)(()=>{if(!s||!f.current)return;let e=f.current.querySelectorAll("[data-employee-option]")[p];e&&e.scrollIntoView({block:"nearest"})},[p,s]);let y=+!!m+h.length,b=(0,i.useCallback)(e=>{if(!s){("Enter"===e.key||" "===e.key||"ArrowDown"===e.key)&&(e.preventDefault(),l(!0));return}if("Escape"===e.key){e.preventDefault(),l(!1);return}if("ArrowDown"===e.key)e.preventDefault(),u(e=>Math.min(e+1,y-1));else if("ArrowUp"===e.key)e.preventDefault(),u(e=>Math.max(e-1,0));else if("Enter"===e.key){if(e.preventDefault(),m&&0===p)o("");else{let e=m?p-1:p;h[e]&&o(h[e].name)}l(!1)}},[s,p,y,m,h,o]);return(0,a.jsxs)("div",{ref:v,style:{position:"relative"},onKeyDown:b,children:[(0,a.jsx)("button",{type:"button",onClick:()=>l(!s),"aria-haspopup":"listbox","aria-expanded":s,style:{width:"100%",display:"flex",alignItems:"center",gap:"var(--space-2)",padding:"8px 12px",fontSize:"var(--text-body)",color:g?"var(--text-primary)":"var(--text-tertiary)",cursor:"pointer",textAlign:"left",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 12px center",paddingRight:36,minHeight:40,fontFamily:"inherit"},children:g?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{style:{fontWeight:"var(--weight-medium)"},children:g.displayName}),k[g.rank]&&(0,a.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",background:"var(--fill-secondary)",borderRadius:"var(--radius-sm)",padding:"1px 6px"},children:k[g.rank]})]}):(0,a.jsx)("span",{children:"Unassigned"})}),s&&(0,a.jsxs)("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:4,zIndex:50,background:"var(--material-regular)",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",boxShadow:"0 8px 32px rgba(0,0,0,0.3)",overflow:"hidden"},children:[(0,a.jsx)("div",{style:{padding:"8px 8px 4px"},children:(0,a.jsx)("input",{ref:x,type:"text",placeholder:"Search employees...",value:d,onChange:e=>c(e.target.value),style:{width:"100%",padding:"6px 10px",fontSize:"var(--text-footnote)",border:"1px solid var(--separator)",borderRadius:"var(--radius-sm)",background:"var(--fill-tertiary)",color:"var(--text-primary)",outline:"none",fontFamily:"inherit"}})}),(0,a.jsxs)("div",{ref:f,role:"listbox",style:{maxHeight:280,overflowY:"auto",padding:"4px"},children:[m&&(0,a.jsxs)("div",{"data-employee-option":!0,role:"option","aria-selected":""===n,onClick:()=>{o(""),l(!1)},style:{display:"flex",alignItems:"center",gap:"var(--space-2)",padding:"8px 10px",borderRadius:"var(--radius-sm)",cursor:"pointer",background:0===p?"var(--fill-secondary)":"transparent",transition:"background 100ms"},onMouseEnter:()=>u(0),children:[(0,a.jsx)("div",{style:{width:32,height:32,borderRadius:8,background:"var(--fill-tertiary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,color:"var(--text-tertiary)",flexShrink:0},children:"—"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontSize:"var(--text-footnote)",fontWeight:"var(--weight-medium)",color:"var(--text-secondary)"},children:"Unassigned"}),(0,a.jsx)("div",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)"},children:"No employee assigned"})]}),""===n&&(0,a.jsx)("span",{style:{marginLeft:"auto",color:"var(--accent)",fontSize:13,flexShrink:0},children:"✓"})]}),h.map((e,t)=>{let r=m?t+1:t,i=p===r,s=n===e.name;return(0,a.jsxs)("div",{"data-employee-option":!0,role:"option","aria-selected":s,onClick:()=>{o(e.name),l(!1)},onMouseEnter:()=>u(r),style:{display:"flex",alignItems:"center",gap:"var(--space-2)",padding:"8px 10px",borderRadius:"var(--radius-sm)",cursor:"pointer",background:i?"var(--fill-secondary)":"transparent",transition:"background 100ms"},children:[(0,a.jsx)("div",{style:{width:32,height:32,borderRadius:8,background:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,color:"#fff",fontWeight:600,flexShrink:0},children:e.displayName.charAt(0).toUpperCase()}),(0,a.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-1)"},children:[(0,a.jsx)("span",{style:{fontSize:"var(--text-footnote)",fontWeight:"var(--weight-semibold)",color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.displayName}),k[e.rank]&&(0,a.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",background:"var(--fill-secondary)",borderRadius:"var(--radius-sm)",padding:"0 4px",flexShrink:0},children:k[e.rank]})]}),(0,a.jsx)("div",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.department||e.name})]}),s&&(0,a.jsx)("span",{style:{color:"var(--accent)",fontSize:13,flexShrink:0},children:"✓"})]},e.name)}),0===h.length&&!m&&(0,a.jsxs)("div",{style:{padding:"var(--space-4)",textAlign:"center",fontSize:"var(--text-footnote)",color:"var(--text-tertiary)"},children:["No employees match “",d,"”"]})]})]})]})}let w=["low","medium","high"],S={low:"Low",medium:"Medium",high:"High"},z={title:"",description:"",priority:"medium",assigneeId:""};function C(e){let{open:t,onOpenChange:r,employees:o,onSubmit:s}=e,[l,d]=(0,i.useState)(z),c=(0,i.useCallback)(()=>{d(z)},[]);return(0,a.jsx)(v.lG,{open:t,onOpenChange:function(e){e||c(),r(e)},children:(0,a.jsxs)(v.Cf,{showCloseButton:!0,style:{background:"var(--bg)",border:"1px solid var(--separator)",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-card)",maxWidth:480},children:[(0,a.jsxs)(v.c7,{children:[(0,a.jsx)(v.L3,{style:{fontSize:"var(--text-title3)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)"},children:"Create Ticket"}),(0,a.jsx)(v.rr,{style:{fontSize:"var(--text-caption1)",color:"var(--text-tertiary)"},children:"Add a new ticket to the backlog."})]}),(0,a.jsxs)("form",{onSubmit:function(e){e.preventDefault(),l.title.trim()&&(s({title:l.title.trim(),description:l.description.trim(),priority:l.priority,assigneeId:l.assigneeId||null}),c(),r(!1))},style:{display:"flex",flexDirection:"column",gap:"var(--space-4)"},children:[(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-1)"},children:[(0,a.jsx)("label",{htmlFor:"ticket-title",style:{fontSize:"var(--text-caption1)",fontWeight:"var(--weight-medium)",color:"var(--text-secondary)"},children:"Title"}),(0,a.jsx)("input",{id:"ticket-title",type:"text",placeholder:"What needs to be done?",value:l.title,onChange:e=>d(t=>({...t,title:e.target.value})),required:!0,autoFocus:!0,style:{fontSize:"var(--text-body)",color:"var(--text-primary)",padding:"8px 12px",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",outline:"none",fontFamily:"inherit"}})]}),(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-1)"},children:[(0,a.jsx)("label",{htmlFor:"ticket-description",style:{fontSize:"var(--text-caption1)",fontWeight:"var(--weight-medium)",color:"var(--text-secondary)"},children:"Description"}),(0,a.jsx)("textarea",{id:"ticket-description",placeholder:"Add details...",rows:3,value:l.description,onChange:e=>d(t=>({...t,description:e.target.value})),style:{fontSize:"var(--text-body)",color:"var(--text-primary)",resize:"vertical",minHeight:72,padding:"8px 12px",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",background:"var(--fill-tertiary)",outline:"none",fontFamily:"inherit"}})]}),(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-2)"},children:[(0,a.jsx)("span",{style:{fontSize:"var(--text-caption1)",fontWeight:"var(--weight-medium)",color:"var(--text-secondary)"},children:"Priority"}),(0,a.jsx)("div",{style:{display:"flex",gap:"var(--space-2)"},children:w.map(e=>{let t=l.priority===e;return(0,a.jsxs)("button",{type:"button",onClick:()=>d(t=>({...t,priority:e})),style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"var(--space-1)",padding:"var(--space-2) var(--space-3)",borderRadius:"var(--radius-md)",border:t?"2px solid ".concat(f[e]):"2px solid var(--separator)",background:t?"var(--fill-tertiary)":"transparent",cursor:"pointer",fontSize:"var(--text-caption1)",fontWeight:"var(--weight-medium)",color:t?"var(--text-primary)":"var(--text-tertiary)",transition:"all 150ms var(--ease-smooth)"},children:[(0,a.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",background:f[e],flexShrink:0}}),S[e]]},e)})})]}),(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-1)"},children:[(0,a.jsx)("label",{style:{fontSize:"var(--text-caption1)",fontWeight:"var(--weight-medium)",color:"var(--text-secondary)"},children:"Assignee"}),(0,a.jsx)(j,{employees:o,value:l.assigneeId,onChange:e=>d(t=>({...t,assigneeId:e}))})]}),(0,a.jsxs)("button",{type:"submit",disabled:!l.title.trim(),style:{borderRadius:"var(--radius-md)",padding:"12px 20px",width:"100%",fontSize:"var(--text-body)",fontWeight:"var(--weight-semibold)",border:"none",display:"flex",alignItems:"center",justifyContent:"center",gap:"var(--space-2)",marginTop:"var(--space-2)",background:"var(--accent)",color:"#fff",cursor:l.title.trim()?"pointer":"default",opacity:l.title.trim()?1:.5,transition:"opacity 150ms ease"},children:[(0,a.jsx)(n,{size:16}),"Create Ticket"]})]})]})})}function D(e){let{priority:t}=e;return(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"var(--space-1)",fontSize:"var(--text-caption2)",fontWeight:600,color:f[t],textTransform:"uppercase",letterSpacing:"0.5px"},children:[(0,a.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:f[t]}}),t]})}function I(e){var t,r;let{status:i}=e,n=null!=(r=null==(t=x.find(e=>e.id===i))?void 0:t.title)?r:i;return(0,a.jsx)("span",{style:{fontSize:"var(--text-caption2)",fontWeight:600,color:"var(--text-secondary)",background:"var(--fill-tertiary)",padding:"2px var(--space-2)",borderRadius:"var(--radius-sm)",textTransform:"uppercase",letterSpacing:"0.3px"},children:n})}function A(e){var t,r;let{ticket:n,employees:o,onClose:s,onStatusChange:l,onAssigneeChange:d,onDelete:c}=e,p=(0,i.useRef)(null);(0,i.useEffect)(()=>{function e(e){"Escape"===e.key&&s()}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s]),(0,i.useEffect)(()=>{var e;null==(e=p.current)||e.focus()},[]);let u=null!=(t=o.find(e=>e.name===n.assigneeId))?t:null,v="var(--accent)";return(0,a.jsx)("div",{style:{position:"absolute",top:0,right:0,bottom:0,zIndex:30},children:(0,a.jsxs)("div",{style:{width:420,maxWidth:"100vw",height:"100%",background:"var(--material-regular)",boxShadow:"-4px 0 24px rgba(0,0,0,0.25)",display:"flex",flexDirection:"column"},children:[(0,a.jsx)("div",{style:{height:3,background:v,flexShrink:0}}),(0,a.jsxs)("div",{style:{flex:1,overflowY:"auto"},children:[(0,a.jsx)("div",{style:{padding:"var(--space-4) var(--space-5) 0",display:"flex",justifyContent:"flex-end",gap:"var(--space-2)"},children:(0,a.jsx)("button",{ref:p,onClick:s,"aria-label":"Close detail panel",style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--fill-secondary)",color:"var(--text-secondary)",border:"none",cursor:"pointer",fontSize:"var(--text-footnote)",transition:"all 150ms var(--ease-spring)"},children:"✕"})}),(0,a.jsxs)("div",{style:{padding:"var(--space-2) var(--space-5) var(--space-4)"},children:[(0,a.jsx)("h2",{style:{fontSize:"var(--text-title3)",fontWeight:700,letterSpacing:"-0.3px",color:"var(--text-primary)",margin:0,lineHeight:1.25},children:n.title}),(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-3)",marginTop:"var(--space-2)"},children:[(0,a.jsx)(I,{status:n.status}),(0,a.jsx)(D,{priority:n.priority})]}),u?(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",marginTop:"var(--space-3)",fontSize:"var(--text-footnote)",color:"var(--text-secondary)"},children:[(0,a.jsx)("span",{children:u.displayName}),(0,a.jsx)("span",{style:{fontSize:"var(--text-caption2)",color:"var(--text-tertiary)",background:"var(--fill-secondary)",borderRadius:"var(--radius-sm)",padding:"0 4px"},children:u.rank})]}):(0,a.jsx)("div",{style:{marginTop:"var(--space-3)",fontSize:"var(--text-footnote)",color:"var(--text-tertiary)",fontStyle:"italic"},children:"Unassigned"})]}),(0,a.jsxs)("div",{style:{padding:"0 var(--space-5) var(--space-4)"},children:[(0,a.jsx)("div",{style:{fontSize:"var(--text-caption1)",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"var(--space-2)"},children:"Move to"}),(0,a.jsx)("div",{style:{display:"flex",gap:"var(--space-1)",flexWrap:"wrap"},children:x.map(e=>{let t=e.id===n.status;return(0,a.jsx)("button",{onClick:()=>{t||l(e.id)},disabled:t,style:{fontSize:"var(--text-caption2)",fontWeight:600,padding:"3px var(--space-2)",borderRadius:"var(--radius-sm)",border:"none",cursor:t?"default":"pointer",background:t?v:"var(--fill-tertiary)",color:t?"#fff":"var(--text-secondary)",opacity:t?1:.8,transition:"all 120ms ease"},children:e.title},e.id)})})]}),(0,a.jsxs)("div",{style:{padding:"0 var(--space-5) var(--space-4)"},children:[(0,a.jsx)("div",{style:{fontSize:"var(--text-caption1)",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"var(--space-2)"},children:"Assignee"}),(0,a.jsx)(j,{employees:o,value:null!=(r=n.assigneeId)?r:"",onChange:e=>d(e||null)})]}),n.description&&(0,a.jsxs)("div",{style:{padding:"0 var(--space-5) var(--space-4)"},children:[(0,a.jsx)("div",{style:{height:1,background:"var(--separator)",marginBottom:"var(--space-3)"}}),(0,a.jsx)("div",{style:{fontSize:"var(--text-caption1)",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"var(--space-2)"},children:"Description"}),(0,a.jsx)("div",{style:{fontSize:"var(--text-footnote)",color:"var(--text-secondary)",lineHeight:1.5,whiteSpace:"pre-wrap"},children:n.description})]})]}),(0,a.jsx)("div",{style:{flexShrink:0,padding:"var(--space-2) var(--space-5) var(--space-4)",borderTop:"1px solid var(--separator)"},children:(0,a.jsx)("button",{onClick:function(){c()},style:{width:"100%",padding:"var(--space-2) var(--space-3)",borderRadius:"var(--radius-md)",border:"1px solid var(--system-red)",background:"transparent",color:"var(--system-red)",fontSize:"var(--text-footnote)",fontWeight:600,cursor:"pointer",transition:"all 120ms ease"},children:"Delete Ticket"})})]})})}function W(e){let{ticket:t,onConfirm:r,onCancel:i}=e;return(0,a.jsx)(v.lG,{open:!0,onOpenChange:e=>{e||i()},children:(0,a.jsxs)(v.Cf,{showCloseButton:!1,style:{background:"var(--bg)",border:"1px solid var(--separator)",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-card)",maxWidth:400},children:[(0,a.jsxs)(v.c7,{children:[(0,a.jsx)(v.L3,{style:{fontSize:"var(--text-title3)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)"},children:"Delete Ticket"}),(0,a.jsxs)(v.rr,{style:{fontSize:"var(--text-footnote)",color:"var(--text-secondary)",lineHeight:1.5},children:["Are you sure you want to delete “",t.title,"”? This cannot be undone."]})]}),(0,a.jsxs)(v.Es,{children:[(0,a.jsx)("button",{onClick:i,style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",border:"1px solid var(--separator)",background:"transparent",color:"var(--text-secondary)",fontSize:"var(--text-footnote)",fontWeight:600,cursor:"pointer"},children:"Cancel"}),(0,a.jsx)("button",{onClick:r,autoFocus:!0,style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",border:"none",background:"var(--system-red)",color:"#fff",fontSize:"var(--text-footnote)",fontWeight:600,cursor:"pointer"},children:"Delete"})]})]})})}function R(){let[e,t]=(0,i.useState)({}),[r,v]=(0,i.useState)([]),[x,f]=(0,i.useState)(!0),[g,h]=(0,i.useState)(null),[m,y]=(0,i.useState)(!1),[k,j]=(0,i.useState)(null),[w,S]=(0,i.useState)(null),[z,D]=(0,i.useState)([]),[I,R]=(0,i.useState)(null),E=(0,i.useCallback)(async e=>{let t={};for(let r of Object.values(e)){let e=r.department;e&&(t[e]||(t[e]=[]),t[e].push({id:r.id,title:r.title,description:r.description||void 0,status:r.status,priority:r.priority,assignee:r.assigneeId||void 0,createdAt:new Date(r.createdAt).toISOString(),updatedAt:new Date(r.updatedAt).toISOString()}))}let r=Array.from(new Set([...Object.keys(t),...z])).map(async e=>{try{await o.F.updateDepartmentBoard(e,t[e]||[])}catch(e){}});await Promise.all(r)},[z]),T=(0,i.useCallback)(()=>{f(!0),h(null),o.F.getOrg().then(async e=>{v(await Promise.all(e.employees.map(async e=>{try{return await o.F.getEmployee(e)}catch(t){return{name:e,displayName:e,department:"",rank:"employee",engine:"unknown",model:"unknown",persona:""}}}))),D(e.departments);let r={};for(let t of e.departments)try{let e=await o.F.getDepartmentBoard(t);if(Array.isArray(e))for(let a of e){let e={todo:"todo",in_progress:"in-progress","in-progress":"in-progress",done:"done",backlog:"backlog",review:"review"}[a.status]||"todo",i={low:"low",medium:"medium",high:"high"}[a.priority||"medium"]||"medium";r[a.id]={id:a.id,title:a.title,description:a.description||"",status:e,priority:i,assigneeId:a.assignee||null,department:t,workState:"idle",createdAt:a.createdAt?new Date(a.createdAt).getTime():Date.now(),updatedAt:a.updatedAt?new Date(a.updatedAt).getTime():Date.now()}}}catch(e){}t({...function(){try{let e=localStorage.getItem(s);if(!e)return{};let t=JSON.parse(e),r={};for(let e of Object.keys(t)){let a=function(e,t){if("string"!=typeof t.title||!t.title)return null;let r=l.has(t.status)?t.status:"backlog",a=d.has(t.priority)?t.priority:"medium",i=c.has(t.workState)?t.workState:"idle";return{id:e,title:t.title,description:"string"==typeof t.description?t.description:"",status:r,priority:a,assigneeId:"string"==typeof t.assigneeId?t.assigneeId:null,department:"string"==typeof t.department?t.department:null,workState:i,createdAt:"number"==typeof t.createdAt?t.createdAt:0,updatedAt:"number"==typeof t.updatedAt?t.updatedAt:"number"==typeof t.createdAt?t.createdAt:0}}(e,t[e]);a&&(("working"===a.workState||"starting"===a.workState)&&(a.status="todo",a.workState="idle"),r[e]=a)}return r}catch(e){return{}}}(),...r})}).catch(e=>h(e.message)).finally(()=>f(!1))},[]);function N(e,r){t(t=>{let a=p(t,e,{status:r});return E(a),a})}if((0,i.useEffect)(()=>{T()},[T]),(0,i.useEffect)(()=>{x||function(e){try{localStorage.setItem(s,JSON.stringify(e))}catch(e){}}(e)},[e,x]),(0,i.useEffect)(()=>{if(k&&e[k.id]){let t=e[k.id];t.updatedAt!==k.updatedAt&&j(t)}},[e,k]),g)return(0,a.jsx)(u.M,{children:(0,a.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:"var(--space-4)",color:"var(--text-tertiary)"},children:[(0,a.jsxs)("div",{style:{borderRadius:"var(--radius-md)",background:"color-mix(in srgb, var(--system-red) 10%, transparent)",border:"1px solid color-mix(in srgb, var(--system-red) 30%, transparent)",padding:"var(--space-3) var(--space-4)",fontSize:"var(--text-body)",color:"var(--system-red)"},children:["Failed to load employees: ",g]}),(0,a.jsx)("button",{onClick:T,style:{padding:"var(--space-2) var(--space-4)",borderRadius:"var(--radius-md)",background:"var(--accent)",color:"var(--accent-contrast)",border:"none",cursor:"pointer",fontSize:"var(--text-body)",fontWeight:"var(--weight-semibold)"},children:"Retry"})]})});let L=Object.keys(e).length,O=new Set(Object.values(e).map(e=>e.assigneeId).filter(Boolean)),M=r.filter(e=>O.has(e.name));return(0,a.jsx)(u.M,{children:(0,a.jsxs)("div",{className:"flex h-full relative",style:{background:"var(--bg)"},children:[(0,a.jsxs)("div",{className:"flex-1 h-full flex flex-col",style:{minWidth:0},children:[(0,a.jsxs)("div",{style:{padding:"var(--space-4) var(--space-5)",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,borderBottom:"1px solid var(--separator)"},children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{style:{fontSize:"var(--text-title2)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)",margin:0,letterSpacing:"-0.3px"},children:"Kanban Board"}),(0,a.jsxs)("p",{style:{fontSize:"var(--text-caption1)",color:"var(--text-tertiary)",margin:"2px 0 0"},children:[L," ticket",1!==L?"s":""]})]}),(0,a.jsxs)("button",{onClick:()=>y(!0),style:{borderRadius:"var(--radius-md)",padding:"8px 16px",fontSize:"var(--text-footnote)",fontWeight:"var(--weight-semibold)",border:"none",display:"flex",alignItems:"center",gap:"var(--space-2)",background:"var(--accent)",color:"#fff",cursor:"pointer"},children:[(0,a.jsx)(n,{size:16}),"New Ticket"]})]}),M.length>0&&(0,a.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"var(--space-2)",padding:"var(--space-2) var(--space-5)",overflowX:"auto",flexShrink:0},children:[(0,a.jsx)("button",{onClick:()=>S(null),style:{display:"flex",alignItems:"center",gap:"var(--space-1)",padding:"4px 12px",borderRadius:"var(--radius-full)",border:"none",fontSize:"var(--text-caption1)",fontWeight:600,cursor:"pointer",background:null===w?"var(--accent)":"var(--fill-tertiary)",color:null===w?"white":"var(--text-secondary)",flexShrink:0},children:"All"}),M.map(e=>(0,a.jsx)("button",{onClick:()=>S(w===e.name?null:e.name),style:{display:"flex",alignItems:"center",gap:"var(--space-1)",padding:"4px 12px",borderRadius:"var(--radius-full)",border:"none",fontSize:"var(--text-caption1)",fontWeight:600,cursor:"pointer",background:w===e.name?"var(--accent)":"var(--fill-tertiary)",color:w===e.name?"white":"var(--text-secondary)",flexShrink:0},children:e.displayName},e.name))]}),(0,a.jsx)("div",{style:{flex:1,padding:"0 var(--space-3)",minHeight:0},children:x?(0,a.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-tertiary)",fontSize:"var(--text-caption1)"},children:"Loading..."}):(0,a.jsx)(b,{tickets:e,employees:r,onTicketClick:function(e){j(e)},onMoveTicket:N,onCreateTicket:()=>y(!0),onDeleteTicket:e=>R(e),filterEmployeeId:w})})]}),k&&(0,a.jsx)("div",{className:"fixed inset-0 z-30 lg:hidden",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>j(null)}),k&&(0,a.jsx)(A,{ticket:k,employees:r,onClose:()=>j(null),onStatusChange:e=>N(k.id,e),onAssigneeChange:e=>(function(e,a){let i=a?r.find(e=>e.name===a):null,n={assigneeId:a};(null==i?void 0:i.department)&&(n.department=i.department),t(t=>{let r=p(t,e,n);return E(r),r})})(k.id,e),onDelete:()=>R(k)}),I&&(0,a.jsx)(W,{ticket:I,onConfirm:()=>{var e;return e=I.id,void(t(t=>{let r=function(e,t){let r={...e};return delete r[t],r}(t,e);return E(r),r}),j(null),R(null))},onCancel:()=>R(null)}),(0,a.jsx)(C,{open:m,onOpenChange:y,employees:r,onSubmit:function(e){let a=e.assigneeId?r.find(t=>t.name===e.assigneeId):null,i=(null==a?void 0:a.department)||z[0]||"platform";t(t=>{let r=function(e,t){let r=crypto.randomUUID(),a=Date.now();return{...e,[r]:{...t,id:r,workState:"idle",createdAt:a,updatedAt:a}}}(t,{...e,status:"backlog",department:i});return E(r),r})}})]})})}},1240:(e,t,r)=>{"use strict";r.d(t,{lG:()=>p,Cf:()=>x,rr:()=>m,Es:()=>g,c7:()=>f,L3:()=>h});var a=r(8111);r(5271);var i=r(1061),n=r(6573),o=r(1397),s=r(3916),l=r(1373);let d=(0,s.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--system-blue)]",{variants:{variant:{default:"bg-[var(--accent)] text-black font-semibold btn-scale hover:shadow-[0_0_24px_var(--accent-fill)]",destructive:"bg-[var(--system-red)] text-white btn-scale",outline:"border border-[var(--separator)] bg-transparent shadow-[var(--shadow-subtle)] hover:bg-[var(--fill-secondary)] hover:text-[var(--text-primary)]",secondary:"bg-[var(--accent-fill)] text-[var(--accent)] font-semibold btn-scale",ghost:"bg-transparent text-[var(--text-secondary)] hover:bg-[var(--fill-secondary)] hover:text-[var(--text-primary)]",link:"text-[var(--system-blue)] underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 text-sm has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 text-sm has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 text-base has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function c(e){let{className:t,variant:r="default",size:i="default",asChild:n=!1,...s}=e,c=n?l.bL:"button";return(0,a.jsx)(c,{"data-slot":"button","data-variant":r,"data-size":i,className:(0,o.cn)(d({variant:r,size:i,className:t})),...s})}function p(e){let{...t}=e;return(0,a.jsx)(n.bL,{"data-slot":"dialog",...t})}function u(e){let{...t}=e;return(0,a.jsx)(n.ZL,{"data-slot":"dialog-portal",...t})}function v(e){let{className:t,...r}=e;return(0,a.jsx)(n.hJ,{"data-slot":"dialog-overlay",className:(0,o.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...r})}function x(e){let{className:t,children:r,showCloseButton:s=!0,...l}=e;return(0,a.jsxs)(u,{"data-slot":"dialog-portal",children:[(0,a.jsx)(v,{}),(0,a.jsxs)(n.UC,{"data-slot":"dialog-content",className:(0,o.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",t),...l,children:[r,s&&(0,a.jsxs)(n.bm,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(i.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function f(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,o.cn)("flex flex-col gap-2 text-center sm:text-left",t),...r})}function g(e){let{className:t,showCloseButton:r=!1,children:i,...s}=e;return(0,a.jsxs)("div",{"data-slot":"dialog-footer",className:(0,o.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s,children:[i,r&&(0,a.jsx)(n.bm,{asChild:!0,children:(0,a.jsx)(c,{variant:"outline",children:"Close"})})]})}function h(e){let{className:t,...r}=e;return(0,a.jsx)(n.hE,{"data-slot":"dialog-title",className:(0,o.cn)("text-lg leading-none font-semibold",t),...r})}function m(e){let{className:t,...r}=e;return(0,a.jsx)(n.VY,{"data-slot":"dialog-description",className:(0,o.cn)("text-muted-foreground text-sm",t),...r})}},1397:(e,t,r)=>{"use strict";r.d(t,{cn:()=>n});var a=r(5242),i=r(3065);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,i.QP)((0,a.$)(t))}},7057:(e,t,r)=>{Promise.resolve().then(r.bind(r,543))}},e=>{e.O(0,[282,590,198,573,700,814,743,358],()=>e(e.s=7057)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{1298:(e,t,n)=>{"use strict";function o(e,t){let n="".concat("https:"===window.location.protocol?"wss:":"ws:","//").concat(window.location.host,"/ws"),o=null,r=null,a=!1;return!function l(){a||((o=new WebSocket(n)).onopen=()=>{var e;null==t||null==(e=t.onOpen)||e.call(t)},o.onmessage=t=>{try{let n=JSON.parse(t.data);e(n.event,n.payload)}catch(e){}},o.onclose=()=>{var e;null==t||null==(e=t.onClose)||e.call(t),a||(r=setTimeout(l,3e3))},o.onerror=()=>null==o?void 0:o.close())}(),{close:()=>{a=!0,r&&clearTimeout(r),null==o||o.close()}}}n.d(t,{E:()=>o})},2755:(e,t,n)=>{"use strict";n.d(t,{Qc:()=>m,Z6:()=>u,t0:()=>d});var o=n(8111),r=n(5271);let a={accentColor:null,portalName:null,portalSubtitle:null,portalEmoji:null,portalIcon:null,iconBgHidden:!1,emojiOnly:!1,operatorName:null,language:"English",employeeOverrides:{}},l="jinn-settings";function s(e){localStorage.setItem(l,JSON.stringify(e))}var c=n(3176);let i=(0,r.createContext)({settings:{accentColor:null,portalName:null,portalSubtitle:null,portalEmoji:null,portalIcon:null,iconBgHidden:!1,emojiOnly:!1,operatorName:null,language:"English",employeeOverrides:{}},setAccentColor:()=>{},setPortalName:()=>{},setPortalSubtitle:()=>{},setPortalEmoji:()=>{},setPortalIcon:()=>{},setIconBgHidden:()=>{},setEmojiOnly:()=>{},setOperatorName:()=>{},setLanguage:()=>{},setEmployeeOverride:()=>{},clearEmployeeOverride:()=>{},getEmployeeDisplay:e=>({emoji:e.emoji}),resetAll:()=>{}});function u(e){let{children:t}=e,[n,u]=(0,r.useState)({...a});(0,r.useEffect)(()=>{let e=function(){try{let e=localStorage.getItem(l);if(!e)return{...a};let t=JSON.parse(e);return{...a,...t}}catch(e){return{...a}}}();u(e),c.F.getOnboarding().then(t=>{if(t.portalName||t.operatorName){let n={...e,...t.portalName&&{portalName:t.portalName},...t.operatorName&&{operatorName:t.operatorName}};u(n),s(n)}}).catch(()=>{})},[]),(0,r.useEffect)(()=>{let e=document.documentElement.style;n.accentColor?(e.setProperty("--accent",n.accentColor),e.setProperty("--accent-fill",function(e){let t=parseInt(e.slice(1,3),16),n=parseInt(e.slice(3,5),16),o=parseInt(e.slice(5,7),16);return"rgba(".concat(t,",").concat(n,",").concat(o,",0.15)")}(n.accentColor)),e.setProperty("--accent-contrast",function(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,o=parseInt(e.slice(5,7),16)/255,r=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return .2126*r(t)+.7152*r(n)+.0722*r(o)>.4?"#000":"#fff"}(n.accentColor))):(e.removeProperty("--accent"),e.removeProperty("--accent-fill"),e.removeProperty("--accent-contrast"))},[n.accentColor]);let d=(0,r.useCallback)(e=>{u(t=>{let n=e(t);return s(n),n})},[]),m=(0,r.useCallback)(e=>{d(t=>({...t,accentColor:e}))},[d]),p=(0,r.useCallback)(e=>{d(t=>({...t,portalName:e||null}))},[d]),g=(0,r.useCallback)(e=>{d(t=>({...t,portalSubtitle:e||null}))},[d]),f=(0,r.useCallback)(e=>{d(t=>({...t,portalEmoji:e||null}))},[d]),h=(0,r.useCallback)(e=>{d(t=>({...t,portalIcon:e}))},[d]),y=(0,r.useCallback)(e=>{d(t=>({...t,iconBgHidden:e}))},[d]),b=(0,r.useCallback)(e=>{d(t=>({...t,emojiOnly:e}))},[d]),C=(0,r.useCallback)(e=>{d(t=>({...t,operatorName:e||null}))},[d]),S=(0,r.useCallback)(e=>{d(t=>({...t,language:e||"English"}))},[d]),w=(0,r.useCallback)((e,t)=>{d(n=>{let o=n.employeeOverrides[e]||{};return{...n,employeeOverrides:{...n.employeeOverrides,[e]:{...o,...t}}}})},[d]),v=(0,r.useCallback)(e=>{d(t=>{let{[e]:n,...o}=t.employeeOverrides;return{...t,employeeOverrides:o}})},[d]),E=(0,r.useCallback)(e=>{let t=n.employeeOverrides[e.id];return{emoji:(null==t?void 0:t.emoji)||e.emoji,profileImage:null==t?void 0:t.profileImage,emojiOnly:n.emojiOnly}},[n.employeeOverrides,n.emojiOnly]),k=(0,r.useCallback)(()=>{d(()=>({accentColor:null,portalName:null,portalSubtitle:null,portalEmoji:null,portalIcon:null,iconBgHidden:!1,emojiOnly:!1,operatorName:null,language:"English",employeeOverrides:{}}))},[d]);return(0,o.jsx)(i.Provider,{value:{settings:n,setAccentColor:m,setPortalName:p,setPortalSubtitle:g,setPortalEmoji:f,setPortalIcon:h,setIconBgHidden:y,setEmojiOnly:b,setOperatorName:C,setLanguage:S,setEmployeeOverride:w,clearEmployeeOverride:v,getEmployeeDisplay:E,resetAll:k},children:t})}let d=()=>(0,r.useContext)(i);function m(){let{settings:e}=d(),t=(0,r.useRef)(e.portalName);return t.current=e.portalName,(0,r.useEffect)(()=>{function e(){let e=t.current||"Jinn",n="".concat(e," - AI Gateway");document.title!==n&&(document.title=n)}e();let n=document.querySelector("title");if(!n)return;let o=new MutationObserver(()=>e());return o.observe(n,{childList:!0,characterData:!0,subtree:!0}),()=>o.disconnect()},[e.portalName]),null}},3176:(e,t,n)=>{"use strict";n.d(t,{F:()=>i});let o=window.location.origin;async function r(e){try{let t=await e.json();if(t.error)return String(t.error);if(t.message)return String(t.message)}catch(e){}return"API error: ".concat(e.status)}async function a(e){let t=await fetch("".concat(o).concat(e));if(!t.ok)throw Error(await r(t));return t.json()}async function l(e,t){let n=await fetch("".concat(o).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:t?JSON.stringify(t):void 0});if(!n.ok)throw Error(await r(n));return n.json()}async function s(e){let t=await fetch("".concat(o).concat(e),{method:"DELETE"});if(!t.ok)throw Error(await r(t));return t.json()}async function c(e,t){let n=await fetch("".concat(o).concat(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(await r(n));return n.json()}let i={getStatus:()=>a("/api/status"),getSessions:()=>a("/api/sessions"),getSession:e=>a("/api/sessions/".concat(e)),getSessionChildren:e=>a("/api/sessions/".concat(e,"/children")),deleteSession:e=>s("/api/sessions/".concat(e)),bulkDeleteSessions:e=>l("/api/sessions/bulk-delete",{ids:e}),createSession:e=>l("/api/sessions",e),createStubSession:e=>l("/api/sessions/stub",e),sendMessage:(e,t)=>l("/api/sessions/".concat(e,"/message"),t),getCronJobs:()=>a("/api/cron"),getCronRuns:e=>a("/api/cron/".concat(e,"/runs")),updateCronJob:(e,t)=>c("/api/cron/".concat(e),t),triggerCronJob:e=>l("/api/cron/".concat(e,"/trigger"),{}),getOrg:()=>a("/api/org"),getEmployee:e=>a("/api/org/employees/".concat(e)),getDepartmentBoard:e=>a("/api/org/departments/".concat(e,"/board")),getSkills:()=>a("/api/skills"),getSkill:e=>a("/api/skills/".concat(e)),getConfig:()=>a("/api/config"),updateConfig:e=>c("/api/config",e),getLogs:e=>a("/api/logs".concat(e?"?n=".concat(e):"")),getOnboarding:()=>a("/api/onboarding"),completeOnboarding:e=>l("/api/onboarding",e),getActivity:()=>a("/api/activity"),updateDepartmentBoard:(e,t)=>c("/api/org/departments/".concat(e,"/board"),t),sttStatus:()=>a("/api/stt/status"),sttDownload:()=>l("/api/stt/download",{}),sttTranscribe:async(e,t)=>{let n=t?"?language=".concat(encodeURIComponent(t)):"",r=new AbortController,a=setTimeout(()=>r.abort(),3e5);try{let t=await fetch("".concat(o,"/api/stt/transcribe").concat(n),{method:"POST",headers:{"Content-Type":e.type||"audio/webm"},body:e,signal:r.signal});if(!t.ok)throw Error("API error: ".concat(t.status));return t.json()}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw Error("Transcription timed out (5 min)");throw e}finally{clearTimeout(a)}},sttUpdateConfig:e=>c("/api/stt/config",{languages:e})}},3841:(e,t,n)=>{"use strict";n.d(t,{E$:()=>s,V2:()=>l,uW:()=>a});var o=n(5271);let r="jinn-notif-prompted";function a(){"Notification"in window&&"default"===Notification.permission&&(localStorage.getItem(r)||setTimeout(()=>{"default"===Notification.permission&&(Notification.requestPermission(),localStorage.setItem(r,"1"))},1e4))}let l=(0,o.createContext)({notifications:[],unreadCount:0,toasts:[],pushFromEvent:()=>{},dismissToast:()=>{},markAllRead:()=>{},markRead:()=>{},clearAll:()=>{}});function s(){return(0,o.useContext)(l)}},4965:(e,t,n)=>{"use strict";n.d(t,{ClientProviders:()=>g});var o=n(8111),r=n(7460),a=n(2755),l=n(5271),s=n(1298);let c="jinn-notifications";function i(e){try{localStorage.setItem(c,JSON.stringify(e.slice(0,50)))}catch(e){}}let u=0,d=new Set(["session:completed","cron:completed","cron:reloaded"]);var m=n(3841);function p(e){let{children:t}=e,[n,r]=(0,l.useState)([]),[a,p]=(0,l.useState)([]),g=(0,l.useRef)(new Map),f=(0,l.useRef)(!1);(0,l.useEffect)(()=>{r(function(){try{let e=localStorage.getItem(c);if(!e)return[];return JSON.parse(e).slice(0,50)}catch(e){return[]}}()),(0,m.uW)()},[]),(0,l.useEffect)(()=>{f.current?i(n):n.length>0&&(f.current=!0)},[n]);let h=(0,l.useCallback)(e=>{p(t=>t.filter(t=>t.id!==e));let t=g.current.get(e);t&&(clearTimeout(t),g.current.delete(e))},[]),y=(0,l.useCallback)((e,t)=>{var n,o;let a=function(e,t){switch(e){case"session:completed":{let e=t.employee||"Session",n=t.error;if(n)return{type:"error",title:"".concat(e," — Error"),message:n.slice(0,120)};return{type:"success",title:"".concat(e," — Done"),message:"Session completed successfully"}}case"cron:triggered":return{type:"info",title:"Cron Triggered",message:t.name||t.jobId||"Job"};case"cron:reloaded":return{type:"info",title:"Cron Reloaded",message:"Scheduled jobs reloaded"};case"cron:completed":{let e=t.name||t.job||"Job",n=t.error;if(n)return{type:"error",title:"Cron Failed: ".concat(e),message:n.slice(0,120)};return{type:"success",title:"Cron Done: ".concat(e),message:"Scheduled job completed successfully"}}case"slack:message":{let e=t.channel||"",n=t.user||t.userName||"Someone",o=t.text||"";return{type:"info",title:"Slack".concat(e?": ".concat(e):""),message:"".concat(n,": ").concat(o).slice(0,120)}}case"session:started":{let e=t.sessionId||"",n=t.employee||"";return{type:"info",title:"Session Started",message:n?"".concat(n," (").concat(e.slice(0,8),")"):e.slice(0,8)}}default:return null}}(e,t);if(!a)return;let l={...a,id:"n_".concat(Date.now(),"_").concat(++u),timestamp:Date.now(),read:!1};r(e=>[l,...e].slice(0,50)),f.current=!0,p(e=>[...e,l]);let s=setTimeout(()=>{p(e=>e.filter(e=>e.id!==l.id)),g.current.delete(l.id)},5e3);g.current.set(l.id,s),d.has(e)&&(n=l.title,o=l.message,"Notification"in window&&"granted"===Notification.permission&&document.hidden&&new Notification(n,{body:o,icon:"/favicon.ico",tag:"jinn-".concat(Date.now())}))},[]),b=(0,l.useRef)(y);b.current=y,(0,l.useEffect)(()=>{let e=(0,s.E)((e,t)=>{b.current(e,t)});return()=>e.close()},[]);let C=(0,l.useCallback)(()=>{r(e=>{let t=e.map(e=>e.read?e:{...e,read:!0});return i(t),t})},[]),S=(0,l.useCallback)(e=>{r(t=>{let n=t.map(t=>t.id===e?{...t,read:!0}:t);return i(n),n})},[]),w=(0,l.useCallback)(()=>{r([]),i([])},[]),v=n.filter(e=>!e.read).length;return(0,o.jsx)(m.V2.Provider,{value:{notifications:n,unreadCount:v,toasts:a,pushFromEvent:y,dismissToast:h,markAllRead:C,markRead:S,clearAll:w},children:t})}function g(e){let{children:t}=e;return(0,o.jsx)(r.N,{children:(0,o.jsx)(a.Z6,{children:(0,o.jsxs)(p,{children:[t,(0,o.jsx)(a.Qc,{})]})})})}},7460:(e,t,n)=>{"use strict";n.d(t,{D:()=>s,N:()=>l});var o=n(8111),r=n(5271);let a=(0,r.createContext)({theme:"dark",setTheme:()=>{}});function l(e){let{children:t}=e,[n,l]=(0,r.useState)("dark"),s=(0,r.useCallback)(e=>{l(e),localStorage.setItem("jinn-theme",e);let t=document.documentElement;if(t.removeAttribute("data-theme"),"system"===e){let e=window.matchMedia("(prefers-color-scheme: dark)").matches;t.setAttribute("data-theme",e?"dark":"light")}else t.setAttribute("data-theme",e)},[]);return(0,r.useEffect)(()=>{let e=localStorage.getItem("jinn-theme");e&&s(e)},[s]),(0,r.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)");function t(){"system"===localStorage.getItem("jinn-theme")&&document.documentElement.setAttribute("data-theme",e.matches?"dark":"light")}return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,o.jsx)(a.Provider,{value:{theme:n,setTheme:s},children:t})}function s(){return(0,r.useContext)(a)}},9469:()=>{},9760:(e,t,n)=>{Promise.resolve().then(n.bind(n,4965)),Promise.resolve().then(n.t.bind(n,9469,23))}},e=>{e.O(0,[506,814,743,358],()=>e(e.s=9760)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[524],{2469:(e,a,r)=>{Promise.resolve().then(r.bind(r,3929))},2876:(e,a,r)=>{"use strict";r.d(a,{A:()=>t});let t=(0,r(1983).A)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},3929:(e,a,r)=>{"use strict";r.r(a),r.d(a,{default:()=>v});var t=r(8111),s=r(5271);let l=(0,r(1983).A)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var i=r(2876),n=r(3176),o=r(8700),c=r(5310);function d(e){let{label:a,value:r,color:s,pulse:l}=e;return(0,t.jsxs)("div",{style:{background:"var(--material-regular)",border:"1px solid var(--separator)",borderRadius:"var(--radius-md)",padding:"var(--space-4)"},children:[(0,t.jsx)("div",{style:{fontSize:"var(--text-caption1)",color:"var(--text-tertiary)",fontWeight:"var(--weight-medium)",marginBottom:"var(--space-1)"},children:a}),(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"var(--space-2)"},children:[l&&r>0&&(0,t.jsx)("span",{className:"animate-error-pulse",style:{width:8,height:8,borderRadius:"50%",background:"var(--system-red)",flexShrink:0}}),(0,t.jsx)("span",{style:{fontSize:"var(--text-title2)",fontWeight:"var(--weight-bold)",color:null!=s?s:"var(--text-primary)"},children:r})]})]})}function v(){let[e,a]=(0,s.useState)([]),[r,v]=(0,s.useState)(!0),[p,h]=(0,s.useState)(!1),[u,m]=(0,s.useState)(null),[g,x]=(0,s.useState)(new Date),[f,y]=(0,s.useState)("just now"),b=(0,s.useCallback)(()=>{h(!0),m(null),n.F.getLogs(500).then(e=>{var r;a(null!=(r=e.lines)?r:[]),x(new Date)}).catch(e=>{m(e instanceof Error?e.message:"Failed to load logs")}).finally(()=>{v(!1),h(!1)})},[]);(0,s.useEffect)(()=>{b();let e=setInterval(b,3e4);return()=>clearInterval(e)},[b]),(0,s.useEffect)(()=>{function e(){let e=Math.floor((Date.now()-g.getTime())/1e3);e<10?y("just now"):e<60?y("".concat(e,"s ago")):y("".concat(Math.floor(e/60),"m ago"))}e();let a=setInterval(e,1e4);return()=>clearInterval(a)},[g]);let j=e.map(c.w),k=j.length,w=j.filter(e=>"error"===e.level).length,S=j.filter(e=>"info"===e.level).length,N=j.filter(e=>"warn"===e.level).length;return(0,t.jsx)(o.M,{children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden animate-fade-in",style:{background:"var(--bg)"},children:[(0,t.jsx)("header",{className:"sticky top-0 z-10 flex-shrink-0",style:{background:"var(--material-regular)",backdropFilter:"blur(40px) saturate(180%)",WebkitBackdropFilter:"blur(40px) saturate(180%)",borderBottom:"1px solid var(--separator)"},children:(0,t.jsxs)("div",{className:"flex items-center justify-between",style:{padding:"var(--space-4) var(--space-6)"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{style:{fontSize:"var(--text-title1)",fontWeight:"var(--weight-bold)",color:"var(--text-primary)",letterSpacing:"-0.5px",lineHeight:"var(--leading-tight)"},children:"Activity Console"}),!r&&(0,t.jsxs)("p",{style:{fontSize:"var(--text-footnote)",color:"var(--text-secondary)",marginTop:"var(--space-1)"},children:[k," event",1!==k?"s":"",w>0&&(0,t.jsxs)("span",{style:{color:"var(--system-red)"},children:[" \xb7 ",w," error",1!==w?"s":""]})]})]}),(0,t.jsxs)("div",{className:"flex items-center",style:{gap:"var(--space-3)"},children:[(0,t.jsxs)("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-live-stream")),className:"focus-ring flex items-center",style:{padding:"6px 14px",borderRadius:"var(--radius-sm)",border:"none",cursor:"pointer",fontSize:"var(--text-footnote)",fontWeight:"var(--weight-semibold)",gap:6,background:"var(--accent-fill)",color:"var(--accent)",transition:"all 200ms var(--ease-smooth)"},children:[(0,t.jsx)(l,{size:14}),"Open Live Stream"]}),(0,t.jsxs)("span",{style:{fontSize:"var(--text-caption1)",color:"var(--text-tertiary)"},children:["Updated ",f]}),(0,t.jsx)("button",{onClick:b,className:"focus-ring","aria-label":"Refresh logs",style:{width:32,height:32,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--radius-sm)",border:"none",background:"transparent",color:"var(--text-tertiary)",cursor:"pointer",transition:"color 150ms var(--ease-smooth)"},children:(0,t.jsx)(i.A,{size:16,className:p?"animate-spin":""})})]})]})}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto flex flex-col",style:{padding:"var(--space-4) var(--space-6) var(--space-6)",minHeight:0},children:[u&&(0,t.jsxs)("div",{style:{marginBottom:"var(--space-3)",padding:"var(--space-3) var(--space-4)",borderRadius:"var(--radius-md)",background:"rgba(255,69,58,0.06)",border:"1px solid rgba(255,69,58,0.15)",fontSize:"var(--text-footnote)",color:"var(--system-red)"},children:["Failed to load logs: ",u]}),r?(0,t.jsx)("div",{className:"flex items-center justify-center",style:{height:200,color:"var(--text-tertiary)"},children:"Loading..."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"summary-cards-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"var(--space-3)",marginBottom:"var(--space-4)"},children:[(0,t.jsx)(d,{label:"Total Events",value:k}),(0,t.jsx)(d,{label:"Errors",value:w,color:w>0?"var(--system-red)":"var(--system-green)",pulse:!0}),(0,t.jsx)(d,{label:"Info",value:S,color:"var(--system-green)"}),(0,t.jsx)(d,{label:"Warnings",value:N,color:"var(--system-orange)"})]}),(0,t.jsx)(c.b,{lines:e})]})]}),(0,t.jsx)("style",{children:"\n @media (max-width: 640px) {\n .summary-cards-grid {\n grid-template-columns: 1fr 1fr !important;\n }\n }\n "})]})})}}},e=>{e.O(0,[282,700,814,743,358],()=>e(e.s=2469)),_N_E=e.O()}]);
|