@deepseekcode/cli 1.0.16 → 1.0.18

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 (35) hide show
  1. package/dist/cli.js +1014 -1004
  2. package/package.json +2 -2
  3. package/web/dist/assets/{AgentFlowView-D-nPVDb9.js → AgentFlowView-qR01S0jV.js} +1 -1
  4. package/web/dist/assets/{AgentsView-DHNgV13S.js → AgentsView-CLvG8aae.js} +1 -1
  5. package/web/dist/assets/{AuditView-ZCIV7Q0I.js → AuditView-CMYlGV9S.js} +1 -1
  6. package/web/dist/assets/{AutomationView-By6rBhla.js → AutomationView-wrcdqhJY.js} +1 -1
  7. package/web/dist/assets/{ChannelConfigView-_cIgiA-O.js → ChannelConfigView-DM70m5RE.js} +1 -1
  8. package/web/dist/assets/{ConnectorsView-BQQ_k_7I.js → ConnectorsView-B5ndd8pU.js} +1 -1
  9. package/web/dist/assets/{FileTreeView-DKUEkVqn.js → FileTreeView-DL66cxki.js} +1 -1
  10. package/web/dist/assets/{HookConfigView-DbkxVuAs.js → HookConfigView-BugHBHlO.js} +2 -2
  11. package/web/dist/assets/{InboxView-B3ddpq78.js → InboxView-DLPWNrqG.js} +1 -1
  12. package/web/dist/assets/ModelsView-CwhL9YPX.js +2 -0
  13. package/web/dist/assets/SessionGrid-CC1NAZ45.js +26 -0
  14. package/web/dist/assets/SettingsPanel-n1UbEjzX.js +4 -0
  15. package/web/dist/assets/{SkillsView-BwJowYXS.js → SkillsView-DznSS50I.js} +1 -1
  16. package/web/dist/assets/{TemplatesTab-BB-6z4z4.js → TemplatesTab-BPD0hvrG.js} +1 -1
  17. package/web/dist/assets/{TerminalView-D9e8fyOS.js → TerminalView-B4WUBGzA.js} +1 -1
  18. package/web/dist/assets/{ToolsView-CQ3hybgP.js → ToolsView-CQgPyD6U.js} +1 -1
  19. package/web/dist/assets/{icons-B5yCkBjC.js → icons-CrV0VGFQ.js} +107 -82
  20. package/web/dist/assets/index-DMxlsuNM.js +20 -0
  21. package/web/dist/assets/index-DjWfcgLQ.css +1 -0
  22. package/web/dist/assets/{markdown-D0iUI0Yw.js → markdown-CaPdHFK5.js} +1 -1
  23. package/web/dist/assets/panels-B3UcQJtY.js +1 -0
  24. package/web/dist/assets/{react-vendor-Bxu3r3ox.js → react-vendor-DnYXnA42.js} +1 -1
  25. package/web/dist/assets/{state-C80Yzgl0.js → state-BHmvnECu.js} +1 -1
  26. package/web/dist/index.html +6 -6
  27. package/web/dist/assets/AskQuestionModal-BKkh6JlF.js +0 -1
  28. package/web/dist/assets/HookApprovalModal-DC_q-If8.js +0 -1
  29. package/web/dist/assets/HookApprovalPreview-C8fU_Umi.js +0 -3
  30. package/web/dist/assets/ModelsView-B2N4jMxM.js +0 -1
  31. package/web/dist/assets/SessionGrid-CnK6naC_.js +0 -23
  32. package/web/dist/assets/SettingsPanel-czOfv9mx.js +0 -3
  33. package/web/dist/assets/index-DVZ3Ws5S.css +0 -1
  34. package/web/dist/assets/index-YAnKQ1Q6.js +0 -20
  35. package/web/dist/assets/panels-DOT_5rsR.js +0 -1
