cli-jaw 2.17.36 → 2.17.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/bin/commands/doctor.js +7 -3
  2. package/dist/bin/commands/doctor.js.map +1 -1
  3. package/dist/lib/mcp/skills-utils.js +4 -0
  4. package/dist/lib/mcp/skills-utils.js.map +1 -1
  5. package/dist/src/agent/alert-escalation.js +8 -2
  6. package/dist/src/agent/alert-escalation.js.map +1 -1
  7. package/dist/src/agent/codex-app-events.js +28 -0
  8. package/dist/src/agent/codex-app-events.js.map +1 -1
  9. package/dist/src/agent/error-classifier.js +40 -3
  10. package/dist/src/agent/error-classifier.js.map +1 -1
  11. package/dist/src/agent/error-cooldown.js +43 -0
  12. package/dist/src/agent/error-cooldown.js.map +1 -0
  13. package/dist/src/agent/lifecycle-handler.js +49 -7
  14. package/dist/src/agent/lifecycle-handler.js.map +1 -1
  15. package/dist/src/agent/spawn.js +32 -2
  16. package/dist/src/agent/spawn.js.map +1 -1
  17. package/dist/src/cli/handlers/session-handlers.js +9 -0
  18. package/dist/src/cli/handlers/session-handlers.js.map +1 -1
  19. package/dist/src/core/bus.js +6 -1
  20. package/dist/src/core/bus.js.map +1 -1
  21. package/dist/src/core/session-ops.js +36 -0
  22. package/dist/src/core/session-ops.js.map +1 -1
  23. package/dist/src/discord/forwarder.js +12 -4
  24. package/dist/src/discord/forwarder.js.map +1 -1
  25. package/dist/src/memory/heartbeat.js +7 -1
  26. package/dist/src/memory/heartbeat.js.map +1 -1
  27. package/dist/src/memory/injection.js +7 -1
  28. package/dist/src/memory/injection.js.map +1 -1
  29. package/dist/src/messaging/error-block.js +54 -0
  30. package/dist/src/messaging/error-block.js.map +1 -0
  31. package/dist/src/messaging/send.js +55 -4
  32. package/dist/src/messaging/send.js.map +1 -1
  33. package/dist/src/messaging/session-key.js +8 -1
  34. package/dist/src/messaging/session-key.js.map +1 -1
  35. package/dist/src/messaging/slack-target.js +17 -0
  36. package/dist/src/messaging/slack-target.js.map +1 -1
  37. package/dist/src/messaging/types.js +6 -0
  38. package/dist/src/messaging/types.js.map +1 -1
  39. package/dist/src/orchestrator/attestation.js +64 -1
  40. package/dist/src/orchestrator/attestation.js.map +1 -1
  41. package/dist/src/slack/bot.js +13 -4
  42. package/dist/src/slack/bot.js.map +1 -1
  43. package/dist/src/slack/context.js +25 -2
  44. package/dist/src/slack/context.js.map +1 -1
  45. package/dist/src/slack/forwarder.js +23 -5
  46. package/dist/src/slack/forwarder.js.map +1 -1
  47. package/dist/src/slack/history.js +27 -2
  48. package/dist/src/slack/history.js.map +1 -1
  49. package/dist/src/slack/mention-watch.js +4 -0
  50. package/dist/src/slack/mention-watch.js.map +1 -1
  51. package/dist/src/slack/send-handler.js +27 -2
  52. package/dist/src/slack/send-handler.js.map +1 -1
  53. package/dist/src/wiki/prompt.js +23 -1
  54. package/dist/src/wiki/prompt.js.map +1 -1
  55. package/package.json +2 -2
  56. package/public/dist/assets/{app-BvRV-aEt.js → app-CXraFyoA.js} +4 -4
  57. package/public/dist/assets/bgtask-badge-BjyAbBio.js +1 -0
  58. package/public/dist/assets/{bgtask-badge-FiEB3FJm.js → bgtask-badge-Cu1w7rg2.js} +1 -1
  59. package/public/dist/assets/{employees-86F_D_Ce.js → employees-qLLnQlAv.js} +1 -1
  60. package/public/dist/assets/iframe-renderer-BLP8Army.js +1 -0
  61. package/public/dist/assets/{iframe-renderer-eozJpgjk.js → iframe-renderer-vuNrU6aI.js} +2 -2
  62. package/public/dist/assets/memory-CRji7xpO.js +1 -0
  63. package/public/dist/assets/{memory-DX7U3WV_.js → memory-I_6c8skr.js} +1 -1
  64. package/public/dist/assets/message-history-C1ThtA4i.js +1 -0
  65. package/public/dist/assets/{message-history-B_fIGorC.js → message-history-CXg12lcd.js} +1 -1
  66. package/public/dist/assets/render-Cc0Y43E3.js +157 -0
  67. package/public/dist/assets/settings-B2Ix6Y7k.js +1 -0
  68. package/public/dist/assets/{settings-CH6exiZf.js → settings-DpjZSu2J.js} +1 -1
  69. package/public/dist/assets/settings-core-Bkb0BoYY.js +1 -0
  70. package/public/dist/assets/{settings-core-DqKyyxbQ.js → settings-core-DWYQIIoe.js} +1 -1
  71. package/public/dist/assets/{sidebar-qyLy9Og8.js → sidebar-C8WKweCz.js} +3 -3
  72. package/public/dist/assets/{skills-DAhOtbfP.js → skills-QWf6vRIB.js} +1 -1
  73. package/public/dist/assets/skills-bEGqvmiQ.js +1 -0
  74. package/public/dist/assets/slash-commands-BbA0Y1up.js +1 -0
  75. package/public/dist/assets/{slash-commands-BYH6YVS4.js → slash-commands-qD6yScsx.js} +1 -1
  76. package/public/dist/assets/{trace-drawer-nyAJ3Bm_.js → trace-drawer-Ct8sP4j-.js} +1 -1
  77. package/public/dist/assets/ui-BZxyyJUk.js +1 -0
  78. package/public/dist/assets/{ui-C62w6bJS.js → ui-xoW9x-Pz.js} +1 -1
  79. package/public/dist/assets/vendor-icons-Begb5v1n.js +1 -0
  80. package/public/dist/index.html +1 -1
  81. package/public/js/icon-mappings.ts +1 -0
  82. package/public/js/icons.ts +2 -0
  83. package/public/js/ws.ts +4 -0
  84. package/public/dist/assets/bgtask-badge-DLqpImpn.js +0 -1
  85. package/public/dist/assets/iframe-renderer-C_swzquc.js +0 -1
  86. package/public/dist/assets/memory-DfPbqPTD.js +0 -1
  87. package/public/dist/assets/message-history-BhSsLjis.js +0 -1
  88. package/public/dist/assets/render-fKAuISeM.js +0 -157
  89. package/public/dist/assets/settings-BNqSR9Zr.js +0 -1
  90. package/public/dist/assets/settings-core-x7CmBZq1.js +0 -1
  91. package/public/dist/assets/skills-C7Yi3LIq.js +0 -1
  92. package/public/dist/assets/slash-commands-DEbJk3sj.js +0 -1
  93. package/public/dist/assets/ui-CBErZPBp.js +0 -1
  94. package/public/dist/assets/vendor-icons-eoCVgkBn.js +0 -1