@@ -1,23 +0,0 @@
1
- import{j as e,M as Ht,P as Pe}from"./markdown-D0iUI0Yw.js";import{r as p,v as Gt,ay as gt,h as ge,a as le,b as qe,ai as ft,X as Ee,aB as qt,aC as Kt,m as fe,s as ze,L as Se,au as Ke,F as Be,aD as Ue,aE as Wt,D as Jt,t as Xt,O as Zt,aa as Yt,aF as et,aG as Vt,R as ce,z as Qt,a4 as en,aH as tn,x as ht,aj as bt,av as nn,y as sn,Q as rn,aI as an,ao as on,aJ as ln,aq as cn,q as dn,aK as un,a0 as kt,a2 as pn,u as mn,an as xn,af as gn}from"./icons-B5yCkBjC.js";import{i as K,e as $,j as fn,k as tt,w as G,l as nt,u as xe,R as hn,a as ee,t as B,m as q,n as bn,W as kn,o as yn,p as He,b as Nn,M as wn,q as vn,r as st,s as jn,d as Ge}from"./index-YAnKQ1Q6.js";import{b as En,s as Sn,T as An,t as Cn,v as Tn,P as _n}from"./HookApprovalPreview-C8fU_Umi.js";import"./react-vendor-Bxu3r3ox.js";import"./state-C80Yzgl0.js";function rt({value:s,max:t=100,size:n="md",variant:r="default",showLabel:a=!1,className:d}){const c=Math.min(Math.max(s/t*100,0),100),o={sm:"h-1",md:"h-2",lg:"h-3"},i={default:"bg-accent-blue",success:"bg-accent-green",warning:"bg-accent-yellow",error:"bg-accent-red"};return e.jsxs("div",{className:K("w-full",d),children:[e.jsx("div",{className:K("w-full bg-dark-border rounded-full overflow-hidden",o[n]),children:e.jsx("div",{className:K("h-full rounded-full transition-all duration-300",i[r]),style:{width:`${c}%`}})}),a&&e.jsxs("span",{className:"text-xs text-dark-muted mt-1",children:[Math.round(c),"%"]})]})}Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(s){s.languages.typescript=s.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),s.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete s.languages.typescript.parameter,delete s.languages.typescript["literal-property"];var t=s.languages.extend("typescript",{});delete t["class-name"],s.languages.typescript["class-name"].inside=t,s.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),s.languages.ts=s.languages.typescript})(Prism);(function(s){var t=s.util.clone(s.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,a=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function d(i,l){return i=i.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return a}),RegExp(i,l)}a=d(a).source,s.languages.jsx=s.languages.extend("markup",t),s.languages.jsx.tag.pattern=d(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),s.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,s.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,s.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,s.languages.jsx.tag.inside.comment=t.comment,s.languages.insertBefore("inside","attr-name",{spread:{pattern:d(/<SPREAD>/.source),inside:s.languages.jsx}},s.languages.jsx.tag),s.languages.insertBefore("inside","special-attr",{script:{pattern:d(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:s.languages.jsx}}},s.languages.jsx.tag);var c=function(i){return i?typeof i=="string"?i:typeof i.content=="string"?i.content:i.content.map(c).join(""):""},o=function(i){for(var l=[],u=0;u<i.length;u++){var g=i[u],f=!1;if(typeof g!="string"&&(g.type==="tag"&&g.content[0]&&g.content[0].type==="tag"?g.content[0].content[0].content==="</"?l.length>0&&l[l.length-1].tagName===c(g.content[0].content[1])&&l.pop():g.content[g.content.length-1].content==="/>"||l.push({tagName:c(g.content[0].content[1]),openedBraces:0}):l.length>0&&g.type==="punctuation"&&g.content==="{"?l[l.length-1].openedBraces++:l.length>0&&l[l.length-1].openedBraces>0&&g.type==="punctuation"&&g.content==="}"?l[l.length-1].openedBraces--:f=!0),(f||typeof g=="string")&&l.length>0&&l[l.length-1].openedBraces===0){var x=c(g);u<i.length-1&&(typeof i[u+1]=="string"||i[u+1].type==="plain-text")&&(x+=c(i[u+1]),i.splice(u+1,1)),u>0&&(typeof i[u-1]=="string"||i[u-1].type==="plain-text")&&(x=c(i[u-1])+x,i.splice(u-1,1),u--),i[u]=new s.Token("plain-text",x,null,x)}g.content&&typeof g.content!="string"&&o(g.content)}};s.hooks.add("after-tokenize",function(i){i.language!=="jsx"&&i.language!=="tsx"||o(i.tokens)})})(Prism);(function(s){var t=s.util.clone(s.languages.typescript);s.languages.tsx=s.languages.extend("jsx",t),delete s.languages.tsx.parameter,delete s.languages.tsx["literal-property"];var n=s.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0})(Prism);(function(s){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var n=s.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(s){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};s.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=s.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],d=r.variable[1].inside,c=0;c<a.length;c++)d[a[c]]=s.languages.bash[a[c]];s.languages.sh=s.languages.bash,s.languages.shell=s.languages.bash})(Prism);Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/};Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python;Prism.languages.py=Prism.languages.python;(function(s){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(u){return u=u.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),d=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;s.languages.markdown=s.languages.extend("markup",{}),s.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:s.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+d+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+d+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:s.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+d+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:s.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(g){u!==g&&(s.languages.markdown[u].inside.content.inside[g]=s.languages.markdown[g])})}),s.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function g(f){if(!(!f||typeof f=="string"))for(var x=0,b=f.length;x<b;x++){var w=f[x];if(w.type!=="code"){g(w.content);continue}var k=w.content[1],S=w.content[3];if(k&&S&&k.type==="code-language"&&S.type==="code-block"&&typeof k.content=="string"){var y=k.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");y=(/[a-z][\w-]*/i.exec(y)||[""])[0].toLowerCase();var R="language-"+y;S.alias?typeof S.alias=="string"?S.alias=[S.alias,R]:S.alias.push(R):S.alias=[R]}}}g(u.tokens)}),s.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var g="",f=0,x=u.classes.length;f<x;f++){var b=u.classes[f],w=/language-(.+)/.exec(b);if(w){g=w[1];break}}var k=s.languages[g];if(k)u.content=s.highlight(l(u.content),k,g);else if(g&&g!=="none"&&s.plugins.autoloader){var S="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=S,s.plugins.autoloader.loadLanguages(g,function(){var y=document.getElementById(S);y&&(y.innerHTML=s.highlight(y.textContent,s.languages[g],g))})}}});var c=RegExp(s.languages.markup.tag.pattern.source,"gi"),o={amp:"&",lt:"<",gt:">",quot:'"'},i=String.fromCodePoint||String.fromCharCode;function l(u){var g=u.replace(c,"");return g=g.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(f,x){if(x=x.toLowerCase(),x[0]==="#"){var b;return x[1]==="x"?b=parseInt(x.slice(2),16):b=Number(x.slice(1)),i(b)}else{var w=o[x];return w||f}}),g}s.languages.md=s.languages.markdown})(Prism);(function(s){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),d=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function c(o,i){i=(i||"").replace(/m/g,"")+"m";var l=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return o});return RegExp(l,i)}s.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+a+"|"+d+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:c(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:c(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:c(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:c(d),lookbehind:!0,greedy:!0},number:{pattern:c(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},s.languages.yml=s.languages.yaml})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};const In={js:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",py:"Python",python:"Python",bash:"Bash",shell:"Shell",css:"CSS",json:"JSON",yaml:"YAML",yml:"YAML",sql:"SQL",md:"Markdown",markdown:"Markdown",xml:"XML",html:"HTML"};function Rn({language:s,code:t}){const[n,r]=p.useState(!1),a=p.useRef(null);p.useEffect(()=>{if(a.current)try{Pe.highlightElement(a.current)}catch{}},[t,s]);const d=async()=>{try{await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}catch(o){console.error("Failed to copy:",o)}},c=In[s]||s.toUpperCase();return e.jsxs("div",{className:"relative group rounded-lg overflow-hidden border border-dark-border my-2",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[e.jsx("span",{className:"text-xs text-dark-muted font-mono",children:c}),e.jsx("button",{onClick:d,className:"flex items-center gap-1 text-xs px-2 py-1 rounded hover:bg-dark-hover transition-colors",children:n?e.jsxs(e.Fragment,{children:[e.jsx(Gt,{size:12,className:"text-accent-green"}),e.jsx("span",{className:"text-accent-green",children:"已复制"})]}):e.jsxs(e.Fragment,{children:[e.jsx(gt,{size:12}),e.jsx("span",{children:"复制"})]})})]}),e.jsx("pre",{className:"bg-dark-bg p-3 overflow-x-auto custom-scrollbar text-sm",children:e.jsx("code",{ref:a,className:`language-${s}`,children:t})})]})}const at=80;function On({content:s,className:t=""}){const[n,r]=p.useState(s),a=p.useRef(0),d=p.useRef(null),c=p.useRef(s);c.current=s,p.useEffect(()=>{if(s===n)return;const i=Date.now(),l=i-a.current;l>=at?(r(s),a.current=i):d.current||(d.current=setTimeout(()=>{d.current=null,r(c.current),a.current=Date.now()},at-l))},[s]),p.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const o=(n||"").replace(/\\n/g,`
2
- `).replace(/\n{3,}/g,`
3
-
4
- `);return e.jsx("div",{className:`markdown-content ${t}`,style:{wordBreak:"break-word"},children:e.jsx(Ht,{components:{code({className:i,children:l,...u}){const g=/language-(\w+)/.exec(i||""),f=String(l).replace(/\n$/,"");return g&&g[1]?e.jsx(Rn,{language:g[1],code:f}):e.jsx("code",{className:"bg-dark-hover px-1.5 py-0.5 rounded text-sm font-mono text-accent-blue",...u,children:l})},a({href:i,children:l}){return e.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-accent-blue hover:underline",children:l})},table({children:i}){return e.jsx("div",{className:"overflow-x-auto custom-scrollbar my-2",children:e.jsx("table",{className:"w-full border-collapse border border-dark-border",children:i})})},th({children:i}){return e.jsx("th",{className:"border border-dark-border px-3 py-2 text-left bg-dark-hover font-medium",children:i})},td({children:i}){return e.jsx("td",{className:"border border-dark-border px-3 py-2",children:i})},p({children:i}){return e.jsx("p",{className:"mb-0.5 leading-snug last:mb-0",children:i})},blockquote({children:i}){return e.jsx("blockquote",{className:"border-l-4 border-accent-blue pl-3 my-1 text-dark-muted italic",children:i})},h1({children:i}){return e.jsx("h1",{className:"text-2xl font-bold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:i})},h2({children:i}){return e.jsx("h2",{className:"text-xl font-semibold mt-3 mb-1 text-dark-text border-b border-dark-border pb-1",children:i})},h3({children:i}){return e.jsx("h3",{className:"text-lg font-semibold mt-2 mb-1 text-dark-text",children:i})}},children:o})})}Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(s){s.type==="entity"&&(s.attributes.title=s.content.replace(/&amp;/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(t,n){var r={};r["language-"+n]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[n]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var a={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};a["language-"+n]={pattern:/[\s\S]+/,inside:Prism.languages[n]};var d={};d[t]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:a},Prism.languages.insertBefore("markup","cdata",d)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(s,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+s+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];(function(s){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),s.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},s.languages.rust["closure-params"].inside.rest=s.languages.rust,s.languages.rust.attribute.inside.string=s.languages.rust.string})(Prism);(function(s){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};s.languages.java=s.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[s.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),s.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),s.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(s){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return t.source});s.languages.cpp=s.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),s.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),s.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:s.languages.cpp}}}}),s.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),s.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:s.languages.extend("cpp",{})}}),s.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},s.languages.cpp["base-clause"])})(Prism);(function(s){function t(n,r){return"___"+n.toUpperCase()+r+"___"}Object.defineProperties(s.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,d){if(n.language===r){var c=n.tokenStack=[];n.code=n.code.replace(a,function(o){if(typeof d=="function"&&!d(o))return o;for(var i=c.length,l;n.code.indexOf(l=t(r,i))!==-1;)++i;return c[i]=o,l}),n.grammar=s.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language!==r||!n.tokenStack)return;n.grammar=s.languages[r];var a=0,d=Object.keys(n.tokenStack);function c(o){for(var i=0;i<o.length&&!(a>=d.length);i++){var l=o[i];if(typeof l=="string"||l.content&&typeof l.content=="string"){var u=d[a],g=n.tokenStack[u],f=typeof l=="string"?l:l.content,x=t(r,u),b=f.indexOf(x);if(b>-1){++a;var w=f.substring(0,b),k=new s.Token(r,s.tokenize(g,n.grammar),"language-"+r,g),S=f.substring(b+x.length),y=[];w&&y.push.apply(y,c([w])),y.push(k),S&&y.push.apply(y,c([S])),typeof l=="string"?o.splice.apply(o,[i,1].concat(y)):l.content=y}}else l.content&&c(l.content)}return o}c(n.tokens)}}})})(Prism);(function(s){var t=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,n=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,a=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,d=/[{}\[\](),:;]/;s.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:t,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:a,punctuation:d};var c={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:s.languages.php},o=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:c}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:c}}];s.languages.insertBefore("php","variable",{string:o,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:t,string:o,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:n,number:r,operator:a,punctuation:d}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),s.hooks.add("before-tokenize",function(i){if(/<\?/.test(i.code)){var l=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;s.languages["markup-templating"].buildPlaceholders(i,"php",l)}}),s.hooks.add("after-tokenize",function(i){s.languages["markup-templating"].tokenizePlaceholders(i,"php")})})(Prism);(function(s){s.languages.ruby=s.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),s.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var t={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:s.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete s.languages.ruby.function;var n="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;s.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+n+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:t,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),s.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+n),greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:t,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+n),greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:t,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete s.languages.ruby.string,s.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),s.languages.rb=s.languages.ruby})(Prism);class Dn{diff(t,n,r={}){let a;typeof r=="function"?(a=r,r={}):"callback"in r&&(a=r.callback);const d=this.castInput(t,r),c=this.castInput(n,r),o=this.removeEmpty(this.tokenize(d,r)),i=this.removeEmpty(this.tokenize(c,r));return this.diffWithOptionsObj(o,i,r,a)}diffWithOptionsObj(t,n,r,a){var d;const c=y=>{if(y=this.postProcess(y,r),a){setTimeout(function(){a(y)},0);return}else return y},o=n.length,i=t.length;let l=1,u=o+i;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const g=(d=r.timeout)!==null&&d!==void 0?d:1/0,f=Date.now()+g,x=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(x[0],n,t,0,r);if(x[0].oldPos+1>=i&&b+1>=o)return c(this.buildValues(x[0].lastComponent,n,t));let w=-1/0,k=1/0;const S=()=>{for(let y=Math.max(w,-l);y<=Math.min(k,l);y+=2){let R;const T=x[y-1],I=x[y+1];T&&(x[y-1]=void 0);let O=!1;if(I){const A=I.oldPos-y;O=I&&0<=A&&A<o}const U=T&&T.oldPos+1<i;if(!O&&!U){x[y]=void 0;continue}if(!U||O&&T.oldPos<I.oldPos?R=this.addToPath(I,!0,!1,0,r):R=this.addToPath(T,!1,!0,1,r),b=this.extractCommon(R,n,t,y,r),R.oldPos+1>=i&&b+1>=o)return c(this.buildValues(R.lastComponent,n,t))||!0;x[y]=R,R.oldPos+1>=i&&(k=Math.min(k,y-1)),b+1>=o&&(w=Math.max(w,y+1))}l++};if(a)(function y(){setTimeout(function(){if(l>u||Date.now()>f)return a(void 0);S()||y()},0)})();else for(;l<=u&&Date.now()<=f;){const y=S();if(y)return y}}addToPath(t,n,r,a,d){const c=t.lastComponent;return c&&!d.oneChangePerToken&&c.added===n&&c.removed===r?{oldPos:t.oldPos+a,lastComponent:{count:c.count+1,added:n,removed:r,previousComponent:c.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:r,previousComponent:c}}}extractCommon(t,n,r,a,d){const c=n.length,o=r.length;let i=t.oldPos,l=i-a,u=0;for(;l+1<c&&i+1<o&&this.equals(r[i+1],n[l+1],d);)l++,i++,u++,d.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return u&&!d.oneChangePerToken&&(t.lastComponent={count:u,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=i,l}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const a=[];let d;for(;t;)a.push(t),d=t.previousComponent,delete t.previousComponent,t=d;a.reverse();const c=a.length;let o=0,i=0,l=0;for(;o<c;o++){const u=a[o];if(u.removed)u.value=this.join(r.slice(l,l+u.count)),l+=u.count;else{if(!u.added&&this.useLongestToken){let g=n.slice(i,i+u.count);g=g.map(function(f,x){const b=r[l+x];return b.length>f.length?b:f}),u.value=this.join(g)}else u.value=this.join(n.slice(i,i+u.count));i+=u.count,u.added||(l+=u.count)}}return a}}class Ln extends Dn{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}}const Fn=new Ln;function $n(s,t,n){return Fn.diff(s,t,n)}const Mn=.4;function it(s){const t=[];let n=0;for(;n<s.length;){const r=s[n];if(/[\p{L}\p{N}_]/u.test(r)){let a=n+1;for(;a<s.length&&/[\p{L}\p{N}_]/u.test(s[a]);)a++;t.push(s.slice(n,a)),n=a}else if(/\s/.test(r)){let a=n+1;for(;a<s.length&&/\s/.test(s[a]);)a++;t.push(s.slice(n,a)),n=a}else{const d=s.codePointAt(n)>65535?2:1;t.push(s.slice(n,n+d)),n+=d}}return t}function Pn(s,t){const n=$n(it(s),it(t)),r=s.length+t.length;let a=0;const d=[],c=[];let o=0,i=0;for(const l of n){const u=l.value.reduce((g,f)=>g+f.length,0);l.removed?(a+=u,d.push({start:o,end:o+u}),o+=u):l.added?(a+=u,c.push({start:i,end:i+u}),i+=u):(o+=u,i+=u)}return r>0&&a/r>Mn?[[],[]]:[d,c]}function yt(s){const t=[];let n=null;for(const r of s.split(`
5
- `)){if(r.startsWith("---")||r.startsWith("+++")||r.startsWith("index ")||r.startsWith("diff --git")||r.startsWith("==="))continue;const a=r.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(a){n&&t.push(n),n={oldStart:parseInt(a[1],10),oldLines:parseInt(a[2]??"1",10),newStart:parseInt(a[3],10),newLines:parseInt(a[4]??"1",10),lines:[]};continue}if(!r.startsWith("\\")){if(n&&(r.startsWith("+")||r.startsWith("-")||r.startsWith(" ")||r==="")){n.lines.push(r);continue}n&&r&&(t.push(n),n=null)}}return n&&t.push(n),t}function Nt(s){let t=s.oldStart,n=s.newStart;const r=[];for(const a of s.lines){const d=a[0]==="+"||a[0]==="-"?a[0]:" ",c=a.slice(1);let o=null,i=null;d==="-"?o=t++:(d==="+"||(o=t++),i=n++),r.push({marker:d,code:c,oldLine:o,newLine:i})}return r}const zn=p.memo(function({filePath:t,content:n,language:r}){if(!n&&!t)return null;const[a,d]=p.useState("unified"),[c,o]=p.useState(!1),i=Bn(t,r),l=(n==null?void 0:n.includes("@@"))||(n==null?void 0:n.includes("+++"))||(n==null?void 0:n.includes("---")),u=l?Un(n||""):null;return e.jsxs("div",{className:"mt-2 border border-dark-border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-dark-surface border-b border-dark-border",children:[e.jsx("span",{className:"text-accent-purple text-xs",children:"📝"}),e.jsx("span",{className:"text-xs font-mono text-dark-fg truncate",children:t||"file"}),u&&e.jsxs("span",{className:"text-xs ml-2 flex gap-2",children:[e.jsxs("span",{className:"text-green-400",children:["+",u.additions]}),e.jsxs("span",{className:"text-red-400",children:["-",u.deletions]})]}),e.jsx("span",{className:"text-xs text-dark-muted ml-auto",children:i}),l&&e.jsxs("div",{className:"flex gap-0.5 ml-2",children:[e.jsx("button",{onClick:()=>d("unified"),className:`text-xs px-1.5 py-0.5 rounded ${a==="unified"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Unified view",children:"Unified"}),e.jsx("button",{onClick:()=>d("side-by-side"),className:`text-xs px-1.5 py-0.5 rounded ${a==="side-by-side"?"bg-accent-blue/20 text-accent-blue":"text-dark-muted hover:text-dark-fg"}`,title:"Side-by-side view",children:"Side"})]}),e.jsx("button",{onClick:()=>o(!c),className:"text-xs text-dark-muted hover:text-dark-fg ml-1",children:c?"▶":"▼"})]}),!c&&e.jsxs("div",{className:"bg-dark-bg overflow-x-auto max-h-96 overflow-y-auto custom-scrollbar",children:[l?a==="unified"?Kn(n||"",i):Wn(n||"",i):e.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:n||"(no content)"}),u&&e.jsxs("div",{className:"sticky bottom-0 bg-dark-surface border-t border-dark-border px-3 py-1 flex gap-4 text-xs text-dark-muted",children:[e.jsxs("span",{className:"text-green-400",children:["+",u.additions," additions"]}),e.jsxs("span",{className:"text-red-400",children:["-",u.deletions," deletions"]}),e.jsxs("span",{children:[u.hunks," hunks"]})]})]})]})});function Bn(s,t){var a;if(t)return t;if(!s)return"plaintext";const n=(a=s.split(".").pop())==null?void 0:a.toLowerCase();return{ts:"typescript",tsx:"typescript",mts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",go:"go",rs:"rust",cpp:"cpp",cxx:"cpp",hpp:"cpp",cc:"cpp",c:"cpp",h:"cpp",css:"css",scss:"css",html:"markup",htm:"markup",svg:"markup",xml:"xml",json:"json",yml:"yaml",yaml:"yaml",md:"markdown",sql:"sql",sh:"bash",bash:"bash",zsh:"bash",php:"php",rb:"ruby"}[n||""]||"plaintext"}function Un(s){const t=s.split(`
6
- `);let n=0,r=0,a=0;for(const d of t)d.startsWith("@@")?a++:d.startsWith("+")&&!d.startsWith("+++")?n++:d.startsWith("-")&&!d.startsWith("---")&&r++;return{additions:n,deletions:r,hunks:a,filesChanged:1}}function Hn(s){const t=[],n=(a,d)=>{if(!d)return;const c=t[t.length-1];c&&c.type===a?c.text+=d:t.push({type:a,text:d})},r=(a,d)=>{if(typeof a=="string"){n(d,a);return}const c=a.type||d;if(typeof a.content=="string"){n(c,a.content);return}for(const o of a.content)r(o,c)};for(const a of s)r(a,"");return t}function wt(s,t){const n=Pe.languages[t];if(!n)return[{type:"",text:s}];try{return Hn(Pe.tokenize(s,n))}catch{return[{type:"",text:s}]}}function Gn(s,t){if(t.length===0)return s.map(a=>({...a,word:!1}));const n=[];let r=0;for(const a of s){const d=r,c=r+a.text.length;let o=0;for(const i of t){const l=Math.max(0,i.start-d),u=Math.min(a.text.length,i.end-d);u<=0||l>=a.text.length||(l>o&&n.push({type:a.type,text:a.text.slice(o,l),word:!1}),n.push({type:a.type,text:a.text.slice(l,u),word:!0}),o=u)}o<a.text.length&&n.push({type:a.type,text:a.text.slice(o),word:!1}),r=c}return n}function qn({code:s,marker:t,lang:n,ranges:r}){const a=t==="-"?[{type:"",text:s}]:wt(s,n),d=Gn(a,r),c=t==="+"?"bg-green-900/30":t==="-"?"bg-red-900/30":"",o=t==="+"?"bg-green-700/60":"bg-red-700/60";return e.jsx("span",{className:`flex-1 whitespace-pre-wrap px-2 ${c}`,children:d.length===0?" ":d.map((i,l)=>e.jsx("span",{className:[i.type?`token ${i.type}`:"",i.word&&t!==" "?o:""].join(" "),children:i.text},l))})}function Kn(s,t){const n=yt(s);if(n.length===0)return e.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:s});const r=[];let a=0;for(const d of n){const c=Nt(d);r.push(e.jsxs("div",{className:"flex text-xs font-mono leading-snug bg-accent-blue/5 text-accent-blue font-bold px-2",style:{minHeight:"1.25rem"},children:[e.jsx("span",{className:"select-none shrink-0 text-right pr-1",children:"@"}),e.jsxs("span",{className:"flex-1 whitespace-pre-wrap",children:["@@ -",d.oldStart,",",d.oldLines," +",d.newStart,",",d.newLines," @@"]})]},a++));const o=new Map;for(let i=0;i<c.length;){if(c[i].marker!=="-"){i++;continue}const l=i;for(;i<c.length&&c[i].marker==="-";)i++;const u=i;for(;i<c.length&&c[i].marker==="+";)i++;const g=Math.min(u-l,i-u);for(let f=0;f<g;f++){const[x,b]=Pn(c[l+f].code,c[u+f].code);o.set(l+f,x),o.set(u+f,b)}}for(let i=0;i<c.length;i++){const l=c[i],u=l.marker==="+",g=l.marker==="-",f=u?"bg-green-900/30":g?"bg-red-900/30":"",x=l.marker==="-"?l.oldLine:l.newLine;r.push(e.jsxs("div",{className:"flex text-xs font-mono leading-snug",style:{minHeight:"1.25rem"},children:[e.jsxs("span",{className:`select-none shrink-0 w-9 text-right pr-1 ${f} ${u?"text-green-400":g?"text-red-400":"text-dark-muted"}`,children:[l.marker===" "?"":l.marker,x??""]}),e.jsx(qn,{code:l.code,marker:l.marker,lang:t,ranges:o.get(i)??[]})]},a++))}}return e.jsx("div",{children:r})}function ot({code:s,lang:t,kind:n}){if(s==="")return e.jsx("span",{className:"flex-1 px-2 border-r border-dark-border/30 font-mono text-xs leading-snug",style:{minHeight:"1.25rem"},children:" "});const r=n==="remove"?[{type:"",text:s}]:wt(s,t),a=n==="add"?"bg-green-900/30":n==="remove"?"bg-red-900/30":"";return e.jsx("span",{className:`flex-1 px-2 border-r border-dark-border/30 font-mono text-xs leading-snug ${a}`,children:r.map((d,c)=>e.jsx("span",{className:d.type?`token ${d.type}`:"",children:d.text},c))})}function Wn(s,t){const n=yt(s);if(n.length===0)return e.jsx("pre",{className:"text-xs font-mono p-2 text-dark-fg whitespace-pre-wrap",children:s});const r=[];for(const a of n){const d=Nt(a);r.push({left:`@@ -${a.oldStart},${a.oldLines} +${a.newStart},${a.newLines} @@`,right:"",type:"header"});let c=[],o=[];const i=()=>{(c.length>0||o.length>0)&&(Jn(r,c,o),c=[],o=[])};for(const l of d)l.marker==="-"?c.push(l.code):l.marker==="+"?o.push(l.code):(i(),r.push({left:l.code,right:l.code,type:"context"}));i()}return e.jsxs("div",{children:[e.jsxs("div",{className:"flex border-b border-dark-border text-xs font-bold text-dark-muted",children:[e.jsx("div",{className:"flex-1 px-2 py-0.5 border-r border-dark-border",children:"Old"}),e.jsx("div",{className:"flex-1 px-2 py-0.5",children:"New"})]}),r.map((a,d)=>a.type==="header"?e.jsx("div",{className:"bg-accent-blue/5 text-accent-blue font-bold font-mono text-xs leading-snug px-2",children:a.left},d):e.jsxs("div",{className:"flex",style:{minHeight:"1.25rem"},children:[e.jsx(ot,{code:a.type==="replace"||a.type==="delete"?"- "+a.left:a.left,lang:t,kind:a.type==="replace"||a.type==="delete"?"remove":"context"}),e.jsx(ot,{code:a.type==="replace"||a.type==="add"?"+ "+a.right:a.right,lang:t,kind:a.type==="replace"||a.type==="add"?"add":"context"})]},d))]})}function Jn(s,t,n){const r=Math.max(t.length,n.length);for(let a=0;a<r;a++){const d=a<t.length?t[a]??"":"",c=a<n.length?n[a]??"":"";s.push({left:d,right:c,type:a<t.length&&a<n.length?"replace":a<t.length?"delete":"add"})}}function vt(s){const t=p.useRef(null),n=p.useRef(0);return p.useEffect(()=>{if(!s){n.current=0;return}n.current=Date.now();const r=t.current;if(!r)return;const a=()=>{const c=Math.floor((Date.now()-n.current)/1e3),o=c>=60?`${Math.floor(c/60)}m ${c%60}s`:`${c}s`;r.textContent=o};a();const d=setInterval(a,1e3);return()=>clearInterval(d)},[s]),t}const Xn=["FileEditTool","FileWriteTool","EditTool","NotebookEditTool","Write","Edit","WriteTool","FileCreateTool"],Zn=/\b(write|edit|save|create|update|modify|patch)\b/i,Yn=/\b(read|open|cat|view|list|ls|dir|find|grep|glob|search)\b/i;function Vn(s){return Xn.includes(s)?!0:Zn.test(s)&&!Yn.test(s)}function Qn(s){return typeof s=="string"?s:s&&typeof s=="object"?JSON.stringify(s,null,2):String(s??"")}function es(s){if(typeof s!="string"&&s)return s.filePath||s.path||s.file||s.file_path}const jt=p.memo(function({toolCall:t,defaultCollapsed:n=!0}){const r=t.status==="running",a=vt(r),d=t.result!==void 0&&t.result!==null,c=t.status==="error",o=Vn(t.name),i=d?Qn(t.result):"",l=t.diff||(o&&i&&(i.includes("@@")||i.includes("+++")||i.includes("---"))?i:void 0),u=typeof t.args=="object"&&t.args?es(t.args):void 0,[g,f]=p.useState(()=>n&&!l),x=p.useRef(!!l);p.useEffect(()=>{!x.current&&l&&(x.current=!0,f(!1))},[l]);const b=t.duration??0,w=b>0?b>=60?`${Math.floor(b/60)}m ${b%60}s`:`${b}s`:"",k=r?"bg-accent-blue":c?"bg-accent-red":"bg-accent-green";return e.jsxs("div",{className:"rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"toolcall-row",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>f(!g),children:[r?e.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):e.jsx("span",{className:`w-2 h-2 shrink-0 rounded-full ${k}`}),e.jsx("span",{className:"text-xs text-dark-muted shrink-0",children:"🔧"}),e.jsx("span",{className:"font-medium text-[13px] text-dark-text truncate",children:t.name}),r&&e.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ge,{size:10}),e.jsx("span",{ref:a,children:"0s"})]}),!r&&w&&e.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ge,{size:10}),e.jsx("span",{children:w})]}),e.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${g?"":"rotate-180"}`,children:e.jsx(le,{size:13})})]}),!g&&e.jsxs("div",{className:"ml-4 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-1",children:[e.jsxs("div",{className:"py-0.5 px-2",children:[e.jsx("div",{className:"text-[10px] text-dark-muted mb-0.5",children:"参数"}),e.jsx("pre",{className:"text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-24 overflow-y-auto custom-scrollbar",children:typeof t.args=="string"?t.args:JSON.stringify(t.args,null,2)})]}),d&&e.jsxs("div",{className:"py-0.5 px-2",children:[e.jsx("div",{className:`text-[10px] mb-0.5 ${c?"text-accent-red":"text-accent-green"}`,children:c?"错误":"结果"}),o&&(l||i)?e.jsx(zn,{filePath:u,content:l||i}):e.jsx("pre",{className:`text-[11px] font-mono bg-dark-bg border border-dark-border p-2 rounded overflow-x-auto max-h-48 overflow-y-auto custom-scrollbar whitespace-pre-wrap break-all ${c?"text-accent-red":"text-accent-green"}`,children:i})]})]})]})}),ts=p.memo(function({text:t,maxLength:n=300,preformatted:r=!1}){const[a,d]=p.useState(!1);return t.length>n?e.jsxs("div",{children:[r?e.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:a?t:t.slice(0,n)+"..."}):e.jsx("div",{className:"text-dark-text leading-snug",children:a?t:t.slice(0,n)+"..."}),e.jsx("button",{onClick:o=>{o.stopPropagation(),d(!a)},className:"mt-1 text-[10px] px-2 py-0.5 rounded bg-dark-hover text-accent-blue hover:bg-dark-border transition-colors",children:a?"收起":"展开"})]}):r?e.jsx("pre",{className:"text-xs font-mono bg-dark-bg p-1.5 rounded overflow-x-auto custom-scrollbar mt-1 text-accent-green",children:t}):e.jsx("div",{className:"text-dark-text leading-snug",children:t})}),ns=p.memo(function({step:t,defaultCollapsed:n=!0}){const[r,a]=p.useState(n),[d,c]=p.useState(!0),o=t.status==="running",i=vt(o),l=t.description||t.thought||t.result||t.action||t.toolCalls&&t.toolCalls.length>0,u=t.duration??0,g=u>0?u>=60?`${Math.floor(u/60)}m ${u%60}s`:`${u}s`:"",f={pending:"bg-dark-muted/40",running:"bg-accent-blue",success:"bg-accent-green",error:"bg-accent-red",warning:"bg-accent-yellow"}[t.status]||"bg-dark-muted/40";return e.jsxs("div",{className:"rounded-lg transition-colors hover:bg-dark-surface/40","data-testid":"step-row",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 cursor-pointer select-none",onClick:()=>l&&a(!r),children:[o?e.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):e.jsx("span",{className:`w-2 h-2 shrink-0 rounded-full ${f} ${t.status==="pending"?"opacity-60":""}`}),e.jsx("span",{className:"text-[13px] text-dark-text truncate",children:t.title}),o&&e.jsxs("span",{className:"text-[11px] text-accent-blue shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ge,{size:10}),e.jsx("span",{ref:i,children:"0s"})]}),!o&&g&&e.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0 flex items-center gap-1 tabular-nums",children:[e.jsx(ge,{size:10}),e.jsx("span",{children:g})]}),l&&e.jsx("span",{className:`ml-auto shrink-0 text-dark-muted/60 transition-transform ${r?"":"rotate-180"}`,children:e.jsx(le,{size:13})})]}),!r&&l&&e.jsxs("div",{className:"ml-4 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-1",children:[t.description&&e.jsx("div",{className:"text-dark-muted py-0.5 px-2 text-xs",children:t.description}),t.thought&&e.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-blue/40 bg-accent-blue/5 rounded-r",children:[e.jsxs("div",{className:"flex items-center gap-1 text-accent-blue cursor-pointer hover:opacity-80 select-none",onClick:()=>c(!d),children:[d?e.jsx(qe,{size:12}):e.jsx(le,{size:12}),e.jsx("span",{children:"🧠 思考"}),d&&e.jsxs("span",{className:"text-[10px] text-dark-muted truncate max-w-[200px]",children:[t.thought.slice(0,80).replace(/\n/g," "),"..."]})]}),!d&&e.jsx("div",{className:"text-dark-muted italic whitespace-pre-wrap leading-snug mt-1",children:t.thought.replace(/\n\s*\n+/g,`
7
- `)})]}),t.action&&e.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-yellow/40 bg-accent-yellow/5 rounded-r",children:[e.jsx("div",{className:"flex items-center gap-1 text-accent-yellow mb-0.5",children:"⚡ 执行"}),e.jsx("div",{className:"text-dark-text leading-snug font-mono text-[11px]",children:t.action})]}),t.toolCalls&&t.toolCalls.length>0&&t.toolCalls.map(x=>e.jsx("div",{className:"px-1 py-0.5",children:e.jsx(jt,{toolCall:x})},x.id)),t.result&&e.jsxs("div",{className:"py-0.5 px-2 text-xs border-l-2 border-accent-green/40 bg-accent-green/5 rounded-r",children:[e.jsx("div",{className:"flex items-center gap-1 text-accent-green mb-0.5",children:"✓ 结果"}),e.jsx(ts,{text:t.result,maxLength:500})]})]})]})}),ss=p.memo(function({steps:t,isGenerating:n}){const{t:r}=$(),[a,d]=p.useState(n),c=p.useRef(n);p.useEffect(()=>{c.current&&!n&&d(!1),c.current=n},[n]);const o=t.length,i=n||t.some(x=>x.status==="running"),l=[...t].reverse().find(x=>x.status==="running"),u=t[t.length-1],g=(l==null?void 0:l.title)||(u==null?void 0:u.title)||"",f=`${o} ${r(o===1?"chat.stepCount":"chat.stepCountPlural")}`;return e.jsxs("div",{className:"mb-1 rounded-lg border border-dark-border/50 transition-colors","data-testid":"turn-group",children:[e.jsxs("button",{className:"flex w-full items-center gap-2 px-2 py-1 text-left cursor-pointer select-none hover:bg-dark-surface/40",onClick:()=>d(!a),"data-testid":"turn-group-toggle",children:[e.jsx("span",{className:"shrink-0 text-dark-muted/60 transition-transform",children:a?e.jsx(le,{size:13}):e.jsx(qe,{size:13})}),i?e.jsx("span",{className:"inline-block w-3 h-3 shrink-0 rounded-full border-2 border-accent-blue border-r-transparent animate-spin"}):e.jsx("span",{className:"w-2 h-2 shrink-0 rounded-full bg-accent-green"}),e.jsx("span",{className:"text-xs text-dark-muted",children:i?`${r("chat.runningSteps")} ${f}…`:f}),i&&g&&e.jsxs("span",{className:"min-w-0 flex-1 truncate pl-1 text-xs text-dark-muted/70",children:["· ",g]})]}),a&&e.jsx("div",{className:"ml-3 pb-1 pl-3 border-l-2 border-dark-border/30 space-y-0.5",children:t.map(x=>e.jsx(ns,{step:x},x.id))})]})}),De=15,rs=p.memo(function({approval:t,onResolved:n}){const{t:r}=$("hook"),[a,d]=p.useState(!1),[c,o]=p.useState(De),i=p.useRef(null),l=t.status==="pending",{level:u,reasonKey:g}=fn(t.toolName,t.askPayload),f=hn[u],x=En(t.toolName,t.askPayload),b=Sn(t.toolName,t.askPayload),w=tt(t.askPayload)!==null;p.useEffect(()=>{if(l)return o(De),i.current=setInterval(()=>{o(A=>A<=1?(i.current&&clearInterval(i.current),0):A-1)},1e3),()=>{i.current&&clearInterval(i.current)}},[l,t.approvalId]),p.useEffect(()=>{const A=(t.timeoutMs??15e3)>0;c===0&&l&&!a&&A&&k()},[c]);const k=p.useCallback(()=>{!l||a||(d(!0),i.current&&clearInterval(i.current),G.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})}),n==null||n(t.approvalId,"approved"))},[l,a,t.approvalId,n]),S=p.useCallback(()=>{!l||a||(d(!0),i.current&&clearInterval(i.current),G.send({type:"hook_deny",data:JSON.stringify({approvalId:t.approvalId})}),n==null||n(t.approvalId,"denied"))},[l,a,t.approvalId,n]),y=p.useCallback(()=>{if(!l||a)return;d(!0),i.current&&clearInterval(i.current);const A=nt.getState(),F=tt(t.askPayload);F?(A.addToSessionAllowList(t.toolName,F),G.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId,sessionAllow:!0})})):(A.addToSessionAllowList(t.toolName),G.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})})),n==null||n(t.approvalId,"approved")},[l,a,t.approvalId,t.toolName,t.askPayload,n]),R=p.useCallback(()=>{!l||a||(d(!0),i.current&&clearInterval(i.current),nt.getState().setAutoMode(!0),xe.getState().setAuto(!0),G.send({type:"hook_allow",data:JSON.stringify({approvalId:t.approvalId})}),n==null||n(t.approvalId,"approved"))},[l,a,t.approvalId,n]);if(!l){const A=t.status==="approved";return e.jsx("div",{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs ${A?"bg-accent-green/10 border border-accent-green/30 text-accent-green":"bg-accent-red/10 border border-accent-red/30 text-accent-red"}`,children:A?e.jsxs(e.Fragment,{children:[e.jsx(ft,{size:14}),e.jsxs("span",{children:[r("alreadyAllowed"),t.toolName]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{size:14}),e.jsxs("span",{children:[r("alreadyDenied"),t.toolName]})]})})}const T=c/De*100,I=c<=5,O=[{id:"allow",index:1,label:r("optionAllow"),hint:r("optionAllowHint"),action:k,kind:"primary"},{id:"allow_session",index:3,label:r("optionAllowAlways"),hint:w?r("optionAllowPathHint"):r("optionAllowAlwaysHint",{tool:t.toolName}),action:y,kind:"secondary"},{id:"auto_mode",index:4,label:r("optionAutoMode"),hint:r("optionAutoModeHint"),action:R,kind:"secondary"},{id:"deny",index:2,label:r("optionDeny"),hint:r("optionDenyHint"),action:S,kind:"danger"}],U={primary:"bg-accent-blue text-white hover:opacity-90 shadow-sm",secondary:"border border-dark-border bg-dark-bg text-dark-text hover:bg-dark-hover",danger:"text-dark-muted hover:bg-red-500/10 hover:text-red-400"};return e.jsxs("div",{className:`bg-dark-bg border rounded-xl overflow-hidden ${b.external?"border-amber-500/40":f.border}`,children:[e.jsxs("div",{className:`flex items-center gap-2 px-3 py-2 border-b ${f.bg} ${b.external?"border-amber-500/30":f.border}`,children:[e.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-bold border shrink-0 ${rc.badge}",children:[f.icon," ",u]}),e.jsx("span",{className:"flex-none w-6 h-6 rounded-md bg-accent-blue/10 text-accent-blue inline-flex items-center justify-center",children:e.jsx(qt,{size:13})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(An,{pre:r(Tn(t.toolName)),obj:Cn(t.toolName,t.askPayload)})}),b.external&&b.path?e.jsxs("span",{className:"flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-400 border border-amber-500/30 shrink-0",title:b.path,children:[e.jsx(Kt,{size:10}),b.path.length>32?`${b.path.slice(0,31)}…`:b.path]}):e.jsx("span",{className:"text-[10px] text-dark-muted/60 shrink-0",children:r("scopeLocal")}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-1 shrink-0",children:[e.jsx(ge,{size:11,className:I?"text-accent-red":"text-dark-muted"}),e.jsxs("span",{className:`text-[11px] font-mono ${I?"text-accent-red animate-pulse":"text-dark-muted"}`,children:[c,"s"]}),e.jsx("div",{className:"w-10 h-1 bg-dark-border rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-1000 ${I?"bg-accent-red":c<=8?"bg-accent-yellow":"bg-accent-green"}`,style:{width:`${T}%`}})})]})]}),e.jsxs("div",{className:"px-3 py-2.5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-dark-muted shrink-0",children:r("tool")}),e.jsx("code",{className:"text-accent-blue font-mono text-xs bg-dark-surface px-1.5 py-0.5 rounded",children:t.toolName}),e.jsx("span",{className:"text-[10px] text-dark-muted/50",children:r(g)})]}),x&&e.jsx(_n,{text:x.text,mono:x.mono}),(u==="CRITICAL"||u==="HIGH")&&e.jsxs("div",{className:`flex items-center gap-1.5 text-[11px] px-2 py-1 rounded ${f.bg} ${f.text}`,children:[e.jsx(fe,{size:12}),e.jsx("span",{children:r(u==="CRITICAL"?"highRiskWarning":"mediumRiskConfirm")})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:O.map(A=>e.jsxs("button",{onClick:A.action,disabled:a,className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs transition-colors disabled:opacity-50 ${U[A.kind]}`,children:[e.jsx("span",{className:`text-[9px] font-mono rounded px-0.5 ${A.kind==="primary"?"bg-white/20":"bg-dark-surface text-dark-muted"}`,children:A.index}),e.jsx("span",{children:A.label}),e.jsx("span",{className:`text-[10px] ${A.kind==="primary"?"text-white/70":"text-dark-muted/60"} hidden sm:inline`,children:A.hint})]},A.id))}),e.jsx("div",{className:"text-[10px] text-dark-muted/50 pt-0.5 border-t border-dark-border/50",children:r("clickToSelect")})]})]})}),ve={xlsx:{icon:Ue,label:"Excel"},xls:{icon:Ue,label:"Excel"},csv:{icon:Be,label:"CSV"},docx:{icon:Be,label:"Word"},text:{icon:Ke,label:"文本"}};function lt(s){return!s&&s!==0?"—":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`}const as=p.memo(function({job:t}){var g,f;const{t:n}=$(),{stage:r}=t,a=p.useCallback(x=>{ee.files.download(x).then(b=>{b.success||B.error(b.error||n("fileJob.downloadFailed"))})},[n]),d=p.useMemo(()=>t.attachments||[],[t.attachments]),c=p.useMemo(()=>t.parsedFiles||[],[t.parsedFiles]),o=p.useMemo(()=>t.mapping||[],[t.mapping]),i=p.useMemo(()=>t.result||[],[t.result]),l=t.renderProgress??(r==="rendering"?0:100),u=t.parseProgress??(r==="parsing"?0:100);return e.jsxs("div",{className:"mt-2 rounded-xl border border-dark-border bg-dark-surface/60 overflow-hidden max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3.5 py-2.5 border-b border-dark-border/60 bg-dark-surface",children:[r==="complete"?e.jsx(ze,{size:15,className:"text-accent-green shrink-0"}):r==="error"?e.jsx(fe,{size:15,className:"text-accent-red shrink-0"}):e.jsx(Se,{size:15,className:"text-accent-blue animate-spin shrink-0"}),e.jsx("span",{className:"text-[13px] font-medium text-dark-text",children:is(r,n)}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"text-[10px] font-mono text-dark-muted/60",children:t.jobId})]}),e.jsxs("div",{className:"px-3.5 py-3 space-y-3",children:[d.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:d.map((x,b)=>{const w=ve[x.kind]||ve.text,k=w.icon;return e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dark-border bg-dark-bg px-2.5 py-1.5",children:[e.jsx(k,{size:14,className:"text-accent-blue shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs text-dark-text truncate max-w-[160px]",children:x.fileName}),e.jsxs("div",{className:"text-[10px] text-dark-muted",children:[lt(x.size)," · ",w.label,x.role&&x.role!=="unknown"&&e.jsxs("span",{className:K("ml-1",x.role==="data"?"text-accent-green":"text-accent-purple"),children:["· ",x.role==="data"?n("fileJob.roleData"):n("fileJob.roleTemplate")]})]})]})]},`${x.fileName}-${b}`)})}),r==="parsing"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs text-dark-muted",children:n("fileJob.parsing",{file:((g=d[0])==null?void 0:g.fileName)||((f=c[0])==null?void 0:f.fileName)||""})}),e.jsx(rt,{value:u,size:"sm",showLabel:!0})]}),c.length>0&&r!=="error"&&e.jsxs("div",{className:"space-y-1.5",children:[c.map(x=>e.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[e.jsx(ze,{size:13,className:"text-accent-green shrink-0"}),e.jsx("span",{className:"truncate",children:x.fileName}),e.jsx("span",{className:"text-[10px] text-dark-muted/70",children:n("fileJob.parsedSummary",{rows:x.rowCount,fields:x.fields.length})})]},x.fileName)),c[0]&&e.jsxs("div",{className:"flex flex-wrap gap-1 pt-1",children:[c[0].fields.slice(0,12).map(x=>e.jsx("span",{className:"rounded bg-dark-bg border border-dark-border/60 px-1.5 py-0.5 text-[10px] font-mono text-dark-muted",children:x},x)),c[0].fields.length>12&&e.jsxs("span",{className:"text-[10px] text-dark-muted/60",children:["+",c[0].fields.length-12]})]})]}),o.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[11px] text-dark-muted",children:n("fileJob.mappingTitle")}),e.jsx("div",{className:"overflow-hidden rounded-lg border border-dark-border",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-dark-bg text-dark-muted",children:[e.jsx("th",{className:"text-left px-2.5 py-1.5 font-medium",children:n("fileJob.templatePlaceholder")}),e.jsx("th",{className:"px-2 py-1.5"}),e.jsx("th",{className:"text-left px-2.5 py-1.5 font-medium",children:n("fileJob.dataField")})]})}),e.jsx("tbody",{children:o.slice(0,8).map(x=>e.jsxs("tr",{className:"border-t border-dark-border/50",children:[e.jsx("td",{className:"px-2.5 py-1.5 font-mono text-accent-purple",children:"{{"+x.placeholder+"}}"}),e.jsx("td",{className:"px-2 py-1.5 text-dark-muted",children:e.jsx(Wt,{size:11})}),e.jsx("td",{className:"px-2.5 py-1.5 font-mono text-accent-blue",children:x.field})]},x.placeholder))})]})}),o.length>8&&e.jsx("div",{className:"text-[10px] text-dark-muted/60",children:n("fileJob.mappingMore",{n:o.length-8})})]}),r==="rendering"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs text-dark-muted",children:n("fileJob.rendering",{current:t.currentRow||0,total:t.totalRows||0})}),e.jsx(rt,{value:l,size:"sm",variant:"warning",showLabel:!0})]}),i.length>0&&r==="complete"&&e.jsx("div",{className:"space-y-1.5",children:i.map(x=>{const w=(ve[x.format]||ve.text).icon,k=x.failedRows.length>0;return e.jsxs("div",{className:"rounded-lg border border-dark-border bg-dark-bg px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{size:15,className:"text-accent-green shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-dark-text truncate",children:x.fileName}),e.jsxs("div",{className:"text-[10px] text-dark-muted",children:[lt(x.size)," · ",x.successCount,"/",x.rowCount," 行",k&&e.jsxs("span",{className:"text-accent-red",children:[" · ",x.failedRows.length," 行失败"]})]})]}),e.jsxs("button",{onClick:()=>a(x.path),className:"flex items-center gap-1 rounded-md bg-accent-blue/10 text-accent-blue px-2 py-1 text-[11px] hover:bg-accent-blue/20 transition-colors",title:n("fileJob.download"),children:[e.jsx(Jt,{size:12}),n("fileJob.download")]})]}),k&&e.jsxs("div",{className:"mt-1.5 space-y-0.5 border-t border-dark-border/50 pt-1.5",children:[x.failedRows.slice(0,3).map(S=>e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-accent-red",children:[e.jsx(Xt,{size:10,className:"shrink-0"}),e.jsxs("span",{children:["#",S.index+1]}),e.jsx("span",{className:"truncate",children:S.error})]},S.index)),x.failedRows.length>3&&e.jsxs("div",{className:"text-[10px] text-dark-muted/70",children:["+",x.failedRows.length-3," 行"]})]})]},x.path)})}),r==="error"&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-accent-red/30 bg-accent-red/5 px-3 py-2.5",children:[e.jsx(fe,{size:15,className:"text-accent-red shrink-0 mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium text-accent-red",children:t.error||n("fileJob.error")}),t.errorDetail&&e.jsx("div",{className:"mt-0.5 text-[11px] text-dark-muted break-words",children:t.errorDetail})]})]})]})]})});function is(s,t){switch(s){case"uploaded":return t("fileJob.stageUploaded");case"parsing":return t("fileJob.stageParsing");case"mapping":return t("fileJob.stageMapping");case"rendering":return t("fileJob.stageRendering");case"complete":return t("fileJob.stageComplete");case"error":return t("fileJob.stageError");default:return t("fileJob.stageUploaded")}}const ct={auth:{icon:Vt,color:"text-accent-red"},rate_limit:{icon:et,color:"text-accent-yellow"},timeout:{icon:et,color:"text-accent-yellow"},network:{icon:Yt,color:"text-accent-yellow"},model:{icon:Zt,color:"text-accent-red"},tool:{icon:fe,color:"text-accent-yellow"},unknown:{icon:fe,color:"text-accent-red"}},os=p.memo(function({error:t,onRetry:n}){const{t:r}=$(),[a,d]=p.useState(!1),c=ct[t.category]||ct.unknown,o=c.icon,i=()=>{window.dispatchEvent(new CustomEvent("switch-tab",{detail:"models"}))};return e.jsxs("div",{className:"mt-2 max-w-2xl overflow-hidden rounded-xl border border-accent-red/30 bg-dark-surface",children:[e.jsxs("div",{className:"flex items-start gap-3 px-3.5 py-3",children:[e.jsx(o,{size:18,className:K("shrink-0 mt-0.5",c.color)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[13px] font-medium text-dark-text",children:t.summary}),t.detail&&t.detail!==t.summary&&e.jsx("div",{className:"mt-0.5 text-[11px] text-dark-muted/80 break-words",children:t.detail.slice(0,160)}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2",children:[t.retryable&&n&&e.jsxs("button",{onClick:n,className:"flex items-center gap-1 rounded-md bg-accent-blue/10 text-accent-blue px-2 py-1 text-[11px] hover:bg-accent-blue/20 transition-colors",children:[e.jsx(ce,{size:11}),r("errorCard.retry")]}),t.category==="auth"&&e.jsxs("button",{onClick:i,className:"flex items-center gap-1 rounded-md bg-dark-hover text-dark-text px-2 py-1 text-[11px] hover:bg-dark-border transition-colors",children:[e.jsx(Qt,{size:11}),r("errorCard.modelSettings")]}),t.detail&&e.jsxs("button",{onClick:()=>d(l=>!l),className:"flex items-center gap-0.5 text-[11px] text-dark-muted hover:text-dark-text transition-colors",children:[e.jsx(le,{size:11,className:K("transition-transform",a&&"rotate-180")}),r("errorCard.details")]})]})]})]}),a&&t.detail&&e.jsx("div",{className:"border-t border-dark-border/60 bg-dark-bg px-3.5 py-2.5 text-[11px] font-mono text-dark-muted break-words max-h-40 overflow-y-auto custom-scrollbar",children:t.detail})]})});function Le({onClick:s,title:t,children:n,danger:r=!1}){return e.jsx("button",{onClick:s,title:t,"aria-label":t,className:`inline-flex items-center justify-center rounded p-1 transition-colors ${r?"text-dark-muted hover:text-accent-red hover:bg-accent-red/10":"text-dark-muted hover:text-dark-text hover:bg-dark-hover"}`,children:n})}function dt({message:s,sessionId:t,onRegenerate:n,onDeleteMessage:r}){const{t:a}=$(),[d,c]=p.useState(!1),o=p.useRef(null);p.useEffect(()=>()=>{o.current&&clearTimeout(o.current)},[]);const i=p.useCallback(async()=>{try{await navigator.clipboard.writeText(s.content||s.thinking||""),c(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>c(!1),2e3)}catch(l){console.error("Failed to copy message:",l)}},[s.content,s.thinking]);return t?e.jsxs(e.Fragment,{children:[e.jsx(Le,{onClick:i,title:a("chat.copyMessage"),children:d?e.jsx(ft,{size:12,className:"text-accent-green"}):e.jsx(gt,{size:12})}),s.type==="assistant"&&n&&e.jsx(Le,{onClick:()=>n(s.id),title:a("chat.regenerate"),children:e.jsx(ce,{size:12})}),r&&e.jsx(Le,{onClick:()=>r(s.id),title:a("chat.deleteMessage"),danger:!0,children:e.jsx(en,{size:12})})]}):null}function ut({ts:s,align:t,children:n}){const{i18n:r}=$(),a=r.language==="en"?"en-US":"zh-CN";return e.jsx("div",{className:"relative h-0 select-none",children:e.jsxs("div",{className:`absolute top-1 flex items-center gap-0.5 text-[10.5px] leading-none whitespace-nowrap opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150 ${t==="right"?"right-0":"left-0"}`,children:[n,e.jsx("span",{className:"pl-1 text-[10px] text-dark-muted/50",children:new Date(s).toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})})]})})}function ls(s,t){const n=[];for(const r of s)n.push({key:`thinking-${r.index}`,index:r.index,kind:"thinking",block:r});for(const r of t??[])n.push({key:`tool-${r.id}`,index:r.index??Number.MAX_SAFE_INTEGER,kind:"tool",toolCall:r});return n.sort((r,a)=>r.index-a.index),n}function cs({index:s,text:t,isGenerating:n,collapsed:r,onToggle:a}){const{t:d}=$();return e.jsxs("div",{children:[e.jsxs("button",{className:"flex items-center gap-1.5 cursor-pointer select-none py-0.5 text-xs",onClick:()=>a(s),"data-testid":"thinking-toggle",children:[e.jsx(qe,{size:12,className:`text-dark-muted transition-transform ${r?"":"rotate-90"}`}),e.jsx("span",{className:n?"text-accent-blue/90 animate-pulse":"text-dark-muted",children:n?`${d("chat.thinking")}…`:d("chat.thoughtProcess")})]}),!r&&e.jsx("div",{className:"mt-1 text-xs text-dark-muted whitespace-pre-wrap break-words border-l-2 border-dark-border/40 pl-3 max-h-64 overflow-y-auto custom-scrollbar",children:t.replace(/\n{3,}/g,`
8
-
9
- `)})]})}const ds=p.memo(function({message:t,sessionId:n,onRegenerate:r,onDeleteMessage:a}){var S,y,R;const{t:d}=$(),c=q(T=>{var O;if(!n||!T.generatingSessions.includes(n))return!1;const I=T.messagesBySession[n];return I?((O=I[I.length-1])==null?void 0:O.id)===t.id:!1}),o=p.useMemo(()=>t.thinkingBlocks&&t.thinkingBlocks.length>0?t.thinkingBlocks:t.thinking?[{index:Number.MIN_SAFE_INTEGER,text:t.thinking}]:[],[t.thinkingBlocks,t.thinking]),[i,l]=p.useState({}),u=p.useRef(c);p.useEffect(()=>{u.current&&!c&&l(T=>{const I={...T};for(const O of o)I[O.index]=!0;return I}),u.current=c},[c,o]);const g=p.useMemo(()=>ls(o,t.toolCalls),[o,t.toolCalls]),f=p.useCallback(T=>{l(I=>({...I,[T]:!(I[T]??!c)}))},[c]),x=t.type==="user",b=t.type==="system",w=p.useCallback((T,I)=>{if(!n)return;const U=q.getState().getMessages(n),A=U.findIndex(te=>te.id===t.id);if(A===-1)return;const F=U[A];if(!F)return;const J={...F,hookApproval:F.hookApproval?{...F.hookApproval,status:I}:void 0},V=[...U];V[A]=J,q.setState({messagesBySession:{...q.getState().messagesBySession,[n]:V}})},[n,t.id]);if(t.deleted)return null;if(x)return e.jsx("div",{className:"group flex justify-end animate-fade-in-up px-1",children:e.jsxs("div",{className:"max-w-[92%] md:max-w-[78%]",children:[e.jsx("div",{className:"rounded-2xl rounded-br-md border border-dark-border/70 bg-dark-surface px-4 py-2.5 shadow-sm",children:e.jsx("div",{className:"text-dark-text whitespace-pre-wrap break-words leading-relaxed text-sm",children:(S=t.content)==null?void 0:S.replace(/\n{3,}/g,`
10
-
11
- `)})}),e.jsx(ut,{ts:t.timestamp,align:"right",children:e.jsx(dt,{message:t,sessionId:n,onRegenerate:r,onDeleteMessage:a})})]})});if(b)return e.jsx("div",{className:"flex justify-center animate-fade-in-up px-1 py-1",children:e.jsx("div",{className:"text-[11px] text-dark-muted bg-dark-surface border border-dark-border/60 rounded-full px-3.5 py-1 max-w-[90%] text-center",children:t.content})});const k=!t.hookApproval&&!!(o.length>0||t.steps&&t.steps.length>0||t.toolCalls&&t.toolCalls.length>0);return e.jsx("div",{className:"group flex animate-fade-in-up px-1",children:e.jsxs("div",{className:"w-full max-w-full",children:[e.jsx(ut,{ts:t.timestamp,align:"left",children:e.jsx(dt,{message:t,sessionId:n,onRegenerate:r,onDeleteMessage:a})}),e.jsxs("div",{className:k?"pt-7":"",children:[t.steps&&t.steps.length>0&&!t.hookApproval?e.jsx(ss,{steps:t.steps,isGenerating:c}):e.jsx(e.Fragment,{children:g.length>0&&!t.hookApproval&&e.jsx("div",{className:"mb-1 space-y-0.5",children:g.map(T=>T.kind==="thinking"&&T.block?e.jsx(cs,{index:T.block.index,text:T.block.text,isGenerating:c,collapsed:i[T.block.index]??!c,onToggle:f},T.key):T.toolCall&&e.jsx(jt,{toolCall:T.toolCall},T.key))})}),t.content?e.jsx("div",{className:"leading-relaxed",children:e.jsx(On,{content:t.content.replace(/\n{3,}/g,`
12
-
13
- `)})}):o.length===0&&!t.hookApproval&&((y=t.steps)!=null&&y.length)?null:o.length===0&&!t.hookApproval&&!((R=t.steps)!=null&&R.length)&&c?e.jsxs("div",{className:"flex items-center gap-3 py-1 text-xs text-dark-muted",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink"}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.2s"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.4s"}})]}),d("chat.thinking"),"..."]}):null,t.summary&&!c&&e.jsx("div",{className:"mt-1.5 text-[11px] text-dark-muted/70","data-testid":"turn-summary",children:bn(t.summary)}),t.fileJob&&e.jsx("div",{className:"mt-3",children:e.jsx(as,{job:t.fileJob})}),t.errorCard&&e.jsx("div",{className:"mt-3",children:e.jsx(os,{error:t.errorCard,onRetry:n&&r?()=>r(t.id):void 0})}),t.hookApproval&&e.jsx("div",{className:"mt-3 border-l-2 border-accent-yellow/50 pl-3",children:e.jsx(rs,{approval:t.hookApproval,onResolved:w})})]})]})})}),us=p.memo(function({messages:t,isGenerating:n,sessionId:r,onSendSuggestion:a,onRegenerate:d,onDeleteMessage:c}){const{t:o}=$(),i=p.useRef(null),[l,u]=p.useState(!0),g=p.useRef(n);g.current=n;const f=p.useCallback(()=>{const k=i.current;if(!k)return;const S=k.scrollHeight-k.scrollTop-k.clientHeight;u(S<50)},[]),x=p.useCallback(()=>{const k=i.current;k&&(k.scrollTop=k.scrollHeight)},[]);p.useEffect(()=>{n&&(u(!0),x())},[n,x]),p.useEffect(()=>{l&&x()},[t,l,x]);const b=p.useMemo(()=>t.filter(k=>!k.deleted),[t]),w=p.useMemo(()=>[{icon:tn,label:o("chat.suggestionCode"),prompt:o("chat.suggestionCodePrompt")},{icon:ht,label:o("chat.suggestionAnalyze"),prompt:o("chat.suggestionAnalyzePrompt")},{icon:bt,label:o("chat.suggestionAutomate"),prompt:o("chat.suggestionAutomatePrompt")}],[o]);return e.jsxs("div",{ref:i,onScroll:f,className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar",children:[b.length===0?e.jsx("div",{className:"flex min-h-[55vh] items-center justify-center p-6",children:e.jsxs("div",{className:"w-full max-w-xl px-4 text-center",children:[e.jsx("img",{src:"/logo.svg",alt:"deepseekcode",className:"w-14 h-14 mx-auto mb-5 rounded-2xl shadow-md"}),e.jsx("h2",{className:"text-xl font-semibold tracking-tight mb-2",children:o("chat.welcome")}),e.jsx("p",{className:"text-dark-muted text-sm mb-8",children:o("chat.welcomeDesc")}),a&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2.5 text-left",children:w.map(k=>e.jsxs("button",{onClick:()=>a(k.prompt),className:"group w-full rounded-xl border border-dark-border bg-dark-surface px-3.5 py-3 text-left transition-all duration-150 hover:border-accent-blue/40 hover:shadow-md hover:-translate-y-px",children:[e.jsx(k.icon,{size:16,"aria-hidden":"true",className:"text-accent-blue mb-2"}),e.jsx("div",{className:"text-[13px] font-medium text-dark-text",children:k.label}),e.jsx("div",{className:"mt-0.5 text-[11px] leading-snug text-dark-muted line-clamp-2",children:k.prompt})]},k.label))})]})}):e.jsx("div",{className:"flex flex-col",children:b.map(k=>e.jsx("div",{className:"px-4 py-2",children:e.jsx(ds,{message:k,sessionId:r,onRegenerate:d,onDeleteMessage:c})},k.id))}),n&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted py-3 px-5",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink"}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.2s"}}),e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent-blue animate-blink",style:{animationDelay:"0.4s"}})]}),e.jsx("span",{children:o("chat.thinkingEllipsis")})]})]})}),ps={plan:"border-accent-blue/30 text-accent-blue bg-accent-blue/10","auto-plan":"border-accent-cyan/30 text-accent-cyan bg-accent-cyan/10",act:"border-accent-green/30 text-accent-green bg-accent-green/10","auto-act":"border-accent-yellow/30 text-accent-yellow bg-accent-yellow/10",goal:"border-accent-purple/30 text-accent-purple bg-accent-purple/10","auto-goal":"border-accent-red/30 text-accent-red bg-accent-red/10",normal:"border-accent-green/30 text-accent-green"},ms=p.memo(function(){const{t}=$(),n=xe(i=>i.mode),r=xe(i=>i.setBaseMode),a=xe(i=>i.toggleAuto),d=n==="normal"?"act":n,c=Nn(d),o=He(d);return e.jsxs("div",{className:"flex items-center gap-1",children:[kn.map(i=>{const l=c===i,u=yn[i],g=n!=="normal"&&l?ps[n]??"border-dark-border text-dark-muted":"border-dark-border text-dark-muted hover:bg-dark-hover";return e.jsx("button",{type:"button",onClick:()=>r(i),className:K("px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",g),title:t("chat.clickToSwitchMode"),"aria-pressed":l,children:u.label},i)}),e.jsxs("button",{type:"button",role:"switch","aria-checked":o,onClick:()=>a(),className:K("flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs whitespace-nowrap transition-colors cursor-pointer",o?"border-accent-yellow/40 text-accent-yellow bg-accent-yellow/10":"border-dark-border text-dark-muted hover:bg-dark-hover"),title:t("plan.autoApprove"),children:[e.jsx(ce,{size:11,className:K(o?"text-accent-yellow":"text-dark-muted")}),e.jsx("span",{children:t("plan.autoApprove")})]})]})});function xs({isOpen:s,files:t,selectedIndex:n,query:r,isSearching:a,onSelect:d,onHover:c,selectedCount:o=0,onFinish:i}){return s?e.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 bg-dark-surface border border-dark-border rounded-lg shadow-xl overflow-hidden z-50",children:[e.jsxs("div",{className:"max-h-60 overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-[11px] text-dark-muted border-b border-dark-border bg-dark-bg",children:[e.jsx("span",{className:"font-medium text-dark-text",children:r?`@${r}`:"@ file"}),e.jsxs("span",{className:"opacity-70 flex items-center gap-2",children:[o>0&&e.jsxs("span",{className:"px-1.5 py-0.5 rounded-full bg-accent-blue/20 text-accent-blue font-medium",children:["已选 ",o]}),e.jsx("span",{children:"↑↓ 选择 · Enter 插入(可连续多选)· Esc 关闭"})]})]}),t.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-dark-muted text-xs flex flex-col items-center gap-1",children:a?e.jsxs(e.Fragment,{children:[e.jsx(Se,{size:16,className:"animate-spin"}),e.jsx("span",{children:"搜索文件中..."})]}):e.jsx("span",{children:"未找到匹配的文件"})}):t.map((l,u)=>e.jsxs("button",{onClick:()=>d(l),onMouseEnter:()=>c(u),className:`w-full px-3 py-1.5 flex items-center gap-2 text-left text-xs transition-colors border-l-2 ${u===n?"bg-accent-blue/20 text-accent-blue border-accent-blue":"hover:bg-dark-hover text-dark-text border-transparent"}`,children:[l.type==="directory"?e.jsx(nn,{size:12,className:"text-accent-yellow shrink-0"}):e.jsx(Ke,{size:12,className:"text-dark-muted shrink-0"}),e.jsx("span",{className:"truncate",children:l.name}),e.jsx("span",{className:"text-[10px] text-dark-muted truncate ml-auto",children:l.path})]},l.id||l.path))]}),i&&e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-dark-border bg-dark-bg",children:[e.jsx("span",{className:"text-[10px] text-dark-muted",children:o>0?`已选 ${o} 个文件`:"Enter 插入 · 可连续多选"}),e.jsx("button",{onClick:i,className:"px-3 py-1 text-[11px] rounded bg-accent-blue text-white hover:opacity-90 transition-opacity",children:"完成引用"})]})]}):null}function gs({open:s,onClose:t,onSelect:n}){const{t:r}=$(),[a,d]=p.useState([]),[c,o]=p.useState(!1),[i,l]=p.useState("");p.useEffect(()=>{s&&(l(""),o(!0),ee.skills.list().then(g=>{const f=Array.isArray(g.data)?g.data:[];d(f.filter(x=>x.enabled!==!1))}).catch(()=>d([])).finally(()=>o(!1)))},[s]);const u=p.useMemo(()=>{const g=i.trim().toLowerCase();return g?a.filter(f=>[f.id,f.name,f.description,f.category,...f.tags||[]].join(" ").toLowerCase().includes(g)):a},[a,i]);return e.jsx(wn,{isOpen:s,onClose:t,title:r("skills.pickTitle"),size:"lg",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-dark-bg border border-dark-border focus-within:border-accent-blue",children:[e.jsx(ht,{size:14,className:"text-dark-muted shrink-0"}),e.jsx("input",{value:i,onChange:g=>l(g.target.value),placeholder:r("skills.pickPlaceholder"),autoFocus:!0,className:"flex-1 bg-transparent outline-none text-sm placeholder-dark-muted/60"}),c&&e.jsx(ce,{size:13,className:"animate-spin text-dark-muted"})]}),c?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(ce,{size:20,className:"animate-spin text-accent-blue"})}):u.length===0?e.jsx("div",{className:"text-center py-12 text-sm text-dark-muted",children:r("skills.pickEmpty")}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:u.map(g=>e.jsxs("button",{onClick:()=>n(g),className:"text-left rounded-lg border border-dark-border p-3 flex flex-col gap-1 transition-colors hover:border-accent-blue/50 hover:bg-dark-hover",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 min-w-0",children:[e.jsxs("span",{className:"font-medium text-sm truncate",children:[g.icon||"⭐"," ",g.name]}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dark-bg border border-dark-border text-dark-muted shrink-0",children:g.injection||"lazy"})]}),e.jsxs("div",{className:"text-xs text-dark-muted truncate font-mono",children:["$",g.id]}),g.description&&e.jsx("div",{className:"text-xs text-dark-muted line-clamp-2",children:g.description}),e.jsxs("div",{className:"flex items-center justify-between gap-2 mt-1",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-dark-bg border border-dark-border text-dark-muted truncate",children:g.category||"—"}),e.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-accent-blue shrink-0",children:[e.jsx(bt,{size:11}),r("skills.pickUse")]})]})]},g.id))})]})})}const fs=800,pt=/\[Pasted text #(\d+)(?:\s*\+\d+ lines?)?\]/g;let hs=0;const Et=new Map;function bs(s){const t=++hs;return Et.set(t,s),t}function ks(s){return s.length>fs||St(s)>0}function St(s){return(s.match(/\r\n|\r|\n/g)||[]).length}function ys(s){const t=bs(s),n=St(s);return n===0?{id:t,label:`[Pasted text #${t}]`}:{id:t,label:`[Pasted text #${t} +${n} lines]`}}function Ns(s){return pt.lastIndex=0,s.replace(pt,(t,n)=>{const r=parseInt(n,10),a=Et.get(r);return a!==void 0?a:t})}function ws(){return typeof window<"u"&&!!window.__TAURI__}async function vs(){const s=window.__TAURI__;if(!s)return null;try{const t=await s.core.invoke("pick_files");return Array.isArray(t)?t.map(n=>String(n)).filter(Boolean):null}catch(t){return console.warn("[native] pick_files failed, falling back to browser picker:",t),null}}const js=({isOpen:s,commands:t,selectedIndex:n,filter:r,onSelect:a,onHover:d,containerRef:c})=>{const{t:o}=$();return!s||t.length===0?null:e.jsxs("div",{ref:c,className:"absolute bottom-full left-0 right-0 mb-2 bg-dark-surface border border-dark-border rounded-lg shadow-xl overflow-hidden z-50 max-h-72 overflow-y-auto custom-scrollbar",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 text-[11px] text-dark-muted border-b border-dark-border bg-dark-bg",children:[e.jsx("span",{className:"font-medium text-dark-text",children:r?`/${r}`:o("slashCommands.quickCommands")}),e.jsx("span",{className:"opacity-70",children:o("slashCommands.help")})]}),t.map((i,l)=>e.jsxs("button",{"data-index":l,onClick:()=>a(i),onMouseEnter:()=>d(l),className:`w-full px-3 py-2 flex items-start gap-3 text-left transition-colors border-l-2 ${l===n?"bg-accent-blue/10 border-accent-blue":"border-transparent hover:bg-dark-hover"}`,children:[e.jsx("span",{className:"text-lg leading-none shrink-0","aria-hidden":"true",children:i.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium text-dark-text",children:["/",i.name]}),i.args&&e.jsx("span",{className:"text-xs text-dark-muted",children:i.args}),!i.local&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-accent-blue/20 text-accent-blue shrink-0",children:o("slashCommands.backend")})]}),e.jsx("div",{className:"text-xs text-dark-muted truncate",children:i.description})]}),l===n&&e.jsx(sn,{size:14,className:"text-dark-muted shrink-0 mt-0.5","aria-hidden":"true"})]},i.id))]})},mt=/\.(xlsx|xls|csv|docx|txt|md)$/i,Es=".deepseekcode/attachments",Ss=50*1024*1024,je=10,As=s=>/\.xlsx?$/i.test(s)?Ue:/\.(csv|docx|txt|md)$/i.test(s)?Be:Ke,Fe=3e3,xt=5,$e=50;function Cs(s,t){const n=s.slice(0,t),r=n.lastIndexOf("@");if(r===-1)return{active:!1,query:"",start:-1};const a=n.slice(r+1);return/^[\p{L}\p{N}_\-./]*$/u.test(a)?{active:!0,query:a,start:r}:{active:!1,query:"",start:-1}}function Ts(s,t){const n=s.lastIndexOf(`
14
- `,t-1)+1,r=s.slice(n,t);return r.startsWith("/")?/\s/.test(r)?{active:!1,query:""}:{active:!0,query:r.slice(1)}:{active:!1,query:""}}const _s=p.memo(function({sessionId:t,onSend:n,onStop:r,onPause:a,onResume:d,slashOptions:c}){const{t:o}=$(),i=q(m=>{var h;return((h=m.sessionInputs)==null?void 0:h[t])??""}),l=q(m=>m.setSessionInput),u=q(m=>{var h;return((h=m.generatingSessions)==null?void 0:h.includes(t))??!1}),g=q(m=>{var h;return((h=m.pausedSessions)==null?void 0:h.includes(t))??!1}),f=p.useRef(null),x=p.useRef(null),b=p.useRef(!1),[w,k]=p.useState([]),[S,y]=p.useState(!1),[R,T]=p.useState(!1),I=vn(c),{isOpen:O,filter:U,filteredCommands:A,selectedIndex:F,setSelectedIndex:J,selectNext:V,selectPrev:te,executeCommand:ne,openMenu:he,closeMenu:C,setFilter:X,allCommands:be,containerRef:ke}=I,[H,L]=p.useState(!1),[de,Z]=p.useState(""),[Q,ye]=p.useState([]),[Ae,se]=p.useState(0),[At,We]=p.useState(!1),[Ct,ue]=p.useState(0),re=p.useRef(-1),ae=p.useRef(new Set),pe=p.useRef(null),Ne=p.useRef(null),Ce=p.useRef([]),Y=p.useRef(!1);p.useEffect(()=>{ae.current=new Set,Y.current=!1,L(!1),Z(""),ye([]),ue(0),C()},[t,C]);const Je=p.useDeferredValue(i),Xe=st(m=>m.estimateTokens),Te=p.useMemo(()=>Xe(Je),[Je,Xe]),Tt=st(m=>m.model),M=p.useCallback(m=>{l(t,m)},[t,l]),Ze=p.useCallback(()=>{const m=f.current;m&&(m.style.height="auto",m.style.height=Math.min(m.scrollHeight,200)+"px")},[]);p.useEffect(()=>{Ze()},[i,w.length,Ze]);const _e=p.useCallback(()=>{if(pe.current)return Promise.resolve(pe.current);if(Ne.current)return Ne.current;We(!0);const m=(async()=>{try{const h=await ee.files.list(),N=h.success&&h.data?h.data[0]:void 0;if(!N)return pe.current=[],[];const j=[],E=new Set,v=async(_,D)=>{if(D>xt||j.length>=Fe)return;const W=[];for(const z of _||[]){if(j.length>=Fe)return;const oe=z.path.replace(/\\/g,"/");E.has(oe)||(E.add(oe),z.type==="file"?j.push({...z,path:oe}):z.children&&z.children.length>0?await v(z.children,D+1):D<xt&&W.push(z))}if(W.length===0)return;const P=await Promise.all(W.map(async z=>{var oe;try{const Oe=await ee.files.list(z.path.replace(/\\/g,"/"));return Oe.success&&Oe.data?((oe=Oe.data[0])==null?void 0:oe.children)||[]:[]}catch{return[]}}));for(const z of P){if(j.length>=Fe)return;await v(z,D+1)}};return await v(N.children,1),pe.current=j,j}catch{return pe.current=[],[]}finally{Ne.current=null,We(!1)}})();return Ne.current=m,m},[]),Ye=p.useCallback(async(m,h)=>{if(Y.current){const _=re.current;if(_<0||h<_){Y.current=!1,L(!1);return}const D=m.slice(_,h);if(/\s/.test(D)){Y.current=!1,L(!1);return}re.current=_,Z(D),L(!0),se(0);const W=await _e();Ce.current=W;const P=D.toLowerCase();ye(W.filter(z=>!P||z.path.toLowerCase().includes(P)).slice(0,$e));return}const N=Cs(m,h);if(!N.active){H&&L(!1);return}re.current=N.start,Z(N.query),L(!0),se(0);const j=await _e();Ce.current=j;const E=N.query.toLowerCase(),v=j.filter(_=>!E||_.path.toLowerCase().includes(E)).slice(0,$e);ye(v)},[H,_e]),_t=p.useCallback(m=>{const h=m.target.value,N=m.target.selectionStart??h.length;M(h),Ye(h,N);const j=Ts(h,N);j.active?(O||he(),X(j.query),J(0)):O&&C()},[M,Ye,O,he,X,J,C]),Ie=p.useCallback(m=>{const h=f.current,N=i,j=re.current>=0?re.current:(h==null?void 0:h.selectionStart)??N.length,E=Math.min(N.length,j+1+de.length),v=`@${m.path} `,_=N.slice(0,j)+v+N.slice(E);ae.current.add(m.path),M(_),L(!0),Z(""),ye(Ce.current.slice(0,$e)),se(0),ue(ae.current.size),re.current=j+v.length,Y.current=!0,requestAnimationFrame(()=>{h==null||h.focus(),h&&(h.selectionStart=h.selectionEnd=j+v.length)})},[i,de,M]),me=p.useCallback(()=>{Y.current=!1,L(!1),Z(""),ue(0)},[]),Re=p.useCallback(m=>{if(!m.args){const v=ne(m,"");v!=null&&v.message&&(v.success?B.success(v.message):B.error(v.message)),M("");return}const h=f.current,N=(h==null?void 0:h.selectionStart)??i.length,j=i.lastIndexOf(`
15
- `,N-1)+1,E=i.slice(0,j)+`/${m.name} `+i.slice(N);M(E),C(),requestAnimationFrame(()=>{h==null||h.focus();const v=j+m.name.length+2;h&&(h.selectionStart=h.selectionEnd=v)})},[i,M,ne,C]),It=p.useCallback(m=>{const h=f.current,N=(h==null?void 0:h.selectionStart)??i.length,j=`$${m.id} `,E=i.slice(0,N)+j+i.slice(N);M(E),T(!1),Y.current=!1,L(!1),Z(""),requestAnimationFrame(()=>{h==null||h.focus();const v=N+j.length;h&&(h.selectionStart=h.selectionEnd=v)})},[i,M]),ie=p.useCallback(m=>{const h=Array.from(m);k(N=>{const j=je-N.length,E=N.slice();for(const v of h.slice(0,j)){if(!mt.test(v.name)){B.warning(o("fileJob.unsupportedType",{name:v.name}));continue}if(v.size>Ss){B.error(o("fileJob.fileTooLarge",{name:v.name}));continue}if(E.some(_=>_.name===v.name)){B.warning(o("fileJob.duplicateFile",{name:v.name}));continue}E.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,file:v,name:v.name,size:v.size,uploading:!1})}return E.length>=je&&B.warning(o("fileJob.maxAttachments",{n:je})),E})},[o]),Rt=p.useCallback(m=>{m.target.files&&m.target.files.length>0&&(ie(m.target.files),m.target.value="")},[ie]),Ot=p.useCallback(async()=>{var m;if(ws()){const h=await vs();if(!h||h.length===0)return;const N=await ee.fileJob.importPaths(h);if(N.success&&Array.isArray(N.data)){const j=N.data.filter(E=>mt.test(E.name)).map(E=>({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,name:E.name,size:E.size,uploading:!1,path:E.path.replace(/\\/g,"/")}));k(E=>{const v=je-E.length;return[...E,...j.slice(0,v)]})}else B.error(N.error||o("fileJob.importFailed"))}else(m=x.current)==null||m.click()},[o]),Dt=p.useCallback(m=>{k(h=>h.filter(N=>N.id!==m))},[]),Lt=p.useCallback(m=>{m.preventDefault(),y(!0)},[]),Ft=p.useCallback(m=>{m.preventDefault(),y(!1)},[]),$t=p.useCallback(m=>{m.preventDefault(),y(!1),m.dataTransfer.files&&m.dataTransfer.files.length>0&&ie(m.dataTransfer.files)},[ie]),Ve=p.useCallback(async()=>{var h;if(w.length===0)return"";const m=[];for(const N of w){if(N.path){m.push(`<attachment path="${N.path}" />`);continue}if(!N.file)continue;k(v=>v.map(_=>_.id===N.id?{..._,uploading:!0,error:void 0}:_));const j=`${Es}/${N.name}`,E=await ee.files.upload(N.file,j);if(E.success&&((h=E.data)!=null&&h.path)){const v=E.data.path.replace(/\\/g,"/");k(_=>_.map(D=>D.id===N.id?{...D,uploading:!1,path:v}:D)),m.push(`<attachment path="${v}" />`)}else k(v=>v.map(_=>_.id===N.id?{..._,uploading:!1,error:E.error||o("fileJob.uploadFailed")}:_)),B.error(`${N.name}: ${E.error||o("fileJob.uploadFailed")}`)}return m.length>0?`${m.join(`
16
- `)}
17
-
18
- `:""},[w,o]),Mt=p.useCallback(m=>{const h=m.clipboardData.getData("text/plain");if(m.clipboardData.files&&m.clipboardData.files.length>0){m.preventDefault(),ie(m.clipboardData.files);return}if(!h||!ks(h))return;m.preventDefault();const{label:N}=ys(h),j=f.current;if(!j)return;const E=j.selectionStart,v=j.selectionEnd,_=j.value,D=_.slice(0,E)+N+_.slice(v);M(D),requestAnimationFrame(()=>{j.selectionStart=j.selectionEnd=E+N.length})},[M,ie]),we=p.useCallback(async()=>{const m=Ns(i);Y.current=!1,L(!1),C();const h=m.trim(),N=w.length>0;if(!h&&!N)return;const j=m.trim();if(j.startsWith("/")&&!N){const D=jn(j);if(D){const W=be.find(P=>P.name===D.command);if(W){const P=ne(W,D.args);P!=null&&P.message&&(P.success?B.success(P.message):B.error(P.message)),M(""),k([]),ae.current=new Set,ue(0);return}B.error(o("slashCommands.unknownCommand",{cmd:`/${D.command}`}));return}}const E=Array.from(ae.current).filter(D=>m.includes(`@${D}`));let v="";if(N){if(w.some(D=>D.uploading)){B.warning(o("fileJob.stillUploading"));return}v=await Ve()}const _=(v+m).trim();!_&&!N||(n(_||v.trim(),E.length>0?E:void 0),M(""),k([]),ae.current=new Set,ue(0))},[i,w,n,M,Ve,o,C,be,ne]),Pt=p.useCallback(m=>{if(!m.nativeEvent.isComposing){if(H&&Q.length>0){if(m.key==="ArrowDown"){m.preventDefault(),se(h=>(h+1)%Q.length);return}if(m.key==="ArrowUp"){m.preventDefault(),se(h=>(h-1+Q.length)%Q.length);return}if(m.key==="Enter"&&!m.shiftKey&&!m.ctrlKey&&!m.metaKey){const h=Q[Ae];h&&(m.preventDefault(),Ie(h));return}if(m.key==="Escape"){m.preventDefault(),me();return}}else if(H&&m.key==="Escape"){m.preventDefault(),me();return}if(O&&A.length>0){if(m.key==="ArrowDown"){m.preventDefault(),V();return}if(m.key==="ArrowUp"){m.preventDefault(),te();return}if(m.key==="Enter"&&!m.shiftKey&&!m.ctrlKey&&!m.metaKey){const h=A[F];h&&(m.preventDefault(),Re(h));return}if(m.key==="Escape"){m.preventDefault(),C();return}}else if(O&&m.key==="Escape"){m.preventDefault(),C();return}if(m.key==="Escape"&&u){m.preventDefault(),g?d():a();return}if(m.key==="Enter"&&(m.ctrlKey||m.metaKey)){m.preventDefault(),we();return}m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),we())}},[u,g,we,a,d,H,Q,Ae,Ie,me,O,A,F,V,te,Re,C]),zt=p.useCallback(()=>{b.current=!0},[]),Bt=p.useCallback(()=>{b.current=!1},[]),Qe=Te>8e3,Ut=i.trim().length>0||w.length>0;return e.jsxs("div",{className:"shrink-0 px-3 sm:px-4 pb-3 pt-2 bg-dark-bg",onDragOver:Lt,onDragLeave:Ft,onDrop:$t,children:[w.length>0&&e.jsx("div",{className:"mb-2 flex flex-wrap gap-1.5",children:w.map(m=>{const h=As(m.name);return e.jsxs("div",{className:K("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-xs transition-colors",m.error?"border-accent-red/40 bg-accent-red/5 text-accent-red":m.uploading?"border-accent-blue/40 bg-accent-blue/5 text-accent-blue":"border-dark-border bg-dark-surface text-dark-text"),children:[m.uploading?e.jsx(Se,{size:13,className:"animate-spin"}):e.jsx(h,{size:13}),e.jsx("span",{className:"max-w-[140px] truncate",children:m.name}),e.jsx("span",{className:"text-[10px] text-dark-muted",children:m.size>1024*1024?`${(m.size/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(m.size/1024))} KB`}),!m.uploading&&e.jsx("button",{onClick:()=>Dt(m.id),className:"rounded p-0.5 text-dark-muted hover:text-accent-red hover:bg-accent-red/10 transition-colors","aria-label":o("a11y.close"),children:e.jsx(Ee,{size:11})})]},m.id)})}),S&&e.jsx("div",{className:"mb-2 rounded-2xl border-2 border-dashed border-accent-blue/50 bg-accent-blue/5 py-3 text-center text-xs text-accent-blue",children:o("fileJob.dropHint")}),e.jsxs("div",{className:"relative rounded-2xl border border-dark-border bg-dark-surface shadow-sm transition-all duration-150 focus-within:border-accent-blue/50 focus-within:ring-4 focus-within:ring-accent-blue/10",children:[H&&e.jsx("div",{onMouseDown:m=>m.preventDefault(),"aria-hidden":!H,children:e.jsx(xs,{isOpen:H,files:Q,selectedIndex:Ae,query:de,isSearching:At,onSelect:Ie,onHover:se,selectedCount:Ct,onFinish:me})}),O&&e.jsx("div",{onMouseDown:m=>m.preventDefault(),"aria-hidden":!O,children:e.jsx(js,{isOpen:O,commands:A,selectedIndex:F,filter:U,onSelect:Re,onHover:J,containerRef:ke})}),e.jsx("textarea",{ref:f,value:i,onChange:_t,onKeyDown:Pt,onPaste:Mt,onBlur:()=>{H&&me(),C()},onCompositionStart:zt,onCompositionEnd:Bt,placeholder:o(u?"chat.generatingPlaceholder":"chat.inputPlaceholder"),rows:1,disabled:u&&!g,"aria-label":"Message input",className:`w-full bg-transparent px-4 pt-3.5 pb-2 text-sm text-dark-text placeholder-dark-muted/60
19
- resize-none focus:outline-none min-h-[44px] max-h-[40vh] leading-relaxed
20
- disabled:opacity-50 disabled:cursor-not-allowed`}),e.jsxs("div",{className:"flex items-center gap-2 px-2.5 pb-2.5",children:[e.jsx(ms,{}),e.jsx("span",{className:"text-[11px] text-dark-muted/80 font-mono truncate max-w-[10rem] hidden sm:block",children:Tt||""}),e.jsx("div",{className:"flex-1"}),Te>0&&i.length>0&&e.jsxs("span",{className:`text-[10px] tabular-nums ${Qe?"text-accent-red font-medium":"text-dark-muted/60"}`,children:["~",Te," tokens",Qe?` · ${o("chat.nearLimit")}`:""]}),!u&&e.jsx("button",{onClick:()=>T(!0),className:"flex h-8 w-8 items-center justify-center rounded-full text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:o("skills.pickTitle"),"aria-label":o("skills.pickTitle"),children:e.jsx(rn,{size:15,"aria-hidden":"true"})}),!u&&e.jsx("button",{onClick:()=>void Ot(),className:"flex h-8 w-8 items-center justify-center rounded-full text-dark-muted transition-colors hover:bg-dark-hover hover:text-dark-text",title:o("fileJob.attach"),"aria-label":o("fileJob.attach"),children:e.jsx(an,{size:15,"aria-hidden":"true"})}),e.jsx("input",{ref:x,type:"file",multiple:!0,accept:".xlsx,.xls,.csv,.docx,.txt,.md",className:"hidden",onChange:Rt}),u?e.jsxs("div",{className:"flex items-center gap-1.5",children:[g?e.jsx("button",{onClick:d,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-green text-white transition-all hover:opacity-85 active:scale-95",title:o("chat.resumeGen"),"aria-label":o("chat.resumeGen"),children:e.jsx(on,{size:14,"aria-hidden":"true"})}):e.jsx("button",{onClick:a,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-yellow text-white transition-all hover:opacity-85 active:scale-95",title:o("chat.pauseGen"),"aria-label":o("chat.pauseGen"),children:e.jsx(ln,{size:14,"aria-hidden":"true"})}),e.jsx("button",{onClick:r,className:"flex h-8 w-8 items-center justify-center rounded-full bg-accent-red text-white transition-all hover:opacity-85 active:scale-95",title:o("chat.stopGen"),"aria-label":o("chat.stopGen"),children:e.jsx(cn,{size:13,"aria-hidden":"true"})})]}):e.jsx("button",{onClick:()=>void we(),disabled:!Ut,className:`flex h-8 w-8 items-center justify-center rounded-full bg-dark-text text-dark-bg transition-all
21
- hover:opacity-80 active:scale-95 disabled:opacity-25 disabled:cursor-not-allowed`,title:o("chat.sendBtn"),"aria-label":o("chat.sendBtn"),children:e.jsx(dn,{size:15,"aria-hidden":"true"})})]})]}),e.jsxs("div",{className:"mt-1.5 hidden sm:flex items-center justify-center gap-3 text-[10px] text-dark-muted/50 select-none",children:[e.jsx("span",{children:o("chat.shiftEnter")}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{children:o("chat.escHint")})]}),e.jsx(gs,{open:R,onClose:()=>T(!1),onSelect:It})]})}),Is=p.memo(function(){const{t}=$(),[n,r]=p.useState(0),[a,d]=p.useState(0),c=p.useCallback(()=>{const o=G.getReconnectState();r(o.reconnecting?o.attempts:0),d(o.maxAttempts)},[]);return p.useEffect(()=>{const o=G.onReconnectAttempt((f,x)=>{r(f),d(x)}),i=G.onReconnectSuccess(()=>{r(0),d(0)}),l=G.onReconnectGiveUp(()=>r(0)),u=G.onClose(c),g=G.onOpen(c);return c(),()=>{o(),i(),l(),u(),g()}},[c]),n<=0?null:e.jsxs("div",{className:"flex items-center justify-center gap-2 px-4 py-2 text-xs text-accent-yellow bg-accent-yellow/10 border-b border-accent-yellow/20 select-none",role:"status","aria-live":"polite",children:[e.jsx(ce,{size:13,className:"animate-spin shrink-0"}),e.jsx("span",{children:t("reconnect.reconnecting",{attempt:n,max:a})}),e.jsx("span",{className:"hidden sm:inline text-[10px] text-accent-yellow/70",children:t("reconnect.hint")})]})}),Me="dsc-auto-access-banner-dismissed",Rs=p.memo(function(){const{t}=$(),n=xe(o=>o.mode),[r,a]=p.useState(()=>localStorage.getItem(Me)==="1");p.useEffect(()=>{He(n==="normal"?"act":n)||localStorage.getItem(Me)==="1"&&a(!1)},[n]);const d=p.useCallback(o=>{o&&localStorage.setItem(Me,"1"),a(!0)},[]);return!(n!=="normal"&&He(n))||r?null:e.jsxs("div",{className:"flex items-start gap-2 px-4 py-2 text-[11px] leading-snug text-accent-yellow bg-accent-yellow/10 border-b border-accent-yellow/20 select-none",role:"note",children:[e.jsx(un,{size:14,className:"shrink-0 mt-0.5 text-accent-yellow"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"font-medium",children:t("autoAccess.title")}),e.jsxs("span",{className:"text-accent-yellow/80",children:[" ",t("autoAccess.desc")]})]}),e.jsx("button",{onClick:()=>d(!1),className:"shrink-0 rounded p-0.5 text-accent-yellow/70 hover:text-accent-yellow hover:bg-accent-yellow/10 transition-colors",title:t("autoAccess.dismiss"),"aria-label":t("autoAccess.dismiss"),children:e.jsx(Ee,{size:12})}),e.jsx("button",{onClick:()=>d(!0),className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] text-accent-yellow/70 hover:text-accent-yellow hover:bg-accent-yellow/10 transition-colors whitespace-nowrap",children:t("autoAccess.neverShow")})]})}),Os={pending:{color:"text-gray-400",bg:"bg-gray-500/10",label:"Pending"},running:{color:"text-blue-400",bg:"bg-blue-500/10",label:"Running"},completed:{color:"text-green-400",bg:"bg-green-500/10",label:"Done"},failed:{color:"text-red-400",bg:"bg-red-500/10",label:"Failed"},skipped:{color:"text-gray-500",bg:"bg-gray-500/5",label:"Skipped"}},Ds=({status:s})=>s==="running"?e.jsx(Se,{size:12,className:"animate-spin text-accent-blue"}):s==="completed"?e.jsx(ze,{size:12,className:"text-accent-green"}):s==="failed"?e.jsx(mn,{size:12,className:"text-accent-red"}):s==="skipped"?e.jsx(xn,{size:12,className:"text-dark-muted"}):e.jsx(gn,{size:12,className:"text-dark-muted"}),Ls=p.memo(function({sessionId:t,defaultExpanded:n,onClose:r}){const{t:a}=$(),[d,c]=p.useState(n??!1),[o,i]=p.useState(null),l=Ge(x=>x.getTasksForSession(t)),u=p.useMemo(()=>{const x=l.length,b=l.filter(y=>y.status==="completed").length,w=l.filter(y=>y.status==="running").length,k=l.filter(y=>y.status==="failed").length,S=x>0?Math.round(b/x*100):0;return{total:x,completed:b,running:w,failed:k,progress:S}},[l]),g=p.useMemo(()=>{const x={pending:[],running:[],completed:[],failed:[]};return l.forEach(b=>{const w=b.status==="skipped"?"pending":b.status;x[w].push(b)}),x},[l]);if(l.length===0)return e.jsx("div",{className:"text-xs text-dark-muted py-4 text-center",children:a("chat.noTasks")});const f=[...g.running,...g.failed,...g.pending.slice(0,5),...g.completed.slice(-3)];return e.jsxs("div",{className:"min-w-[220px] border border-dark-border rounded bg-dark-bg/70",children:[e.jsxs("div",{className:"w-full flex items-center justify-between px-2 py-1.5 hover:bg-dark-hover transition-colors cursor-pointer",onClick:()=>c(!d),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(kt,{size:14,className:"text-accent-blue shrink-0"}),e.jsx("span",{className:"text-xs font-medium text-dark-text",children:"Task Board"}),e.jsxs("span",{className:"text-[10px] text-dark-muted shrink-0",children:[u.completed,"/",u.total]}),e.jsx("div",{className:"w-16 h-1.5 bg-dark-surface rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${u.running>0?"bg-accent-blue":u.failed>0?"bg-accent-red":"bg-accent-green"}`,style:{width:`${u.progress}%`}})}),u.running>0&&e.jsx("span",{className:"w-1.5 h-1.5 bg-accent-blue rounded-full animate-pulse shrink-0"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[r&&d&&e.jsx("span",{role:"button",tabIndex:0,onClick:x=>{x.stopPropagation(),r()},onKeyDown:x=>{x.key==="Enter"&&(x.stopPropagation(),r())},className:"p-0.5 rounded hover:bg-dark-hover transition-colors cursor-pointer",title:"Hide task panel",children:e.jsx(Ee,{size:12,className:"text-dark-muted"})}),d?e.jsx(pn,{size:14,className:"text-dark-muted"}):e.jsx(le,{size:14,className:"text-dark-muted"})]})]}),d&&e.jsxs("div",{className:"px-2 pb-2 max-h-[260px] overflow-y-auto custom-scrollbar space-y-1.5",children:[f.map(x=>e.jsx($s,{task:x,isSelected:x.id===o,onClick:()=>i(o===x.id?null:x.id)},x.id)),g.pending.length>5&&e.jsxs("div",{className:"text-[10px] text-dark-muted text-center",children:[g.pending.length-5," more pending tasks"]}),g.completed.length>3&&e.jsxs("div",{className:"text-[10px] text-dark-muted text-center",children:[g.completed.length-3," more completed tasks"]})]})]})}),Fs=(s,t)=>{if(!s)return"";const n=(t||Date.now())-s;return n<1e3?`${n}ms`:`${(n/1e3).toFixed(1)}s`},$s=p.memo(function({task:t,isSelected:n,onClick:r}){const a=Os[t.status];return e.jsxs("div",{onClick:r,className:`rounded border p-2 cursor-pointer transition-all ${a.bg} border-dark-border
22
- ${n?"ring-1 ring-accent-blue":"hover:border-dark-muted/40"}
23
- ${t.status==="running"?"border-l-2 border-l-accent-blue":"border-l-2 border-l-transparent"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ds,{status:t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-dark-text truncate",children:t.title}),e.jsx("span",{className:`text-[10px] ${a.color} shrink-0`,children:a.label})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-dark-muted",children:[e.jsx("span",{children:t.agentType||t.source}),t.startedAt&&e.jsx("span",{children:Fs(t.startedAt,t.completedAt)})]})]})]}),t.status==="running"&&t.progress!==void 0&&e.jsx("div",{className:"mt-1.5",children:e.jsx("div",{className:"w-full h-1 bg-dark-bg rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-accent-blue rounded-full transition-all duration-500",style:{width:`${t.progress}%`}})})}),n&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-dark-border space-y-1",children:[t.description&&e.jsx("p",{className:"text-[10px] text-dark-muted",children:t.description}),t.error&&e.jsx("p",{className:"text-[10px] text-red-400",children:t.error}),t.result&&e.jsx("p",{className:"text-[10px] text-green-400",children:t.result}),t.dependencies&&t.dependencies.length>0&&e.jsxs("p",{className:"text-[10px] text-dark-muted",children:[t.dependencies.length," dependencies"]})]})]})}),Gs=p.memo(function({tabs:t,activeSessionId:n,onSend:r,onStop:a,onPause:d,onResume:c,activeTab:o,setActiveTab:i,createNewSession:l,clearMessages:u,setTheme:g,setThemePreset:f,toggleTerminal:x,setLogs:b,setUnreadLogs:w,showTaskBoard:k=!0,onToggleTaskBoard:S,onRegenerate:y,onDeleteMessage:R}){const T=p.useMemo(()=>({setActiveTab:i,createNewSession:l,clearMessages:u,setTheme:g,setThemePreset:f,toggleTerminal:x,setLogs:b,setUnreadLogs:w}),[i,l,u,g,f,x,b,w]),I=q(C=>n?C.messagesBySession[n]||[]:[]),O=q(C=>n?C.generatingSessions.includes(n):!1),U=q(C=>n?C.pausedSessions.includes(n):!1),A=Ge(C=>n?C.getTasksForSession(n):[]);p.useEffect(()=>{if(!n)return;let C=!1;return ee.tasks.list().then(X=>{if(C||!X.success||!Array.isArray(X.data))return;const be={PENDING:"pending",RUNNING:"running",COMPLETED:"completed",FAILED:"failed",CANCELLED:"skipped"},ke=Date.now(),H=X.data.map(L=>{const de=new Date(L.createdAt).getTime()||ke,Z=new Date(L.updatedAt).getTime()||ke;return{id:L.id,sessionId:n,title:L.title,status:be[L.status]||"pending",source:"task",description:L.description,progress:L.progress,createdAt:de,updatedAt:Z,raw:L}});Ge.getState().setTasks(n,H,"task")}).catch(()=>{}),()=>{C=!0}},[n]);const F=t.find(C=>C.id===n)||null,J=A.length>0,V=p.useCallback((C,X)=>{n&&r(n,C,X)},[r,n]),te=p.useCallback(C=>{n&&r(n,C)},[r,n]),ne=p.useCallback(C=>{n&&y&&y(n,C)},[y,n]),he=p.useCallback(C=>{n&&R&&R(n,C)},[R,n]);return e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[e.jsx(Is,{}),e.jsx(Rs,{}),F&&e.jsxs(e.Fragment,{children:[e.jsx(us,{messages:I,isGenerating:O,isPaused:U,sessionId:F.id,onSendSuggestion:te,onRegenerate:y?ne:void 0,onDeleteMessage:R?he:void 0}),e.jsx(_s,{sessionId:F.id,onSend:V,onStop:()=>a(F.id),onPause:()=>d(F.id),onResume:()=>c(F.id),slashOptions:T})]})]}),n&&k&&J&&e.jsx("div",{className:"w-80 shrink-0 border-l border-dark-border overflow-hidden flex flex-col min-h-0 max-lg:hidden",children:e.jsx(Ls,{sessionId:n,defaultExpanded:!0,onClose:S})}),n&&!k&&J&&e.jsxs("button",{onClick:S,className:"fixed bottom-6 right-6 z-40 bg-accent-blue text-white rounded-full px-3 py-2 shadow-lg hover:opacity-90 transition-opacity flex items-center gap-1.5 text-xs",children:[e.jsx(kt,{size:14}),"Task Board"]})]})});export{Gs as SessionGrid};
@@ -1,3 +0,0 @@
1
- import{j as e}from"./markdown-D0iUI0Yw.js";import{r,R as U,F as ee,m as te,$ as se,z as ae,x as _,aL as re,aM as O,aN as ne,aC as oe,aO as le,aj as ce,aP as ie,aQ as de,aR as ue,I as xe}from"./icons-B5yCkBjC.js";import{a as y,t as i,e as Y,g as me,c as he,T as ge,D as pe,w as K,r as G}from"./index-YAnKQ1Q6.js";import"./react-vendor-Bxu3r3ox.js";import"./state-C80Yzgl0.js";const D=r.memo(function({title:d,subtitle:s,enabled:c,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between p-3 bg-dark-bg rounded-lg",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:d}),e.jsx("div",{className:"text-xs text-dark-muted",children:s})]}),e.jsx("button",{onClick:()=>l(!c),className:`relative w-12 h-6 rounded-full transition-colors ${c?"bg-accent-green":"bg-dark-border"}`,children:e.jsx("span",{className:`absolute top-1 w-4 h-4 bg-white rounded-full transition-transform ${c?"left-7":"left-1"}`})})]})});function be(o){return o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`}function fe(o){return new Date(o).toLocaleString()}function ke(){const[o,d]=r.useState([]),[s,c]=r.useState(null),[l,p]=r.useState(""),[b,v]=r.useState(""),[m,n]=r.useState(!1),[g,T]=r.useState(!1),N=r.useCallback(async()=>{n(!0);try{const a=await y.config.files.list();a.success&&Array.isArray(a.data)&&d(a.data)}catch{i.error("Failed to load config files")}finally{n(!1)}},[]),M=r.useCallback(async a=>{try{const S=await y.config.files.read(a);if(S.success&&S.data){const f=S.data;c(f.name),p(f.content),v(f.content)}}catch{i.error(`Failed to read ${a}`)}},[]);r.useEffect(()=>{N()},[N]);const L=r.useCallback(async()=>{if(s){T(!0);try{const a=await y.config.files.write(s,l);a.success?(v(l),i.success(`${s} saved`),N()):i.error(a.error||"Failed to save")}catch{i.error("Failed to save file")}finally{T(!1)}}},[s,l,N]),C=l!==b,R=(s==null?void 0:s.endsWith(".yaml"))||(s==null?void 0:s.endsWith(".yml")),E=s==null?void 0:s.endsWith(".json"),z=a=>R?a.replace(/(#.*)$/,'<span class="text-dark-muted">$1</span>').replace(/^(\s*)([\w-]+)(:)/,'$1<span class="text-accent-blue">$2</span>$3').replace(/:\s+(true|false|null|~)(\s*)$/,': <span class="text-accent-purple">$1</span>$2').replace(/:\s+(\d+\.?\d*)(\s*)$/,': <span class="text-accent-green">$1</span>$2').replace(/:\s+"([^"]*)"(\s*)$/,': <span class="text-accent-yellow">"$1"</span>$2'):E?a.replace(/(\s*"[^"]*")(\s*:)/g,'<span class="text-accent-blue">$1</span>$2').replace(/:\s+(true|false|null)/g,': <span class="text-accent-purple">$1</span>').replace(/:\s+(\d+\.?\d*)/g,': <span class="text-accent-green">$1</span>').replace(/:\s+"([^"]*)"/g,': <span class="text-accent-yellow">"$1"</span>'):a;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-medium text-dark-text",children:"Config Files"}),e.jsx("button",{onClick:N,disabled:m,className:"p-1.5 rounded hover:bg-dark-hover transition-colors text-dark-muted",title:"Refresh file list",children:e.jsx(U,{size:14,className:m?"animate-spin":""})})]}),o.length===0&&!m&&e.jsx("p",{className:"text-xs text-dark-muted",children:"No config files found in ~/.agent/"}),o.length>0&&e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-48 shrink-0 space-y-0.5 max-h-[300px] overflow-y-auto custom-scrollbar",children:o.map(a=>e.jsxs("button",{onClick:()=>M(a.name),className:`w-full text-left px-2.5 py-1.5 rounded text-xs flex items-center gap-2 transition-colors ${s===a.name?"bg-accent-blue/10 text-accent-blue":"text-dark-text hover:bg-dark-hover"}`,children:[e.jsx(ee,{size:12,className:"shrink-0"}),e.jsx("span",{className:"truncate flex-1",children:a.name}),!a.editable&&e.jsx("span",{className:"text-[10px] text-dark-muted shrink-0",title:"Read-only",children:"read"})]},a.name))}),s?e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-dark-muted",children:[e.jsx("span",{className:"text-dark-text font-medium",children:s}),o.find(a=>a.name===s)&&e.jsxs("span",{children:[be(o.find(a=>a.name===s).size)," · ",fe(o.find(a=>a.name===s).modified)]}),C&&e.jsxs("span",{className:"text-accent-yellow flex items-center gap-1",children:[e.jsx(te,{size:10}),"unsaved changes"]})]}),e.jsxs("button",{onClick:L,disabled:!C||g,className:`flex items-center gap-1 px-2.5 py-1 rounded text-xs transition-all ${C?"bg-accent-blue text-white hover:opacity-90":"bg-dark-hover text-dark-muted cursor-not-allowed"}`,children:[e.jsx(se,{size:12}),g?"Saving...":"Save"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"w-full h-[260px] p-3 rounded-lg bg-dark-bg border border-dark-border font-mono text-xs leading-relaxed overflow-auto custom-scrollbar pointer-events-none",dangerouslySetInnerHTML:{__html:l.split(`
2
- `).map(z).join(`
3
- `)||"&nbsp;"}}),e.jsx("textarea",{value:l,onChange:a=>p(a.target.value),className:"absolute inset-0 w-full h-full p-3 rounded-lg bg-transparent border border-dark-border font-mono text-xs leading-relaxed resize-none overflow-auto custom-scrollbar text-transparent caret-dark-text focus:outline-none focus:border-accent-blue/50",style:{color:"transparent"},spellCheck:!1})]})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-dark-muted",children:"Select a file to edit"})]})]})}const ve=r.memo(function({nameKey:d,descriptionKey:s,colors:c,isSelected:l,onClick:p}){const{t:b}=Y(),v=["bg","surface","border","text","muted","accentBlue","accentGreen","accentRed","accentYellow","accentPurple"];return e.jsxs("button",{onClick:p,className:`relative flex flex-col items-center rounded-xl p-2 transition-all focus:outline-none focus:ring-2 focus:ring-accent-blue/50 ${l?"ring-2 ring-accent-blue/60 bg-dark-bg border border-accent-blue/40 shadow-sm":"border border-dark-border hover:border-accent-blue/30 bg-dark-bg hover:shadow-sm"}`,title:b(s),"aria-pressed":l,"aria-label":b(d),children:[e.jsx("div",{className:"flex gap-[2px] rounded-md overflow-hidden w-full h-8 mb-1.5 border border-dark-border/40",children:v.map(m=>e.jsx("div",{className:"flex-1",style:{backgroundColor:c[m]},title:m},m))}),e.jsx("span",{className:`text-[11px] font-medium truncate w-full text-center ${l?"text-accent-blue":"text-dark-text"}`,children:b(d)}),l&&e.jsx("span",{className:"absolute top-1 right-1 w-4 h-4 bg-accent-blue rounded-full flex items-center justify-center shadow-sm",children:e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:e.jsx("path",{d:"M1.5 4L3.5 6L6.5 2",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}),W=[{key:"bg",labelKey:"settings.colorBg"},{key:"surface",labelKey:"settings.colorSurface"},{key:"border",labelKey:"settings.colorBorder"},{key:"text",labelKey:"settings.colorText"},{key:"muted",labelKey:"settings.colorMuted"},{key:"accentBlue",labelKey:"settings.colorAccentBlue"},{key:"accentGreen",labelKey:"settings.colorAccentGreen"},{key:"accentRed",labelKey:"settings.colorAccentRed"},{key:"accentYellow",labelKey:"settings.colorAccentYellow"},{key:"accentPurple",labelKey:"settings.colorAccentPurple"}],je={language:["language","lang","Chinese","中文","English","en","zh"],theme:["theme","dark","light","color","palette","custom"],advanced:["advanced","yolo","auto","swarm","workspace","guard","bypass"],provider:["provider","model","api","key","openai","anthropic","deepseek"],configFiles:["config","file","yaml","json","editor"],system:["system","server","uptime","restart","reboot"],about:["about","version","info"]},Te=r.memo(function({onNavigate:d}){const{t:s}=Y(),{theme:c,setTheme:l,themePresetId:p,setThemePreset:b,language:v,setLanguage:m,yolo:n,setYoloEnabled:g,autoSwarm:T,setAutoSwarmEnabled:N,workspaceGuardBypass:M,setWorkspaceGuardBypass:L,customTheme:C,customThemeEnabled:R,setCustomTheme:E,setCustomThemeEnabled:z,resetCustomTheme:a}=me(),S=he(t=>t.activeSessionId),[f,H]=r.useState(R),q=r.useMemo(()=>c==="dark"?"dark":c==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",[c]),Q=r.useMemo(()=>Object.values(ge),[]),[I,Z]=r.useState(0),[j,F]=r.useState(!1),[A,P]=r.useState(!1),[$,B]=r.useState(""),k=r.useCallback(t=>{if(!$.trim())return!0;const x=$.toLowerCase().trim();return(je[t]??[]).some(h=>h.toLowerCase().includes(x))},[$]);r.useEffect(()=>{let t=!0;const x=async()=>{try{const h=await y.system.status();t&&h.success&&h.data&&Z(h.data.uptime)}catch{}};x();const u=setInterval(x,j?2e3:1e4);return()=>{t=!1,clearInterval(u)}},[j]);const J=r.useCallback(async()=>{if(window.confirm("Restart the server? All active sessions will be disconnected.")){F(!0);try{const t=await y.system.restart();t.success?i.info("Server restarting..."):(i.error(t.error||"Restart failed"),F(!1))}catch{i.error("Failed to send restart request"),F(!1)}}},[]),V=r.useCallback(async()=>{if(window.confirm("Shut down the server? This will stop the entire backend process.")&&window.confirm("Are you sure? All active sessions and unsaved work will be lost.")){P(!0);try{const t=await y.system.shutdown();t.success?i.info("Server shutting down..."):(i.error(t.error||"Shutdown failed"),P(!1))}catch{i.error("Failed to send shutdown request"),P(!1)}}},[]);r.useEffect(()=>{j&&I<1e4&&(F(!1),i.success("Server restarted"))},[I,j]);const X=t=>{const x=Math.floor(t/1e3),u=Math.floor(x/60),h=Math.floor(u/60);return h>0?`${h}h ${u%60}m`:u>0?`${u}m ${x%60}s`:`${x}s`};return e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto custom-scrollbar p-4 bg-transparent",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 gap-4 rounded-xl border border-dark-border bg-dark-surface p-3",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2 shrink-0",children:[e.jsx(ae,{size:18,className:"text-accent-blue"}),s("settings.title")]}),e.jsxs("div",{className:"relative flex-1 max-w-xs",children:[e.jsx(_,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-dark-muted pointer-events-none"}),e.jsx("input",{type:"text",value:$,onChange:t=>B(t.target.value),placeholder:"Search settings...",className:"w-full bg-dark-bg border border-dark-border rounded-lg pl-9 pr-3 py-1.5 text-sm text-dark-text placeholder-dark-muted focus:border-accent-blue/60 focus:ring-2 focus:ring-accent-blue/15 outline-none transition-all"}),$&&e.jsx("button",{onClick:()=>B(""),className:"absolute right-2 top-1/2 -translate-y-1/2 text-dark-muted hover:text-dark-text text-xs p-1 rounded",children:"×"})]})]}),e.jsxs("div",{className:"space-y-5 max-w-3xl",children:[k("language")&&e.jsx(w,{icon:re,iconColor:"text-accent-blue",title:s("settings.language"),children:e.jsx("div",{className:"flex gap-2",children:["zh-CN","en"].map(t=>e.jsx("button",{onClick:()=>m(t),className:`px-4 py-2 rounded-lg transition-all ${v===t?"bg-accent-blue text-white":"bg-dark-hover text-dark-text hover:bg-dark-border"}`,children:s(t==="zh-CN"?"settings.languageZh":"settings.languageEn")},t))})}),k("theme")&&e.jsxs(w,{icon:O,iconColor:"text-accent-purple",title:s("settings.theme"),children:[e.jsx("div",{className:"flex gap-2 mb-4",children:["dark","light","auto"].map(t=>e.jsx("button",{onClick:()=>l(t),className:`px-4 py-2 rounded-lg transition-all ${c===t?"bg-accent-blue text-white":"bg-dark-hover text-dark-text hover:bg-dark-border"}`,children:s(t==="dark"?"settings.themeDark":t==="light"?"settings.themeLight":"settings.themeAuto")},t))}),e.jsxs("div",{className:"mb-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-dark-text mb-2",children:s("settings.themePresets")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2",children:Q.map(t=>{if(!t)return null;const x=(p||pe)===t.id,u=q==="dark"?t.dark:t.light;return e.jsx(ve,{id:t.id,nameKey:t.nameKey,descriptionKey:t.descriptionKey,colors:u,isSelected:x,onClick:()=>b(t.id)},t.id)})})]}),e.jsxs("div",{className:"pt-4 border-t border-dark-border",children:[e.jsxs("button",{onClick:()=>{const t=!f;H(t),z(t)},className:"flex items-center gap-2 text-sm text-dark-muted hover:text-dark-text transition-colors",children:[e.jsx(O,{size:14}),e.jsx("span",{children:s("settings.customOverrides")}),e.jsx("span",{className:`w-8 h-4 rounded-full transition-colors ${f?"bg-accent-blue":"bg-dark-border"}`,children:e.jsx("span",{className:`block w-3 h-3 rounded-full bg-white transition-transform mt-0.5 ${f?"ml-4":"ml-0.5"}`})})]}),f&&e.jsx("p",{className:"text-[10px] text-dark-muted mt-1 mb-2",children:s("settings.customOverridesHint")}),f&&e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"flex gap-1 mb-3 rounded-lg overflow-hidden h-6",children:W.map(({key:t})=>e.jsx("div",{className:"flex-1",style:{backgroundColor:C[t]},title:t},t))}),e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:W.map(({key:t,labelKey:x})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:C[t],onChange:u=>E({[t]:u.target.value}),className:"w-8 h-8 rounded border border-dark-border cursor-pointer bg-transparent p-0.5 shrink-0"}),e.jsx("span",{className:"text-xs text-dark-muted flex-1 truncate",children:s(x)}),e.jsx("input",{type:"text",value:C[t],onChange:u=>{const h=u.target.value;/^#[0-9a-fA-F]{0,6}$/.test(h)&&E({[t]:h})},className:"w-16 bg-dark-bg border border-dark-border rounded px-1 py-0.5 text-xs text-dark-text font-mono text-center",maxLength:7})]},t))}),e.jsx("button",{onClick:a,className:"mt-2 text-xs text-dark-muted hover:text-accent-red transition-colors",children:s("settings.resetColors")})]})]})]}),k("provider")&&e.jsxs(w,{icon:ne,iconColor:"text-accent-yellow",title:"Provider & Models",children:[e.jsx("p",{className:"text-sm text-dark-muted mb-3",children:"Configure AI providers, API keys, and model settings. Add or remove providers like OpenAI, Anthropic, DeepSeek, and more."}),e.jsxs("button",{onClick:()=>d==null?void 0:d("models"),className:"flex items-center gap-2 px-4 py-2 bg-accent-blue text-white rounded-lg hover:opacity-90 transition-opacity text-sm w-fit",children:[e.jsx(oe,{size:14}),"Manage Providers & Models"]})]}),k("context")&&e.jsx(w,{icon:le,iconColor:"text-accent-blue",title:"Max Context",children:e.jsx(we,{})}),k("advanced")&&e.jsx(w,{icon:ce,iconColor:"text-accent-yellow",title:s("settings.advancedFeatures"),children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(D,{title:s("settings.yoloMode"),subtitle:s("settings.yoloDesc"),enabled:n.enabled,onChange:t=>{g(t),K.send({type:"toggle_yolo",sessionId:S||"",data:t?"true":"false"})}}),e.jsx(D,{title:s("settings.autoSwarm"),subtitle:s("settings.autoSwarmDesc"),enabled:T.enabled,onChange:t=>{N(t),K.send({type:"toggle_auto_swarm",sessionId:S||"",data:t?"true":"false"})}}),e.jsx(D,{title:s("settings.workspaceGuard"),subtitle:s("settings.workspaceGuardDesc"),enabled:M,onChange:t=>{L(t),K.send({type:"toggle_workspace_guard",sessionId:S||"",data:t?"true":"false"})}})]})}),k("configFiles")&&e.jsx(w,{icon:ie,iconColor:"text-accent-green",title:"Config Files (~/.agent/)",children:e.jsx(ke,{})}),k("system")&&e.jsx(w,{icon:de,iconColor:"text-dark-muted",title:"System",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-dark-muted",children:"Server Uptime"}),e.jsx("span",{className:"text-dark-text font-mono",children:X(I)})]}),e.jsxs("button",{onClick:J,disabled:j,className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm transition-all ${j?"bg-dark-hover text-dark-muted cursor-wait":"bg-accent-red/10 text-accent-red hover:bg-accent-red/20 border border-accent-red/30"}`,children:[e.jsx(U,{size:14,className:j?"animate-spin":""}),j?"Restarting...":"Restart Server"]}),e.jsxs("button",{onClick:V,disabled:A,className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm transition-all ${A?"bg-dark-hover text-dark-muted cursor-wait":"bg-accent-red/10 text-accent-red hover:bg-accent-red/20 border border-accent-red/30"}`,children:[e.jsx(ue,{size:14,className:A?"animate-pulse":""}),A?"Shutting Down...":"Shutdown Server"]})]})}),k("about")&&e.jsx(w,{icon:xe,iconColor:"text-accent-blue",title:s("settings.about"),children:e.jsxs("div",{className:"text-sm text-dark-muted space-y-2",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-dark-text",children:"DeepSeekCode Web"})," v1.0.0"]}),e.jsx("p",{children:s("settings.aboutDesc")}),e.jsx("p",{className:"text-xs",children:"Powered by React + TypeScript + TailwindCSS"})]})}),$.trim()&&!["language","theme","provider","advanced","configFiles","system","about"].some(k)&&e.jsxs("div",{className:"text-center py-12 text-dark-muted",children:[e.jsx(_,{size:32,className:"mx-auto mb-2 opacity-40"}),e.jsxs("p",{className:"text-sm",children:["No settings match “",$,"”"]})]})]})]})});function we(){const o=G(n=>n.maxContextTokens),d=G(n=>n.setMaxContextTokens),[s,c]=r.useState(String(o)),[l,p]=r.useState(!1),b=[32e3,64e3,128e3,256e3,512e3,1e6,2e6],v=async()=>{const n=parseInt(s,10);if(!(isNaN(n)||n<1e3)){p(!0),d(n);try{await y.config.provider.save({contextWindow:n}),i.success("Context window saved")}catch(g){i.error("Failed to save context window: "+(g instanceof Error?g.message:"Unknown error"))}p(!1)}},m=n=>n>=1e6?(n/1e6).toFixed(0)+"M":(n/1e3).toFixed(0)+"K";return e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-dark-muted mb-3",children:"Set the maximum context window (in tokens) for your AI model. This controls how the progress bar and usage percentage are calculated."}),e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("input",{type:"number",value:s,onChange:n=>c(n.target.value),min:1e3,max:1e7,step:1e3,className:"w-32 bg-dark-bg border border-dark-border rounded-lg px-3 py-1.5 text-sm text-dark-text font-mono focus:border-accent-blue/60 focus:ring-2 focus:ring-accent-blue/15 outline-none transition-all"}),e.jsx("span",{className:"text-sm text-dark-muted",children:"tokens"}),e.jsx("button",{onClick:v,disabled:l,className:"px-3 py-1.5 rounded-lg text-sm bg-accent-blue text-white hover:opacity-90 transition-opacity disabled:opacity-50",children:l?"Saving...":"Apply"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:b.map(n=>e.jsx("button",{onClick:async()=>{c(String(n)),d(n);try{await y.config.provider.save({contextWindow:n}),i.success("Context window saved")}catch(g){i.error("Failed to save context window: "+(g instanceof Error?g.message:"Unknown error"))}},className:"px-3 py-1 rounded-lg text-xs transition-all",children:m(n)},n))}),e.jsxs("p",{className:"text-xs text-dark-muted mt-2",children:["Current: ",e.jsx("span",{className:"font-mono text-dark-text",children:parseInt(s,10).toLocaleString()})," tokens"]})]})}function w({icon:o,iconColor:d,title:s,children:c}){return e.jsxs("div",{className:"rounded-xl border border-dark-border bg-dark-surface p-4",children:[e.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[e.jsx(o,{size:16,className:d}),s]}),c]})}export{Te as SettingsPanel};