@@ -0,0 +1,157 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-render-kIxHrxDV.css"])))=>i.map(i=>d[i]);
2
+ import{A as e,L as t,R as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as ee,l as d,m as f,o as te,p as ne,s as re,u as ie,v as ae,x as p,y as oe}from"./vendor-render-BpGO1zp3.js";import{a as se,i as ce,n as le,t as m}from"./api-tVoG39dL.js";import{t as h}from"./preload-helper-DFYRRz9w.js";import{a as ue,i as de,n as fe,o as pe,r as me,t as he}from"./mermaid-preprocess-4oGDpf1X.js";import{$ as ge,$t as _e,A as ve,At as ye,B as be,Bt as xe,C as Se,Cn as Ce,Ct as we,D as Te,Dt as Ee,E as De,En as Oe,Et as ke,F as Ae,Ft as je,G as Me,Gt as Ne,H as Pe,Ht as Fe,I as Ie,It as Le,J as Re,Jt as ze,K as Be,Kt as Ve,L as He,Lt as Ue,M as We,Mt as Ge,N as Ke,Nt as qe,O as Je,Ot as Ye,P as Xe,Pt as Ze,Q as Qe,Qt as $e,R as et,Rt as tt,S as nt,Sn as rt,St as it,T as at,Tn as ot,Tt as st,U as ct,Ut as lt,V as ut,Vt as dt,W as ft,Wt as pt,X as mt,Xt as ht,Y as gt,Yt as _t,Z as vt,Zt as yt,_ as bt,_n as xt,_t as St,a as Ct,an as wt,at as Tt,b as Et,bn as Dt,bt as Ot,c as kt,cn as At,ct as jt,d as Mt,dn as Nt,dt as Pt,en as Ft,et as It,f as Lt,fn as Rt,ft as zt,g as Bt,gn as Vt,gt as Ht,h as Ut,hn as Wt,ht as Gt,i as Kt,in as qt,it as Jt,j as Yt,jt as Xt,k as Zt,kt as Qt,l as $t,ln as en,lt as tn,m as nn,mn as rn,mt as an,n as on,nn as sn,nt as cn,o as ln,on as un,ot as dn,p as fn,pn,pt as mn,q as hn,qt as gn,r as _n,rn as vn,rt as yn,s as bn,sn as xn,st as Sn,t as Cn,tn as wn,tt as Tn,u as En,un as Dn,ut as On,v as kn,vn as An,vt as jn,w as Mn,wn as Nn,wt as Pn,x as Fn,xn as In,xt as Ln,y as Rn,yn as zn,yt as Bn,z as Vn,zt as Hn}from"./vendor-icons-Begb5v1n.js";var Un=[`en`,`ko`,`zh`,`ja`],g=`ko`,Wn={},_={};async function Gn(){let e=null;try{e=localStorage.getItem(`claw_locale`)}catch{}if(!e){let t=(navigator.language||`ko`).split(/[-_]/)[0].toLowerCase();e=Un.includes(t)?t:`ko`}_=await Kn(`ko`),Wn=e===`ko`?_:await Kn(e),g=e,document.documentElement.lang=g,qn()}async function Kn(e){try{let{api:t}=await h(async()=>{let{api:e}=await import(`./api-DNnX8m0u.js`);return{api:e}},[]);return await t(`/api/i18n/${e}`)||{}}catch{return{}}}function v(e,t={}){let n=Wn[e]??_[e]??e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,String(r));return n}function qn(){document.querySelectorAll(`[data-i18n]`).forEach(e=>{let t=e.getAttribute(`data-i18n`);t&&(e.textContent=v(t))}),document.querySelectorAll(`[data-i18n-placeholder]`).forEach(e=>{let t=e.getAttribute(`data-i18n-placeholder`);t&&(e.placeholder=v(t))}),document.querySelectorAll(`[data-i18n-title]`).forEach(e=>{let t=e.getAttribute(`data-i18n-title`);t&&(e.title=v(t))}),document.querySelectorAll(`[data-i18n-aria]`).forEach(e=>{let t=e.getAttribute(`data-i18n-aria`);t&&e.setAttribute(`aria-label`,v(t))})}async function Jn(e){if(e!==g){Un.includes(e)||(e=`ko`),Wn=e===`ko`?_:await Kn(e),g=e,document.documentElement.lang=g;try{localStorage.setItem(`claw_locale`,e)}catch{}qn();try{let{loadEmployees:e}=await h(async()=>{let{loadEmployees:e}=await import(`./employees-qLLnQlAv.js`);return{loadEmployees:e}},__vite__mapDeps([0]));e()}catch{}try{let{loadSkills:e}=await h(async()=>{let{loadSkills:e}=await import(`./skills-bEGqvmiQ.js`);return{loadSkills:e}},[]);e()}catch{}try{let{loadCommands:e}=await h(async()=>{let{loadCommands:e}=await import(`./slash-commands-BbA0Y1up.js`);return{loadCommands:e}},[]);e()}catch{}try{let{loadSettings:e}=await h(async()=>{let{loadSettings:e}=await import(`./settings-B2Ix6Y7k.js`);return{loadSettings:e}},[]);e()}catch{}}}function Yn(){return g}function Xn(e,t={}){let n=new URL(e,location.origin);return n.searchParams.has(`locale`)||n.searchParams.set(`locale`,g),fetch(n.toString(),t)}function Zn(e){let t=[],n=e.replace(/```[\s\S]*?```/g,e=>(t.push(e),`\x00P${t.length-1}\x00`)).replace(/`[^`]+`/g,e=>(t.push(e),`\x00P${t.length-1}\x00`));return n=n.replace(/([\p{P}])\*\*(?=[^\s\p{P}])/gu,(e,t)=>t===`*`?e:t+`​**`),n=n.replace(/\x00P(\d+)\x00/g,(e,n)=>t[Number(n)]),n}var Qn=0;function $n(e){let t=new Map;return{text:e.replace(/^ {0,3}(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n {0,3}\1[ \t]*$/gm,e=>{let n=`\x00FENCE-${Qn++}\x00`;return t.set(n,e),n}),fences:t}}function er(e,t){for(let[n,r]of t)e=e.replace(n,()=>r);return e}function tr(e,t=!1){let n=[],r=``,i=0;for(;i<e.length;){let a=e.indexOf(`<svg`,i);if(a===-1){r+=e.slice(i);break}let o=e[a+4];if(o&&!/[\s\/>]/.test(o)){r+=e.slice(i,a+4),i=a+4;continue}r+=e.slice(i,a);let s=0,c=a,l=!1;for(;c<e.length;){let t=e.indexOf(`<svg`,c+1),o=e.indexOf(`</svg>`,c+(c===a?0:1));if(o===-1)break;if(t!==-1&&t<o){let n=e[t+4];n&&/[\s\/>]/.test(n)&&s++,c=t+4}else if(s===0){let t=o+6,s=e.slice(a,t),c=Qn++,u=`\n\n<div data-jaw-svg="${c}"></div>\n\n`;n.push({id:c,index:a,length:s.length,svg:s,kind:`complete`,placeholder:u}),r+=u,i=t,l=!0;break}else s--,c=o+6}if(!l){let o=Qn++;if(t){let t=e.slice(a),s=`\n\n<div data-jaw-svg="${o}" data-jaw-kind="partial"></div>\n\n`;n.push({id:o,index:a,length:t.length,svg:``,kind:`partial`,placeholder:s}),r+=s,i=e.length}else{let t=`\n\n<div data-jaw-svg="${o}" data-jaw-kind="error"></div>\n\n`,s=e.slice(a),c=s.search(/\n\s*\n/),l=c===-1?s.length:c;n.push({id:o,index:a,length:l,svg:``,kind:`error`,placeholder:t}),r+=t,i=a+l}}}return{text:r,blocks:n}}function y(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var nr=/["'](?:subtasks|employee_config|agent_phases|orchestration_plan)["']\s*:/,rr=/(^|\n)(?:## Approved Plan \((?:authoritative|auto-injected by orchestrator)[^\n]*\)|\[PABCD — [A-Z]:[^\n]*\]|\[PLANNING MODE[^\n]*\]|\[PLAN AUDIT[^\n]*\]|The approved plan is already injected above)/m;function ir(e){let t=rr.exec(e);return!t||t.index<0?e:e.slice(0,t.index).trim()}function ar(e){let t=e.replace(/```json\n([\s\S]*?)\n```/g,(e,t)=>nr.test(t)?``:e);return t=t.replace(/\{[^{}]*"subtasks"\s*:\s*\[[\s\S]*?\]\s*\}/g,``).trim(),ir(t)}function or(e){let t=[],n=[],r=e.replace(/```[\s\S]*?```/g,e=>(n.push(e),`\x00C${n.length-1}\x00`)).replace(/`[^`]+`/g,e=>(n.push(e),`\x00C${n.length-1}\x00`));return r=r.replace(/\$\$([\s\S]+?)\$\$/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!0}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\\\[([\s\S]+?)\\\]/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!0}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/(?<!\$)\$(?!\$)([^\n$]+?)\$(?!\$)/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!1}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\\\((.+?)\\\)/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!1}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\x00C(\d+)\x00/g,(e,t)=>n[Number(t)]),{text:r,blocks:t}}function sr(t,n,r=!1){return t.replace(/\x00MATH-(\d+)\x00/g,(t,i)=>{let a=n[Number(i)];if(!a)return`<code title="math placeholder error">[math error]</code>`;if(r)return a.displayMode?`<div class="math-placeholder">${y(a.tex)}</div>`:`<code class="math-placeholder">${y(a.tex)}</code>`;try{return e.renderToString(a.tex,{displayMode:a.displayMode,throwOnError:!1})}catch{return a.displayMode?`<pre><code>${y(a.tex)}</code></pre>`:`<code>${y(a.tex)}</code>`}})}var cr={"✅":`check`,"❌":`error`,"❔":`unknown`,"🔧":`tool`,"⏭":`skip`,"🧠":`brain`,"💓":`heartPulse`,"🔒":`lock`,"🔓":`lockOpen`,"🔑":`key`,"⚙":`settings`,"⚙️":`settings`,"📄":`file`,"🗑":`trash`,"🗑️":`trash`,"⚠":`warning`,"⚠️":`warning`,"💡":`lightbulb`,"🦈":`shark`,"👤":`user`,"💭":`thinking`,"💬":`message`,"🔍":`search`,"🌐":`web`,"⚡":`exec`,"💻":`terminal`,"🗜":`compacting`,"🗜️":`compacting`,"📝":`plan`,"📑":`clipboard`,"🤖":`robot`,"📋":`clipboard`,"🔄":`refresh`,"🎨":`palette`,"🎤":`mic`,"🔗":`link`,"🫡":`salute`,"📎":`paperclip`,"💾":`save`,"🎮":`gamepad`,"🏠":`house`,"📡":`radio`,"📂":`folder`,"✏️":`pencil`,"📊":`chart`,"🎙️":`mic`,"⏳":`hourglass`,"⏹️":`stop`,"🎯":`target`,"📨":`send`,"🚫":`ban`,"▶":`play`,"🔐":`permission`,"📖":`read`},lr={"🧪":`test`,"🏗️":`architecture`,"🍎":`apple`,"🔴":`statusDot`,"🎬":`video`,"🐍":`code`,"🐛":`bug`,"📐":`drafting`,"📚":`library`,"📦":`package`,"🔬":`research`,"🖼️":`image`,"🗃️":`database`,"▲":`triangle`,"🇰🇷":`korea`,"✍️":`pen`,"🎥":`video`,"🐘":`database`,"🐦":`message`,"👥":`people`,"📏":`ruler`,"📱":`mobile`,"🔀":`branch`,"🔎":`searchCheck`,"🔥":`flame`,"🖥️":`monitor`,"🗺️":`map`,"🧵":`thread`,"🚀":`deploy`,"🛡️":`shield`,"☁️":`cloud`,"☕":`coffee`,"♾️":`infinity`,"♿":`accessibility`,"⚓":`anchor`,"⚛️":`atom`,"✉️":`mail`,"🌊":`waves`,"🌍":`web`,"🌤️":`weather`,"🌲":`tree`,"🍃":`leaf`,"🎭":`theatre`,"🎵":`music`,"🏋️":`fitness`,"🏛️":`institution`,"🏢":`company`,"🏭":`factory`,"🐙":`git`,"🐪":`camel`,"🐳":`container`,"🐹":`golang`,"👁️":`eye`,"💎":`gem`,"💚":`heart`,"💰":`money`,"💼":`briefcase`,"📆":`calendar`,"📍":`mapPin`,"📓":`notebook`,"📘":`read`,"📢":`megaphone`,"📧":`mail`,"📩":`inbox`,"📰":`newspaper`,"📲":`mobile`,"📸":`camera`,"📽️":`presentation`,"🔁":`repeat`,"🔊":`volume`,"🔌":`plug`,"🔔":`bell`,"🔤":`language`,"🔷":`code`,"🔺":`triangle`,"🕷️":`crawler`,"🗄️":`database`,"🗣️":`voice`,"🤗":`hug`,"🤝":`handshake`,"🦀":`rust`,"🦋":`flutter`,"🦠":`quality`,"🧙":`wizard`,"🧩":`puzzle`,"🧭":`compass`,"🧱":`brick`,"🧹":`cleanup`,"🚚":`truck`,"🚨":`siren`,"🛂":`compliance`,"🛃":`compliance`,"🟣":`code`},ur={...cr,...lr},dr=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12c0 0 2-4 6-4 1 0 2 .5 3 1l3-6c0 0 1 5 3 7 1.5 1.5 5 2 5 2s-1 4-5 4c-1 0-2-.3-3-.8L12 18c0 0-2-1-4-1-4 0-6-5-6-5z"/><circle cx="17" cy="11" r="0.5" fill="currentColor" stroke="none"/><path d="M7 12l1 2"/><path d="M9.5 12l1 2"/></svg>`,b=14,fr=16;function x(e,t=fr){return Oe(e,{size:t})}var S={check:x(_e),error:x(ht),warning:x(Mt),skip:x(Et),tool:x(_n),thinking:x(It),search:x(Je),web:x(st),exec:x(Cn),compacting:x(Be),plan:x(Re),message:x(Tn),unknown:x($e),read:x(rn),terminal:x(nn),test:x(ye),architecture:x(lt),build:x(At),apple:x(Ce),statusDot:x(_t),video:x(bn),bug:x(xn),ruler:x(We),drafting:x(Ue),library:x(On),package:x(Be),research:x(Qe),image:x(St),archive:x(rt),database:x(xe),deploy:x(Xe),shield:x(Se),shieldAlert:x(at),permission:x(Mn),cloud:x(gn),code:x(Ve),coffee:x(Ne),infinity:x(Gt),accessibility:x(ot),anchor:x(Nn),atom:x(zn),mail:x(Tt),waves:x(Kt),map:x(yn),weather:x(Bt),tree:x(Lt),leaf:x(Pt),theatre:x(qe),music:x(mt),fitness:x(Le),institution:x(mn),company:x(At),factory:x(je),git:x(ke),camel:x(Ve),container:x(Fe),golang:x(Ge),eye:x(ve),gem:x(Ee),heart:x(Ot),money:x(Hn),briefcase:x(Dn),calendar:x(un),mapPin:x(Jt),notebook:x(hn),megaphone:x(cn),mailIn:x(Tt),inbox:x(Ht),newspaper:x(gt),mobile:x(Rn),camera:x(wt),presentation:x(Vn),repeat:x(Ae),volume:x(ln),plug:x(be),bell:x(Vt),language:x(zt),triangle:x(En),crawler:x(xn),voice:x(kn),hug:x(Pn),handshake:x(it),rust:x(Ve),flutter:x(Kt),quality:x(An),wizard:x(Ct),puzzle:x(et),compass:x(pt),brick:x(Nt),cleanup:x(en),truck:x($t),siren:x(Fn),compliance:x(An),korea:x(zt),people:x(kt),branch:x(ke),searchCheck:x(Zt),flame:x(Xt),monitor:x(vt),route:x(Ke),thread:x(ke),bike:x(Wt),ship:x(nt),pen:x(ct),brain:x(Rt),heartPulse:x(Ln),lock:x(dn),lockOpen:x(Sn),key:x(an),settings:x(De),file:x(Ze),trash:x(fn),lightbulb:x(tn),refresh:x(Ie),mic:x(ge),clipboard:x(ze),robot:x(pn),palette:x(Me),link:x(jt),salute:x(we),shark:dr,user:x(yt),paperclip:x(ft),save:x(Yt),gamepad:x(Ye),house:x(jn),radio:x(He),folder:x(Qt),pencil:x(Pe),chart:x(qt),hourglass:x(Bn),target:x(Ut),ban:x(xt),play:x(ut),stop:x(bt),close:x(on,b),send:x(Te),copy:x(dt,b),download:x(tt,b),checkSimple:x(vn,b),chevronLeft:x(wn,b),chevronRight:x(Ft,b),chevronDown:x(sn,b),arrowLeft:x(In,b),arrowRight:x(Dt,b)};function pr(e){return Object.prototype.hasOwnProperty.call(S,e)}function mr(e,t=`tool`){let n=(e||``).trim();if(!n)return S[t];if(n.startsWith(`<svg`))return n;if(pr(n))return S[n];let r=ur[n];return r?S[r]:S[t]}function hr(e){return e===`✅`?`done`:e===`❌`?`error`:null}function gr(e=document.body){let t=e.querySelectorAll(`[data-icon]`);for(let e of t){let t=e.dataset.icon;t&&S[t]&&(e.innerHTML=S[t],e.classList.add(`icon-hydrated`))}}function _r(e){return e instanceof Error?e.message:String(e)}function vr(){return window.cliJawDesktop?.clipboard??null}async function yr(e){try{let t=vr();if(t){let n=await t.writeText(e);return n.ok?{ok:!0}:{ok:!1,error:n.error??`Clipboard bridge rejected the copy request.`}}return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),{ok:!0}):{ok:!1,error:`Clipboard API is unavailable.`}}catch(e){return{ok:!1,error:_r(e)}}}function br(e){if(/\bwidth\s*=/i.test(e.slice(0,e.indexOf(`>`))))return e;let t=e.match(/viewBox=["']?\s*([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/);if(!t)return e;let n=Math.round(parseFloat(t[3])),r=Math.round(parseFloat(t[4]));return!n||!r?e:e.replace(/^<svg/,`<svg width="${n}" height="${r}"`)}function xr(e){e.querySelector(`.mermaid-zoom-btn`)?.remove(),e.querySelector(`.mermaid-copy-btn`)?.remove(),e.querySelector(`.mermaid-save-btn`)?.remove();let t=document.createElement(`button`);t.className=`mermaid-zoom-btn`,t.type=`button`,t.ariaLabel=`Expand diagram`,t.title=`Expand`,t.textContent=`⤢`,e.appendChild(t);let n=document.createElement(`button`);n.className=`mermaid-save-btn`,n.type=`button`,n.ariaLabel=`Save as image`,n.title=`Save`,n.innerHTML=S.download,e.appendChild(n);let r=document.createElement(`button`);r.className=`mermaid-copy-btn`,r.type=`button`,r.ariaLabel=`Copy source`,r.title=`Copy`,r.innerHTML=S.copy,e.appendChild(r)}var Sr=!1;function Cr(){Sr||(Sr=!0,document.addEventListener(`click`,e=>{let t=e.target,n=t?.closest(`.diagram-copy-btn`);if(n){let e=n.closest(`.diagram-container`);if(!e)return;let t=``;if(e.dataset.widgetHtml)try{t=decodeURIComponent(escape(atob(e.dataset.widgetHtml)))}catch{return}else{let n=e.querySelector(`svg`);n&&(t=n.outerHTML)}t&&C(n,t,`copy`);return}let r=t?.closest(`.mermaid-copy-btn`);if(r){let e=r.closest(`.mermaid-container`);if(!e)return;let t=e.dataset.mermaidCode||``;t&&C(r,t,`copy`);return}let i=t?.closest(`.diagram-save-btn`);if(i){let e=i.closest(`.diagram-container`);if(!e)return;if(e.dataset.widgetHtml){let t=e.querySelector(`iframe`);t?.contentWindow&&(t.contentWindow.postMessage({type:`jaw-request-screenshot`},`*`),C(i,``,`save`));return}let t=e.querySelector(`svg`);t&&Tr(t,i);return}let a=t?.closest(`.mermaid-save-btn`);if(a){let e=a.closest(`.mermaid-container`);if(!e)return;let t=e.querySelector(`svg`);t&&Tr(t,a);return}}))}function C(e,t,n){let r=()=>{let t=e.innerHTML;e.innerHTML=S.checkSimple,e.classList.add(`copied`),setTimeout(()=>{e.innerHTML=t,e.classList.remove(`copied`)},1500)};n===`copy`?yr(t).then(e=>{e.ok&&r()}):r()}function wr(e,t){let n=e.children,r=t.children,i=[`fill`,`stroke`,`stroke-width`,`color`,`opacity`,`rx`,`ry`,`font-size`,`font-weight`,`font-family`,`text-anchor`,`dominant-baseline`];for(let e=0;e<n.length;e++){let t=n[e],a=r[e];if(!t||!a)continue;let o=getComputedStyle(t);for(let e of i){let t=o.getPropertyValue(e);t&&a.style.setProperty(e,t)}t.children.length&&wr(t,a)}}function Tr(e,t){let n=e.cloneNode(!0);wr(e,n);let r=e.getBoundingClientRect();n.getAttribute(`width`)||n.setAttribute(`width`,String(r.width)),n.getAttribute(`height`)||n.setAttribute(`height`,String(r.height));let i=new XMLSerializer().serializeToString(n),a=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(i),o=new Image;o.onload=()=>{let e=document.createElement(`canvas`);e.width=o.naturalWidth*2,e.height=o.naturalHeight*2;let n=e.getContext(`2d`);n.scale(2,2),n.drawImage(o,0,0),e.toBlob(e=>{e&&(Er(e,`diagram-${Date.now()}.png`),C(t,``,`save`))},`image/png`)},o.onerror=()=>{Er(new Blob([i],{type:`image/svg+xml;charset=utf-8`}),`diagram-${Date.now()}.svg`),C(t,``,`save`)},o.src=a}function Er(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function Dr(e){if(e.kind===`partial`)return`<div class="diagram-container diagram-loading" role="status"
3
+ aria-label="Diagram loading"><div class="diagram-spinner"></div></div>`;if(e.kind===`error`)return`<div class="diagram-container diagram-error" role="alert">
4
+ Malformed SVG: unclosed element</div>`;let t=ue(e.svg);return t=br(t),`<div class="diagram-container diagram-svg" tabindex="0"
5
+ role="figure" aria-label="SVG diagram">
6
+ ${t}
7
+ <button class="diagram-save-btn" type="button"
8
+ aria-label="Save as image" title="Save">${S.download}</button>
9
+ <button class="diagram-copy-btn" type="button"
10
+ aria-label="Copy source" title="Copy">${S.copy}</button>
11
+ <button class="diagram-zoom-btn" type="button"
12
+ aria-label="Expand diagram" title="Expand">⤢</button>
13
+ </div>`}function Or(e,t){for(let n of t){let t=`<div\\b[^>]*?\\bdata-jaw-svg="${n.id}"[^>]*></div>`,r=new RegExp(t,`g`),i=Dr(n);e=e.replace(r,()=>i)}return e}function kr(e){(e||document).querySelectorAll(`.diagram-zoom-btn, .mermaid-zoom-btn`).forEach(e=>{e.dataset.bound||(e.dataset.bound=`1`,e.addEventListener(`click`,()=>{if(e.closest(`.diagram-widget`))return;let t=e.closest(`.diagram-container`),n=e.closest(`.mermaid-container`),r=t||n;if(!r)return;let i=r.cloneNode(!0);i.querySelectorAll(`.diagram-zoom-btn, .mermaid-zoom-btn, .diagram-copy-btn, .diagram-save-btn, .mermaid-copy-btn, .mermaid-save-btn`).forEach(e=>e.remove());let a=n&&!t?`mermaid`:`inline-svg`;Ar(i.innerHTML,a)}))})}function Ar(e,t=`inline-svg`){let n=document.activeElement,r=document.createElement(`div`);r.className=`diagram-overlay`,r.setAttribute(`role`,`dialog`),r.setAttribute(`aria-modal`,`true`),r.setAttribute(`aria-label`,`Expanded diagram`);let i=ue(e);r.innerHTML=[`<div class="`,t===`inline-svg`?`diagram-overlay-content diagram-svg-overlay`:`diagram-overlay-content`,`">`,i,`</div>`,`<button class="diagram-overlay-close" type="button" aria-label="Close">✕</button>`].join(``),r.querySelectorAll(`.diagram-overlay-content svg`).forEach(e=>{if(!e.getAttribute(`viewBox`)){let t=e.getAttribute(`width`)||e.getBBox?.()?.width,n=e.getAttribute(`height`)||e.getBBox?.()?.height;t&&n&&e.setAttribute(`viewBox`,`0 0 `+parseFloat(String(t))+` `+parseFloat(String(n)))}e.removeAttribute(`width`),e.removeAttribute(`height`)});let a=r.querySelector(`.diagram-overlay-close`),o=()=>{r.remove(),document.removeEventListener(`keydown`,s),n&&n.isConnected&&n.focus()},s=e=>{if(e.key===`Escape`){o();return}if(e.key===`Tab`){let t=r.querySelectorAll(`button, [href], [tabindex]:not([tabindex="-1"])`);if(t.length===0)return;let n=t[0],i=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),n.focus())}};a.addEventListener(`click`,o),document.addEventListener(`keydown`,s),document.body.appendChild(r),a.focus()}var jr=!1;function Mr(){jr||(jr=!0,p.registerLanguage(`javascript`,a),p.registerLanguage(`js`,a),p.registerLanguage(`typescript`,oe),p.registerLanguage(`ts`,oe),p.registerLanguage(`python`,ae),p.registerLanguage(`py`,ae),p.registerLanguage(`bash`,r),p.registerLanguage(`shell`,l),p.registerLanguage(`sh`,l),p.registerLanguage(`json`,u),p.registerLanguage(`css`,f),p.registerLanguage(`xml`,ne),p.registerLanguage(`html`,ne),p.registerLanguage(`markdown`,c),p.registerLanguage(`md`,c),p.registerLanguage(`yaml`,s),p.registerLanguage(`yml`,s),p.registerLanguage(`sql`,ie),p.registerLanguage(`rust`,d),p.registerLanguage(`rs`,d),p.registerLanguage(`go`,o),p.registerLanguage(`java`,re),p.registerLanguage(`cpp`,te),p.registerLanguage(`c`,te),p.registerLanguage(`diff`,i),p.registerLanguage(`plaintext`,ee),p.registerLanguage(`text`,ee))}function Nr(e,t){if(Mr(),t&&p.getLanguage(t))try{return p.highlight(e,{language:t}).value}catch{return y(e)}try{return p.highlightAuto(e).value}catch{return y(e)}}function Pr(e){Mr(),(e||document).querySelectorAll(`.code-block pre code, .code-block-wrapper pre code`).forEach(e=>{if(e.dataset.highlighted===`yes`)return;let t=[...e.classList].find(e=>e.startsWith(`language-`))?.replace(`language-`,``),n=e.textContent||``;try{t&&p.getLanguage(t)?e.innerHTML=p.highlight(n,{language:t}).value:e.innerHTML=p.highlightAuto(n).value,e.dataset.highlighted=`yes`}catch{}})}var w=null,T=Promise.resolve();async function Fr(){return w||=(await h(()=>import(`./mermaid-loader-BcReSszT.js`),__vite__mapDeps([0]))).loadMermaid(),w}function E(){w.initialize(me())}var Ir=0;async function Lr(){let e=document.querySelectorAll(`.mermaid-rendered`);e.length&&(T=T.then(async()=>{let t=await Fr();for(let n of e){let e=n,r=e.dataset.mermaidCode;if(!r||!e.isConnected)continue;let i=he(r),a=`mermaid-${++Ir}`;try{E();let n;try{({svg:n}=await t.render(a,i))}catch{let e=fe(i);if(!e)continue;E(),{svg:n}=await t.render(`${a}-retry`,e)}if(!e.isConnected)continue;e.innerHTML=pe(n);let r=e.closest(`.mermaid-container`);r&&r.classList.toggle(`mermaid-type-wide`,de(i)),xr(e),kr(e)}catch{}}}).catch(e=>{console.error(`[mermaid:queue] rerender failed, keeping queue alive:`,e)}),await T)}var D=null;function Rr(){D||=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target;e.classList.contains(`mermaid-pending`)&&(D.unobserve(e),Vr(e))}},{rootMargin:`200px`})}function zr(e,t,n){e.classList.remove(`mermaid-rendered`),e.innerHTML=`
14
+ <div class="mermaid-error">
15
+ <div class="mermaid-error-title">${S.warning} ${y(v(`mermaid.renderFail`)||`Mermaid render failed`)}</div>
16
+ <div class="mermaid-error-msg">${y(n.slice(0,200))}</div>
17
+ <pre class="mermaid-error-code"><code>${y(t)}</code></pre>
18
+ </div>`}async function Br(e){if(!e.isConnected){delete e.dataset.mermaidQueued,delete e.dataset.mermaidInflight;return}e.classList.remove(`mermaid-pending`);let t=e.dataset.mermaidCodeRaw||``,n=he(t?decodeURIComponent(t):e.textContent||``);e.dataset.mermaidCode=n;let r=`mermaid-${++Ir}`;e.dataset.mermaidInflight=`1`;try{let t=await Fr();E();let i;try{({svg:i}=await t.render(r,n))}catch(e){let a=fe(n);if(!a)throw e;E(),{svg:i}=await t.render(`${r}-retry`,a)}if(!e.isConnected)return;e.innerHTML=pe(i),e.classList.add(`mermaid-rendered`);let a=e.closest(`.mermaid-container`);a&&a.classList.toggle(`mermaid-type-wide`,de(n)),delete e.dataset.mermaidCodeRaw,xr(e),kr(e)}catch(t){zr(e,n,t?.message||t?.str||`Unknown error`)}finally{delete e.dataset.mermaidQueued,delete e.dataset.mermaidInflight}}function Vr(e){e.dataset.mermaidQueued!==`1`&&(e.dataset.mermaidQueued=`1`,T=T.then(()=>Br(e)).catch(e=>{console.error(`[mermaid:queue] render failed, keeping queue alive:`,e)}))}async function Hr(e,t={}){let n=(e||document).querySelectorAll(`.mermaid-pending`);if(n.length){Rr();for(let e of n)if(e.dataset.mermaidQueued!==`1`){if(t.immediate){let t=e.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight;if(t.bottom>=-200&&t.top<=n+200){D.unobserve(e),Vr(e);continue}}D.observe(e)}}}function Ur(e){if(!D)return;let t=[`.mermaid-pending`,`[data-mermaid-queued="1"]`,`[data-mermaid-inflight="1"]`].join(`,`),n=[];e.matches(t)&&n.push(e),e.querySelectorAll(t).forEach(e=>n.push(e));for(let e of n)D.unobserve(e),delete e.dataset.mermaidQueued,delete e.dataset.mermaidQueuedAt,delete e.dataset.mermaidInflight,!e.classList.contains(`mermaid-rendered`)&&(e.dataset.mermaidCodeRaw||e.dataset.mermaidCode)&&e.classList.add(`mermaid-pending`)}function Wr(){if(w)return;let e=()=>{Fr().catch(()=>{})};typeof window.requestIdleCallback==`function`?window.requestIdleCallback(e,{timeout:2e3}):setTimeout(e,500)}function O(e){if(e===window.location.origin)return!0;try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`||t===`[::1]`}catch{return!1}}function k(){if(window.parent===window)return null;try{let e=window.parent.location.origin;if(e&&e!==`null`&&O(e))return e}catch{}if(Jr)return Jr;try{if(document.referrer){let e=new URL(document.referrer).origin;if(O(e))return e}}catch{}return null}var A=!1,Gr=!1,Kr=!1,qr=!1,Jr=null,j=new Set;function Yr(){return A}function Xr(e){O(e)&&(Jr=e)}function Zr(e){for(let t of j)t(e);j.clear()}function Qr(){let e=k()||`*`;try{return window.parent.postMessage({type:`jaw-preview-capabilities-request`},e),!0}catch{return!1}}function $r(){Kr||(Kr=!0,window.addEventListener(`message`,e=>{if(e.source!==window.parent||!O(e.origin))return;let t=e.data;!t||t.type!==`jaw-preview-capabilities`||(Xr(e.origin),A=t.docPanel===!0,Gr=!0,Zr(A))}),Qr())}function ei(e=180){return $r(),A||Gr?Promise.resolve(A):Qr()?new Promise(t=>{let n=!1,r=e=>{n||(n=!0,j.delete(r),window.clearTimeout(i),t(e))},i=window.setTimeout(()=>r(A),e);j.add(r)}):Promise.resolve(!1)}function ti(e){return e instanceof HTMLInputElement?[`text`,`search`,`url`,`tel`,`email`,`password`].includes(e.type):!1}function ni(e){if(!e)return null;if(e instanceof HTMLTextAreaElement||ti(e))return e;let t=e.closest(`[contenteditable="true"]`);return t instanceof HTMLElement?t:null}function ri(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?!e.disabled&&!e.readOnly:e.isContentEditable}function ii(e){if(!ri(e))return!1;if(e===document.activeElement)return!0;let t=window.getComputedStyle(e);if(t.display===`none`||t.visibility===`hidden`||t.visibility===`collapse`)return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0}function ai(){let e=ni(document.activeElement);if(e&&ii(e))return e;let t=[`#chatInput`,`textarea.chat-input`,`textarea[data-chat-input="true"]`,`textarea[aria-label*="chat" i]`,`textarea[placeholder*="message" i]`,`textarea[placeholder*="메시지" i]`,`textarea[placeholder*="입력" i]`,`textarea`,`input[type="text"]`,`input[type="search"]`,`input:not([type])`,`[contenteditable="true"]`],n=new Set;for(let e of t)for(let t of document.querySelectorAll(e)){if(n.has(t))continue;n.add(t);let e=ni(t);if(e&&ii(e))return e}return null}function oi(e,t){if(e instanceof HTMLTextAreaElement||ti(e)){if(!ri(e))return!1;let n=document.activeElement===e,r=n?e.selectionStart??e.value.length:e.value.length,i=n?e.selectionEnd??r:r;return e.setRangeText(t,r,i,`end`),e.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:t})),e.focus(),!0}let n=e.closest(`[contenteditable="true"]`);if(!(n instanceof HTMLElement)||!ri(n))return!1;let r=window.getSelection(),i=null;if(r&&r.rangeCount>0){let e=r.getRangeAt(0);n.contains(e.commonAncestorContainer)&&(i=e)}i||(i=document.createRange(),i.selectNodeContents(n),i.collapse(!1)),i.deleteContents();let a=document.createTextNode(t);return i.insertNode(a),i.setStartAfter(a),i.setEndAfter(a),r?.removeAllRanges(),r?.addRange(i),n.dispatchEvent(new InputEvent(`input`,{bubbles:!0,inputType:`insertText`,data:t})),n.focus(),!0}function si(){qr||(qr=!0,window.addEventListener(`message`,e=>{if(!O(e.origin))return;let t=e.data;if(!t||t.type!==`jaw-preview-insert-text`)return;Xr(e.origin);let n=typeof t.requestId==`string`?t.requestId:``,r=typeof t.text==`string`?t.text:``,i=(t,r)=>{n&&window.parent.postMessage({type:`jaw-preview-insert-text-result`,requestId:n,ok:t,...r?{error:r}:{}},e.origin)};if(!n||!r){i(!1,`invalid insert request`);return}let a=ai();if(!a||!oi(a,r)){i(!1,`no editable target`);return}i(!0)}))}function ci(e){let t=k();return!t||!e.trim()?!1:(window.parent.postMessage({type:`jaw-preview-open-notes`,path:e},t),!0)}function li(e){let t=k();return!t||!e.trim()?!1:(window.parent.postMessage({type:`jaw-preview-open-doc`,path:e},t),!0)}function ui(e,t){let n=k();return!n||e.length===0?!1:(window.parent.postMessage({type:`dashboard.invalidate`,topics:e,reason:t},n),!0)}var di=new Set([`.git`,`.assets`,`_templates`,`_snippets`,`_plugins`]),fi=`.md`;function M(e){return e.replace(/\\/g,`/`).trim()}function pi(e){let t=e.split(`/`)[0]??``;return di.has(t)}function mi(e){return!(!e||e.startsWith(`/`)||e.includes(`..`)||!e.endsWith(fi)||pi(e))}function hi(e,t){let n=M(e),r=M(t).replace(/\/+$/,``);if(!r||n===r)return null;let i=`${r}/`;if(!n.startsWith(i))return null;let a=n.slice(i.length);return mi(a)?a:null}function gi(e){let t=M(e),n=t.match(/^(\/Users\/[^/]+)/);if(n)return n[1];let r=t.match(/^(\/home\/[^/]+)/);return r?r[1]:null}function _i(e,t){if(!e.startsWith(`~/`))return e;let n=gi(t);return n?`${n}/${e.slice(2)}`:e}function vi(e,t){let n=M(e);return n?t&&!n.startsWith(`~/`)&&mi(n)?n:t&&hi(_i(n,t),t)||null:null}var yi=/(?:~\/[^\s)`\]"'<>]+|\/(?:Users|home|tmp|var|opt|private)\/[^\s)`\]"'<>]+)/g,bi=/(?:^|[\s([{"'`])([A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*\.md)\b/g,xi=/[.,!?:;]+$/,Si=/^(?:~\/|\/(?:Users|home|tmp|var|opt|private)\/)/,Ci=/\.(ts|tsx|js|jsx|py|rs|go|java|cpp|c|css|html|htm|xml|json|yaml|yml|sh|bash|sql)$/i,wi=/\.(md|mdx)$/i,N,Ti=null;function Ei(e){return Si.test(e)}function Di(e){if(Ei(e))return e;try{let t=new URL(e,window.location.href);if(t.origin!==window.location.origin||t.pathname!==`/api/file/open`)return null;let n=t.searchParams.get(`path`)??``;return Ei(n)?n:null}catch{return null}}function Oi(e){try{let t=new URL(e,window.location.href);return t.protocol!==`http:`&&t.protocol!==`https:`||t.username||t.password?!1:t.origin!==window.location.origin}catch{return!1}}function ki(e){e.target=`_blank`;let t=new Set(e.rel.split(/\s+/).filter(Boolean));t.add(`noopener`),t.add(`noreferrer`),e.rel=[...t].join(` `)}async function Ai(){return N===void 0?k()?(Ti||=ce(`/api/dashboard/notes/info`,`GET`,null).then(e=>typeof e?.root==`string`?e.root:null).catch(()=>null).then(e=>(N=e,e)),Ti):(N=null,null):N}function ji(e,t){t&&t.classList.add(`opening`),ce(`/api/file/open`,`POST`,{path:e}).then(e=>{t?.classList.remove(`opening`),e?.ok===!1?(t?.classList.add(`open-failed`),t&&(t.title=e?.error||`Failed to open`),setTimeout(()=>{t?.classList.remove(`open-failed`),t&&(t.title=``)},2e3)):(t?.classList.add(`opened`),setTimeout(()=>t?.classList.remove(`opened`),1500))}).catch(()=>{t?.classList.remove(`opening`),t?.classList.add(`open-failed`),setTimeout(()=>t?.classList.remove(`open-failed`),2e3)})}function Mi(e,t,n){let r=document.createElement(`span`);r.className=`file-path-link`,r.setAttribute(`data-file-path`,t),n&&r.setAttribute(`data-vault-rel`,n),r.setAttribute(`role`,`button`),r.setAttribute(`tabindex`,`0`);let i=t.split(`/`).pop()||t,a=/\.\w{1,10}$/.test(i);r.textContent=a?i:t,a&&(r.title=t),e.appendChild(r)}function Ni(e){yi.lastIndex=0;let t=[],n;for(;n=yi.exec(e);){let e=n[0],r=e.replace(xi,``);r.length<4||t.push({index:n.index,raw:e,clean:r})}return t}function Pi(e){bi.lastIndex=0;let t=[],n;for(;n=bi.exec(e);){let e=n[0].slice(0,n[0].length-n[1].length),r=n[1],i=n.index+e.length;t.push({index:i,raw:r,clean:r})}return t}function Fi(e,t){let n=[...e,...t].sort((e,t)=>e.index-t.index),r=[],i=-1;for(let e of n)e.index<i||(r.push(e),i=e.index+e.raw.length);return r}function Ii(e,t=null){let n=new Set([`PRE`,`A`,`BUTTON`,`TEXTAREA`,`INPUT`,`SCRIPT`,`STYLE`]),r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(t){let r=t.parentElement;for(;r&&r!==e;){if(n.has(r.tagName)||r.classList.contains(`file-path-link`)||r.tagName===`CODE`&&r.parentElement?.tagName===`PRE`)return NodeFilter.FILTER_REJECT;r=r.parentElement}return NodeFilter.FILTER_ACCEPT}}),i=new Map,a;for(;a=r.nextNode();){let e=a.textContent||``,n=Fi(Ni(e),t?Pi(e):[]);n.length&&i.set(a,n)}for(let[e,n]of i){let r=e.textContent||``,i=e.parentNode;if(!i)continue;let a=document.createDocumentFragment(),o=0;for(let{index:e,raw:i,clean:s}of n){e>o&&a.appendChild(document.createTextNode(r.slice(o,e))),Mi(a,s,vi(s,t));let n=i.slice(s.length);n&&a.appendChild(document.createTextNode(n)),o=e+i.length}o<r.length&&a.appendChild(document.createTextNode(r.slice(o))),i.replaceChild(a,e)}}async function Li(e){Ii(e,await Ai())}async function Ri(e,t){let n=await Ai(),r=t.getAttribute(`data-vault-rel`)||vi(e,n);if(r&&k()&&ci(r)){t.classList.add(`opened`),setTimeout(()=>t.classList.remove(`opened`),1500);return}if((wi.test(e)||Ci.test(e))&&(Yr()||await ei())&&k()&&li(e)){t.classList.add(`opened`),setTimeout(()=>t.classList.remove(`opened`),1500);return}ji(e,t)}var zi=!1;function Bi(){zi||(zi=!0,$r(),document.addEventListener(`click`,e=>{let t=e.target,n=t?.closest(`a`),r=n?.getAttribute(`href`)||``;if(n&&Oi(r)){ki(n);return}let i=n?Di(r):null;if(n&&i){e.preventDefault(),n.classList.add(`file-path-link`),Ri(i,n);return}let a=t?.closest(`.file-path-link`);if(!a)return;let o=a.getAttribute(`data-file-path`);o&&(e.preventDefault(),Ri(o,a))},!0),document.addEventListener(`keydown`,e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;t?.classList.contains(`file-path-link`)&&(e.preventDefault(),t.click())},!0))}function P(e){return typeof e==`string`?e.trim():``}function Vi(e){try{return JSON.parse(e)}catch{return null}}function Hi(e){let t=P(e);return t===`multi_select`||t===`multi`||t===`checkbox`?`multi_select`:t===`rank_priorities`||t===`rank`||t===`ranking`?`rank_priorities`:`single_select`}function Ui(e){return Array.isArray(e)?e.map((e,t)=>{if(typeof e==`string`){let n=e.trim();return n?{id:`option_${t+1}`,value:n,label:n,description:``,submitText:``}:null}if(!e||typeof e!=`object`)return null;let n=e,r=P(n.label)||P(n.text)||P(n.value)||P(n.id);if(!r)return null;let i=P(n.value)||r;return{id:P(n.id)||i||`option_${t+1}`,value:i,label:r,description:P(n.description),submitText:P(n.submitText)}}).filter(e=>!!e):[]}function Wi(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){let e=n.trim();if(!e)continue;let i=Array.isArray(r)?r.map(P).filter(Boolean):[P(r)].filter(Boolean);i.length>0&&(t[e]=i)}return t}function Gi(e,t){if(!e||typeof e!=`object`)return null;let n=e,r=P(n.question)||P(n.title)||P(n.prompt);return r?{id:P(n.id)||`q${t+1}`,type:Hi(n.type),question:r,options:Ui(n.options),visibleWhen:Wi(n.visibleWhen)}:null}function Ki(e){if(!e||typeof e!=`object`)return null;let t=e,n=(Array.isArray(t.questions)?t.questions:[{question:t.question,options:t.options,type:t.type}]).map((e,t)=>Gi(e,t)).filter(e=>!!e);return n.length>0?{questions:n}:null}function qi(e){return Ki(Vi(e))}function Ji(e){let t=[];for(let n of e.matchAll(/^ {0,3}```(?:elicitation|choice-buttons)[^\n]*\n([\s\S]*?)^ {0,3}```/gm)){let e=n[1]?.trim();e&&t.push(e)}return t}var Yi=`jaw:elicitation:complete`,Xi=`구조화 질문 응답:`;function Zi(e){return Array.isArray(e)?`[${e.map(Zi).join(`,`)}]`:e&&typeof e==`object`?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Zi(e[t])}`).join(`,`)}}`:JSON.stringify(e)}function Qi(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function $i(){let e=typeof window>`u`?`unknown`:`${window.location.origin}${window.location.pathname}`,t=`default`;try{t=localStorage.getItem(`clijaw_scope`)||`default`}catch{}return Qi(`${e}::${t}`)}function ea(e){return Qi(Zi(e))}function ta(e){return`${Yi}:${$i()}:${e.turnIndex}:${e.blockIndex}:${ea(e.spec)}`}function na(e,t){let n=e.closest(`.msg`),r=n?.dataset.turnIndex||``,i=Number(r);if(!Number.isFinite(i)||i<0)return null;let a=e.closest(`.msg-content`)||n,o=a?Array.from(a.querySelectorAll(`.elicitation-pending, .elicitation-block`)):[e];return ta({turnIndex:i,blockIndex:Math.max(0,o.indexOf(e)),spec:t})}function ra(e){if(!e)return!1;try{return localStorage.getItem(e)===`1`}catch{return!1}}function ia(e){if(e)try{localStorage.setItem(e,`1`)}catch{}}function aa(e){return e===`assistant`||e===`agent`}function oa(e){return e?.role===`user`&&e.content.includes(Xi)}function sa(e,t){return t.questions.some(t=>e.includes(t.question))}function ca(e){e.forEach((t,n)=>{if(!aa(t.role))return;let r=e[n+1];oa(r)&&Ji(t.content).forEach((e,t)=>{let i=qi(e);!i||!sa(r.content,i)||ia(ta({turnIndex:n,blockIndex:t,spec:i}))})})}var F={enabled:!1,mode:`off`,activeId:null,viewed:null},la=null,ua=/^\s*(?:\/switch(?:\s|$)|\/sessions(?:\s|$)|\/fork(?:\s|$)|\/\d+(?:\s|$))/i;function da(e){return(m&&e.startsWith(m)?e.slice(m.length):e)||`/`}function fa(e){let t=da(e).match(/^\/(\d+)\/?$/);return t?Number(t[1]):null}function pa(e){return e.sessions.some(e=>Object.prototype.hasOwnProperty.call(e,`source`))}function ma(e,t=window.location.pathname){if(!pa(e))return Object.assign(F,{enabled:!1,mode:`off`,activeId:null,viewed:null}),`off`;let n=da(t);if(n===`/`||n===``)return Object.assign(F,{enabled:!0,mode:`hub`,activeId:e.active,viewed:null}),`hub`;let r=fa(t),i=r===null?null:e.sessions.find(e=>e.seq===r)||null;return i?(Object.assign(F,{enabled:!0,mode:`session`,activeId:e.active,viewed:i}),I()||la?.(),`session`):(Object.assign(F,{enabled:!0,mode:`redirect`,activeId:e.active,viewed:null}),`redirect`)}function I(e=``){return F.enabled?e&&ua.test(e)?!0:F.mode===`session`&&F.viewed?.id===F.activeId&&F.viewed.remoteKey===null:fa(window.location.pathname)===null?!0:e?ua.test(e):!1}function ha(){return F.enabled&&F.mode===`session`&&F.viewed?.id||null}function ga(){if(!F.enabled||F.mode!==`session`)return null;let e=F.viewed;return e?e.id===`default`?`default`:e.remoteKey?e.remoteKey:`local:${e.id}`:null}function _a(e){let t=ha();if(!t)return e;if(e.startsWith(`?`)){let n=new URLSearchParams(e.slice(1));return n.set(`session`,t),`?${n.toString()}`}let n=new URL(e,`http://session.local`);return n.searchParams.set(`session`,t),`${n.pathname}${n.search}${n.hash}`}function va(e){let t=ha();return t?{...e,sessionId:t}:e}function ya(e){return`${m}/${e}`}function ba(){return m||`/`}function xa(e){return e.seq===0?v(`sessionHub.defaultSession`):e.label?.trim()||v(`sessionHub.sessionLabel`,{seq:e.seq})}function Sa(e){if(e==null)return v(`sessionHub.noActivity`);let t=new Date(e);return Number.isNaN(t.getTime())?v(`sessionHub.noActivity`):new Intl.DateTimeFormat(Yn(),{dateStyle:`medium`,timeStyle:`short`}).format(t)}function Ca(e){return v(`sessionHub.source.${e||`local`}`)}function wa(e,t){let n=e.remoteKey!=null,r=e.id!==`default`&&!n,i=n?v(`sessionHub.deleteRemoteDisabled`):``;return`<article class="session-card${e.id===t?` is-active`:``}" data-session-id="${y(e.id)}">
19
+ <a class="session-card-link" href="${y(ya(e.seq))}">
20
+ <div class="session-card-heading">
21
+ <span class="session-seq">/${e.seq}</span>
22
+ <span class="session-source">${y(Ca(e.source))}</span>
23
+ </div>
24
+ <h2>${y(xa(e))}</h2>
25
+ <dl class="session-card-meta">
26
+ <div><dt>${y(v(`sessionHub.messages`))}</dt><dd>${e.message_count}</dd></div>
27
+ <div><dt>${y(v(`sessionHub.lastActivity`))}</dt><dd>${y(Sa(e.lastActivityAt))}</dd></div>
28
+ </dl>
29
+ </a>
30
+ ${e.id===`default`?``:r?`<button type="button" class="session-delete" data-delete-session="${y(e.id)}">${y(v(`sessionHub.delete`))}</button>`:`<button type="button" class="session-delete" data-delete-session="${y(e.id)}" aria-disabled="true" aria-describedby="delete-reason-${y(e.id)}">${y(v(`sessionHub.delete`))}</button>
31
+ <p class="session-delete-reason" id="delete-reason-${y(e.id)}">${y(i)}</p>`}
32
+ </article>`}function Ta(){document.body.classList.add(`session-hub-mode`);let e=document.getElementById(`sessionHub`);e||(e=document.createElement(`main`),e.id=`sessionHub`,e.className=`session-hub`,document.body.prepend(e)),e.setAttribute(`aria-busy`,`true`),e.innerHTML=`<div class="session-hub-shell">
33
+ <header class="session-hub-header"><div><p class="session-hub-kicker">CLI-JAW</p><h1>${y(v(`sessionHub.title`))}</h1></div></header>
34
+ <div class="session-grid session-grid-loading" aria-hidden="true">
35
+ <div class="session-card-skeleton"><span></span><span></span><span></span></div>
36
+ <div class="session-card-skeleton"><span></span><span></span><span></span></div>
37
+ </div>
38
+ </div>`}function Ea(e){document.body.classList.add(`session-hub-mode`);let t=document.getElementById(`sessionHub`);t||(t=document.createElement(`main`),t.id=`sessionHub`,t.className=`session-hub`,document.body.prepend(t)),t.removeAttribute(`aria-busy`);let n=e.sessions.length===1&&e.sessions[0]?.id===`default`;t.innerHTML=`<div class="session-hub-shell">
39
+ <header class="session-hub-header">
40
+ <div><p class="session-hub-kicker">CLI-JAW</p><h1>${y(v(`sessionHub.title`))}</h1></div>
41
+ <p>${y(v(`sessionHub.description`))}</p>
42
+ </header>
43
+ ${n?`<section class="session-hub-empty" aria-labelledby="sessionHubEmptyTitle">
44
+ <h2 id="sessionHubEmptyTitle">${y(v(`sessionHub.empty.title`))}</h2>
45
+ <p>${y(v(`sessionHub.empty.description`))}</p>
46
+ <a href="${y(ya(0))}#settings">${y(v(`sessionHub.empty.action`))}</a>
47
+ </section>`:``}
48
+ <section class="session-grid" aria-label="${y(v(`sessionHub.listAria`))}">
49
+ ${e.sessions.map(t=>wa(t,e.active)).join(``)}
50
+ </section>
51
+ <p class="session-hub-error" id="sessionHubError" role="status" aria-live="polite"></p>
52
+ </div>`,t.dataset.eventsBound||(t.addEventListener(`click`,Da),t.dataset.eventsBound=`true`)}async function Da(e){let t=e.target?.closest(`[data-delete-session]`);if(!t||t.disabled||t.getAttribute(`aria-disabled`)===`true`)return;e.preventDefault();let n=t.dataset.deleteSession;if(!n||!window.confirm(v(`sessionHub.deleteConfirm`)))return;t.disabled=!0;let r=await se();try{let e=await fetch(`${m}/api/chat-sessions/${encodeURIComponent(n)}`,{method:`DELETE`,headers:r?{Authorization:`Bearer ${r}`}:{}});if(!e.ok)throw Error(String(e.status));let t=await le(`/api/chat-sessions`);t&&Ea(t)}catch{let e=document.getElementById(`sessionHubError`);e&&(e.textContent=v(`sessionHub.deleteFailed`)),t.disabled=!1}}function Oa(){let e=F.viewed;if(!e)return;document.title=`${xa(e)} · CLI-JAW`;let t=document.querySelector(`.chat-header > span`);t&&t.insertAdjacentHTML(`beforeend`,`<span class="session-view-label">/${e.seq} · ${y(xa(e))}</span>`),I()||L()}function L(){if(!F.enabled||!F.viewed)return;let e=document.getElementById(`sessionReadonlyNotice`);e||(e=document.createElement(`div`),e.id=`sessionReadonlyNotice`,e.className=`session-readonly-notice`,e.setAttribute(`role`,`status`),document.querySelector(`.chat-input-area`)?.before(e));let t=F.viewed.remoteKey!=null,n=t?`/sessions`:`/switch ${F.viewed.seq}`,r=t?v(`sessionReadonly.openSessions`):v(`sessionReadonly.switch`,{seq:F.viewed.seq});e.innerHTML=`<span>${y(v(t?`sessionReadonly.remote`:`sessionReadonly.message`))}</span>
53
+ <button type="button">${y(r)}</button>`,e.querySelector(`button`)?.addEventListener(`click`,()=>{let e=document.getElementById(`chatInput`);e&&(e.value=n,e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`cmd-execute`,{bubbles:!0})))})}function ka(e){if(!F.enabled||F.mode!==`session`||!F.viewed)return!1;let t=e.deleted;return!t||t.id!==F.viewed.id&&t.seq!==F.viewed.seq?!1:(window.location.assign(ba()),!0)}async function Aa(e={}){la=e.cancelRecording||null;let t=await le(`/api/chat-sessions`);if(!t)return fa(window.location.pathname)===null?`off`:(Object.assign(F,{enabled:!0,mode:`redirect`,activeId:null,viewed:null}),window.location.replace(ba()),`redirect`);let n=ma(t);return n===`hub`&&(Ta(),Ea(await le(`/api/chat-sessions`)||t)),n===`session`&&Oa(),n===`redirect`&&window.location.replace(ba()),n}var ja=`.elicitation-pending`,Ma=`.elicitation-block`,R=`submitting`,Na=`위 응답을 기준으로 계속 진행해줘.`,z=new WeakMap,Pa=null,Fa=0;function B(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Ia(e,t){let n=encodeURIComponent(e);return`<div class="elicitation-pending" data-elicitation-kind="${B(t)}" data-elicitation-spec="${B(n)}" role="status" aria-label="Structured question loading">
54
+ <div class="elicitation-loading">질문을 준비하는 중...</div>
55
+ </div>`}function La(e){let t=[];return e instanceof HTMLElement&&e.matches(ja)&&t.push(e),t.push(...Array.from(e.querySelectorAll(ja))),t}function Ra(e=document){for(let t of La(e)){if(t.dataset.elicitationHydrated===`true`)continue;let e=t.dataset.elicitationSpec||``,n=``;try{n=decodeURIComponent(e)}catch{n=``}let r=qi(n);if(t.dataset.elicitationHydrated=`true`,!r){console.warn(`[elicitation] invalid structured question spec`,{kind:t.dataset.elicitationKind||``,decodedChars:n.length,reason:n?`parse_or_normalize_failed`:`empty_spec`}),t.className=`elicitation-block elicitation-error`,t.innerHTML=`<div class="elicitation-error-text">질문 형식을 읽을 수 없습니다.</div>`;continue}let i=na(t,r);if(t.dataset.elicitationCompletionKey=i||``,ra(i)){$a(t);continue}let a={spec:r,index:0,answers:[]};z.set(t,a),Ga(t,a)}}function za(e){let t=z.get(e);if(!t)return;let n=t.spec.questions[t.index];if(!n){to(e,t);return}let r=t.spec.questions.length,i=e.id||`elicitation-${++Fa}`;e.id=i,e.className=`elicitation-block`,e.dataset.elicitationState=`active`,e.innerHTML=`
56
+ <div class="elicitation-top">
57
+ <div class="elicitation-progress">Q${t.index+1} ${t.index+1}/${r}</div>
58
+ <button class="elicitation-skip" type="button" data-elicitation-action="skip">skip</button>
59
+ </div>
60
+ <div class="elicitation-question" id="${B(i)}-question">${y(n.question)}</div>
61
+ <div class="elicitation-options" role="group" aria-labelledby="${B(i)}-question">
62
+ ${n.options.map(e=>Ba(n,e)).join(``)}
63
+ </div>
64
+ ${n.type===`multi_select`?`<button class="elicitation-submit" type="button" data-elicitation-action="submit-multi">선택 완료</button>`:``}
65
+ <div class="elicitation-input-row">
66
+ <input class="elicitation-input" type="text" placeholder="직접 입력" aria-label="직접 입력">
67
+ <button class="elicitation-submit" type="button" data-elicitation-action="submit-custom">입력</button>
68
+ </div>`}function Ba(e,t){let n=e.type===`multi_select`?` aria-pressed="false"`:``,r=t.description?`<span class="elicitation-option-description">${y(t.description)}</span>`:``;return`<button class="elicitation-option" type="button" data-elicitation-action="select-option" data-option-id="${B(t.id)}"${n}>
69
+ <span class="elicitation-option-label">${y(t.label)}</span>${r}
70
+ </button>`}function Va(e){return e instanceof HTMLElement?e.closest(Ma):null}function V(e){return e.spec.questions[e.index]||null}function Ha(e,t){return V(e)?.options.find(e=>e.id===t)||null}function Ua(e){let t=new Map;for(let n of e.answers)n&&t.set(n.question.id,n);return t}function Wa(e,t){for(let[n,r]of Object.entries(e.visibleWhen)){let e=t.get(n);if(!e||e.skipped||!e.values.some(e=>r.includes(e)))return!1}return!0}function Ga(e,t){for(;t.index<t.spec.questions.length;){let e=V(t);if(!e||Wa(e,Ua(t)))break;t.index+=1}za(e)}function H(e,t){let n=z.get(e),r=n?V(n):null;!n||!r||e.dataset.elicitationState===R||(n.answers[n.index]={question:r,...t},n.index+=1,Ga(e,n))}function Ka(e,t,n){let r=Ha(n,e.dataset.optionId||``),i=V(n);if(!(!r||!i)){if(i.type===`multi_select`){let t=e.getAttribute(`aria-pressed`)!==`true`;e.setAttribute(`aria-pressed`,String(t)),e.classList.toggle(`is-selected`,t);return}H(t,{skipped:!1,values:[r.value],labels:[r.submitText||r.label]})}}function qa(e,t){let n=Array.from(e.querySelectorAll(`.elicitation-option[aria-pressed="true"]`)).map(e=>Ha(t,e.dataset.optionId||``)).filter(e=>!!e);n.length!==0&&H(e,{skipped:!1,values:n.map(e=>e.value),labels:n.map(e=>e.submitText||e.label)})}function Ja(e){let t=e.querySelector(`.elicitation-input`),n=t?.value.trim()||``;if(!n){t?.focus();return}H(e,{skipped:!1,values:[n],labels:[n]})}function Ya(e){let t=e.target instanceof HTMLElement?e.target.closest(`[data-elicitation-action]`):null;if(!t)return;let n=Va(t),r=n?z.get(n):null;if(!n||!r||n.dataset.elicitationState===R)return;e.preventDefault();let i=t.dataset.elicitationAction;i===`select-option`&&Ka(t,n,r),i===`submit-multi`&&qa(n,r),i===`submit-custom`&&Ja(n),i===`skip`&&H(n,{skipped:!0,values:[],labels:[`skip`]})}function Xa(e){if(e.key!==`Enter`)return;let t=e.target;if(!(t instanceof HTMLElement)||t.tagName!==`INPUT`||!t.classList.contains(`elicitation-input`))return;let n=Va(t);n&&(e.preventDefault(),Ja(n))}function Za(e){return e.filter(e=>!!e)}function Qa(e){return`구조화 질문 응답:\n\n${Za(e).map(e=>{let t=e.skipped?`skip`:e.labels.join(`, `),n=e.values.length>0?` (값: ${e.values.join(`, `)})`:``;return`- ${e.question.question}: ${t}${n}`}).join(`
71
+ `)}\n\n${Na}`}function $a(e){e.className=`elicitation-block elicitation-complete`,e.dataset.elicitationState=`complete`,e.innerHTML=`<div class="elicitation-complete-row"><button class="elicitation-complete-button" type="button" disabled>응답 완료</button></div>`}function eo(e,t){return new(e.ownerDocument.defaultView?.Event||Event)(t,{bubbles:!0})}function to(e,t){if(e.dataset.elicitationState===R)return;if(!I()){L(),e.classList.add(`elicitation-error`);let t=e.querySelector(`.elicitation-readonly-notice`);t||(t=document.createElement(`div`),t.className=`elicitation-readonly-notice`,t.setAttribute(`role`,`status`),e.appendChild(t)),t.textContent=v(`sessionReadonly.elicitationRejected`);return}e.dataset.elicitationState=R;let n=document.getElementById(`chatInput`);if(!n){e.classList.add(`elicitation-error`),e.innerHTML=`<div class="elicitation-error-text">입력창을 찾을 수 없습니다.</div>`;return}n.value=Qa(t.answers),n.dispatchEvent(eo(n,`input`)),n.dispatchEvent(eo(n,`cmd-execute`)),ia(e.dataset.elicitationCompletionKey||null),z.delete(e),$a(e)}function no(){Pa!==document&&(document.addEventListener(`click`,Ya),document.addEventListener(`keydown`,Xa),Pa=document)}var ro=`.search-results-pending`,io=10,ao=240;function oo(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function U(e,t=ao){let n=typeof e==`string`?e.trim().replace(/\s+/g,` `):``;return n.length>t?`${n.slice(0,t-1)}…`:n}function so(e){let t=e.replace(/^\[|\]$/g,``).toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t.endsWith(`.local`)||/^0\./.test(t)||/^10\./.test(t)||/^127\./.test(t)||/^169\.254\./.test(t)||/^172\.(1[6-9]|2\d|3[01])\./.test(t)||/^192\.168\./.test(t)||/^::1$/.test(t)}function co(e){let t=typeof e==`string`?e.trim():``;if(!t)return``;try{let e=new URL(t);return![`http:`,`https:`].includes(e.protocol)||e.username||e.password||so(e.hostname)?``:e.href}catch{return``}}function lo(e){try{return JSON.parse(e)}catch{return null}}function uo(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.schemaVersion!==`search-results-v1`)return null;let n=U(t.query,160),r=Array.isArray(t.results)?t.results:[],i=new Set,a=[];for(let e of r){if(!e||typeof e!=`object`)continue;let t=e,n=co(t.url||t.link);if(!n||i.has(n))continue;i.add(n);let r=U(t.title,160)||new URL(n).hostname;if(a.push({title:r,url:n,snippet:U(t.snippet||t.description),source:U(t.source,80)||new URL(n).hostname}),a.length>=io)break}return!n&&a.length===0?null:{schemaVersion:`search-results-v1`,query:n,results:a}}function fo(e){return`<div class="search-results-pending" data-search-results-kind="search-results" data-search-results-spec="${oo(encodeURIComponent(e))}" role="status" aria-label="Search results loading">
72
+ <div class="search-results-loading">검색 결과를 준비하는 중...</div>
73
+ </div>`}function po(e){let t=[];return e instanceof HTMLElement&&e.matches(ro)&&t.push(e),t.push(...Array.from(e.querySelectorAll(ro))),t}function mo(e){let t=e.results.length===0?`<div class="search-results-empty">표시할 검색 결과가 없습니다.</div>`:``,n=e.results.map((e,t)=>`
74
+ <a class="search-result-card" href="${oo(e.url)}" target="_blank" rel="noopener noreferrer">
75
+ <span class="search-result-index">${t+1}</span>
76
+ <span class="search-result-body">
77
+ <span class="search-result-title">${y(e.title)}</span>
78
+ ${e.snippet?`<span class="search-result-snippet">${y(e.snippet)}</span>`:``}
79
+ <span class="search-result-source">${y(e.source)}</span>
80
+ </span>
81
+ </a>`).join(``);return`
82
+ <div class="search-results-header">
83
+ <div class="search-results-title">Search Results</div>
84
+ ${e.query?`<div class="search-results-query">${y(e.query)}</div>`:``}
85
+ </div>
86
+ <div class="search-results-list">${n}${t}</div>`}function ho(e=document){for(let t of po(e)){if(t.dataset.searchResultsHydrated===`true`)continue;t.dataset.searchResultsHydrated=`true`;let e=t.dataset.searchResultsSpec||``,n=``;try{n=decodeURIComponent(e)}catch{n=``}delete t.dataset.searchResultsSpec;let r=uo(lo(n));if(!r){console.warn(`[search-results] invalid search result spec`,{decodedChars:n.length}),t.className=`search-results-block search-results-error`,t.innerHTML=`<div class="search-results-error-text">검색 결과 형식을 읽을 수 없습니다.</div>`;continue}t.className=`search-results-block`,t.innerHTML=mo(r)}}var go=`.compose-block-pending`,_o=`.compose-block`,vo=120,yo=180,bo=2e4,xo=4e3,So=3,W=new WeakMap,Co=null;function wo(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function G(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?n.slice(0,t):n}function To(e,t){if(!Array.isArray(e))return[];let n=[],r=0;for(let i of e){let e=typeof i==`string`?i.trim():``;if(!e)continue;let a=t-r;if(a<=0)break;let o=e.length>a?e.slice(0,a):e;n.push(o),r+=o.length}return n}function Eo(e){let t=G(e.body,bo);if(t)return t;let n=To(e.paragraphs,bo);if(n.length>0)return n.join(`
87
+
88
+ `);let r=To(e.bodyLines,bo);return r.length>0?r.join(`
89
+ `):``}function Do(e){let t=typeof e==`string`?e.trim():``;return t===`email`||t===`message`||t===`document`||t===`other`?t:t===`textMessage`?`message`:`other`}function Oo(e){try{return JSON.parse(e)}catch{return null}}function ko(e){return encodeURIComponent(JSON.stringify(e))}function Ao(e){let t=e.dataset.composeBlockSpec||``,n=``;try{n=decodeURIComponent(t)}catch{n=``}return Mo(Oo(n))}function jo(e,t,n){if(!e||typeof e!=`object`)return null;let r=e,i=Eo(r);if(!i)return null;let a=G(r.label,40)||`Variant ${t+1}`;return{id:G(r.id,60)||`variant_${t+1}`,label:a,subject:G(r.subject,yo)||n,body:i}}function Mo(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.schemaVersion!==`compose-block-v1`)return null;let n=Do(t.kind),r=G(t.subject,yo),i=(Array.isArray(t.variants)?t.variants:[]).map((e,t)=>jo(e,t,r)).filter(e=>!!e).slice(0,So);return i.length===0?null:{schemaVersion:`compose-block-v1`,kind:n,title:G(t.title,vo)||`Draft`,subject:r,variants:i}}function No(e){return`<div class="compose-block-pending" data-compose-block-kind="compose-block" data-compose-block-spec="${wo(encodeURIComponent(e))}" role="status" aria-label="Compose block loading">
90
+ <div class="compose-loading">초안을 준비하는 중...</div>
91
+ </div>`}function Po(e){let t=[];return e instanceof HTMLElement&&e.matches(go)&&t.push(e),t.push(...Array.from(e.querySelectorAll(go))),t}function Fo(e){let t=[],n=`${_o}[data-compose-block-spec]`;return e instanceof HTMLElement&&e.matches(n)&&t.push(e),t.push(...Array.from(e.querySelectorAll(n))),t}function Io(e){return e===`email`?`Email`:e===`message`?`Message`:e===`document`?`Document`:`Draft`}function Lo(e){return e===`document`?`Title`:e===`message`?`Topic`:`Subject`}function Ro(e){return e.variants.map((e,t)=>`<button class="compose-tab${t===0?` is-active`:``}" type="button" data-compose-action="variant" data-variant-id="${wo(e.id)}" aria-pressed="${t===0?`true`:`false`}">${y(e.label)}</button>`).join(``)}function zo(e){let t=e.variants[0],n=e.kind===`email`?`<button class="compose-btn" type="button" data-compose-action="mail">Open in Mail</button>`:e.kind===`message`?`<button class="compose-btn" type="button" data-compose-action="sms">Open in Messages</button>`:``;return`
92
+ <div class="compose-block-header">
93
+ <div class="compose-title">${y(e.title)}</div>
94
+ <div class="compose-kind">${y(Io(e.kind))}</div>
95
+ </div>
96
+ <label class="compose-subject-row">
97
+ <span>${y(Lo(e.kind))}</span>
98
+ <input class="compose-subject-input" type="text" value="${wo(t.subject||e.subject)}" maxlength="${yo}">
99
+ </label>
100
+ <div class="compose-tabs" role="group" aria-label="Draft variants">${Ro(e)}</div>
101
+ <textarea class="compose-body" rows="8" maxlength="${bo}">${y(t.body)}</textarea>
102
+ <div class="compose-actions">
103
+ <button class="compose-btn" type="button" data-compose-action="copy">Copy</button>
104
+ ${n}
105
+ </div>
106
+ <div class="compose-followup">
107
+ <label class="compose-followup-row">
108
+ <span>Prompt</span>
109
+ <textarea class="compose-followup-input" rows="2" maxlength="${xo}" placeholder="추가 요청을 입력하세요. Cmd/Ctrl+Enter로 보낼 수 있습니다."></textarea>
110
+ </label>
111
+ <div class="compose-followup-actions">
112
+ <div class="compose-followup-error" role="alert" aria-live="polite"></div>
113
+ <button class="compose-btn compose-send-btn" type="button" data-compose-action="send-followup">Send</button>
114
+ </div>
115
+ </div>`}function Bo(e=document){for(let t of Po(e)){if(t.dataset.composeBlockHydrated===`true`)continue;t.dataset.composeBlockHydrated=`true`;let e=Ao(t);if(!e){console.warn(`[compose-block] invalid compose block spec`),delete t.dataset.composeBlockSpec,t.className=`compose-block compose-error`,t.innerHTML=`<div class="compose-error-text">초안 형식을 읽을 수 없습니다. compose-block은 strict JSON이어야 하며 문자열 안 줄바꿈은 \\n으로 escape해야 합니다.</div>`;continue}t.className=`compose-block`,t.dataset.composeBlockSpec=ko(e),W.set(t,e),t.innerHTML=zo(e)}for(let t of Fo(e)){if(W.has(t))continue;let e=Ao(t);e&&W.set(t,e)}}function Vo(e){return e instanceof HTMLElement?e.closest(_o):null}function Ho(e){return{subject:e.querySelector(`.compose-subject-input`)?.value||``,body:e.querySelector(`.compose-body`)?.value||``}}function Uo(e){let t=(e.querySelector(`.compose-followup-input`)?.value||``).trim();return t.length>xo?t.slice(0,xo):t}function Wo(e,t,n=`error`){let r=e.querySelector(`.compose-followup-error`);r&&(r.textContent=t,r.dataset.state=t?n:``)}function Go(e,t){return new(e.ownerDocument.defaultView?.Event||Event)(t,{bubbles:!0})}function Ko(e,t,n,r){let i=Lo(e.kind);return[`다음 compose-block 초안을 사용자가 편집했습니다.`,``,`종류: ${Io(e.kind)}`,`카드 제목: ${e.title}`,``,`${i}:`,t||`(비어 있음)`,``,`본문:`,n||`(비어 있음)`,``,`사용자 추가 요청:`,r,``,`위 수정본과 추가 요청을 반영해서 새 compose-block 초안을 다시 작성해주세요. 결과는 strict JSON compose-block으로 반환하고, 멀티라인 본문은 variants[].paragraphs 또는 variants[].bodyLines 배열을 우선 사용해주세요.`].join(`
116
+ `)}function qo(e,t){let n=Uo(e);if(!n){Wo(e,`추가 요청을 입력한 뒤 Send를 눌러주세요.`),e.querySelector(`.compose-followup-input`)?.focus();return}let r=document.getElementById(`chatInput`);if(!r){Wo(e,`채팅 입력창을 찾을 수 없습니다.`);return}if(!I()){L(),Wo(e,v(`sessionReadonly.composeRejected`));return}let{subject:i,body:a}=Ho(e);r.value=Ko(t,i,a,n),r.dispatchEvent(Go(r,`input`)),r.dispatchEvent(Go(r,`cmd-execute`));let o=e.querySelector(`.compose-followup-input`);o&&(o.value=``),Wo(e,`전송했습니다.`,`success`)}function Jo(e,t){let n=W.get(e);if(!n)return;let r=n?.variants.find(e=>e.id===t);if(!r)return;let i=e.querySelector(`.compose-subject-input`),a=e.querySelector(`.compose-body`);i&&(i.value=r.subject||n.subject),a&&(a.value=r.body);for(let n of e.querySelectorAll(`.compose-tab`)){let e=n.dataset.variantId===t;n.classList.toggle(`is-active`,e),n.setAttribute(`aria-pressed`,String(e))}}async function Yo(e){let t=navigator.clipboard;if(t?.writeText){await t.writeText(e);return}let n=document.createElement(`textarea`);n.value=e,n.style.position=`fixed`,n.style.opacity=`0`,document.body.appendChild(n),n.select(),document.execCommand(`copy`),n.remove()}function Xo(e){window.location.href=e}function Zo(e){let t=e.target instanceof HTMLElement?e.target.closest(`[data-compose-action]`):null;if(!t)return;let n=Vo(t),r=n?W.get(n):null;if(!n||!r)return;e.preventDefault();let i=t.dataset.composeAction,{subject:a,body:o}=Ho(n);i===`variant`&&Jo(n,t.dataset.variantId||``),i===`copy`&&Yo(a?`${a}\n\n${o}`:o),i===`mail`&&Xo(`mailto:?subject=${encodeURIComponent(a)}&body=${encodeURIComponent(o)}`),i===`sms`&&Xo(`sms:?body=${encodeURIComponent(o)}`),i===`send-followup`&&qo(n,r)}function Qo(e){if(e.key!==`Enter`||e.shiftKey||!e.metaKey&&!e.ctrlKey)return;let t=e.target;if(!(t instanceof HTMLElement)||!t.classList.contains(`compose-followup-input`))return;let n=Vo(t),r=n?W.get(n):null;!n||!r||(e.preventDefault(),qo(n,r))}function $o(){Co!==document&&(document.addEventListener(`click`,Zo),document.addEventListener(`keydown`,Qo),Co=document)}var es=`.dataframe-pending`,ts=`.dataframe-block`,ns=20,rs=500,is=240,as=25,K=new WeakMap,os=null;function ss(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function cs(e,t=is){let n=``;return n=e==null?``:typeof e==`object`?JSON.stringify(e):String(e),n=n.trim(),n.length>t?`${n.slice(0,t-1)}…`:n}function ls(e){try{return JSON.parse(e)}catch{return null}}function us(e){return encodeURIComponent(JSON.stringify(e))}function ds(e){let t=e.dataset.dataframeSpec||``,n=``;try{n=decodeURIComponent(t)}catch{n=``}return ms(ls(n))}function fs(e){return Math.min(100,Math.max(5,typeof e==`number`&&Number.isFinite(e)?Math.floor(e):as))}function ps(e){return e===`number`||e===`boolean`||e===`date`||e===`json`?e:`string`}function ms(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.schemaVersion!==`dataframe-v1`)return null;let n=(Array.isArray(t.columns)?t.columns:[]).map(e=>cs(e,80)).filter(Boolean).slice(0,ns);if(n.length===0)return null;let r=(Array.isArray(t.rows)?t.rows:Array.isArray(t.data)?t.data:[]).filter(e=>Array.isArray(e)).slice(0,rs).map(e=>n.map((t,n)=>cs(e[n]))),i=Array.isArray(t.types)?t.types:[],a=n.map((e,t)=>ps(i[t]));return{schemaVersion:`dataframe-v1`,title:cs(t.title,120)||`Dataframe`,columns:n,types:a,rows:r,pageSize:fs(t.pageSize)}}function hs(e){return`<div class="dataframe-pending" data-dataframe-kind="dataframe" data-dataframe-spec="${ss(encodeURIComponent(e))}" role="status" aria-label="Dataframe loading">
117
+ <div class="dataframe-loading">표를 준비하는 중...</div>
118
+ </div>`}function gs(e){let t=[];return e instanceof HTMLElement&&e.matches(es)&&t.push(e),t.push(...Array.from(e.querySelectorAll(es))),t}function _s(e){let t=[],n=`${ts}[data-dataframe-spec]`;return e instanceof HTMLElement&&e.matches(n)&&t.push(e),t.push(...Array.from(e.querySelectorAll(n))),t}function vs(e){let t=e.filter.trim().toLowerCase(),n=e.spec.rows;if(t&&(n=n.filter(e=>e.some(e=>e.toLowerCase().includes(t)))),e.sortColumn!==null){let t=e.sortColumn,r=e.sortDirection===`asc`?1:-1;n=[...n].sort((e,n)=>e[t].localeCompare(n[t],void 0,{numeric:!0})*r)}return n}function q(e){let t=K.get(e);if(!t)return;let n=vs(t),r=Math.max(1,Math.ceil(n.length/t.spec.pageSize));t.page=Math.min(t.page,r-1);let i=t.page*t.spec.pageSize,a=n.slice(i,i+t.spec.pageSize),o=t.spec.columns.map((e,n)=>{let r=t.sortColumn===n?t.sortDirection===`asc`?`↑`:`↓`:``;return`<th><button class="dataframe-sort-btn" type="button" data-dataframe-action="sort" data-column-index="${n}">${y(e)} ${r}</button></th>`}).join(``),s=a.length===0?`<tr><td class="dataframe-empty" colspan="${t.spec.columns.length}">표시할 행이 없습니다.</td></tr>`:a.map(e=>`<tr>${e.map(e=>`<td><button class="dataframe-cell" type="button" data-dataframe-action="copy-cell" data-cell-value="${ss(e)}">${y(e)}</button></td>`).join(``)}</tr>`).join(``);e.querySelector(`.dataframe-table-wrap`).innerHTML=`<table class="dataframe-table"><thead><tr>${o}</tr></thead><tbody>${s}</tbody></table>`,e.querySelector(`.dataframe-page-info`).textContent=`${t.page+1}/${r} · ${n.length} rows`;let c=e.querySelector(`[data-dataframe-action="prev"]`),l=e.querySelector(`[data-dataframe-action="next"]`);c&&(c.disabled=t.page===0),l&&(l.disabled=t.page>=r-1)}function ys(e){return`
119
+ <div class="dataframe-toolbar">
120
+ <div class="dataframe-title">${y(e.title)}</div>
121
+ <input class="dataframe-filter" type="search" placeholder="Filter" aria-label="Filter table">
122
+ </div>
123
+ <div class="dataframe-table-wrap"></div>
124
+ <div class="dataframe-pagination">
125
+ <button class="dataframe-page-btn" type="button" data-dataframe-action="prev">Prev</button>
126
+ <span class="dataframe-page-info"></span>
127
+ <button class="dataframe-page-btn" type="button" data-dataframe-action="next">Next</button>
128
+ </div>`}function bs(e=document){for(let t of gs(e)){if(t.dataset.dataframeHydrated===`true`)continue;t.dataset.dataframeHydrated=`true`;let e=ds(t);if(!e){console.warn(`[dataframe] invalid dataframe spec`),delete t.dataset.dataframeSpec,t.className=`dataframe-block dataframe-error`,t.innerHTML=`<div class="dataframe-error-text">표 형식을 읽을 수 없습니다.</div>`;continue}t.className=`dataframe-block`,t.dataset.dataframeSpec=us(e),K.set(t,{spec:e,filter:``,sortColumn:null,sortDirection:`asc`,page:0}),t.innerHTML=ys(e),q(t)}for(let t of _s(e)){if(K.has(t))continue;let e=ds(t);if(!e)continue;let n=t.querySelector(`.dataframe-filter`)?.value||``;K.set(t,{spec:e,filter:n,sortColumn:null,sortDirection:`asc`,page:0}),q(t)}}function xs(e){return e instanceof HTMLElement?e.closest(ts):null}async function Ss(e){navigator.clipboard?.writeText&&await navigator.clipboard.writeText(e)}function Cs(e){let t=e.target instanceof HTMLElement?e.target.closest(`[data-dataframe-action]`):null;if(!t)return;let n=xs(t),r=n?K.get(n):null;if(!n||!r)return;e.preventDefault();let i=t.dataset.dataframeAction;if(i===`sort`){let e=Number(t.dataset.columnIndex);if(!Number.isInteger(e))return;r.sortColumn===e?r.sortDirection=r.sortDirection===`asc`?`desc`:`asc`:(r.sortColumn=e,r.sortDirection=`asc`),r.page=0,q(n)}i===`prev`&&(r.page=Math.max(0,r.page-1),q(n)),i===`next`&&(r.page+=1,q(n)),i===`copy-cell`&&Ss(t.dataset.cellValue||``)}function ws(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.classList.contains(`dataframe-filter`))return;let n=xs(t),r=n?K.get(n):null;!n||!r||(r.filter=t.value,r.page=0,q(n))}function Ts(){os!==document&&(document.addEventListener(`click`,Cs),document.addEventListener(`input`,ws),os=document)}var Es=`.chart-json-pending`,Ds=24,J=[`#2563eb`,`#16a34a`,`#dc2626`,`#9333ea`,`#ca8a04`,`#0891b2`];function Os(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function ks(e,t){let n=typeof e==`string`?e.trim():``;return n.length>t?`${n.slice(0,t-1)}…`:n}function As(e){try{return JSON.parse(e)}catch{return null}}function js(e){return e===`line`||e===`pie`?e:`bar`}function Ms(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.schemaVersion!==`chart-json-v1`)return null;let n=Array.isArray(t.labels)?t.labels:[],r=Array.isArray(t.data)?t.data:[],i=Math.min(n.length,r.length,Ds),a=[],o=[];for(let e=0;e<i;e+=1){let t=Number(r[e]);Number.isFinite(t)&&(a.push(ks(n[e],40)||`Item ${e+1}`),o.push(t))}return a.length===0?null:{schemaVersion:`chart-json-v1`,type:js(t.type),title:ks(t.title,120)||`Chart`,description:ks(t.description,240),labels:a,data:o}}function Ns(e){return`<div class="chart-json-pending" data-chart-json-kind="chart-json" data-chart-json-spec="${Os(encodeURIComponent(e))}" role="status" aria-label="Chart loading">
129
+ <div class="chart-json-loading">차트를 준비하는 중...</div>
130
+ </div>`}function Ps(e){let t=[];return e instanceof HTMLElement&&e.matches(Es)&&t.push(e),t.push(...Array.from(e.querySelectorAll(Es))),t}function Fs(e,t,n){return n===t?.5:(e-t)/(n-t)}function Is(e){let t=Math.max(...e.data,1),n=Math.max(8,(360-6*(e.data.length-1))/e.data.length),r=e.data.map((r,i)=>{let a=Math.max(2,r/t*130);return`<rect x="${i*(n+6)}" y="${170-a-24}" width="${n}" height="${a}" rx="3" fill="${J[i%J.length]}"><title>${y(e.labels[i])}: ${r}</title></rect>`}).join(``);return`<svg class="chart-json-svg" viewBox="0 0 360 170" role="img" aria-label="${Os(e.title)}">${r}</svg>`}function Ls(e){let t=Math.min(...e.data),n=Math.max(...e.data),r=e.data.map((r,i)=>{let a=e.data.length===1?360/2:i/(e.data.length-1)*360,o=145-Fs(r,t,n)*120;return`${a.toFixed(1)},${o.toFixed(1)}`}),i=r.map((t,n)=>{let[r,i]=t.split(`,`);return`<circle cx="${r}" cy="${i}" r="3" fill="${J[n%J.length]}"><title>${y(e.labels[n])}: ${e.data[n]}</title></circle>`}).join(``);return`<svg class="chart-json-svg" viewBox="0 0 360 170" role="img" aria-label="${Os(e.title)}"><polyline points="${r.join(` `)}" fill="none" stroke="#2563eb" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>${i}</svg>`}function Rs(e,t,n,r,i){let a=e+n*Math.cos(r),o=t+n*Math.sin(r),s=e+n*Math.cos(i),c=t+n*Math.sin(i),l=+(i-r>Math.PI);return`M ${e} ${t} L ${a.toFixed(2)} ${o.toFixed(2)} A ${n} ${n} 0 ${l} 1 ${s.toFixed(2)} ${c.toFixed(2)} Z`}function zs(e){let t=e.data.reduce((e,t)=>e+Math.max(0,t),0);if(t<=0)return Is(e);let n=-Math.PI/2,r=e.data.map((r,i)=>{let a=Math.max(0,r)/t*Math.PI*2,o=Rs(90,85,64,n,n+a);return n+=a,`<path d="${o}" fill="${J[i%J.length]}"><title>${y(e.labels[i])}: ${r}</title></path>`}).join(``);return`<svg class="chart-json-svg" viewBox="0 0 180 170" role="img" aria-label="${Os(e.title)}">${r}</svg>`}function Bs(e){return e.labels.map((e,t)=>`<span class="chart-json-legend-item"><span class="chart-json-swatch chart-json-swatch-${t%J.length}"></span>${y(e)}</span>`).join(``)}function Vs(e){let t=e.type===`line`?Ls(e):e.type===`pie`?zs(e):Is(e);return`
131
+ <div class="chart-json-header">
132
+ <div class="chart-json-title">${y(e.title)}</div>
133
+ ${e.description?`<div class="chart-json-description">${y(e.description)}</div>`:``}
134
+ </div>
135
+ <div class="chart-json-frame">${t}</div>
136
+ <div class="chart-json-legend">${Bs(e)}</div>`}function Hs(e=document){for(let t of Ps(e)){if(t.dataset.chartJsonHydrated===`true`)continue;t.dataset.chartJsonHydrated=`true`;let e=t.dataset.chartJsonSpec||``,n=``;try{n=decodeURIComponent(e)}catch{n=``}delete t.dataset.chartJsonSpec;let r=Ms(As(n));if(!r){console.warn(`[chart-json] invalid chart spec`,{decodedChars:n.length}),t.className=`chart-json-block chart-json-error`,t.innerHTML=`<div class="chart-json-error-text">차트 형식을 읽을 수 없습니다.</div>`;continue}t.className=`chart-json-block`,t.innerHTML=Vs(r)}}var Us=`link-preview-card`,Ws=4,Gs=200,Y=new Map,Ks=[],qs=0;function Js(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Ys(e){let t=e.replace(/^\[|\]$/g,``).toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t.endsWith(`.local`)||/^0\./.test(t)||/^10\./.test(t)||/^127\./.test(t)||/^169\.254\./.test(t)||/^172\.(1[6-9]|2\d|3[01])\./.test(t)||/^192\.168\./.test(t)||/^::1$/.test(t)}function Xs(e){try{let t=new URL(e,window.location.href);return![`http:`,`https:`].includes(t.protocol)||t.origin===window.location.origin||t.username||t.password||Ys(t.hostname)||/\.(?:png|jpe?g|gif|webp|avif|svg|mp4|webm|mov|zip|tar|gz|pdf)(?:$|\?)/i.test(t.pathname)?``:t.href}catch{return``}}function Zs(e){return e.closest(`.${Us}, .search-results-block, .elicitation-block, .code-block`)||e.dataset.linkPreviewAttached===`true`?!1:!!Xs(e.href)}async function Qs(e){qs>=Ws&&await new Promise(e=>Ks.push(e)),qs+=1;try{return await e()}finally{--qs,Ks.shift()?.()}}function $s(e){let t=Y.get(e);if(t)return Y.delete(e),Y.set(e,t),t;let n=Qs(async()=>{try{let t=await fetch(`${m}/api/link-preview?url=${encodeURIComponent(e)}`);if(t.status===204||!t.ok)return null;let n=await t.json();return n.ok&&n.data?n.data:null}catch{return null}});for(Y.set(e,n);Y.size>Gs;){let e=Y.keys().next().value;if(!e)break;Y.delete(e)}return n}function ec(e){return`${m}/api/link-preview/image?url=${encodeURIComponent(e)}`}function tc(e,t){let n=String(e.title||``).trim(),r=String(e.description||``).trim(),i=String(e.siteName||e.domain||``).trim(),a=String(e.canonicalUrl||e.finalUrl||t).trim(),o=new URL(a||t).hostname,s=i&&i.toLowerCase()!==o.toLowerCase()?i:``,c=String(e.image||``).trim(),l=String(e.favicon||``).trim();if(!n&&!r&&!c&&!l)return null;let u=c?`<img class="link-preview-image" src="${Js(ec(c))}" alt="" loading="lazy" referrerpolicy="no-referrer">`:`<div class="link-preview-image link-preview-image-empty" aria-hidden="true"></div>`,ee=l?`<img class="link-preview-favicon" src="${Js(ec(l))}" alt="" loading="lazy" referrerpolicy="no-referrer">`:``,d=document.createElement(`a`);return d.className=Us,d.href=a||t,d.target=`_blank`,d.rel=`noopener noreferrer`,d.setAttribute(`aria-label`,n?`Link preview: ${n}`:`Link preview`),d.innerHTML=`
137
+ ${u}
138
+ <span class="link-preview-body">
139
+ <span class="link-preview-meta">${ee}${s?`<span>${y(s)}</span><span class="link-preview-separator">-</span>`:``}<span class="link-preview-url">${y(o)}</span></span>
140
+ ${n?`<span class="link-preview-title">${y(n)}</span>`:``}
141
+ ${r?`<span class="link-preview-description">${y(r)}</span>`:``}
142
+ </span>`,d.href=a||t,d}async function nc(e){let t=Xs(e.href);if(!t||e.dataset.linkPreviewAttached===`true`)return;e.dataset.linkPreviewAttached=`true`;let n=await $s(t);if(!n||!e.isConnected)return;let r=tc(n,t);r&&e.insertAdjacentElement(`afterend`,r)}function rc(e){if(!(`IntersectionObserver`in window)){nc(e);return}let t=new IntersectionObserver(n=>{for(let r of n)r.isIntersecting&&(t.disconnect(),nc(e))},{rootMargin:`160px`});t.observe(e)}function ic(e=document){let t=[];e instanceof HTMLAnchorElement&&Zs(e)&&t.push(e),t.push(...Array.from(e.querySelectorAll(`a[href]`)).filter(Zs));for(let e of t)rc(e)}var X=null,Z=null;function ac(){Z&&clearTimeout(Z),X&&=(cancelAnimationFrame(X),null),Z=setTimeout(()=>{Z=null,X=requestAnimationFrame(()=>{X=null;let e=document.getElementById(`chatMessages`);(!e||e.querySelector(`.mermaid-pending, [data-mermaid-code-raw]`))&&Hr(),(!e||e.querySelector(`.code-block pre code, .code-block-wrapper pre code`))&&Pr(),(!e||e.querySelector(`.diagram-zoom-btn, .mermaid-zoom-btn`))&&kr(),e&&(Ra(e),ho(e),Bo(e),bs(e),Hs(e),ic(e),Li(e))})},100)}function oc(){Z&&=(clearTimeout(Z),null),X&&=(cancelAnimationFrame(X),null)}var sc=!1;function cc(e,t){yr(t).then(t=>{if(!t.ok)return;let n=e.textContent||``;e.textContent=v(`code.copied`),e.classList.add(`copied`),setTimeout(()=>{e.textContent=n,e.classList.remove(`copied`)},1500)})}function lc(){sc||(sc=!0,document.addEventListener(`click`,e=>{let t=e.target,n=t?.closest(`.code-copy-btn`);if(n){let e=n.closest(`.code-block`);if(!e)return;let t=e.querySelector(`pre code`);if(!t)return;cc(n,t.textContent||``);return}let r=t?.closest(`.code-lang-label`);if(!r)return;let i=r.closest(`.code-block-wrapper`);if(!i)return;let a=i.querySelector(`pre code`);a&&cc(r,a.textContent||``)}))}var uc=!1;function dc(){uc||(uc=!0,document.addEventListener(`error`,e=>{let t=e.target;if(!(t instanceof HTMLElement)||t.tagName!==`IMG`||!t.classList.contains(`chat-inline-img`))return;let n=t.getAttribute(`alt`)?.trim()||``,r=document.createElement(`div`);r.className=`chat-inline-img-error`,r.setAttribute(`role`,`status`),r.textContent=n?`Image unavailable: ${n}`:`Image unavailable`,t.replaceWith(r)},!0))}function fc(){dc(),lc(),Cr(),Bi(),no(),$o(),Ts()}var pc=/^---\s+\S+\n\+\+\+\s+\S+\n@@\s/m,mc=800;function hc(e){return pc.test(e.trim())}function gc(e){return e.startsWith(`--- `)||e.startsWith(`+++ `)?`diff-file`:e.startsWith(`@@`)?`diff-hunk`:e.startsWith(`+`)?`diff-add`:e.startsWith(`-`)?`diff-del`:e.startsWith(` `)?`diff-ctx`:`diff-meta`}function _c(e,t){return t.startsWith(`@@`)||t.startsWith(`--- `)||t.startsWith(`+++ `)?``:String(e+1)}function vc(e){let t=e.replace(/\r\n/g,`
143
+ `).split(`
144
+ `);return`<div class="diff-viewer" role="region" aria-label="Diff viewer">${t.slice(0,mc).map((e,t)=>`<div class="diff-line ${gc(e)}"><span class="diff-ln">${y(_c(t,e))}</span><span class="diff-code">${y(e||` `)}</span></div>`).join(``)}${t.length>mc?`<div class="diff-omitted">${t.length-mc} lines omitted</div>`:``}</div>`}var yc=[`elicitation`,`choice-buttons`,`search-results`,`compose-block`,`dataframe`,`chart-json`],bc=/^ {0,3}(`{3,}|~{3,})([A-Za-z0-9_-]+)?[^\n]*$/;function xc(e){return new Set(e.map(e=>e.trim().toLowerCase()).filter(Boolean))}function Sc(e,t){let n=t[0],r=t.length;return RegExp(`^ {0,3}\\${n}{${r},}[ \\t]*$`).test(e)}function Cc(e,t=yc){let n=xc(t),r=new Set,i=0,a=0,o=e.split(/\r?\n/);for(let e=0;e<o.length;e+=1){let t=o[e].match(bc);if(!t)continue;let s=t[1],c=(t[2]||``).trim().toLowerCase();if(!n.has(c))continue;r.add(c);let l=!1;for(let t=e+1;t<o.length;t+=1)if(Sc(o[t],s)){i+=1,l=!0,e=t;break}if(!l){a+=1;break}}return{status:a>0?`incomplete`:i>0?`complete`:`absent`,completeCount:i,incompleteCount:a,langs:[...r]}}function wc(e){return Cc(e).status===`incomplete`}var Tc=!1,Q=!1,Ec=RegExp(`^([ \\t]{0,3})([-*+]|\\d+[.)])[ \\t]+(\`{3,}|~{3,})(${[`elicitation`,`choice-buttons`,`search-results`,`compose-block`,`dataframe`,`chart-json`].join(`|`)})([^\\n]*)$`,`gim`);function Dc(e){return e.replace(Ec,`$1$3$4$5`)}function $(e,t){let n=Nr(e,t),r=t?y(t):``,i=v(`code.copy`)||`Copy`;return`<div class="code-block"><div class="code-header"><span class="code-lang">${r}</span><button class="code-copy-btn" type="button" aria-label="${y(i)}">${y(i)}</button></div><pre><code class="hljs${t?` language-${y(t)}`:``}">${n}</code></pre></div>`}function Oc(e){let t=e.trim();if(!t)return``;if(t.startsWith(`{`))try{let e=JSON.parse(t);return typeof e.id==`string`?e.id.trim():``}catch{return``}return t}function kc(){if(Tc)return!0;let e=new n;return e.code=function({text:e,lang:t}){let n=t?.trim().toLowerCase();if(n===`mermaid`)return`<div class="mermaid-container mermaid-pending" data-mermaid-code-raw="${encodeURIComponent(e)}" role="status" aria-label="Diagram loading">
145
+ <div class="mermaid-skeleton">
146
+ <div class="mermaid-skeleton-spinner"></div>
147
+ <div class="mermaid-skeleton-text">Rendering diagram…</div>
148
+ </div>
149
+ </div>`;if(n===`diagram-html`)return`<div class="diagram-widget-pending" data-diagram-html="${btoa(unescape(encodeURIComponent(e)))}"
150
+ role="status" aria-label="Interactive widget loading">
151
+ <div class="diagram-spinner"></div>
152
+ </div>`;if(n===`diagram-file`){let n=Oc(e);return n?`<div class="diagram-widget-pending" data-widget-id="${y(n)}"
153
+ role="status" aria-label="Interactive widget loading">
154
+ <div class="diagram-spinner"></div>
155
+ </div>`:$(e,t)}return n===`elicitation`||n===`choice-buttons`?Q?$(e,t):Ia(e,n):n===`search-results`?Q?$(e,t):fo(e):n===`compose-block`?Q?$(e,t):No(e):n===`dataframe`?Q?$(e,t):hs(e):n===`chart-json`?Q?$(e,t):Ns(e):n===`diff`||!n&&hc(e)?vc(e):$(e,t)},e.image=function({href:e,title:t,text:n}){if(!e)return``;let r;r=e.includes(`/uploads/`)?`${m}/media/${encodeURIComponent(e.split(`/`).pop())}`:e.startsWith(`/`)?`${m}/api/image?path=${encodeURIComponent(e)}`:y(e);let i=y(n||``),a=t?` title="${y(t)}"`:``,o=(e.split(/[?#]/)[0].split(`.`).pop()||``).toLowerCase();return[`mp4`,`webm`,`mov`,`ogg`].includes(o)?`<video src="${r}" controls class="chat-inline-video" preload="metadata"${a}></video>`:`<img src="${r}" alt="${i}" class="chat-inline-img" loading="lazy"${a} />`},e.link=function({href:e,title:t,text:n}){return`<a href="${y(e||``)}" target="_blank" rel="noopener noreferrer"${t?` title="${y(t)}"`:``}>${n}</a>`},t.setOptions({renderer:e,gfm:!0,breaks:!1}),Tc=!0,!0}function Ac(e,n=!1){let r=ar(e);if(!r)return`<em class="text-dim orchestrate-placeholder">`+y(v(`orchestrator.dispatching`))+`</em>`;let i=Dc(r).replace(/\n{3,}/g,`
156
+
157
+ `),a=wc(i),{text:o,fences:s}=$n(i),{text:c,blocks:l}=tr(o,n),{text:u,blocks:ee}=or(er(c,s));Mr(),kc();let d=Zn(u),f=``;Q=n||a;try{f=t.parse(d)}finally{Q=!1}return f=f.replace(/<table/g,`<div class="table-wrapper"><table`).replace(/<\/table>/g,`</table></div>`),f=sr(f,ee,n),f=ue(f),f=Or(f,l),n||ac(),fc(),f}export{gr as A,Wr as C,yr as D,Lr as E,Yn as F,Gn as I,Jn as L,y as M,ar as N,S as O,Xn as P,v as R,k as S,Hr as T,Li as _,bs as a,O as b,Ra as c,ka as d,Aa as f,ca as g,_a as h,Hs as i,mr as j,hr as k,I as l,va as m,oc as n,Bo as o,L as p,ic as r,ho as s,Ac as t,ga as u,$r as v,Ur as w,ui as x,si as y};
@@ -0,0 +1 @@
1
+ import{a as e,d as t,p as n}from"./settings-core-DWYQIIoe.js";import"./settings-DpjZSu2J.js";export{e as loadSettings,t as savePerCli,n as updateSettings};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./state-DxpgDKMO.js";import{i as t,n}from"./api-tVoG39dL.js";import{M as r,O as i,R as a}from"./render-fKAuISeM.js";import{r as o}from"./locale-DC-ZsWOf.js";import{r as s,t as c}from"./settings-types-DPhhM-cj.js";import"./settings-core-DqKyyxbQ.js";import{n as l,r as u}from"./provider-icons-CXA2mnPO.js";var d=new Set([`ai-e`,`codex-app`]),f=new Set([`ai-e`,`claude-e`,`jwc`,`pi`,`gemini`]),p={},m={cursor:{title:`Enable quota bars (dashboard session)`,description:`Cursor does not expose quota via its CLI. To display usage bars, log in with cursor-agent or manually export your session token from cursor.com DevTools (Application → Cookies → WorkosCursorSessionToken).`,commands:[`cursor-agent login`,`export CURSOR_SESSION_TOKEN="<WorkosCursorSessionToken from cursor.com DevTools>"`,`echo "$CURSOR_SESSION_TOKEN" > ~/.cli-jaw/quota/cursor-session-token && chmod 600 ~/.cli-jaw/quota/cursor-session-token`]},agy:{title:`Enable Gem / Cla quota bars`,description:`Antigravity wraps Google Gemini and Claude models. Log in with antigravity-usage to fetch your remaining Gem/Cla tier quotas.`,commands:[`npx antigravity-usage login`,`npx antigravity-usage --json`]},grok:{title:`Grok login`,description:`Authenticate with Grok (X/Twitter AI) to enable quota tracking and model access through the progrok proxy.`,commands:[`progrok login`]},opencode:{title:`OpenCode Go quota (API key)`,description:`cli-jaw reads your sk- API key from ~/.local/share/opencode/auth.json (opencode-go) or OPENCODE_GO_API_KEY, then calls GET /zen/go/v1/usage. The usage endpoint is not deployed yet — quota bars appear when upstream ships it. Your key still works for models/chat.`,commands:[`opencode providers login`,`export OPENCODE_GO_API_KEY=sk-...`,`curl -s -H "Authorization: Bearer $OPENCODE_GO_API_KEY" https://opencode.ai/zen/go/v1/usage`],note:`Not the opencode-quota plugin (cookie scrape). Built-in opencode stats = session tokens only.`,links:[{label:`OpenCode Go docs`,url:`https://opencode.ai/docs/go/`},{label:`Upstream usage API issue #16017`,url:`https://github.com/anomalyco/opencode/issues/16017`},{label:`Upstream usage API PR #16513`,url:`https://github.com/anomalyco/opencode/pull/16513`},{label:`slkiser/opencode-quota (cookie workaround)`,url:`https://github.com/slkiser/opencode-quota`},{label:`robinebers/openusage (local cost estimate)`,url:`https://github.com/robinebers/openusage`},{label:`Rodowen/oc-go-monitor (cookie + /usage)`,url:`https://github.com/Rodowen/oc-go-monitor`}]}};function h(e,t){return e===`gemini`?t===`Pro`||t===`P`?`P`:t===`Flash`||t===`F`?`F`:t:e===`copilot`&&(t===`Premium`||t===`Prem`||t.includes(`plus monthly subscriber quota`))?`30d`:t.replace(`-hour`,`h`).replace(`-day`,`d`).replace(` Sonnet`,``).replace(` Opus`,``)}function g(e,t){if(t.delegatedProvider)return`Delegates quota/status to ${t.delegatedProvider}`;let n=t.quotaSource?.match(/^not-exposed-by-(.*?)-cli$/);return n?`Quota not exposed by ${n[1].toUpperCase()} CLI`:t.quotaSource?t.quotaSource:e===`opencode`?`Auth/status only`:`Usage data not exposed by this CLI`}function _(e){return e.toLowerCase().replace(/^cursor\s+/i,``).trim()}var v=new Set([`auth/status only`,`google cloud code`,`runtime-checked`]),y=new Set([`cursor`,`antigravity.google`,`antigravity`,`max`,`copilot`,`gemini`]);function b(e,t){let n=t.account;if(!n)return[];let r=[];n.email&&r.push(n.email);let i=new Set(r.map(_));for(let e of[n.plan,n.tier]){if(!e)continue;let t=_(e);if(!(!t||v.has(t))&&!y.has(t)&&!i.has(t)){i.add(t),r.push(e);break}}return r}function x(e,t,n=[]){let i=m[e],a=[...n,...i?i.commands:[],...i?.note?[i.note]:[]].filter(Boolean);return a.length?`<button type="button" class="help-trigger" style="margin-left:4px" data-cli-help="${r(a.join(`
1
+ import{t as e}from"./state-DxpgDKMO.js";import{i as t,n}from"./api-tVoG39dL.js";import{M as r,O as i,R as a}from"./render-Cc0Y43E3.js";import{r as o}from"./locale-DC-ZsWOf.js";import{r as s,t as c}from"./settings-types-DPhhM-cj.js";import"./settings-core-DWYQIIoe.js";import{n as l,r as u}from"./provider-icons-CXA2mnPO.js";var d=new Set([`ai-e`,`codex-app`]),f=new Set([`ai-e`,`claude-e`,`jwc`,`pi`,`gemini`]),p={},m={cursor:{title:`Enable quota bars (dashboard session)`,description:`Cursor does not expose quota via its CLI. To display usage bars, log in with cursor-agent or manually export your session token from cursor.com DevTools (Application → Cookies → WorkosCursorSessionToken).`,commands:[`cursor-agent login`,`export CURSOR_SESSION_TOKEN="<WorkosCursorSessionToken from cursor.com DevTools>"`,`echo "$CURSOR_SESSION_TOKEN" > ~/.cli-jaw/quota/cursor-session-token && chmod 600 ~/.cli-jaw/quota/cursor-session-token`]},agy:{title:`Enable Gem / Cla quota bars`,description:`Antigravity wraps Google Gemini and Claude models. Log in with antigravity-usage to fetch your remaining Gem/Cla tier quotas.`,commands:[`npx antigravity-usage login`,`npx antigravity-usage --json`]},grok:{title:`Grok login`,description:`Authenticate with Grok (X/Twitter AI) to enable quota tracking and model access through the progrok proxy.`,commands:[`progrok login`]},opencode:{title:`OpenCode Go quota (API key)`,description:`cli-jaw reads your sk- API key from ~/.local/share/opencode/auth.json (opencode-go) or OPENCODE_GO_API_KEY, then calls GET /zen/go/v1/usage. The usage endpoint is not deployed yet — quota bars appear when upstream ships it. Your key still works for models/chat.`,commands:[`opencode providers login`,`export OPENCODE_GO_API_KEY=sk-...`,`curl -s -H "Authorization: Bearer $OPENCODE_GO_API_KEY" https://opencode.ai/zen/go/v1/usage`],note:`Not the opencode-quota plugin (cookie scrape). Built-in opencode stats = session tokens only.`,links:[{label:`OpenCode Go docs`,url:`https://opencode.ai/docs/go/`},{label:`Upstream usage API issue #16017`,url:`https://github.com/anomalyco/opencode/issues/16017`},{label:`Upstream usage API PR #16513`,url:`https://github.com/anomalyco/opencode/pull/16513`},{label:`slkiser/opencode-quota (cookie workaround)`,url:`https://github.com/slkiser/opencode-quota`},{label:`robinebers/openusage (local cost estimate)`,url:`https://github.com/robinebers/openusage`},{label:`Rodowen/oc-go-monitor (cookie + /usage)`,url:`https://github.com/Rodowen/oc-go-monitor`}]}};function h(e,t){return e===`gemini`?t===`Pro`||t===`P`?`P`:t===`Flash`||t===`F`?`F`:t:e===`copilot`&&(t===`Premium`||t===`Prem`||t.includes(`plus monthly subscriber quota`))?`30d`:t.replace(`-hour`,`h`).replace(`-day`,`d`).replace(` Sonnet`,``).replace(` Opus`,``)}function g(e,t){if(t.delegatedProvider)return`Delegates quota/status to ${t.delegatedProvider}`;let n=t.quotaSource?.match(/^not-exposed-by-(.*?)-cli$/);return n?`Quota not exposed by ${n[1].toUpperCase()} CLI`:t.quotaSource?t.quotaSource:e===`opencode`?`Auth/status only`:`Usage data not exposed by this CLI`}function _(e){return e.toLowerCase().replace(/^cursor\s+/i,``).trim()}var v=new Set([`auth/status only`,`google cloud code`,`runtime-checked`]),y=new Set([`cursor`,`antigravity.google`,`antigravity`,`max`,`copilot`,`gemini`]);function b(e,t){let n=t.account;if(!n)return[];let r=[];n.email&&r.push(n.email);let i=new Set(r.map(_));for(let e of[n.plan,n.tier]){if(!e)continue;let t=_(e);if(!(!t||v.has(t))&&!y.has(t)&&!i.has(t)){i.add(t),r.push(e);break}}return r}function x(e,t,n=[]){let i=m[e],a=[...n,...i?i.commands:[],...i?.note?[i.note]:[]].filter(Boolean);return a.length?`<button type="button" class="help-trigger" style="margin-left:4px" data-cli-help="${r(a.join(`
2
2
  `))}"${i?.description?` data-cli-help-desc="${r(i.description)}"`:``}${i?.links?.length?` data-cli-help-links="${r(JSON.stringify(i.links))}"`:``} aria-label="Setup help">?</button>`:``}function ee(e,t){let n=m[e],i=t.sessionUsage,a=[];i?.primaryModelId&&a.push(`Model: ${i.primaryModelId}`),i?.contextTokensUsed&&i?.contextWindowTokens?a.push(`Session context: ${Math.round(i.contextTokensUsed).toLocaleString()} / ${Math.round(i.contextWindowTokens).toLocaleString()} tokens`):i?.turnCount&&a.push(`Session turns: ${Math.round(i.turnCount).toLocaleString()}`);let o=x(e,t,a);if(n){let e=n.commands.map(e=>`
3
3
  <div style="margin-top:3px"><code style="font-size:10px;background:var(--border);padding:1px 4px;border-radius:2px;word-break:break-all">${r(e)}</code></div>
4
4
  `).join(``),t=n.description?`<div style="margin-top:3px;color:var(--text-dim);font-size:10px">${r(n.description)}</div>`:``,i=n.links?.length?`<ul style="margin:6px 0 0;padding-left:16px;font-size:10px">${n.links.map(e=>`<li><a href="${r(e.url)}" target="_blank" rel="noopener noreferrer">${r(e.label)}</a></li>`).join(``)}</ul>`:``;return`
@@ -0,0 +1 @@
1
+ import{d as e,l as t}from"./settings-core-DWYQIIoe.js";export{t as refreshHeaderFromSettingsChange,e as savePerCli};
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n,r,t as i}from"./api-tVoG39dL.js";import{D as a,M as o,O as s,R as c,x as l}from"./render-fKAuISeM.js";import{n as u}from"./locale-DC-ZsWOf.js";import{a as d,i as f,n as p,o as m,t as h}from"./constants-BfYYzHNr.js";import{i as ee}from"./settings-types-DPhhM-cj.js";import{a as te,c as ne,l as re,u as ie}from"./pi-settings-DEuKgvIj.js";import{n as ae,r as oe}from"./provider-icons-CXA2mnPO.js";function se(e){let n=document.getElementById(`sttEngine`),r=document.getElementById(`sttGeminiKey`),i=document.getElementById(`sttGeminiModel`),a=document.getElementById(`sttGeminiModelCustom`),o=document.getElementById(`sttWhisperModel`),s=document.getElementById(`sttOpenaiBaseUrl`),c=document.getElementById(`sttOpenaiKey`),l=document.getElementById(`sttOpenaiModel`),u=document.getElementById(`sttVertexJson`);if(n&&(n.value=e.engine||`auto`),r&&(r.placeholder=e.geminiKeySet?g(e.geminiKeyLast4):`AIza...`),i){let t=e.geminiModel||`gemini-2.5-flash-lite`;Array.from(i.options).some(e=>e.value===t)?i.value=t:(i.value=`__custom__`,a&&(a.value=t,a.style.display=``))}o&&(o.value=e.whisperModel||`mlx-community/whisper-large-v3-turbo`),s&&(s.value=e.openaiBaseUrl||``),c&&(c.placeholder=e.openaiKeySet?g(e.openaiKeyLast4):`sk-...`),l&&(l.value=e.openaiModel||``),u&&(u.value=e.vertexConfig||``);function d(){let e=n?.value||`auto`,t=e===`auto`||e===`gemini`,r=e===`openai`,i=e===`vertex`,a=e===`auto`||e===`whisper`;document.querySelectorAll(`.stt-gemini`).forEach(e=>e.style.display=t?``:`none`),document.querySelectorAll(`.stt-openai`).forEach(e=>e.style.display=r?``:`none`),document.querySelectorAll(`.stt-vertex`).forEach(e=>e.style.display=i?``:`none`),document.querySelectorAll(`.stt-whisper`).forEach(e=>e.style.display=a?``:`none`)}d();async function f(){let e={stt:{engine:n?.value||`auto`,geminiModel:(i?.value===`__custom__`?a?.value:i?.value)||`gemini-2.5-flash-lite`,whisperModel:o?.value||``,openaiBaseUrl:s?.value||``,openaiModel:l?.value||``,vertexConfig:u?.value||``}};r?.value&&(e.stt.geminiApiKey=r.value),c?.value&&(e.stt.openaiApiKey=c.value),console.log(`[stt] saving:`,{engine:e.stt.engine,hasGeminiKey:!!e.stt.geminiApiKey,hasOpenaiKey:!!e.stt.openaiApiKey});try{if(await t(`/api/settings`,`PUT`,e),r?.value){let e=r.value.slice(-4);r.value=``,r.placeholder=g(e)}if(c?.value){let e=c.value.slice(-4);c.value=``,c.placeholder=g(e)}}catch(e){console.error(`[stt] save failed:`,e)}}n?.addEventListener(`change`,()=>{d(),f()}),i?.addEventListener(`change`,()=>{a&&(a.style.display=i.value===`__custom__`?``:`none`),i.value!==`__custom__`&&f()}),a?.addEventListener(`blur`,f),r?.addEventListener(`blur`,()=>{r.value&&f()}),c?.addEventListener(`blur`,()=>{c.value&&f()}),s?.addEventListener(`blur`,f),l?.addEventListener(`blur`,f),o?.addEventListener(`blur`,f),u?.addEventListener(`blur`,f)}function g(e){return c(`stt.key.savedPlaceholder`,{last4:e||``})}function ce(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.configured==`boolean`&&typeof t.activeInbound==`boolean`&&typeof t.sendCapable==`boolean`}function le(e){return e===`telegram`||e===`discord`||e===`slack`}function ue(e){if(!e||typeof e!=`object`)return null;let t=e.channels;if(!t||typeof t!=`object`)return null;let n=t,r=n.activeInboundChannels,i;if(r!==void 0)i=Array.isArray(r)&&r.every(le)?[...new Set(r)]:null;else{let e=n.activeInbound;i=le(e)?[e]:null}if(!i)return null;let a=n.activeInbound;if(!le(a)||!ce(n.telegram)||!ce(n.discord))return null;let o=ce(n.slack)?n.slack:{configured:!1,activeInbound:!1,sendCapable:!1,reason:`unavailable`};return{activeInbound:a,activeInboundChannels:i,telegram:n.telegram,discord:n.discord,slack:o}}function de(e){let t=[];return t.push(e.configured?c(`settings.channel.configured`):c(`settings.channel.notConfigured`)),e.sendCapable&&t.push(c(`settings.channel.sendCapable`)),e.activeInbound&&t.push(c(`settings.channel.activeInbound`)),t}function fe(e,t,n){let r=de(t).map(e=>`<span class="transport-status-chip">${o(e)}</span>`).join(``),i=t.reason===`not_attach_instance`?`<p class="transport-status-hint">${o(c(`settings.channel.notAttachInstanceHint`))}</p>`:n&&t.configured&&t.sendCapable&&!t.activeInbound?`<p class="transport-status-hint">${o(c(`settings.channel.sendOnlyHint`))}</p>`:``;return`
1
+ import{a as e,i as t,n,r,t as i}from"./api-tVoG39dL.js";import{D as a,M as o,O as s,R as c,x as l}from"./render-Cc0Y43E3.js";import{n as u}from"./locale-DC-ZsWOf.js";import{a as d,i as f,n as p,o as m,t as h}from"./constants-BfYYzHNr.js";import{i as ee}from"./settings-types-DPhhM-cj.js";import{a as te,c as ne,l as re,u as ie}from"./pi-settings-DEuKgvIj.js";import{n as ae,r as oe}from"./provider-icons-CXA2mnPO.js";function se(e){let n=document.getElementById(`sttEngine`),r=document.getElementById(`sttGeminiKey`),i=document.getElementById(`sttGeminiModel`),a=document.getElementById(`sttGeminiModelCustom`),o=document.getElementById(`sttWhisperModel`),s=document.getElementById(`sttOpenaiBaseUrl`),c=document.getElementById(`sttOpenaiKey`),l=document.getElementById(`sttOpenaiModel`),u=document.getElementById(`sttVertexJson`);if(n&&(n.value=e.engine||`auto`),r&&(r.placeholder=e.geminiKeySet?g(e.geminiKeyLast4):`AIza...`),i){let t=e.geminiModel||`gemini-2.5-flash-lite`;Array.from(i.options).some(e=>e.value===t)?i.value=t:(i.value=`__custom__`,a&&(a.value=t,a.style.display=``))}o&&(o.value=e.whisperModel||`mlx-community/whisper-large-v3-turbo`),s&&(s.value=e.openaiBaseUrl||``),c&&(c.placeholder=e.openaiKeySet?g(e.openaiKeyLast4):`sk-...`),l&&(l.value=e.openaiModel||``),u&&(u.value=e.vertexConfig||``);function d(){let e=n?.value||`auto`,t=e===`auto`||e===`gemini`,r=e===`openai`,i=e===`vertex`,a=e===`auto`||e===`whisper`;document.querySelectorAll(`.stt-gemini`).forEach(e=>e.style.display=t?``:`none`),document.querySelectorAll(`.stt-openai`).forEach(e=>e.style.display=r?``:`none`),document.querySelectorAll(`.stt-vertex`).forEach(e=>e.style.display=i?``:`none`),document.querySelectorAll(`.stt-whisper`).forEach(e=>e.style.display=a?``:`none`)}d();async function f(){let e={stt:{engine:n?.value||`auto`,geminiModel:(i?.value===`__custom__`?a?.value:i?.value)||`gemini-2.5-flash-lite`,whisperModel:o?.value||``,openaiBaseUrl:s?.value||``,openaiModel:l?.value||``,vertexConfig:u?.value||``}};r?.value&&(e.stt.geminiApiKey=r.value),c?.value&&(e.stt.openaiApiKey=c.value),console.log(`[stt] saving:`,{engine:e.stt.engine,hasGeminiKey:!!e.stt.geminiApiKey,hasOpenaiKey:!!e.stt.openaiApiKey});try{if(await t(`/api/settings`,`PUT`,e),r?.value){let e=r.value.slice(-4);r.value=``,r.placeholder=g(e)}if(c?.value){let e=c.value.slice(-4);c.value=``,c.placeholder=g(e)}}catch(e){console.error(`[stt] save failed:`,e)}}n?.addEventListener(`change`,()=>{d(),f()}),i?.addEventListener(`change`,()=>{a&&(a.style.display=i.value===`__custom__`?``:`none`),i.value!==`__custom__`&&f()}),a?.addEventListener(`blur`,f),r?.addEventListener(`blur`,()=>{r.value&&f()}),c?.addEventListener(`blur`,()=>{c.value&&f()}),s?.addEventListener(`blur`,f),l?.addEventListener(`blur`,f),o?.addEventListener(`blur`,f),u?.addEventListener(`blur`,f)}function g(e){return c(`stt.key.savedPlaceholder`,{last4:e||``})}function ce(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.configured==`boolean`&&typeof t.activeInbound==`boolean`&&typeof t.sendCapable==`boolean`}function le(e){return e===`telegram`||e===`discord`||e===`slack`}function ue(e){if(!e||typeof e!=`object`)return null;let t=e.channels;if(!t||typeof t!=`object`)return null;let n=t,r=n.activeInboundChannels,i;if(r!==void 0)i=Array.isArray(r)&&r.every(le)?[...new Set(r)]:null;else{let e=n.activeInbound;i=le(e)?[e]:null}if(!i)return null;let a=n.activeInbound;if(!le(a)||!ce(n.telegram)||!ce(n.discord))return null;let o=ce(n.slack)?n.slack:{configured:!1,activeInbound:!1,sendCapable:!1,reason:`unavailable`};return{activeInbound:a,activeInboundChannels:i,telegram:n.telegram,discord:n.discord,slack:o}}function de(e){let t=[];return t.push(e.configured?c(`settings.channel.configured`):c(`settings.channel.notConfigured`)),e.sendCapable&&t.push(c(`settings.channel.sendCapable`)),e.activeInbound&&t.push(c(`settings.channel.activeInbound`)),t}function fe(e,t,n){let r=de(t).map(e=>`<span class="transport-status-chip">${o(e)}</span>`).join(``),i=t.reason===`not_attach_instance`?`<p class="transport-status-hint">${o(c(`settings.channel.notAttachInstanceHint`))}</p>`:n&&t.configured&&t.sendCapable&&!t.activeInbound?`<p class="transport-status-hint">${o(c(`settings.channel.sendOnlyHint`))}</p>`:``;return`
2
2
  <div class="transport-status-block">
3
3
  <div class="transport-status-label">${o(e)}</div>
4
4
  <div class="transport-status-chips">${r}</div>
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-render-kIxHrxDV.css"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./state-DxpgDKMO.js";import{i as t,t as n}from"./api-tVoG39dL.js";import{t as r}from"./preload-helper-DFYRRz9w.js";import{D as i,F as a,M as o,O as s,R as c,d as ee,n as te}from"./render-fKAuISeM.js";import{_ as ne,g as re,p as ie}from"./iframe-renderer-eozJpgjk.js";import{_ as ae,d as oe,u as l,v as u}from"./message-history-B_fIGorC.js";import{a as d,d as se,i as ce,l as f,n as le,r as ue,s as de,t as fe,u as pe}from"./ui-C62w6bJS.js";var p=null,m=0,h=[],g=2e3,me=3e4,he=1.5,_=null,ge=4e4,_e=1e4,ve=0,ye=!1,be=null,xe=null;function Se(e){xe=e}function Ce(){let e=null;try{e=xe?.()??null}catch{e=null}return e?`&scope=${encodeURIComponent(e)}`:``}function we(){be||=setInterval(()=>{!p||!v||!ye||Date.now()-ve<=ge||(console.warn(`[sse] stalled channel (no ping in`,ge,`ms) — forcing reconnect`),p.close(),p=null,v=!1,x?.(),C(Te))},_e)}var Te=``,v=!1,Ee=!1,De=!1,y=!1,b=!1,Oe=null,x=null,S=null;function ke(e){Oe=e}function Ae(e){x=e}function je(e){S=e}function Me(e,t,n){let r={topic:e,event:t,handler:n};return h.push(r),()=>{let e=h.indexOf(r);e>=0&&h.splice(e,1)}}function Ne(e,t,n){for(let r of h)if((r.topic===`*`||r.topic===e)&&(r.event===null||r.event===t))try{r.handler(n)}catch(e){console.warn(`[sse] handler error:`,e.message)}}function Pe(){Ee||_||(_=setTimeout(()=>{_=null,C(Te)},g),g=Math.min(g*he,me))}function C(e){Te=e,Ee=!1,_&&=(clearTimeout(_),null),p&&p.close();let t=`${n}/api/events?lang=${encodeURIComponent(e)}`+Ce()+(m?`&lastEventId=${m}`:``);y=!1,b=!1,p=new EventSource(t),we(),p.onopen=()=>{g=2e3,v=!0,De=!0,y=!0,ve=Date.now(),Oe?.()},p.onerror=()=>{if(p?.close(),p=null,!y&&!De&&S){b||(b=!0,S());return}v&&(v=!1,x?.()),Pe()},p.onmessage=e=>{m=parseInt(e.lastEventId||`0`,10)||m;let t;try{t=JSON.parse(e.data)}catch{console.warn(`[sse] malformed message:`,e.data);return}if(!t||typeof t!=`object`||typeof t.topic!=`string`||typeof t.event!=`string`){console.warn(`[sse] invalid message shape:`,t);return}if(ve=Date.now(),t.topic===`system`&&t.event===`ping`){ye=!0;return}Ne(t.topic,t.event,t)}}var Fe=3e3,w=new Map,T=[],E=(e,t)=>`${e}:${t}`;function D(e=[]){let t=document.getElementById(`pendingQueue`);if(t){if(T=e.slice(),!e.length){Be(new Set),t.classList.remove(`visible`),t.innerHTML=``;return}t.classList.add(`visible`),t.innerHTML=`
2
+ import{t as e}from"./state-DxpgDKMO.js";import{i as t,t as n}from"./api-tVoG39dL.js";import{t as r}from"./preload-helper-DFYRRz9w.js";import{D as i,F as a,M as o,O as s,R as c,d as ee,n as te}from"./render-Cc0Y43E3.js";import{_ as ne,g as re,p as ie}from"./iframe-renderer-vuNrU6aI.js";import{_ as ae,d as oe,u as l,v as u}from"./message-history-CXg12lcd.js";import{a as d,d as se,i as ce,l as f,n as le,r as ue,s as de,t as fe,u as pe}from"./ui-xoW9x-Pz.js";var p=null,m=0,h=[],g=2e3,me=3e4,he=1.5,_=null,ge=4e4,_e=1e4,ve=0,ye=!1,be=null,xe=null;function Se(e){xe=e}function Ce(){let e=null;try{e=xe?.()??null}catch{e=null}return e?`&scope=${encodeURIComponent(e)}`:``}function we(){be||=setInterval(()=>{!p||!v||!ye||Date.now()-ve<=ge||(console.warn(`[sse] stalled channel (no ping in`,ge,`ms) — forcing reconnect`),p.close(),p=null,v=!1,x?.(),C(Te))},_e)}var Te=``,v=!1,Ee=!1,De=!1,y=!1,b=!1,Oe=null,x=null,S=null;function ke(e){Oe=e}function Ae(e){x=e}function je(e){S=e}function Me(e,t,n){let r={topic:e,event:t,handler:n};return h.push(r),()=>{let e=h.indexOf(r);e>=0&&h.splice(e,1)}}function Ne(e,t,n){for(let r of h)if((r.topic===`*`||r.topic===e)&&(r.event===null||r.event===t))try{r.handler(n)}catch(e){console.warn(`[sse] handler error:`,e.message)}}function Pe(){Ee||_||(_=setTimeout(()=>{_=null,C(Te)},g),g=Math.min(g*he,me))}function C(e){Te=e,Ee=!1,_&&=(clearTimeout(_),null),p&&p.close();let t=`${n}/api/events?lang=${encodeURIComponent(e)}`+Ce()+(m?`&lastEventId=${m}`:``);y=!1,b=!1,p=new EventSource(t),we(),p.onopen=()=>{g=2e3,v=!0,De=!0,y=!0,ve=Date.now(),Oe?.()},p.onerror=()=>{if(p?.close(),p=null,!y&&!De&&S){b||(b=!0,S());return}v&&(v=!1,x?.()),Pe()},p.onmessage=e=>{m=parseInt(e.lastEventId||`0`,10)||m;let t;try{t=JSON.parse(e.data)}catch{console.warn(`[sse] malformed message:`,e.data);return}if(!t||typeof t!=`object`||typeof t.topic!=`string`||typeof t.event!=`string`){console.warn(`[sse] invalid message shape:`,t);return}if(ve=Date.now(),t.topic===`system`&&t.event===`ping`){ye=!0;return}Ne(t.topic,t.event,t)}}var Fe=3e3,w=new Map,T=[],E=(e,t)=>`${e}:${t}`;function D(e=[]){let t=document.getElementById(`pendingQueue`);if(t){if(T=e.slice(),!e.length){Be(new Set),t.classList.remove(`visible`),t.innerHTML=``;return}t.classList.add(`visible`),t.innerHTML=`
3
3
  <div class="pending-queue-header">
4
4
  <span class="pending-queue-title">${s.hourglass} <span data-i18n="queue.pendingTitle">${o(c(`queue.pendingTitle`))}</span> <span class="pending-queue-count">${e.length}</span></span>
5
5
  </div>
@@ -12,7 +12,7 @@ import{t as e}from"./state-DxpgDKMO.js";import{i as t,t as n}from"./api-tVoG39dL
12
12
  <button class="pending-row-btn pending-row-copy" data-pending-action="copy" title="${i}" aria-label="${i}"><span class="pending-btn-content">${s.copy}</span></button>
13
13
  <button class="pending-row-btn pending-row-steer" data-pending-action="steer" data-i18n-title="queue.steer" title="${a}" aria-label="${a}"><span class="pending-arm-fill" aria-hidden="true"></span><span class="pending-btn-content"><span class="pending-steer-arrow" aria-hidden="true">↳</span><span class="pending-steer-label">${a}</span></span></button>
14
14
  <button class="pending-row-btn pending-row-delete" data-pending-action="delete" data-i18n-title="queue.delete" title="${ee}" aria-label="${ee}"><span class="pending-arm-fill" aria-hidden="true"></span><span class="pending-btn-content">${s.trash}</span></button>
15
- </div>`}function O(e,t){let n=document.querySelector(`.pending-row[data-pending-id="${CSS.escape(e)}"]`);return n?n.querySelector(`[data-pending-action="${t}"]`):null}function Le(e,t){let n=O(e,t);if(!n)return;n.classList.add(`armed`),n.setAttribute(`title`,c(`queue.cancelArm`));let r=n.querySelector(`.pending-arm-fill`);r&&(r.style.animation=`none`,r.offsetWidth,r.style.animation=``)}function Re(e,t){let n=O(e,t);n&&(n.classList.remove(`armed`),n.setAttribute(`title`,c(t===`steer`?`queue.steer`:`queue.delete`)))}function ze(){for(let e of w.values()){let t=O(e.id,e.action);t&&(t.classList.add(`armed`),t.setAttribute(`title`,c(`queue.cancelArm`)))}}function Be(e){for(let[t,n]of w)e.has(n.id)||(clearTimeout(n.timerId),w.delete(t))}function Ve(e,n){let r=E(e,n),i=setTimeout(()=>Ue(e,n),Fe);w.set(r,{id:e,action:n,timerId:i}),Le(e,n),n===`steer`&&t(`/api/orchestrate/queue/${encodeURIComponent(e)}/hold`,`POST`,{}).catch(()=>{})}function He(e,n){let r=E(e,n),i=w.get(r);i&&(clearTimeout(i.timerId),w.delete(r),Re(e,n),n===`steer`&&t(`/api/orchestrate/queue/${encodeURIComponent(e)}/hold`,`DELETE`,{}).catch(()=>{}))}async function Ue(e,n){w.delete(E(e,n));let r=n===`steer`?`/api/orchestrate/queue/${encodeURIComponent(e)}/steer`:`/api/orchestrate/queue/${encodeURIComponent(e)}`,i=n===`steer`?`POST`:`DELETE`;if(n===`steer`&&l(`running`),await t(r,i,{})==null){T=T.filter(t=>t.id!==e),D(T),n===`steer`&&U(`steer-fire-miss`).catch(()=>{});return}T=T.filter(t=>t.id!==e),D(T)}function We(e,t){if(w.has(E(e,t))){He(e,t);return}Ve(e,t)}function Ge(){let e=document.getElementById(`pendingQueue`);e&&e.addEventListener(`click`,async e=>{let t=e.target?.closest(`[data-pending-action]`);if(!t)return;let n=t.closest(`.pending-row`)?.dataset.pendingId;if(!n)return;let r=t.dataset.pendingAction;if(r===`copy`){let e=T.find(e=>e.id===n);if(e?.prompt&&(await i(e.prompt)).ok){let e=t.querySelector(`.pending-btn-content`);e&&(e.innerHTML=s.checkSimple,setTimeout(()=>{e.innerHTML=s.copy},600))}return}We(n,r===`steer`?`steer`:`delete`)})}var Ke=800,k=64,qe=`CLI-JAW`,A=!1,j=0,M=qe,N=null,Je=``,Ye=!1,Xe=0;function Ze(){return navigator}function Qe(){return document.visibilityState!==`visible`||!document.hasFocus()}function $e(e){return e-Xe<Ke}function et(){if(N)return N;let e=document.querySelector(`link[rel~="icon"]`);if(e)return N=e,Je=e.href||e.getAttribute(`href`)||``,e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.appendChild(t),N=t,Ye=!0,t}function tt(e){let t=document.createElement(`canvas`);t.width=k,t.height=k;let n=t.getContext(`2d`);return n?(n.clearRect(0,0,k,k),n.font=`44px "Apple Color Emoji", "Segoe UI Emoji", sans-serif`,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(`🦈`,28,36),n.beginPath(),n.arc(50,15,e>1?12:9,0,Math.PI*2),n.fillStyle=`#ff335f`,n.fill(),n.lineWidth=4,n.strokeStyle=`#ffffff`,n.stroke(),e>1&&(n.fillStyle=`#ffffff`,n.font=`bold 15px sans-serif`,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(String(Math.min(e,9)),50,16)),t.toDataURL(`image/png`)):Je}async function nt(e){let t=Ze();if(typeof t.setAppBadge==`function`)try{await t.setAppBadge(e)}catch{}}async function rt(){let e=Ze();if(typeof e.clearAppBadge==`function`)try{await e.clearAppBadge()}catch{}}function it(){document.title=`(${j}) ${M}`;let e=et();e&&(e.href=tt(j)),nt(j)}function at(){document.title=M}function ot(){if(N){if(Ye){N.remove(),N=null,Ye=!1;return}N.href=Je}}function st(){A||(A=!0,M=document.title||qe,et(),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&lt()}),window.addEventListener(`focus`,()=>lt()))}function ct(){if(!A||!Qe())return;let e=Date.now();$e(e)||(Xe=e,j+=1,it())}function lt(){!A||j===0||(j=0,Xe=0,at(),ot(),rt())}function ut(e,t){return!e||!t?!0:e===`all`||e===t}var P=[`I`,`P`,`A`,`B`,`C`],F=null;function dt(e,t,n){let r=P.indexOf(n);if(r<0)return;let i=e.getBoundingClientRect(),a=t.offsetWidth||36,o=document.getElementById(`dot-${n}`);if(!o)return;let s=P[r+1],c=s?document.getElementById(`dot-${s}`):null;if(c){let e=o.getBoundingClientRect(),n=c.getBoundingClientRect(),r=(e.right+n.left)/2;t.style.transform=`translateX(${r-i.left-a/2}px)`}else{let e=o.getBoundingClientRect();t.style.transform=`translateX(${e.left-i.left+e.width/2-a/2}px)`}}var I={},ft=8,pt=64,L=null,R=0,z=[],B=new Map;function mt(e){return e!==null&&z.includes(e)}function ht(e){let t=Number(e);return Number.isFinite(t)&&t>0?Math.floor(t):null}function gt(e,t){if(!(!e||t==null))for(t>(B.get(e)||0)&&B.set(e,t);B.size>pt;){let e=null;for(let t of B.keys())if(t!==L){e=t;break}if(!e)break;B.delete(e)}}function _t(e){let t=new Map;for(let n of e?.toolLog||[]){let e=typeof n?.traceRunId==`string`&&n.traceRunId?n.traceRunId:null,r=ht(n?.traceSeq);!e||r==null||r>(t.get(e)||0)&&t.set(e,r)}return t}function vt(e,t,n){return!n||!e||t==null?!1:t<=(B.get(e)||0)}function yt(e){let t=e??L;L=null,R=0,t&&!z.includes(t)&&(z.push(t),z.length>ft&&z.shift())}function bt(e){!e||e===L||(L=e,R=0)}function xt(e){if(e?.running){typeof e.traceRunId==`string`&&e.traceRunId&&(L=e.traceRunId),R=typeof e.textLen==`number`?e.textLen:(e.text||``).length;for(let[t,n]of _t(e))gt(t,n)}}var St=``,V=0,H=null,Ct=0,wt=!1,Tt=0,Et=750,Dt=750;async function Ot(e={}){let t=await(await fetch(`${n}/api/orchestrate/snapshot`)).json();St=String(t.orc.scope||``),Ht(t.orc.state),Ft(t.orc.ctx||null),Pt(t.heartbeat||{pending:0,deferredPending:0}),Nt(t.workers),oe(t.runtime.queuePending),le(t.queued||[]),D(t.queued||[]),e.hydrateRun&&(de(t.activeRun),xt(t.activeRun)),Bt(),t.runtime.busy?l(`running`):f()||l(`idle`),r(()=>import(`./employees-86F_D_Ce.js`).then(e=>{typeof e.renderEmployees==`function`&&e.renderEmployees()}),__vite__mapDeps([0]))}function U(e=`manual`,t={}){let n=Date.now();return t.hydrateRun?Ot(t):H||(n-Ct<Et?Promise.resolve():(Ct=n,H=Ot(t).catch(t=>{throw console.warn(`[ws] orchestrate snapshot sync failed (${e})`,t),t}).finally(()=>{H=null}),H))}function kt(e){return e===`iframe-visible`||e===`pageshow`||e===`discard`||e===`visibilitychange`}function At(e){re(e),r(()=>import(`./ui-CBErZPBp.js`).then(async t=>{if(kt(e)&&V>0)try{await t.loadMessages(),V=Date.now()}catch(t){console.warn(`[ws] restore loadMessages failed (${e})`,t)}await U(e,{hydrateRun:!0})}),__vite__mapDeps([0])).catch(()=>{}).finally(()=>{ie(e)})}function W(e){let t=Date.now();!kt(e)&&t-Tt<Dt||(Tt=t,At(e))}function jt(e){let t=Array.isArray(e.changedKeys)?e.changedKeys:[];if(t.includes(`multiSession`)){window.location.reload();return}t.includes(`workingDir`)||t.includes(`projectDirs`)?r(()=>import(`./ui-CBErZPBp.js`).then(async e=>{try{await e.loadMessages(),V=Date.now()}catch(e){console.warn(`[ws] settings scope loadMessages failed`,e)}await U(`settings_change`).catch(()=>{}).finally(()=>e.reconcileChatBottomAfterRestore(`settings_change`))}),__vite__mapDeps([0])):U(`settings_change`).catch(()=>{}),r(()=>import(`./settings-core-x7CmBZq1.js`).then(t=>t.refreshHeaderFromSettingsChange(e)),__vite__mapDeps([0])).catch(()=>{})}function Mt(){wt||(wt=!0,window.addEventListener(`focus`,()=>{W(`focus`)}),window.addEventListener(`pageshow`,e=>{e.persisted&&W(`pageshow`)}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&W(`visibilitychange`)}),document.addEventListener(`resume`,()=>{W(`resume`)}),`wasDiscarded`in document&&document.wasDiscarded&&W(`discard`),window.addEventListener(`message`,e=>{e.data?.type===`jaw-preview-visibility`&&e.data.visible&&W(`iframe-visible`)}))}function Nt(e){for(let e of Object.keys(I))delete I[e];for(let t of e)t.state===`running`&&t.phase&&(I[t.agentId]={phase:t.phase,phaseLabel:t.phaseLabel||``})}function Pt(t){let n={pending:Number(t?.pending||0),deferredPending:Number(t?.deferredPending||0),...t?.reason?{reason:t.reason}:{},...t?.policy?{policy:t.policy}:{},...t?.jobId?{jobId:t.jobId}:{},...t?.jobName?{jobName:t.jobName}:{}};e.heartbeatRuntime=n;let r=document.getElementById(`pabcHeartbeatStatus`);if(r)if(n.reason===`pabcd_active`&&n.deferredPending>0){let e=n.jobName?`: ${n.jobName}`:``;r.textContent=`heartbeat deferred (${n.deferredPending})${e}`,r.hidden=!1}else r.textContent=``,r.hidden=!0}function Ft(t){e.orcTaskAnchor=String(t?.taskAnchor||``).trim(),e.orcResolvedSelection=t?.resolvedSelection||null;let n=document.getElementById(`pabcTaskAnchor`);n&&(e.orcTaskAnchor?(n.textContent=`anchor: ${e.orcResolvedSelection?.index?`${e.orcResolvedSelection.index}. `:``}${e.orcTaskAnchor}`,n.hidden=!1):(n.textContent=``,n.hidden=!0),Rt(t?.interview||null))}var G=(()=>{try{return localStorage.getItem(`jaw:interviewCollapsed`)===`1`}catch{return!1}})();function It(e){G=e;try{localStorage.setItem(`jaw:interviewCollapsed`,e?`1`:`0`)}catch{}let t=document.getElementById(`interviewPanel`);if(!t)return;t.classList.toggle(`collapsed`,e);let n=t.querySelector(`.iv-toggle`);n&&n.setAttribute(`aria-expanded`,String(!e))}function Lt(e){let t=e=>{switch(e){case`max`:return 1;case`xhigh`:return .8;case`high`:return .6;case`medium`:return .4;default:return .2}},n=e=>{switch(e){case`max`:return`#2196f3`;case`xhigh`:return`#4caf50`;case`high`:return`#8bc34a`;case`medium`:return`#ff9800`;default:return`#f44336`}},r=[t(e.goal),t(e.constraint),t(e.success),t(e.ontology)],i=1-r.reduce((e,t)=>e+t,0)/r.length,a=Object.values(e).every(e=>e===`max`)||i<=.2?`🟢 Ready`:i<=.4?`🟡 Almost`:`🔴 Needs work`,o=(e,r)=>{let i=t(r);return`<div style="display:flex;align-items:center;gap:6px;font-size:12px">
15
+ </div>`}function O(e,t){let n=document.querySelector(`.pending-row[data-pending-id="${CSS.escape(e)}"]`);return n?n.querySelector(`[data-pending-action="${t}"]`):null}function Le(e,t){let n=O(e,t);if(!n)return;n.classList.add(`armed`),n.setAttribute(`title`,c(`queue.cancelArm`));let r=n.querySelector(`.pending-arm-fill`);r&&(r.style.animation=`none`,r.offsetWidth,r.style.animation=``)}function Re(e,t){let n=O(e,t);n&&(n.classList.remove(`armed`),n.setAttribute(`title`,c(t===`steer`?`queue.steer`:`queue.delete`)))}function ze(){for(let e of w.values()){let t=O(e.id,e.action);t&&(t.classList.add(`armed`),t.setAttribute(`title`,c(`queue.cancelArm`)))}}function Be(e){for(let[t,n]of w)e.has(n.id)||(clearTimeout(n.timerId),w.delete(t))}function Ve(e,n){let r=E(e,n),i=setTimeout(()=>Ue(e,n),Fe);w.set(r,{id:e,action:n,timerId:i}),Le(e,n),n===`steer`&&t(`/api/orchestrate/queue/${encodeURIComponent(e)}/hold`,`POST`,{}).catch(()=>{})}function He(e,n){let r=E(e,n),i=w.get(r);i&&(clearTimeout(i.timerId),w.delete(r),Re(e,n),n===`steer`&&t(`/api/orchestrate/queue/${encodeURIComponent(e)}/hold`,`DELETE`,{}).catch(()=>{}))}async function Ue(e,n){w.delete(E(e,n));let r=n===`steer`?`/api/orchestrate/queue/${encodeURIComponent(e)}/steer`:`/api/orchestrate/queue/${encodeURIComponent(e)}`,i=n===`steer`?`POST`:`DELETE`;if(n===`steer`&&l(`running`),await t(r,i,{})==null){T=T.filter(t=>t.id!==e),D(T),n===`steer`&&U(`steer-fire-miss`).catch(()=>{});return}T=T.filter(t=>t.id!==e),D(T)}function We(e,t){if(w.has(E(e,t))){He(e,t);return}Ve(e,t)}function Ge(){let e=document.getElementById(`pendingQueue`);e&&e.addEventListener(`click`,async e=>{let t=e.target?.closest(`[data-pending-action]`);if(!t)return;let n=t.closest(`.pending-row`)?.dataset.pendingId;if(!n)return;let r=t.dataset.pendingAction;if(r===`copy`){let e=T.find(e=>e.id===n);if(e?.prompt&&(await i(e.prompt)).ok){let e=t.querySelector(`.pending-btn-content`);e&&(e.innerHTML=s.checkSimple,setTimeout(()=>{e.innerHTML=s.copy},600))}return}We(n,r===`steer`?`steer`:`delete`)})}var Ke=800,k=64,qe=`CLI-JAW`,A=!1,j=0,M=qe,N=null,Je=``,Ye=!1,Xe=0;function Ze(){return navigator}function Qe(){return document.visibilityState!==`visible`||!document.hasFocus()}function $e(e){return e-Xe<Ke}function et(){if(N)return N;let e=document.querySelector(`link[rel~="icon"]`);if(e)return N=e,Je=e.href||e.getAttribute(`href`)||``,e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.appendChild(t),N=t,Ye=!0,t}function tt(e){let t=document.createElement(`canvas`);t.width=k,t.height=k;let n=t.getContext(`2d`);return n?(n.clearRect(0,0,k,k),n.font=`44px "Apple Color Emoji", "Segoe UI Emoji", sans-serif`,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(`🦈`,28,36),n.beginPath(),n.arc(50,15,e>1?12:9,0,Math.PI*2),n.fillStyle=`#ff335f`,n.fill(),n.lineWidth=4,n.strokeStyle=`#ffffff`,n.stroke(),e>1&&(n.fillStyle=`#ffffff`,n.font=`bold 15px sans-serif`,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(String(Math.min(e,9)),50,16)),t.toDataURL(`image/png`)):Je}async function nt(e){let t=Ze();if(typeof t.setAppBadge==`function`)try{await t.setAppBadge(e)}catch{}}async function rt(){let e=Ze();if(typeof e.clearAppBadge==`function`)try{await e.clearAppBadge()}catch{}}function it(){document.title=`(${j}) ${M}`;let e=et();e&&(e.href=tt(j)),nt(j)}function at(){document.title=M}function ot(){if(N){if(Ye){N.remove(),N=null,Ye=!1;return}N.href=Je}}function st(){A||(A=!0,M=document.title||qe,et(),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&lt()}),window.addEventListener(`focus`,()=>lt()))}function ct(){if(!A||!Qe())return;let e=Date.now();$e(e)||(Xe=e,j+=1,it())}function lt(){!A||j===0||(j=0,Xe=0,at(),ot(),rt())}function ut(e,t){return!e||!t?!0:e===`all`||e===t}var P=[`I`,`P`,`A`,`B`,`C`],F=null;function dt(e,t,n){let r=P.indexOf(n);if(r<0)return;let i=e.getBoundingClientRect(),a=t.offsetWidth||36,o=document.getElementById(`dot-${n}`);if(!o)return;let s=P[r+1],c=s?document.getElementById(`dot-${s}`):null;if(c){let e=o.getBoundingClientRect(),n=c.getBoundingClientRect(),r=(e.right+n.left)/2;t.style.transform=`translateX(${r-i.left-a/2}px)`}else{let e=o.getBoundingClientRect();t.style.transform=`translateX(${e.left-i.left+e.width/2-a/2}px)`}}var I={},ft=8,pt=64,L=null,R=0,z=[],B=new Map;function mt(e){return e!==null&&z.includes(e)}function ht(e){let t=Number(e);return Number.isFinite(t)&&t>0?Math.floor(t):null}function gt(e,t){if(!(!e||t==null))for(t>(B.get(e)||0)&&B.set(e,t);B.size>pt;){let e=null;for(let t of B.keys())if(t!==L){e=t;break}if(!e)break;B.delete(e)}}function _t(e){let t=new Map;for(let n of e?.toolLog||[]){let e=typeof n?.traceRunId==`string`&&n.traceRunId?n.traceRunId:null,r=ht(n?.traceSeq);!e||r==null||r>(t.get(e)||0)&&t.set(e,r)}return t}function vt(e,t,n){return!n||!e||t==null?!1:t<=(B.get(e)||0)}function yt(e){let t=e??L;L=null,R=0,t&&!z.includes(t)&&(z.push(t),z.length>ft&&z.shift())}function bt(e){!e||e===L||(L=e,R=0)}function xt(e){if(e?.running){typeof e.traceRunId==`string`&&e.traceRunId&&(L=e.traceRunId),R=typeof e.textLen==`number`?e.textLen:(e.text||``).length;for(let[t,n]of _t(e))gt(t,n)}}var St=``,V=0,H=null,Ct=0,wt=!1,Tt=0,Et=750,Dt=750;async function Ot(e={}){let t=await(await fetch(`${n}/api/orchestrate/snapshot`)).json();St=String(t.orc.scope||``),Ht(t.orc.state),Ft(t.orc.ctx||null),Pt(t.heartbeat||{pending:0,deferredPending:0}),Nt(t.workers),oe(t.runtime.queuePending),le(t.queued||[]),D(t.queued||[]),e.hydrateRun&&(de(t.activeRun),xt(t.activeRun)),Bt(),t.runtime.busy?l(`running`):f()||l(`idle`),r(()=>import(`./employees-qLLnQlAv.js`).then(e=>{typeof e.renderEmployees==`function`&&e.renderEmployees()}),__vite__mapDeps([0]))}function U(e=`manual`,t={}){let n=Date.now();return t.hydrateRun?Ot(t):H||(n-Ct<Et?Promise.resolve():(Ct=n,H=Ot(t).catch(t=>{throw console.warn(`[ws] orchestrate snapshot sync failed (${e})`,t),t}).finally(()=>{H=null}),H))}function kt(e){return e===`iframe-visible`||e===`pageshow`||e===`discard`||e===`visibilitychange`}function At(e){re(e),r(()=>import(`./ui-BZxyyJUk.js`).then(async t=>{if(kt(e)&&V>0)try{await t.loadMessages(),V=Date.now()}catch(t){console.warn(`[ws] restore loadMessages failed (${e})`,t)}await U(e,{hydrateRun:!0})}),__vite__mapDeps([0])).catch(()=>{}).finally(()=>{ie(e)})}function W(e){let t=Date.now();!kt(e)&&t-Tt<Dt||(Tt=t,At(e))}function jt(e){let t=Array.isArray(e.changedKeys)?e.changedKeys:[];if(t.includes(`multiSession`)){window.location.reload();return}t.includes(`workingDir`)||t.includes(`projectDirs`)?r(()=>import(`./ui-BZxyyJUk.js`).then(async e=>{try{await e.loadMessages(),V=Date.now()}catch(e){console.warn(`[ws] settings scope loadMessages failed`,e)}await U(`settings_change`).catch(()=>{}).finally(()=>e.reconcileChatBottomAfterRestore(`settings_change`))}),__vite__mapDeps([0])):U(`settings_change`).catch(()=>{}),r(()=>import(`./settings-core-Bkb0BoYY.js`).then(t=>t.refreshHeaderFromSettingsChange(e)),__vite__mapDeps([0])).catch(()=>{})}function Mt(){wt||(wt=!0,window.addEventListener(`focus`,()=>{W(`focus`)}),window.addEventListener(`pageshow`,e=>{e.persisted&&W(`pageshow`)}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&W(`visibilitychange`)}),document.addEventListener(`resume`,()=>{W(`resume`)}),`wasDiscarded`in document&&document.wasDiscarded&&W(`discard`),window.addEventListener(`message`,e=>{e.data?.type===`jaw-preview-visibility`&&e.data.visible&&W(`iframe-visible`)}))}function Nt(e){for(let e of Object.keys(I))delete I[e];for(let t of e)t.state===`running`&&t.phase&&(I[t.agentId]={phase:t.phase,phaseLabel:t.phaseLabel||``})}function Pt(t){let n={pending:Number(t?.pending||0),deferredPending:Number(t?.deferredPending||0),...t?.reason?{reason:t.reason}:{},...t?.policy?{policy:t.policy}:{},...t?.jobId?{jobId:t.jobId}:{},...t?.jobName?{jobName:t.jobName}:{}};e.heartbeatRuntime=n;let r=document.getElementById(`pabcHeartbeatStatus`);if(r)if(n.reason===`pabcd_active`&&n.deferredPending>0){let e=n.jobName?`: ${n.jobName}`:``;r.textContent=`heartbeat deferred (${n.deferredPending})${e}`,r.hidden=!1}else r.textContent=``,r.hidden=!0}function Ft(t){e.orcTaskAnchor=String(t?.taskAnchor||``).trim(),e.orcResolvedSelection=t?.resolvedSelection||null;let n=document.getElementById(`pabcTaskAnchor`);n&&(e.orcTaskAnchor?(n.textContent=`anchor: ${e.orcResolvedSelection?.index?`${e.orcResolvedSelection.index}. `:``}${e.orcTaskAnchor}`,n.hidden=!1):(n.textContent=``,n.hidden=!0),Rt(t?.interview||null))}var G=(()=>{try{return localStorage.getItem(`jaw:interviewCollapsed`)===`1`}catch{return!1}})();function It(e){G=e;try{localStorage.setItem(`jaw:interviewCollapsed`,e?`1`:`0`)}catch{}let t=document.getElementById(`interviewPanel`);if(!t)return;t.classList.toggle(`collapsed`,e);let n=t.querySelector(`.iv-toggle`);n&&n.setAttribute(`aria-expanded`,String(!e))}function Lt(e){let t=e=>{switch(e){case`max`:return 1;case`xhigh`:return .8;case`high`:return .6;case`medium`:return .4;default:return .2}},n=e=>{switch(e){case`max`:return`#2196f3`;case`xhigh`:return`#4caf50`;case`high`:return`#8bc34a`;case`medium`:return`#ff9800`;default:return`#f44336`}},r=[t(e.goal),t(e.constraint),t(e.success),t(e.ontology)],i=1-r.reduce((e,t)=>e+t,0)/r.length,a=Object.values(e).every(e=>e===`max`)||i<=.2?`🟢 Ready`:i<=.4?`🟡 Almost`:`🔴 Needs work`,o=(e,r)=>{let i=t(r);return`<div style="display:flex;align-items:center;gap:6px;font-size:12px">
16
16
  <span style="width:70px;color:var(--text-secondary)">${e}</span>
17
17
  <div style="flex:1;height:5px;background:var(--bg-tertiary);border-radius:3px">
18
18
  <div style="width:${i*100}%;height:100%;background:${n(r)};border-radius:3px;transition:width .3s"></div>
@@ -46,4 +46,4 @@ import{t as e}from"./state-DxpgDKMO.js";import{i as t,t as n}from"./api-tVoG39dL
46
46
  </div>`};n.innerHTML=`<div style="font-size:11px;font-weight:600;margin-bottom:4px;color:var(--text-secondary)">Build Budget</div>
47
47
  ${r(`Workers`,e.spent.workerDispatches,e.maxWorkerDispatches)}
48
48
  ${r(`Self-heal`,e.spent.selfHealRetries,e.maxSelfHealRetries)}
49
- ${r(`Verify`,e.spent.verificationRounds,e.maxVerificationRounds)}`}async function Bt(){try{let t=await fetch(`${n}/api/goal`);if(!t.ok)return;let r=await t.json();r.goal?e.activeGoal={id:r.goal.id,objective:r.goal.objective,status:r.goal.status,createdAt:r.goal.createdAt,updatedAt:r.goal.updatedAt,lastCheckpointSummary:r.goal.lastCheckpoint?.summary,nextAction:r.goal.lastCheckpoint?.nextAction}:e.activeGoal=null,Vt()}catch{}}function Vt(){let t=document.getElementById(`goalCockpit`);if(!t)return;let n=e.activeGoal;if(!n||n.status===`complete`||n.status===`cancelled`){t.hidden=!0,t.innerHTML=``;return}t.hidden=!1,t.replaceChildren();let r=n.status===`paused`?`paused`:n.status===`blocked`?`blocked`:`active`,i=document.createElement(`span`);i.className=`goal-objective`,i.title=n.objective,i.textContent=n.objective;let a=document.createElement(`span`);if(a.className=`goal-status goal-status--${r}`,a.textContent=n.status,t.append(i,a),n.nextAction){let e=document.createElement(`span`);e.className=`goal-next`,e.textContent=n.nextAction,t.append(e)}}function Ht(t,n){let r=new Set([`IDLE`,`I`,`P`,`A`,`B`,`C`,`D`]).has(t)?t:`IDLE`;if(e.orcState=r,r===`IDLE`||r===`D`)document.body.removeAttribute(`data-orc-state`),document.body.style.removeProperty(`--orc-glow`);else{document.body.setAttribute(`data-orc-state`,r);let e=`--orc-glow-${r}`,t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();document.body.style.setProperty(`--orc-glow`,t)}document.body.classList.add(`orc-pulse`),setTimeout(()=>document.body.classList.remove(`orc-pulse`),700);let i=document.getElementById(`orcStateBadge`);i&&(i.textContent={IDLE:``,I:`INTERVIEW`,P:`PLAN`,A:`AUDIT`,B:`BUILD`,C:`CHECK`,D:`DONE`}[r],i.style.display=r===`IDLE`?`none`:`inline-block`);let a=document.getElementById(`pabcRoadmap`),o=document.getElementById(`sharkRunner`),s=document.getElementById(`pabcBrand`);if(a&&o){if(!a.dataset.resizeObserved){a.dataset.resizeObserved=`1`,new ResizeObserver(()=>{F&&o.classList.contains(`running`)&&dt(a,o,F)}).observe(a);let e=0;window.addEventListener(`resize`,()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{F&&o.classList.contains(`running`)&&dt(a,o,F)})})}if(r===`IDLE`)a.classList.remove(`visible`,`shimmer-out`),o.classList.remove(`running`),F=null;else if(r===`D`){P.forEach(e=>{let t=document.getElementById(`dot-${e}`);t&&(t.className=`pabc-dot done`,t.setAttribute(`data-phase`,e))});for(let e=0;e<P.length;e++){let t=document.getElementById(`pabc-conn-${e}`);t&&(t.className=`pabc-connector done`)}o.classList.remove(`running`),F=null,a.classList.add(`shimmer-out`),setTimeout(()=>a.classList.remove(`visible`,`shimmer-out`),1e3)}else{a.classList.remove(`shimmer-out`),a.classList.add(`visible`),o.classList.add(`running`);let e=P.indexOf(r);P.forEach((t,n)=>{let r=document.getElementById(`dot-${t}`);r&&(r.className=`pabc-dot ${n<e?`done`:n===e?`active`:`future`}`,r.setAttribute(`data-phase`,t))});for(let t=0;t<P.length;t++){let n=document.getElementById(`pabc-conn-${t}`);n&&(n.className=`pabc-connector ${t<e?`done`:``}`)}F=r,requestAnimationFrame(()=>dt(a,o,r))}s&&n&&(s.textContent=n)}}var Ut=!1,Wt=Promise.resolve(),Gt=0;function K(){Mt(),Ut||(Ut=!0,tn()),$t(),C(a())}var Kt=K;function qt(e){console.log(`[${e}] connected`),X=2e3,Xt();let t=Date.now()-V<1e4;Wt=r(()=>import(`./ui-CBErZPBp.js`).then(async n=>{if(n.cleanupToolActivity(),!t)try{await n.loadMessages(),V=Date.now()}catch(t){console.error(`[${e}] loadMessages failed`,t)}await U(`reconnect`,{hydrateRun:!0}).catch(()=>{}).finally(()=>n.reconcileChatBottomAfterRestore(`reconnect`)),r(()=>import(`./memory-DfPbqPTD.js`).then(e=>e.refreshMemorySidebar()),__vite__mapDeps([0])).catch(()=>{}),r(()=>import(`./bgtask-badge-DLqpImpn.js`).then(e=>e.refreshBgtaskBadge()),__vite__mapDeps([0])).catch(()=>{})}),void 0)}function Jt(){re(`replay_gap`),Wt=r(()=>import(`./ui-CBErZPBp.js`).then(async e=>{try{await e.loadMessages(),V=Date.now()}catch(e){console.error(`[sse] replay gap loadMessages failed`,e)}await U(`replay_gap`,{hydrateRun:!0}).catch(()=>{}).finally(()=>e.reconcileChatBottomAfterRestore(`replay_gap`))}),__vite__mapDeps([0]))}var Yt=8e3,q=null;function Xt(){q!==null&&(window.clearTimeout(q),q=null)}function Zt(){console.log(`[channel] disconnected`),r(()=>import(`./ui-CBErZPBp.js`).then(e=>e.cleanupToolActivity()),__vite__mapDeps([0])),q===null&&(q=window.setTimeout(()=>{q=null,l(`idle`),u(`${s.exec} ${c(`ws.disconnected`)}`,`tool-activity`)},Yt))}var J=null,Y=!1,X=2e3,Qt=3e4;function $t(){if(J){Y=!0;try{J.close()}catch{}J=null}}function en(){if(J)return;console.warn(`[channel] /api/events unavailable — falling back to legacy WebSocket`);let e=`ws://${location.host}`,t=new WebSocket(`${e}${n}/?lang=${a()}`);J=t,Y=!1,t.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{console.warn(`[ws] malformed message:`,e.data);return}if(!t||typeof t!=`object`||typeof t.type!=`string`){console.warn(`[ws] invalid message shape:`,t);return}nn(t)};let r=!1;t.onopen=()=>{r=!0,X=2e3,qt(`ws`)},t.onclose=()=>{if(J===t&&(J=null),Y){Y=!1;return}if(r){Zt(),setTimeout(K,2e3);return}X=Math.min(X*2,Qt),setTimeout(K,X)}}function tn(){Me(`widget`,`widget_updated`,e=>{let t=e.chatId,n=e.widgetId;typeof t!=`string`||typeof n!=`string`||r(()=>import(`./iframe-renderer-C_swzquc.js`).then(e=>e.refreshFileWidget(t,n)),__vite__mapDeps([0])).catch(e=>console.warn(`[widget] refresh failed:`,e.message))}),Me(`*`,null,e=>{nn({...e,type:e.event})}),ke(()=>qt(`sse`)),Ae(()=>Zt()),je(()=>en())}function nn(t){if(t.type===`agent_tool`){if(f())return;let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null,n=ht(t.traceSeq);if(mt(e)||vt(e,n,t.sseReplay===!0))return;t.isEmployee!==!0&&bt(e);let r=t.toolType===`thinking`?`thinking`:t.toolType===`search`?`search`:t.toolType===`subagent`?`subagent`:`tool`;se({id:`step-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:r,icon:t.icon||s.tool,rawIcon:t.rawIcon||t.icon||``,label:t.label||``,isEmployee:t.isEmployee===!0,detail:t.detail||``,stepRef:t.stepRef||``,traceRunId:t.traceRunId||``,traceSeq:t.traceSeq,detailAvailable:t.detailAvailable,detailBytes:t.detailBytes,rawRetentionStatus:t.rawRetentionStatus,status:t.status||`running`,startTime:typeof t.startedAt==`number`&&t.startedAt>0?t.startedAt:Date.now()},typeof t.startedAt==`number`&&t.startedAt>0?t.startedAt:void 0),gt(e,n)}else if(t.type===`agent_output`||t.type===`agent_chunk`){if(f())return;let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null;if(mt(e))return;bt(e);let n=t.text||``;if(e&&typeof t.textLen==`number`){if(t.textLen<=R){t.sseReplay!==!0&&t.textLen<R&&(console.warn(`[ws] live agent_output behind applied cursor — resync (${t.textLen} < ${R})`),R=t.textLen);return}let e=t.textLen-R;e<n.length&&(n=n.slice(-e)),R=t.textLen}fe(n)}else if(t.type===`agent_status`){if(!t.running&&f())return;t.running&&f()&&ce(),t.running===void 0?l(t.status||`idle`):l(t.running?`running`:`idle`),t.agentId&&t.phase&&(I[t.agentId]={phase:t.phase,phaseLabel:t.phaseLabel||``},r(()=>import(`./employees-86F_D_Ce.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0])))}else if(t.type===`bgtask_update`)r(()=>import(`./bgtask-badge-DLqpImpn.js`).then(e=>e.applyBgtaskUpdate(t)),__vite__mapDeps([0])).catch(()=>{});else if(t.type===`queue_update`)oe(t.pending||0),Array.isArray(t.queued)&&D(t.queued),U(`queue_update`).catch(()=>{});else if(t.type===`agent_retry`){let e=Number(t.delay??0),n=t.reason,r=o(String(n||`429`));u(c(e>0?`ws.retry`:`ws.retryNow`,{cli:o(t.cli||``),reason:r,delay:e}),`tool-activity`)}else if(t.type===`agent_fallback`)u(c(`ws.fallback`,{from:o(t.from||``),to:o(t.to||``)}),`tool-activity`);else if(t.type===`agent_smoke`)u(`${s.warning} ${o(t.cli||`agent`)}: smoke response detected — auto-continuing`,`tool-activity`);else if(t.type===`goal_done`)e.activeGoal=null,Vt(),u(`🎯 Goal completed${t.source===`ai_output`?` (detected from AI output)`:``}`,`tool-activity`);else if(t.type===`goal_cancel`)e.activeGoal=null,Vt(),u(`🎯 Goal cancelled`,`tool-activity`);else if(t.type===`schedule_wakeup`)u(`⏰ Wakeup scheduled in ${t.delaySeconds}s — ${o(String(t.reason||``))}`,`tool-activity`);else if(t.type===`goal_continuation_limit`)u(`⚠️ Goal continuation limit reached (${t.attempts} attempts)`,`tool-activity`);else if(t.type===`goal_continuation`)u(`🎯 Active goal — auto-continuing`,`tool-activity`);else if(t.type===`agent_done`){if(!(t.steered||f())){let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null;if(mt(e)||e&&L&&e!==L)return;yt(e),d(t.text||``,t.toolLog),ct()}}else if(t.type===`orchestrate_done`)yt(null),d(t.text||``),ct();else if(t.type===`clear`){te(),ue(),ne().clear();let e=document.getElementById(`chatMessages`);e&&(e.innerHTML=``),r(()=>import(`./idb-cache-B5PX63p7.js`).then(e=>e.clearScopedCache()),[]).catch(()=>{})}else if(t.type===`session_reset`)u(`${s.refresh} Session reset — history preserved`,`tool-activity`);else if(t.type===`agent_added`||t.type===`agent_updated`||t.type===`agent_deleted`)r(()=>import(`./employees-86F_D_Ce.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0]));else if(t.type===`heartbeat_pending`){let e={pending:t.pending||0,deferredPending:t.deferredPending||0};t.reason!==void 0&&(e.reason=t.reason),t.policy!==void 0&&(e.policy=t.policy),t.jobId!==void 0&&(e.jobId=t.jobId),t.jobName!==void 0&&(e.jobName=t.jobName),Pt(e)}else if(t.type===`orc_state`)rn(t);else if(t.type===`memory_status`)r(()=>import(`./memory-DfPbqPTD.js`).then(e=>e.refreshMemorySidebar()),__vite__mapDeps([0]));else if(t.type===`steer_started`)pe(),yt(null),d(``),l(`steering`);else if(t.type===`new_message`&&(t.source===`telegram`||t.source===`discord`||t.source===`slack`||t.source===`bgtask`||t.source===`cli`||t.source===`goal`||t.external===!0||t.fromQueue===!0)){let e=t.role===`assistant`?`agent`:t.role||`user`,n=t.content||``,i=t.cli;r(()=>import(`./message-history-BhSsLjis.js`).then(t=>{if(t.historyReloadInFlight()){t.loadMessages().then(()=>t.loadMessages()).catch(e=>console.warn(`[ws] new_message reload after in-flight failed`,e));return}ae(e,n,i)}),__vite__mapDeps([0]))}else t.type===`system_notice`?u(`ℹ️ ${o(t.text||``)}`,`tool-activity`):t.type===`replay_gap`?Jt():t.type===`worker_stalled`?u(`⚠️ Worker stalled: ${o(t.employeeName||t.agentId||``)}`,`tool-activity`):t.type===`worker_disconnected`?u(`🔌 Worker disconnected: ${o(t.agentId||``)} (exit ${o(String(t.exitCode??`?`))})`,`tool-activity`):t.type===`worker_timeout`?u(`⏱️ Worker timed out: ${o(t.employeeName||t.agentId||``)}`,`tool-activity`):t.type===`alert_escalation`?u(o(t.message||``),`tool-activity`):t.type===`schedule_wakeup_failed`?u(`⚠️ Wakeup failed — ${o(String(t.reason||``))}: ${o(t.error||``)}`,`tool-activity`):t.type===`goal_continuation_failed`?u(`⚠️ Goal continuation failed: ${o(t.error||``)}`,`tool-activity`):t.type===`settings_change`?jt(t):t.type===`session_list`?ee(t):(t.type===`session_switched`||t.type===`session_created`)&&window.location.reload()}function rn(e){let t=++Gt;Wt.then(()=>{t===Gt&&ut(e.scope,St)&&(Ht(typeof e.state==`string`?e.state:`IDLE`,e.title),Ft({taskAnchor:e.taskAnchor||null,resolvedSelection:e.resolvedSelection||null,interview:e.interview||null}),zt(e.buildBudget||null,typeof e.state==`string`?e.state:`IDLE`))})}function an(e){return I[e]||null}var on=`sidebarState`,sn=900,cn=768;function ln(){return window.innerWidth<=cn}function Z(){document.body.classList.remove(`left-expanded`,`right-expanded`)}function un(e){let t=`${e}-expanded`,n=e===`left`?`right-expanded`:`left-expanded`,r=!document.body.classList.contains(t);document.body.classList.remove(n),document.body.classList.toggle(t,r)}function dn(){let e={};try{e=JSON.parse(localStorage.getItem(on)||`{}`)}catch{}e.left&&document.body.classList.add(`left-collapsed`),e.right&&document.body.classList.add(`right-collapsed`);let t=ln();document.getElementById(`toggleLeft`)?.addEventListener(`click`,fn),document.getElementById(`toggleRight`)?.addEventListener(`click`,pn),window.addEventListener(`resize`,()=>{let e=ln();if(window.innerWidth>sn){Z();let e={};try{e=JSON.parse(localStorage.getItem(on)||`{}`)}catch{}document.body.classList.toggle(`left-collapsed`,!!e.left),document.body.classList.toggle(`right-collapsed`,!!e.right)}else document.body.classList.remove(`left-collapsed`,`right-collapsed`),e!==t&&Z();t=e,$()}),window.innerWidth<=sn&&(document.body.classList.remove(`left-collapsed`,`right-collapsed`),ln()&&Z()),$()}function Q(){return window.innerWidth<=sn}function fn(){Q()?un(`left`):document.body.classList.toggle(`left-collapsed`),gn(),$()}function pn(){Q()?un(`right`):document.body.classList.toggle(`right-collapsed`),hn()&&document.getElementById(`tabAgents`)?.classList.contains(`active`)&&r(()=>import(`./employees-86F_D_Ce.js`).then(e=>e.loadEmployees(!0)),__vite__mapDeps([0])),gn(),$()}function mn(){return Q()?document.body.classList.contains(`left-expanded`):!document.body.classList.contains(`left-collapsed`)}function hn(){return Q()?document.body.classList.contains(`right-expanded`):!document.body.classList.contains(`right-collapsed`)}function $(){let e=document.getElementById(`toggleLeft`),t=document.getElementById(`toggleRight`);e&&(e.innerHTML=mn()?s.chevronLeft:s.chevronRight),t&&(t.innerHTML=hn()?s.chevronRight:s.chevronLeft)}function gn(){localStorage.setItem(on,JSON.stringify({left:document.body.classList.contains(`left-collapsed`),right:document.body.classList.contains(`right-collapsed`)}))}export{K as a,U as c,Ge as d,Se as f,pn as i,lt as l,hn as n,an as o,fn as r,Kt as s,dn as t,st as u};
49
+ ${r(`Verify`,e.spent.verificationRounds,e.maxVerificationRounds)}`}async function Bt(){try{let t=await fetch(`${n}/api/goal`);if(!t.ok)return;let r=await t.json();r.goal?e.activeGoal={id:r.goal.id,objective:r.goal.objective,status:r.goal.status,createdAt:r.goal.createdAt,updatedAt:r.goal.updatedAt,lastCheckpointSummary:r.goal.lastCheckpoint?.summary,nextAction:r.goal.lastCheckpoint?.nextAction}:e.activeGoal=null,Vt()}catch{}}function Vt(){let t=document.getElementById(`goalCockpit`);if(!t)return;let n=e.activeGoal;if(!n||n.status===`complete`||n.status===`cancelled`){t.hidden=!0,t.innerHTML=``;return}t.hidden=!1,t.replaceChildren();let r=n.status===`paused`?`paused`:n.status===`blocked`?`blocked`:`active`,i=document.createElement(`span`);i.className=`goal-objective`,i.title=n.objective,i.textContent=n.objective;let a=document.createElement(`span`);if(a.className=`goal-status goal-status--${r}`,a.textContent=n.status,t.append(i,a),n.nextAction){let e=document.createElement(`span`);e.className=`goal-next`,e.textContent=n.nextAction,t.append(e)}}function Ht(t,n){let r=new Set([`IDLE`,`I`,`P`,`A`,`B`,`C`,`D`]).has(t)?t:`IDLE`;if(e.orcState=r,r===`IDLE`||r===`D`)document.body.removeAttribute(`data-orc-state`),document.body.style.removeProperty(`--orc-glow`);else{document.body.setAttribute(`data-orc-state`,r);let e=`--orc-glow-${r}`,t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();document.body.style.setProperty(`--orc-glow`,t)}document.body.classList.add(`orc-pulse`),setTimeout(()=>document.body.classList.remove(`orc-pulse`),700);let i=document.getElementById(`orcStateBadge`);i&&(i.textContent={IDLE:``,I:`INTERVIEW`,P:`PLAN`,A:`AUDIT`,B:`BUILD`,C:`CHECK`,D:`DONE`}[r],i.style.display=r===`IDLE`?`none`:`inline-block`);let a=document.getElementById(`pabcRoadmap`),o=document.getElementById(`sharkRunner`),s=document.getElementById(`pabcBrand`);if(a&&o){if(!a.dataset.resizeObserved){a.dataset.resizeObserved=`1`,new ResizeObserver(()=>{F&&o.classList.contains(`running`)&&dt(a,o,F)}).observe(a);let e=0;window.addEventListener(`resize`,()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{F&&o.classList.contains(`running`)&&dt(a,o,F)})})}if(r===`IDLE`)a.classList.remove(`visible`,`shimmer-out`),o.classList.remove(`running`),F=null;else if(r===`D`){P.forEach(e=>{let t=document.getElementById(`dot-${e}`);t&&(t.className=`pabc-dot done`,t.setAttribute(`data-phase`,e))});for(let e=0;e<P.length;e++){let t=document.getElementById(`pabc-conn-${e}`);t&&(t.className=`pabc-connector done`)}o.classList.remove(`running`),F=null,a.classList.add(`shimmer-out`),setTimeout(()=>a.classList.remove(`visible`,`shimmer-out`),1e3)}else{a.classList.remove(`shimmer-out`),a.classList.add(`visible`),o.classList.add(`running`);let e=P.indexOf(r);P.forEach((t,n)=>{let r=document.getElementById(`dot-${t}`);r&&(r.className=`pabc-dot ${n<e?`done`:n===e?`active`:`future`}`,r.setAttribute(`data-phase`,t))});for(let t=0;t<P.length;t++){let n=document.getElementById(`pabc-conn-${t}`);n&&(n.className=`pabc-connector ${t<e?`done`:``}`)}F=r,requestAnimationFrame(()=>dt(a,o,r))}s&&n&&(s.textContent=n)}}var Ut=!1,Wt=Promise.resolve(),Gt=0;function K(){Mt(),Ut||(Ut=!0,tn()),$t(),C(a())}var Kt=K;function qt(e){console.log(`[${e}] connected`),X=2e3,Xt();let t=Date.now()-V<1e4;Wt=r(()=>import(`./ui-BZxyyJUk.js`).then(async n=>{if(n.cleanupToolActivity(),!t)try{await n.loadMessages(),V=Date.now()}catch(t){console.error(`[${e}] loadMessages failed`,t)}await U(`reconnect`,{hydrateRun:!0}).catch(()=>{}).finally(()=>n.reconcileChatBottomAfterRestore(`reconnect`)),r(()=>import(`./memory-CRji7xpO.js`).then(e=>e.refreshMemorySidebar()),__vite__mapDeps([0])).catch(()=>{}),r(()=>import(`./bgtask-badge-BjyAbBio.js`).then(e=>e.refreshBgtaskBadge()),__vite__mapDeps([0])).catch(()=>{})}),void 0)}function Jt(){re(`replay_gap`),Wt=r(()=>import(`./ui-BZxyyJUk.js`).then(async e=>{try{await e.loadMessages(),V=Date.now()}catch(e){console.error(`[sse] replay gap loadMessages failed`,e)}await U(`replay_gap`,{hydrateRun:!0}).catch(()=>{}).finally(()=>e.reconcileChatBottomAfterRestore(`replay_gap`))}),__vite__mapDeps([0]))}var Yt=8e3,q=null;function Xt(){q!==null&&(window.clearTimeout(q),q=null)}function Zt(){console.log(`[channel] disconnected`),r(()=>import(`./ui-BZxyyJUk.js`).then(e=>e.cleanupToolActivity()),__vite__mapDeps([0])),q===null&&(q=window.setTimeout(()=>{q=null,l(`idle`),u(`${s.exec} ${c(`ws.disconnected`)}`,`tool-activity`)},Yt))}var J=null,Y=!1,X=2e3,Qt=3e4;function $t(){if(J){Y=!0;try{J.close()}catch{}J=null}}function en(){if(J)return;console.warn(`[channel] /api/events unavailable — falling back to legacy WebSocket`);let e=`ws://${location.host}`,t=new WebSocket(`${e}${n}/?lang=${a()}`);J=t,Y=!1,t.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{console.warn(`[ws] malformed message:`,e.data);return}if(!t||typeof t!=`object`||typeof t.type!=`string`){console.warn(`[ws] invalid message shape:`,t);return}nn(t)};let r=!1;t.onopen=()=>{r=!0,X=2e3,qt(`ws`)},t.onclose=()=>{if(J===t&&(J=null),Y){Y=!1;return}if(r){Zt(),setTimeout(K,2e3);return}X=Math.min(X*2,Qt),setTimeout(K,X)}}function tn(){Me(`widget`,`widget_updated`,e=>{let t=e.chatId,n=e.widgetId;typeof t!=`string`||typeof n!=`string`||r(()=>import(`./iframe-renderer-BLP8Army.js`).then(e=>e.refreshFileWidget(t,n)),__vite__mapDeps([0])).catch(e=>console.warn(`[widget] refresh failed:`,e.message))}),Me(`*`,null,e=>{nn({...e,type:e.event})}),ke(()=>qt(`sse`)),Ae(()=>Zt()),je(()=>en())}function nn(t){if(t.type===`agent_tool`){if(f())return;let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null,n=ht(t.traceSeq);if(mt(e)||vt(e,n,t.sseReplay===!0))return;t.isEmployee!==!0&&bt(e);let r=t.toolType===`thinking`?`thinking`:t.toolType===`search`?`search`:t.toolType===`subagent`?`subagent`:`tool`;se({id:`step-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:r,icon:t.icon||s.tool,rawIcon:t.rawIcon||t.icon||``,label:t.label||``,isEmployee:t.isEmployee===!0,detail:t.detail||``,stepRef:t.stepRef||``,traceRunId:t.traceRunId||``,traceSeq:t.traceSeq,detailAvailable:t.detailAvailable,detailBytes:t.detailBytes,rawRetentionStatus:t.rawRetentionStatus,status:t.status||`running`,startTime:typeof t.startedAt==`number`&&t.startedAt>0?t.startedAt:Date.now()},typeof t.startedAt==`number`&&t.startedAt>0?t.startedAt:void 0),gt(e,n)}else if(t.type===`agent_output`||t.type===`agent_chunk`){if(f())return;let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null;if(mt(e))return;bt(e);let n=t.text||``;if(e&&typeof t.textLen==`number`){if(t.textLen<=R){t.sseReplay!==!0&&t.textLen<R&&(console.warn(`[ws] live agent_output behind applied cursor — resync (${t.textLen} < ${R})`),R=t.textLen);return}let e=t.textLen-R;e<n.length&&(n=n.slice(-e)),R=t.textLen}fe(n)}else if(t.type===`agent_status`){if(!t.running&&f())return;t.running&&f()&&ce(),t.running===void 0?l(t.status||`idle`):l(t.running?`running`:`idle`),t.agentId&&t.phase&&(I[t.agentId]={phase:t.phase,phaseLabel:t.phaseLabel||``},r(()=>import(`./employees-qLLnQlAv.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0])))}else if(t.type===`bgtask_update`)r(()=>import(`./bgtask-badge-BjyAbBio.js`).then(e=>e.applyBgtaskUpdate(t)),__vite__mapDeps([0])).catch(()=>{});else if(t.type===`queue_update`)oe(t.pending||0),Array.isArray(t.queued)&&D(t.queued),U(`queue_update`).catch(()=>{});else if(t.type===`agent_retry`){let e=Number(t.delay??0),n=t.reason,r=o(String(n||`429`));u(c(e>0?`ws.retry`:`ws.retryNow`,{cli:o(t.cli||``),reason:r,delay:e}),`tool-activity`)}else if(t.type===`agent_fallback`)u(c(`ws.fallback`,{from:o(t.from||``),to:o(t.to||``)}),`tool-activity`);else if(t.type===`agent_smoke`)u(`${s.warning} ${o(t.cli||`agent`)}: smoke response detected — auto-continuing`,`tool-activity`);else if(t.type===`goal_done`)e.activeGoal=null,Vt(),u(`🎯 Goal completed${t.source===`ai_output`?` (detected from AI output)`:``}`,`tool-activity`);else if(t.type===`goal_cancel`)e.activeGoal=null,Vt(),u(`🎯 Goal cancelled`,`tool-activity`);else if(t.type===`schedule_wakeup`)u(`⏰ Wakeup scheduled in ${t.delaySeconds}s — ${o(String(t.reason||``))}`,`tool-activity`);else if(t.type===`goal_continuation_limit`)u(`⚠️ Goal continuation limit reached (${t.attempts} attempts)`,`tool-activity`);else if(t.type===`goal_continuation`)u(`🎯 Active goal — auto-continuing`,`tool-activity`);else if(t.type===`agent_done`){if(!(t.steered||f())){let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null;if(mt(e)||e&&L&&e!==L)return;yt(e),d(t.text||``,t.toolLog),ct()}}else if(t.type===`orchestrate_done`)yt(null),d(t.text||``),ct();else if(t.type===`clear`){te(),ue(),ne().clear();let e=document.getElementById(`chatMessages`);e&&(e.innerHTML=``),r(()=>import(`./idb-cache-B5PX63p7.js`).then(e=>e.clearScopedCache()),[]).catch(()=>{})}else if(t.type===`session_reset`)u(`${s.refresh} Session reset — history preserved`,`tool-activity`);else if(t.type===`agent_added`||t.type===`agent_updated`||t.type===`agent_deleted`)r(()=>import(`./employees-qLLnQlAv.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0]));else if(t.type===`heartbeat_pending`){let e={pending:t.pending||0,deferredPending:t.deferredPending||0};t.reason!==void 0&&(e.reason=t.reason),t.policy!==void 0&&(e.policy=t.policy),t.jobId!==void 0&&(e.jobId=t.jobId),t.jobName!==void 0&&(e.jobName=t.jobName),Pt(e)}else if(t.type===`orc_state`)rn(t);else if(t.type===`memory_status`)r(()=>import(`./memory-CRji7xpO.js`).then(e=>e.refreshMemorySidebar()),__vite__mapDeps([0]));else if(t.type===`steer_started`)pe(),yt(null),d(``),l(`steering`);else if(t.type===`new_message`&&(t.source===`telegram`||t.source===`discord`||t.source===`slack`||t.source===`bgtask`||t.source===`cli`||t.source===`goal`||t.external===!0||t.fromQueue===!0)){let e=t.role===`assistant`?`agent`:t.role||`user`,n=t.content||``,i=t.cli;r(()=>import(`./message-history-C1ThtA4i.js`).then(t=>{if(t.historyReloadInFlight()){t.loadMessages().then(()=>t.loadMessages()).catch(e=>console.warn(`[ws] new_message reload after in-flight failed`,e));return}ae(e,n,i)}),__vite__mapDeps([0]))}else t.type===`system_notice`?u(`ℹ️ ${o(t.text||``)}`,`tool-activity`):t.type===`replay_gap`?Jt():t.type===`worker_stalled`?u(`⚠️ Worker stalled: ${o(t.employeeName||t.agentId||``)}`,`tool-activity`):t.type===`steer_context_lost`?u(`⚠️ 이전 턴의 진행 내용을 살리지 못했습니다 — 새 턴은 그 맥락 없이 시작합니다.`,`tool-activity`):t.type===`worker_disconnected`?u(`🔌 Worker disconnected: ${o(t.agentId||``)} (exit ${o(String(t.exitCode??`?`))})`,`tool-activity`):t.type===`worker_timeout`?u(`⏱️ Worker timed out: ${o(t.employeeName||t.agentId||``)}`,`tool-activity`):t.type===`alert_escalation`?u(o(t.message||``),`tool-activity`):t.type===`schedule_wakeup_failed`?u(`⚠️ Wakeup failed — ${o(String(t.reason||``))}: ${o(t.error||``)}`,`tool-activity`):t.type===`goal_continuation_failed`?u(`⚠️ Goal continuation failed: ${o(t.error||``)}`,`tool-activity`):t.type===`settings_change`?jt(t):t.type===`session_list`?ee(t):(t.type===`session_switched`||t.type===`session_created`)&&window.location.reload()}function rn(e){let t=++Gt;Wt.then(()=>{t===Gt&&ut(e.scope,St)&&(Ht(typeof e.state==`string`?e.state:`IDLE`,e.title),Ft({taskAnchor:e.taskAnchor||null,resolvedSelection:e.resolvedSelection||null,interview:e.interview||null}),zt(e.buildBudget||null,typeof e.state==`string`?e.state:`IDLE`))})}function an(e){return I[e]||null}var on=`sidebarState`,sn=900,cn=768;function ln(){return window.innerWidth<=cn}function Z(){document.body.classList.remove(`left-expanded`,`right-expanded`)}function un(e){let t=`${e}-expanded`,n=e===`left`?`right-expanded`:`left-expanded`,r=!document.body.classList.contains(t);document.body.classList.remove(n),document.body.classList.toggle(t,r)}function dn(){let e={};try{e=JSON.parse(localStorage.getItem(on)||`{}`)}catch{}e.left&&document.body.classList.add(`left-collapsed`),e.right&&document.body.classList.add(`right-collapsed`);let t=ln();document.getElementById(`toggleLeft`)?.addEventListener(`click`,fn),document.getElementById(`toggleRight`)?.addEventListener(`click`,pn),window.addEventListener(`resize`,()=>{let e=ln();if(window.innerWidth>sn){Z();let e={};try{e=JSON.parse(localStorage.getItem(on)||`{}`)}catch{}document.body.classList.toggle(`left-collapsed`,!!e.left),document.body.classList.toggle(`right-collapsed`,!!e.right)}else document.body.classList.remove(`left-collapsed`,`right-collapsed`),e!==t&&Z();t=e,$()}),window.innerWidth<=sn&&(document.body.classList.remove(`left-collapsed`,`right-collapsed`),ln()&&Z()),$()}function Q(){return window.innerWidth<=sn}function fn(){Q()?un(`left`):document.body.classList.toggle(`left-collapsed`),gn(),$()}function pn(){Q()?un(`right`):document.body.classList.toggle(`right-collapsed`),hn()&&document.getElementById(`tabAgents`)?.classList.contains(`active`)&&r(()=>import(`./employees-qLLnQlAv.js`).then(e=>e.loadEmployees(!0)),__vite__mapDeps([0])),gn(),$()}function mn(){return Q()?document.body.classList.contains(`left-expanded`):!document.body.classList.contains(`left-collapsed`)}function hn(){return Q()?document.body.classList.contains(`right-expanded`):!document.body.classList.contains(`right-collapsed`)}function $(){let e=document.getElementById(`toggleLeft`),t=document.getElementById(`toggleRight`);e&&(e.innerHTML=mn()?s.chevronLeft:s.chevronRight),t&&(t.innerHTML=hn()?s.chevronRight:s.chevronLeft)}function gn(){localStorage.setItem(on,JSON.stringify({left:document.body.classList.contains(`left-collapsed`),right:document.body.classList.contains(`right-collapsed`)}))}export{K as a,U as c,Ge as d,Se as f,pn as i,lt as l,hn as n,an as o,fn as r,Kt as s,dn as t,st as u};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./state-DxpgDKMO.js";import{i as t}from"./api-tVoG39dL.js";import{M as n,O as r,P as i,R as a,j as o}from"./render-fKAuISeM.js";var s=[`productivity`,`communication`,`devtools`,`ai-media`,`utility`,`smarthome`,`automation`];function c(e,t){return t?[e.id,e.name,e.description,e.category,e.requires?.env?.join(` `),e.requires?.bins?.join(` `),e.install].filter(Boolean).join(` `).toLowerCase().includes(t):!0}async function l(){try{e.allSkills=await(await i(`/api/skills`)).json(),u()}catch{let e=document.getElementById(`skillsList`);e&&(e.innerHTML=`<div style="color:var(--text-dim);font-size:11px">${a(`skill.loadFail`)}</div>`)}}function u(){let t=document.getElementById(`skillsList`),i=document.getElementById(`skillsCount`);if(!t||!i)return;let l=e.allSkills,u=l;e.currentSkillFilter===`installed`?u=l.filter(e=>e.enabled):e.currentSkillFilter===`other`?u=l.filter(e=>!s.includes(e.category||``)):e.currentSkillFilter!==`all`&&(u=l.filter(t=>t.category===e.currentSkillFilter));let d=e.currentSkillSearch.trim().toLowerCase();u=u.filter(e=>c(e,d));let f=l.filter(e=>e.enabled).length;if(i.textContent=d?a(`skill.countFiltered`,{shown:u.length,active:f,total:l.length}):a(`skill.count`,{active:f,total:l.length}),!u.length){t.innerHTML=`<div class="skill-empty">${n(a(`skill.search.empty`))}</div>`;return}t.innerHTML=u.map(e=>{let t=[];return e.requires?.env&&t.push(`${r.key} `+e.requires.env.map(e=>n(e)).join(`, `)),e.requires?.bins&&t.push(`${r.settings} `+e.requires.bins.map(e=>n(e)).join(`, `)),e.install&&t.push(n(e.install)),`
1
+ import{t as e}from"./state-DxpgDKMO.js";import{i as t}from"./api-tVoG39dL.js";import{M as n,O as r,P as i,R as a,j as o}from"./render-Cc0Y43E3.js";var s=[`productivity`,`communication`,`devtools`,`ai-media`,`utility`,`smarthome`,`automation`];function c(e,t){return t?[e.id,e.name,e.description,e.category,e.requires?.env?.join(` `),e.requires?.bins?.join(` `),e.install].filter(Boolean).join(` `).toLowerCase().includes(t):!0}async function l(){try{e.allSkills=await(await i(`/api/skills`)).json(),u()}catch{let e=document.getElementById(`skillsList`);e&&(e.innerHTML=`<div style="color:var(--text-dim);font-size:11px">${a(`skill.loadFail`)}</div>`)}}function u(){let t=document.getElementById(`skillsList`),i=document.getElementById(`skillsCount`);if(!t||!i)return;let l=e.allSkills,u=l;e.currentSkillFilter===`installed`?u=l.filter(e=>e.enabled):e.currentSkillFilter===`other`?u=l.filter(e=>!s.includes(e.category||``)):e.currentSkillFilter!==`all`&&(u=l.filter(t=>t.category===e.currentSkillFilter));let d=e.currentSkillSearch.trim().toLowerCase();u=u.filter(e=>c(e,d));let f=l.filter(e=>e.enabled).length;if(i.textContent=d?a(`skill.countFiltered`,{shown:u.length,active:f,total:l.length}):a(`skill.count`,{active:f,total:l.length}),!u.length){t.innerHTML=`<div class="skill-empty">${n(a(`skill.search.empty`))}</div>`;return}t.innerHTML=u.map(e=>{let t=[];return e.requires?.env&&t.push(`${r.key} `+e.requires.env.map(e=>n(e)).join(`, `)),e.requires?.bins&&t.push(`${r.settings} `+e.requires.bins.map(e=>n(e)).join(`, `)),e.install&&t.push(n(e.install)),`
2
2
  <div class="skill-card ${e.enabled?`enabled`:``}">
3
3
  <div class="skill-card-header">
4
4
  <span class="skill-emoji">${e.emoji?o(e.emoji):r.tool}</span>
@@ -0,0 +1 @@
1
+ import{n as e}from"./skills-QWf6vRIB.js";export{e as loadSkills};
@@ -0,0 +1 @@
1
+ import{a as e}from"./slash-commands-qD6yScsx.js";export{e as loadCommands};