om-memory-system 5.4.0 → 5.5.0-next.212
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.
|
@@ -120,15 +120,15 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
120
120
|
${e}</tr>
|
|
121
121
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
122
122
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Qg(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=$g(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Qg(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=$g(e);if(i===null)return Qg(n);e=i;let a=`<img src="${e}" alt="${Qg(n)}"`;return t&&(a+=` title="${Qg(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Qg(e.text)}},u_=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},d_=class e{options;renderer;textRenderer;constructor(e){this.options=e||Mh,this.options.renderer=this.options.renderer||new l_,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new u_}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},f_=class{options;block;constructor(e){this.options=e||Mh}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?c_.lex:c_.lexInline}provideParser(e=this.block){return e?d_.parse:d_.parseInline}},p_=new class{defaults=jh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=d_;Renderer=l_;TextRenderer=u_;Lexer=c_;Tokenizer=s_;Hooks=f_;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new l_(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new s_(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new f_;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=f_.passThroughHooks.has(n)?e=>{if(this.defaults.async&&f_.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return c_.lex(e,t??this.defaults)}parser(e,t){return d_.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?c_.lex:c_.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?d_.parse:d_.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?c_.lex:c_.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?d_.parse:d_.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
123
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Qg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function m_(e,t){return p_.parse(e,t)}m_.options=m_.setOptions=function(e){return p_.setOptions(e),m_.defaults=p_.defaults,Nh(m_.defaults),m_},m_.getDefaults=jh,m_.defaults=Mh;function h_(...e){return p_.use(...e),m_.defaults=p_.defaults,Nh(m_.defaults),m_}m_.use=h_,m_.walkTokens=function(e,t){return p_.walkTokens(e,t)},m_.parseInline=p_.parseInline,m_.Parser=d_,m_.parser=d_.parse,m_.Renderer=l_,m_.TextRenderer=u_,m_.Lexer=c_,m_.lexer=c_.lex,m_.Tokenizer=s_,m_.Hooks=f_,m_.parse=m_,m_.options,m_.setOptions,m_.walkTokens,m_.parseInline,d_.parse,c_.lex,m_.setOptions({gfm:!0,breaks:!0});function g_(e){let t=m_.parse(e,{async:!1});return Ah.sanitize(t)}var __=320,v_=240;function y_(e){if(e.projectPath){let t=e.projectPath.replace(/\\/g,`/`).split(`/`).filter(e=>e);return t[t.length-1]||e.projectPath}return e.displayName||e.id}function b_(e){return{createdDate:Qp(e.createdAt),updatedDate:e.updatedAt&&e.updatedAt!==e.createdAt?Qp(e.updatedAt):null}}function x_(e,t){return e.similarity===void 0?null:t?`${Math.round(e.similarity*100)}%`:`${e.similarity}%`}function S_({variant:e,item:t,memory:n,prompt:r,selected:i=!1,onSelect:a,onPin:o,onUnpin:s,onEdit:c,onDeleteMemory:l,onDeletePrompt:u,activeKeyword:d,onKeywordClick:f}){let{t:p}=G();if(e===`pair`&&n&&r){let e=n.isPinned||!1,t=b_(n),u=x_(n,!0);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-3 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":n.id,children:[(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-muted p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:p(`badge-prompt`)}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Qp(r.createdAt)})]}),(0,H.jsx)(Rp,{maxHeight:v_,fade:`var(--muted)`,children:(0,H.jsx)(Yp,{content:r.content})})]}),(0,H.jsx)(`div`,{className:`flex justify-center text-muted-foreground`,children:(0,H.jsx)(M,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(n.id,e===!0)}),(0,H.jsx)(id,{children:p(`badge-memory`)}),n.memoryType?(0,H.jsx)(Up,{type:n.memoryType}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(id,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:n.displayName||n.id})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(n.id),children:(0,H.jsx)(ht,{className:`size-3.5 fill-current`})}):(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(n.id),children:(0,H.jsx)(ht,{className:`size-3.5`})}),(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(n.id),children:(0,H.jsx)(pt,{className:`size-3.5`})}),(0,H.jsx)(Hp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(`btn-delete-pair`),onClick:()=>l?.(n.id,!0),children:(0,H.jsx)(Rt,{className:`size-3.5`})})})]})]}),n.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.tags.map(e=>(0,H.jsx)(Hp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(nd,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Rp,{maxHeight:__,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:g_(n.content)}})})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,t.createdDate]}),t.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,t.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,n.id]})]})]})]})}if(e===`prompt`&&t){let e=!!t.linkedMemoryId;return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),(0,H.jsx)(Ze,{className:`size-3.5 text-muted-foreground`}),(0,H.jsx)(id,{variant:`secondary`,children:p(`badge-prompt`)}),e?(0,H.jsxs)(id,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Qp(t.createdAt)})]}),e?(0,H.jsx)(Hp,{content:p(`tooltip-delete-prompt-pair`),children:(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Rt,{className:`size-3.5`})})}):(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Rt,{className:`size-3.5`})})]}),(0,H.jsx)(Rp,{maxHeight:v_,children:(0,H.jsx)(Yp,{content:t.content})}),e?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(M,{className:`size-3`}),p(`text-generated-above`),(0,H.jsx)(ee,{className:`size-3`})]}):null]})}if(e===`memory`&&t){let e=t.isPinned||!1,n=!!t.linkedPromptId,r=b_(t),u=x_(t,!1);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),t.memoryType?(0,H.jsx)(Up,{type:t.memoryType}):null,n?(0,H.jsxs)(id,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(id,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:y_(t)}),t.projectPath?(0,H.jsx)(`span`,{dir:`ltr`,className:`text-code text-muted-foreground font-mono break-all w-full`,children:t.projectPath}):null]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(t.id),children:(0,H.jsx)(ht,{className:`size-3.5 fill-current`})}):(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(t.id),children:(0,H.jsx)(ht,{className:`size-3.5`})}),(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(t.id),children:(0,H.jsx)(pt,{className:`size-3.5`})}),n?(0,H.jsx)(Hp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Rt,{className:`size-3.5`})})}):(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Rt,{className:`size-3.5`})})]})]}),t.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.tags.map(e=>(0,H.jsx)(Hp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(nd,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Rp,{maxHeight:__,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:g_(t.content)}})})}),n?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(ee,{className:`size-3`}),p(`text-from-below`),(0,H.jsx)(M,{className:`size-3`})]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,r.createdDate]}),r.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,r.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,t.id]})]})]})}return null}function C_(e){let t=new Map(e.map(e=>[e.id,e])),n=[],r=new Set;for(let i of e)if(!r.has(i.id)){if(i.type===`memory`&&i.linkedPromptId&&t.has(i.linkedPromptId)){let e=t.get(i.linkedPromptId);n.push({isPair:!0,memory:i,prompt:e}),r.add(i.id),r.add(e.id)}else if(i.type===`prompt`&&i.linkedMemoryId&&t.has(i.linkedMemoryId)){let e=t.get(i.linkedMemoryId);n.push({isPair:!0,memory:e,prompt:i}),r.add(i.id),r.add(e.id)}else n.push({isPair:!1,type:i.type,item:i}),r.add(i.id)}return n.sort((e,t)=>{let n=e.isPair?e.memory.createdAt:e.item.createdAt,r=t.isPair?t.memory.createdAt:t.item.createdAt;return new Date(r).getTime()-new Date(n).getTime()})}function w_({memories:e,selectedIds:t,currentPage:n,totalPages:r,loading:i=!1,error:a=null,onSelect:o,onPageChange:s,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m}){let{t:h}=G(),g=(0,v.useMemo)(()=>C_(e),[e]),_=h(`text-page`,{current:n,total:r}),y=(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(K,{variant:`outline`,size:`icon-xs`,disabled:!(n>1),onClick:()=>s(-1),children:(0,H.jsx)(se,{className:`size-3.5`})}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:_}),(0,H.jsx)(K,{variant:`outline`,size:`icon-xs`,disabled:!(n<r),onClick:()=>s(1),children:(0,H.jsx)(ce,{className:`size-3.5`})})]});return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{className:`grid min-h-32 items-start gap-3 lg:grid-cols-2`,children:i&&e.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`loading-init`)}):a?(0,H.jsxs)(`div`,{className:`text-sm text-destructive py-8 text-center`,children:[`Error: `,a]}):g.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`empty-memories`)}):g.map(e=>e.isPair?(0,H.jsx)(S_,{variant:`pair`,memory:e.memory,prompt:e.prompt,selected:t.has(e.memory.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.memory.id):e.type===`prompt`?(0,H.jsx)(S_,{variant:`prompt`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id):(0,H.jsx)(S_,{variant:`memory`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id))}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:y})]})}function T_(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=!1;return di.status().then(t=>{e||n(t.success?t.data??null:null)}),()=>{e=!0}},[e,r]),{record:t,reload:(0,v.useCallback)(()=>i(e=>e+1),[])}}function E_(e){return e!==null}function D_(e){return{createdAt:e.createdAt,merged:e.merged,removed:e.removed}}function O_(e,t){return e===`idle`&&t===`open`?`confirming`:e===`confirming`&&t===`cancel`?`idle`:e===`confirming`&&t===`confirm`?`working`:e===`working`&&t===`done`?`idle`:e}function k_(e,t){return e===`confirming`&&t===`confirm`}function A_(e){return{key:e.notFound>0?`toast-auto-cleanup-undone-partial`:`toast-auto-cleanup-undone`,params:{restored:e.restored,notFound:e.notFound}}}function j_({version:e,onUndone:t}){let{t:n}=G(),{record:r,reload:i}=T_(e),[a,o]=(0,v.useState)(`idle`);if(!E_(r)||!r)return null;async function s(){if(!k_(a,`confirm`))return;o(O_(a,`confirm`));let e=await di.undo();if(o(`idle`),i(),!e.success||!e.data){U.info(e.error||n(`toast-auto-cleanup-undo-failed`));return}let r=A_(e.data);U.success(n(r.key,r.params)),t?.()}let c=D_(r);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>o(O_(a,`open`)),children:[(0,H.jsx)(Vt,{className:`size-3.5`}),n(`btn-auto-cleanup-undo`)]}),(0,H.jsx)(zl,{open:a!==`idle`,onOpenChange:e=>{e||o(O_(a,`cancel`))},children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:n(`title-auto-cleanup-undo`)}),(0,H.jsx)(Gl,{children:n(`label-auto-cleanup-undo-body`,{when:Qp(new Date(c.createdAt).toISOString()),merged:c.merged,removed:c.removed})})]}),(0,H.jsxs)(Ul,{className:`gap-2`,children:[(0,H.jsx)(K,{variant:`secondary`,size:`sm`,disabled:a===`working`,onClick:()=>o(O_(a,`cancel`)),children:n(`btn-cancel`)}),(0,H.jsx)(K,{size:`sm`,disabled:a===`working`,onClick:()=>void s(),children:n(`btn-auto-cleanup-undo-confirm`)})]})]})})]})}var M_=Ba(`grid min-w-0 gap-0.5 rounded-xl border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_minmax(0,1fr)] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive-label bg-card *:data-[slot=alert-description]:text-destructive-label *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function N_({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:V(M_({variant:t}),e),...n})}function P_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-description`,className:V(`text-muted-foreground text-sm [&_p]:leading-relaxed col-start-2`,e),...t})}function F_(e){if(!e)return null;let t=e.status;switch(t.state){case`grouping`:return{kind:`grouping`};case`checking`:return t.total>0?{kind:`checking`,done:t.done,total:t.total}:{kind:`grouping`};case`done`:return{kind:`ready`,groups:t.preview.groups.length};case`failed`:return{kind:`failed`,error:t.error}}}function I_(e){return e?.status.state===`grouping`||e?.status.state===`checking`}var L_=3e3;function R_(e){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e)return;let t=!1,r,i=async()=>{let e=await oi(`/api/user-profile/category-cleanup`);if(t)return;let a=e.success?e.data??null:null;n(a),I_(a)&&(r=setTimeout(()=>void i(),L_))};return i(),()=>{t=!0,clearTimeout(r)}},[e]),t}function z_({paused:e,onOpen:t}){let{t:n}=G(),r=F_(R_(e));if(e||!r)return null;let i=r.kind===`failed`;return(0,H.jsx)(N_,{variant:i?`destructive`:`default`,role:i?`alert`:`status`,children:(0,H.jsxs)(`div`,{className:`col-start-1 flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 break-words`,children:[r.kind===`grouping`&&n(`label-category-cleanup-loading`),r.kind===`checking`&&n(`label-category-cleanup-progress`,{done:r.done,total:r.total}),r.kind===`ready`&&n(`label-category-cleanup-banner-ready`,{groups:r.groups}),r.kind===`failed`&&(0,H.jsxs)(H.Fragment,{children:[n(`label-category-cleanup-banner-failed`),` `,(0,H.jsx)(`bdi`,{children:r.error})]})]}),(0,H.jsx)(K,{variant:`outline`,size:`xs`,onClick:t,children:n(`btn-category-cleanup-banner-open`)})]})})}var B_=Object.defineProperty,V_=(e,t)=>B_(e,`name`,{value:t,configurable:!0}),H_=v.createContext(void 0);function U_(e){let t=v.useContext(H_);return e||t||`ltr`}V_(U_,`useDirection`);var W_=Object.defineProperty,G_=(e,t)=>W_(e,`name`,{value:t,configurable:!0});function K_(e,[t,n]){return Math.min(n,Math.max(t,e))}G_(K_,`clamp`);var q_=Object.defineProperty,J_=(e,t)=>q_(e,`name`,{value:t,configurable:!0});function Y_(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}J_(Y_,`useStateMachine`);var X_=`ScrollArea`,[Z_,Q_]=qa(X_),[$_,ev]=Z_(X_),tv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[h,g]=v.useState(null),[_,y]=v.useState(0),[b,x]=v.useState(0),[S,C]=v.useState(!1),[w,T]=v.useState(!1),E=xa(t,c),D=U_(i);return(0,H.jsx)($_,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,H.jsx)(Mo.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),nv=`ScrollAreaViewport`,rv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=ev(nv,n),s=xa(t,v.useRef(null),o.onViewportChange);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(iv,{nonce:i}),(0,H.jsx)(Mo.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,H.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),iv=v.memo(J_(function({nonce:e}){return(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),av=`ScrollAreaScrollbar`,ov=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=ev(av,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return v.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,H.jsx)(sv,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,H.jsx)(cv,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,H.jsx)(lv,{...r,ref:t,forceMount:n}):i.type===`always`?(0,H.jsx)(uv,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),sv=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=ev(av,e.__scopeScrollArea),[a,o]=v.useState(!1);return v.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=J_(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=J_(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,H.jsx)(wo,{present:n||a,children:(0,H.jsx)(lv,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),cv=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=ev(av,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Av(()=>c(`SCROLL_END`),100),[s,c]=Y_(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return v.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),v.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=J_(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,H.jsx)(wo,{present:n||s!==`hidden`,children:(0,H.jsx)(uv,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:Qa(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:Qa(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),lv=v.forwardRef(J_(function(e,t){let n=ev(av,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=v.useState(!1),s=e.orientation===`horizontal`,c=Av(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return jv(n.viewport,c),jv(n.content,c),(0,H.jsx)(wo,{present:r||a,children:(0,H.jsx)(uv,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),uv=v.forwardRef(J_(function(e,t){let{orientation:n=`vertical`,...r}=e,i=ev(av,e.__scopeScrollArea),a=v.useRef(null),o=v.useRef(0),[s,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Cv(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:J_(e=>a.current=e,`onThumbChange`),onThumbPointerUp:J_(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:J_(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return Tv(e,o.current,s,t)}return J_(d,`getScrollPosition`),n===`horizontal`?(0,H.jsx)(dv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Ev(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,H.jsx)(fv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Ev(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),dv=v.forwardRef(J_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=ev(av,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarXChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(hv,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":wv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Ov(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Sv(o.paddingLeft),paddingEnd:Sv(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),fv=v.forwardRef(J_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=ev(av,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarYChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(hv,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":wv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Ov(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Sv(o.paddingTop),paddingEnd:Sv(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[pv,mv]=Z_(av),hv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=ev(av,n),[m,h]=v.useState(null),g=xa(t,h),_=v.useRef(null),y=v.useRef(``),b=p.viewport,x=r.content-r.viewport,S=os(u),C=os(c),w=Av(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return J_(T,`handleDragScroll`),v.useEffect(()=>{let e=J_(e=>{let t=e.target;m?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,m,x,S]),v.useEffect(C,[r,C]),jv(m,w),jv(p.content,w),(0,H.jsx)(pv,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:os(a),onThumbPointerUp:os(o),onThumbPositionChange:C,onThumbPointerDown:os(s),children:(0,H.jsx)(Mo.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:Qa(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:Qa(e.onPointerMove,T),onPointerUp:Qa(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),gv=`ScrollAreaThumb`,_v=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=mv(gv,e.__scopeScrollArea);return(0,H.jsx)(wo,{present:n||i.hasThumb,children:(0,H.jsx)(vv,{ref:t,...r})})},`ScrollAreaThumb`)),vv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=ev(gv,n),o=mv(gv,n),{onThumbPositionChange:s}=o,c=xa(t,o.onThumbChange),l=v.useRef(void 0),u=Av(()=>{l.current&&=(l.current(),void 0)},100);return v.useEffect(()=>{let e=a.viewport;if(e){let t=J_(()=>{if(u(),!l.current){let t=kv(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,H.jsx)(Mo.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:Qa(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:Qa(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),yv=`ScrollAreaCorner`,bv=v.forwardRef(J_(function(e,t){let n=ev(yv,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,H.jsx)(xv,{...e,ref:t}):null},`ScrollAreaCorner`)),xv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,...r}=e,i=ev(yv,n),[a,o]=v.useState(0),[s,c]=v.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return jv(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),jv(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),v.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,H.jsx)(Mo.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function Sv(e){return e?parseInt(e,10):0}J_(Sv,`toInt`);function Cv(e,t){let n=e/t;return isNaN(n)?0:n}J_(Cv,`getThumbRatio`);function wv(e){let t=Cv(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}J_(wv,`getThumbSize`);function Tv(e,t,n,r=`ltr`){let i=wv(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Dv([c,l],d)(e)}J_(Tv,`getScrollPositionFromPointer`);function Ev(e,t,n=`ltr`){let r=wv(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=K_(e,n===`ltr`?[0,o]:[o*-1,0]);return Dv([0,o],[0,s])(c)}J_(Ev,`getThumbOffsetFromScroll`);function Dv(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}J_(Dv,`linearScale`);function Ov(e,t){return e>0&&e<t}J_(Ov,`isScrollingWithinScrollbarBounds`);var kv=J_((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return J_((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function Av(e,t){let n=os(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}J_(Av,`useDebounceCallback`);function jv(e,t){let n=os(t);ro(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}J_(jv,`useResizeObserver`);var Mv=tv,Nv=rv,Pv=bv;function Fv({className:e,children:t,...n}){return(0,H.jsxs)(Mv,{"data-slot":`scroll-area`,className:V(`relative`,e),...n,children:[(0,H.jsx)(Nv,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:t}),(0,H.jsx)(Iv,{}),(0,H.jsx)(Pv,{})]})}function Iv({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(ov,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:V(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,H.jsx)(_v,{"data-slot":`scroll-area-thumb`,className:`bg-border relative flex-1 rounded-full`})})}function Lv({open:e=!1,profileId:t=``,onOpenChange:n}){let{t:r}=G(),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)([]);(0,v.useEffect)(()=>{e&&t&&c(t)},[e,t]);async function c(e){a(!0),s([]);let t=await oi(`/api/user-profile/changelog?profileId=${encodeURIComponent(e)}&limit=10`);a(!1),t.success&&t.data?s(t.data):s([])}return(0,H.jsx)(zl,{open:e,onOpenChange:n,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:r(`modal-changelog-title`)})}),(0,H.jsx)(Fv,{className:`max-h-80`,children:i?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`loading-changelog`)}):o.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`empty-changelog`)}):(0,H.jsx)(`div`,{className:`space-y-3 pr-3`,children:o.map((e,t)=>(0,H.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`font-medium`,children:[`v`,e.version]}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeType}),(0,H.jsx)(`span`,{className:`text-muted-foreground ml-auto`,children:Qp(e.createdAt)})]}),(0,H.jsx)(`p`,{className:`text-sm`,children:e.changeSummary})]},`${e.version}-${t}`))})})]})})}function Rv({item:e,onOpen:t,focusKey:n}){let{t:r}=G(),i=Gu(e).length;return i===0?null:(0,H.jsxs)(K,{type:`button`,variant:`ghost`,size:`xs`,className:`-mx-1.5 h-5 cursor-pointer px-1.5 text-xs font-normal text-muted-foreground transition-colors duration-200 ease-in hover:bg-transparent hover:text-primary-label focus-visible:text-primary-label`,"aria-haspopup":`dialog`,"data-evidence-key":n,"aria-label":r(`evidence-open-label`,{count:i}),onClick:t,children:[(0,H.jsx)(Be,{className:`size-3`,"aria-hidden":`true`}),r(`evidence-count`,{count:i})]})}var zv={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function Bv({item:e,section:t}){let{t:n,language:r}=G(),i=Gu(e);return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,children:[n(zv[t]),e.category?` · ${e.category}`:null]}),(0,H.jsx)(`p`,{dir:`auto`,className:`text-sm leading-6 break-words`,children:e.description}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-hit-count`,{count:e.frequency||1})})]}),(0,H.jsx)(Fv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[50vh] rounded-lg border`,children:(0,H.jsx)(`ol`,{className:`flex flex-col divide-y`,children:i.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex gap-3 px-3 py-2.5 text-sm leading-6`,children:[(0,H.jsx)(`span`,{className:`w-5 shrink-0 text-end text-xs leading-6 text-muted-foreground tabular-nums`,children:t+1}),e.kind===`manual-write`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted-foreground italic`,children:[(0,H.jsx)(pt,{className:`size-3.5`,"aria-hidden":`true`}),n(`evidence-manual-write`)]}):(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 whitespace-pre-wrap break-words`,children:e.text})]},t))})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-note`)})]})}function Vv({item:e,section:t,focusKey:n,onOpenChange:r}){let{t:i}=G(),a=(0,v.useRef)(null);return n&&(a.current=n),(0,H.jsx)(zl,{open:e!==null,onOpenChange:r,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,onCloseAutoFocus:e=>{let t=a.current,n=t?document.querySelector(`[data-evidence-key="${CSS.escape(t)}"]`):null;n&&(e.preventDefault(),n.focus())},children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:i(`evidence-dialog-title`)}),(0,H.jsx)(Gl,{className:`sr-only`,children:e?.description})]}),e?(0,H.jsx)(Bv,{item:e,section:t}):null]})})}function Hv({open:e=!1,type:t=null,index:n=0,action:r=`edit`,item:i=null,onOpenChange:a,onSaved:o}){let{t:s}=G(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)([``]),[m,h]=(0,v.useState)(`1`),[g,_]=(0,v.useState)(!1),y=r===`edit`,b=t===`workflows`;(0,v.useEffect)(()=>{e&&i&&(l(i.category||``),d(i.description||``),p(i.steps?.length?[...i.steps]:[``]),h(`1`))},[e,i]);let x=y?s(`btn-edit`)||`Edit Item`:m===`2`?s(`confirm-delete-title`)||`Confirm Delete`:s(`confirm-delete`)||`Delete Item?`;function S(e){a?.(e)}function C(){p(e=>[...e,``])}function w(e){p(t=>{let n=t.filter((t,n)=>n!==e);return n.length===0?[``]:n})}function T(e,t){p(n=>n.map((n,r)=>r===e?t:n))}async function E(e){if(e.preventDefault(),!t)return;if(r===`delete`){if(m===`1`){h(`2`);return}_(!0);let e=await oi(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:t,index:n,action:`delete`})});_(!1),e.success?(U.success(s(`toast-delete-success`)||`Item deleted`),S(!1),o?.()):U.error(e.error||s(`toast-delete-failed`)||`Delete failed`);return}_(!0);let i={type:t,index:n,action:`edit`,category:b?void 0:c,description:u};t===`workflows`&&(i.steps=f.map(e=>e.trim()).filter(Boolean));let a=await oi(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});_(!1),a.success?(U.success(s(`toast-update-success`)||`Item updated`),S(!1),o?.()):U.error(a.error||s(`toast-update-failed`)||`Update failed`)}return(0,H.jsx)(zl,{open:e,onOpenChange:S,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:x})}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:E,children:[y||m===`1`?(0,H.jsxs)(H.Fragment,{children:[b?null:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`profile-item-category`,children:s(`label-category`)}),(0,H.jsx)(ad,{id:`profile-item-category`,value:c,onChange:e=>l(e.target.value),disabled:!y})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`profile-item-description`,children:s(`label-description`)}),(0,H.jsx)(Ip,{id:`profile-item-description`,rows:4,value:u,onChange:e=>d(e.target.value),disabled:!y})]}),b&&y?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{children:s(`label-steps`)}),(0,H.jsx)(`div`,{className:`space-y-2`,children:f.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground w-5 tabular-nums`,children:t+1}),(0,H.jsx)(ad,{value:e,placeholder:`Step ${t+1}...`,onChange:e=>T(t,e.target.value)}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:()=>w(t),children:`×`})]},t))}),(0,H.jsx)(K,{type:`button`,variant:`secondary`,size:`sm`,onClick:C,children:s(`btn-add-step`)})]}):null]}):null,(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`secondary`,onClick:()=>S(!1),children:s(`btn-cancel`)}),(0,H.jsx)(K,{type:`submit`,variant:y?`default`:`destructive`,disabled:g,children:y?s(`btn-save`)||`Save`:s(`btn-delete`)||`Delete`})]})]})]})})}var Uv=8;function Wv({label:e,children:t,className:n}){let r=v.useId(),i=v.useRef(null),a=v.useRef(null),[o,s]=v.useState(!1),[c,l]=v.useState(0);return v.useEffect(()=>{if(!o)return;let e=e=>{i.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[o]),v.useLayoutEffect(()=>{let e=a.current,t=i.current;if(!o||!e||!t)return;let n=t.getBoundingClientRect(),r=e.offsetWidth/2,s=n.left+n.width/2,c=document.documentElement.clientWidth,u=Math.min(Math.max(s,Uv+r),c-Uv-r);l(u-s)},[o]),(0,H.jsxs)(`span`,{ref:i,className:V(`relative inline-flex`,n),children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":e,"aria-expanded":o,"aria-controls":r,onClick:()=>s(e=>!e),className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors duration-150 outline-none hover:bg-interactive-hover hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-selection aria-expanded:text-foreground`,children:(0,H.jsx)(Be,{className:`size-3.5`,"aria-hidden":`true`})}),o?(0,H.jsx)(`div`,{ref:a,id:r,style:{transform:`translateX(calc(-50% + ${c}px))`},className:`absolute top-full left-1/2 z-30 mt-2 w-72 max-w-[calc(100vw-1rem)] rounded-lg border border-border bg-card p-3 text-start text-xs whitespace-normal text-card-foreground shadow-sm`,children:t}):null]})}var Gv=20;function Kv(e,t){let n=e.length,r=Math.max(1,Math.ceil(n/Gv)),i=Math.min(t,r),a=(i-1)*Gv;return{items:e.slice(a,a+Gv),total:n,totalPages:r,page:i,start:a}}function qv(e){return Math.round((e.confidence||0)*100)}function Jv({profile:e,loading:t=!1,onRefresh:n,onCleanup:r,onCategoryCleanup:i,categoryCleanupOpen:a=!1}){let{t:o}=G(),[s,c]=(0,v.useState)({pref:1,pat:1,wf:1}),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(0),[_,y]=(0,v.useState)(`edit`),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),w=(0,v.useMemo)(()=>{if(!e?.exists||!e.profileData)return null;let t=e.profileData;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}return t},[e]),T=(0,v.useMemo)(()=>{let e=[...w?.preferences??[],...w?.patterns??[]];return new Set(e.map(e=>e.category||`General`)).size},[w]),E=(0,v.useMemo)(()=>Vu(w?.preferences),[w]),D=(0,v.useMemo)(()=>Vu(w?.patterns),[w]),O=(0,v.useMemo)(()=>Vu(w?.workflows),[w]),k=(0,v.useMemo)(()=>O.map((e,t)=>({item:e,index:t})).sort((e,t)=>(t.item.frequency||0)-(e.item.frequency||0)),[O]),j=Kv(E,s.pref),M=Kv(D,s.pat),N=Kv(k,s.wf),P=O.length;function ee(e,t,n){let r=(e===`preferences`?E:e===`patterns`?D:O)[t];r&&(m(e),g(t),y(n),x(r),f(!0))}function F(e,t){return e.indexOf(t)}function I({page:e,pageKey:t}){return e.total<=Gv?null:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-2`,children:[(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground me-2`,children:[e.start+1,`-`,Math.min(e.start+Gv,e.total),` / `,e.total]}),Array.from({length:e.totalPages},(e,t)=>t+1).map(n=>(0,H.jsx)(K,{size:`xs`,variant:n===e.page?`default`:`outline`,onClick:()=>c(e=>({...e,[t]:n})),children:n},n))]})}function te({item:e,type:t,fullList:n}){let r=F(n,e),i=qv(e);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-4 space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[t!==`workflows`||e.category?(0,H.jsx)(id,{variant:`outline`,className:`bg-transparent border-current [color:oklch(0.42_0.13_var(--category-hue))] dark:[color:oklch(0.8_0.13_var(--category-hue))]`,style:{"--category-hue":String(td(e.category||`General`))},children:e.category||`General`}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5 ms-auto`,children:[(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:o(`btn-edit`)||`Edit`,onClick:()=>ee(t,r,`edit`),children:(0,H.jsx)(mt,{className:`size-3`})}),(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:o(`btn-delete`)||`Delete`,onClick:()=>ee(t,r,`delete`),children:(0,H.jsx)(Rt,{className:`size-3`})})]}),(0,H.jsxs)(`div`,{className:V(`shrink-0 rounded-md border px-1.5 py-0.5 text-xs font-medium tabular-nums`,qu[Ku(i)]),title:`${o(`label-confidence`)}: ${i}%`,children:[i,`%`]})]}),(0,H.jsx)(`p`,{className:`text-sm break-words`,children:e.description||``}),e.steps?.length?(0,H.jsx)(`ol`,{className:`flex flex-col items-start gap-1.5`,children:e.steps.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex min-w-0 max-w-full items-start gap-2 rounded-2xl border border-blue-600/40 bg-blue-500/15 py-1 ps-1 pe-3 text-xs leading-5 text-blue-700 dark:text-blue-400`,children:[(0,H.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-blue-500/30 text-[11px] font-medium tabular-nums dark:bg-blue-400/30`,children:t+1}),(0,H.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))}):null,e.evidence||e.frequency?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:o(`label-evidence-tooltip`,{count:e.frequency||1}),children:[(0,H.jsx)(It,{className:`size-3`}),e.frequency||1]}),Gu(e).length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`·`}),(0,H.jsx)(Rv,{item:e,focusKey:`${t}-${r}`,onOpen:()=>C({item:e,section:t,focusKey:`${t}-${r}`})})]}):null]}):null]})}return t&&!e?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:o(`loading-profile`)}):e?.exists?w?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{dir:`auto`,className:`text-section-title font-semibold break-words`,children:e.displayName||e.userId}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-version`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.version})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-prompts`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.totalPromptsAnalyzed})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-updated`)}),(0,H.jsx)(`span`,{className:`ms-1`,children:e.lastAnalyzedAt?Qp(e.lastAnalyzedAt):`—`})]}),(0,H.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(K,{variant:`outline`,size:`sm`,onClick:()=>r?.(),children:[(0,H.jsx)(At,{className:`size-3.5`}),o(`btn-ai-cleanup`)]}),(0,H.jsx)(Wv,{label:o(`label-more-info`),children:o(`help-ai-cleanup`)})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(K,{variant:`outline`,size:`sm`,onClick:()=>i?.(),children:[(0,H.jsx)(Ft,{className:`size-3.5`}),o(`btn-category-cleanup`),(0,H.jsx)(`span`,{className:`font-mono opacity-70`,title:o(`label-category-count-title`),children:T})]}),(0,H.jsx)(Wv,{label:o(`label-more-info`),children:o(`help-category-cleanup`)})]}),(0,H.jsx)(j_,{version:e.version,onUndone:n}),(0,H.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>n?.(),children:[(0,H.jsx)(xt,{className:`size-3.5`}),o(`btn-refresh`)]}),(0,H.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>u(!0),children:[(0,H.jsx)(Ct,{className:`size-3.5`}),`History`]})]})]}),(0,H.jsx)(z_,{paused:a,onOpen:()=>i?.()})]}),(0,H.jsxs)(`div`,{className:`grid gap-8`,children:[(0,H.jsxs)(`section`,{id:`profile-preferences`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Le,{className:`size-4`}),o(`profile-preferences`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:E.length})]}),E.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-preferences`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:j.items.map(e=>(0,H.jsx)(te,{item:e,type:`preferences`,fullList:E},F(E,e)))}),(0,H.jsx)(I,{page:j,pageKey:`pref`})]})]}),(0,H.jsxs)(`section`,{id:`profile-patterns`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(A,{className:`size-4`}),o(`profile-patterns`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:D.length})]}),D.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-patterns`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:M.items.map(e=>(0,H.jsx)(te,{item:e,type:`patterns`,fullList:D},F(D,e)))}),(0,H.jsx)(I,{page:M,pageKey:`pat`})]})]}),(0,H.jsxs)(`section`,{id:`profile-workflows`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Gt,{className:`size-4`}),o(`profile-workflows`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:P})]}),P===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-workflows`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid items-start gap-3 lg:grid-cols-2`,children:N.items.map(e=>(0,H.jsx)(te,{item:e.item,type:`workflows`,fullList:O},e.index))}),(0,H.jsx)(I,{page:N,pageKey:`wf`})]})]})]})]}),(0,H.jsx)(Lv,{open:l,onOpenChange:u,profileId:e?.id||``}),(0,H.jsx)(Hv,{open:d,onOpenChange:f,type:p,index:h,action:_,item:b,onSaved:n}),(0,H.jsx)(Vv,{item:S?.item??null,section:S?.section??`preferences`,focusKey:S?.focusKey??null,onOpenChange:e=>{e||C(null)}})]}):null:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-10 text-muted-foreground`,children:[(0,H.jsx)(Ht,{className:`size-8`}),(0,H.jsx)(`p`,{className:`text-sm`,children:e?.message||o(`empty-preferences`)})]})}function Yv({open:e=!1,count:t=0,onOpenChange:n,onComplete:r}){let{t:i}=G(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(0);(0,v.useEffect)(()=>{e&&!a&&(c(i(`migration-found-tags`,{count:t})),u(0))},[e,a,t,i]);function d(e){a&&!e||n?.(e)}async function f(){o(!0),c(i(`status-migration-init`)),u(0);let e=!0,t=0,n=1e3;for(;e&&t<n;){t++;let n=await oi(`/api/migration/tags/run-batch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({batchSize:3})});if(!n.success||!n.data){c(i(`toast-migration-failed`)+`: `+(n.error||``)),o(!1);return}let r=n.data.processed;e=n.data.hasMore;let a=n.data.total;u(a>0?Math.round(r/a*100):0),c(i(`status-migration-progress`,{current:r,total:a})),e&&await new Promise(e=>setTimeout(e,100))}if(t>=n){c(i(`migration-stopped`)),o(!1);return}u(100),c(i(`toast-migration-success`)),U.success(i(`toast-migration-success`)),setTimeout(()=>{o(!1),d(!1),r?.()},2e3)}return(0,H.jsx)(zl,{open:e,onOpenChange:d,children:(0,H.jsxs)(q,{className:`sm:max-w-md`,showCloseButton:!a,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:i(`modal-migration-title`)})}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s}),(0,H.jsx)(`div`,{className:`h-2 rounded-full bg-muted overflow-hidden`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary transition-all duration-200`,style:{width:`${l}%`}})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`migration-note`)})]}),a?null:(0,H.jsx)(Ul,{children:(0,H.jsxs)(K,{onClick:f,children:[(0,H.jsx)(gt,{className:`size-3.5`}),i(`btn-start-migration`)]})})]})})}var Xv=[{id:`settings-section-external-api`,title:`External API`},{id:`settings-section-models`,title:`Models`},{id:`settings-section-embedding`,title:`Embedding`},{id:`settings-section-keys`,title:`Keys and access`},{id:`settings-section-diagnostics`,title:`Capture diagnostics`},{id:`settings-section-health`,title:`Health`},{id:`settings-section-claude-folder`,title:`Claude Code folder`},{id:`settings-section-capture-language`,title:`Memory language`},{id:`settings-section-appearance`,title:`Appearance`},{id:`settings-section-profiles`,title:`Profiles`},{id:`settings-section-web-app`,title:`Web app`},{id:`settings-section-skill-learning`,title:`Skill learning`},{id:`settings-section-log`,title:`Log`}],Zv={"(empty prompt)":[`(空提示)`,`(مطالبة فارغة)`],"<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.":[`<private> 文本、API 密钥和密码将按原文存储,并在起草时发送到外部 API。`,`سيُخزَّن نص <private> ومفاتيح API وكلمات المرور كما كُتبت، وتُرسَل إلى واجهة API الخارجية عند الصياغة.`],"A project config turns recording off for this project.":[`项目配置已为此项目关闭记录。`,`يوقف إعداد المشروع التسجيل في هذا المشروع.`],Attention:[`关注度`,`الاهتمام`],"Add folder":[`添加文件夹`,`إضافة مجلد`],"All skills":[`所有技能`,`كل المهارات`],"Changes to SKILL.md":[`对 SKILL.md 的更改`,`التغييرات على SKILL.md`],"Delete recorded turns":[`删除已记录的回合`,`حذف الأدوار المسجلة`],"Delete {count} recorded turns? This cannot be undone.":[`删除 {count} 个已记录的回合?此操作无法撤销。`,`حذف {count} من الأدوار المسجلة؟ لا يمكن التراجع عن ذلك.`],"Deleted {count} recorded turns.":[`已删除 {count} 个已记录的回合。`,`تم حذف {count} من الأدوار المسجلة.`],"Draft improvement":[`起草改进`,`صياغة تحسين`],"Draft skill":[`起草技能`,`صياغة مهارة`],"Drafting needs the external API. Set it up first.":[`起草需要外部 API。请先设置。`,`تحتاج الصياغة إلى واجهة API الخارجية. أعدّها أولاً.`],"Drafting… This can take a few minutes.":[`正在起草…这可能需要几分钟。`,`جارٍ الصياغة… قد يستغرق ذلك بضع دقائق.`],"Evidence turns":[`证据回合`,`الأدوار الداعمة`],"Failed turns":[`失败的回合`,`الأدوار الفاشلة`],"File size":[`文件大小`,`حجم الملف`],"Finding past sessions…":[`正在查找过去的会话…`,`جارٍ البحث عن الجلسات السابقة…`],"Filter skills by name":[`按名称筛选技能`,`تصفية المهارات بالاسم`],"Find new skill ideas":[`查找新技能想法`,`البحث عن أفكار مهارات جديدة`],"Folder for the new skill":[`新技能的文件夹`,`مجلد المهارة الجديدة`],"Folder not found":[`未找到文件夹`,`المجلد غير موجود`],"Folder path":[`文件夹路径`,`مسار المجلد`],"Hide changes":[`隐藏更改`,`إخفاء التغييرات`],Improvement:[`改进`,`تحسين`],"Last seen":[`最近出现`,`آخر ظهور`],"Last use":[`上次使用`,`آخر استخدام`],"Loading…":[`加载中…`,`جارٍ التحميل…`],"Loading the proposal…":[`正在加载提案…`,`جارٍ تحميل المقترح…`],"The proposal could not be loaded. Select Show less, then Show more to try again.":[`无法加载该提案。选择“显示更少”,再选择“显示更多”即可重试。`,`تعذّر تحميل المقترح. اختر «عرض أقل» ثم «عرض المزيد» للمحاولة مرة أخرى.`],"Looking…":[`正在查找…`,`جارٍ البحث…`],Manual:[`手动`,`يدوي`],"Most calls":[`调用次数最多`,`الأكثر استدعاءً`],"Most used":[`最常用`,`الأكثر استخدامًا`],"Needs attention":[`需要关注`,`يحتاج إلى اهتمام`],"Sort skills":[`技能排序`,`ترتيب المهارات`],"New skill":[`新技能`,`مهارة جديدة`],"New skill ideas":[`新技能想法`,`أفكار مهارات جديدة`],"New turns will be stored as written.":[`新回合将按原文存储。`,`ستُخزَّن الأدوار الجديدة كما كُتبت.`],"No change proposed":[`没有建议更改`,`لم يُقترح أي تغيير`],"No content was saved.":[`没有保存内容。`,`لم يُحفظ أي محتوى.`],"No folders are watched.":[`没有监视的文件夹。`,`لا توجد مجلدات مراقبة.`],"No new skill ideas in the recorded turns.":[`已记录的回合中没有新的技能想法。`,`لا توجد أفكار مهارات جديدة في الأدوار المسجلة.`],"No proposals yet.":[`还没有提案。`,`لا توجد مقترحات بعد.`],"No recorded turns.":[`没有已记录的回合。`,`لا توجد أدوار مسجلة.`],"No skill matches this name.":[`没有技能匹配此名称。`,`لا توجد مهارة تطابق هذا الاسم.`],"No skills found in the watched folders.":[`在监视的文件夹中未找到技能。`,`لم يُعثر على مهارات في المجلدات المراقبة.`],"No turns are recorded yet.":[`还没有记录任何回合。`,`لم تُسجَّل أي أدوار بعد.`],"Not in a watched folder":[`不在监视的文件夹中`,`ليست في مجلد مراقب`],"Nothing is recorded yet. Agent turns are recorded only after you turn it on.":[`尚未记录任何内容。只有在你开启后才会记录智能体回合。`,`لم يُسجَّل شيء بعد. لا تُسجَّل أدوار الوكيل إلا بعد تشغيل ذلك.`],"OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.":[`OMMS 会把完整的提示、回复和工具调用存储在这台电脑上的 skills.db 中。起草时会把已记录的回合发送到外部 API。该文件包含回合中的所有内容。`,`يخزّن OMMS المطالبات والردود واستدعاءات الأدوات كاملةً في skills.db على هذا الجهاز. ترسل الصياغة الأدوار المسجلة إلى واجهة API الخارجية. يحتوي الملف على كل ما تحتويه الأدوار.`],"OMMS will change this SKILL.md file without asking. It drafts an improvement after 10 new uses and at least 24 hours, then applies it. Each change can be undone.":[`OMMS 会在不询问的情况下修改此 SKILL.md 文件。它在 10 次新使用且至少 24 小时后起草改进,然后直接应用。每次更改都可以撤销。`,`سيعدّل OMMS ملف SKILL.md هذا دون أن يسأل. يصوغ تحسيناً بعد 10 استخدامات جديدة و24 ساعة على الأقل، ثم يطبّقه. يمكن التراجع عن كل تغيير.`],"Skill learning watches how your agents use your skills on Pi, OpenCode and Claude Code. It ranks each skill by use and failed tool calls, and drafts better versions from real turns.":[`技能学习会观察你的智能体在 Pi、OpenCode 和 Claude Code 中如何使用你的技能。它按使用次数和失败的工具调用为每个技能排名,并根据真实回合起草更好的版本。`,`يراقب تعلّم المهارات كيف يستخدم وكلاؤك مهاراتك في Pi وOpenCode وClaude Code. يرتّب كل مهارة حسب الاستخدام واستدعاءات الأدوات الفاشلة، ويصوغ نسخاً أفضل من أدوار حقيقية.`],"Every draft is a proposal with a diff. Nothing changes a SKILL.md file until you apply it, unless you set that skill to Automatic. Undo restores the previous version.":[`每份草稿都是带差异对比的提案。在你应用之前,SKILL.md 文件不会改变,除非你把该技能设为“自动”。撤销会恢复之前的版本。`,`كل مسودة مقترح مع عرض للفروق. لا يتغيّر ملف SKILL.md حتى تطبّقه، إلا إذا ضبطت تلك المهارة على تلقائي. التراجع يعيد النسخة السابقة.`],"The memory chat sends skill counts and short change summaries to the external API, never turn text.":[`记忆聊天会把技能计数和简短的更改摘要发送到外部 API,绝不发送回合文本。`,`ترسل دردشة الذاكرة أعداد المهارات وملخصات التغييرات القصيرة إلى واجهة API الخارجية، ولا ترسل نص الأدوار أبداً.`],"Open the Skill learning card":[`打开“技能学习”卡片`,`افتح بطاقة تعلّم المهارات`],"No proposals are waiting.":[`没有等待处理的提案。`,`لا توجد مقترحات قيد الانتظار.`],"No proposals have been decided yet.":[`尚未处理任何提案。`,`لم يتم البتّ في أي مقترح بعد.`],"Pending proposals":[`待处理的提案`,`المقترحات المعلّقة`],Proposals:[`提案`,`المقترحات`],"Ranked skills":[`技能排名`,`المهارات مرتبةً`],"Recent turns":[`最近的回合`,`الأدوار الأخيرة`],"Recent proposals":[`最近的提案`,`المقترحات الأخيرة`],"Record agent turns":[`记录智能体回合`,`تسجيل أدوار الوكيل`],"Record agent turns so OMMS can rank your skills and draft improvements.":[`记录智能体回合,让 OMMS 为你的技能排名并起草改进。`,`سجّل أدوار الوكيل ليتمكن OMMS من ترتيب مهاراتك وصياغة التحسينات.`],"Record past turns":[`记录过去的回合`,`تسجيل الأدوار السابقة`],"Record past turns did not finish.":[`记录过去的回合未完成。`,`لم يكتمل تسجيل الأدوار السابقة.`],"Recorded turns":[`已记录的回合`,`الأدوار المسجلة`],"Recorded {count} past turns.":[`已记录 {count} 个过去的回合。`,`تم تسجيل {count} من الأدوار السابقة.`],Reject:[`拒绝`,`رفض`],"Remove folder":[`移除文件夹`,`إزالة المجلد`],"Remove folder {path}":[`移除文件夹 {path}`,`إزالة المجلد {path}`],"Remove private text and secrets":[`移除私密文本和机密`,`إزالة النص الخاص والأسرار`],"Reset default":[`恢复默认`,`استعادة الافتراضي`],"Saved.":[`已保存。`,`تم الحفظ.`],"Show changes":[`显示更改`,`عرض التغييرات`],"Skill learning":[`技能学习`,`تعلّم المهارات`],"Skill turns":[`技能回合`,`أدوار المهارات`],"Skill turns are recorded only while Record agent turns is on.":[`只有开启“记录智能体回合”时才会记录技能回合。`,`لا تُسجَّل أدوار المهارات إلا عند تشغيل تسجيل أدوار الوكيل.`],"Skill turns to record":[`待记录的技能回合`,`أدوار المهارات المراد تسجيلها`],"Skill turns already recorded":[`已记录的技能回合`,`أدوار المهارات المسجلة سابقاً`],"Skill turns recorded":[`本次记录的技能回合`,`أدوار المهارات المسجلة`],"Skill turns already present":[`已存在的技能回合`,`أدوار المهارات الموجودة مسبقاً`],Skills:[`技能`,`المهارات`],"Stale: the file changed since this draft":[`已过期:自起草以来文件已更改`,`قديم: تغيّر الملف منذ هذه المسودة`],"Stop removing private text and secrets?":[`停止移除私密文本和机密?`,`إيقاف إزالة النص الخاص والأسرار؟`],Suggested:[`建议`,`مقترحة`],"Turn off":[`关闭`,`إيقاف`],"Turn on Automatic":[`开启自动`,`تشغيل التلقائي`],"Turn on Automatic mode for this skill?":[`为此技能开启自动模式?`,`تشغيل الوضع التلقائي لهذه المهارة؟`],Undo:[`撤销`,`تراجع`],"Undo stopped because the file changed. This is the content OMMS saved:":[`撤销已停止,因为文件已更改。这是 OMMS 保存的内容:`,`توقف التراجع لأن الملف تغيّر. هذا هو المحتوى الذي حفظه OMMS:`],Uses:[`使用`,`الاستخدامات`],"Uses in 30 days":[`30 天内使用`,`الاستخدامات في 30 يوماً`],"Watched folders":[`监视的文件夹`,`المجلدات المراقبة`],applied:[`已应用`,`طُبّق`],"applied automatically":[`已自动应用`,`طُبّق تلقائياً`],rejected:[`已拒绝`,`مرفوض`],stale:[`已过期`,`قديم`],undone:[`已撤销`,`تم التراجع`],"{count} failed tool call":[`{count} 次工具调用失败`,`فشل استدعاء أداة واحد`],"{count} failed tool calls":[`{count} 次工具调用失败`,`فشل {count} من استدعاءات الأدوات`],"{count} skill":[`{count} 个技能`,`مهارة واحدة`],"{count} skills":[`{count} 个技能`,`المهارات: {count}`],Show:[`显示`,`عرض`],results:[`条结果`,`نتائج`],"Custom:":[`自定义:`,`مخصص:`],"Results per page":[`每页结果数`,`النتائج في كل صفحة`],"Custom results per page":[`自定义每页结果数`,`عدد مخصص للنتائج في كل صفحة`],"Sort by":[`排序方式`,`الترتيب حسب`],"Sort ascending":[`升序排列`,`ترتيب تصاعدي`],"Sort descending":[`降序排列`,`ترتيب تنازلي`],"Showing {from} to {to} of {total} results":[`显示第 {from} 到 {to} 条,共 {total} 条结果`,`عرض {from} إلى {to} من {total} نتيجة`],pagination:[`分页`,`ترقيم الصفحات`],"Go to previous page":[`转到上一页`,`الانتقال إلى الصفحة السابقة`],"Go to next page":[`转到下一页`,`الانتقال إلى الصفحة التالية`],"Go to page {page}":[`转到第 {page} 页`,`الانتقال إلى الصفحة {page}`],"More pages":[`更多页面`,`صفحات أخرى`],"Name (A–Z)":[`名称(A–Z)`,`الاسم (A–Z)`],Newest:[`最新`,`الأحدث`],Oldest:[`最早`,`الأقدم`],Skill:[`技能`,`المهارة`],Mode:[`模式`,`الوضع`],"Tool (A–Z)":[`工具(A–Z)`,`الأدوات (A–Z)`],Contents:[`目录`,`المحتويات`],"Show contents":[`显示目录`,`إظهار المحتويات`],"Hide contents":[`隐藏目录`,`إخفاء المحتويات`],"{count} proposal":[`{count} 个提案`,`مقترح واحد ({count})`],"{count} proposals":[`{count} 个提案`,`المقترحات: {count}`],"{count} turn":[`{count} 个回合`,`دور واحد ({count})`],"{count} turns":[`{count} 个回合`,`الأدوار: {count}`],"{count} failure group":[`{count} 个失败分组`,`مجموعة فشل واحدة ({count})`],"{count} failure groups":[`{count} 个失败分组`,`مجموعات فشل: {count}`],"{count} entry":[`{count} 条记录`,`إدخال واحد ({count})`],"{count} entries":[`{count} 条记录`,`الإدخالات: {count}`],"Created {date}":[`创建于 {date}`,`أُنشئ في {date}`],"Applied {date}":[`应用于 {date}`,`طُبّق في {date}`],"Rejected {date}":[`拒绝于 {date}`,`رُفض في {date}`],"Undone {date}":[`撤销于 {date}`,`تم التراجع في {date}`],"Stale since {date}":[`自 {date} 起已过期`,`قديم منذ {date}`],"Each card shows when the proposal was created and when it was last applied, rejected or undone.":[`每张卡片显示提案的创建时间,以及最近一次应用、拒绝或撤销的时间。`,`تعرض كل بطاقة وقت إنشاء المقترح ووقت آخر تطبيق أو رفض أو تراجع.`],History:[`历史记录`,`السجل`],created:[`已创建`,`أُنشئ`],"Each proposal, apply, reject and undo of this skill. Revert an applied change to restore SKILL.md as it was before it.":[`此技能的每个提案、应用、拒绝和撤销。还原已应用的更改可将 SKILL.md 恢复到该更改之前的状态。`,`كل مقترح وتطبيق ورفض وتراجع لهذه المهارة. أعِد تغييراً مطبّقاً لتستعيد SKILL.md كما كان قبله.`],"No history yet.":[`暂无历史记录。`,`لا يوجد سجل بعد.`],"{added} lines added, {removed} lines removed":[`新增 {added} 行,删除 {removed} 行`,`أُضيف {added} سطر، وحُذف {removed} سطر`],"Revert to before this change":[`还原到此更改之前`,`الرجوع إلى ما قبل هذا التغيير`],"Revert the newer change first.":[`请先还原较新的更改。`,`أعِد التغيير الأحدث أولاً.`],"Revert this change?":[`还原此更改?`,`هل تريد إعادة هذا التغيير؟`],"OMMS restores SKILL.md as it was before this change.":[`OMMS 会将 SKILL.md 恢复到此更改之前的状态。`,`يستعيد OMMS ملف SKILL.md كما كان قبل هذا التغيير.`],"Reverting this also removes {count} later change.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة تغيير لاحق واحد ({count}).`],"Reverting this also removes {count} later changes.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة {count} من التغييرات اللاحقة.`],Revert:[`还原`,`إعادة`],"Reverting…":[`正在还原…`,`جارٍ الإعادة…`],"Reverted. SKILL.md is back to the version before that change.":[`已还原。SKILL.md 已恢复到该更改之前的版本。`,`تمت الإعادة. عاد SKILL.md إلى النسخة السابقة لذلك التغيير.`],Activity:[`活动`,`النشاط`],"Activity could not load.":[`无法加载活动。`,`تعذّر تحميل النشاط.`],"Active skills":[`活跃技能`,`المهارات النشطة`],"Uses per day":[`每日使用`,`الاستخدامات يومياً`],"Uses in the last 30 days":[`最近 30 天的使用`,`الاستخدامات في آخر 30 يوماً`],"Most used skills":[`最常用的技能`,`المهارات الأكثر استخداماً`],"Proposal pipeline":[`提案进度`,`مسار المقترحات`],Successful:[`成功`,`ناجح`],Day:[`日期`,`اليوم`],"{uses} uses, {failed} with a failed tool call":[`使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"{name} leads with {uses} uses. Click a bar to open the skill.":[`{name} 以 {uses} 次使用领先。点击条形可打开该技能。`,`تتصدر {name} بعدد {uses} استخدام. انقر على شريط لفتح المهارة.`],"{total} proposals, {pending} waiting for a decision":[`共 {total} 个提案,{pending} 个等待决定`,`{total} مقترح، منها {pending} بانتظار قرار`],"No uses in the last 30 days. Bars appear after OMMS records turns.":[`最近 30 天没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في آخر 30 يوماً. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"No skill was used in the last 30 days.":[`最近 30 天没有使用任何技能。`,`لم تُستخدم أي مهارة في آخر 30 يوماً.`],"No skill uses are recorded in the last 30 days. The use charts appear after OMMS records agent turns that use a skill.":[`最近 30 天没有记录到技能使用。OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`لا توجد استخدامات مسجلة للمهارات في آخر 30 يوماً. تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"Show uses by":[`使用次数显示方式`,`عرض الاستخدامات حسب`],Days:[`按天`,`الأيام`],Months:[`按月`,`الأشهر`],Years:[`按年`,`السنوات`],"Days to show":[`要显示的日期范围`,`الأيام المعروضة`],"Year to show":[`要显示的年份`,`السنة المعروضة`],"Last 30 days":[`最近 30 天`,`آخر 30 يوماً`],"Uses per month":[`每月使用`,`الاستخدامات شهرياً`],"Uses per year":[`每年使用`,`الاستخدامات سنوياً`],Month:[`月份`,`الشهر`],Year:[`年份`,`السنة`],"{from} to {to}":[`{from} 至 {to}`,`من {from} إلى {to}`],"Uses in {period}":[`{period} 的使用`,`الاستخدامات في {period}`],"{period}: {uses} uses, {failed} with a failed tool call":[`{period}:使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{period}: {uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"No skill uses are recorded in {period}.":[`{period} 没有记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات في {period}.`],"No skill uses are recorded yet.":[`尚未记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات بعد.`],"The use charts appear after OMMS records agent turns that use a skill.":[`OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"No uses in this period. Bars appear after OMMS records turns.":[`此期间没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في هذه الفترة. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"Showing {shown} of {total}":[`显示 {shown} / {total}`,`عرض {shown} من {total}`],"Show more":[`显示更多`,`عرض المزيد`],"Show less":[`显示更少`,`عرض أقل`],lines:[`行`,`أسطر`],"Show {count} more":[`再显示 {count} 条`,`عرض {count} إضافية`],"Last modified":[`最近修改`,`آخر تعديل`],"Modified on {date}":[`修改于 {date}`,`تم التعديل في {date}`],"Show skills by modification":[`按是否修改显示技能`,`عرض المهارات حسب التعديل`],"All ({count})":[`全部({count})`,`الكل ({count})`],"Not modified ({count})":[`未修改({count})`,`غير معدّلة ({count})`],"Modified ({count})":[`已修改({count})`,`معدّلة ({count})`],"No skill has been modified yet.":[`尚未修改任何技能。`,`لم يتم تعديل أي مهارة بعد.`],"Every skill has been modified.":[`所有技能都已修改。`,`تم تعديل كل المهارات.`],"Suggested ({count})":[`建议({count})`,`مقترحة ({count})`],"No skill is suggested for a change yet.":[`尚无建议修改的技能。`,`لم تُقترح أي مهارة للتعديل بعد.`],"The state could not be saved, so SKILL.md is as it was. Try again.":[`无法保存状态,SKILL.md 保持原样。请重试。`,`تعذر حفظ الحالة، لذا بقي SKILL.md كما كان. حاول مرة أخرى.`],"No skill matches this name in this tab.":[`此标签页中没有技能匹配该名称。`,`لا توجد مهارة تطابق هذا الاسم في هذا التبويب.`],"No error text recorded":[`没有记录错误文本`,`لم يُسجَّل نص خطأ`],"Could not copy":[`无法复制`,`تعذّر النسخ`],"Show full input":[`显示完整输入`,`عرض الإدخال الكامل`],"Show less input":[`收起完整输入`,`إخفاء الإدخال الكامل`],"The server sent the first 20000 characters of this input.":[`服务器只发送了此输入的前 20000 个字符。`,`أرسل الخادم أول 20000 حرفاً من هذا الإدخال فقط.`],Copy:[`复制`,`نسخ`],Close:[`关闭`,`إغلاق`],"The failed calls could not be loaded.":[`无法加载失败的工具调用。`,`تعذّر تحميل الاستدعاءات الفاشلة.`],"Position {position}":[`位置 {position}`,`الموضع {position}`],Failures:[`失败记录`,`حالات الفشل`],"Failed calls that count against this skill, grouped by tool and first error line.":[`按工具和错误首行分组、计入此技能的失败调用。`,`الاستدعاءات الفاشلة التي تُحسب على هذه المهارة، مجمّعةً حسب الأداة وأول سطر في الخطأ.`],"No failed tool calls are recorded for this skill.":[`没有记录到计入此技能的失败工具调用。`,`لا توجد استدعاءات أدوات فاشلة مسجّلة لهذه المهارة.`],"no error text":[`无错误文本`,`بلا نص خطأ`],"{calls} call over {turns} turn":[`{calls} 次调用,涉及 {turns} 个回合`,`استدعاء واحد عبر دور واحد`],"{calls} call over {turns} turns":[`{calls} 次调用,涉及 {turns} 个回合`,`استدعاء واحد عبر {turns} أدوار`],"{calls} calls over {turns} turn":[`{calls} 次调用,涉及 {turns} 个回合`,`{calls} استدعاءات عبر دور واحد`],"{calls} calls over {turns} turns":[`{calls} 次调用,涉及 {turns} 个回合`,`{calls} استدعاءات عبر {turns} أدوار`],"{count} call is in this group; showing the latest {shown}.":[`此分组共有 {count} 次调用;显示最新的 {shown} 次。`,`هذه المجموعة تضم استدعاء واحداً؛ يُعرض آخر {shown} منه.`],"{count} calls are in this group; showing the latest {shown}.":[`此分组共有 {count} 次调用;显示最新的 {shown} 次。`,`هذه المجموعة تضم {count} استدعاء؛ يُعرض آخر {shown} منها.`],"Last seen {date}":[`最近出现于 {date}`,`آخر ظهور {date}`],"Explain failures":[`解释失败`,`شرح حالات الفشل`],"Explaining… This can take a few minutes.":[`正在解释…这可能需要几分钟。`,`جارٍ الشرح… قد يستغرق ذلك بضع دقائق.`],"Skill learning must be on to explain failures.":[`必须开启技能学习才能解释失败。`,`يجب تشغيل تعلّم المهارات لشرح حالات الفشل.`],"No failure groups to explain.":[`没有可解释的失败分组。`,`لا توجد مجموعات فشل لشرحها.`],"About Explain failures":[`关于“解释失败”`,`حول شرح حالات الفشل`],"Explaining needs the external API. Set it up first.":[`解释失败需要外部 API。请先设置。`,`يحتاج شرح الفشل إلى واجهة API الخارجية. أعدّها أولاً.`],"Send failures to the external API?":[`将失败记录发送到外部 API?`,`إرسال حالات الفشل إلى واجهة API الخارجية؟`],"Nothing is sent until you confirm. Nothing is saved.":[`确认之前不会发送任何内容,也不会保存任何内容。`,`لا يُرسَل شيء قبل التأكيد، ولا يُحفَظ شيء.`],"This sends the failure groups (tool names, error text and input excerpts of up to 500 characters) and this skill's SKILL.md to the external API model.":[`这会把失败分组(工具名称、错误文本和最多 500 字符的输入摘录)以及此技能的 SKILL.md 发送到外部 API 模型。`,`يرسل هذا مجموعات الفشل (أسماء الأدوات ونصوص الأخطاء ومقتطفات إدخال حتى 500 حرف) وملف SKILL.md لهذه المهارة إلى نموذج واجهة API الخارجية.`],"The text is sent as stored, after <private> removal and secret redaction.":[`文本按存储时的样子发送:已移除 <private> 内容并对机密进行脱敏。`,`يُرسَل النص كما خُزِّن: بعد إزالة <private> وإخفاء الأسرار.`],"Warning: redaction is off. The text may hold secrets that were not removed.":[`警告:脱敏已关闭。文本中可能含有未移除的机密。`,`تحذير: إخفاء الأسرار متوقف. قد يحمل النص أسراراً لم تُزَل.`],Cancel:[`取消`,`إلغاء`],"Skill fix":[`技能修复`,`إصلاح المهارة`],"Host or harness bug":[`宿主或框架缺陷`,`خلل في المضيف أو الإطار`],"Environment problem":[`环境问题`,`مشكلة في البيئة`],Unknown:[`未知`,`غير معروف`],"Suggested actions":[`建议操作`,`الإجراءات المقترحة`],"The labels and suggestions are leads from the error text only; the model cannot see the host's code.":[`标签和建议仅是来自错误文本的线索;模型看不到宿主的代码。`,`التسميات والاقتراحات مجرد مؤشرات من نص الخطأ فقط؛ لا يستطيع النموذج رؤية كود المضيف.`],"Import chat history":[`导入聊天记录`,`استيراد سجل المحادثات`],"Memory limits":[`记忆限制`,`حدود الذاكرة`],"Resolve missing project folders":[`解析缺失的项目文件夹`,`حل مجلدات المشاريع المفقودة`],"Project memories":[`项目记忆`,`ذاكرة المشروع`],"User profile":[`用户画像`,`الملف الشخصي للمستخدم`],"(preferences, patterns, and workflows)":[`(偏好、模式和工作流程)`,`(التفضيلات والأنماط وسير العمل)`],"All hosts":[`所有宿主`,`جميع المضيفين`],"Selected hosts":[`已选宿主`,`المضيفون المحددون`],"Choose at least one output.":[`请至少选择一项输出。`,`اختر مخرجاً واحداً على الأقل.`],"Choose at least one host.":[`请至少选择一个宿主。`,`اختر مضيفاً واحداً على الأقل.`],"Re-analyse handled history":[`重新分析已处理的记录`,`إعادة تحليل السجل المعالج`],"Re-analysis applies to the selected outputs. Each profile prompt can be forcibly re-analysed once. Findings merge into the existing profile.":[`重新分析适用于所选输出。每条画像提示只能强制重新分析一次。结果合并到现有画像中。`,`تنطبق إعادة التحليل على المخرجات المحددة. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة. تُدمج النتائج في الملف الحالي.`],"Preview the current selection before starting an import.":[`开始导入前,请预览当前选择。`,`عاين الاختيار الحالي قبل بدء الاستيراد.`],"This import makes model calls. Continue?":[`此次导入会调用模型。是否继续?`,`سيجري هذا الاستيراد اتصالات بالنموذج. هل تريد المتابعة؟`],"Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.":[`对话生成项目事实。用户提示生成个人偏好、重复模式和工作流程步骤。`,`تضيف المحادثات حقائق المشروع. وتضيف مطالبات المستخدم التفضيلات الشخصية والأنماط المتكررة وخطوات سير العمل.`],"Profile identity in Settings":[`设置中的画像身份`,`هوية الملف الشخصي في الإعدادات`],"Hosts keep their existing user identities. All hosts does not merge profiles with different identities.":[`各宿主保留现有用户身份。选择所有宿主不会合并不同身份的画像。`,`يحتفظ المضيفون بهويات المستخدم الحالية. اختيار جميع المضيفين لا يدمج ملفات الهويات المختلفة.`],"Pi session reader is unavailable. Fix the reader or deselect Pi.":[`Pi 会话读取器不可用。请修复读取器或取消选择 Pi。`,`قارئ جلسات Pi غير متاح. أصلح القارئ أو ألغِ تحديد Pi.`],"Import results":[`导入结果`,`نتائج الاستيراد`],"Import successful 🎉":[`导入成功`,`تم الاستيراد بنجاح`],"Import failed":[`导入失败`,`فشل الاستيراد`],"Import cancelled":[`导入已取消`,`تم إلغاء الاستيراد`],"The import finished while you were away.":[`导入在你离开时已结束。`,`انتهى الاستيراد أثناء غيابك.`],"Could not reload the settings. Reload the page.":[`无法重新加载设置。请刷新页面。`,`تعذر إعادة تحميل الإعدادات. أعد تحميل الصفحة.`],OK:[`确定`,`حسناً`],Dismiss:[`关闭`,`إغلاق`],"Show handled sessions":[`显示已处理的会话`,`إظهار الجلسات المعالجة`],Handled:[`已处理`,`تمت معالجتها`],"Handled sessions hidden":[`已隐藏的已处理会话`,`الجلسات المعالجة المخفية`],"Some memory units failed. Completed work is saved. A new preview and import retries only the failed units.":[`部分记忆单元失败。已完成的工作已保存。重新预览并导入只会重试失败的单元。`,`فشلت بعض وحدات الذاكرة. العمل المكتمل محفوظ. المعاينة والاستيراد الجديدان يعيدان محاولة الوحدات الفاشلة فقط.`],"Profile learning failed. Completed memory work is saved.":[`画像学习失败。已完成的记忆处理已保存。`,`فشل تعلّم الملف الشخصي. عمل الذاكرة المكتمل محفوظ.`],"Import preparation failed.":[`导入准备失败。`,`فشل تحضير الاستيراد.`],"Refresh the preview and retry.":[`请刷新预览后重试。`,`حدّث المعاينة ثم أعد المحاولة.`],"The session list is out of date. Refresh the list and try again.":[`会话列表已过期。请刷新列表后重试。`,`قائمة الجلسات قديمة. حدّث القائمة ثم أعد المحاولة.`],"The history source changed. Choose it again.":[`历史记录来源已更改。请重新选择。`,`تغيّر مصدر السجل. اختره مجدداً.`],"The history source is no longer valid. Choose it again.":[`历史记录来源已失效。请重新选择。`,`لم يعد مصدر السجل صالحاً. اختره مجدداً.`],"A Pi import is already running":[`已有 Pi 导入正在运行`,`استيراد Pi قيد التشغيل بالفعل`],"An OpenCode import is already running":[`已有 OpenCode 导入正在运行`,`استيراد OpenCode قيد التشغيل بالفعل`],"A Claude Code import is already running":[`已有 Claude Code 导入正在运行`,`استيراد Claude Code قيد التشغيل بالفعل`],"Combined counts":[`合计数量`,`الأعداد المجمعة`],"Current host":[`当前宿主`,`المضيف الحالي`],"Memory extraction":[`提取记忆`,`استخراج الذاكرة`],"Memory units":[`记忆单元`,`وحدات الذاكرة`],"Pending memory units":[`待处理记忆单元`,`وحدات الذاكرة المعلقة`],"Imported memory units":[`已导入记忆单元`,`وحدات الذاكرة المستوردة`],"Already handled memory units":[`已处理记忆单元`,`وحدات الذاكرة المعالجة سابقاً`],"Skipped memory units":[`已跳过记忆单元`,`وحدات الذاكرة المتخطاة`],"Failed memory units":[`失败的记忆单元`,`وحدات الذاكرة التي فشلت`],"Held-back turns":[`暂缓处理的轮次`,`الرسائل المؤجلة`],"Untimed turns":[`无时间戳的轮次`,`الرسائل بلا طابع زمني`],"Load errors":[`加载错误`,`أخطاء التحميل`],"Already handled profile prompts":[`已处理画像提示`,`مطالبات الملف الشخصي المعالجة سابقاً`],"Profile prompts":[`画像提示`,`مطالبات الملف الشخصي`],"Profile batches":[`画像批次`,`دفعات الملف الشخصي`],"Estimated profile analysis calls":[`预计画像分析调用次数`,`اتصالات تحليل الملف الشخصي المقدّرة`],"Waiting prompts inside OMMS":[`OMMS 内等待处理的提示`,`المطالبات المنتظرة داخل OMMS`],"No work to process":[`没有待处理工作`,`لا يوجد عمل للمعالجة`],queued:[`排队中`,`في الانتظار`],preparing:[`准备中`,`جارٍ التحضير`],"not-run":[`未运行`,`لم يُشغّل`],"Automatic profile cleanup":[`自动整理画像`,`التنظيف التلقائي للملف الشخصي`],"After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.":[`学习完成后,OMMS 会在后台自动合并重复的画像条目,并删除含糊的条目。每次运行大约每 100 个条目调用一次模型,在大型画像上需要几分钟。在“用户画像”页面选择“撤销上次自动整理”可恢复这些更改。`,`بعد كل جولة تعلّم، يدمج OMMS عناصر الملف الشخصي المكررة ويحذف العناصر الغامضة تلقائياً في الخلفية. تجري كل عملية نحو اتصال واحد بالنموذج لكل 100 عنصر وتستغرق عدة دقائق على الملف الكبير. يعيد خيار «تراجع عن آخر تنظيف تلقائي» في صفحة الملف الشخصي التغييرات.`],"Clean up the profile automatically":[`自动整理画像`,`تنظيف الملف الشخصي تلقائياً`],"Run every this many analysed prompts":[`每隔多少条已分析的提示运行一次`,`التشغيل كل عدد من المطالبات المحللة`],"Save interval":[`保存间隔`,`حفظ الفاصل`],"Enter a whole number from 50 to 100000.":[`请输入 50 到 100000 之间的整数。`,`أدخل عدداً صحيحاً من 50 إلى 100000.`],"Saved. Changes apply at the next learning pass.":[`已保存。更改将在下一次学习时生效。`,`تم الحفظ. تنطبق التغييرات في جولة التعلّم التالية.`],"Analyse waiting prompts":[`分析等待处理的提示`,`تحليل المطالبات المنتظرة`],"Re-analyse chat history":[`重新分析聊天记录`,`إعادة تحليل سجل المحادثات`],"Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.":[`分析等待处理的提示使用已保存的外部 API,读取 OMMS 内已有的提示,每次分析调用处理 50 条符合条件的提示。不会重新分析已完成的历史记录。输出包括偏好、模式和工作流程。`,`يقرأ تحليل المطالبات المنتظرة المطالبات الموجودة داخل OMMS عبر واجهة API الخارجية المحفوظة، بمعدل 50 مطالبة مؤهلة لكل اتصال تحليل. لا يُعاد تحليل السجل المكتمل. المخرجات هي التفضيلات والأنماط وسير العمل.`],"Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.":[`分析调用次数为估计值。匹配、去重、重试和新增的等待提示可能增加调用次数。`,`اتصالات التحليل تقديرية. قد تضيف المطابقة وإزالة التكرار وإعادة المحاولة والمطالبات المنتظرة الجديدة اتصالات أخرى.`],"Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.":[`重新分析聊天记录会打开强制仅导入画像的流程。现有画像和项目记忆将保留。必须先预览并确认。每条画像提示只能强制重新分析一次。`,`تفتح إعادة تحليل سجل المحادثات استيراداً قسرياً للملف الشخصي فقط. تُحفظ ذاكرة المشروع وملفك الشخصي. تلزم المعاينة والتأكيد. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة.`],"Automatic import reads older conversations when a host starts. It populates project memories and user profile input. The first backfill fixes a cutoff; later turns use live capture.":[`自动导入在宿主启动时读取较早的对话,填充项目记忆和用户画像输入。首次回填固定截止时间,之后的轮次使用实时捕获。`,`يقرأ الاستيراد التلقائي المحادثات الأقدم عند بدء المضيف. ويضيف ذاكرة المشروع ومدخلات الملف الشخصي. يثبت أول استيراد تاريخاً فاصلاً؛ وتستخدم الرسائل اللاحقة الالتقاط المباشر.`],"A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.":[`目录映射将记录的项目文件夹链接到当前文件夹。保存的映射在下次导入或回填时全局应用于所有宿主。保存前请检查更改。`,`تربط خريطة المجلدات مجلد المشروع المسجل بمجلده الحالي. تنطبق الخرائط المحفوظة على جميع المضيفين في الاستيراد التالي. راجع التغييرات قبل الحفظ.`],"Prompt date from must not be after Prompt date to.":[`提示开始日期不能晚于结束日期。`,`يجب ألا يأتي تاريخ بدء المطالبات بعد تاريخ انتهائها.`],"Profile batch size must be a positive integer.":[`画像批次大小必须为正整数。`,`يجب أن يكون حجم دفعة الملف الشخصي عدداً صحيحاً موجباً.`],Models:[`模型`,`النماذج`],"External API fallback":[`外部 API 备用模型`,`النموذج الاحتياطي عبر واجهة API الخارجية`],none:[`无`,`لا يوجد`],ready:[`就绪`,`جاهز`],"not ready":[`未就绪`,`غير جاهز`],"Credentials (values hidden)":[`凭据(不显示内容)`,`بيانات الاعتماد (القيم مخفية)`],set:[`已设置`,`مضبوط`],"not set":[`未设置`,`غير مضبوط`],"Effective model":[`当前使用模型`,`النموذج المستخدم`],session:[`会话`,`الجلسة`],"external API":[`外部 API`,`واجهة API الخارجية`],unavailable:[`不可用`,`غير متاح`],"Project override is active. Changes to the global file may not take effect here.":[`项目设置优先。全局文件的更改可能不会在此生效。`,`إعدادات المشروع لها الأولوية. قد لا تسري تغييرات الملف العام هنا.`],"Model choice":[`模型选择`,`اختيار النموذج`],"Session model":[`会话模型`,`نموذج الجلسة`],"Manual model":[`手动选择模型`,`اختيار النموذج يدوياً`],"Manual provider/model":[`手动输入提供商/模型`,`إدخال المزوّد/النموذج يدوياً`],"Model list unavailable. Enter provider/model manually.":[`模型列表不可用。请手动输入提供商/模型。`,`قائمة النماذج غير متاحة. أدخل المزوّد/النموذج يدوياً.`],"OpenCode model list unavailable":[`OpenCode 模型列表不可用`,`قائمة نماذج OpenCode غير متاحة`],"OMMS could not find OpenCode on this computer, so it cannot list OpenCode's models here. Type the model as provider/model, for example zai-coding-plan/glm-5.3. If OpenCode is installed, open an OpenCode session and reload this page.":[`OMMS 在这台电脑上找不到 OpenCode,因此无法在此列出 OpenCode 的模型。请按 提供商/模型 格式输入模型,例如 zai-coding-plan/glm-5.3。如果已安装 OpenCode,请打开一个 OpenCode 会话,然后重新加载此页面。`,`لم يعثر OMMS على OpenCode في هذا الحاسوب، لذا لا يمكنه عرض نماذج OpenCode هنا. أدخل النموذج بصيغة المزوّد/النموذج، مثل zai-coding-plan/glm-5.3. إذا كان OpenCode مثبتاً، فافتح جلسة OpenCode ثم أعد تحميل هذه الصفحة.`],"OpenCode took too long to send its model list. Reload this page to try again, or type the model as provider/model.":[`OpenCode 发送模型列表的时间过长。请重新加载此页面重试,或按 提供商/模型 格式输入模型。`,`استغرق OpenCode وقتاً طويلاً لإرسال قائمة نماذجه. أعد تحميل هذه الصفحة للمحاولة مرة أخرى، أو أدخل النموذج بصيغة المزوّد/النموذج.`],"OpenCode has no signed-in models. Run `opencode auth login`, then reload this page.":["OpenCode 没有已登录的模型。请运行 `opencode auth login`,然后重新加载此页面。","لا توجد في OpenCode نماذج مسجَّل الدخول إليها. شغّل `opencode auth login` ثم أعد تحميل هذه الصفحة."],"This OpenCode version sent a model list OMMS cannot read. Type the model as provider/model. Update OMMS if this continues.":[`此版本的 OpenCode 发送的模型列表 OMMS 无法读取。请按 提供商/模型 格式输入模型。如果问题持续,请更新 OMMS。`,`أرسل هذا الإصدار من OpenCode قائمة نماذج لا يستطيع OMMS قراءتها. أدخل النموذج بصيغة المزوّد/النموذج. حدّث OMMS إذا استمرت المشكلة.`],"OMMS could not read Pi's model list. Type the model as provider/model.":[`OMMS 无法读取 Pi 的模型列表。请按 提供商/模型 格式输入模型。`,`تعذّر على OMMS قراءة قائمة نماذج Pi. أدخل النموذج بصيغة المزوّد/النموذج.`],"Pi has no signed-in models. Sign in to a provider in Pi, then reload this page.":[`Pi 没有已登录的模型。请在 Pi 中登录一个提供商,然后重新加载此页面。`,`لا توجد في Pi نماذج مسجَّل الدخول إليها. سجّل الدخول إلى مزوّد في Pi ثم أعد تحميل هذه الصفحة.`],"Save model":[`保存模型`,`حفظ النموذج`],"Enter a model as provider/model.":[`按 提供商/模型 格式输入。`,`أدخل النموذج بصيغة المزوّد/النموذج.`],"Saved. New capture and profile work uses these settings.":[`已保存。下一次捕获和用户画像将使用这些设置。`,`تم الحفظ. ستستخدم عمليات الالتقاط والملف الشخصي الجديدة هذه الإعدادات.`],"Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.":[`已保存。OMMS 现在读取 ~/.config/omms/omms.jsonc,旧配置保留。`,`تم الحفظ. يقرأ OMMS الآن الملف ~/.config/omms/omms.jsonc مع الاحتفاظ بالإعدادات القديمة.`],"Current settings were reloaded; check the values and save again.":[`已重新加载当前设置;检查数值后再次保存。`,`أُعيد تحميل الإعدادات الحالية. راجع القيم ثم احفظ مجدداً.`],"Capture diagnostics":[`捕获诊断`,`تشخيص الالتقاط`],"Time range":[`时间范围`,`الفترة الزمنية`],"24 hours":[`24 小时`,`24 ساعة`],"7 days":[`7 天`,`7 أيام`],"30 days":[`30 天`,`30 يوماً`],"90 days":[`90 天`,`90 يوماً`],"Host / model":[`主机 / 模型`,`المضيف / النموذج`],Saved:[`已保存`,`محفوظ`],Skipped:[`已跳过`,`متجاوز`],Failed:[`失败`,`فشل`],Total:[`总数`,`المجموع`],"Failure reasons":[`失败原因`,`أسباب الفشل`],"Recent attempts":[`最近尝试`,`المحاولات الأخيرة`],Time:[`时间`,`الوقت`],Host:[`主机`,`المضيف`],Source:[`来源`,`المصدر`],Session:[`会话`,`الجلسة`],Path:[`路径`,`المسار`],Model:[`模型`,`النموذج`],Stop:[`结束原因`,`سبب التوقف`],Blocks:[`区块`,`الكتل`],Prompt:[`提示词长度`,`طول الطلب`],Reply:[`回复长度`,`طول الرد`],Duration:[`耗时`,`المدة`],Outcome:[`结果`,`النتيجة`],Reason:[`原因`,`السبب`],"Save capture traces":[`保存捕获追踪`,`حفظ تتبعات الالتقاط`],"Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.":[`追踪文件在脱敏后仍可能包含对话内容。仅在调试时开启。`,`قد تحتوي التتبعات على محتوى المحادثة بعد التنقيح. فعّلها عند التصحيح فقط.`],"This project turns tracing off. The global switch cannot turn it on here.":[`此项目已关闭追踪。全局开关无法在此开启。`,`أوقف هذا المشروع التتبع. لا يمكن للمفتاح العام تفعيله هنا.`],"Trace retention (days)":[`追踪保留天数`,`مدة حفظ التتبعات (بالأيام)`],"Attempt retention (days)":[`尝试记录保留天数`,`مدة حفظ المحاولات (بالأيام)`],"Retry retention (hours)":[`重试保留小时数`,`مدة حفظ إعادة المحاولة (بالساعات)`],"When the capture model cannot be reached, OMMS keeps the turn and tries again later. Queued turns can hold conversation content after redaction. 0 turns the queue off and deletes waiting turns.":[`捕获模型无法访问时,OMMS 会保留该轮对话并稍后重试。排队的对话在脱敏后仍可能包含对话内容。设为 0 会关闭队列并删除等待中的对话。`,`عندما يتعذر الوصول إلى نموذج الالتقاط، يحتفظ OMMS بالجولة ويعيد المحاولة لاحقاً. قد تحتوي الجولات المنتظرة على محتوى المحادثة بعد التنقيح. القيمة 0 توقف قائمة الانتظار وتحذف الجولات المنتظرة.`],"Turns waiting for retry":[`等待重试的对话`,`الجولات المنتظرة لإعادة المحاولة`],"Retry now":[`立即重试`,`أعد المحاولة الآن`],"Retrying now.":[`正在重试。`,`تجري إعادة المحاولة الآن.`],"A retry is already running.":[`重试已在运行。`,`إعادة المحاولة قيد التشغيل بالفعل.`],"These turns retry at the next Pi session start.":[`这些对话将在下次启动 Pi 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Pi التالية.`],"These turns retry at the next OpenCode session start.":[`这些对话将在下次启动 OpenCode 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة OpenCode التالية.`],"These turns retry at the next Claude Code session start.":[`这些对话将在下次启动 Claude Code 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Claude Code التالية.`],"Claude Code capture uses the external API.":[`Claude Code 捕获使用外部 API。`,`يستخدم التقاط Claude Code واجهة API الخارجية.`],"Claude Code capture is off. Complete the external API settings.":[`Claude Code 捕获已关闭。请完成外部 API 设置。`,`التقاط Claude Code متوقف. أكمل إعدادات واجهة API الخارجية.`],"Missing settings":[`缺少的设置`,`الإعدادات الناقصة`],"memoryModel is not configured":[`未配置 memoryModel`,`لم يُضبط memoryModel`],"memoryApiUrl is not configured":[`未配置 memoryApiUrl`,`لم يُضبط memoryApiUrl`],"memoryApiKey is not configured":[`未配置 memoryApiKey`,`لم يُضبط memoryApiKey`],"memoryApiKey contains a placeholder value":[`memoryApiKey 包含占位值`,`يحتوي memoryApiKey على قيمة نائبة`],"Claude Code backfill always uses the external API. It has no backfill model setting.":[`Claude Code 回填始终使用外部 API,没有回填模型设置。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية، ولا يوجد له إعداد لنموذج الاستيراد.`],"Claude Code transcripts folder":[`Claude Code 对话记录文件夹`,`مجلد سجلات محادثات Claude Code`],"Claude Code transcripts":[`Claude Code 对话记录`,`سجلات محادثات Claude Code`],found:[`已找到`,`موجود`],"not found":[`未找到`,`غير موجود`],"Claude Code imports always use the external API.":[`Claude Code 导入始终使用外部 API。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية.`],"Claude Code imports use the external API. Complete the external API settings.":[`Claude Code 导入使用外部 API。请完成外部 API 设置。`,`يستخدم استيراد Claude Code واجهة API الخارجية. أكمل إعدادات واجهة API الخارجية.`],"Trace files":[`追踪文件`,`ملفات التتبع`],View:[`查看`,`عرض`],Delete:[`删除`,`حذف`],Health:[`健康检查`,`فحص الحالة`],"Config files":[`配置文件`,`ملفات الإعدادات`],"Memory store":[`记忆存储`,`مخزن الذاكرة`],Embedding:[`嵌入模型`,`نموذج التضمين`],"Web binding":[`网页服务绑定`,`ربط خادم الويب`],"OpenCode model":[`OpenCode 模型`,`نموذج OpenCode`],"Pi model":[`Pi 模型`,`نموذج Pi`],"Capture failures (24 hours)":[`捕获失败(24 小时)`,`فشل الالتقاط (24 ساعة)`],"OpenCode model test":[`OpenCode 模型测试`,`اختبار نموذج OpenCode`],"Pi model test":[`Pi 模型测试`,`اختبار نموذج Pi`],"Run checks":[`运行检查`,`تشغيل الفحوصات`],"Run checks and test models":[`运行检查并测试模型`,`تشغيل الفحوصات واختبار النماذج`],"Checking…":[`正在检查…`,`جارٍ الفحص…`],pass:[`通过`,`نجاح`],warn:[`警告`,`تحذير`],fail:[`失败`,`فشل`],"Import and backfill":[`导入和回填`,`الاستيراد والاستكمال`],"Automatic import":[`自动导入`,`الاستيراد التلقائي`],"Automatic import makes model calls. Changes apply at the next host start. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。更改在下次启动主机时生效。关闭后,正在运行的导入将在当前轮次结束后停止。`,`يستدعي الاستيراد التلقائي النموذج. تسري التغييرات عند بدء المضيف التالي. يوقف التعطيل الاستيراد بعد التبادل الحالي.`],"Import past chats automatically":[`自动导入过去的对话`,`استيراد المحادثات السابقة تلقائياً`],"Backfill model":[`历史导入模型`,`نموذج استيراد السجل`],"Same as live capture":[`与实时捕获相同`,`مثل الالتقاط المباشر`],"Saved. Changes apply at the next host start.":[`已保存。更改在下次启动主机时生效。`,`تم الحفظ. تسري التغييرات عند بدء المضيف التالي.`],State:[`状态`,`الحالة`],"not started":[`尚未开始`,`لم يبدأ`],"not-started":[`尚未开始`,`لم يبدأ`],Imported:[`已导入`,`مستورَد`],Pending:[`待处理`,`معلّق`],"Unresolved sessions":[`目录未解析的会话`,`جلسات بمجلدات غير محددة`],Cutoff:[`截止时间`,`وقت القطع`],stopped:[`已停止`,`توقف`],"Web app":[`网页应用`,`تطبيق الويب`],"Start web app at login":[`登录时启动网页应用`,`بدء تطبيق الويب عند تسجيل الدخول`],"Login item":[`登录启动项`,`عنصر بدء تسجيل الدخول`],"not installed":[`未安装`,`غير مثبّت`],"not-installed":[`未安装`,`غير مثبّت`],installed:[`已安装`,`مثبّت`],unsupported:[`不受支持`,`غير مدعوم`],"no-runtime":[`缺少运行环境`,`بيئة التشغيل غير متاحة`],"no-package":[`缺少软件包`,`الحزمة غير متاحة`],"no-launcher":[`缺少启动器`,`المشغّل غير متاح`],"Login items are unsupported on this platform.":[`此平台不支持登录启动项。`,`عناصر بدء تسجيل الدخول غير مدعومة على هذا النظام.`],"Install Node or Bun to start the web app at login.":[`安装 Node 或 Bun 后,网页应用才能在登录时启动。`,`ثبّت Node أو Bun لبدء تطبيق الويب عند تسجيل الدخول.`],"Use these commands to apply the change now:":[`使用以下命令立即应用更改:`,`استخدم هذه الأوامر لتطبيق التغيير الآن:`],"Saved. The login item changes at the next Pi or OpenCode start.":[`已保存。登录启动项将在下次启动 Pi 或 OpenCode 时更新。`,`تم الحفظ. يتغير عنصر بدء التشغيل عند بدء Pi أو OpenCode التالي.`],"History host":[`历史记录主机`,`مضيف السجل`],Scope:[`范围`,`النطاق`],"Current project":[`当前项目`,`المشروع الحالي`],"All projects":[`所有项目`,`كل المشاريع`],"Project directory":[`项目目录`,`مجلد المشروع`],"Current directory":[`当前目录`,`المجلد الحالي`],"Profile batch size":[`用户画像批量大小`,`حجم دفعة الملف الشخصي`],"Directory maps (old=new, one per line)":[`目录映射(旧=新,每行一条)`,`تعيين المجلدات (قديم=جديد، واحد في كل سطر)`],"Force reimport":[`强制重新导入`,`فرض إعادة الاستيراد`],"Skip memories":[`跳过记忆`,`تجاوز الذكريات`],"Skip profile":[`跳过用户画像`,`تجاوز الملف الشخصي`],"Import model":[`导入模型`,`نموذج الاستيراد`],"Saved external API":[`已保存的外部 API`,`واجهة API الخارجية المحفوظة`],"Preview (dry run)":[`预览(不写入)`,`معاينة (تشغيل تجريبي)`],"Start import":[`开始导入`,`بدء الاستيراد`],"Cancel after current unit":[`完成当前单元后取消`,`الإلغاء بعد الوحدة الحالية`],"Directory maps must be old=new, one per line":[`目录映射须为 旧=新,每行一条`,`يجب أن يكون تعيين المجلدات بصيغة قديم=جديد، واحد في كل سطر`],running:[`运行中`,`جارٍ التشغيل`],cancelling:[`正在取消`,`جارٍ الإلغاء`],cancelled:[`已取消`,`أُلغي`],done:[`已完成`,`اكتمل`],failed:[`失败`,`فشل`],units:[`单元`,`وحدات`],"List sessions":[`列出会话`,`عرض الجلسات`],"Refresh list":[`刷新列表`,`تحديث القائمة`],"Advanced options":[`高级选项`,`خيارات متقدمة`],"Hide advanced options":[`隐藏高级选项`,`إخفاء الخيارات المتقدمة`],"default location":[`默认位置`,`الموقع الافتراضي`],"Prompt date from":[`提示日期起`,`تاريخ الطلب من`],"Prompt date to":[`提示日期止`,`تاريخ الطلب إلى`],"Prompt dates are inclusive, use your time zone, and filter the turns inside each session, not the list. Empty dates include every turn.":[`提示日期包含首尾两天,按你所在时区计算,只筛选每个会话中的对话轮次,不筛选列表。留空则包含所有轮次。`,`تواريخ الطلب شاملة لليومين، وتُحسب بمنطقتك الزمنية، وتُصفّي الأدوار داخل كل جلسة لا القائمة. تركها فارغة يشمل كل الأدوار.`],"Sessions with directories that no longer exist":[`目录已不存在的会话`,`جلسات لم تعد مجلداتها موجودة`],"Show them and add a directory map":[`显示它们并添加目录映射`,`اعرضها وأضف تعيين مجلد`],Selected:[`已选择`,`المحدد`],"Select all matching":[`选择所有匹配项`,`تحديد كل المطابق`],"Clear selection":[`清除选择`,`مسح التحديد`],Select:[`选择`,`تحديد`],Created:[`创建时间`,`تاريخ الإنشاء`],"Resolved by":[`解析方式`,`طريقة التحديد`],recorded:[`记录的目录`,`المجلد المسجّل`],mapped:[`目录映射`,`تعيين مجلد`],"project root":[`项目根目录`,`جذر المشروع`],missing:[`缺失`,`مفقود`],"No sessions match.":[`没有匹配的会话。`,`لا توجد جلسات مطابقة.`],Previous:[`上一页`,`السابق`],Next:[`下一页`,`التالي`],None:[`无`,`لا شيء`],"Configured, not tested.":[`已配置,未测试。`,`مُعدّ، لم يُختبر.`],"An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode.":[`使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。`,`يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode.`],"The chosen OpenCode model is not connected here. An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode. Choose the external API for a web import.":[`所选 OpenCode 模型在此处未连接。使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。网页导入请选择外部 API。`,`نموذج OpenCode المختار غير متصل هنا. يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode. اختر واجهة API الخارجية للاستيراد من الصفحة.`],"Test models in Health":[`在健康检查中测试模型`,`اختبر النماذج في قسم السلامة`],Import:[`导入`,`استيراد`],sessions:[`个会话`,`جلسات`],"1 session":[`1 个会话`,`جلسة واحدة`],"List sessions first.":[`请先列出会话。`,`اعرض الجلسات أولاً.`],"Options changed. Refresh the session list first.":[`选项已更改。请先刷新会话列表。`,`تغيّرت الخيارات. حدّث قائمة الجلسات أولاً.`],"Select at least one session.":[`请至少选择一个会话。`,`حدّد جلسة واحدة على الأقل.`],"Select at most 1000 sessions one by one, or use Select all matching.":[`逐个选择最多 1000 个会话,或使用“选择所有匹配项”。`,`حدّد 1000 جلسة كحد أقصى واحدة تلو الأخرى، أو استخدم «تحديد كل المطابق».`],"Model readiness is unknown. Reload the page.":[`无法确定模型是否就绪。请重新加载页面。`,`حالة جاهزية النموذج غير معروفة. أعد تحميل الصفحة.`],"No import model is ready. Connect a model in OpenCode or complete the external API settings.":[`没有可用的导入模型。请在 OpenCode 中连接模型,或补全外部 API 设置。`,`لا يوجد نموذج استيراد جاهز. اربط نموذجاً في OpenCode أو أكمل إعدادات واجهة API الخارجية.`],"The external API is not ready":[`外部 API 未就绪`,`واجهة API الخارجية غير جاهزة`],"The external API has no memoryModel in the global config":[`全局配置中缺少外部 API 的 memoryModel`,`لا يحتوي الإعداد العام على memoryModel لواجهة API الخارجية`],"The external API has no memoryApiUrl in the global config":[`全局配置中缺少外部 API 的 memoryApiUrl`,`لا يحتوي الإعداد العام على memoryApiUrl لواجهة API الخارجية`],"The external API key is missing in the OpenCode process; check memoryApiKey and its env:// or file:// source":[`OpenCode 进程中缺少外部 API 密钥;请检查 memoryApiKey 及其 env:// 或 file:// 来源`,`مفتاح واجهة API الخارجية غير موجود في عملية OpenCode؛ تحقّق من memoryApiKey ومصدره env:// أو file://`],"The memoryProvider in the global config is not supported for imports":[`全局配置中的 memoryProvider 不支持导入`,`مزوّد memoryProvider في الإعداد العام غير مدعوم للاستيراد`],"Pi sessions folder or one .jsonl session file":[`Pi 会话文件夹或单个 .jsonl 会话文件`,`مجلد جلسات Pi أو ملف جلسة .jsonl واحد`],"OpenCode database file":[`OpenCode 数据库文件`,`ملف قاعدة بيانات OpenCode`],"Absolute path, for example on a mounted volume":[`绝对路径,例如已挂载卷上的路径`,`مسار مطلق، مثلاً على وحدة تخزين مركّبة`],"Use this source":[`使用此来源`,`استخدم هذا المصدر`],Browse:[`浏览`,`استعراض`],"Use the default location":[`使用默认位置`,`استخدم الموقع الافتراضي`],"Chosen source":[`已选来源`,`المصدر المختار`],Choose:[`选择`,`اختيار`],"Only the first 500 entries are shown.":[`仅显示前 500 项。`,`تُعرض أول 500 عنصر فقط.`],"Reload the page before saving again.":[`再次保存前请重新加载页面。`,`أعد تحميل الصفحة قبل الحفظ مرة أخرى.`],"The current settings could not be reloaded. Reload the page.":[`无法重新加载当前设置。请重新加载页面。`,`تعذّر إعادة تحميل الإعدادات الحالية. أعد تحميل الصفحة.`],Log:[`日志`,`السجل`],"Capture attempts only":[`仅显示捕获尝试`,`محاولات الالتقاط فقط`],Refresh:[`刷新`,`تحديث`],"Copy log path":[`复制日志路径`,`نسخ مسار السجل`],"Log lines":[`日志行`,`أسطر السجل`],"No log has been written yet.":[`尚未写入日志。`,`لم يُكتب سجل بعد.`],"Loading log…":[`正在加载日志…`,`جارٍ تحميل السجل…`],Level:[`级别`,`المستوى`],Warning:[`警告`,`تحذير`],Error:[`错误`,`خطأ`],info:[`信息`,`معلومات`],error:[`错误`,`خطأ`],"Level guessed from the message":[`级别由消息内容推测`,`المستوى مُخمَّن من نص الرسالة`],"Copy visible records":[`复制可见记录`,`نسخ السجلات المعروضة`],Copied:[`已复制`,`تم النسخ`],"No matching log records.":[`没有匹配的日志记录。`,`لا توجد سجلات مطابقة.`],"External API":[`外部 API`,`واجهة API الخارجية`],"An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.":[`兼容 OpenAI 或 Anthropic 的端点,两个宿主都可用于捕获和回填。`,`نقطة نهاية متوافقة مع OpenAI أو Anthropic يمكن لأي مضيف استخدامها للالتقاط والاستيراد.`],Provider:[`提供商`,`المزوّد`],"API URL":[`API 地址`,`عنوان API`],"API key":[`API 密钥`,`مفتاح API`],"Save endpoint":[`保存端点`,`حفظ نقطة النهاية`],"Nothing to save.":[`没有需要保存的内容。`,`لا يوجد ما يُحفظ.`],"Key source":[`密钥来源`,`مصدر المفتاح`],"environment variable":[`环境变量`,`متغير البيئة`],"key file":[`密钥文件`,`ملف المفتاح`],"set in the config file":[`在配置文件中设置`,`مضبوط في ملف الإعدادات`],"resolves in the web app":[`可在网页应用中解析`,`يُقرأ في تطبيق الويب`],"does not resolve in the web app":[`无法在网页应用中解析`,`لا يُقرأ في تطبيق الويب`],"A login web app does not see variables set only in a shell profile; a key file works everywhere.":[`登录时启动的网页应用看不到仅在 shell 配置文件中设置的变量;密钥文件在任何地方都可用。`,`تطبيق الويب الذي يبدأ عند تسجيل الدخول لا يرى المتغيرات المضبوطة في ملف الصدفة فقط؛ ملف المفتاح يعمل في كل مكان.`],"The key does not resolve in this web app. Save it to a key file instead.":[`此网页应用无法解析该密钥。请改为保存到密钥文件。`,`لا يُقرأ المفتاح في تطبيق الويب هذا. احفظه في ملف مفتاح بدلاً من ذلك.`],"Environment variable":[`环境变量`,`متغير البيئة`],"Key file":[`密钥文件`,`ملف المفتاح`],"Save key to a private file":[`将密钥保存到私有文件`,`حفظ المفتاح في ملف خاص`],"Variable name":[`变量名`,`اسم المتغير`],"Key file path":[`密钥文件路径`,`مسار ملف المفتاح`],"Key file name":[`密钥文件名`,`اسم ملف المفتاح`],"The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.":[`密钥写入 ~/.config/omms/secrets/,仅你可读,之后不再显示。`,`يُكتب المفتاح في ~/.config/omms/secrets/ ولا يقرؤه غيرك، ولن يُعرض مرة أخرى.`],"Save key source":[`保存密钥来源`,`حفظ مصدر المفتاح`],"Key source saved.":[`密钥来源已保存。`,`تم حفظ مصدر المفتاح.`],"A key file with this name exists. Replace it?":[`已存在同名密钥文件。要替换吗?`,`يوجد ملف مفتاح بهذا الاسم. هل تريد استبداله؟`],"Enter a variable name such as ZAI_API_KEY":[`请输入变量名,例如 ZAI_API_KEY`,`أدخل اسم متغير مثل ZAI_API_KEY`],"Enter the path of a key file":[`请输入密钥文件路径`,`أدخل مسار ملف المفتاح`],"Name the key file with letters, digits, dashes, or underscores":[`密钥文件名只能包含字母、数字、短横线或下划线`,`سمِّ ملف المفتاح بحروف أو أرقام أو شرطات أو شرطات سفلية`],"Paste the key":[`请粘贴密钥`,`الصق المفتاح`],Test:[`测试`,`اختبار`],"Test call succeeded":[`测试调用成功`,`نجح استدعاء الاختبار`],"Test call failed":[`测试调用失败`,`فشل استدعاء الاختبار`],"External API needs":[`外部 API 缺少`,`تحتاج واجهة API الخارجية إلى`],"Automatic import makes model calls. A model change applies at the next run. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。模型更改在下次运行时生效。关闭后,正在进行的导入会在当前对话完成后停止。`,`يستدعي الاستيراد التلقائي النماذج. يسري تغيير النموذج في التشغيل التالي. إيقافه يوقف الاستيراد الجاري بعد المحادثة الحالية.`],"Saved. Changes apply at the next run.":[`已保存。更改在下次运行时生效。`,`تم الحفظ. تسري التغييرات في التشغيل التالي.`],paused:[`已暂停`,`متوقف مؤقتاً`],"started from auto":[`自动启动`,`بدأ تلقائياً`],"started from web":[`从网页启动`,`بدأ من الويب`],"started from cli":[`从终端启动`,`بدأ من الطرفية`],"started from slash":[`从斜杠命令启动`,`بدأ من أمر الشرطة المائلة`],"Minutes left":[`剩余分钟`,`الدقائق المتبقية`],unknown:[`未知`,`غير معروف`],about:[`约`,`حوالي`],Pause:[`暂停`,`إيقاف مؤقت`],Resume:[`继续`,`استئناف`],"Pausing after the current exchange.":[`将在当前对话完成后暂停。`,`سيتوقف مؤقتاً بعد المحادثة الحالية.`],"Backfill started.":[`回填已开始。`,`بدأ الاستيراد.`],"The list is still loading. Try again in a moment.":[`列表仍在加载。请稍后再试。`,`لا تزال القائمة قيد التحميل. حاول مرة أخرى بعد لحظة.`],"Paused. No import starts until you resume.":[`已暂停。恢复前不会开始导入。`,`تم الإيقاف مؤقتاً. لن يبدأ أي استيراد حتى تستأنفه.`],"Directory maps":[`目录映射`,`خرائط المجلدات`],"Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.":[`将已移动或删除的目录映射到其所属项目。更改在下次导入或回填时生效。`,`اربط مجلداً نُقل أو حُذف بالمشروع الذي ينتمي إليه. يسري التغيير في الاستيراد التالي.`],"Saved maps":[`已保存的映射`,`الخرائط المحفوظة`],Keep:[`保留`,`إبقاء`],Remove:[`移除`,`إزالة`],"Unresolved directories":[`无法解析的目录`,`مجلدات غير محلولة`],"No unresolved directories in the latest run.":[`最近一次运行没有无法解析的目录。`,`لا توجد مجلدات غير محلولة في آخر تشغيل.`],"No suggestion found.":[`未找到建议。`,`لم يُعثر على اقتراح.`],"Target directory":[`目标目录`,`المجلد الهدف`],"Saved. Maps apply to the next import or backfill run.":[`已保存。映射在下次导入或回填时生效。`,`تم الحفظ. تسري الخرائط في الاستيراد التالي.`],"Memory language":[`记忆语言`,`لغة الذاكرة`],"The language that new memory summaries are written in. Automatic detects it from your prompt, but a Latin-script prompt under 100 characters counts as English.":[`新记忆摘要使用的语言。“自动”会根据你的提示检测语言,但少于 100 个字符的拉丁字母提示按英语处理。`,`اللغة التي تُكتب بها ملخصات الذاكرة الجديدة. يكتشفها الوضع التلقائي من موجّهك، لكن الموجّه بالأحرف اللاتينية الأقصر من 100 حرف يُعدّ إنجليزياً.`],"Summary language":[`摘要语言`,`لغة الملخص`],Appearance:[`外观`,`المظهر`],Theme:[`主题`,`السمة`],"Theme mode":[`主题模式`,`وضع السمة`],System:[`系统`,`النظام`],Light:[`浅色`,`فاتح`],Dark:[`深色`,`داكن`],"Light theme":[`浅色主题`,`السمة الفاتحة`],"Dark theme":[`深色主题`,`السمة الداكنة`],"On screen now":[`当前显示`,`معروضة الآن`],"No theme matches.":[`没有匹配的主题。`,`لا توجد سمة مطابقة.`],"Filter themes":[`筛选主题`,`تصفية السمات`],"System follows your operating system and switches between the light and the dark theme. The choice stays in this browser.":[`“系统”跟随操作系统,在浅色和深色主题之间切换。此选择只保存在此浏览器中。`,`يتبع «النظام» نظام التشغيل ويبدّل بين السمة الفاتحة والداكنة. يبقى الاختيار في هذا المتصفح.`],"Date and time":[`日期和时间`,`التاريخ والوقت`],"How dates and times show in this web app. The choice stays in this browser.":[`此网页应用中日期和时间的显示方式。此选择只保存在此浏览器中。`,`طريقة عرض التواريخ والأوقات في تطبيق الويب هذا. يبقى الاختيار في هذا المتصفح.`],"Date format":[`日期格式`,`تنسيق التاريخ`],"Time format":[`时间格式`,`تنسيق الوقت`],"Day month year":[`日 月 年`,`يوم شهر سنة`],"Month day year":[`月 日 年`,`شهر يوم سنة`],"Year-month-day":[`年-月-日`,`سنة-شهر-يوم`],"24-hour":[`24 小时制`,`24 ساعة`],"12-hour":[`12 小时制`,`12 ساعة`],Automatic:[`自动`,`تلقائي`],"Saved. New memories use this language.":[`已保存。新记忆将使用此语言。`,`تم الحفظ. ستستخدم الذكريات الجديدة هذه اللغة.`],"Claude Code folder":[`Claude Code 文件夹`,`مجلد Claude Code`],"Set this when Claude Code does not use ~/.claude, for example when you start it with CLAUDE_CONFIG_DIR. Leave it empty to use the default.":[`当 Claude Code 不使用 ~/.claude 时(例如用 CLAUDE_CONFIG_DIR 启动它),请设置此项。留空则使用默认文件夹。`,`اضبط هذا عندما لا يستخدم Claude Code المجلد ~/.claude، مثلاً عند تشغيله مع CLAUDE_CONFIG_DIR. اتركه فارغاً لاستخدام المجلد الافتراضي.`],"Save folder":[`保存文件夹`,`حفظ المجلد`],"Transcripts folder in use":[`正在使用的会话记录文件夹`,`مجلد سجلات الجلسات المستخدم`],From:[`来源`,`المصدر`],"this setting":[`此设置`,`هذا الإعداد`],"the CLAUDE_CONFIG_DIR variable of the web app":[`网页应用的 CLAUDE_CONFIG_DIR 变量`,`متغير CLAUDE_CONFIG_DIR لتطبيق الويب`],"the default folder":[`默认文件夹`,`المجلد الافتراضي`],"This folder does not exist. Claude Code capture and import will not work:":[`此文件夹不存在。Claude Code 的捕获和导入将无法工作:`,`هذا المجلد غير موجود. لن يعمل الالتقاط والاستيراد في Claude Code:`],"Enter a full path, or a path that starts with ~/.":[`请输入完整路径,或以 ~/ 开头的路径。`,`أدخل مساراً كاملاً، أو مساراً يبدأ بـ ~/.`],"Saved. Capture and import use this folder now.":[`已保存。捕获和导入现在使用此文件夹。`,`تم الحفظ. يستخدم الالتقاط والاستيراد هذا المجلد الآن.`],"Running version":[`运行版本`,`الإصدار الجاري`],"Global command":[`全局命令`,`الأمر العام`],"not installed globally":[`未全局安装`,`غير مثبت عمومياً`],"A newer OMMS copy runs in place of the global install. The global install is optional. To update it:":[`正在运行的是更新的 OMMS 副本,而不是全局安装。全局安装是可选的。更新方法:`,`تعمل نسخة OMMS أحدث بدلاً من التثبيت العام. التثبيت العام اختياري. لتحديثه:`],"The global install is newer than the running OMMS. The next Pi or OpenCode start replaces the web app.":[`全局安装比正在运行的 OMMS 更新。下次启动 Pi 或 OpenCode 时将替换网页应用。`,`التثبيت العام أحدث من OMMS الجاري. سيستبدل التشغيل التالي لـ Pi أو OpenCode تطبيق الويب.`],"OMMS is not installed globally. A global install is optional.":[`OMMS 未全局安装。全局安装是可选的。`,`OMMS غير مثبت عمومياً. التثبيت العام اختياري.`],"Keys and access":[`密钥与访问`,`المفاتيح والوصول`],"not needed":[`不需要`,`غير مطلوب`],"External API key":[`外部 API 密钥`,`مفتاح واجهة API الخارجية`],"Embedding server key":[`嵌入服务器密钥`,`مفتاح خادم التضمين`],"Capture and profile learning through the external API. Claude Code always uses it.":[`通过外部 API 进行捕获和用户画像学习。Claude Code 始终使用它。`,`الالتقاط وتعلّم الملف الشخصي عبر واجهة API الخارجية. يستخدمه Claude Code دائماً.`],"Sent to an embedding server on another machine.":[`发送给另一台机器上的嵌入服务器。`,`يُرسَل إلى خادم تضمين على جهاز آخر.`],"Let scripts and other computers call the web app's API.":[`允许脚本和其他电脑调用网页应用的 API。`,`تتيح للبرامج النصية والحواسيب الأخرى استدعاء واجهة API لتطبيق الويب.`],"Asks for a user name and password before the page opens.":[`打开页面前要求输入用户名和密码。`,`يطلب اسم مستخدم وكلمة مرور قبل فتح الصفحة.`],"External API card":[`外部 API 卡片`,`بطاقة واجهة API الخارجية`],"Embedding card":[`嵌入卡片`,`بطاقة التضمين`],"Table below":[`下方表格`,`الجدول أدناه`],"Form below":[`下方表单`,`النموذج أدناه`],"API tokens":[`API 令牌`,`رموز API`],"Browser password":[`浏览器密码`,`كلمة مرور المتصفح`],"The config file still sets webServerApiToken. OMMS imported it once as the token “from config file” and no longer reads the key. Use the token table instead.":[`配置文件仍设置了 webServerApiToken。OMMS 已将其导入一次,作为令牌“from config file”,之后不再读取该键。请改用令牌表。`,`لا يزال ملف الإعدادات يضبط webServerApiToken. استورده OMMS مرة واحدة كرمز باسم “from config file” ولم يعد يقرأ هذا المفتاح. استخدم جدول الرموز بدلاً منه.`],"Open this page on the computer that runs OMMS to manage tokens and the password.":[`请在运行 OMMS 的电脑上打开此页面,以管理令牌和密码。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لإدارة الرموز وكلمة المرور.`],"Revoke this token? Scripts that use it stop working.":[`撤销此令牌?使用它的脚本将停止工作。`,`إلغاء هذا الرمز؟ ستتوقف البرامج النصية التي تستخدمه عن العمل.`],"No browser password is set.":[`未设置浏览器密码。`,`لم تُضبط كلمة مرور للمتصفح.`],"A browser password is set for user":[`已为以下用户设置浏览器密码:`,`ضُبطت كلمة مرور المتصفح للمستخدم`],"A browser password is set for your computer user name.":[`已为你的电脑用户名设置浏览器密码。`,`ضُبطت كلمة مرور المتصفح لاسم مستخدم حاسوبك.`],"User name":[`用户名`,`اسم المستخدم`],Password:[`密码`,`كلمة المرور`],"Save password":[`保存密码`,`حفظ كلمة المرور`],"Clear password":[`清除密码`,`مسح كلمة المرور`],"Saved. Restart the web app to use the new browser password.":[`已保存。重启网页应用以使用新的浏览器密码。`,`تم الحفظ. أعد تشغيل تطبيق الويب لاستخدام كلمة مرور المتصفح الجديدة.`],Name:[`名称`,`الاسم`],Expires:[`过期时间`,`تاريخ الانتهاء`],"Last used":[`上次使用`,`آخر استخدام`],Never:[`永不`,`أبداً`],Revoke:[`撤销`,`إلغاء`],Copy:[`复制`,`نسخ`],"Copy this token now. It will not be shown again.":[`请立即复制此令牌。它不会再次显示。`,`انسخ هذا الرمز الآن. لن يُعرض مرة أخرى.`],"Token name":[`令牌名称`,`اسم الرمز`],"Expires after":[`有效期`,`ينتهي بعد`],"Generate token":[`生成令牌`,`إنشاء رمز`],All:[`全部`,`الكل`],Kind:[`类型`,`النوع`],"Built-in model":[`内置模型`,`النموذج المدمج`],"OpenAI-compatible server":[`OpenAI 兼容服务器`,`خادم متوافق مع OpenAI`],"Server URL":[`服务器 URL`,`عنوان URL للخادم`],"Vector size":[`向量维度`,`حجم المتجه`],"Stored memories":[`已存储的记忆`,`الذكريات المخزنة`],"Re-embedding":[`正在重新嵌入`,`جارٍ إعادة التضمين`],"Re-embed finished.":[`重新嵌入已完成。`,`اكتملت إعادة التضمين.`],"Re-embed failed":[`重新嵌入失败`,`فشلت إعادة التضمين`],Retry:[`重试`,`إعادة المحاولة`],Lock:[`锁定`,`قفل`],"Unlock to change":[`解锁以更改`,`افتح القفل للتغيير`],"The model that turns memory text into search vectors. A change re-embeds every memory.":[`将记忆文本转换为搜索向量的模型。更改后会重新嵌入所有记忆。`,`النموذج الذي يحوّل نص الذكريات إلى متجهات بحث. يؤدي تغييره إلى إعادة تضمين كل الذكريات.`],Preset:[`预设`,`إعداد مسبق`],Custom:[`自定义`,`مخصص`],"No key":[`无密钥`,`بلا مفتاح`],"Keep the saved key":[`保留已保存的密钥`,`الاحتفاظ بالمفتاح المحفوظ`],Apply:[`应用`,`تطبيق`],Cancel:[`取消`,`إلغاء الأمر`],"Test passed. Vector size":[`测试通过。向量维度`,`نجح الاختبار. حجم المتجه`],"Test failed":[`测试失败`,`فشل الاختبار`],"Every stored memory will be re-embedded":[`所有已存储的记忆都将重新嵌入`,`ستُعاد عملية تضمين كل الذكريات المخزنة`],"The hosted server is called once for each memory, which may cost money.":[`托管服务器会为每条记忆调用一次,可能产生费用。`,`يُستدعى الخادم المستضاف مرة لكل ذكرى، وقد يكلّف ذلك مالاً.`],"Search results are poor until the re-embed ends.":[`在重新嵌入结束前,搜索结果质量较差。`,`تكون نتائج البحث ضعيفة حتى تنتهي إعادة التضمين.`],"Restart open OpenCode and Pi sessions after the change.":[`更改后请重启已打开的 OpenCode 和 Pi 会话。`,`أعد تشغيل جلسات OpenCode وPi المفتوحة بعد التغيير.`],"Profile learning":[`用户画像学习`,`تعلّم الملف الشخصي`],"Catch up analyses every waiting prompt with the saved external API, 50 prompts for each model call.":[`补齐会使用已保存的外部 API 分析所有等待中的提示词,每次模型调用处理 50 条。`,`يحلّل اللحاق كل الطلبات المنتظرة عبر واجهة API الخارجية المحفوظة، 50 طلباً لكل استدعاء للنموذج.`],"Open this page on the computer that runs OMMS to start a catch-up run.":[`请在运行 OMMS 的电脑上打开此页面以开始补齐。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لبدء اللحاق.`],"Prompts waiting for profile learning":[`等待用户画像学习的提示词`,`الطلبات المنتظرة لتعلّم الملف الشخصي`],"Model calls":[`模型调用次数`,`استدعاءات النموذج`],"Batches done":[`已完成批次`,`الدفعات المكتملة`],"Prompts waiting":[`等待中的提示词`,`الطلبات المنتظرة`],Paused:[`已暂停`,`متوقف مؤقتاً`],Finished:[`已完成`,`اكتمل`],Stopped:[`已停止`,`توقّف`],"Catch up profile":[`补齐用户画像`,`اللحاق بالملف الشخصي`],"Start profile learning for the waiting prompts? Model calls":[`为等待中的提示词开始用户画像学习?模型调用次数`,`بدء تعلّم الملف الشخصي للطلبات المنتظرة؟ عدد استدعاءات النموذج`],"never used before":[`从未使用`,`لم يُستخدم من قبل`],"A newer catch-up run took over.":[`较新的补齐任务已接管。`,`تولّت عملية لحاق أحدث المهمة.`],"Browser password cleared. Restart the web app to turn it off.":[`浏览器密码已清除。重启网页应用以关闭它。`,`تم مسح كلمة مرور المتصفح. أعد تشغيل تطبيق الويب لإيقافها.`],Actions:[`操作`,`الإجراءات`],"All exchanges are done. Learning the profile from the imported prompts":[`所有对话已完成。正在从导入的提示中学习画像`,`اكتملت كل المحادثات. يجري تعلّم الملف الشخصي من المطالبات المستوردة`],batches:[`批`,`دفعات`],"Change it in":[`修改位置`,`مكان التغيير`],"Check them, then press Save maps.":[`请检查后点击保存映射。`,`راجعها ثم اضغط حفظ الخرائط.`],Credential:[`凭据`,`بيانات الاعتماد`],Email:[`邮箱`,`البريد الإلكتروني`],Filled:[`已填写`,`تم الملء`],"Finds the project each missing directory belongs to, mostly the main repository of a deleted worktree, and fills it in for you to check. Nothing is saved until you press Save maps.":[`为每个缺失的目录找到所属项目(多为已删除工作树的主仓库),并填入供你检查。点击保存映射之前不会保存任何内容。`,`يعثر على المشروع الذي ينتمي إليه كل مجلد مفقود، وغالباً المستودع الرئيسي لشجرة عمل محذوفة، ويملؤه لتراجعه. لا يُحفظ شيء حتى تضغط حفظ الخرائط.`],Hosts:[`主机`,`المضيفات`],"Import status":[`导入状态`,`حالة الاستيراد`],"in use":[`使用中`,`قيد الاستخدام`],"Last run":[`上次运行`,`آخر تشغيل`],"Last update":[`最后更新`,`آخر تحديث`],"Learning profile":[`正在学习画像`,`يجري تعلّم الملف الشخصي`],"Merge into":[`合并到`,`دمج في`],"Merge this profile into the other one? The source profile is turned off, not deleted.":[`将此画像合并到另一个画像?源画像会被停用,不会被删除。`,`دمج هذا الملف الشخصي في الآخر؟ يُوقَف الملف المصدر ولا يُحذف.`],"Merged.":[`已合并。`,`تم الدمج.`],"model not recorded":[`未记录模型`,`لم يُسجَّل نموذج`],model:[`个模型`,`نموذج`],models:[`个模型`,`نماذج`],"No directory recorded":[`未记录目录`,`لم يُسجَّل مجلد`],"No suggestion":[`无建议`,`لا اقتراح`],"Not started":[`未开始`,`لم يبدأ`],"OMMS keeps one profile for each git email. A folder whose repository has its own email starts a second profile. Choose the profile that is yours, or merge the extra one into it.":[`OMMS 为每个 git 邮箱保留一个画像。若某文件夹的仓库设置了自己的邮箱,就会产生第二个画像。请选择属于你的画像,或把多余的画像合并进去。`,`يحتفظ OMMS بملف شخصي لكل بريد git. المجلد الذي يملك مستودعه بريداً خاصاً يبدأ ملفاً شخصياً ثانياً. اختر ملفك الشخصي، أو ادمج الملف الزائد فيه.`],"Outcomes by host":[`各主机结果`,`النتائج حسب المضيف`],"Partly imported":[`部分已导入`,`مستورد جزئياً`],Patterns:[`模式`,`الأنماط`],pending:[`待处理`,`معلّق`],Preferences:[`偏好`,`التفضيلات`],Profiles:[`画像`,`الملفات الشخصية`],"Prompts analysed":[`已分析提示`,`المطالبات المحلَّلة`],Running:[`运行中`,`قيد التشغيل`],"Saved maps apply to every host.":[`已保存的映射适用于所有主机。`,`تنطبق الخرائط المحفوظة على كل المضيفات.`],"Saved: a memory was stored. Skipped: the model or a rule found nothing worth keeping, or the turn was private or trivial. Failed: the attempt hit an error. Total: the three added up. Each percentage is a share of its row's total.":[`已保存:存储了一条记忆。已跳过:模型或规则认为没有值得保留的内容,或该轮为私密或琐碎内容。失败:尝试出错。总计:三者之和。每个百分比是该行总计中的占比。`,`محفوظ: خُزّنت ذاكرة. متجاوز: لم يجد النموذج أو قاعدة ما يستحق الحفظ، أو كانت الجولة خاصة أو تافهة. فشل: واجهت المحاولة خطأ. الإجمالي: مجموع الثلاثة. كل نسبة هي حصة من إجمالي صفها.`],"Saved. OMMS now uses this profile in every folder.":[`已保存。OMMS 现在在所有文件夹中使用此画像。`,`تم الحفظ. يستخدم OMMS هذا الملف الشخصي الآن في كل المجلدات.`],Directories:[`目录数`,`عدد المجلدات`],"No target chosen":[`尚未选择目标`,`لم يُختر مجلد مستهدف`],"Smart resolve directories":[`智能解析目录`,`حلّ المجلدات تلقائياً`],Exact:[`精确`,`مطابقة تامة`],"Name match":[`名称匹配`,`مطابقة بالاسم`],Guess:[`猜测`,`تخمين`],Confidence:[`可信度`,`درجة الثقة`],"Temporary folder":[`临时文件夹`,`مجلد مؤقت`],"node_modules folder":[`node_modules 文件夹`,`مجلد node_modules`],"App data folder":[`应用数据文件夹`,`مجلد بيانات التطبيقات`],"Skills folder":[`技能文件夹`,`مجلد المهارات`],"Rows with a target":[`已有目标的行数`,`عدد الصفوف ذات المجلد المستهدف`],"Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.":[`智能解析会在对话框中列出每个建议的映射和忽略项。勾选要保留的项,然后点击确认。在此之前不会保存任何内容。`,`يعرض الحلّ التلقائي كل خريطة مقترحة وكل تجاهل مقترح في مربع حوار. حدّد ما تريد الاحتفاظ به، ثم اضغط تأكيد. لا يُحفظ شيء قبل ذلك.`],"Suggested to ignore":[`建议忽略`,`مقترح للتجاهل`],Ignore:[`忽略`,`تجاهل`],Restore:[`恢复`,`استعادة`],"No target":[`无目标`,`بلا مجلد مستهدف`],"Save this map":[`保存此映射`,`حفظ هذه الخريطة`],"Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.":[`勾选要保留的映射和忽略项,然后点击确认保存。保存的映射将在所有主机的下一次导入或回填时生效。`,`حدّد الخرائط وعناصر التجاهل التي تريد الاحتفاظ بها، ثم اضغط تأكيد لحفظها. تسري الخرائط المحفوظة على كل المضيفات في عملية الاستيراد أو الاستكمال التالية.`],"Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.":[`没有可保存的内容。请在行中输入目标,或对不是项目的文件夹点击忽略。`,`لا يوجد ما يُحفظ. اكتب مجلداً مستهدفاً في صف، أو اضغط تجاهل للمجلدات التي ليست مشاريع.`],"Ignored directories":[`已忽略的目录`,`المجلدات المتجاهَلة`],"Ignored directories stay unimported and leave the unresolved counts.":[`已忽略的目录保持未导入,并且不计入未解析数量。`,`تبقى المجلدات المتجاهَلة دون استيراد، ولا تُحسب ضمن الأعداد غير المحلولة.`],"They apply to the next import or backfill run. No sessions were imported.":[`它们将在下一次导入或回填时生效。未导入任何会话。`,`تسري في عملية الاستيراد أو الاستكمال التالية. لم تُستورد أي جلسات.`],"Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.":[`会话导入后请保留映射。每次导入在跳过会话之前都会先检查映射,因此删除映射会使其会话在下次运行时重新变为未解析。`,`احتفظ بالخريطة بعد استيراد جلساتها. يفحص كل استيراد الخريطة قبل أن يتجاوز جلسة، لذا فإن حذف الخريطة يجعل جلساتها غير محلولة مجدداً في التشغيل التالي.`],"Save removals":[`保存删除`,`حفظ عمليات الحذف`],"Settings changed elsewhere. Check the list and try again.":[`设置已在其他位置更改。请检查列表后再试。`,`تغيّرت الإعدادات في مكان آخر. راجع القائمة، ثم حاول مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再试。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة، ثم حاول مجدداً.`],"Saved. Removed maps stop applying at the next import or backfill run.":[`已保存。删除的映射将从下一次导入或回填起不再生效。`,`تم الحفظ. تتوقف الخرائط المحذوفة عن السريان في عملية الاستيراد أو الاستكمال التالية.`],"Removals could not be saved. Try again.":[`无法保存删除。请重试。`,`تعذّر حفظ عمليات الحذف. حاول مجدداً.`],"Ignored. The directory stays unimported.":[`已忽略。该目录保持未导入。`,`تم التجاهل. يبقى المجلد دون استيراد.`],"The directory could not be ignored. Try again.":[`无法忽略该目录。请重试。`,`تعذّر تجاهل المجلد. حاول مجدداً.`],"Restored. The directory shows again in each host list that reported it.":[`已恢复。该目录会重新出现在报告它的每个主机列表中。`,`تمت الاستعادة. يظهر المجلد مجدداً في قائمة كل مضيف أبلغ عنه.`],"The directory could not be restored. Try again.":[`无法恢复该目录。请重试。`,`تعذّرت استعادة المجلد. حاول مجدداً.`],"Saved, but the list could not be refreshed. Refresh the list without saving again.":[`已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`تم الحفظ، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"Review directory maps":[`检查目录映射`,`مراجعة خرائط المجلدات`],"Proposed maps":[`建议映射数`,`عدد الخرائط المقترحة`],Sessions:[`会话数`,`عدد الجلسات`],Confirm:[`确认`,`تأكيد`],"Saving…":[`正在保存…`,`جارٍ الحفظ…`],"Settings refreshed. No maps were saved.":[`设置已刷新。未保存任何映射。`,`حُدّثت الإعدادات. لم تُحفظ أي خرائط.`],"Settings could not be refreshed. Try Refresh list again.":[`无法刷新设置。请再次点击刷新列表。`,`تعذّر تحديث الإعدادات. حاول تحديث القائمة مجدداً.`],"Maps could not be saved. Review the targets and confirm again.":[`无法保存映射。请检查目标后再次确认。`,`تعذّر حفظ الخرائط. راجع المجلدات المستهدفة، ثم أكّد مجدداً.`],"Settings changed elsewhere. Review these maps and confirm again.":[`设置已在其他位置更改。请检查这些映射后再次确认。`,`تغيّرت الإعدادات في مكان آخر. راجع هذه الخرائط، ثم أكّد مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再次确认。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة قبل التأكيد مجدداً.`],"Maps were saved, but the list could not be refreshed. Refresh the list without saving again.":[`映射已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`حُفظت الخرائط، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"No model was recorded for these attempts. This happens with records written by older OMMS versions, and when an attempt stops before a model is chosen.":[`这些尝试没有记录模型。旧版 OMMS 写入的记录,以及在选定模型之前就停止的尝试,会出现这种情况。`,`لم يُسجَّل نموذج لهذه المحاولات. يحدث ذلك في السجلات التي كتبتها إصدارات أقدم من OMMS، وعندما تتوقف المحاولة قبل اختيار نموذج.`],"These sessions cannot be mapped.":[`这些会话无法映射。`,`لا يمكن ربط هذه الجلسات.`],unresolved:[`未解析`,`غير محلول`],"Use this profile":[`使用此画像`,`استخدام هذا الملف الشخصي`],"Use this profile for every folder?":[`在所有文件夹中使用此画像?`,`استخدام هذا الملف الشخصي في كل المجلدات؟`],"Used for":[`用途`,`الاستخدام`],Workflows:[`工作流`,`سير العمل`],Memory:[`记忆`,`الذاكرة`],Setting:[`设置`,`الإعداد`],Value:[`数值`,`القيمة`],Default:[`默认值`,`القيمة الافتراضية`],Unit:[`单位`,`الوحدة`],Affects:[`影响`,`التأثير`],Results:[`条结果`,`نتائج`],Memories:[`条记忆`,`ذكريات`],Bytes:[`字节`,`بايت`],"Approximate tokens":[`约计令牌`,`رموز تقريبية`],"Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.":[`记忆搜索结果的最大数量。手动搜索可以请求更少;提示词检索使用此上限。`,`الحد الأقصى لنتائج بحث الذاكرة. يمكن للبحث اليدوي طلب عدد أقل؛ ويستخدم استرجاع الطلب هذا السقف.`],"Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.":[`会话开始时在 OpenCode V1 和 Claude Code 中加入的近期记忆。Pi 和 OpenCode V2 改用基于提示词的搜索。`,`الذكريات الحديثة التي تُضاف عند بدء الجلسة في OpenCode V1 و Claude Code. أما Pi و OpenCode V2 فيستخدمان البحث عبر الطلب بدلاً منها.`],"Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.":[`通过共享捕获管道发送给记忆摘要模型的对话输入。数值较小时可能省略部分对话文本。`,`مدخلات المحادثة التي تُرسل إلى نموذج تلخيص الذاكرة عبر مسار الالتقاط المشترك. القيم الأصغر قد تحذف نصاً من المحادثة.`],"OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.":[`OpenCode 画像学习的输入。数值较小时可能从该输入中省略部分提示词。此设置不限制其他主机的画像输入。`,`مدخلات تعلّم الملف الشخصي في OpenCode. القيم الأصغر قد تحذف مطالبات من هذه المدخلات. لا يقيّد هذا الإعداد مدخلات الملف الشخصي في المضيفات الأخرى.`],"Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.":[`自动加入各主机代理请求的记忆上下文,包括画像文本和格式化内容。数值较小时会显示更少或更短的记忆。`,`سياق الذاكرة المُضاف تلقائياً إلى طلبات الوكيل في كل المضيفات، بما في ذلك نص الملف الشخصي والتنسيق. القيم الأصغر قد تعرض ذكريات أقل أو أقصر.`],"Enter a positive whole number.":[`请输入正整数。`,`أدخل رقماً صحيحاً موجباً.`],"Enter a whole number from 16,384 to 16,777,216.":[`请输入 16,384 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 16,384 إلى 16,777,216.`],"Enter a whole number from 1,024 to 16,777,216.":[`请输入 1,024 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 1,024 إلى 16,777,216.`],"Enter a whole number from 256 to 65,536.":[`请输入 256 到 65,536 之间的整数。`,`أدخل رقماً صحيحاً من 256 إلى 65,536.`],"Byte limits count UTF-8 bytes.":[`字节限制按 UTF-8 字节计数。`,`تُحتسب حدود البايت بوحدات بايت UTF-8.`],"Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.":[`约计令牌按 ceil(UTF-8 字节数 / 4) 估算。同一文本,提供商统计的令牌数可能更多或更少。`,`تُقدَّر الرموز التقريبية بالصيغة ceil(بايتات UTF-8 / 4). قد يحسب المزوّد للنص نفسه رموزاً أكثر أو أقل.`],"These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.":[`这些设置不会删除已存储的数据、设定消费限额、限制模型回复,也不会控制 Graphify 输出。`,`لا تحذف هذه الإعدادات البيانات المخزنة، ولا تضع حد إنفاق، ولا تحدّ من ردود النموذج، ولا تتحكم في خرج Graphify.`],"Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.":[`也可以直接编辑 ~/.config/omms/omms.jsonc 来设置这些限制,无需网页界面。`,`عدّل الملف ~/.config/omms/omms.jsonc مباشرة لضبط هذه الحدود دون واجهة الويب.`],"Save memory limits":[`保存记忆限制`,`حفظ حدود الذاكرة`],"Saved. New memory operations use these limits.":[`已保存。新的记忆操作将使用这些限制。`,`تم الحفظ. ستستخدم عمليات الذاكرة الجديدة هذه الحدود.`],"Invalid setting":[`无效的设置`,`إعداد غير صالح`],"Config changed. Reload settings and save again.":[`设置文件已更改。请重新加载设置后再次保存。`,`تغيّر ملف الإعدادات. أعد تحميل الإعدادات ثم احفظ مجدداً.`],"The memory settings could not be loaded. Reload the page to try again.":[`无法加载记忆设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات الذاكرة. أعد تحميل الصفحة للمحاولة مجدداً.`],"The memory settings could not be saved.":[`无法保存记忆设置。`,`تعذّر حفظ إعدادات الذاكرة.`],"Effective value":[`生效值`,`القيمة السارية`],project:[`项目`,`المشروع`],"The project value stays in force. Saving edits the global file only.":[`项目值仍然生效。保存只修改全局文件。`,`تبقى قيمة المشروع سارية، والحفظ يعدّل الملف العام فقط.`],"Similarity score":[`相似度分数`,`درجة التشابه`],"Enter a number from 0 to 1.":[`请输入 0 到 1 之间的数字。`,`أدخل رقماً من 0 إلى 1.`],"Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.":[`记忆被搜索返回所需的最低分数。较低的值会返回更多记忆,包括相关性较低的;较高的值可能一条也不返回。默认值取决于嵌入模型。`,`أدنى درجة تحتاجها الذاكرة لتُعاد في نتائج البحث. القيم الأدنى تعيد ذكريات أكثر بمن فيها الأقل صلة، والقيم الأعلى قد لا تعيد شيئاً. تعتمد القيمة الافتراضية على نموذج التضمين.`],"Reset to default":[`恢复默认`,`إعادة إلى الافتراضي`],"Differs from default":[`与默认值不同`,`يختلف عن الافتراضي`],"Keyword matching":[`关键词匹配`,`مطابقة الكلمات`],"Search finds memories by meaning and by exact words from your prompt.":[`搜索按含义和提示中的确切词语查找记忆。`,`يجد البحث الذكريات بالمعنى وبالكلمات الدقيقة من مطالبتك.`],"Word matching mode":[`词语匹配模式`,`وضع مطابقة الكلمات`],"Boost (default)":[`加分(默认)`,`تعزيز (افتراضي)`],"Rank fusion (experimental)":[`排名融合(实验性)`,`دمج الترتيب (تجريبي)`],"Boost adds a small score bonus to memories that contain a word of your prompt.":[`加分会给包含提示中某个词的记忆增加少量分数。`,`يضيف التعزيز مكافأة صغيرة في الدرجة للذكريات التي تحتوي على كلمة من مطالبتك.`],"Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.":[`排名融合会合并按含义排序的列表和按词语排序的列表。即使含义得分低于相似度阈值,包含提示中某个词的记忆也可能被返回。实验性:尚未证明能找到更多相关记忆。`,`يدمج دمج الترتيب قائمة بالمعنى وقائمة بالكلمات. قد تُعاد ذاكرة تحتوي على كلمة من مطالبتك حتى لو كانت درجة المعنى أقل من حد التشابه. تجريبي: لم يثبت أنه يجد ذكريات أكثر صلة.`],"Rank fusion is not used while the reranker is on. Search uses the boost.":[`重排序器开启时不使用排名融合,搜索使用加分模式。`,`لا يُستخدم دمج الترتيب أثناء تشغيل معيد الترتيب. يستخدم البحث التعزيز.`],"A project file can override this setting. This page edits the global value.":[`项目文件可以覆盖此设置。此页面编辑全局值。`,`يمكن لملف المشروع تجاوز هذا الإعداد. تعدّل هذه الصفحة القيمة العامة.`],"Saved. New searches use this mode.":[`已保存。新的搜索将使用此模式。`,`تم الحفظ. تستخدم عمليات البحث الجديدة هذا الوضع.`],"The keyword matching setting could not be saved. Reload the page to try again.":[`无法保存关键词匹配设置。请重新加载页面后重试。`,`تعذّر حفظ إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],"The keyword matching setting could not be loaded. Reload the page to try again.":[`无法加载关键词匹配设置。请重新加载页面后重试。`,`تعذّر تحميل إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],Reranker:[`重排序器`,`إعادة الترتيب`],"Use a reranker":[`使用重排序器`,`استخدم معيد الترتيب`],Key:[`密钥`,`المفتاح`],Timeout:[`超时`,`مهلة الانتهاء`],"Search is unchanged while the switch is off.":[`开关关闭时,搜索行为保持不变。`,`يظل البحث دون تغيير أثناء إيقاف المفتاح.`],"The reranker reorders the best memory search results with your reranker server and keeps the top results.":[`重排序器使用您的重排序服务器对最佳记忆搜索结果重新排序,并保留最靠前的结果。`,`يعيد معيد الترتيب ترتيب أفضل نتائج بحث الذاكرة عبر خادم إعادة الترتيب لديك ويحتفظ بالنتائج العليا.`],"The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.":[`重排序器会将提示和候选记忆的文本发送到该服务器 URL。建议使用同一台机器上的服务器。`,`يرسل معيد الترتيب المطالبة ونص الذكريات المرشحة إلى عنوان URL للخادم. يُنصح بخادم على الجهاز نفسه.`],"This URL is not on this machine: memory text leaves this machine.":[`此 URL 不在本机上:记忆文本将离开本机。`,`هذا العنوان ليس على هذا الجهاز: نص الذاكرة يغادر جهازك.`],"A project file cannot change these settings. The reranker settings are global only.":[`项目文件无法更改这些设置。重排序器设置仅限全局。`,`لا يمكن لملف المشروع تغيير هذه الإعدادات. إعدادات معيد الترتيب عامة فقط.`],"The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.":[`默认值 4000 使搜索保持在 OpenCode V2 的 5 秒等待之内。超过 5000 的值可能导致 OpenCode V2 在不注入记忆的情况下发送请求。`,`تحافظ القيمة الافتراضية 4000 على بقاء البحث داخل مهلة انتظار OpenCode V2 البالغة 5 ثوانٍ. القيمة الأعلى من 5000 قد تجعل OpenCode V2 يرسل الطلب دون ذاكرة.`],"Enter the server URL and model before turning the reranker on.":[`打开重排序器前,请先填写服务器 URL 和模型。`,`أدخل عنوان URL للخادم والنموذج قبل تشغيل معيد الترتيب.`],"The key must be an env:// or file:// reference, or left empty.":[`密钥必须是 env:// 或 file:// 引用,或留空。`,`يجب أن يكون المفتاح مرجع env:// أو file://، أو يُترك فارغاً.`],"Enter a whole number from 500 to 30,000.":[`请输入 500 到 30,000 之间的整数。`,`أدخل رقماً صحيحاً من 500 إلى 30,000.`],"Optional env:// or file:// key reference.":[`可选的 env:// 或 file:// 密钥引用。`,`مرجع مفتاح env:// أو file:// اختياري.`],milliseconds:[`毫秒`,`ميلي ثانية`],Save:[`保存`,`حفظ`],"Saved. New searches use these settings.":[`已保存。新的搜索将使用这些设置。`,`تم الحفظ. ستستخدم عمليات البحث الجديدة هذه الإعدادات.`],"The reranker settings could not be saved. Reload the page to try again.":[`无法保存重排序器设置。请重新加载页面重试。`,`تعذّر حفظ إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"The reranker settings could not be loaded. Reload the page to try again.":[`无法加载重排序器设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"Test passed.":[`测试通过。`,`نجح الاختبار.`],"Test failed:":[`测试失败:`,`فشل الاختبار:`],"Change icon":[`更换图标`,`تغيير الأيقونة`],"Check again":[`再次检查`,`تحقق مرة أخرى`],"Choose a host to see its history import, sessions and settings.":[`选择一个宿主,查看其历史导入、会话和设置。`,`اختر مضيفاً لعرض استيراد سجله وجلساته وإعداداته.`],"Choose icon":[`选择图标`,`اختر أيقونة`],"Every avatar is shown at the same size. Images are cropped to a square.":[`所有头像大小一致。图片会被裁剪为正方形。`,`تظهر كل الصور الرمزية بالحجم نفسه. تُقصّ الصور إلى مربع.`],"Every host":[`所有宿主`,`كل المضيفين`],"Fix the service named here, then press Check again.":[`请修复此处所列的服务,然后点击“再次检查”。`,`أصلح الخدمة المذكورة هنا، ثم اضغط «تحقق مرة أخرى».`],"How many memories a search returns":[`一次搜索返回多少条记忆`,`عدد الذكريات التي يعيدها البحث`],"How to set up":[`如何设置`,`كيفية الإعداد`],"Ignore all":[`全部忽略`,`تجاهل الكل`],"Memory injection":[`记忆注入`,`حقن الذاكرة`],"Inject memories at session start":[`在会话开始时注入记忆`,`حقن الذكريات عند بدء الجلسة`],"Added to the first message of a new session. OMMS searches the query below and adds only matching memories.":[`添加到新会话的第一条消息中。OMMS 会用下面的查询进行搜索,只添加匹配的记忆。`,`تُضاف إلى أول رسالة في جلسة جديدة. يبحث OMMS بالاستعلام أدناه ويضيف الذكريات المطابقة فقط.`],"Session-start search query":[`会话开始搜索查询`,`استعلام البحث عند بدء الجلسة`],"Subagent memory":[`子代理记忆`,`ذاكرة الوكلاء الفرعيين`],"Subagents get memories that match their task. No rows are shown for them.":[`子代理会获得与其任务匹配的记忆。不会为它们显示记忆行。`,`يحصل الوكلاء الفرعيون على الذكريات المطابقة لمهمتهم. لا تُعرض لهم أي صفوف.`],"Restore memories after compaction or resume":[`压缩或恢复后还原记忆`,`استعادة الذكريات بعد الضغط أو الاستئناف`],"Most memories to restore":[`最多还原的记忆数`,`أقصى عدد من الذكريات للاستعادة`],"Applies to OpenCode V2, Pi and Claude Code. OpenCode V1 is not covered. On Pi, subagent memory needs om-pi-subagents to load OMMS.":[`适用于 OpenCode V2、Pi 和 Claude Code,不包括 OpenCode V1。在 Pi 上,子代理记忆需要 om-pi-subagents 来加载 OMMS。`,`ينطبق على OpenCode V2 وPi وClaude Code. لا يشمل OpenCode V1. على Pi تحتاج ذاكرة الوكلاء الفرعيين إلى om-pi-subagents لتحميل OMMS.`],"A project config can turn the session-start and subagent options off. It can turn restore on or off.":[`项目配置只能关闭会话开始和子代理选项,但可以开启或关闭还原。`,`يمكن لإعدادات المشروع إيقاف خياري بدء الجلسة والوكلاء الفرعيين فقط، ويمكنها تشغيل الاستعادة أو إيقافها.`],"Saved. The next session uses these options.":[`已保存。下一个会话将使用这些选项。`,`تم الحفظ. ستستخدم الجلسة التالية هذه الخيارات.`],"The memory injection settings could not be loaded. Reload the page to try again.":[`无法加载记忆注入设置。请重新加载页面后重试。`,`تعذّر تحميل إعدادات حقن الذاكرة. أعد تحميل الصفحة للمحاولة مرة أخرى.`],"Session start {opening} · Subagents {subagent} · Restore {restore}":[`会话开始 {opening} · 子代理 {subagent} · 还原 {restore}`,`بدء الجلسة {opening} · الوكلاء الفرعيون {subagent} · الاستعادة {restore}`],"Invalid openingContext setting":[`openingContext 设置无效`,`إعداد openingContext غير صالح`],"Invalid subagentMemory setting":[`subagentMemory 设置无效`,`إعداد subagentMemory غير صالح`],"Invalid compaction.enabled setting":[`compaction.enabled 设置无效`,`إعداد compaction.enabled غير صالح`],"Invalid compaction.memoryLimit setting: accepted positive safe integers":[`compaction.memoryLimit 设置无效:只接受正整数`,`إعداد compaction.memoryLimit غير صالح: يُقبل عدد صحيح موجب فقط`],"openingContextQuery must be text of 500 characters or fewer":[`openingContextQuery 必须是不超过 500 个字符的文本`,`يجب أن يكون openingContextQuery نصاً لا يزيد عن 500 حرف`],"Import all hosts":[`导入所有宿主`,`استيراد كل المضيفين`],"Import progress":[`导入进度`,`تقدم الاستيراد`],"Running · history imported {date}":[`运行中 · 历史已导入 {date}`,`قيد التشغيل · استُورد السجل {date}`],"Running · history imported {date} · last saved {when}":[`运行中 · 历史已导入 {date} · 上次保存 {when}`,`قيد التشغيل · استُورد السجل {date} · آخر حفظ {when}`],"Running · last saved {when}":[`运行中 · 上次保存 {when}`,`قيد التشغيل · آخر حفظ {when}`],"today {time}":[`今天 {time}`,`اليوم {time}`],"yesterday {time}":[`昨天 {time}`,`أمس {time}`],"Importing makes model calls and can cost money.":[`导入会调用模型,可能产生费用。`,`يجري الاستيراد اتصالات بالنموذج وقد يكلّف مالاً.`],"Importing · {percent}%":[`正在导入 · {percent}%`,`جارٍ الاستيراد · {percent}%`],"Memories are not being saved.":[`记忆当前无法保存。`,`لا يتم حفظ الذكريات حالياً.`],"Memories not saved":[`记忆未保存`,`الذكريات غير محفوظة`],"Memory views":[`记忆视图`,`عروض الذاكرة`],"Mode: {mode}":[`模式:{mode}`,`الوضع: {mode}`],"No icon matches.":[`没有匹配的图标。`,`لا توجد أيقونة مطابقة.`],"Not set up":[`未设置`,`غير مُعد`],"Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.":[`自动导入已开启。在 {date} 之前没有待导入的内容。更新的聊天请使用下方的“会话”。`,`الاستيراد التلقائي قيد التشغيل. لم يكن هناك ما ينتظر قبل {date}. استخدم «الجلسات» أدناه للمحادثات الأحدث.`],"Automatic import is on. Nothing is waiting.":[`自动导入已开启。没有待导入的内容。`,`الاستيراد التلقائي قيد التشغيل. لا يوجد ما ينتظر.`],"OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.":[`OMMS 在这台电脑上没有找到该宿主的聊天记录。请安装该宿主并使用一次,然后重新加载此页面。`,`لم يعثر OMMS على سجل محادثات هذا المضيف على هذا الحاسوب. ثبّت المضيف واستخدمه مرة واحدة، ثم أعد تحميل هذه الصفحة.`],Off:[`关`,`متوقف`],On:[`开`,`قيد التشغيل`],"On · {model}":[`开 · {model}`,`قيد التشغيل · {model}`],"PNG, JPEG, WebP or GIF, up to 20 MB.":[`PNG、JPEG、WebP 或 GIF,最大 20 MB。`,`PNG أو JPEG أو WebP أو GIF، حتى 20 ميغابايت.`],"Paused · {pending} pending":[`已暂停 · 待处理 {pending}`,`متوقف مؤقتاً · {pending} قيد الانتظار`],"Paused. Resume to continue.":[`已暂停。点击“恢复”继续。`,`متوقف مؤقتاً. اضغط «استئناف» للمتابعة.`],"Prompts waiting for profile learning, and re-analysis of old chats":[`等待画像学习的提示,以及旧聊天的重新分析`,`مطالبات تنتظر تعلم الملف الشخصي، وإعادة تحليل المحادثات القديمة`],"Results {results} · Similarity {similarity}":[`结果数 {results} · 相似度 {similarity}`,`النتائج {results} · التشابه {similarity}`],"Runs one import for every host you tick. It makes model calls and can cost money.":[`对勾选的每个宿主运行一次导入。它会调用模型,可能产生费用。`,`يشغّل استيراداً واحداً لكل مضيف تحدده. يجري اتصالات بالنموذج وقد يكلّف مالاً.`],"Saved maps and ignored directories":[`已保存的映射和已忽略的目录`,`الخرائط المحفوظة والمجلدات المتجاهلة`],"Search icons":[`搜索图标`,`ابحث عن أيقونة`],"Settings for every host":[`适用于所有宿主的设置`,`إعدادات لكل المضيفين`],Shared:[`共享`,`مشترك`],"Stopped · {pending} pending":[`已停止 · 待处理 {pending}`,`متوقف · {pending} قيد الانتظار`],"Stopped: {error}":[`已停止:{error}`,`توقف: {error}`],"These directories stay unimported and leave the unresolved counts.":[`这些目录保持未导入状态,并从未解析计数中移除。`,`تبقى هذه المجلدات غير مستوردة وتخرج من أعداد غير المحلولة.`],"These settings apply to every host. Open a row to change it.":[`这些设置适用于所有宿主。展开一行即可修改。`,`تنطبق هذه الإعدادات على كل المضيفين. افتح صفاً لتغييره.`],"This browser could not read the image.":[`此浏览器无法读取该图片。`,`تعذّر على هذا المتصفح قراءة الصورة.`],"This host is not set up on this machine.":[`此宿主尚未在这台机器上设置。`,`لم يتم إعداد هذا المضيف على هذا الجهاز.`],"This switch applies to every host. Automatic import makes model calls.":[`此开关适用于所有宿主。自动导入会调用模型。`,`ينطبق هذا المفتاح على كل المضيفين. يجري الاستيراد التلقائي اتصالات بالنموذج.`],"Upload image":[`上传图片`,`رفع صورة`],"Use external API":[`使用外部 API`,`استخدام واجهة API الخارجية`],settings:[`设置`,`الإعدادات`],"{saved} saved · {ignored} ignored":[`已保存 {saved} · 已忽略 {ignored}`,`{saved} محفوظة · {ignored} متجاهلة`],"The image is larger than 20 MB.":[`图片超过 20 MB。`,`الصورة أكبر من 20 ميغابايت.`],"Only PNG, JPEG, WebP and GIF images are accepted.":[`仅接受 PNG、JPEG、WebP 和 GIF 图片。`,`تُقبل صور PNG وJPEG وWebP وGIF فقط.`],"Importing {done} / {total}.":[`正在导入 {done} / {total}。`,`جارٍ الاستيراد {done} / {total}.`],"Importing {done} / {total}. About {minutes} min left.":[`正在导入 {done} / {total}。约剩 {minutes} 分钟。`,`جارٍ الاستيراد {done} / {total}. يتبقى نحو {minutes} دقيقة.`],"Nothing is waiting to import.":[`没有待导入的内容。`,`لا يوجد ما ينتظر الاستيراد.`],"{pending} still waiting to import.":[`仍有 {pending} 条待导入。`,`لا يزال {pending} بانتظار الاستيراد.`]};function Qv(e,t){return t===`en`?e:Zv[e]?.[t===`zh`?0:1]??e}function Y(){let{language:e}=G();return t=>Qv(t,e)}function $v(e){try{return localStorage.getItem(e)!==`0`}catch{return!0}}function ey(e,t){try{localStorage.setItem(e,t?`1`:`0`)}catch{}}function ty({storageKey:e,sections:t,back:n}){let r=Y(),[i,a]=(0,v.useState)(()=>$v(e)),o=()=>a(t=>(ey(e,!t),!t)),s=e=>t=>{t.preventDefault();let n=document.getElementById(e);n&&(n.scrollIntoView(af),of(n))};return(0,H.jsxs)(`div`,{className:`fixed top-16 end-3 z-20 flex flex-col items-end gap-1 md:top-3`,children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-expanded":i,"aria-controls":`${e}-nav`,"aria-label":r(i?`Hide contents`:`Show contents`),onClick:o,className:`bg-card/95 shadow-sm backdrop-blur`,children:(0,H.jsx)(qe,{className:`size-4`,"aria-hidden":`true`})}),i?(0,H.jsx)(`nav`,{id:`${e}-nav`,"aria-label":r(`Contents`),className:`max-h-[70vh] w-48 max-w-full overflow-y-auto rounded-xl border border-border bg-card/95 px-2 py-1.5 shadow-sm backdrop-blur`,children:(0,H.jsxs)(`ul`,{children:[n?(0,H.jsx)(`li`,{className:`mb-1 border-b border-border pb-1`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:n.onBack,className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-sm hover:bg-interactive-hover`,children:[(0,H.jsx)(N,{className:`rtl:-scale-x-100 size-3.5 shrink-0`,"aria-hidden":`true`}),n.label]})}):null,t.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`a`,{href:`#${e.id}`,onClick:s(e.id),className:`block rounded-lg px-2 py-1.5 text-start text-sm hover:bg-interactive-hover`,children:r(e.title)})},e.id))]})}):null]})}var ny=class extends Error{status;constructor(e,t){super(e),this.name=`SettingsRequestError`,this.status=t}};async function X(e,t={}){let n=(t.method??`GET`).toUpperCase(),r=n!==`GET`&&n!==`HEAD`,i=await fetch(e,{...t,headers:{"x-omms-token":window.__OMMS_TOKEN__??``,...r||t.body?{"Content-Type":`application/json`}:{},...t.headers}}),a=await i.json();if(!i.ok)throw new ny(a.error??`Request failed (${i.status})`,i.status);return a}var ry=new Set,iy=0;function ay(e){iy++;for(let t of ry)t(e)}function oy(){let e=iy;return{isCurrent:()=>iy===e}}async function sy(){try{let e=await X(`/api/settings`);return ay(e),e}catch{return null}}function cy(e){return ry.add(e),()=>{ry.delete(e)}}function ly(e,t){return`${e.replace(/\.+$/,``)}. ${t}`}function uy(){let e=0;return{begin(){let t=++e;return()=>t===e}}}async function dy(e,t){e(!0);try{return await t()}finally{e(!1)}}function fy(e,t){if(e===`env`){let n=(t.name??``).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n))throw Error(`Enter a variable name such as ZAI_API_KEY`);return{source:e,name:n}}if(e===`file`){let n=(t.path??``).trim();if(!n)throw Error(`Enter the path of a key file`);return{source:e,path:n}}let n=(t.name??``).trim()||`memory-api`;if(!/^[A-Za-z0-9_-]{1,64}$/.test(n))throw Error(`Name the key file with letters, digits, dashes, or underscores`);if(!(t.value??``).trim())throw Error(`Paste the key`);return{source:e,name:n,value:t.value??``,replace:t.replace===!0}}function py(e){let t=[],n=e.memoryProvider===`orcarouter`;return!n&&!e.memoryModel&&t.push(`memoryModel`),!n&&!e.memoryApiUrl&&t.push(`memoryApiUrl`),e.keySet||t.push(`memoryApiKey`),t}function my(e,t){if(t===`inherit`||t===`external`)return{[`${e}Model`]:t};let n=t.indexOf(`/`);if(n<1||n===t.length-1)throw Error(`Enter a model as provider/model.`);return{[`${e}Provider`]:t.slice(0,n),[`${e}Model`]:t.slice(n+1)}}function hy(e){return{kind:e.relation,command:e.relation===`older`?`npm i -g om-memory-system@latest`:null}}function gy(e,t){return e.filter(e=>!t.has(e.from))}function _y({status:e}){let t=Y();return(0,H.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Yd(`claude-code`)}),e?.ready===!0&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`Claude Code capture uses the external API.`)}),e?.ready===!1&&(0,H.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-xs`,children:[(0,H.jsx)(`p`,{className:`text-amber-600`,children:t(`Claude Code capture is off. Complete the external API settings.`)}),(e.issues??[]).length>0&&(0,H.jsxs)(`p`,{children:[t(`Missing settings`),`: `,(e.issues??[]).map(e=>t(e)).join(`; `)]})]})]})}function vy(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&o(t.message)});for(let t of[`opencode`,`pi`])X(`/api/settings/models?host=${t}`).then(n=>{e&&i(e=>({...e,[t]:n}))}).catch(()=>{e&&i(e=>({...e,[t]:{available:!1}}))});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function l(n,r){if(!t)return;let i;try{i=my(n,r)}catch(t){o(e(t.message));return}c(!0);let a,s;try{a=await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:i,revision:t.revision})})}catch(e){s=e}let l=await sy()!==null;if(c(!1),a){let t=e(a.migratedLegacy?`Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.`:`Saved. New capture and profile work uses these settings.`);o(l?t:`${t} ${e(`Reload the page before saving again.`)}`)}else o(ly(s?.message??``,e(l?`Current settings were reloaded; check the values and save again.`:`The current settings could not be reloaded. Reload the page.`)))}let u=py({memoryProvider:t?.settings.memoryProvider?.globalValue,memoryModel:t?.settings.memoryModel?.globalValue,memoryApiUrl:t?.settings.memoryApiUrl?.globalValue,keySet:!!t?.secrets.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Models`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Models`)}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e(`External API fallback`),`: `,t?.fallback.model??e(`none`),` (`,e(t?.fallback.configured?`ready`:`not ready`),`).`]}),[`opencode`,`pi`].map(e=>(0,H.jsx)(yy,{host:e,model:t?.settings[`${e}Model`],provider:t?.settings[`${e}Provider`],effective:e===`pi`?t?.effective.pi.kind:t?.effective.opencode.mode??`unready`,list:r[e],externalMissing:u,busy:s||!t,onSave:t=>l(e,t)},e)),(0,H.jsx)(_y,{status:t?.effective[`claude-code`]}),a&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:a})]})}function yy({host:e,model:t,provider:n,effective:r,list:i,externalMissing:a,busy:o,onSave:s}){let c=Y(),l=t?.globalValue===`inherit`||!t?.globalValue?`inherit`:t.globalValue===`external`?`external`:`${n?.globalValue??``}/${t.globalValue}`,[u,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),g=u??(l===`inherit`||l===`external`?l:`manual`),_=i?.models??[],y=l===`inherit`||l===`external`?``:l,b=m||y||(_[0]?`${_[0].provider}/${_[0].model}`:`typed`),x=!_.some(e=>`${e.provider}/${e.model}`===b),S=f??y;return(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Yd(e)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Effective model`),`:`,` `,t?.value===`external`&&r===`manual`?c(`external API`):t?.value===`inherit`||r===`session`?c(`session`):r===`manual`?c(`external API`):r===`unready`?c(`unavailable`):`${n?.value??``}/${t?.value??``}`]}),(t?.source===`project`||n?.source===`project`)&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:c(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`label`,{className:`block text-sm`,htmlFor:`${e}-model`,children:c(`Model choice`)}),(0,H.jsxs)(Dr,{id:`${e}-model`,className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,value:g,onChange:e=>d(e.target.value),children:[(0,H.jsx)(`option`,{value:`inherit`,children:c(`Session model`)}),(0,H.jsx)(`option`,{value:`manual`,children:c(`Manual model`)}),(0,H.jsx)(`option`,{value:`external`,disabled:a.length>0,children:c(`External API`)})]}),a.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`External API needs`),`: `,a.join(`, `)]}),g===`manual`&&i?.available&&_.length>0&&(0,H.jsxs)(Dr,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${Yd(e)} ${c(`Model`)}`,value:x?`typed`:b,onChange:e=>h(e.target.value),children:[_.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:c(`Manual provider/model`)})]}),g===`manual`&&x&&(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${e} ${c(`Manual provider/model`)}`,placeholder:`provider/model`,value:S,onChange:e=>{p(e.target.value),h(`typed`)}}),g===`manual`&&i&&!i.available&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason?c(i.reason):c(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:o,onClick:()=>s(g===`manual`?x?S.trim():b:g),children:c(`Save model`)})]})}var by=[`openai-chat`,`openai-responses`,`anthropic`,`minimax`,`orcarouter`,`google-gemini`];function xy(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(`file`),[s,c]=(0,v.useState)({name:``,path:``,value:``}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&u(t.message)});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let p=e=>String(t?.settings[e]?.globalValue??``),m=e=>r[e]??p(e);async function h(){if(!t)return;let n={};for(let e of[`memoryProvider`,`memoryApiUrl`,`memoryModel`]){let t=m(e).trim();t&&t!==p(e)&&(n[e]=t)}if(!Object.keys(n).length){u(e(`Nothing to save.`));return}f(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),i({}),u(e(`Saved. New capture and profile work uses these settings.`))}catch(e){u(e.message)}await sy(),f(!1)}async function g(n=!1){if(!t)return;let r;try{r=fy(a,{...s,replace:n})}catch(t){u(e(t.message));return}f(!0);try{await X(`/api/settings/external-api/key`,{method:`POST`,body:JSON.stringify({...r,revision:t.revision})}),c(e=>({...e,value:``})),u(e(`Key source saved.`))}catch(t){let r=t.message;if(a===`paste`&&!n&&r.includes(`Confirm to replace`)){f(!1),window.confirm(e(`A key file with this name exists. Replace it?`))&&await g(!0);return}u(r)}await sy(),f(!1)}async function _(){f(!0);try{let t=await X(`/api/settings/external-api/test`,{method:`POST`,body:`{}`});u(t.ok?`${e(`Test call succeeded`)}: ${t.model??``}`:`${e(`Test call failed`)}: ${t.error??``}`)}catch(e){u(e.message)}f(!1)}let y=t?.externalKey;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`External API`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`External API`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.`)}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Provider`),(0,H.jsx)(`div`,{className:Er,children:(0,H.jsx)(Dr,{"aria-label":e(`Provider`),className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:m(`memoryProvider`)||`openai-chat`,onChange:e=>i({...r,memoryProvider:e.target.value}),children:by.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`API URL`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`https://api.example.com/v1`,value:m(`memoryApiUrl`),onChange:e=>i({...r,memoryApiUrl:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Model`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`glm-5-turbo`,value:m(`memoryModel`),onChange:e=>i({...r,memoryModel:e.target.value})})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d||!t,onClick:()=>void h(),children:e(`Save endpoint`)}),(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API key`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e(`Key source`),`:`,` `,y?.source===`env`?`${e(`environment variable`)} ${y.reference}`:y?.source===`file`?`${e(`key file`)} ${y.reference}`:y?.source===`literal`?e(`set in the config file`):e(`not set`),y?.source&&` · ${e(y.resolvesInWebApp?`resolves in the web app`:`does not resolve in the web app`)}`]}),y?.source===`env`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`A login web app does not see variables set only in a shell profile; a key file works everywhere.`)}),y?.source&&!y.resolvesInWebApp&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`The key does not resolve in this web app. Save it to a key file instead.`)}),[[`env`,`Environment variable`],[`file`,`Key file`],[`paste`,`Save key to a private file`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-key-source`,checked:a===t,onChange:()=>o(t)}),e(n)]},t)),a===`env`&&(0,H.jsx)(`input`,{"aria-label":e(`Variable name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`ZAI_API_KEY`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),a===`file`&&(0,H.jsx)(`input`,{"aria-label":e(`Key file path`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`~/.config/omms/secrets/zai.key`,value:s.path,onChange:e=>c({...s,path:e.target.value})}),a===`paste`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{"aria-label":e(`Key file name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`memory-api`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),(0,H.jsx)(`input`,{"aria-label":e(`API key`),type:`password`,autoComplete:`off`,className:`w-full rounded border border-border bg-background p-2`,value:s.value,onChange:e=>c({...s,value:e.target.value})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:d||!t,onClick:()=>void g(),children:e(`Save key source`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d,onClick:()=>void _(),children:e(`Test`)}),l&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:l})]})}var Sy=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`,`0:0:0:0:0:0:0:1`]);function Cy(e){let t=e.trim().toLowerCase();return Sy.has(t)||/^127(?:\.\d{1,3}){3}$/.test(t)}function wy(e){try{return Cy(new URL(e).hostname)}catch{return!1}}function Ty(e,t){return e?`set`:t?`missing`:`not-needed`}function Ey(e){let{access:t,secrets:n}=e,r=t.embeddingApiUrl;return{memoryApiKey:(e=>e===`not-needed`?`never-used`:e)(Ty(!!n.memoryApiKey?.set,e.externalUsed||e.claudeCodeInUse)),embeddingApiKey:Ty(!!n.embeddingApiKey?.set,!!r&&!wy(r)),apiTokens:Ty(t.tokenAvailable,!Cy(t.host)&&!t.authEnabled),webPassword:Ty(!!n.webServerAuthPassword?.set,!1)}}function Dy(e){return e?`Browser password cleared. Restart the web app to turn it off.`:`Saved. Restart the web app to use the new browser password.`}var Oy=[{id:`ollama`,label:`Ollama`,url:`http://localhost:11434/v1`},{id:`llamacpp`,label:`llama.cpp`,url:`http://localhost:8080/v1`},{id:`openrouter`,label:`OpenRouter`,url:`https://openrouter.ai/api/v1`},{id:`openai`,label:`OpenAI`,url:`https://api.openai.com/v1`},{id:`custom`,label:`Custom`,url:``}];function ky(e,t){let n=Oy.find(t=>t.id===e);return n&&n.url?n.url:t}function Ay(e){if(e.kind===`builtin`)return{kind:`builtin`,model:e.model.trim()};let t=e.key===`none`||e.key===`saved`?{source:e.key}:fy(e.key,{...e.keyInput,name:e.keyInput.name||`embedding-api`});return{kind:`server`,url:e.url.trim(),model:e.model.trim(),key:t}}function jy(e){return JSON.stringify([e.kind,e.kind===`server`?e.url.trim():``,e.model.trim(),e.kind===`server`?e.key:`none`,e.kind===`server`?e.keyInput:null])}function My(e,t){return e!==void 0&&e===jy(t)}function Ny(e,t){let n=t.kind===`server`&&!wy(t.url);return{count:e.toLocaleString(`en-US`),risks:[...n?[`The hosted server is called once for each memory, which may cost money.`]:[],`Search results are poor until the re-embed ends.`,`Restart open OpenCode and Pi sessions after the change.`]}}var Py=`Xenova/nomic-embed-text-v1`;function Fy(e,t=Py){return e===`builtin`?{kind:e,model:t}:{kind:e}}function Iy(e,t){return e===`server`&&t?`saved`:`none`}function Ly({current:e,keySet:t}){let n=Y();return(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-sm`,children:[(0,H.jsx)(`dt`,{children:n(`Kind`)}),(0,H.jsx)(`dd`,{children:n(e.kind===`server`?`OpenAI-compatible server`:`Built-in model`)}),e.url&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`Server URL`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.url})]}),(0,H.jsx)(`dt`,{children:n(`Model`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.model}),(0,H.jsx)(`dt`,{children:n(`Vector size`)}),(0,H.jsx)(`dd`,{children:e.dimensions}),(0,H.jsx)(`dt`,{children:n(`API key`)}),(0,H.jsx)(`dd`,{children:n(t?`set`:`not set`)}),(0,H.jsx)(`dt`,{children:n(`Stored memories`)}),(0,H.jsx)(`dd`,{children:e.memoryCount.toLocaleString(`en-US`)})]})}function Ry({run:e,onRetry:t}){let n=Y();return e.state===`idle`?null:(0,H.jsxs)(`div`,{role:`status`,className:`space-y-1 text-sm`,children:[e.state===`running`&&(0,H.jsxs)(`p`,{children:[n(`Re-embedding`),`: `,e.progress.processed,`/`,e.progress.total]}),e.state===`done`&&(0,H.jsx)(`p`,{children:n(`Re-embed finished.`)}),e.state===`failed`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`text-red-600`,children:[n(`Re-embed failed`),`: `,e.error??``]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:t,children:n(`Retry`)})]})]})}function zy(e,t){return{kind:e.kind,url:e.url??``,model:e.model,key:Iy(e.kind,t),keyInput:{name:``,path:``,value:``}}}function By(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)({state:`idle`,progress:{processed:0,total:0}}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1);async function b(){let e=await X(`/api/settings/embedding`);return n(e),m(e.run),e}(0,v.useEffect)(()=>{let e=!0,t=oy();b().catch(t=>e&&g(t.message)),X(`/api/settings`).then(n=>e&&t.isCurrent()&&i(n)).catch(()=>{}),X(`/api/web/status`).then(t=>e&&o(!!t.isLocal)).catch(()=>{});let n=cy(t=>e&&i(t));return()=>{e=!1,n()}},[]),(0,v.useEffect)(()=>{if(p.state!==`running`)return;let e=setInterval(()=>{X(`/api/settings/embedding/run`).then(e=>{m(e),e.state!==`running`&&b()}).catch(()=>{})},1e3);return()=>clearInterval(e)},[p.state]);function x(){if(s||!t){c(!1),u(void 0),f(void 0);return}u(zy(t,!!r?.secrets.embeddingApiKey?.set)),c(!0)}let S=e=>u(t=>t&&{...t,...e});async function C(){l&&await dy(y,async()=>{try{let t=await X(`/api/settings/embedding/test`,{method:`POST`,body:JSON.stringify(Ay(l))});t.ok&&t.dimensions?(f({key:jy(l),dimensions:t.dimensions}),g(`${e(`Test passed. Vector size`)}: ${t.dimensions}`)):(f(void 0),g(`${e(`Test failed`)}: ${t.reason??``}`))}catch(t){g(e(t.message))}})}async function w(){if(!l||!t||!r)return;let{count:n,risks:i}=Ny(t.memoryCount,l),a=[`${e(`Every stored memory will be re-embedded`)}: ${n}`,...i.map(t=>e(t))].join(`
|
|
123
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Qg(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function m_(e,t){return p_.parse(e,t)}m_.options=m_.setOptions=function(e){return p_.setOptions(e),m_.defaults=p_.defaults,Nh(m_.defaults),m_},m_.getDefaults=jh,m_.defaults=Mh;function h_(...e){return p_.use(...e),m_.defaults=p_.defaults,Nh(m_.defaults),m_}m_.use=h_,m_.walkTokens=function(e,t){return p_.walkTokens(e,t)},m_.parseInline=p_.parseInline,m_.Parser=d_,m_.parser=d_.parse,m_.Renderer=l_,m_.TextRenderer=u_,m_.Lexer=c_,m_.lexer=c_.lex,m_.Tokenizer=s_,m_.Hooks=f_,m_.parse=m_,m_.options,m_.setOptions,m_.walkTokens,m_.parseInline,d_.parse,c_.lex,m_.setOptions({gfm:!0,breaks:!0});function g_(e){let t=m_.parse(e,{async:!1});return Ah.sanitize(t)}var __=320,v_=240;function y_(e){if(e.projectPath){let t=e.projectPath.replace(/\\/g,`/`).split(`/`).filter(e=>e);return t[t.length-1]||e.projectPath}return e.displayName||e.id}function b_(e){return{createdDate:Qp(e.createdAt),updatedDate:e.updatedAt&&e.updatedAt!==e.createdAt?Qp(e.updatedAt):null}}function x_(e,t){return e.similarity===void 0?null:t?`${Math.round(e.similarity*100)}%`:`${e.similarity}%`}function S_({variant:e,item:t,memory:n,prompt:r,selected:i=!1,onSelect:a,onPin:o,onUnpin:s,onEdit:c,onDeleteMemory:l,onDeletePrompt:u,activeKeyword:d,onKeywordClick:f}){let{t:p}=G();if(e===`pair`&&n&&r){let e=n.isPinned||!1,t=b_(n),u=x_(n,!0);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-3 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":n.id,children:[(0,H.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-muted p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:p(`badge-prompt`)}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Qp(r.createdAt)})]}),(0,H.jsx)(Rp,{maxHeight:v_,fade:`var(--muted)`,children:(0,H.jsx)(Yp,{content:r.content})})]}),(0,H.jsx)(`div`,{className:`flex justify-center text-muted-foreground`,children:(0,H.jsx)(M,{className:`size-4`})}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(n.id,e===!0)}),(0,H.jsx)(id,{children:p(`badge-memory`)}),n.memoryType?(0,H.jsx)(Up,{type:n.memoryType}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(id,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:n.displayName||n.id})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(n.id),children:(0,H.jsx)(ht,{className:`size-3.5 fill-current`})}):(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(n.id),children:(0,H.jsx)(ht,{className:`size-3.5`})}),(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(n.id),children:(0,H.jsx)(pt,{className:`size-3.5`})}),(0,H.jsx)(Hp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(`btn-delete-pair`),onClick:()=>l?.(n.id,!0),children:(0,H.jsx)(Rt,{className:`size-3.5`})})})]})]}),n.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:n.tags.map(e=>(0,H.jsx)(Hp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(nd,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Rp,{maxHeight:__,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:g_(n.content)}})})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,t.createdDate]}),t.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,t.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,n.id]})]})]})]})}if(e===`prompt`&&t){let e=!!t.linkedMemoryId;return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),(0,H.jsx)(Ze,{className:`size-3.5 text-muted-foreground`}),(0,H.jsx)(id,{variant:`secondary`,children:p(`badge-prompt`)}),e?(0,H.jsxs)(id,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Qp(t.createdAt)})]}),e?(0,H.jsx)(Hp,{content:p(`tooltip-delete-prompt-pair`),children:(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Rt,{className:`size-3.5`})})}):(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(e?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>u?.(t.id,e),children:(0,H.jsx)(Rt,{className:`size-3.5`})})]}),(0,H.jsx)(Rp,{maxHeight:v_,children:(0,H.jsx)(Yp,{content:t.content})}),e?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(M,{className:`size-3`}),p(`text-generated-above`),(0,H.jsx)(ee,{className:`size-3`})]}):null]})}if(e===`memory`&&t){let e=t.isPinned||!1,n=!!t.linkedPromptId,r=b_(t),u=x_(t,!1);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-3 space-y-2 ${i?`ring-1 ring-input`:``} ${e?`border-primary/40`:``}`,"data-id":t.id,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 min-w-0`,children:[(0,H.jsx)(Qo,{checked:i,onCheckedChange:e=>a?.(t.id,e===!0)}),t.memoryType?(0,H.jsx)(Up,{type:t.memoryType}):null,n?(0,H.jsxs)(id,{variant:`outline`,className:`border-status-success text-status-success bg-transparent`,children:[(0,H.jsx)(Ke,{className:`size-3`}),p(`badge-linked`)]}):null,u?(0,H.jsx)(`span`,{className:`text-xs text-primary`,children:u}):null,e?(0,H.jsx)(id,{variant:`secondary`,children:p(`badge-pinned`)}):null,(0,H.jsx)(`span`,{dir:`auto`,className:`text-xs text-muted-foreground font-mono min-w-0 break-all`,children:y_(t)}),t.projectPath?(0,H.jsx)(`span`,{dir:`ltr`,className:`text-code text-muted-foreground font-mono break-all w-full`,children:t.projectPath}):null]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e?(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Unpin`,onClick:()=>s?.(t.id),children:(0,H.jsx)(ht,{className:`size-3.5 fill-current`})}):(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:`Pin`,onClick:()=>o?.(t.id),children:(0,H.jsx)(ht,{className:`size-3.5`})}),(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,onClick:()=>c?.(t.id),children:(0,H.jsx)(pt,{className:`size-3.5`})}),n?(0,H.jsx)(Hp,{content:p(`tooltip-delete-pair`),children:(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Rt,{className:`size-3.5`})})}):(0,H.jsx)(K,{variant:`destructive`,size:`icon-xs`,"aria-label":p(n?`btn-delete-pair`:`btn-delete`),title:p(`btn-delete`),onClick:()=>l?.(t.id,n),children:(0,H.jsx)(Rt,{className:`size-3.5`})})]})]}),t.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.tags.map(e=>(0,H.jsx)(Hp,{content:p(`tooltip-tags`),className:`min-w-0 max-w-full`,children:(0,H.jsx)(nd,{keyword:e,active:d?.toLowerCase()===e.toLowerCase(),"aria-label":`${p(`tooltip-filter-keyword`)}: ${e}`,onClick:f})},e))}):null,(0,H.jsx)(`div`,{className:`rounded-lg border border-border bg-muted p-3`,children:(0,H.jsx)(Rp,{maxHeight:__,fade:`var(--muted)`,children:(0,H.jsx)(`div`,{className:`markdown-content text-sm prose-invert max-w-none`,dangerouslySetInnerHTML:{__html:g_(t.content)}})})}),n?(0,H.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,H.jsx)(ee,{className:`size-3`}),p(`text-from-below`),(0,H.jsx)(M,{className:`size-3`})]}):null,(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[p(`date-created`),` `,r.createdDate]}),r.updatedDate?(0,H.jsxs)(`span`,{children:[p(`date-updated`),` `,r.updatedDate]}):null,(0,H.jsxs)(`span`,{dir:`ltr`,className:`font-mono break-all`,children:[`ID: `,t.id]})]})]})}return null}function C_(e){let t=new Map(e.map(e=>[e.id,e])),n=[],r=new Set;for(let i of e)if(!r.has(i.id)){if(i.type===`memory`&&i.linkedPromptId&&t.has(i.linkedPromptId)){let e=t.get(i.linkedPromptId);n.push({isPair:!0,memory:i,prompt:e}),r.add(i.id),r.add(e.id)}else if(i.type===`prompt`&&i.linkedMemoryId&&t.has(i.linkedMemoryId)){let e=t.get(i.linkedMemoryId);n.push({isPair:!0,memory:e,prompt:i}),r.add(i.id),r.add(e.id)}else n.push({isPair:!1,type:i.type,item:i}),r.add(i.id)}return n.sort((e,t)=>{let n=e.isPair?e.memory.createdAt:e.item.createdAt,r=t.isPair?t.memory.createdAt:t.item.createdAt;return new Date(r).getTime()-new Date(n).getTime()})}function w_({memories:e,selectedIds:t,currentPage:n,totalPages:r,loading:i=!1,error:a=null,onSelect:o,onPageChange:s,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m}){let{t:h}=G(),g=(0,v.useMemo)(()=>C_(e),[e]),_=h(`text-page`,{current:n,total:r}),y=(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(K,{variant:`outline`,size:`icon-xs`,disabled:!(n>1),onClick:()=>s(-1),children:(0,H.jsx)(se,{className:`size-3.5`})}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:_}),(0,H.jsx)(K,{variant:`outline`,size:`icon-xs`,disabled:!(n<r),onClick:()=>s(1),children:(0,H.jsx)(ce,{className:`size-3.5`})})]});return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`div`,{className:`grid min-h-32 items-start gap-3 lg:grid-cols-2`,children:i&&e.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`loading-init`)}):a?(0,H.jsxs)(`div`,{className:`text-sm text-destructive py-8 text-center`,children:[`Error: `,a]}):g.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:h(`empty-memories`)}):g.map(e=>e.isPair?(0,H.jsx)(S_,{variant:`pair`,memory:e.memory,prompt:e.prompt,selected:t.has(e.memory.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.memory.id):e.type===`prompt`?(0,H.jsx)(S_,{variant:`prompt`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id):(0,H.jsx)(S_,{variant:`memory`,item:e.item,selected:t.has(e.item.id),onSelect:o,onPin:c,onUnpin:l,onEdit:u,onDeleteMemory:d,onDeletePrompt:f,activeKeyword:p,onKeywordClick:m},e.item.id))}),(0,H.jsx)(`div`,{className:`flex justify-end`,children:y})]})}function T_(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=!1;return di.status().then(t=>{e||n(t.success?t.data??null:null)}),()=>{e=!0}},[e,r]),{record:t,reload:(0,v.useCallback)(()=>i(e=>e+1),[])}}function E_(e){return e!==null}function D_(e){return{createdAt:e.createdAt,merged:e.merged,removed:e.removed}}function O_(e,t){return e===`idle`&&t===`open`?`confirming`:e===`confirming`&&t===`cancel`?`idle`:e===`confirming`&&t===`confirm`?`working`:e===`working`&&t===`done`?`idle`:e}function k_(e,t){return e===`confirming`&&t===`confirm`}function A_(e){return{key:e.notFound>0?`toast-auto-cleanup-undone-partial`:`toast-auto-cleanup-undone`,params:{restored:e.restored,notFound:e.notFound}}}function j_({version:e,onUndone:t}){let{t:n}=G(),{record:r,reload:i}=T_(e),[a,o]=(0,v.useState)(`idle`);if(!E_(r)||!r)return null;async function s(){if(!k_(a,`confirm`))return;o(O_(a,`confirm`));let e=await di.undo();if(o(`idle`),i(),!e.success||!e.data){U.info(e.error||n(`toast-auto-cleanup-undo-failed`));return}let r=A_(e.data);U.success(n(r.key,r.params)),t?.()}let c=D_(r);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>o(O_(a,`open`)),children:[(0,H.jsx)(Vt,{className:`size-3.5`}),n(`btn-auto-cleanup-undo`)]}),(0,H.jsx)(zl,{open:a!==`idle`,onOpenChange:e=>{e||o(O_(a,`cancel`))},children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:n(`title-auto-cleanup-undo`)}),(0,H.jsx)(Gl,{children:n(`label-auto-cleanup-undo-body`,{when:Qp(new Date(c.createdAt).toISOString()),merged:c.merged,removed:c.removed})})]}),(0,H.jsxs)(Ul,{className:`gap-2`,children:[(0,H.jsx)(K,{variant:`secondary`,size:`sm`,disabled:a===`working`,onClick:()=>o(O_(a,`cancel`)),children:n(`btn-cancel`)}),(0,H.jsx)(K,{size:`sm`,disabled:a===`working`,onClick:()=>void s(),children:n(`btn-auto-cleanup-undo-confirm`)})]})]})})]})}var M_=Ba(`grid min-w-0 gap-0.5 rounded-xl border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_minmax(0,1fr)] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 group/alert relative w-full`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive-label bg-card *:data-[slot=alert-description]:text-destructive-label *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function N_({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:V(M_({variant:t}),e),...n})}function P_({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-description`,className:V(`text-muted-foreground text-sm [&_p]:leading-relaxed col-start-2`,e),...t})}function F_(e){if(!e)return null;let t=e.status;switch(t.state){case`grouping`:return{kind:`grouping`};case`checking`:return t.total>0?{kind:`checking`,done:t.done,total:t.total}:{kind:`grouping`};case`done`:return{kind:`ready`,groups:t.preview.groups.length};case`failed`:return{kind:`failed`,error:t.error}}}function I_(e){return e?.status.state===`grouping`||e?.status.state===`checking`}var L_=3e3;function R_(e){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(e)return;let t=!1,r,i=async()=>{let e=await oi(`/api/user-profile/category-cleanup`);if(t)return;let a=e.success?e.data??null:null;n(a),I_(a)&&(r=setTimeout(()=>void i(),L_))};return i(),()=>{t=!0,clearTimeout(r)}},[e]),t}function z_({paused:e,onOpen:t}){let{t:n}=G(),r=F_(R_(e));if(e||!r)return null;let i=r.kind===`failed`;return(0,H.jsx)(N_,{variant:i?`destructive`:`default`,role:i?`alert`:`status`,children:(0,H.jsxs)(`div`,{className:`col-start-1 flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 break-words`,children:[r.kind===`grouping`&&n(`label-category-cleanup-loading`),r.kind===`checking`&&n(`label-category-cleanup-progress`,{done:r.done,total:r.total}),r.kind===`ready`&&n(`label-category-cleanup-banner-ready`,{groups:r.groups}),r.kind===`failed`&&(0,H.jsxs)(H.Fragment,{children:[n(`label-category-cleanup-banner-failed`),` `,(0,H.jsx)(`bdi`,{children:r.error})]})]}),(0,H.jsx)(K,{variant:`outline`,size:`xs`,onClick:t,children:n(`btn-category-cleanup-banner-open`)})]})})}var B_=Object.defineProperty,V_=(e,t)=>B_(e,`name`,{value:t,configurable:!0}),H_=v.createContext(void 0);function U_(e){let t=v.useContext(H_);return e||t||`ltr`}V_(U_,`useDirection`);var W_=Object.defineProperty,G_=(e,t)=>W_(e,`name`,{value:t,configurable:!0});function K_(e,[t,n]){return Math.min(n,Math.max(t,e))}G_(K_,`clamp`);var q_=Object.defineProperty,J_=(e,t)=>q_(e,`name`,{value:t,configurable:!0});function Y_(e,t){return v.useReducer((e,n)=>t[e][n]??e,e)}J_(Y_,`useStateMachine`);var X_=`ScrollArea`,[Z_,Q_]=qa(X_),[$_,ev]=Z_(X_),tv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[p,m]=v.useState(null),[h,g]=v.useState(null),[_,y]=v.useState(0),[b,x]=v.useState(0),[S,C]=v.useState(!1),[w,T]=v.useState(!1),E=xa(t,c),D=U_(i);return(0,H.jsx)($_,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:w,onScrollbarYEnabledChange:T,onCornerWidthChange:y,onCornerHeightChange:x,children:(0,H.jsx)(Mo.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":b+`px`,...e.style}})})},`ScrollArea`)),nv=`ScrollAreaViewport`,rv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=ev(nv,n),s=xa(t,v.useRef(null),o.onViewportChange);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(iv,{nonce:i}),(0,H.jsx)(Mo.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,H.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),iv=v.memo(J_(function({nonce:e}){return(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),av=`ScrollAreaScrollbar`,ov=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=ev(av,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return v.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,H.jsx)(sv,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,H.jsx)(cv,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,H.jsx)(lv,{...r,ref:t,forceMount:n}):i.type===`always`?(0,H.jsx)(uv,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),sv=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=ev(av,e.__scopeScrollArea),[a,o]=v.useState(!1);return v.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=J_(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=J_(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,H.jsx)(wo,{present:n||a,children:(0,H.jsx)(lv,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),cv=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=ev(av,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Av(()=>c(`SCROLL_END`),100),[s,c]=Y_(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return v.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),v.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=J_(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,H.jsx)(wo,{present:n||s!==`hidden`,children:(0,H.jsx)(uv,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:Qa(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:Qa(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),lv=v.forwardRef(J_(function(e,t){let n=ev(av,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=v.useState(!1),s=e.orientation===`horizontal`,c=Av(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return jv(n.viewport,c),jv(n.content,c),(0,H.jsx)(wo,{present:r||a,children:(0,H.jsx)(uv,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),uv=v.forwardRef(J_(function(e,t){let{orientation:n=`vertical`,...r}=e,i=ev(av,e.__scopeScrollArea),a=v.useRef(null),o=v.useRef(0),[s,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Cv(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:J_(e=>a.current=e,`onThumbChange`),onThumbPointerUp:J_(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:J_(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return Tv(e,o.current,s,t)}return J_(d,`getScrollPosition`),n===`horizontal`?(0,H.jsx)(dv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Ev(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,H.jsx)(fv,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Ev(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),dv=v.forwardRef(J_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=ev(av,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarXChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(hv,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":wv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Ov(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Sv(o.paddingLeft),paddingEnd:Sv(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),fv=v.forwardRef(J_(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=ev(av,e.__scopeScrollArea),[o,s]=v.useState(),c=v.useRef(null),l=xa(t,c,a.onScrollbarYChange);return v.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,H.jsx)(hv,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":wv(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Ov(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Sv(o.paddingTop),paddingEnd:Sv(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[pv,mv]=Z_(av),hv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=ev(av,n),[m,h]=v.useState(null),g=xa(t,h),_=v.useRef(null),y=v.useRef(``),b=p.viewport,x=r.content-r.viewport,S=os(u),C=os(c),w=Av(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return J_(T,`handleDragScroll`),v.useEffect(()=>{let e=J_(e=>{let t=e.target;m?.contains(t)&&S(e,x)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[b,m,x,S]),v.useEffect(C,[r,C]),jv(m,w),jv(p.content,w),(0,H.jsx)(pv,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:os(a),onThumbPointerUp:os(o),onThumbPositionChange:C,onThumbPointerDown:os(s),children:(0,H.jsx)(Mo.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:Qa(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:Qa(e.onPointerMove,T),onPointerUp:Qa(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),gv=`ScrollAreaThumb`,_v=v.forwardRef(J_(function(e,t){let{forceMount:n,...r}=e,i=mv(gv,e.__scopeScrollArea);return(0,H.jsx)(wo,{present:n||i.hasThumb,children:(0,H.jsx)(vv,{ref:t,...r})})},`ScrollAreaThumb`)),vv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=ev(gv,n),o=mv(gv,n),{onThumbPositionChange:s}=o,c=xa(t,o.onThumbChange),l=v.useRef(void 0),u=Av(()=>{l.current&&=(l.current(),void 0)},100);return v.useEffect(()=>{let e=a.viewport;if(e){let t=J_(()=>{if(u(),!l.current){let t=kv(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,H.jsx)(Mo.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:Qa(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:Qa(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),yv=`ScrollAreaCorner`,bv=v.forwardRef(J_(function(e,t){let n=ev(yv,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,H.jsx)(xv,{...e,ref:t}):null},`ScrollAreaCorner`)),xv=v.forwardRef(J_(function(e,t){let{__scopeScrollArea:n,...r}=e,i=ev(yv,n),[a,o]=v.useState(0),[s,c]=v.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return jv(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),jv(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),v.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,H.jsx)(Mo.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function Sv(e){return e?parseInt(e,10):0}J_(Sv,`toInt`);function Cv(e,t){let n=e/t;return isNaN(n)?0:n}J_(Cv,`getThumbRatio`);function wv(e){let t=Cv(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}J_(wv,`getThumbSize`);function Tv(e,t,n,r=`ltr`){let i=wv(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Dv([c,l],d)(e)}J_(Tv,`getScrollPositionFromPointer`);function Ev(e,t,n=`ltr`){let r=wv(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=K_(e,n===`ltr`?[0,o]:[o*-1,0]);return Dv([0,o],[0,s])(c)}J_(Ev,`getThumbOffsetFromScroll`);function Dv(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}J_(Dv,`linearScale`);function Ov(e,t){return e>0&&e<t}J_(Ov,`isScrollingWithinScrollbarBounds`);var kv=J_((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return J_((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function Av(e,t){let n=os(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}J_(Av,`useDebounceCallback`);function jv(e,t){let n=os(t);ro(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}J_(jv,`useResizeObserver`);var Mv=tv,Nv=rv,Pv=bv;function Fv({className:e,children:t,...n}){return(0,H.jsxs)(Mv,{"data-slot":`scroll-area`,className:V(`relative`,e),...n,children:[(0,H.jsx)(Nv,{"data-slot":`scroll-area-viewport`,className:`focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1`,children:t}),(0,H.jsx)(Iv,{}),(0,H.jsx)(Pv,{})]})}function Iv({className:e,orientation:t=`vertical`,...n}){return(0,H.jsx)(ov,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:V(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,H.jsx)(_v,{"data-slot":`scroll-area-thumb`,className:`bg-border relative flex-1 rounded-full`})})}function Lv({open:e=!1,profileId:t=``,onOpenChange:n}){let{t:r}=G(),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)([]);(0,v.useEffect)(()=>{e&&t&&c(t)},[e,t]);async function c(e){a(!0),s([]);let t=await oi(`/api/user-profile/changelog?profileId=${encodeURIComponent(e)}&limit=10`);a(!1),t.success&&t.data?s(t.data):s([])}return(0,H.jsx)(zl,{open:e,onOpenChange:n,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:r(`modal-changelog-title`)})}),(0,H.jsx)(Fv,{className:`max-h-80`,children:i?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`loading-changelog`)}):o.length===0?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-6 text-center`,children:r(`empty-changelog`)}):(0,H.jsx)(`div`,{className:`space-y-3 pr-3`,children:o.map((e,t)=>(0,H.jsxs)(`div`,{className:`rounded-lg border border-border p-3 space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`font-medium`,children:[`v`,e.version]}),(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:e.changeType}),(0,H.jsx)(`span`,{className:`text-muted-foreground ml-auto`,children:Qp(e.createdAt)})]}),(0,H.jsx)(`p`,{className:`text-sm`,children:e.changeSummary})]},`${e.version}-${t}`))})})]})})}function Rv({item:e,onOpen:t,focusKey:n}){let{t:r}=G(),i=Gu(e).length;return i===0?null:(0,H.jsxs)(K,{type:`button`,variant:`ghost`,size:`xs`,className:`-mx-1.5 h-5 cursor-pointer px-1.5 text-xs font-normal text-muted-foreground transition-colors duration-200 ease-in hover:bg-transparent hover:text-primary-label focus-visible:text-primary-label`,"aria-haspopup":`dialog`,"data-evidence-key":n,"aria-label":r(`evidence-open-label`,{count:i}),onClick:t,children:[(0,H.jsx)(Be,{className:`size-3`,"aria-hidden":`true`}),r(`evidence-count`,{count:i})]})}var zv={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function Bv({item:e,section:t}){let{t:n,language:r}=G(),i=Gu(e);return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`span`,{className:`text-xs font-medium tracking-wide text-muted-foreground`,children:[n(zv[t]),e.category?` · ${e.category}`:null]}),(0,H.jsx)(`p`,{dir:`auto`,className:`text-sm leading-6 break-words`,children:e.description}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-hit-count`,{count:e.frequency||1})})]}),(0,H.jsx)(Fv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[50vh] rounded-lg border`,children:(0,H.jsx)(`ol`,{className:`flex flex-col divide-y`,children:i.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex gap-3 px-3 py-2.5 text-sm leading-6`,children:[(0,H.jsx)(`span`,{className:`w-5 shrink-0 text-end text-xs leading-6 text-muted-foreground tabular-nums`,children:t+1}),e.kind===`manual-write`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-muted-foreground italic`,children:[(0,H.jsx)(pt,{className:`size-3.5`,"aria-hidden":`true`}),n(`evidence-manual-write`)]}):(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 whitespace-pre-wrap break-words`,children:e.text})]},t))})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`evidence-note`)})]})}function Vv({item:e,section:t,focusKey:n,onOpenChange:r}){let{t:i}=G(),a=(0,v.useRef)(null);return n&&(a.current=n),(0,H.jsx)(zl,{open:e!==null,onOpenChange:r,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,onCloseAutoFocus:e=>{let t=a.current,n=t?document.querySelector(`[data-evidence-key="${CSS.escape(t)}"]`):null;n&&(e.preventDefault(),n.focus())},children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:i(`evidence-dialog-title`)}),(0,H.jsx)(Gl,{className:`sr-only`,children:e?.description})]}),e?(0,H.jsx)(Bv,{item:e,section:t}):null]})})}function Hv({open:e=!1,type:t=null,index:n=0,action:r=`edit`,item:i=null,onOpenChange:a,onSaved:o}){let{t:s}=G(),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)([``]),[m,h]=(0,v.useState)(`1`),[g,_]=(0,v.useState)(!1),y=r===`edit`,b=t===`workflows`;(0,v.useEffect)(()=>{e&&i&&(l(i.category||``),d(i.description||``),p(i.steps?.length?[...i.steps]:[``]),h(`1`))},[e,i]);let x=y?s(`btn-edit`)||`Edit Item`:m===`2`?s(`confirm-delete-title`)||`Confirm Delete`:s(`confirm-delete`)||`Delete Item?`;function S(e){a?.(e)}function C(){p(e=>[...e,``])}function w(e){p(t=>{let n=t.filter((t,n)=>n!==e);return n.length===0?[``]:n})}function T(e,t){p(n=>n.map((n,r)=>r===e?t:n))}async function E(e){if(e.preventDefault(),!t)return;if(r===`delete`){if(m===`1`){h(`2`);return}_(!0);let e=await oi(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:t,index:n,action:`delete`})});_(!1),e.success?(U.success(s(`toast-delete-success`)||`Item deleted`),S(!1),o?.()):U.error(e.error||s(`toast-delete-failed`)||`Delete failed`);return}_(!0);let i={type:t,index:n,action:`edit`,category:b?void 0:c,description:u};t===`workflows`&&(i.steps=f.map(e=>e.trim()).filter(Boolean));let a=await oi(`/api/user-profile/item`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)});_(!1),a.success?(U.success(s(`toast-update-success`)||`Item updated`),S(!1),o?.()):U.error(a.error||s(`toast-update-failed`)||`Update failed`)}return(0,H.jsx)(zl,{open:e,onOpenChange:S,children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:x})}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:E,children:[y||m===`1`?(0,H.jsxs)(H.Fragment,{children:[b?null:(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`profile-item-category`,children:s(`label-category`)}),(0,H.jsx)(ad,{id:`profile-item-category`,value:c,onChange:e=>l(e.target.value),disabled:!y})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`profile-item-description`,children:s(`label-description`)}),(0,H.jsx)(Ip,{id:`profile-item-description`,rows:4,value:u,onChange:e=>d(e.target.value),disabled:!y})]}),b&&y?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{children:s(`label-steps`)}),(0,H.jsx)(`div`,{className:`space-y-2`,children:f.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground w-5 tabular-nums`,children:t+1}),(0,H.jsx)(ad,{value:e,placeholder:`Step ${t+1}...`,onChange:e=>T(t,e.target.value)}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,onClick:()=>w(t),children:`×`})]},t))}),(0,H.jsx)(K,{type:`button`,variant:`secondary`,size:`sm`,onClick:C,children:s(`btn-add-step`)})]}):null]}):null,(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`secondary`,onClick:()=>S(!1),children:s(`btn-cancel`)}),(0,H.jsx)(K,{type:`submit`,variant:y?`default`:`destructive`,disabled:g,children:y?s(`btn-save`)||`Save`:s(`btn-delete`)||`Delete`})]})]})]})})}var Uv=8;function Wv({label:e,children:t,className:n}){let r=v.useId(),i=v.useRef(null),a=v.useRef(null),[o,s]=v.useState(!1),[c,l]=v.useState(0);return v.useEffect(()=>{if(!o)return;let e=e=>{i.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[o]),v.useLayoutEffect(()=>{let e=a.current,t=i.current;if(!o||!e||!t)return;let n=t.getBoundingClientRect(),r=e.offsetWidth/2,s=n.left+n.width/2,c=document.documentElement.clientWidth,u=Math.min(Math.max(s,Uv+r),c-Uv-r);l(u-s)},[o]),(0,H.jsxs)(`span`,{ref:i,className:V(`relative inline-flex`,n),children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":e,"aria-expanded":o,"aria-controls":r,onClick:()=>s(e=>!e),className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors duration-150 outline-none hover:bg-interactive-hover hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring aria-expanded:bg-selection aria-expanded:text-foreground`,children:(0,H.jsx)(Be,{className:`size-3.5`,"aria-hidden":`true`})}),o?(0,H.jsx)(`div`,{ref:a,id:r,style:{transform:`translateX(calc(-50% + ${c}px))`},className:`absolute top-full left-1/2 z-30 mt-2 w-72 max-w-[calc(100vw-1rem)] rounded-lg border border-border bg-card p-3 text-start text-xs whitespace-normal text-card-foreground shadow-sm`,children:t}):null]})}var Gv=20;function Kv(e,t){let n=e.length,r=Math.max(1,Math.ceil(n/Gv)),i=Math.min(t,r),a=(i-1)*Gv;return{items:e.slice(a,a+Gv),total:n,totalPages:r,page:i,start:a}}function qv(e){return Math.round((e.confidence||0)*100)}function Jv({profile:e,loading:t=!1,onRefresh:n,onCleanup:r,onCategoryCleanup:i,categoryCleanupOpen:a=!1}){let{t:o}=G(),[s,c]=(0,v.useState)({pref:1,pat:1,wf:1}),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(0),[_,y]=(0,v.useState)(`edit`),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),w=(0,v.useMemo)(()=>{if(!e?.exists||!e.profileData)return null;let t=e.profileData;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}return t},[e]),T=(0,v.useMemo)(()=>{let e=[...w?.preferences??[],...w?.patterns??[]];return new Set(e.map(e=>e.category||`General`)).size},[w]),E=(0,v.useMemo)(()=>Vu(w?.preferences),[w]),D=(0,v.useMemo)(()=>Vu(w?.patterns),[w]),O=(0,v.useMemo)(()=>Vu(w?.workflows),[w]),k=(0,v.useMemo)(()=>O.map((e,t)=>({item:e,index:t})).sort((e,t)=>(t.item.frequency||0)-(e.item.frequency||0)),[O]),j=Kv(E,s.pref),M=Kv(D,s.pat),N=Kv(k,s.wf),P=O.length;function ee(e,t,n){let r=(e===`preferences`?E:e===`patterns`?D:O)[t];r&&(m(e),g(t),y(n),x(r),f(!0))}function F(e,t){return e.indexOf(t)}function I({page:e,pageKey:t}){return e.total<=Gv?null:(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-2`,children:[(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground me-2`,children:[e.start+1,`-`,Math.min(e.start+Gv,e.total),` / `,e.total]}),Array.from({length:e.totalPages},(e,t)=>t+1).map(n=>(0,H.jsx)(K,{size:`xs`,variant:n===e.page?`default`:`outline`,onClick:()=>c(e=>({...e,[t]:n})),children:n},n))]})}function te({item:e,type:t,fullList:n}){let r=F(n,e),i=qv(e);return(0,H.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-4 space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[t!==`workflows`||e.category?(0,H.jsx)(id,{variant:`outline`,className:`bg-transparent border-current [color:oklch(0.42_0.13_var(--category-hue))] dark:[color:oklch(0.8_0.13_var(--category-hue))]`,style:{"--category-hue":String(td(e.category||`General`))},children:e.category||`General`}):null,(0,H.jsxs)(`div`,{className:`flex items-center gap-0.5 ms-auto`,children:[(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:o(`btn-edit`)||`Edit`,onClick:()=>ee(t,r,`edit`),children:(0,H.jsx)(mt,{className:`size-3`})}),(0,H.jsx)(K,{variant:`ghost`,size:`icon-xs`,title:o(`btn-delete`)||`Delete`,onClick:()=>ee(t,r,`delete`),children:(0,H.jsx)(Rt,{className:`size-3`})})]}),(0,H.jsxs)(`div`,{className:V(`shrink-0 rounded-md border px-1.5 py-0.5 text-xs font-medium tabular-nums`,qu[Ku(i)]),title:`${o(`label-confidence`)}: ${i}%`,children:[i,`%`]})]}),(0,H.jsx)(`p`,{className:`text-sm break-words`,children:e.description||``}),e.steps?.length?(0,H.jsx)(`ol`,{className:`flex flex-col items-start gap-1.5`,children:e.steps.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex min-w-0 max-w-full items-start gap-2 rounded-2xl border border-blue-600/40 bg-blue-500/15 py-1 ps-1 pe-3 text-xs leading-5 text-blue-700 dark:text-blue-400`,children:[(0,H.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-blue-500/30 text-[11px] font-medium tabular-nums dark:bg-blue-400/30`,children:t+1}),(0,H.jsx)(`span`,{className:`min-w-0 break-words`,children:e})]},t))}):null,e.evidence||e.frequency?(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,title:o(`label-evidence-tooltip`,{count:e.frequency||1}),children:[(0,H.jsx)(It,{className:`size-3`}),e.frequency||1]}),Gu(e).length>0?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{children:`·`}),(0,H.jsx)(Rv,{item:e,focusKey:`${t}-${r}`,onOpen:()=>C({item:e,section:t,focusKey:`${t}-${r}`})})]}):null]}):null]})}return t&&!e?(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground py-8 text-center`,children:o(`loading-profile`)}):e?.exists?w?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h2`,{dir:`auto`,className:`text-section-title font-semibold break-words`,children:e.displayName||e.userId}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-version`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.version})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-prompts`)}),(0,H.jsx)(`span`,{className:`ms-1 font-mono`,children:e.totalPromptsAnalyzed})]}),(0,H.jsxs)(`span`,{className:`rounded-full bg-muted px-2.5 py-1 text-xs`,children:[(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:o(`profile-updated`)}),(0,H.jsx)(`span`,{className:`ms-1`,children:e.lastAnalyzedAt?Qp(e.lastAnalyzedAt):`—`})]}),(0,H.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(K,{variant:`outline`,size:`sm`,onClick:()=>r?.(),children:[(0,H.jsx)(At,{className:`size-3.5`}),o(`btn-ai-cleanup`)]}),(0,H.jsx)(Wv,{label:o(`label-more-info`),children:o(`help-ai-cleanup`)})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,H.jsxs)(K,{variant:`outline`,size:`sm`,onClick:()=>i?.(),children:[(0,H.jsx)(Ft,{className:`size-3.5`}),o(`btn-category-cleanup`),(0,H.jsx)(`span`,{className:`font-mono opacity-70`,title:o(`label-category-count-title`),children:T})]}),(0,H.jsx)(Wv,{label:o(`label-more-info`),children:o(`help-category-cleanup`)})]}),(0,H.jsx)(j_,{version:e.version,onUndone:n}),(0,H.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>n?.(),children:[(0,H.jsx)(xt,{className:`size-3.5`}),o(`btn-refresh`)]}),(0,H.jsxs)(K,{variant:`secondary`,size:`sm`,onClick:()=>u(!0),children:[(0,H.jsx)(Ct,{className:`size-3.5`}),`History`]})]})]}),(0,H.jsx)(z_,{paused:a,onOpen:()=>i?.()})]}),(0,H.jsxs)(`div`,{className:`grid gap-8`,children:[(0,H.jsxs)(`section`,{id:`profile-preferences`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Le,{className:`size-4`}),o(`profile-preferences`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:E.length})]}),E.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-preferences`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:j.items.map(e=>(0,H.jsx)(te,{item:e,type:`preferences`,fullList:E},F(E,e)))}),(0,H.jsx)(I,{page:j,pageKey:`pref`})]})]}),(0,H.jsxs)(`section`,{id:`profile-patterns`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(A,{className:`size-4`}),o(`profile-patterns`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:D.length})]}),D.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-patterns`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:M.items.map(e=>(0,H.jsx)(te,{item:e,type:`patterns`,fullList:D},F(D,e)))}),(0,H.jsx)(I,{page:M,pageKey:`pat`})]})]}),(0,H.jsxs)(`section`,{id:`profile-workflows`,className:`scroll-mt-4 space-y-3`,children:[(0,H.jsxs)(`h2`,{className:`flex flex-wrap items-center gap-2 text-section-title font-semibold`,children:[(0,H.jsx)(Gt,{className:`size-4`}),o(`profile-workflows`),(0,H.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:P})]}),P===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o(`empty-workflows`)}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`grid items-start gap-3 lg:grid-cols-2`,children:N.items.map(e=>(0,H.jsx)(te,{item:e.item,type:`workflows`,fullList:O},e.index))}),(0,H.jsx)(I,{page:N,pageKey:`wf`})]})]})]})]}),(0,H.jsx)(Lv,{open:l,onOpenChange:u,profileId:e?.id||``}),(0,H.jsx)(Hv,{open:d,onOpenChange:f,type:p,index:h,action:_,item:b,onSaved:n}),(0,H.jsx)(Vv,{item:S?.item??null,section:S?.section??`preferences`,focusKey:S?.focusKey??null,onOpenChange:e=>{e||C(null)}})]}):null:(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-10 text-muted-foreground`,children:[(0,H.jsx)(Ht,{className:`size-8`}),(0,H.jsx)(`p`,{className:`text-sm`,children:e?.message||o(`empty-preferences`)})]})}function Yv({open:e=!1,count:t=0,onOpenChange:n,onComplete:r}){let{t:i}=G(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(0);(0,v.useEffect)(()=>{e&&!a&&(c(i(`migration-found-tags`,{count:t})),u(0))},[e,a,t,i]);function d(e){a&&!e||n?.(e)}async function f(){o(!0),c(i(`status-migration-init`)),u(0);let e=!0,t=0,n=1e3;for(;e&&t<n;){t++;let n=await oi(`/api/migration/tags/run-batch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({batchSize:3})});if(!n.success||!n.data){c(i(`toast-migration-failed`)+`: `+(n.error||``)),o(!1);return}let r=n.data.processed;e=n.data.hasMore;let a=n.data.total;u(a>0?Math.round(r/a*100):0),c(i(`status-migration-progress`,{current:r,total:a})),e&&await new Promise(e=>setTimeout(e,100))}if(t>=n){c(i(`migration-stopped`)),o(!1);return}u(100),c(i(`toast-migration-success`)),U.success(i(`toast-migration-success`)),setTimeout(()=>{o(!1),d(!1),r?.()},2e3)}return(0,H.jsx)(zl,{open:e,onOpenChange:d,children:(0,H.jsxs)(q,{className:`sm:max-w-md`,showCloseButton:!a,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:i(`modal-migration-title`)})}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:s}),(0,H.jsx)(`div`,{className:`h-2 rounded-full bg-muted overflow-hidden`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary transition-all duration-200`,style:{width:`${l}%`}})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`migration-note`)})]}),a?null:(0,H.jsx)(Ul,{children:(0,H.jsxs)(K,{onClick:f,children:[(0,H.jsx)(gt,{className:`size-3.5`}),i(`btn-start-migration`)]})})]})})}var Xv=[{id:`settings-section-external-api`,title:`External API`},{id:`settings-section-models`,title:`Models`},{id:`settings-section-embedding`,title:`Embedding`},{id:`settings-section-keys`,title:`Keys and access`},{id:`settings-section-diagnostics`,title:`Capture diagnostics`},{id:`settings-section-health`,title:`Health`},{id:`settings-section-claude-folder`,title:`Claude Code folder`},{id:`settings-section-capture-language`,title:`Memory language`},{id:`settings-section-appearance`,title:`Appearance`},{id:`settings-section-profiles`,title:`Profiles`},{id:`settings-section-web-app`,title:`Web app`},{id:`settings-section-skill-learning`,title:`Skill learning`},{id:`settings-section-log`,title:`Log`}],Zv={"(empty prompt)":[`(空提示)`,`(مطالبة فارغة)`],"<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.":[`<private> 文本、API 密钥和密码将按原文存储,并在起草时发送到外部 API。`,`سيُخزَّن نص <private> ومفاتيح API وكلمات المرور كما كُتبت، وتُرسَل إلى واجهة API الخارجية عند الصياغة.`],"A project config turns recording off for this project.":[`项目配置已为此项目关闭记录。`,`يوقف إعداد المشروع التسجيل في هذا المشروع.`],Attention:[`关注度`,`الاهتمام`],"Add folder":[`添加文件夹`,`إضافة مجلد`],"All skills":[`所有技能`,`كل المهارات`],"Changes to SKILL.md":[`对 SKILL.md 的更改`,`التغييرات على SKILL.md`],"Delete recorded turns":[`删除已记录的回合`,`حذف الأدوار المسجلة`],"Delete {count} recorded turns? This cannot be undone.":[`删除 {count} 个已记录的回合?此操作无法撤销。`,`حذف {count} من الأدوار المسجلة؟ لا يمكن التراجع عن ذلك.`],"Deleted {count} recorded turns.":[`已删除 {count} 个已记录的回合。`,`تم حذف {count} من الأدوار المسجلة.`],"Draft improvement":[`起草改进`,`صياغة تحسين`],"Draft skill":[`起草技能`,`صياغة مهارة`],"Drafting needs the external API. Set it up first.":[`起草需要外部 API。请先设置。`,`تحتاج الصياغة إلى واجهة API الخارجية. أعدّها أولاً.`],"Drafting… This can take a few minutes.":[`正在起草…这可能需要几分钟。`,`جارٍ الصياغة… قد يستغرق ذلك بضع دقائق.`],"Evidence turns":[`证据回合`,`الأدوار الداعمة`],"Failed turns":[`失败的回合`,`الأدوار الفاشلة`],"File size":[`文件大小`,`حجم الملف`],"Finding past sessions…":[`正在查找过去的会话…`,`جارٍ البحث عن الجلسات السابقة…`],"Filter skills by name":[`按名称筛选技能`,`تصفية المهارات بالاسم`],"Find new skill ideas":[`查找新技能想法`,`البحث عن أفكار مهارات جديدة`],"Folder for the new skill":[`新技能的文件夹`,`مجلد المهارة الجديدة`],"Folder not found":[`未找到文件夹`,`المجلد غير موجود`],"Folder path":[`文件夹路径`,`مسار المجلد`],"Hide changes":[`隐藏更改`,`إخفاء التغييرات`],Improvement:[`改进`,`تحسين`],"Last seen":[`最近出现`,`آخر ظهور`],"Last use":[`上次使用`,`آخر استخدام`],"Loading…":[`加载中…`,`جارٍ التحميل…`],"Loading the proposal…":[`正在加载提案…`,`جارٍ تحميل المقترح…`],"The proposal could not be loaded. Select Show less, then Show more to try again.":[`无法加载该提案。选择“显示更少”,再选择“显示更多”即可重试。`,`تعذّر تحميل المقترح. اختر «عرض أقل» ثم «عرض المزيد» للمحاولة مرة أخرى.`],"Looking…":[`正在查找…`,`جارٍ البحث…`],Manual:[`手动`,`يدوي`],"Most calls":[`调用次数最多`,`الأكثر استدعاءً`],"Most used":[`最常用`,`الأكثر استخدامًا`],"Needs attention":[`需要关注`,`يحتاج إلى اهتمام`],"Sort skills":[`技能排序`,`ترتيب المهارات`],"New skill":[`新技能`,`مهارة جديدة`],"New skill ideas":[`新技能想法`,`أفكار مهارات جديدة`],"New turns will be stored as written.":[`新回合将按原文存储。`,`ستُخزَّن الأدوار الجديدة كما كُتبت.`],"No change proposed":[`没有建议更改`,`لم يُقترح أي تغيير`],"No content was saved.":[`没有保存内容。`,`لم يُحفظ أي محتوى.`],"No folders are watched.":[`没有监视的文件夹。`,`لا توجد مجلدات مراقبة.`],"No new skill ideas in the recorded turns.":[`已记录的回合中没有新的技能想法。`,`لا توجد أفكار مهارات جديدة في الأدوار المسجلة.`],"No proposals yet.":[`还没有提案。`,`لا توجد مقترحات بعد.`],"No recorded turns.":[`没有已记录的回合。`,`لا توجد أدوار مسجلة.`],"No skill matches this name.":[`没有技能匹配此名称。`,`لا توجد مهارة تطابق هذا الاسم.`],"No skills found in the watched folders.":[`在监视的文件夹中未找到技能。`,`لم يُعثر على مهارات في المجلدات المراقبة.`],"No turns are recorded yet.":[`还没有记录任何回合。`,`لم تُسجَّل أي أدوار بعد.`],"Not in a watched folder":[`不在监视的文件夹中`,`ليست في مجلد مراقب`],"Nothing is recorded yet. Agent turns are recorded only after you turn it on.":[`尚未记录任何内容。只有在你开启后才会记录智能体回合。`,`لم يُسجَّل شيء بعد. لا تُسجَّل أدوار الوكيل إلا بعد تشغيل ذلك.`],"OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.":[`OMMS 会把完整的提示、回复和工具调用存储在这台电脑上的 skills.db 中。起草时会把已记录的回合发送到外部 API。该文件包含回合中的所有内容。`,`يخزّن OMMS المطالبات والردود واستدعاءات الأدوات كاملةً في skills.db على هذا الجهاز. ترسل الصياغة الأدوار المسجلة إلى واجهة API الخارجية. يحتوي الملف على كل ما تحتويه الأدوار.`],"OMMS will change this SKILL.md file without asking. It drafts an improvement after 10 new uses and at least 24 hours, then applies it. Each change can be undone.":[`OMMS 会在不询问的情况下修改此 SKILL.md 文件。它在 10 次新使用且至少 24 小时后起草改进,然后直接应用。每次更改都可以撤销。`,`سيعدّل OMMS ملف SKILL.md هذا دون أن يسأل. يصوغ تحسيناً بعد 10 استخدامات جديدة و24 ساعة على الأقل، ثم يطبّقه. يمكن التراجع عن كل تغيير.`],"Skill learning watches how your agents use your skills on Pi, OpenCode and Claude Code. It ranks each skill by use and failed tool calls, and drafts better versions from real turns.":[`技能学习会观察你的智能体在 Pi、OpenCode 和 Claude Code 中如何使用你的技能。它按使用次数和失败的工具调用为每个技能排名,并根据真实回合起草更好的版本。`,`يراقب تعلّم المهارات كيف يستخدم وكلاؤك مهاراتك في Pi وOpenCode وClaude Code. يرتّب كل مهارة حسب الاستخدام واستدعاءات الأدوات الفاشلة، ويصوغ نسخاً أفضل من أدوار حقيقية.`],"Every draft is a proposal with a diff. Nothing changes a SKILL.md file until you apply it, unless you set that skill to Automatic. Undo restores the previous version.":[`每份草稿都是带差异对比的提案。在你应用之前,SKILL.md 文件不会改变,除非你把该技能设为“自动”。撤销会恢复之前的版本。`,`كل مسودة مقترح مع عرض للفروق. لا يتغيّر ملف SKILL.md حتى تطبّقه، إلا إذا ضبطت تلك المهارة على تلقائي. التراجع يعيد النسخة السابقة.`],"The memory chat sends skill counts and short change summaries to the external API, never turn text.":[`记忆聊天会把技能计数和简短的更改摘要发送到外部 API,绝不发送回合文本。`,`ترسل دردشة الذاكرة أعداد المهارات وملخصات التغييرات القصيرة إلى واجهة API الخارجية، ولا ترسل نص الأدوار أبداً.`],"Open the Skill learning card":[`打开“技能学习”卡片`,`افتح بطاقة تعلّم المهارات`],"No proposals are waiting.":[`没有等待处理的提案。`,`لا توجد مقترحات قيد الانتظار.`],"No proposals have been decided yet.":[`尚未处理任何提案。`,`لم يتم البتّ في أي مقترح بعد.`],"Pending proposals":[`待处理的提案`,`المقترحات المعلّقة`],Proposals:[`提案`,`المقترحات`],"Ranked skills":[`技能排名`,`المهارات مرتبةً`],"Recent turns":[`最近的回合`,`الأدوار الأخيرة`],"Recent proposals":[`最近的提案`,`المقترحات الأخيرة`],"Record agent turns":[`记录智能体回合`,`تسجيل أدوار الوكيل`],"Record agent turns so OMMS can rank your skills and draft improvements.":[`记录智能体回合,让 OMMS 为你的技能排名并起草改进。`,`سجّل أدوار الوكيل ليتمكن OMMS من ترتيب مهاراتك وصياغة التحسينات.`],"Record past turns":[`记录过去的回合`,`تسجيل الأدوار السابقة`],"Record past turns did not finish.":[`记录过去的回合未完成。`,`لم يكتمل تسجيل الأدوار السابقة.`],"Recorded turns":[`已记录的回合`,`الأدوار المسجلة`],"Recorded {count} past turns.":[`已记录 {count} 个过去的回合。`,`تم تسجيل {count} من الأدوار السابقة.`],Reject:[`拒绝`,`رفض`],"Remove folder":[`移除文件夹`,`إزالة المجلد`],"Remove folder {path}":[`移除文件夹 {path}`,`إزالة المجلد {path}`],"Remove private text and secrets":[`移除私密文本和机密`,`إزالة النص الخاص والأسرار`],"Reset default":[`恢复默认`,`استعادة الافتراضي`],"Saved.":[`已保存。`,`تم الحفظ.`],"Show changes":[`显示更改`,`عرض التغييرات`],"Skill learning":[`技能学习`,`تعلّم المهارات`],"Skill turns":[`技能回合`,`أدوار المهارات`],"Skill turns are recorded only while Record agent turns is on.":[`只有开启“记录智能体回合”时才会记录技能回合。`,`لا تُسجَّل أدوار المهارات إلا عند تشغيل تسجيل أدوار الوكيل.`],"Skill turns to record":[`待记录的技能回合`,`أدوار المهارات المراد تسجيلها`],"Skill turns already recorded":[`已记录的技能回合`,`أدوار المهارات المسجلة سابقاً`],"Skill turns recorded":[`本次记录的技能回合`,`أدوار المهارات المسجلة`],"Skill turns already present":[`已存在的技能回合`,`أدوار المهارات الموجودة مسبقاً`],Skills:[`技能`,`المهارات`],"Stale: the file changed since this draft":[`已过期:自起草以来文件已更改`,`قديم: تغيّر الملف منذ هذه المسودة`],"Stop removing private text and secrets?":[`停止移除私密文本和机密?`,`إيقاف إزالة النص الخاص والأسرار؟`],Suggested:[`建议`,`مقترحة`],"Turn off":[`关闭`,`إيقاف`],"Turn on Automatic":[`开启自动`,`تشغيل التلقائي`],"Turn on Automatic mode for this skill?":[`为此技能开启自动模式?`,`تشغيل الوضع التلقائي لهذه المهارة؟`],Undo:[`撤销`,`تراجع`],"Undo stopped because the file changed. This is the content OMMS saved:":[`撤销已停止,因为文件已更改。这是 OMMS 保存的内容:`,`توقف التراجع لأن الملف تغيّر. هذا هو المحتوى الذي حفظه OMMS:`],Uses:[`使用`,`الاستخدامات`],"Uses in 30 days":[`30 天内使用`,`الاستخدامات في 30 يوماً`],"Watched folders":[`监视的文件夹`,`المجلدات المراقبة`],applied:[`已应用`,`طُبّق`],"applied automatically":[`已自动应用`,`طُبّق تلقائياً`],rejected:[`已拒绝`,`مرفوض`],stale:[`已过期`,`قديم`],undone:[`已撤销`,`تم التراجع`],"{count} failed tool call":[`{count} 次工具调用失败`,`فشل استدعاء أداة واحد`],"{count} failed tool calls":[`{count} 次工具调用失败`,`فشل {count} من استدعاءات الأدوات`],"{count} skill":[`{count} 个技能`,`مهارة واحدة`],"{count} skills":[`{count} 个技能`,`المهارات: {count}`],Show:[`显示`,`عرض`],results:[`条结果`,`نتائج`],"Custom:":[`自定义:`,`مخصص:`],"Results per page":[`每页结果数`,`النتائج في كل صفحة`],"Custom results per page":[`自定义每页结果数`,`عدد مخصص للنتائج في كل صفحة`],"Sort by":[`排序方式`,`الترتيب حسب`],"Sort ascending":[`升序排列`,`ترتيب تصاعدي`],"Sort descending":[`降序排列`,`ترتيب تنازلي`],"Showing {from} to {to} of {total} results":[`显示第 {from} 到 {to} 条,共 {total} 条结果`,`عرض {from} إلى {to} من {total} نتيجة`],pagination:[`分页`,`ترقيم الصفحات`],"Go to previous page":[`转到上一页`,`الانتقال إلى الصفحة السابقة`],"Go to next page":[`转到下一页`,`الانتقال إلى الصفحة التالية`],"Go to page {page}":[`转到第 {page} 页`,`الانتقال إلى الصفحة {page}`],"More pages":[`更多页面`,`صفحات أخرى`],"Name (A–Z)":[`名称(A–Z)`,`الاسم (A–Z)`],Newest:[`最新`,`الأحدث`],Oldest:[`最早`,`الأقدم`],Skill:[`技能`,`المهارة`],Mode:[`模式`,`الوضع`],"Tool (A–Z)":[`工具(A–Z)`,`الأدوات (A–Z)`],Contents:[`目录`,`المحتويات`],"Show contents":[`显示目录`,`إظهار المحتويات`],"Hide contents":[`隐藏目录`,`إخفاء المحتويات`],"{count} proposal":[`{count} 个提案`,`مقترح واحد ({count})`],"{count} proposals":[`{count} 个提案`,`المقترحات: {count}`],"{count} turn":[`{count} 个回合`,`دور واحد ({count})`],"{count} turns":[`{count} 个回合`,`الأدوار: {count}`],"{count} failure group":[`{count} 个失败分组`,`مجموعة فشل واحدة ({count})`],"{count} failure groups":[`{count} 个失败分组`,`مجموعات فشل: {count}`],"{count} entry":[`{count} 条记录`,`إدخال واحد ({count})`],"{count} entries":[`{count} 条记录`,`الإدخالات: {count}`],"Created {date}":[`创建于 {date}`,`أُنشئ في {date}`],"Applied {date}":[`应用于 {date}`,`طُبّق في {date}`],"Rejected {date}":[`拒绝于 {date}`,`رُفض في {date}`],"Undone {date}":[`撤销于 {date}`,`تم التراجع في {date}`],"Stale since {date}":[`自 {date} 起已过期`,`قديم منذ {date}`],"Each card shows when the proposal was created and when it was last applied, rejected or undone.":[`每张卡片显示提案的创建时间,以及最近一次应用、拒绝或撤销的时间。`,`تعرض كل بطاقة وقت إنشاء المقترح ووقت آخر تطبيق أو رفض أو تراجع.`],History:[`历史记录`,`السجل`],created:[`已创建`,`أُنشئ`],"Each proposal, apply, reject and undo of this skill. Revert an applied change to restore SKILL.md as it was before it.":[`此技能的每个提案、应用、拒绝和撤销。还原已应用的更改可将 SKILL.md 恢复到该更改之前的状态。`,`كل مقترح وتطبيق ورفض وتراجع لهذه المهارة. أعِد تغييراً مطبّقاً لتستعيد SKILL.md كما كان قبله.`],"No history yet.":[`暂无历史记录。`,`لا يوجد سجل بعد.`],"{added} lines added, {removed} lines removed":[`新增 {added} 行,删除 {removed} 行`,`أُضيف {added} سطر، وحُذف {removed} سطر`],"Revert to before this change":[`还原到此更改之前`,`الرجوع إلى ما قبل هذا التغيير`],"Revert the newer change first.":[`请先还原较新的更改。`,`أعِد التغيير الأحدث أولاً.`],"Revert this change?":[`还原此更改?`,`هل تريد إعادة هذا التغيير؟`],"OMMS restores SKILL.md as it was before this change.":[`OMMS 会将 SKILL.md 恢复到此更改之前的状态。`,`يستعيد OMMS ملف SKILL.md كما كان قبل هذا التغيير.`],"Reverting this also removes {count} later change.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة تغيير لاحق واحد ({count}).`],"Reverting this also removes {count} later changes.":[`还原此更改也会移除之后的 {count} 个更改。`,`تؤدي إعادة هذا التغيير أيضاً إلى إزالة {count} من التغييرات اللاحقة.`],Revert:[`还原`,`إعادة`],"Reverting…":[`正在还原…`,`جارٍ الإعادة…`],"Reverted. SKILL.md is back to the version before that change.":[`已还原。SKILL.md 已恢复到该更改之前的版本。`,`تمت الإعادة. عاد SKILL.md إلى النسخة السابقة لذلك التغيير.`],Activity:[`活动`,`النشاط`],"Activity could not load.":[`无法加载活动。`,`تعذّر تحميل النشاط.`],"Active skills":[`活跃技能`,`المهارات النشطة`],"Uses per day":[`每日使用`,`الاستخدامات يومياً`],"Uses in the last 30 days":[`最近 30 天的使用`,`الاستخدامات في آخر 30 يوماً`],"Most used skills":[`最常用的技能`,`المهارات الأكثر استخداماً`],"Proposal pipeline":[`提案进度`,`مسار المقترحات`],Successful:[`成功`,`ناجح`],Day:[`日期`,`اليوم`],"{uses} uses, {failed} with a failed tool call":[`使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"{name} leads with {uses} uses. Click a bar to open the skill.":[`{name} 以 {uses} 次使用领先。点击条形可打开该技能。`,`تتصدر {name} بعدد {uses} استخدام. انقر على شريط لفتح المهارة.`],"{total} proposals, {pending} waiting for a decision":[`共 {total} 个提案,{pending} 个等待决定`,`{total} مقترح، منها {pending} بانتظار قرار`],"No uses in the last 30 days. Bars appear after OMMS records turns.":[`最近 30 天没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في آخر 30 يوماً. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"No skill was used in the last 30 days.":[`最近 30 天没有使用任何技能。`,`لم تُستخدم أي مهارة في آخر 30 يوماً.`],"No skill uses are recorded in the last 30 days. The use charts appear after OMMS records agent turns that use a skill.":[`最近 30 天没有记录到技能使用。OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`لا توجد استخدامات مسجلة للمهارات في آخر 30 يوماً. تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"Show uses by":[`使用次数显示方式`,`عرض الاستخدامات حسب`],Days:[`按天`,`الأيام`],Months:[`按月`,`الأشهر`],Years:[`按年`,`السنوات`],"Days to show":[`要显示的日期范围`,`الأيام المعروضة`],"Year to show":[`要显示的年份`,`السنة المعروضة`],"Last 30 days":[`最近 30 天`,`آخر 30 يوماً`],"Uses per month":[`每月使用`,`الاستخدامات شهرياً`],"Uses per year":[`每年使用`,`الاستخدامات سنوياً`],Month:[`月份`,`الشهر`],Year:[`年份`,`السنة`],"{from} to {to}":[`{from} 至 {to}`,`من {from} إلى {to}`],"Uses in {period}":[`{period} 的使用`,`الاستخدامات في {period}`],"{period}: {uses} uses, {failed} with a failed tool call":[`{period}:使用 {uses} 次,其中 {failed} 次有工具调用失败`,`{period}: {uses} استخدام، منها {failed} مع استدعاء أداة فاشل`],"No skill uses are recorded in {period}.":[`{period} 没有记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات في {period}.`],"No skill uses are recorded yet.":[`尚未记录到技能使用。`,`لا توجد استخدامات مسجلة للمهارات بعد.`],"The use charts appear after OMMS records agent turns that use a skill.":[`OMMS 记录使用技能的智能体回合后,会显示使用图表。`,`تظهر مخططات الاستخدام بعد أن يسجّل OMMS أدوار الوكلاء التي تستخدم مهارة.`],"No uses in this period. Bars appear after OMMS records turns.":[`此期间没有使用。OMMS 记录回合后会显示条形图。`,`لا توجد استخدامات في هذه الفترة. تظهر الأشرطة بعد أن يسجّل OMMS الأدوار.`],"Showing {shown} of {total}":[`显示 {shown} / {total}`,`عرض {shown} من {total}`],"Show more":[`显示更多`,`عرض المزيد`],"Show less":[`显示更少`,`عرض أقل`],lines:[`行`,`أسطر`],"Show {count} more":[`再显示 {count} 条`,`عرض {count} إضافية`],"Last modified":[`最近修改`,`آخر تعديل`],"Modified on {date}":[`修改于 {date}`,`تم التعديل في {date}`],"Show skills by modification":[`按是否修改显示技能`,`عرض المهارات حسب التعديل`],"All ({count})":[`全部({count})`,`الكل ({count})`],"Not modified ({count})":[`未修改({count})`,`غير معدّلة ({count})`],"Modified ({count})":[`已修改({count})`,`معدّلة ({count})`],"No skill has been modified yet.":[`尚未修改任何技能。`,`لم يتم تعديل أي مهارة بعد.`],"Every skill has been modified.":[`所有技能都已修改。`,`تم تعديل كل المهارات.`],"Suggested ({count})":[`建议({count})`,`مقترحة ({count})`],"No skill is suggested for a change yet.":[`尚无建议修改的技能。`,`لم تُقترح أي مهارة للتعديل بعد.`],"The state could not be saved, so SKILL.md is as it was. Try again.":[`无法保存状态,SKILL.md 保持原样。请重试。`,`تعذر حفظ الحالة، لذا بقي SKILL.md كما كان. حاول مرة أخرى.`],"No skill matches this name in this tab.":[`此标签页中没有技能匹配该名称。`,`لا توجد مهارة تطابق هذا الاسم في هذا التبويب.`],"No error text recorded":[`没有记录错误文本`,`لم يُسجَّل نص خطأ`],"Could not copy":[`无法复制`,`تعذّر النسخ`],"Show full input":[`显示完整输入`,`عرض الإدخال الكامل`],"Show less input":[`收起完整输入`,`إخفاء الإدخال الكامل`],"The server sent the first 20000 characters of this input.":[`服务器只发送了此输入的前 20000 个字符。`,`أرسل الخادم أول 20000 حرفاً من هذا الإدخال فقط.`],Copy:[`复制`,`نسخ`],Close:[`关闭`,`إغلاق`],"The failed calls could not be loaded.":[`无法加载失败的工具调用。`,`تعذّر تحميل الاستدعاءات الفاشلة.`],"Position {position}":[`位置 {position}`,`الموضع {position}`],Failures:[`失败记录`,`حالات الفشل`],"Failed calls that count against this skill, grouped by tool and first error line.":[`按工具和错误首行分组、计入此技能的失败调用。`,`الاستدعاءات الفاشلة التي تُحسب على هذه المهارة، مجمّعةً حسب الأداة وأول سطر في الخطأ.`],"No failed tool calls are recorded for this skill.":[`没有记录到计入此技能的失败工具调用。`,`لا توجد استدعاءات أدوات فاشلة مسجّلة لهذه المهارة.`],"no error text":[`无错误文本`,`بلا نص خطأ`],"{calls} call over {turns} turn":[`{calls} 次调用,涉及 {turns} 个回合`,`استدعاء واحد عبر دور واحد`],"{calls} call over {turns} turns":[`{calls} 次调用,涉及 {turns} 个回合`,`استدعاء واحد عبر {turns} أدوار`],"{calls} calls over {turns} turn":[`{calls} 次调用,涉及 {turns} 个回合`,`{calls} استدعاءات عبر دور واحد`],"{calls} calls over {turns} turns":[`{calls} 次调用,涉及 {turns} 个回合`,`{calls} استدعاءات عبر {turns} أدوار`],"{count} call is in this group; showing the latest {shown}.":[`此分组共有 {count} 次调用;显示最新的 {shown} 次。`,`هذه المجموعة تضم استدعاء واحداً؛ يُعرض آخر {shown} منه.`],"{count} calls are in this group; showing the latest {shown}.":[`此分组共有 {count} 次调用;显示最新的 {shown} 次。`,`هذه المجموعة تضم {count} استدعاء؛ يُعرض آخر {shown} منها.`],"Last seen {date}":[`最近出现于 {date}`,`آخر ظهور {date}`],"Explain failures":[`解释失败`,`شرح حالات الفشل`],"Explaining… This can take a few minutes.":[`正在解释…这可能需要几分钟。`,`جارٍ الشرح… قد يستغرق ذلك بضع دقائق.`],"Skill learning must be on to explain failures.":[`必须开启技能学习才能解释失败。`,`يجب تشغيل تعلّم المهارات لشرح حالات الفشل.`],"No failure groups to explain.":[`没有可解释的失败分组。`,`لا توجد مجموعات فشل لشرحها.`],"About Explain failures":[`关于“解释失败”`,`حول شرح حالات الفشل`],"Explaining needs the external API. Set it up first.":[`解释失败需要外部 API。请先设置。`,`يحتاج شرح الفشل إلى واجهة API الخارجية. أعدّها أولاً.`],"Send failures to the external API?":[`将失败记录发送到外部 API?`,`إرسال حالات الفشل إلى واجهة API الخارجية؟`],"Nothing is sent until you confirm. Nothing is saved.":[`确认之前不会发送任何内容,也不会保存任何内容。`,`لا يُرسَل شيء قبل التأكيد، ولا يُحفَظ شيء.`],"This sends the failure groups (tool names, error text and input excerpts of up to 500 characters) and this skill's SKILL.md to the external API model.":[`这会把失败分组(工具名称、错误文本和最多 500 字符的输入摘录)以及此技能的 SKILL.md 发送到外部 API 模型。`,`يرسل هذا مجموعات الفشل (أسماء الأدوات ونصوص الأخطاء ومقتطفات إدخال حتى 500 حرف) وملف SKILL.md لهذه المهارة إلى نموذج واجهة API الخارجية.`],"The text is sent as stored, after <private> removal and secret redaction.":[`文本按存储时的样子发送:已移除 <private> 内容并对机密进行脱敏。`,`يُرسَل النص كما خُزِّن: بعد إزالة <private> وإخفاء الأسرار.`],"Warning: redaction is off. The text may hold secrets that were not removed.":[`警告:脱敏已关闭。文本中可能含有未移除的机密。`,`تحذير: إخفاء الأسرار متوقف. قد يحمل النص أسراراً لم تُزَل.`],Cancel:[`取消`,`إلغاء`],"Skill fix":[`技能修复`,`إصلاح المهارة`],"Host or harness bug":[`宿主或框架缺陷`,`خلل في المضيف أو الإطار`],"Environment problem":[`环境问题`,`مشكلة في البيئة`],Unknown:[`未知`,`غير معروف`],"Suggested actions":[`建议操作`,`الإجراءات المقترحة`],"The labels and suggestions are leads from the error text only; the model cannot see the host's code.":[`标签和建议仅是来自错误文本的线索;模型看不到宿主的代码。`,`التسميات والاقتراحات مجرد مؤشرات من نص الخطأ فقط؛ لا يستطيع النموذج رؤية كود المضيف.`],"Import chat history":[`导入聊天记录`,`استيراد سجل المحادثات`],"Memory limits":[`记忆限制`,`حدود الذاكرة`],"Resolve missing project folders":[`解析缺失的项目文件夹`,`حل مجلدات المشاريع المفقودة`],"Project memories":[`项目记忆`,`ذاكرة المشروع`],"User profile":[`用户画像`,`الملف الشخصي للمستخدم`],"(preferences, patterns, and workflows)":[`(偏好、模式和工作流程)`,`(التفضيلات والأنماط وسير العمل)`],"All hosts":[`所有宿主`,`جميع المضيفين`],"Selected hosts":[`已选宿主`,`المضيفون المحددون`],"Choose at least one output.":[`请至少选择一项输出。`,`اختر مخرجاً واحداً على الأقل.`],"Choose at least one host.":[`请至少选择一个宿主。`,`اختر مضيفاً واحداً على الأقل.`],"Re-analyse handled history":[`重新分析已处理的记录`,`إعادة تحليل السجل المعالج`],"Re-analysis applies to the selected outputs. Each profile prompt can be forcibly re-analysed once. Findings merge into the existing profile.":[`重新分析适用于所选输出。每条画像提示只能强制重新分析一次。结果合并到现有画像中。`,`تنطبق إعادة التحليل على المخرجات المحددة. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة. تُدمج النتائج في الملف الحالي.`],"Preview the current selection before starting an import.":[`开始导入前,请预览当前选择。`,`عاين الاختيار الحالي قبل بدء الاستيراد.`],"This import makes model calls. Continue?":[`此次导入会调用模型。是否继续?`,`سيجري هذا الاستيراد اتصالات بالنموذج. هل تريد المتابعة؟`],"Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.":[`对话生成项目事实。用户提示生成个人偏好、重复模式和工作流程步骤。`,`تضيف المحادثات حقائق المشروع. وتضيف مطالبات المستخدم التفضيلات الشخصية والأنماط المتكررة وخطوات سير العمل.`],"Profile identity in Settings":[`设置中的画像身份`,`هوية الملف الشخصي في الإعدادات`],"Hosts keep their existing user identities. All hosts does not merge profiles with different identities.":[`各宿主保留现有用户身份。选择所有宿主不会合并不同身份的画像。`,`يحتفظ المضيفون بهويات المستخدم الحالية. اختيار جميع المضيفين لا يدمج ملفات الهويات المختلفة.`],"Pi session reader is unavailable. Fix the reader or deselect Pi.":[`Pi 会话读取器不可用。请修复读取器或取消选择 Pi。`,`قارئ جلسات Pi غير متاح. أصلح القارئ أو ألغِ تحديد Pi.`],"Import results":[`导入结果`,`نتائج الاستيراد`],"Import successful 🎉":[`导入成功`,`تم الاستيراد بنجاح`],"Import failed":[`导入失败`,`فشل الاستيراد`],"Import cancelled":[`导入已取消`,`تم إلغاء الاستيراد`],"The import finished while you were away.":[`导入在你离开时已结束。`,`انتهى الاستيراد أثناء غيابك.`],"Could not reload the settings. Reload the page.":[`无法重新加载设置。请刷新页面。`,`تعذر إعادة تحميل الإعدادات. أعد تحميل الصفحة.`],OK:[`确定`,`حسناً`],Dismiss:[`关闭`,`إغلاق`],"Show handled sessions":[`显示已处理的会话`,`إظهار الجلسات المعالجة`],Handled:[`已处理`,`تمت معالجتها`],"Handled sessions hidden":[`已隐藏的已处理会话`,`الجلسات المعالجة المخفية`],"Some memory units failed. Completed work is saved. A new preview and import retries only the failed units.":[`部分记忆单元失败。已完成的工作已保存。重新预览并导入只会重试失败的单元。`,`فشلت بعض وحدات الذاكرة. العمل المكتمل محفوظ. المعاينة والاستيراد الجديدان يعيدان محاولة الوحدات الفاشلة فقط.`],"Profile learning failed. Completed memory work is saved.":[`画像学习失败。已完成的记忆处理已保存。`,`فشل تعلّم الملف الشخصي. عمل الذاكرة المكتمل محفوظ.`],"Import preparation failed.":[`导入准备失败。`,`فشل تحضير الاستيراد.`],"Refresh the preview and retry.":[`请刷新预览后重试。`,`حدّث المعاينة ثم أعد المحاولة.`],"The session list is out of date. Refresh the list and try again.":[`会话列表已过期。请刷新列表后重试。`,`قائمة الجلسات قديمة. حدّث القائمة ثم أعد المحاولة.`],"The history source changed. Choose it again.":[`历史记录来源已更改。请重新选择。`,`تغيّر مصدر السجل. اختره مجدداً.`],"The history source is no longer valid. Choose it again.":[`历史记录来源已失效。请重新选择。`,`لم يعد مصدر السجل صالحاً. اختره مجدداً.`],"A Pi import is already running":[`已有 Pi 导入正在运行`,`استيراد Pi قيد التشغيل بالفعل`],"An OpenCode import is already running":[`已有 OpenCode 导入正在运行`,`استيراد OpenCode قيد التشغيل بالفعل`],"A Claude Code import is already running":[`已有 Claude Code 导入正在运行`,`استيراد Claude Code قيد التشغيل بالفعل`],"Combined counts":[`合计数量`,`الأعداد المجمعة`],"Current host":[`当前宿主`,`المضيف الحالي`],"Memory extraction":[`提取记忆`,`استخراج الذاكرة`],"Memory units":[`记忆单元`,`وحدات الذاكرة`],"Pending memory units":[`待处理记忆单元`,`وحدات الذاكرة المعلقة`],"Imported memory units":[`已导入记忆单元`,`وحدات الذاكرة المستوردة`],"Already handled memory units":[`已处理记忆单元`,`وحدات الذاكرة المعالجة سابقاً`],"Skipped memory units":[`已跳过记忆单元`,`وحدات الذاكرة المتخطاة`],"Failed memory units":[`失败的记忆单元`,`وحدات الذاكرة التي فشلت`],"Held-back turns":[`暂缓处理的轮次`,`الرسائل المؤجلة`],"Untimed turns":[`无时间戳的轮次`,`الرسائل بلا طابع زمني`],"Load errors":[`加载错误`,`أخطاء التحميل`],"Already handled profile prompts":[`已处理画像提示`,`مطالبات الملف الشخصي المعالجة سابقاً`],"Profile prompts":[`画像提示`,`مطالبات الملف الشخصي`],"Profile batches":[`画像批次`,`دفعات الملف الشخصي`],"Estimated profile analysis calls":[`预计画像分析调用次数`,`اتصالات تحليل الملف الشخصي المقدّرة`],"Waiting prompts inside OMMS":[`OMMS 内等待处理的提示`,`المطالبات المنتظرة داخل OMMS`],"No work to process":[`没有待处理工作`,`لا يوجد عمل للمعالجة`],queued:[`排队中`,`في الانتظار`],preparing:[`准备中`,`جارٍ التحضير`],"not-run":[`未运行`,`لم يُشغّل`],"Automatic profile cleanup":[`自动整理画像`,`التنظيف التلقائي للملف الشخصي`],"After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.":[`学习完成后,OMMS 会在后台自动合并重复的画像条目,并删除含糊的条目。每次运行大约每 100 个条目调用一次模型,在大型画像上需要几分钟。在“用户画像”页面选择“撤销上次自动整理”可恢复这些更改。`,`بعد كل جولة تعلّم، يدمج OMMS عناصر الملف الشخصي المكررة ويحذف العناصر الغامضة تلقائياً في الخلفية. تجري كل عملية نحو اتصال واحد بالنموذج لكل 100 عنصر وتستغرق عدة دقائق على الملف الكبير. يعيد خيار «تراجع عن آخر تنظيف تلقائي» في صفحة الملف الشخصي التغييرات.`],"Clean up the profile automatically":[`自动整理画像`,`تنظيف الملف الشخصي تلقائياً`],"Run every this many analysed prompts":[`每隔多少条已分析的提示运行一次`,`التشغيل كل عدد من المطالبات المحللة`],"Save interval":[`保存间隔`,`حفظ الفاصل`],"Enter a whole number from 50 to 100000.":[`请输入 50 到 100000 之间的整数。`,`أدخل عدداً صحيحاً من 50 إلى 100000.`],"Saved. Changes apply at the next learning pass.":[`已保存。更改将在下一次学习时生效。`,`تم الحفظ. تنطبق التغييرات في جولة التعلّم التالية.`],"Analyse waiting prompts":[`分析等待处理的提示`,`تحليل المطالبات المنتظرة`],"Re-analyse chat history":[`重新分析聊天记录`,`إعادة تحليل سجل المحادثات`],"Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.":[`分析等待处理的提示使用已保存的外部 API,读取 OMMS 内已有的提示,每次分析调用处理 50 条符合条件的提示。不会重新分析已完成的历史记录。输出包括偏好、模式和工作流程。`,`يقرأ تحليل المطالبات المنتظرة المطالبات الموجودة داخل OMMS عبر واجهة API الخارجية المحفوظة، بمعدل 50 مطالبة مؤهلة لكل اتصال تحليل. لا يُعاد تحليل السجل المكتمل. المخرجات هي التفضيلات والأنماط وسير العمل.`],"Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.":[`分析调用次数为估计值。匹配、去重、重试和新增的等待提示可能增加调用次数。`,`اتصالات التحليل تقديرية. قد تضيف المطابقة وإزالة التكرار وإعادة المحاولة والمطالبات المنتظرة الجديدة اتصالات أخرى.`],"Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.":[`重新分析聊天记录会打开强制仅导入画像的流程。现有画像和项目记忆将保留。必须先预览并确认。每条画像提示只能强制重新分析一次。`,`تفتح إعادة تحليل سجل المحادثات استيراداً قسرياً للملف الشخصي فقط. تُحفظ ذاكرة المشروع وملفك الشخصي. تلزم المعاينة والتأكيد. يمكن إعادة تحليل كل مطالبة للملف الشخصي بالقوة مرة واحدة.`],"Automatic import reads older conversations when a host starts. It populates project memories and user profile input. The first backfill fixes a cutoff; later turns use live capture.":[`自动导入在宿主启动时读取较早的对话,填充项目记忆和用户画像输入。首次回填固定截止时间,之后的轮次使用实时捕获。`,`يقرأ الاستيراد التلقائي المحادثات الأقدم عند بدء المضيف. ويضيف ذاكرة المشروع ومدخلات الملف الشخصي. يثبت أول استيراد تاريخاً فاصلاً؛ وتستخدم الرسائل اللاحقة الالتقاط المباشر.`],"A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.":[`目录映射将记录的项目文件夹链接到当前文件夹。保存的映射在下次导入或回填时全局应用于所有宿主。保存前请检查更改。`,`تربط خريطة المجلدات مجلد المشروع المسجل بمجلده الحالي. تنطبق الخرائط المحفوظة على جميع المضيفين في الاستيراد التالي. راجع التغييرات قبل الحفظ.`],"Prompt date from must not be after Prompt date to.":[`提示开始日期不能晚于结束日期。`,`يجب ألا يأتي تاريخ بدء المطالبات بعد تاريخ انتهائها.`],"Profile batch size must be a positive integer.":[`画像批次大小必须为正整数。`,`يجب أن يكون حجم دفعة الملف الشخصي عدداً صحيحاً موجباً.`],Models:[`模型`,`النماذج`],"External API fallback":[`外部 API 备用模型`,`النموذج الاحتياطي عبر واجهة API الخارجية`],none:[`无`,`لا يوجد`],ready:[`就绪`,`جاهز`],"not ready":[`未就绪`,`غير جاهز`],"Credentials (values hidden)":[`凭据(不显示内容)`,`بيانات الاعتماد (القيم مخفية)`],set:[`已设置`,`مضبوط`],"not set":[`未设置`,`غير مضبوط`],"Effective model":[`当前使用模型`,`النموذج المستخدم`],session:[`会话`,`الجلسة`],"external API":[`外部 API`,`واجهة API الخارجية`],unavailable:[`不可用`,`غير متاح`],"Project override is active. Changes to the global file may not take effect here.":[`项目设置优先。全局文件的更改可能不会在此生效。`,`إعدادات المشروع لها الأولوية. قد لا تسري تغييرات الملف العام هنا.`],"Model choice":[`模型选择`,`اختيار النموذج`],"Session model":[`会话模型`,`نموذج الجلسة`],"Manual model":[`手动选择模型`,`اختيار النموذج يدوياً`],"Manual provider/model":[`手动输入提供商/模型`,`إدخال المزوّد/النموذج يدوياً`],"Model list unavailable. Enter provider/model manually.":[`模型列表不可用。请手动输入提供商/模型。`,`قائمة النماذج غير متاحة. أدخل المزوّد/النموذج يدوياً.`],"OpenCode model list unavailable":[`OpenCode 模型列表不可用`,`قائمة نماذج OpenCode غير متاحة`],"OMMS could not find OpenCode on this computer, so it cannot list OpenCode's models here. Type the model as provider/model, for example zai-coding-plan/glm-5.3. If OpenCode is installed, open an OpenCode session and reload this page.":[`OMMS 在这台电脑上找不到 OpenCode,因此无法在此列出 OpenCode 的模型。请按 提供商/模型 格式输入模型,例如 zai-coding-plan/glm-5.3。如果已安装 OpenCode,请打开一个 OpenCode 会话,然后重新加载此页面。`,`لم يعثر OMMS على OpenCode في هذا الحاسوب، لذا لا يمكنه عرض نماذج OpenCode هنا. أدخل النموذج بصيغة المزوّد/النموذج، مثل zai-coding-plan/glm-5.3. إذا كان OpenCode مثبتاً، فافتح جلسة OpenCode ثم أعد تحميل هذه الصفحة.`],"OpenCode took too long to send its model list. Reload this page to try again, or type the model as provider/model.":[`OpenCode 发送模型列表的时间过长。请重新加载此页面重试,或按 提供商/模型 格式输入模型。`,`استغرق OpenCode وقتاً طويلاً لإرسال قائمة نماذجه. أعد تحميل هذه الصفحة للمحاولة مرة أخرى، أو أدخل النموذج بصيغة المزوّد/النموذج.`],"OpenCode has no signed-in models. Run `opencode auth login`, then reload this page.":["OpenCode 没有已登录的模型。请运行 `opencode auth login`,然后重新加载此页面。","لا توجد في OpenCode نماذج مسجَّل الدخول إليها. شغّل `opencode auth login` ثم أعد تحميل هذه الصفحة."],"This OpenCode version sent a model list OMMS cannot read. Type the model as provider/model. Update OMMS if this continues.":[`此版本的 OpenCode 发送的模型列表 OMMS 无法读取。请按 提供商/模型 格式输入模型。如果问题持续,请更新 OMMS。`,`أرسل هذا الإصدار من OpenCode قائمة نماذج لا يستطيع OMMS قراءتها. أدخل النموذج بصيغة المزوّد/النموذج. حدّث OMMS إذا استمرت المشكلة.`],"OMMS could not read Pi's model list. Type the model as provider/model.":[`OMMS 无法读取 Pi 的模型列表。请按 提供商/模型 格式输入模型。`,`تعذّر على OMMS قراءة قائمة نماذج Pi. أدخل النموذج بصيغة المزوّد/النموذج.`],"Pi has no signed-in models. Sign in to a provider in Pi, then reload this page.":[`Pi 没有已登录的模型。请在 Pi 中登录一个提供商,然后重新加载此页面。`,`لا توجد في Pi نماذج مسجَّل الدخول إليها. سجّل الدخول إلى مزوّد في Pi ثم أعد تحميل هذه الصفحة.`],"Save model":[`保存模型`,`حفظ النموذج`],"Enter a model as provider/model.":[`按 提供商/模型 格式输入。`,`أدخل النموذج بصيغة المزوّد/النموذج.`],"Saved. New capture and profile work uses these settings.":[`已保存。下一次捕获和用户画像将使用这些设置。`,`تم الحفظ. ستستخدم عمليات الالتقاط والملف الشخصي الجديدة هذه الإعدادات.`],"Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.":[`已保存。OMMS 现在读取 ~/.config/omms/omms.jsonc,旧配置保留。`,`تم الحفظ. يقرأ OMMS الآن الملف ~/.config/omms/omms.jsonc مع الاحتفاظ بالإعدادات القديمة.`],"Current settings were reloaded; check the values and save again.":[`已重新加载当前设置;检查数值后再次保存。`,`أُعيد تحميل الإعدادات الحالية. راجع القيم ثم احفظ مجدداً.`],"Capture diagnostics":[`捕获诊断`,`تشخيص الالتقاط`],"Time range":[`时间范围`,`الفترة الزمنية`],"24 hours":[`24 小时`,`24 ساعة`],"7 days":[`7 天`,`7 أيام`],"30 days":[`30 天`,`30 يوماً`],"90 days":[`90 天`,`90 يوماً`],"Host / model":[`主机 / 模型`,`المضيف / النموذج`],Saved:[`已保存`,`محفوظ`],Skipped:[`已跳过`,`متجاوز`],Failed:[`失败`,`فشل`],Total:[`总数`,`المجموع`],"Failure reasons":[`失败原因`,`أسباب الفشل`],"Recent attempts":[`最近尝试`,`المحاولات الأخيرة`],Time:[`时间`,`الوقت`],Host:[`主机`,`المضيف`],Source:[`来源`,`المصدر`],Session:[`会话`,`الجلسة`],Path:[`路径`,`المسار`],Model:[`模型`,`النموذج`],Stop:[`结束原因`,`سبب التوقف`],Blocks:[`区块`,`الكتل`],Prompt:[`提示词长度`,`طول الطلب`],Reply:[`回复长度`,`طول الرد`],Duration:[`耗时`,`المدة`],Outcome:[`结果`,`النتيجة`],Reason:[`原因`,`السبب`],"Save capture traces":[`保存捕获追踪`,`حفظ تتبعات الالتقاط`],"Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.":[`追踪文件在脱敏后仍可能包含对话内容。仅在调试时开启。`,`قد تحتوي التتبعات على محتوى المحادثة بعد التنقيح. فعّلها عند التصحيح فقط.`],"This project turns tracing off. The global switch cannot turn it on here.":[`此项目已关闭追踪。全局开关无法在此开启。`,`أوقف هذا المشروع التتبع. لا يمكن للمفتاح العام تفعيله هنا.`],"Trace retention (days)":[`追踪保留天数`,`مدة حفظ التتبعات (بالأيام)`],"Attempt retention (days)":[`尝试记录保留天数`,`مدة حفظ المحاولات (بالأيام)`],"Retry retention (hours)":[`重试保留小时数`,`مدة حفظ إعادة المحاولة (بالساعات)`],"When the capture model cannot be reached, OMMS keeps the turn and tries again later. Queued turns can hold conversation content after redaction. 0 turns the queue off and deletes waiting turns.":[`捕获模型无法访问时,OMMS 会保留该轮对话并稍后重试。排队的对话在脱敏后仍可能包含对话内容。设为 0 会关闭队列并删除等待中的对话。`,`عندما يتعذر الوصول إلى نموذج الالتقاط، يحتفظ OMMS بالجولة ويعيد المحاولة لاحقاً. قد تحتوي الجولات المنتظرة على محتوى المحادثة بعد التنقيح. القيمة 0 توقف قائمة الانتظار وتحذف الجولات المنتظرة.`],"Turns waiting for retry":[`等待重试的对话`,`الجولات المنتظرة لإعادة المحاولة`],"Retry now":[`立即重试`,`أعد المحاولة الآن`],"Retrying now.":[`正在重试。`,`تجري إعادة المحاولة الآن.`],"A retry is already running.":[`重试已在运行。`,`إعادة المحاولة قيد التشغيل بالفعل.`],"These turns retry at the next Pi session start.":[`这些对话将在下次启动 Pi 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Pi التالية.`],"These turns retry at the next OpenCode session start.":[`这些对话将在下次启动 OpenCode 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة OpenCode التالية.`],"These turns retry at the next Claude Code session start.":[`这些对话将在下次启动 Claude Code 会话时重试。`,`ستُعاد محاولة هذه الجولات عند بدء جلسة Claude Code التالية.`],"Claude Code capture uses the external API.":[`Claude Code 捕获使用外部 API。`,`يستخدم التقاط Claude Code واجهة API الخارجية.`],"Claude Code capture is off. Complete the external API settings.":[`Claude Code 捕获已关闭。请完成外部 API 设置。`,`التقاط Claude Code متوقف. أكمل إعدادات واجهة API الخارجية.`],"Missing settings":[`缺少的设置`,`الإعدادات الناقصة`],"memoryModel is not configured":[`未配置 memoryModel`,`لم يُضبط memoryModel`],"memoryApiUrl is not configured":[`未配置 memoryApiUrl`,`لم يُضبط memoryApiUrl`],"memoryApiKey is not configured":[`未配置 memoryApiKey`,`لم يُضبط memoryApiKey`],"memoryApiKey contains a placeholder value":[`memoryApiKey 包含占位值`,`يحتوي memoryApiKey على قيمة نائبة`],"Claude Code backfill always uses the external API. It has no backfill model setting.":[`Claude Code 回填始终使用外部 API,没有回填模型设置。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية، ولا يوجد له إعداد لنموذج الاستيراد.`],"Claude Code transcripts folder":[`Claude Code 对话记录文件夹`,`مجلد سجلات محادثات Claude Code`],"Claude Code transcripts":[`Claude Code 对话记录`,`سجلات محادثات Claude Code`],found:[`已找到`,`موجود`],"not found":[`未找到`,`غير موجود`],"Claude Code imports always use the external API.":[`Claude Code 导入始终使用外部 API。`,`يستخدم استيراد Claude Code دائماً واجهة API الخارجية.`],"Claude Code imports use the external API. Complete the external API settings.":[`Claude Code 导入使用外部 API。请完成外部 API 设置。`,`يستخدم استيراد Claude Code واجهة API الخارجية. أكمل إعدادات واجهة API الخارجية.`],"Trace files":[`追踪文件`,`ملفات التتبع`],View:[`查看`,`عرض`],Delete:[`删除`,`حذف`],Health:[`健康检查`,`فحص الحالة`],"Config files":[`配置文件`,`ملفات الإعدادات`],"Memory store":[`记忆存储`,`مخزن الذاكرة`],Embedding:[`嵌入模型`,`نموذج التضمين`],"Web binding":[`网页服务绑定`,`ربط خادم الويب`],"OpenCode model":[`OpenCode 模型`,`نموذج OpenCode`],"Pi model":[`Pi 模型`,`نموذج Pi`],"Capture failures (24 hours)":[`捕获失败(24 小时)`,`فشل الالتقاط (24 ساعة)`],"OpenCode model test":[`OpenCode 模型测试`,`اختبار نموذج OpenCode`],"Pi model test":[`Pi 模型测试`,`اختبار نموذج Pi`],"Run checks":[`运行检查`,`تشغيل الفحوصات`],"Run checks and test models":[`运行检查并测试模型`,`تشغيل الفحوصات واختبار النماذج`],"Checking…":[`正在检查…`,`جارٍ الفحص…`],pass:[`通过`,`نجاح`],warn:[`警告`,`تحذير`],fail:[`失败`,`فشل`],"Import and backfill":[`导入和回填`,`الاستيراد والاستكمال`],"Automatic import":[`自动导入`,`الاستيراد التلقائي`],"Automatic import makes model calls. Changes apply at the next host start. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。更改在下次启动主机时生效。关闭后,正在运行的导入将在当前轮次结束后停止。`,`يستدعي الاستيراد التلقائي النموذج. تسري التغييرات عند بدء المضيف التالي. يوقف التعطيل الاستيراد بعد التبادل الحالي.`],"Import past chats automatically":[`自动导入过去的对话`,`استيراد المحادثات السابقة تلقائياً`],"Backfill model":[`历史导入模型`,`نموذج استيراد السجل`],"Same as live capture":[`与实时捕获相同`,`مثل الالتقاط المباشر`],"Saved. Changes apply at the next host start.":[`已保存。更改在下次启动主机时生效。`,`تم الحفظ. تسري التغييرات عند بدء المضيف التالي.`],State:[`状态`,`الحالة`],"not started":[`尚未开始`,`لم يبدأ`],"not-started":[`尚未开始`,`لم يبدأ`],Imported:[`已导入`,`مستورَد`],Pending:[`待处理`,`معلّق`],"Unresolved sessions":[`目录未解析的会话`,`جلسات بمجلدات غير محددة`],Cutoff:[`截止时间`,`وقت القطع`],stopped:[`已停止`,`توقف`],"Web app":[`网页应用`,`تطبيق الويب`],"Start web app at login":[`登录时启动网页应用`,`بدء تطبيق الويب عند تسجيل الدخول`],"Login item":[`登录启动项`,`عنصر بدء تسجيل الدخول`],"not installed":[`未安装`,`غير مثبّت`],"not-installed":[`未安装`,`غير مثبّت`],installed:[`已安装`,`مثبّت`],unsupported:[`不受支持`,`غير مدعوم`],"no-runtime":[`缺少运行环境`,`بيئة التشغيل غير متاحة`],"no-package":[`缺少软件包`,`الحزمة غير متاحة`],"no-launcher":[`缺少启动器`,`المشغّل غير متاح`],"Login items are unsupported on this platform.":[`此平台不支持登录启动项。`,`عناصر بدء تسجيل الدخول غير مدعومة على هذا النظام.`],"Install Node or Bun to start the web app at login.":[`安装 Node 或 Bun 后,网页应用才能在登录时启动。`,`ثبّت Node أو Bun لبدء تطبيق الويب عند تسجيل الدخول.`],"Use these commands to apply the change now:":[`使用以下命令立即应用更改:`,`استخدم هذه الأوامر لتطبيق التغيير الآن:`],"Saved. The login item changes at the next Pi or OpenCode start.":[`已保存。登录启动项将在下次启动 Pi 或 OpenCode 时更新。`,`تم الحفظ. يتغير عنصر بدء التشغيل عند بدء Pi أو OpenCode التالي.`],"History host":[`历史记录主机`,`مضيف السجل`],Scope:[`范围`,`النطاق`],"Current project":[`当前项目`,`المشروع الحالي`],"All projects":[`所有项目`,`كل المشاريع`],"Project directory":[`项目目录`,`مجلد المشروع`],"Current directory":[`当前目录`,`المجلد الحالي`],"Profile batch size":[`用户画像批量大小`,`حجم دفعة الملف الشخصي`],"Directory maps (old=new, one per line)":[`目录映射(旧=新,每行一条)`,`تعيين المجلدات (قديم=جديد، واحد في كل سطر)`],"Force reimport":[`强制重新导入`,`فرض إعادة الاستيراد`],"Skip memories":[`跳过记忆`,`تجاوز الذكريات`],"Skip profile":[`跳过用户画像`,`تجاوز الملف الشخصي`],"Import model":[`导入模型`,`نموذج الاستيراد`],"Saved external API":[`已保存的外部 API`,`واجهة API الخارجية المحفوظة`],"Preview (dry run)":[`预览(不写入)`,`معاينة (تشغيل تجريبي)`],"Start import":[`开始导入`,`بدء الاستيراد`],"Cancel after current unit":[`完成当前单元后取消`,`الإلغاء بعد الوحدة الحالية`],"Directory maps must be old=new, one per line":[`目录映射须为 旧=新,每行一条`,`يجب أن يكون تعيين المجلدات بصيغة قديم=جديد، واحد في كل سطر`],running:[`运行中`,`جارٍ التشغيل`],cancelling:[`正在取消`,`جارٍ الإلغاء`],cancelled:[`已取消`,`أُلغي`],done:[`已完成`,`اكتمل`],failed:[`失败`,`فشل`],units:[`单元`,`وحدات`],"List sessions":[`列出会话`,`عرض الجلسات`],"Refresh list":[`刷新列表`,`تحديث القائمة`],"Advanced options":[`高级选项`,`خيارات متقدمة`],"Hide advanced options":[`隐藏高级选项`,`إخفاء الخيارات المتقدمة`],"default location":[`默认位置`,`الموقع الافتراضي`],"Prompt date from":[`提示日期起`,`تاريخ الطلب من`],"Prompt date to":[`提示日期止`,`تاريخ الطلب إلى`],"Prompt dates are inclusive, use your time zone, and filter the turns inside each session, not the list. Empty dates include every turn.":[`提示日期包含首尾两天,按你所在时区计算,只筛选每个会话中的对话轮次,不筛选列表。留空则包含所有轮次。`,`تواريخ الطلب شاملة لليومين، وتُحسب بمنطقتك الزمنية، وتُصفّي الأدوار داخل كل جلسة لا القائمة. تركها فارغة يشمل كل الأدوار.`],"Sessions with directories that no longer exist":[`目录已不存在的会话`,`جلسات لم تعد مجلداتها موجودة`],"Show them and add a directory map":[`显示它们并添加目录映射`,`اعرضها وأضف تعيين مجلد`],Selected:[`已选择`,`المحدد`],"Select all matching":[`选择所有匹配项`,`تحديد كل المطابق`],"Clear selection":[`清除选择`,`مسح التحديد`],Select:[`选择`,`تحديد`],Created:[`创建时间`,`تاريخ الإنشاء`],"Resolved by":[`解析方式`,`طريقة التحديد`],recorded:[`记录的目录`,`المجلد المسجّل`],mapped:[`目录映射`,`تعيين مجلد`],"project root":[`项目根目录`,`جذر المشروع`],missing:[`缺失`,`مفقود`],"No sessions match.":[`没有匹配的会话。`,`لا توجد جلسات مطابقة.`],Previous:[`上一页`,`السابق`],Next:[`下一页`,`التالي`],None:[`无`,`لا شيء`],"Configured, not tested.":[`已配置,未测试。`,`مُعدّ، لم يُختبر.`],"An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode.":[`使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。`,`يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode.`],"The chosen OpenCode model is not connected here. An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode. Choose the external API for a web import.":[`所选 OpenCode 模型在此处未连接。使用 OpenCode 已登录模型的导入需在终端运行,或在 OpenCode 中使用 /import。网页导入请选择外部 API。`,`نموذج OpenCode المختار غير متصل هنا. يتم الاستيراد بنموذج OpenCode المسجَّل الدخول من الطرفية أو بالأمر /import داخل OpenCode. اختر واجهة API الخارجية للاستيراد من الصفحة.`],"Test models in Health":[`在健康检查中测试模型`,`اختبر النماذج في قسم السلامة`],Import:[`导入`,`استيراد`],sessions:[`个会话`,`جلسات`],"1 session":[`1 个会话`,`جلسة واحدة`],"List sessions first.":[`请先列出会话。`,`اعرض الجلسات أولاً.`],"Options changed. Refresh the session list first.":[`选项已更改。请先刷新会话列表。`,`تغيّرت الخيارات. حدّث قائمة الجلسات أولاً.`],"Select at least one session.":[`请至少选择一个会话。`,`حدّد جلسة واحدة على الأقل.`],"Select at most 1000 sessions one by one, or use Select all matching.":[`逐个选择最多 1000 个会话,或使用“选择所有匹配项”。`,`حدّد 1000 جلسة كحد أقصى واحدة تلو الأخرى، أو استخدم «تحديد كل المطابق».`],"Model readiness is unknown. Reload the page.":[`无法确定模型是否就绪。请重新加载页面。`,`حالة جاهزية النموذج غير معروفة. أعد تحميل الصفحة.`],"No import model is ready. Connect a model in OpenCode or complete the external API settings.":[`没有可用的导入模型。请在 OpenCode 中连接模型,或补全外部 API 设置。`,`لا يوجد نموذج استيراد جاهز. اربط نموذجاً في OpenCode أو أكمل إعدادات واجهة API الخارجية.`],"The external API is not ready":[`外部 API 未就绪`,`واجهة API الخارجية غير جاهزة`],"The external API has no memoryModel in the global config":[`全局配置中缺少外部 API 的 memoryModel`,`لا يحتوي الإعداد العام على memoryModel لواجهة API الخارجية`],"The external API has no memoryApiUrl in the global config":[`全局配置中缺少外部 API 的 memoryApiUrl`,`لا يحتوي الإعداد العام على memoryApiUrl لواجهة API الخارجية`],"The external API key is missing in the OpenCode process; check memoryApiKey and its env:// or file:// source":[`OpenCode 进程中缺少外部 API 密钥;请检查 memoryApiKey 及其 env:// 或 file:// 来源`,`مفتاح واجهة API الخارجية غير موجود في عملية OpenCode؛ تحقّق من memoryApiKey ومصدره env:// أو file://`],"The memoryProvider in the global config is not supported for imports":[`全局配置中的 memoryProvider 不支持导入`,`مزوّد memoryProvider في الإعداد العام غير مدعوم للاستيراد`],"Pi sessions folder or one .jsonl session file":[`Pi 会话文件夹或单个 .jsonl 会话文件`,`مجلد جلسات Pi أو ملف جلسة .jsonl واحد`],"OpenCode database file":[`OpenCode 数据库文件`,`ملف قاعدة بيانات OpenCode`],"Absolute path, for example on a mounted volume":[`绝对路径,例如已挂载卷上的路径`,`مسار مطلق، مثلاً على وحدة تخزين مركّبة`],"Use this source":[`使用此来源`,`استخدم هذا المصدر`],Browse:[`浏览`,`استعراض`],"Use the default location":[`使用默认位置`,`استخدم الموقع الافتراضي`],"Chosen source":[`已选来源`,`المصدر المختار`],Choose:[`选择`,`اختيار`],"Only the first 500 entries are shown.":[`仅显示前 500 项。`,`تُعرض أول 500 عنصر فقط.`],"Reload the page before saving again.":[`再次保存前请重新加载页面。`,`أعد تحميل الصفحة قبل الحفظ مرة أخرى.`],"The current settings could not be reloaded. Reload the page.":[`无法重新加载当前设置。请重新加载页面。`,`تعذّر إعادة تحميل الإعدادات الحالية. أعد تحميل الصفحة.`],Log:[`日志`,`السجل`],"Capture attempts only":[`仅显示捕获尝试`,`محاولات الالتقاط فقط`],Refresh:[`刷新`,`تحديث`],"Copy log path":[`复制日志路径`,`نسخ مسار السجل`],"Log lines":[`日志行`,`أسطر السجل`],"No log has been written yet.":[`尚未写入日志。`,`لم يُكتب سجل بعد.`],"Loading log…":[`正在加载日志…`,`جارٍ تحميل السجل…`],Level:[`级别`,`المستوى`],Warning:[`警告`,`تحذير`],Error:[`错误`,`خطأ`],info:[`信息`,`معلومات`],error:[`错误`,`خطأ`],"Level guessed from the message":[`级别由消息内容推测`,`المستوى مُخمَّن من نص الرسالة`],"Copy visible records":[`复制可见记录`,`نسخ السجلات المعروضة`],Copied:[`已复制`,`تم النسخ`],"No matching log records.":[`没有匹配的日志记录。`,`لا توجد سجلات مطابقة.`],"External API":[`外部 API`,`واجهة API الخارجية`],"An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.":[`兼容 OpenAI 或 Anthropic 的端点,两个宿主都可用于捕获和回填。`,`نقطة نهاية متوافقة مع OpenAI أو Anthropic يمكن لأي مضيف استخدامها للالتقاط والاستيراد.`],Provider:[`提供商`,`المزوّد`],"API URL":[`API 地址`,`عنوان API`],"API key":[`API 密钥`,`مفتاح API`],"Save endpoint":[`保存端点`,`حفظ نقطة النهاية`],"Nothing to save.":[`没有需要保存的内容。`,`لا يوجد ما يُحفظ.`],"Key source":[`密钥来源`,`مصدر المفتاح`],"environment variable":[`环境变量`,`متغير البيئة`],"key file":[`密钥文件`,`ملف المفتاح`],"set in the config file":[`在配置文件中设置`,`مضبوط في ملف الإعدادات`],"resolves in the web app":[`可在网页应用中解析`,`يُقرأ في تطبيق الويب`],"does not resolve in the web app":[`无法在网页应用中解析`,`لا يُقرأ في تطبيق الويب`],"A login web app does not see variables set only in a shell profile; a key file works everywhere.":[`登录时启动的网页应用看不到仅在 shell 配置文件中设置的变量;密钥文件在任何地方都可用。`,`تطبيق الويب الذي يبدأ عند تسجيل الدخول لا يرى المتغيرات المضبوطة في ملف الصدفة فقط؛ ملف المفتاح يعمل في كل مكان.`],"The key does not resolve in this web app. Save it to a key file instead.":[`此网页应用无法解析该密钥。请改为保存到密钥文件。`,`لا يُقرأ المفتاح في تطبيق الويب هذا. احفظه في ملف مفتاح بدلاً من ذلك.`],"Environment variable":[`环境变量`,`متغير البيئة`],"Key file":[`密钥文件`,`ملف المفتاح`],"Save key to a private file":[`将密钥保存到私有文件`,`حفظ المفتاح في ملف خاص`],"Variable name":[`变量名`,`اسم المتغير`],"Key file path":[`密钥文件路径`,`مسار ملف المفتاح`],"Key file name":[`密钥文件名`,`اسم ملف المفتاح`],"The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.":[`密钥写入 ~/.config/omms/secrets/,仅你可读,之后不再显示。`,`يُكتب المفتاح في ~/.config/omms/secrets/ ولا يقرؤه غيرك، ولن يُعرض مرة أخرى.`],"Save key source":[`保存密钥来源`,`حفظ مصدر المفتاح`],"Key source saved.":[`密钥来源已保存。`,`تم حفظ مصدر المفتاح.`],"A key file with this name exists. Replace it?":[`已存在同名密钥文件。要替换吗?`,`يوجد ملف مفتاح بهذا الاسم. هل تريد استبداله؟`],"Enter a variable name such as ZAI_API_KEY":[`请输入变量名,例如 ZAI_API_KEY`,`أدخل اسم متغير مثل ZAI_API_KEY`],"Enter the path of a key file":[`请输入密钥文件路径`,`أدخل مسار ملف المفتاح`],"Name the key file with letters, digits, dashes, or underscores":[`密钥文件名只能包含字母、数字、短横线或下划线`,`سمِّ ملف المفتاح بحروف أو أرقام أو شرطات أو شرطات سفلية`],"Paste the key":[`请粘贴密钥`,`الصق المفتاح`],Test:[`测试`,`اختبار`],"Test call succeeded":[`测试调用成功`,`نجح استدعاء الاختبار`],"Test call failed":[`测试调用失败`,`فشل استدعاء الاختبار`],"External API needs":[`外部 API 缺少`,`تحتاج واجهة API الخارجية إلى`],"Automatic import makes model calls. A model change applies at the next run. Turning it off stops a running import after the current exchange.":[`自动导入会调用模型。模型更改在下次运行时生效。关闭后,正在进行的导入会在当前对话完成后停止。`,`يستدعي الاستيراد التلقائي النماذج. يسري تغيير النموذج في التشغيل التالي. إيقافه يوقف الاستيراد الجاري بعد المحادثة الحالية.`],"Saved. Changes apply at the next run.":[`已保存。更改在下次运行时生效。`,`تم الحفظ. تسري التغييرات في التشغيل التالي.`],paused:[`已暂停`,`متوقف مؤقتاً`],"started from auto":[`自动启动`,`بدأ تلقائياً`],"started from web":[`从网页启动`,`بدأ من الويب`],"started from cli":[`从终端启动`,`بدأ من الطرفية`],"started from slash":[`从斜杠命令启动`,`بدأ من أمر الشرطة المائلة`],"Minutes left":[`剩余分钟`,`الدقائق المتبقية`],unknown:[`未知`,`غير معروف`],about:[`约`,`حوالي`],Pause:[`暂停`,`إيقاف مؤقت`],Resume:[`继续`,`استئناف`],"Pausing after the current exchange.":[`将在当前对话完成后暂停。`,`سيتوقف مؤقتاً بعد المحادثة الحالية.`],"Backfill started.":[`回填已开始。`,`بدأ الاستيراد.`],"The list is still loading. Try again in a moment.":[`列表仍在加载。请稍后再试。`,`لا تزال القائمة قيد التحميل. حاول مرة أخرى بعد لحظة.`],"Paused. No import starts until you resume.":[`已暂停。恢复前不会开始导入。`,`تم الإيقاف مؤقتاً. لن يبدأ أي استيراد حتى تستأنفه.`],"Directory maps":[`目录映射`,`خرائط المجلدات`],"Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.":[`将已移动或删除的目录映射到其所属项目。更改在下次导入或回填时生效。`,`اربط مجلداً نُقل أو حُذف بالمشروع الذي ينتمي إليه. يسري التغيير في الاستيراد التالي.`],"Saved maps":[`已保存的映射`,`الخرائط المحفوظة`],Keep:[`保留`,`إبقاء`],Remove:[`移除`,`إزالة`],"Unresolved directories":[`无法解析的目录`,`مجلدات غير محلولة`],"No unresolved directories in the latest run.":[`最近一次运行没有无法解析的目录。`,`لا توجد مجلدات غير محلولة في آخر تشغيل.`],"No suggestion found.":[`未找到建议。`,`لم يُعثر على اقتراح.`],"Target directory":[`目标目录`,`المجلد الهدف`],"Saved. Maps apply to the next import or backfill run.":[`已保存。映射在下次导入或回填时生效。`,`تم الحفظ. تسري الخرائط في الاستيراد التالي.`],"Memory language":[`记忆语言`,`لغة الذاكرة`],"The language that new memory summaries are written in. Automatic detects it from your prompt, but a Latin-script prompt under 100 characters counts as English.":[`新记忆摘要使用的语言。“自动”会根据你的提示检测语言,但少于 100 个字符的拉丁字母提示按英语处理。`,`اللغة التي تُكتب بها ملخصات الذاكرة الجديدة. يكتشفها الوضع التلقائي من موجّهك، لكن الموجّه بالأحرف اللاتينية الأقصر من 100 حرف يُعدّ إنجليزياً.`],"Summary language":[`摘要语言`,`لغة الملخص`],Appearance:[`外观`,`المظهر`],Theme:[`主题`,`السمة`],"Theme mode":[`主题模式`,`وضع السمة`],System:[`系统`,`النظام`],Light:[`浅色`,`فاتح`],Dark:[`深色`,`داكن`],"Light theme":[`浅色主题`,`السمة الفاتحة`],"Dark theme":[`深色主题`,`السمة الداكنة`],"On screen now":[`当前显示`,`معروضة الآن`],"No theme matches.":[`没有匹配的主题。`,`لا توجد سمة مطابقة.`],"Filter themes":[`筛选主题`,`تصفية السمات`],"System follows your operating system and switches between the light and the dark theme. The choice stays in this browser.":[`“系统”跟随操作系统,在浅色和深色主题之间切换。此选择只保存在此浏览器中。`,`يتبع «النظام» نظام التشغيل ويبدّل بين السمة الفاتحة والداكنة. يبقى الاختيار في هذا المتصفح.`],"Date and time":[`日期和时间`,`التاريخ والوقت`],"How dates and times show in this web app. The choice stays in this browser.":[`此网页应用中日期和时间的显示方式。此选择只保存在此浏览器中。`,`طريقة عرض التواريخ والأوقات في تطبيق الويب هذا. يبقى الاختيار في هذا المتصفح.`],"Date format":[`日期格式`,`تنسيق التاريخ`],"Time format":[`时间格式`,`تنسيق الوقت`],"Day month year":[`日 月 年`,`يوم شهر سنة`],"Month day year":[`月 日 年`,`شهر يوم سنة`],"Year-month-day":[`年-月-日`,`سنة-شهر-يوم`],"24-hour":[`24 小时制`,`24 ساعة`],"12-hour":[`12 小时制`,`12 ساعة`],Automatic:[`自动`,`تلقائي`],"Saved. New memories use this language.":[`已保存。新记忆将使用此语言。`,`تم الحفظ. ستستخدم الذكريات الجديدة هذه اللغة.`],"Claude Code folder":[`Claude Code 文件夹`,`مجلد Claude Code`],"Set this when Claude Code does not use ~/.claude, for example when you start it with CLAUDE_CONFIG_DIR. Leave it empty to use the default.":[`当 Claude Code 不使用 ~/.claude 时(例如用 CLAUDE_CONFIG_DIR 启动它),请设置此项。留空则使用默认文件夹。`,`اضبط هذا عندما لا يستخدم Claude Code المجلد ~/.claude، مثلاً عند تشغيله مع CLAUDE_CONFIG_DIR. اتركه فارغاً لاستخدام المجلد الافتراضي.`],"Save folder":[`保存文件夹`,`حفظ المجلد`],"Transcripts folder in use":[`正在使用的会话记录文件夹`,`مجلد سجلات الجلسات المستخدم`],From:[`来源`,`المصدر`],"this setting":[`此设置`,`هذا الإعداد`],"the CLAUDE_CONFIG_DIR variable of the web app":[`网页应用的 CLAUDE_CONFIG_DIR 变量`,`متغير CLAUDE_CONFIG_DIR لتطبيق الويب`],"the default folder":[`默认文件夹`,`المجلد الافتراضي`],"This folder does not exist. Claude Code capture and import will not work:":[`此文件夹不存在。Claude Code 的捕获和导入将无法工作:`,`هذا المجلد غير موجود. لن يعمل الالتقاط والاستيراد في Claude Code:`],"Enter a full path, or a path that starts with ~/.":[`请输入完整路径,或以 ~/ 开头的路径。`,`أدخل مساراً كاملاً، أو مساراً يبدأ بـ ~/.`],"Saved. Capture and import use this folder now.":[`已保存。捕获和导入现在使用此文件夹。`,`تم الحفظ. يستخدم الالتقاط والاستيراد هذا المجلد الآن.`],"Running version":[`运行版本`,`الإصدار الجاري`],"Global command":[`全局命令`,`الأمر العام`],"not installed globally":[`未全局安装`,`غير مثبت عمومياً`],"A newer OMMS copy runs in place of the global install. The global install is optional. To update it:":[`正在运行的是更新的 OMMS 副本,而不是全局安装。全局安装是可选的。更新方法:`,`تعمل نسخة OMMS أحدث بدلاً من التثبيت العام. التثبيت العام اختياري. لتحديثه:`],"The global install is newer than the running OMMS. The next Pi or OpenCode start replaces the web app.":[`全局安装比正在运行的 OMMS 更新。下次启动 Pi 或 OpenCode 时将替换网页应用。`,`التثبيت العام أحدث من OMMS الجاري. سيستبدل التشغيل التالي لـ Pi أو OpenCode تطبيق الويب.`],"OMMS is not installed globally. A global install is optional.":[`OMMS 未全局安装。全局安装是可选的。`,`OMMS غير مثبت عمومياً. التثبيت العام اختياري.`],"Keys and access":[`密钥与访问`,`المفاتيح والوصول`],"not needed":[`不需要`,`غير مطلوب`],"External API key":[`外部 API 密钥`,`مفتاح واجهة API الخارجية`],"Embedding server key":[`嵌入服务器密钥`,`مفتاح خادم التضمين`],"Capture and profile learning through the external API. Claude Code always uses it.":[`通过外部 API 进行捕获和用户画像学习。Claude Code 始终使用它。`,`الالتقاط وتعلّم الملف الشخصي عبر واجهة API الخارجية. يستخدمه Claude Code دائماً.`],"Sent to an embedding server on another machine.":[`发送给另一台机器上的嵌入服务器。`,`يُرسَل إلى خادم تضمين على جهاز آخر.`],"Let scripts and other computers call the web app's API.":[`允许脚本和其他电脑调用网页应用的 API。`,`تتيح للبرامج النصية والحواسيب الأخرى استدعاء واجهة API لتطبيق الويب.`],"Asks for a user name and password before the page opens.":[`打开页面前要求输入用户名和密码。`,`يطلب اسم مستخدم وكلمة مرور قبل فتح الصفحة.`],"External API card":[`外部 API 卡片`,`بطاقة واجهة API الخارجية`],"Embedding card":[`嵌入卡片`,`بطاقة التضمين`],"Table below":[`下方表格`,`الجدول أدناه`],"Form below":[`下方表单`,`النموذج أدناه`],"API tokens":[`API 令牌`,`رموز API`],"Browser password":[`浏览器密码`,`كلمة مرور المتصفح`],"The config file still sets webServerApiToken. OMMS imported it once as the token “from config file” and no longer reads the key. Use the token table instead.":[`配置文件仍设置了 webServerApiToken。OMMS 已将其导入一次,作为令牌“from config file”,之后不再读取该键。请改用令牌表。`,`لا يزال ملف الإعدادات يضبط webServerApiToken. استورده OMMS مرة واحدة كرمز باسم “from config file” ولم يعد يقرأ هذا المفتاح. استخدم جدول الرموز بدلاً منه.`],"Open this page on the computer that runs OMMS to manage tokens and the password.":[`请在运行 OMMS 的电脑上打开此页面,以管理令牌和密码。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لإدارة الرموز وكلمة المرور.`],"Revoke this token? Scripts that use it stop working.":[`撤销此令牌?使用它的脚本将停止工作。`,`إلغاء هذا الرمز؟ ستتوقف البرامج النصية التي تستخدمه عن العمل.`],"No browser password is set.":[`未设置浏览器密码。`,`لم تُضبط كلمة مرور للمتصفح.`],"A browser password is set for user":[`已为以下用户设置浏览器密码:`,`ضُبطت كلمة مرور المتصفح للمستخدم`],"A browser password is set for your computer user name.":[`已为你的电脑用户名设置浏览器密码。`,`ضُبطت كلمة مرور المتصفح لاسم مستخدم حاسوبك.`],"User name":[`用户名`,`اسم المستخدم`],Password:[`密码`,`كلمة المرور`],"Save password":[`保存密码`,`حفظ كلمة المرور`],"Clear password":[`清除密码`,`مسح كلمة المرور`],"Saved. Restart the web app to use the new browser password.":[`已保存。重启网页应用以使用新的浏览器密码。`,`تم الحفظ. أعد تشغيل تطبيق الويب لاستخدام كلمة مرور المتصفح الجديدة.`],Name:[`名称`,`الاسم`],Expires:[`过期时间`,`تاريخ الانتهاء`],"Last used":[`上次使用`,`آخر استخدام`],Never:[`永不`,`أبداً`],Revoke:[`撤销`,`إلغاء`],Copy:[`复制`,`نسخ`],"Copy this token now. It will not be shown again.":[`请立即复制此令牌。它不会再次显示。`,`انسخ هذا الرمز الآن. لن يُعرض مرة أخرى.`],"Token name":[`令牌名称`,`اسم الرمز`],"Expires after":[`有效期`,`ينتهي بعد`],"Generate token":[`生成令牌`,`إنشاء رمز`],All:[`全部`,`الكل`],Kind:[`类型`,`النوع`],"Built-in model":[`内置模型`,`النموذج المدمج`],"OpenAI-compatible server":[`OpenAI 兼容服务器`,`خادم متوافق مع OpenAI`],"Server URL":[`服务器 URL`,`عنوان URL للخادم`],"Vector size":[`向量维度`,`حجم المتجه`],"Stored memories":[`已存储的记忆`,`الذكريات المخزنة`],"Re-embedding":[`正在重新嵌入`,`جارٍ إعادة التضمين`],"Re-embed finished.":[`重新嵌入已完成。`,`اكتملت إعادة التضمين.`],"Re-embed failed":[`重新嵌入失败`,`فشلت إعادة التضمين`],Retry:[`重试`,`إعادة المحاولة`],Lock:[`锁定`,`قفل`],"Unlock to change":[`解锁以更改`,`افتح القفل للتغيير`],"The model that turns memory text into search vectors. A change re-embeds every memory.":[`将记忆文本转换为搜索向量的模型。更改后会重新嵌入所有记忆。`,`النموذج الذي يحوّل نص الذكريات إلى متجهات بحث. يؤدي تغييره إلى إعادة تضمين كل الذكريات.`],Preset:[`预设`,`إعداد مسبق`],Custom:[`自定义`,`مخصص`],"No key":[`无密钥`,`بلا مفتاح`],"Keep the saved key":[`保留已保存的密钥`,`الاحتفاظ بالمفتاح المحفوظ`],Apply:[`应用`,`تطبيق`],Cancel:[`取消`,`إلغاء الأمر`],"Test passed. Vector size":[`测试通过。向量维度`,`نجح الاختبار. حجم المتجه`],"Test failed":[`测试失败`,`فشل الاختبار`],"Every stored memory will be re-embedded":[`所有已存储的记忆都将重新嵌入`,`ستُعاد عملية تضمين كل الذكريات المخزنة`],"The hosted server is called once for each memory, which may cost money.":[`托管服务器会为每条记忆调用一次,可能产生费用。`,`يُستدعى الخادم المستضاف مرة لكل ذكرى، وقد يكلّف ذلك مالاً.`],"Search results are poor until the re-embed ends.":[`在重新嵌入结束前,搜索结果质量较差。`,`تكون نتائج البحث ضعيفة حتى تنتهي إعادة التضمين.`],"Restart open OpenCode and Pi sessions after the change.":[`更改后请重启已打开的 OpenCode 和 Pi 会话。`,`أعد تشغيل جلسات OpenCode وPi المفتوحة بعد التغيير.`],"Profile learning":[`用户画像学习`,`تعلّم الملف الشخصي`],"Catch up analyses every waiting prompt with the saved external API, 50 prompts for each model call.":[`补齐会使用已保存的外部 API 分析所有等待中的提示词,每次模型调用处理 50 条。`,`يحلّل اللحاق كل الطلبات المنتظرة عبر واجهة API الخارجية المحفوظة، 50 طلباً لكل استدعاء للنموذج.`],"Open this page on the computer that runs OMMS to start a catch-up run.":[`请在运行 OMMS 的电脑上打开此页面以开始补齐。`,`افتح هذه الصفحة على الحاسوب الذي يشغّل OMMS لبدء اللحاق.`],"Prompts waiting for profile learning":[`等待用户画像学习的提示词`,`الطلبات المنتظرة لتعلّم الملف الشخصي`],"Model calls":[`模型调用次数`,`استدعاءات النموذج`],"Batches done":[`已完成批次`,`الدفعات المكتملة`],"Prompts waiting":[`等待中的提示词`,`الطلبات المنتظرة`],Paused:[`已暂停`,`متوقف مؤقتاً`],Finished:[`已完成`,`اكتمل`],Stopped:[`已停止`,`توقّف`],"Catch up profile":[`补齐用户画像`,`اللحاق بالملف الشخصي`],"Start profile learning for the waiting prompts? Model calls":[`为等待中的提示词开始用户画像学习?模型调用次数`,`بدء تعلّم الملف الشخصي للطلبات المنتظرة؟ عدد استدعاءات النموذج`],"never used before":[`从未使用`,`لم يُستخدم من قبل`],"A newer catch-up run took over.":[`较新的补齐任务已接管。`,`تولّت عملية لحاق أحدث المهمة.`],"Browser password cleared. Restart the web app to turn it off.":[`浏览器密码已清除。重启网页应用以关闭它。`,`تم مسح كلمة مرور المتصفح. أعد تشغيل تطبيق الويب لإيقافها.`],Actions:[`操作`,`الإجراءات`],"All exchanges are done. Learning the profile from the imported prompts":[`所有对话已完成。正在从导入的提示中学习画像`,`اكتملت كل المحادثات. يجري تعلّم الملف الشخصي من المطالبات المستوردة`],batches:[`批`,`دفعات`],"Change it in":[`修改位置`,`مكان التغيير`],"Check them, then press Save maps.":[`请检查后点击保存映射。`,`راجعها ثم اضغط حفظ الخرائط.`],Credential:[`凭据`,`بيانات الاعتماد`],Email:[`邮箱`,`البريد الإلكتروني`],Filled:[`已填写`,`تم الملء`],"Finds the project each missing directory belongs to, mostly the main repository of a deleted worktree, and fills it in for you to check. Nothing is saved until you press Save maps.":[`为每个缺失的目录找到所属项目(多为已删除工作树的主仓库),并填入供你检查。点击保存映射之前不会保存任何内容。`,`يعثر على المشروع الذي ينتمي إليه كل مجلد مفقود، وغالباً المستودع الرئيسي لشجرة عمل محذوفة، ويملؤه لتراجعه. لا يُحفظ شيء حتى تضغط حفظ الخرائط.`],Hosts:[`主机`,`المضيفات`],"Import status":[`导入状态`,`حالة الاستيراد`],"in use":[`使用中`,`قيد الاستخدام`],"Last run":[`上次运行`,`آخر تشغيل`],"Last update":[`最后更新`,`آخر تحديث`],"Learning profile":[`正在学习画像`,`يجري تعلّم الملف الشخصي`],"Merge into":[`合并到`,`دمج في`],"Merge this profile into the other one? The source profile is turned off, not deleted.":[`将此画像合并到另一个画像?源画像会被停用,不会被删除。`,`دمج هذا الملف الشخصي في الآخر؟ يُوقَف الملف المصدر ولا يُحذف.`],"Merged.":[`已合并。`,`تم الدمج.`],"model not recorded":[`未记录模型`,`لم يُسجَّل نموذج`],model:[`个模型`,`نموذج`],models:[`个模型`,`نماذج`],"No directory recorded":[`未记录目录`,`لم يُسجَّل مجلد`],"No suggestion":[`无建议`,`لا اقتراح`],"Not started":[`未开始`,`لم يبدأ`],"OMMS keeps one profile for each git email. A folder whose repository has its own email starts a second profile. Choose the profile that is yours, or merge the extra one into it.":[`OMMS 为每个 git 邮箱保留一个画像。若某文件夹的仓库设置了自己的邮箱,就会产生第二个画像。请选择属于你的画像,或把多余的画像合并进去。`,`يحتفظ OMMS بملف شخصي لكل بريد git. المجلد الذي يملك مستودعه بريداً خاصاً يبدأ ملفاً شخصياً ثانياً. اختر ملفك الشخصي، أو ادمج الملف الزائد فيه.`],"Outcomes by host":[`各主机结果`,`النتائج حسب المضيف`],"Partly imported":[`部分已导入`,`مستورد جزئياً`],Patterns:[`模式`,`الأنماط`],pending:[`待处理`,`معلّق`],Preferences:[`偏好`,`التفضيلات`],Profiles:[`画像`,`الملفات الشخصية`],"Prompts analysed":[`已分析提示`,`المطالبات المحلَّلة`],Running:[`运行中`,`قيد التشغيل`],"Saved maps apply to every host.":[`已保存的映射适用于所有主机。`,`تنطبق الخرائط المحفوظة على كل المضيفات.`],"Saved: a memory was stored. Skipped: the model or a rule found nothing worth keeping, or the turn was private or trivial. Failed: the attempt hit an error. Total: the three added up. Each percentage is a share of its row's total.":[`已保存:存储了一条记忆。已跳过:模型或规则认为没有值得保留的内容,或该轮为私密或琐碎内容。失败:尝试出错。总计:三者之和。每个百分比是该行总计中的占比。`,`محفوظ: خُزّنت ذاكرة. متجاوز: لم يجد النموذج أو قاعدة ما يستحق الحفظ، أو كانت الجولة خاصة أو تافهة. فشل: واجهت المحاولة خطأ. الإجمالي: مجموع الثلاثة. كل نسبة هي حصة من إجمالي صفها.`],"Saved. OMMS now uses this profile in every folder.":[`已保存。OMMS 现在在所有文件夹中使用此画像。`,`تم الحفظ. يستخدم OMMS هذا الملف الشخصي الآن في كل المجلدات.`],Directories:[`目录数`,`عدد المجلدات`],"No target chosen":[`尚未选择目标`,`لم يُختر مجلد مستهدف`],"Smart resolve directories":[`智能解析目录`,`حلّ المجلدات تلقائياً`],Exact:[`精确`,`مطابقة تامة`],"Name match":[`名称匹配`,`مطابقة بالاسم`],Guess:[`猜测`,`تخمين`],Confidence:[`可信度`,`درجة الثقة`],"Temporary folder":[`临时文件夹`,`مجلد مؤقت`],"node_modules folder":[`node_modules 文件夹`,`مجلد node_modules`],"App data folder":[`应用数据文件夹`,`مجلد بيانات التطبيقات`],"Skills folder":[`技能文件夹`,`مجلد المهارات`],"Rows with a target":[`已有目标的行数`,`عدد الصفوف ذات المجلد المستهدف`],"Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.":[`智能解析会在对话框中列出每个建议的映射和忽略项。勾选要保留的项,然后点击确认。在此之前不会保存任何内容。`,`يعرض الحلّ التلقائي كل خريطة مقترحة وكل تجاهل مقترح في مربع حوار. حدّد ما تريد الاحتفاظ به، ثم اضغط تأكيد. لا يُحفظ شيء قبل ذلك.`],"Suggested to ignore":[`建议忽略`,`مقترح للتجاهل`],Ignore:[`忽略`,`تجاهل`],Restore:[`恢复`,`استعادة`],"No target":[`无目标`,`بلا مجلد مستهدف`],"Save this map":[`保存此映射`,`حفظ هذه الخريطة`],"Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.":[`勾选要保留的映射和忽略项,然后点击确认保存。保存的映射将在所有主机的下一次导入或回填时生效。`,`حدّد الخرائط وعناصر التجاهل التي تريد الاحتفاظ بها، ثم اضغط تأكيد لحفظها. تسري الخرائط المحفوظة على كل المضيفات في عملية الاستيراد أو الاستكمال التالية.`],"Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.":[`没有可保存的内容。请在行中输入目标,或对不是项目的文件夹点击忽略。`,`لا يوجد ما يُحفظ. اكتب مجلداً مستهدفاً في صف، أو اضغط تجاهل للمجلدات التي ليست مشاريع.`],"Ignored directories":[`已忽略的目录`,`المجلدات المتجاهَلة`],"Ignored directories stay unimported and leave the unresolved counts.":[`已忽略的目录保持未导入,并且不计入未解析数量。`,`تبقى المجلدات المتجاهَلة دون استيراد، ولا تُحسب ضمن الأعداد غير المحلولة.`],"They apply to the next import or backfill run. No sessions were imported.":[`它们将在下一次导入或回填时生效。未导入任何会话。`,`تسري في عملية الاستيراد أو الاستكمال التالية. لم تُستورد أي جلسات.`],"Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.":[`会话导入后请保留映射。每次导入在跳过会话之前都会先检查映射,因此删除映射会使其会话在下次运行时重新变为未解析。`,`احتفظ بالخريطة بعد استيراد جلساتها. يفحص كل استيراد الخريطة قبل أن يتجاوز جلسة، لذا فإن حذف الخريطة يجعل جلساتها غير محلولة مجدداً في التشغيل التالي.`],"Save removals":[`保存删除`,`حفظ عمليات الحذف`],"Settings changed elsewhere. Check the list and try again.":[`设置已在其他位置更改。请检查列表后再试。`,`تغيّرت الإعدادات في مكان آخر. راجع القائمة، ثم حاول مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再试。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة، ثم حاول مجدداً.`],"Saved. Removed maps stop applying at the next import or backfill run.":[`已保存。删除的映射将从下一次导入或回填起不再生效。`,`تم الحفظ. تتوقف الخرائط المحذوفة عن السريان في عملية الاستيراد أو الاستكمال التالية.`],"Removals could not be saved. Try again.":[`无法保存删除。请重试。`,`تعذّر حفظ عمليات الحذف. حاول مجدداً.`],"Ignored. The directory stays unimported.":[`已忽略。该目录保持未导入。`,`تم التجاهل. يبقى المجلد دون استيراد.`],"The directory could not be ignored. Try again.":[`无法忽略该目录。请重试。`,`تعذّر تجاهل المجلد. حاول مجدداً.`],"Restored. The directory shows again in each host list that reported it.":[`已恢复。该目录会重新出现在报告它的每个主机列表中。`,`تمت الاستعادة. يظهر المجلد مجدداً في قائمة كل مضيف أبلغ عنه.`],"The directory could not be restored. Try again.":[`无法恢复该目录。请重试。`,`تعذّرت استعادة المجلد. حاول مجدداً.`],"Saved, but the list could not be refreshed. Refresh the list without saving again.":[`已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`تم الحفظ، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"Review directory maps":[`检查目录映射`,`مراجعة خرائط المجلدات`],"Proposed maps":[`建议映射数`,`عدد الخرائط المقترحة`],Sessions:[`会话数`,`عدد الجلسات`],Confirm:[`确认`,`تأكيد`],"Saving…":[`正在保存…`,`جارٍ الحفظ…`],"Settings refreshed. No maps were saved.":[`设置已刷新。未保存任何映射。`,`حُدّثت الإعدادات. لم تُحفظ أي خرائط.`],"Settings could not be refreshed. Try Refresh list again.":[`无法刷新设置。请再次点击刷新列表。`,`تعذّر تحديث الإعدادات. حاول تحديث القائمة مجدداً.`],"Maps could not be saved. Review the targets and confirm again.":[`无法保存映射。请检查目标后再次确认。`,`تعذّر حفظ الخرائط. راجع المجلدات المستهدفة، ثم أكّد مجدداً.`],"Settings changed elsewhere. Review these maps and confirm again.":[`设置已在其他位置更改。请检查这些映射后再次确认。`,`تغيّرت الإعدادات في مكان آخر. راجع هذه الخرائط، ثم أكّد مجدداً.`],"Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.":[`设置已在其他位置更改,且无法刷新。请刷新列表后再次确认。`,`تغيّرت الإعدادات في مكان آخر وتعذّر تحديثها. حدّث القائمة قبل التأكيد مجدداً.`],"Maps were saved, but the list could not be refreshed. Refresh the list without saving again.":[`映射已保存,但无法刷新列表。请刷新列表,无需再次保存。`,`حُفظت الخرائط، لكن تعذّر تحديث القائمة. حدّث القائمة دون الحفظ مجدداً.`],"No model was recorded for these attempts. This happens with records written by older OMMS versions, and when an attempt stops before a model is chosen.":[`这些尝试没有记录模型。旧版 OMMS 写入的记录,以及在选定模型之前就停止的尝试,会出现这种情况。`,`لم يُسجَّل نموذج لهذه المحاولات. يحدث ذلك في السجلات التي كتبتها إصدارات أقدم من OMMS، وعندما تتوقف المحاولة قبل اختيار نموذج.`],"These sessions cannot be mapped.":[`这些会话无法映射。`,`لا يمكن ربط هذه الجلسات.`],unresolved:[`未解析`,`غير محلول`],"Use this profile":[`使用此画像`,`استخدام هذا الملف الشخصي`],"Use this profile for every folder?":[`在所有文件夹中使用此画像?`,`استخدام هذا الملف الشخصي في كل المجلدات؟`],"Used for":[`用途`,`الاستخدام`],Workflows:[`工作流`,`سير العمل`],Memory:[`记忆`,`الذاكرة`],Setting:[`设置`,`الإعداد`],Value:[`数值`,`القيمة`],Default:[`默认值`,`القيمة الافتراضية`],Unit:[`单位`,`الوحدة`],Affects:[`影响`,`التأثير`],Results:[`条结果`,`نتائج`],Memories:[`条记忆`,`ذكريات`],Bytes:[`字节`,`بايت`],"Approximate tokens":[`约计令牌`,`رموز تقريبية`],"Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.":[`记忆搜索结果的最大数量。手动搜索可以请求更少;提示词检索使用此上限。`,`الحد الأقصى لنتائج بحث الذاكرة. يمكن للبحث اليدوي طلب عدد أقل؛ ويستخدم استرجاع الطلب هذا السقف.`],"Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.":[`会话开始时在 OpenCode V1 和 Claude Code 中加入的近期记忆。Pi 和 OpenCode V2 改用基于提示词的搜索。`,`الذكريات الحديثة التي تُضاف عند بدء الجلسة في OpenCode V1 و Claude Code. أما Pi و OpenCode V2 فيستخدمان البحث عبر الطلب بدلاً منها.`],"Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.":[`通过共享捕获管道发送给记忆摘要模型的对话输入。数值较小时可能省略部分对话文本。`,`مدخلات المحادثة التي تُرسل إلى نموذج تلخيص الذاكرة عبر مسار الالتقاط المشترك. القيم الأصغر قد تحذف نصاً من المحادثة.`],"OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.":[`OpenCode 画像学习的输入。数值较小时可能从该输入中省略部分提示词。此设置不限制其他主机的画像输入。`,`مدخلات تعلّم الملف الشخصي في OpenCode. القيم الأصغر قد تحذف مطالبات من هذه المدخلات. لا يقيّد هذا الإعداد مدخلات الملف الشخصي في المضيفات الأخرى.`],"Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.":[`自动加入各主机代理请求的记忆上下文,包括画像文本和格式化内容。数值较小时会显示更少或更短的记忆。`,`سياق الذاكرة المُضاف تلقائياً إلى طلبات الوكيل في كل المضيفات، بما في ذلك نص الملف الشخصي والتنسيق. القيم الأصغر قد تعرض ذكريات أقل أو أقصر.`],"Enter a positive whole number.":[`请输入正整数。`,`أدخل رقماً صحيحاً موجباً.`],"Enter a whole number from 16,384 to 16,777,216.":[`请输入 16,384 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 16,384 إلى 16,777,216.`],"Enter a whole number from 1,024 to 16,777,216.":[`请输入 1,024 到 16,777,216 之间的整数。`,`أدخل رقماً صحيحاً من 1,024 إلى 16,777,216.`],"Enter a whole number from 256 to 65,536.":[`请输入 256 到 65,536 之间的整数。`,`أدخل رقماً صحيحاً من 256 إلى 65,536.`],"Byte limits count UTF-8 bytes.":[`字节限制按 UTF-8 字节计数。`,`تُحتسب حدود البايت بوحدات بايت UTF-8.`],"Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.":[`约计令牌按 ceil(UTF-8 字节数 / 4) 估算。同一文本,提供商统计的令牌数可能更多或更少。`,`تُقدَّر الرموز التقريبية بالصيغة ceil(بايتات UTF-8 / 4). قد يحسب المزوّد للنص نفسه رموزاً أكثر أو أقل.`],"These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.":[`这些设置不会删除已存储的数据、设定消费限额、限制模型回复,也不会控制 Graphify 输出。`,`لا تحذف هذه الإعدادات البيانات المخزنة، ولا تضع حد إنفاق، ولا تحدّ من ردود النموذج، ولا تتحكم في خرج Graphify.`],"Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.":[`也可以直接编辑 ~/.config/omms/omms.jsonc 来设置这些限制,无需网页界面。`,`عدّل الملف ~/.config/omms/omms.jsonc مباشرة لضبط هذه الحدود دون واجهة الويب.`],"Save memory limits":[`保存记忆限制`,`حفظ حدود الذاكرة`],"Saved. New memory operations use these limits.":[`已保存。新的记忆操作将使用这些限制。`,`تم الحفظ. ستستخدم عمليات الذاكرة الجديدة هذه الحدود.`],"Invalid setting":[`无效的设置`,`إعداد غير صالح`],"Config changed. Reload settings and save again.":[`设置文件已更改。请重新加载设置后再次保存。`,`تغيّر ملف الإعدادات. أعد تحميل الإعدادات ثم احفظ مجدداً.`],"The memory settings could not be loaded. Reload the page to try again.":[`无法加载记忆设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات الذاكرة. أعد تحميل الصفحة للمحاولة مجدداً.`],"The memory settings could not be saved.":[`无法保存记忆设置。`,`تعذّر حفظ إعدادات الذاكرة.`],"Effective value":[`生效值`,`القيمة السارية`],project:[`项目`,`المشروع`],"The project value stays in force. Saving edits the global file only.":[`项目值仍然生效。保存只修改全局文件。`,`تبقى قيمة المشروع سارية، والحفظ يعدّل الملف العام فقط.`],"Similarity score":[`相似度分数`,`درجة التشابه`],"Enter a number from 0 to 1.":[`请输入 0 到 1 之间的数字。`,`أدخل رقماً من 0 إلى 1.`],"Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.":[`记忆被搜索返回所需的最低分数。较低的值会返回更多记忆,包括相关性较低的;较高的值可能一条也不返回。默认值取决于嵌入模型。`,`أدنى درجة تحتاجها الذاكرة لتُعاد في نتائج البحث. القيم الأدنى تعيد ذكريات أكثر بمن فيها الأقل صلة، والقيم الأعلى قد لا تعيد شيئاً. تعتمد القيمة الافتراضية على نموذج التضمين.`],"Reset to default":[`恢复默认`,`إعادة إلى الافتراضي`],"Differs from default":[`与默认值不同`,`يختلف عن الافتراضي`],"Keyword matching":[`关键词匹配`,`مطابقة الكلمات`],"Search finds memories by meaning and by exact words from your prompt.":[`搜索按含义和提示中的确切词语查找记忆。`,`يجد البحث الذكريات بالمعنى وبالكلمات الدقيقة من مطالبتك.`],"Word matching mode":[`词语匹配模式`,`وضع مطابقة الكلمات`],"Boost (default)":[`加分(默认)`,`تعزيز (افتراضي)`],"Rank fusion (experimental)":[`排名融合(实验性)`,`دمج الترتيب (تجريبي)`],"Boost adds a small score bonus to memories that contain a word of your prompt.":[`加分会给包含提示中某个词的记忆增加少量分数。`,`يضيف التعزيز مكافأة صغيرة في الدرجة للذكريات التي تحتوي على كلمة من مطالبتك.`],"Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.":[`排名融合会合并按含义排序的列表和按词语排序的列表。即使含义得分低于相似度阈值,包含提示中某个词的记忆也可能被返回。实验性:尚未证明能找到更多相关记忆。`,`يدمج دمج الترتيب قائمة بالمعنى وقائمة بالكلمات. قد تُعاد ذاكرة تحتوي على كلمة من مطالبتك حتى لو كانت درجة المعنى أقل من حد التشابه. تجريبي: لم يثبت أنه يجد ذكريات أكثر صلة.`],"Rank fusion is not used while the reranker is on. Search uses the boost.":[`重排序器开启时不使用排名融合,搜索使用加分模式。`,`لا يُستخدم دمج الترتيب أثناء تشغيل معيد الترتيب. يستخدم البحث التعزيز.`],"A project file can override this setting. This page edits the global value.":[`项目文件可以覆盖此设置。此页面编辑全局值。`,`يمكن لملف المشروع تجاوز هذا الإعداد. تعدّل هذه الصفحة القيمة العامة.`],"Saved. New searches use this mode.":[`已保存。新的搜索将使用此模式。`,`تم الحفظ. تستخدم عمليات البحث الجديدة هذا الوضع.`],"The keyword matching setting could not be saved. Reload the page to try again.":[`无法保存关键词匹配设置。请重新加载页面后重试。`,`تعذّر حفظ إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],"The keyword matching setting could not be loaded. Reload the page to try again.":[`无法加载关键词匹配设置。请重新加载页面后重试。`,`تعذّر تحميل إعداد مطابقة الكلمات. أعد تحميل الصفحة للمحاولة مرة أخرى.`],Reranker:[`重排序器`,`إعادة الترتيب`],"Use a reranker":[`使用重排序器`,`استخدم معيد الترتيب`],Key:[`密钥`,`المفتاح`],Timeout:[`超时`,`مهلة الانتهاء`],"Search is unchanged while the switch is off.":[`开关关闭时,搜索行为保持不变。`,`يظل البحث دون تغيير أثناء إيقاف المفتاح.`],"The reranker reorders the best memory search results with your reranker server and keeps the top results.":[`重排序器使用您的重排序服务器对最佳记忆搜索结果重新排序,并保留最靠前的结果。`,`يعيد معيد الترتيب ترتيب أفضل نتائج بحث الذاكرة عبر خادم إعادة الترتيب لديك ويحتفظ بالنتائج العليا.`],"The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.":[`重排序器会将提示和候选记忆的文本发送到该服务器 URL。建议使用同一台机器上的服务器。`,`يرسل معيد الترتيب المطالبة ونص الذكريات المرشحة إلى عنوان URL للخادم. يُنصح بخادم على الجهاز نفسه.`],"This URL is not on this machine: memory text leaves this machine.":[`此 URL 不在本机上:记忆文本将离开本机。`,`هذا العنوان ليس على هذا الجهاز: نص الذاكرة يغادر جهازك.`],"A project file cannot change these settings. The reranker settings are global only.":[`项目文件无法更改这些设置。重排序器设置仅限全局。`,`لا يمكن لملف المشروع تغيير هذه الإعدادات. إعدادات معيد الترتيب عامة فقط.`],"The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.":[`默认值 4000 使搜索保持在 OpenCode V2 的 5 秒等待之内。超过 5000 的值可能导致 OpenCode V2 在不注入记忆的情况下发送请求。`,`تحافظ القيمة الافتراضية 4000 على بقاء البحث داخل مهلة انتظار OpenCode V2 البالغة 5 ثوانٍ. القيمة الأعلى من 5000 قد تجعل OpenCode V2 يرسل الطلب دون ذاكرة.`],"Enter the server URL and model before turning the reranker on.":[`打开重排序器前,请先填写服务器 URL 和模型。`,`أدخل عنوان URL للخادم والنموذج قبل تشغيل معيد الترتيب.`],"The key must be an env:// or file:// reference, or left empty.":[`密钥必须是 env:// 或 file:// 引用,或留空。`,`يجب أن يكون المفتاح مرجع env:// أو file://، أو يُترك فارغاً.`],"Enter a whole number from 500 to 30,000.":[`请输入 500 到 30,000 之间的整数。`,`أدخل رقماً صحيحاً من 500 إلى 30,000.`],"Optional env:// or file:// key reference.":[`可选的 env:// 或 file:// 密钥引用。`,`مرجع مفتاح env:// أو file:// اختياري.`],milliseconds:[`毫秒`,`ميلي ثانية`],Save:[`保存`,`حفظ`],"Saved. New searches use these settings.":[`已保存。新的搜索将使用这些设置。`,`تم الحفظ. ستستخدم عمليات البحث الجديدة هذه الإعدادات.`],"The reranker settings could not be saved. Reload the page to try again.":[`无法保存重排序器设置。请重新加载页面重试。`,`تعذّر حفظ إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"The reranker settings could not be loaded. Reload the page to try again.":[`无法加载重排序器设置。请重新加载页面重试。`,`تعذّر تحميل إعدادات معيد الترتيب. أعد تحميل الصفحة للمحاولة مجدداً.`],"Test passed.":[`测试通过。`,`نجح الاختبار.`],"Test failed:":[`测试失败:`,`فشل الاختبار:`],"Change icon":[`更换图标`,`تغيير الأيقونة`],"Check again":[`再次检查`,`تحقق مرة أخرى`],"Choose a host to see its history import, sessions and settings.":[`选择一个宿主,查看其历史导入、会话和设置。`,`اختر مضيفاً لعرض استيراد سجله وجلساته وإعداداته.`],"Choose icon":[`选择图标`,`اختر أيقونة`],"Every avatar is shown at the same size. Images are cropped to a square.":[`所有头像大小一致。图片会被裁剪为正方形。`,`تظهر كل الصور الرمزية بالحجم نفسه. تُقصّ الصور إلى مربع.`],"Every host":[`所有宿主`,`كل المضيفين`],"Fix the service named here, then press Check again.":[`请修复此处所列的服务,然后点击“再次检查”。`,`أصلح الخدمة المذكورة هنا، ثم اضغط «تحقق مرة أخرى».`],"How many memories a search returns":[`一次搜索返回多少条记忆`,`عدد الذكريات التي يعيدها البحث`],"How to set up":[`如何设置`,`كيفية الإعداد`],"Ignore all":[`全部忽略`,`تجاهل الكل`],"Memory injection":[`记忆注入`,`حقن الذاكرة`],"Inject memories with the first message":[`随第一条消息注入记忆`,`حقن الذكريات مع الرسالة الأولى`],"Added once, with the first message of a new session. Nothing is added when a new session opens. OMMS searches the query below and adds only matching memories.":[`仅随新会话的第一条消息添加一次。新会话打开时不会添加任何内容。OMMS 会用下面的查询进行搜索,只添加匹配的记忆。`,`تُضاف مرة واحدة مع أول رسالة في جلسة جديدة. لا يُضاف شيء عند فتح جلسة جديدة. يبحث OMMS بالاستعلام أدناه ويضيف الذكريات المطابقة فقط.`],"Memories are added at these moments:":[`记忆会在这些时刻添加:`,`تُضاف الذكريات في هذه اللحظات:`],"With every message: the memories that match that message. On by default. chatMessage.enabled in the config file turns it off, and the first-message and subagent options with it.":[`随每条消息:与该消息匹配的记忆。默认开启。配置文件中的 chatMessage.enabled 可将其关闭,第一条消息和子代理选项也会随之关闭。`,`مع كل رسالة: الذكريات المطابقة لتلك الرسالة. مفعّلة افتراضيًا. يوقفها chatMessage.enabled في ملف الإعدادات، وتتوقف معها خيارات الرسالة الأولى والوكلاء الفرعيين.`],"With the first message of a new session: the memories that match the query below. Needs the first switch.":[`随新会话的第一条消息:与下面查询匹配的记忆。需要打开第一个开关。`,`مع أول رسالة في جلسة جديدة: الذكريات المطابقة للاستعلام أدناه. تتطلب المفتاح الأول.`],"For a subagent: the memories that match its task. Claude Code adds them once, when the subagent starts. OpenCode V2 and Pi add them with each prompt the subagent gets. Needs the Subagent memory switch.":[`对于子代理:与其任务匹配的记忆。Claude Code 在子代理启动时添加一次。OpenCode V2 和 Pi 在子代理收到的每条提示时添加。需要打开“子代理记忆”开关。`,`للوكيل الفرعي: الذكريات المطابقة لمهمته. يضيفها Claude Code مرة واحدة عند بدء الوكيل. ويضيفها OpenCode V2 وPi مع كل طلب يتلقاه الوكيل. يتطلب مفتاح ذاكرة الوكلاء الفرعيين.`],"After a compaction or resume: the memories that session captured. Needs the Restore switch.":[`压缩或恢复之后:该会话捕获的记忆。需要打开“还原”开关。`,`بعد الضغط أو الاستئناف: الذكريات التي التقطتها تلك الجلسة. تتطلب مفتاح الاستعادة.`],"Nothing is added when a new session opens.":[`新会话打开时不会添加任何内容。`,`لا يُضاف شيء عند فتح جلسة جديدة.`],"Claude Code can add memories when a session opens. Pi and OpenCode V2 cannot. To keep all three the same, OMMS adds them with the first message on every host.":[`Claude Code 可以在会话打开时添加记忆,Pi 和 OpenCode V2 不能。为了让三者保持一致,OMMS 在所有宿主上都随第一条消息添加记忆。`,`يمكن لـ Claude Code إضافة الذكريات عند فتح الجلسة، ولا يمكن ذلك لـ Pi وOpenCode V2. للإبقاء على الثلاثة متطابقة، يضيف OMMS الذكريات مع الرسالة الأولى على كل مضيف.`],"Added when a session resumes or compacts. Restores the memories that session captured.":[`会话恢复或压缩时添加。还原该会话捕获的记忆。`,`تُضاف عند استئناف الجلسة أو ضغطها. تستعيد الذكريات التي التقطتها تلك الجلسة.`],"First-message search query":[`第一条消息的搜索查询`,`استعلام البحث للرسالة الأولى`],"Sets how OMMS adds memories to the context the model sees.":[`设置 OMMS 如何将记忆添加到模型的上下文中。`,`يحدد كيفية إضافة OMMS للذكريات إلى سياق النموذج.`],"Subagent memory":[`子代理记忆`,`ذاكرة الوكلاء الفرعيين`],"Subagents get memories that match their task. Claude Code adds them once, at start. OpenCode V2 and Pi add them with each subagent prompt. No rows are shown for them.":[`子代理会获得与其任务匹配的记忆。Claude Code 在启动时添加一次。OpenCode V2 和 Pi 在每条子代理提示时添加。不会为它们显示记忆行。`,`يحصل الوكلاء الفرعيون على الذكريات المطابقة لمهمتهم. يضيفها Claude Code مرة واحدة عند البدء. ويضيفها OpenCode V2 وPi مع كل طلب للوكيل الفرعي. لا تُعرض لهم أي صفوف.`],"Restore memories after compaction or resume":[`压缩或恢复后还原记忆`,`استعادة الذكريات بعد الضغط أو الاستئناف`],"Most memories to restore":[`最多还原的记忆数`,`أقصى عدد من الذكريات للاستعادة`],"Applies to OpenCode V2, Pi and Claude Code. OpenCode V1 is not covered. On Pi, a subagent gets memory only when its agent maps the OMMS extension in om-pi-subagents. Turn it on in /omps-settings, Agent capabilities, Memory.":[`适用于 OpenCode V2、Pi 和 Claude Code,不包括 OpenCode V1。在 Pi 上,只有当子代理的 agent 在 om-pi-subagents 中映射了 OMMS 扩展时,子代理才会获得记忆。请在 /omps-settings 的 Agent capabilities 中打开 Memory。`,`ينطبق على OpenCode V2 وPi وClaude Code. لا يشمل OpenCode V1. على Pi لا يحصل الوكيل الفرعي على الذكريات إلا إذا ربط وكيله امتداد OMMS في om-pi-subagents. فعّل ذلك من /omps-settings ثم Agent capabilities ثم Memory.`],"A project config can turn the first-message and subagent options off. It can turn restore on or off.":[`项目配置只能关闭第一条消息和子代理选项,但可以开启或关闭还原。`,`يمكن لإعدادات المشروع إيقاف خياري الرسالة الأولى والوكلاء الفرعيين فقط، ويمكنها تشغيل الاستعادة أو إيقافها.`],"Saved. The next session uses these options.":[`已保存。下一个会话将使用这些选项。`,`تم الحفظ. ستستخدم الجلسة التالية هذه الخيارات.`],"The memory injection settings could not be loaded. Reload the page to try again.":[`无法加载记忆注入设置。请重新加载页面后重试。`,`تعذّر تحميل إعدادات حقن الذاكرة. أعد تحميل الصفحة للمحاولة مرة أخرى.`],"First message {opening} · Subagents {subagent} · Restore {restore}":[`第一条消息 {opening} · 子代理 {subagent} · 还原 {restore}`,`الرسالة الأولى {opening} · الوكلاء الفرعيون {subagent} · الاستعادة {restore}`],"Invalid openingContext setting":[`openingContext 设置无效`,`إعداد openingContext غير صالح`],"Invalid subagentMemory setting":[`subagentMemory 设置无效`,`إعداد subagentMemory غير صالح`],"Invalid compaction.enabled setting":[`compaction.enabled 设置无效`,`إعداد compaction.enabled غير صالح`],"Invalid compaction.memoryLimit setting: accepted positive safe integers":[`compaction.memoryLimit 设置无效:只接受正整数`,`إعداد compaction.memoryLimit غير صالح: يُقبل عدد صحيح موجب فقط`],"openingContextQuery must be text of 500 characters or fewer":[`openingContextQuery 必须是不超过 500 个字符的文本`,`يجب أن يكون openingContextQuery نصاً لا يزيد عن 500 حرف`],"Import all hosts":[`导入所有宿主`,`استيراد كل المضيفين`],"Import progress":[`导入进度`,`تقدم الاستيراد`],"Running · history imported {date}":[`运行中 · 历史已导入 {date}`,`قيد التشغيل · استُورد السجل {date}`],"Running · history imported {date} · last saved {when}":[`运行中 · 历史已导入 {date} · 上次保存 {when}`,`قيد التشغيل · استُورد السجل {date} · آخر حفظ {when}`],"Running · last saved {when}":[`运行中 · 上次保存 {when}`,`قيد التشغيل · آخر حفظ {when}`],"today {time}":[`今天 {time}`,`اليوم {time}`],"yesterday {time}":[`昨天 {time}`,`أمس {time}`],"Importing makes model calls and can cost money.":[`导入会调用模型,可能产生费用。`,`يجري الاستيراد اتصالات بالنموذج وقد يكلّف مالاً.`],"Importing · {percent}%":[`正在导入 · {percent}%`,`جارٍ الاستيراد · {percent}%`],"Memories are not being saved.":[`记忆当前无法保存。`,`لا يتم حفظ الذكريات حالياً.`],"Memories not saved":[`记忆未保存`,`الذكريات غير محفوظة`],"Memory views":[`记忆视图`,`عروض الذاكرة`],"Mode: {mode}":[`模式:{mode}`,`الوضع: {mode}`],"No icon matches.":[`没有匹配的图标。`,`لا توجد أيقونة مطابقة.`],"Not set up":[`未设置`,`غير مُعد`],"Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.":[`自动导入已开启。在 {date} 之前没有待导入的内容。更新的聊天请使用下方的“会话”。`,`الاستيراد التلقائي قيد التشغيل. لم يكن هناك ما ينتظر قبل {date}. استخدم «الجلسات» أدناه للمحادثات الأحدث.`],"Automatic import is on. Nothing is waiting.":[`自动导入已开启。没有待导入的内容。`,`الاستيراد التلقائي قيد التشغيل. لا يوجد ما ينتظر.`],"OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.":[`OMMS 在这台电脑上没有找到该宿主的聊天记录。请安装该宿主并使用一次,然后重新加载此页面。`,`لم يعثر OMMS على سجل محادثات هذا المضيف على هذا الحاسوب. ثبّت المضيف واستخدمه مرة واحدة، ثم أعد تحميل هذه الصفحة.`],Off:[`关`,`متوقف`],On:[`开`,`قيد التشغيل`],"On · {model}":[`开 · {model}`,`قيد التشغيل · {model}`],"PNG, JPEG, WebP or GIF, up to 20 MB.":[`PNG、JPEG、WebP 或 GIF,最大 20 MB。`,`PNG أو JPEG أو WebP أو GIF، حتى 20 ميغابايت.`],"Paused · {pending} pending":[`已暂停 · 待处理 {pending}`,`متوقف مؤقتاً · {pending} قيد الانتظار`],"Paused. Resume to continue.":[`已暂停。点击“恢复”继续。`,`متوقف مؤقتاً. اضغط «استئناف» للمتابعة.`],"Prompts waiting for profile learning, and re-analysis of old chats":[`等待画像学习的提示,以及旧聊天的重新分析`,`مطالبات تنتظر تعلم الملف الشخصي، وإعادة تحليل المحادثات القديمة`],"Results {results} · Similarity {similarity}":[`结果数 {results} · 相似度 {similarity}`,`النتائج {results} · التشابه {similarity}`],"Runs one import for every host you tick. It makes model calls and can cost money.":[`对勾选的每个宿主运行一次导入。它会调用模型,可能产生费用。`,`يشغّل استيراداً واحداً لكل مضيف تحدده. يجري اتصالات بالنموذج وقد يكلّف مالاً.`],"Saved maps and ignored directories":[`已保存的映射和已忽略的目录`,`الخرائط المحفوظة والمجلدات المتجاهلة`],"Search icons":[`搜索图标`,`ابحث عن أيقونة`],"Settings for every host":[`适用于所有宿主的设置`,`إعدادات لكل المضيفين`],Shared:[`共享`,`مشترك`],"Stopped · {pending} pending":[`已停止 · 待处理 {pending}`,`متوقف · {pending} قيد الانتظار`],"Stopped: {error}":[`已停止:{error}`,`توقف: {error}`],"These directories stay unimported and leave the unresolved counts.":[`这些目录保持未导入状态,并从未解析计数中移除。`,`تبقى هذه المجلدات غير مستوردة وتخرج من أعداد غير المحلولة.`],"These settings apply to every host. Open a row to change it.":[`这些设置适用于所有宿主。展开一行即可修改。`,`تنطبق هذه الإعدادات على كل المضيفين. افتح صفاً لتغييره.`],"This browser could not read the image.":[`此浏览器无法读取该图片。`,`تعذّر على هذا المتصفح قراءة الصورة.`],"This host is not set up on this machine.":[`此宿主尚未在这台机器上设置。`,`لم يتم إعداد هذا المضيف على هذا الجهاز.`],"This switch applies to every host. Automatic import makes model calls.":[`此开关适用于所有宿主。自动导入会调用模型。`,`ينطبق هذا المفتاح على كل المضيفين. يجري الاستيراد التلقائي اتصالات بالنموذج.`],"Upload image":[`上传图片`,`رفع صورة`],"Use external API":[`使用外部 API`,`استخدام واجهة API الخارجية`],settings:[`设置`,`الإعدادات`],"{saved} saved · {ignored} ignored":[`已保存 {saved} · 已忽略 {ignored}`,`{saved} محفوظة · {ignored} متجاهلة`],"The image is larger than 20 MB.":[`图片超过 20 MB。`,`الصورة أكبر من 20 ميغابايت.`],"Only PNG, JPEG, WebP and GIF images are accepted.":[`仅接受 PNG、JPEG、WebP 和 GIF 图片。`,`تُقبل صور PNG وJPEG وWebP وGIF فقط.`],"Importing {done} / {total}.":[`正在导入 {done} / {total}。`,`جارٍ الاستيراد {done} / {total}.`],"Importing {done} / {total}. About {minutes} min left.":[`正在导入 {done} / {total}。约剩 {minutes} 分钟。`,`جارٍ الاستيراد {done} / {total}. يتبقى نحو {minutes} دقيقة.`],"Nothing is waiting to import.":[`没有待导入的内容。`,`لا يوجد ما ينتظر الاستيراد.`],"{pending} still waiting to import.":[`仍有 {pending} 条待导入。`,`لا يزال {pending} بانتظار الاستيراد.`]};function Qv(e,t){return t===`en`?e:Zv[e]?.[t===`zh`?0:1]??e}function Y(){let{language:e}=G();return t=>Qv(t,e)}function $v(e){try{return localStorage.getItem(e)!==`0`}catch{return!0}}function ey(e,t){try{localStorage.setItem(e,t?`1`:`0`)}catch{}}function ty({storageKey:e,sections:t,back:n}){let r=Y(),[i,a]=(0,v.useState)(()=>$v(e)),o=()=>a(t=>(ey(e,!t),!t)),s=e=>t=>{t.preventDefault();let n=document.getElementById(e);n&&(n.scrollIntoView(af),of(n))};return(0,H.jsxs)(`div`,{className:`fixed top-16 end-3 z-20 flex flex-col items-end gap-1 md:top-3`,children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-expanded":i,"aria-controls":`${e}-nav`,"aria-label":r(i?`Hide contents`:`Show contents`),onClick:o,className:`bg-card/95 shadow-sm backdrop-blur`,children:(0,H.jsx)(qe,{className:`size-4`,"aria-hidden":`true`})}),i?(0,H.jsx)(`nav`,{id:`${e}-nav`,"aria-label":r(`Contents`),className:`max-h-[70vh] w-48 max-w-full overflow-y-auto rounded-xl border border-border bg-card/95 px-2 py-1.5 shadow-sm backdrop-blur`,children:(0,H.jsxs)(`ul`,{children:[n?(0,H.jsx)(`li`,{className:`mb-1 border-b border-border pb-1`,children:(0,H.jsxs)(`button`,{type:`button`,onClick:n.onBack,className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-sm hover:bg-interactive-hover`,children:[(0,H.jsx)(N,{className:`rtl:-scale-x-100 size-3.5 shrink-0`,"aria-hidden":`true`}),n.label]})}):null,t.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`a`,{href:`#${e.id}`,onClick:s(e.id),className:`block rounded-lg px-2 py-1.5 text-start text-sm hover:bg-interactive-hover`,children:r(e.title)})},e.id))]})}):null]})}var ny=class extends Error{status;constructor(e,t){super(e),this.name=`SettingsRequestError`,this.status=t}};async function X(e,t={}){let n=(t.method??`GET`).toUpperCase(),r=n!==`GET`&&n!==`HEAD`,i=await fetch(e,{...t,headers:{"x-omms-token":window.__OMMS_TOKEN__??``,...r||t.body?{"Content-Type":`application/json`}:{},...t.headers}}),a=await i.json();if(!i.ok)throw new ny(a.error??`Request failed (${i.status})`,i.status);return a}var ry=new Set,iy=0;function ay(e){iy++;for(let t of ry)t(e)}function oy(){let e=iy;return{isCurrent:()=>iy===e}}async function sy(){try{let e=await X(`/api/settings`);return ay(e),e}catch{return null}}function cy(e){return ry.add(e),()=>{ry.delete(e)}}function ly(e,t){return`${e.replace(/\.+$/,``)}. ${t}`}function uy(){let e=0;return{begin(){let t=++e;return()=>t===e}}}async function dy(e,t){e(!0);try{return await t()}finally{e(!1)}}function fy(e,t){if(e===`env`){let n=(t.name??``).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n))throw Error(`Enter a variable name such as ZAI_API_KEY`);return{source:e,name:n}}if(e===`file`){let n=(t.path??``).trim();if(!n)throw Error(`Enter the path of a key file`);return{source:e,path:n}}let n=(t.name??``).trim()||`memory-api`;if(!/^[A-Za-z0-9_-]{1,64}$/.test(n))throw Error(`Name the key file with letters, digits, dashes, or underscores`);if(!(t.value??``).trim())throw Error(`Paste the key`);return{source:e,name:n,value:t.value??``,replace:t.replace===!0}}function py(e){let t=[],n=e.memoryProvider===`orcarouter`;return!n&&!e.memoryModel&&t.push(`memoryModel`),!n&&!e.memoryApiUrl&&t.push(`memoryApiUrl`),e.keySet||t.push(`memoryApiKey`),t}function my(e,t){if(t===`inherit`||t===`external`)return{[`${e}Model`]:t};let n=t.indexOf(`/`);if(n<1||n===t.length-1)throw Error(`Enter a model as provider/model.`);return{[`${e}Provider`]:t.slice(0,n),[`${e}Model`]:t.slice(n+1)}}function hy(e){return{kind:e.relation,command:e.relation===`older`?`npm i -g om-memory-system@latest`:null}}function gy(e,t){return e.filter(e=>!t.has(e.from))}function _y({status:e}){let t=Y();return(0,H.jsxs)(`div`,{className:`space-y-1 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Yd(`claude-code`)}),e?.ready===!0&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`Claude Code capture uses the external API.`)}),e?.ready===!1&&(0,H.jsxs)(`div`,{role:`alert`,className:`space-y-1 text-xs`,children:[(0,H.jsx)(`p`,{className:`text-amber-600`,children:t(`Claude Code capture is off. Complete the external API settings.`)}),(e.issues??[]).length>0&&(0,H.jsxs)(`p`,{children:[t(`Missing settings`),`: `,(e.issues??[]).map(e=>t(e)).join(`; `)]})]})]})}function vy(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&o(t.message)});for(let t of[`opencode`,`pi`])X(`/api/settings/models?host=${t}`).then(n=>{e&&i(e=>({...e,[t]:n}))}).catch(()=>{e&&i(e=>({...e,[t]:{available:!1}}))});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function l(n,r){if(!t)return;let i;try{i=my(n,r)}catch(t){o(e(t.message));return}c(!0);let a,s;try{a=await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:i,revision:t.revision})})}catch(e){s=e}let l=await sy()!==null;if(c(!1),a){let t=e(a.migratedLegacy?`Saved. OMMS now reads ~/.config/omms/omms.jsonc. The legacy config was kept.`:`Saved. New capture and profile work uses these settings.`);o(l?t:`${t} ${e(`Reload the page before saving again.`)}`)}else o(ly(s?.message??``,e(l?`Current settings were reloaded; check the values and save again.`:`The current settings could not be reloaded. Reload the page.`)))}let u=py({memoryProvider:t?.settings.memoryProvider?.globalValue,memoryModel:t?.settings.memoryModel?.globalValue,memoryApiUrl:t?.settings.memoryApiUrl?.globalValue,keySet:!!t?.secrets.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Models`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Models`)}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[e(`External API fallback`),`: `,t?.fallback.model??e(`none`),` (`,e(t?.fallback.configured?`ready`:`not ready`),`).`]}),[`opencode`,`pi`].map(e=>(0,H.jsx)(yy,{host:e,model:t?.settings[`${e}Model`],provider:t?.settings[`${e}Provider`],effective:e===`pi`?t?.effective.pi.kind:t?.effective.opencode.mode??`unready`,list:r[e],externalMissing:u,busy:s||!t,onSave:t=>l(e,t)},e)),(0,H.jsx)(_y,{status:t?.effective[`claude-code`]}),a&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:a})]})}function yy({host:e,model:t,provider:n,effective:r,list:i,externalMissing:a,busy:o,onSave:s}){let c=Y(),l=t?.globalValue===`inherit`||!t?.globalValue?`inherit`:t.globalValue===`external`?`external`:`${n?.globalValue??``}/${t.globalValue}`,[u,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(),g=u??(l===`inherit`||l===`external`?l:`manual`),_=i?.models??[],y=l===`inherit`||l===`external`?``:l,b=m||y||(_[0]?`${_[0].provider}/${_[0].model}`:`typed`),x=!_.some(e=>`${e.provider}/${e.model}`===b),S=f??y;return(0,H.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Yd(e)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Effective model`),`:`,` `,t?.value===`external`&&r===`manual`?c(`external API`):t?.value===`inherit`||r===`session`?c(`session`):r===`manual`?c(`external API`):r===`unready`?c(`unavailable`):`${n?.value??``}/${t?.value??``}`]}),(t?.source===`project`||n?.source===`project`)&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:c(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`label`,{className:`block text-sm`,htmlFor:`${e}-model`,children:c(`Model choice`)}),(0,H.jsxs)(Dr,{id:`${e}-model`,className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,value:g,onChange:e=>d(e.target.value),children:[(0,H.jsx)(`option`,{value:`inherit`,children:c(`Session model`)}),(0,H.jsx)(`option`,{value:`manual`,children:c(`Manual model`)}),(0,H.jsx)(`option`,{value:`external`,disabled:a.length>0,children:c(`External API`)})]}),a.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`External API needs`),`: `,a.join(`, `)]}),g===`manual`&&i?.available&&_.length>0&&(0,H.jsxs)(Dr,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${Yd(e)} ${c(`Model`)}`,value:x?`typed`:b,onChange:e=>h(e.target.value),children:[_.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:c(`Manual provider/model`)})]}),g===`manual`&&x&&(0,H.jsx)(`input`,{className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,"aria-label":`${e} ${c(`Manual provider/model`)}`,placeholder:`provider/model`,value:S,onChange:e=>{p(e.target.value),h(`typed`)}}),g===`manual`&&i&&!i.available&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i.reason?c(i.reason):c(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:o,onClick:()=>s(g===`manual`?x?S.trim():b:g),children:c(`Save model`)})]})}var by=[`openai-chat`,`openai-responses`,`anthropic`,`minimax`,`orcarouter`,`google-gemini`];function xy(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(`file`),[s,c]=(0,v.useState)({name:``,path:``,value:``}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&u(t.message)});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let p=e=>String(t?.settings[e]?.globalValue??``),m=e=>r[e]??p(e);async function h(){if(!t)return;let n={};for(let e of[`memoryProvider`,`memoryApiUrl`,`memoryModel`]){let t=m(e).trim();t&&t!==p(e)&&(n[e]=t)}if(!Object.keys(n).length){u(e(`Nothing to save.`));return}f(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),i({}),u(e(`Saved. New capture and profile work uses these settings.`))}catch(e){u(e.message)}await sy(),f(!1)}async function g(n=!1){if(!t)return;let r;try{r=fy(a,{...s,replace:n})}catch(t){u(e(t.message));return}f(!0);try{await X(`/api/settings/external-api/key`,{method:`POST`,body:JSON.stringify({...r,revision:t.revision})}),c(e=>({...e,value:``})),u(e(`Key source saved.`))}catch(t){let r=t.message;if(a===`paste`&&!n&&r.includes(`Confirm to replace`)){f(!1),window.confirm(e(`A key file with this name exists. Replace it?`))&&await g(!0);return}u(r)}await sy(),f(!1)}async function _(){f(!0);try{let t=await X(`/api/settings/external-api/test`,{method:`POST`,body:`{}`});u(t.ok?`${e(`Test call succeeded`)}: ${t.model??``}`:`${e(`Test call failed`)}: ${t.error??``}`)}catch(e){u(e.message)}f(!1)}let y=t?.externalKey;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`External API`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`External API`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`An OpenAI- or Anthropic-compatible endpoint that either host can use for capture and backfill.`)}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Provider`),(0,H.jsx)(`div`,{className:Er,children:(0,H.jsx)(Dr,{"aria-label":e(`Provider`),className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:m(`memoryProvider`)||`openai-chat`,onChange:e=>i({...r,memoryProvider:e.target.value}),children:by.map(e=>(0,H.jsx)(`option`,{value:e,children:e},e))})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`API URL`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`https://api.example.com/v1`,value:m(`memoryApiUrl`),onChange:e=>i({...r,memoryApiUrl:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[e(`Model`),(0,H.jsx)(`input`,{dir:`ltr`,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`glm-5-turbo`,value:m(`memoryModel`),onChange:e=>i({...r,memoryModel:e.target.value})})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d||!t,onClick:()=>void h(),children:e(`Save endpoint`)}),(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API key`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e(`Key source`),`:`,` `,y?.source===`env`?`${e(`environment variable`)} ${y.reference}`:y?.source===`file`?`${e(`key file`)} ${y.reference}`:y?.source===`literal`?e(`set in the config file`):e(`not set`),y?.source&&` · ${e(y.resolvesInWebApp?`resolves in the web app`:`does not resolve in the web app`)}`]}),y?.source===`env`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`A login web app does not see variables set only in a shell profile; a key file works everywhere.`)}),y?.source&&!y.resolvesInWebApp&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`The key does not resolve in this web app. Save it to a key file instead.`)}),[[`env`,`Environment variable`],[`file`,`Key file`],[`paste`,`Save key to a private file`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-key-source`,checked:a===t,onChange:()=>o(t)}),e(n)]},t)),a===`env`&&(0,H.jsx)(`input`,{"aria-label":e(`Variable name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`ZAI_API_KEY`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),a===`file`&&(0,H.jsx)(`input`,{"aria-label":e(`Key file path`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`~/.config/omms/secrets/zai.key`,value:s.path,onChange:e=>c({...s,path:e.target.value})}),a===`paste`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`input`,{"aria-label":e(`Key file name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`memory-api`,value:s.name,onChange:e=>c({...s,name:e.target.value})}),(0,H.jsx)(`input`,{"aria-label":e(`API key`),type:`password`,autoComplete:`off`,className:`w-full rounded border border-border bg-background p-2`,value:s.value,onChange:e=>c({...s,value:e.target.value})}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The key is written to ~/.config/omms/secrets/ readable only by you. It is never shown again.`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:d||!t,onClick:()=>void g(),children:e(`Save key source`)})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:d,onClick:()=>void _(),children:e(`Test`)}),l&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:l})]})}var Sy=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`,`0:0:0:0:0:0:0:1`]);function Cy(e){let t=e.trim().toLowerCase();return Sy.has(t)||/^127(?:\.\d{1,3}){3}$/.test(t)}function wy(e){try{return Cy(new URL(e).hostname)}catch{return!1}}function Ty(e,t){return e?`set`:t?`missing`:`not-needed`}function Ey(e){let{access:t,secrets:n}=e,r=t.embeddingApiUrl;return{memoryApiKey:(e=>e===`not-needed`?`never-used`:e)(Ty(!!n.memoryApiKey?.set,e.externalUsed||e.claudeCodeInUse)),embeddingApiKey:Ty(!!n.embeddingApiKey?.set,!!r&&!wy(r)),apiTokens:Ty(t.tokenAvailable,!Cy(t.host)&&!t.authEnabled),webPassword:Ty(!!n.webServerAuthPassword?.set,!1)}}function Dy(e){return e?`Browser password cleared. Restart the web app to turn it off.`:`Saved. Restart the web app to use the new browser password.`}var Oy=[{id:`ollama`,label:`Ollama`,url:`http://localhost:11434/v1`},{id:`llamacpp`,label:`llama.cpp`,url:`http://localhost:8080/v1`},{id:`openrouter`,label:`OpenRouter`,url:`https://openrouter.ai/api/v1`},{id:`openai`,label:`OpenAI`,url:`https://api.openai.com/v1`},{id:`custom`,label:`Custom`,url:``}];function ky(e,t){let n=Oy.find(t=>t.id===e);return n&&n.url?n.url:t}function Ay(e){if(e.kind===`builtin`)return{kind:`builtin`,model:e.model.trim()};let t=e.key===`none`||e.key===`saved`?{source:e.key}:fy(e.key,{...e.keyInput,name:e.keyInput.name||`embedding-api`});return{kind:`server`,url:e.url.trim(),model:e.model.trim(),key:t}}function jy(e){return JSON.stringify([e.kind,e.kind===`server`?e.url.trim():``,e.model.trim(),e.kind===`server`?e.key:`none`,e.kind===`server`?e.keyInput:null])}function My(e,t){return e!==void 0&&e===jy(t)}function Ny(e,t){let n=t.kind===`server`&&!wy(t.url);return{count:e.toLocaleString(`en-US`),risks:[...n?[`The hosted server is called once for each memory, which may cost money.`]:[],`Search results are poor until the re-embed ends.`,`Restart open OpenCode and Pi sessions after the change.`]}}var Py=`Xenova/nomic-embed-text-v1`;function Fy(e,t=Py){return e===`builtin`?{kind:e,model:t}:{kind:e}}function Iy(e,t){return e===`server`&&t?`saved`:`none`}function Ly({current:e,keySet:t}){let n=Y();return(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-sm`,children:[(0,H.jsx)(`dt`,{children:n(`Kind`)}),(0,H.jsx)(`dd`,{children:n(e.kind===`server`?`OpenAI-compatible server`:`Built-in model`)}),e.url&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`Server URL`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.url})]}),(0,H.jsx)(`dt`,{children:n(`Model`)}),(0,H.jsx)(`dd`,{className:`break-all`,children:e.model}),(0,H.jsx)(`dt`,{children:n(`Vector size`)}),(0,H.jsx)(`dd`,{children:e.dimensions}),(0,H.jsx)(`dt`,{children:n(`API key`)}),(0,H.jsx)(`dd`,{children:n(t?`set`:`not set`)}),(0,H.jsx)(`dt`,{children:n(`Stored memories`)}),(0,H.jsx)(`dd`,{children:e.memoryCount.toLocaleString(`en-US`)})]})}function Ry({run:e,onRetry:t}){let n=Y();return e.state===`idle`?null:(0,H.jsxs)(`div`,{role:`status`,className:`space-y-1 text-sm`,children:[e.state===`running`&&(0,H.jsxs)(`p`,{children:[n(`Re-embedding`),`: `,e.progress.processed,`/`,e.progress.total]}),e.state===`done`&&(0,H.jsx)(`p`,{children:n(`Re-embed finished.`)}),e.state===`failed`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`p`,{className:`text-red-600`,children:[n(`Re-embed failed`),`: `,e.error??``]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:t,children:n(`Retry`)})]})]})}function zy(e,t){return{kind:e.kind,url:e.url??``,model:e.model,key:Iy(e.kind,t),keyInput:{name:``,path:``,value:``}}}function By(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)({state:`idle`,progress:{processed:0,total:0}}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1);async function b(){let e=await X(`/api/settings/embedding`);return n(e),m(e.run),e}(0,v.useEffect)(()=>{let e=!0,t=oy();b().catch(t=>e&&g(t.message)),X(`/api/settings`).then(n=>e&&t.isCurrent()&&i(n)).catch(()=>{}),X(`/api/web/status`).then(t=>e&&o(!!t.isLocal)).catch(()=>{});let n=cy(t=>e&&i(t));return()=>{e=!1,n()}},[]),(0,v.useEffect)(()=>{if(p.state!==`running`)return;let e=setInterval(()=>{X(`/api/settings/embedding/run`).then(e=>{m(e),e.state!==`running`&&b()}).catch(()=>{})},1e3);return()=>clearInterval(e)},[p.state]);function x(){if(s||!t){c(!1),u(void 0),f(void 0);return}u(zy(t,!!r?.secrets.embeddingApiKey?.set)),c(!0)}let S=e=>u(t=>t&&{...t,...e});async function C(){l&&await dy(y,async()=>{try{let t=await X(`/api/settings/embedding/test`,{method:`POST`,body:JSON.stringify(Ay(l))});t.ok&&t.dimensions?(f({key:jy(l),dimensions:t.dimensions}),g(`${e(`Test passed. Vector size`)}: ${t.dimensions}`)):(f(void 0),g(`${e(`Test failed`)}: ${t.reason??``}`))}catch(t){g(e(t.message))}})}async function w(){if(!l||!t||!r)return;let{count:n,risks:i}=Ny(t.memoryCount,l),a=[`${e(`Every stored memory will be re-embedded`)}: ${n}`,...i.map(t=>e(t))].join(`
|
|
124
124
|
`);window.confirm(a)&&await dy(y,async()=>{try{let e=await X(`/api/settings/embedding/apply`,{method:`POST`,body:JSON.stringify({candidate:Ay(l),revision:r.revision})});m(e),c(!1),u(void 0),f(void 0),g(``)}catch(e){g(e.message)}await sy()})}async function T(){try{m(await X(`/api/settings/embedding/run`,{method:`POST`,body:`{}`}))}catch(e){g(e.message)}}let E=!!r?.secrets.embeddingApiKey?.set;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Embedding`),children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Embedding`)}),a&&(0,H.jsx)(`button`,{type:`button`,"aria-label":e(s?`Lock`:`Unlock to change`),title:e(s?`Lock`:`Unlock to change`),className:`rounded border border-border px-2 py-1`,disabled:!t||p.state===`running`,onClick:x,children:s?`🔓`:`🔒`})]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`The model that turns memory text into search vectors. A change re-embeds every memory.`)}),t&&!s&&(0,H.jsx)(Ly,{current:t,keySet:E}),s&&l&&(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[[`builtin`,`server`].map(n=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-embedding-kind`,checked:l.kind===n,onChange:()=>S(Fy(n,t?.kind===`builtin`?t.model:`Xenova/nomic-embed-text-v1`))}),e(n===`server`?`OpenAI-compatible server`:`Built-in model`)]},n)),l.kind===`server`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`block`,children:[e(`Preset`),(0,H.jsx)(`div`,{className:`w-72 max-w-full`,children:(0,H.jsx)(Dr,{"aria-label":e(`Preset`),className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:Oy.find(e=>e.url===l.url)?.id??`custom`,onChange:e=>S({url:ky(e.target.value,l.url)}),children:Oy.map(t=>(0,H.jsx)(`option`,{value:t.id,children:t.id===`custom`?e(`Custom`):t.label},t.id))})})]}),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Server URL`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:l.url,onChange:e=>S({url:e.target.value})})]})]}),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Model`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,placeholder:l.kind===`server`?`nomic-embed-text`:`Xenova/nomic-embed-text-v1`,value:l.model,onChange:e=>S({model:e.target.value})})]}),l.kind===`server`&&(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API key`)}),[[`none`,`No key`],...E?[[`saved`,`Keep the saved key`]]:[],[`env`,`Environment variable`],[`file`,`Key file`],[`paste`,`Save key to a private file`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`omms-embedding-key`,checked:l.key===t,onChange:()=>S({key:t})}),e(n)]},t)),l.key===`env`&&(0,H.jsx)(`input`,{"aria-label":e(`Variable name`),className:`w-full rounded border border-border bg-background p-2`,placeholder:`OPENROUTER_API_KEY`,value:l.keyInput.name,onChange:e=>S({keyInput:{...l.keyInput,name:e.target.value}})}),l.key===`file`&&(0,H.jsx)(`input`,{"aria-label":e(`Key file path`),className:`w-full rounded border border-border bg-background p-2`,value:l.keyInput.path,onChange:e=>S({keyInput:{...l.keyInput,path:e.target.value}})}),l.key===`paste`&&(0,H.jsx)(`input`,{"aria-label":e(`API key`),type:`password`,autoComplete:`off`,className:`w-full rounded border border-border bg-background p-2`,value:l.keyInput.value,onChange:e=>S({keyInput:{...l.keyInput,value:e.target.value}})})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:_||!l.model.trim(),onClick:()=>void C(),children:e(`Test`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:_||!My(d?.key,l),onClick:()=>void w(),children:e(`Apply`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:x,children:e(`Cancel`)})]})]}),(0,H.jsx)(Ry,{run:p,onRetry:()=>void T()}),h&&(0,H.jsx)(`p`,{className:`text-sm`,children:h})]})}async function Vy(e,t){return e()?(await t(),!0):!1}var Hy=[[`7`,`7 days`],[`30`,`30 days`],[`90`,`90 days`],[`never`,`Never`]];function Uy({tokens:e,newValue:t,busy:n,onGenerate:r,onRevoke:i}){let a=Y(),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(`30`),u=e=>e===null?a(`Never`):$p(e);return(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{children:a(`Name`)}),(0,H.jsx)(`th`,{children:a(`Created`)}),(0,H.jsx)(`th`,{children:a(`Expires`)}),(0,H.jsx)(`th`,{children:a(`Last used`)}),(0,H.jsx)(`th`,{})]})}),(0,H.jsx)(`tbody`,{children:e.map(e=>(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`td`,{children:e.name}),(0,H.jsx)(`td`,{children:u(e.createdAt)}),(0,H.jsx)(`td`,{children:u(e.expiresAt)}),(0,H.jsx)(`td`,{children:e.lastUsedAt===null?`-`:u(e.lastUsedAt)}),(0,H.jsx)(`td`,{children:(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-0.5`,disabled:n,onClick:()=>i(e),children:a(`Revoke`)})})]},e.id))})]}),t&&(0,H.jsxs)(`div`,{role:`status`,className:`space-y-1 rounded border border-border p-2 text-xs`,children:[(0,H.jsx)(`code`,{className:`block break-all`,children:t}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-0.5`,onClick:()=>void navigator.clipboard?.writeText(t),children:a(`Copy`)}),(0,H.jsx)(`p`,{className:`text-amber-600`,children:a(`Copy this token now. It will not be shown again.`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[a(`Token name`),(0,H.jsx)(`input`,{className:`mt-1 block rounded border border-border bg-background p-1.5`,placeholder:`ci`,value:o,onChange:e=>s(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`block`,children:[a(`Expires after`),(0,H.jsx)(Dr,{"aria-label":a(`Expires after`),className:`mt-1 block rounded border border-border bg-background p-1.5`,value:c,onChange:e=>l(e.target.value),children:Hy.map(([e,t])=>(0,H.jsx)(`option`,{value:e,children:a(t)},e))})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:n||!o.trim(),onClick:()=>r(o.trim(),c===`never`?null:Number(c)),children:a(`Generate token`)})]})]})}var Wy=`relative overflow-x-auto rounded-lg border border-border`,Gy=`px-3 py-2 text-start font-medium`,Ky=`bg-muted/50 text-xs text-muted-foreground`,qy=`px-3 py-2 text-start font-medium`,Jy=`border-t border-border transition-colors hover:bg-muted/30`,Yy=`px-3 py-1.5`;function Xy(e){return{secrets:e.secrets??{},externalUsed:e.effective?.opencode?.mode===`manual`||e.effective?.pi?.kind===`manual`,claudeCodeInUse:!!(e.claudeCodeEvidence?.attempts||e.claudeCodeEvidence?.folderSet),access:e.access??{host:`127.0.0.1`,authEnabled:!1,tokenAvailable:!1,embeddingApiUrl:null}}}var Zy=[{id:`memoryApiKey`,label:`External API key`,purpose:`Capture and profile learning through the external API. Claude Code always uses it.`,hosts:`OpenCode, Pi, Claude Code`,where:`External API card`},{id:`embeddingApiKey`,label:`Embedding server key`,purpose:`Sent to an embedding server on another machine.`,hosts:`OpenCode, Pi, Claude Code`,where:`Embedding card`},{id:`apiTokens`,label:`API tokens`,purpose:`Let scripts and other computers call the web app's API.`,hosts:`Web app`,where:`Table below`},{id:`webPassword`,label:`Browser password`,purpose:`Asks for a user name and password before the page opens.`,hosts:`Web app`,where:`Form below`}];function Qy({state:e}){let t=Y();return e===`set`?(0,H.jsxs)(`span`,{children:[`✅ `,t(`set`)]}):e===`missing`?(0,H.jsxs)(`span`,{className:`text-red-600`,children:[`⛔️ `,t(`missing`)]}):e===`never-used`?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t(`never used before`)}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:t(`not needed`)})}function $y({states:e}){let t=Y();return(0,H.jsx)(`div`,{className:Wy,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:V(Gy,`sr-only`),children:t(`Keys and access`)}),(0,H.jsx)(`thead`,{className:Ky,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:qy,children:t(`Credential`)}),(0,H.jsx)(`th`,{className:qy,children:t(`State`)}),(0,H.jsx)(`th`,{className:qy,children:t(`Used for`)}),(0,H.jsx)(`th`,{className:qy,children:t(`Hosts`)}),(0,H.jsx)(`th`,{className:qy,children:t(`Change it in`)})]})}),(0,H.jsx)(`tbody`,{children:Zy.map(n=>(0,H.jsxs)(`tr`,{className:V(Jy,`align-top`),children:[(0,H.jsx)(`td`,{className:V(Yy,`font-medium`),children:t(n.label)}),(0,H.jsx)(`td`,{className:V(Yy,`whitespace-nowrap`),children:(0,H.jsx)(Qy,{state:e[n.id]})}),(0,H.jsx)(`td`,{className:Yy,children:t(n.purpose)}),(0,H.jsx)(`td`,{className:Yy,children:n.hosts===`Web app`?t(`Web app`):n.hosts}),(0,H.jsx)(`td`,{className:Yy,children:t(n.where)})]},n.id))})]})})}function eb({value:e,onChange:t}){let n=Y();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`label`,{className:`block w-full max-w-72`,children:[(0,H.jsx)(`span`,{children:n(`User name`)}),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2`,autoComplete:`username`,value:e.username,onChange:n=>t({...e,username:n.target.value})})]}),(0,H.jsxs)(`label`,{className:`block w-full max-w-72`,children:[(0,H.jsx)(`span`,{children:n(`Password`)}),(0,H.jsx)(`input`,{type:`password`,autoComplete:`new-password`,className:`mt-1 block w-full rounded border border-border bg-background p-2`,value:e.value,onChange:n=>t({...e,value:n.target.value})})]})]})}function tb(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)({username:``,value:``}),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1);async function h(){let e=await X(`/api/settings/tokens`);o(e.tokens)}(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&f(t.message)}),X(`/api/web/status`).then(async t=>{!e||!t.isLocal||(i(!0),await h())}).catch(()=>{});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function g(e){await dy(m,async()=>{try{await e()}catch(e){f(e.message)}await sy()}).catch(()=>{})}let _=(e,t)=>g(async()=>{let n=await X(`/api/settings/tokens`,{method:`POST`,body:JSON.stringify({name:e,expiresInDays:t})});c(n.value),f(``),await h()}),y=t=>g(async()=>{c(void 0),await Vy(()=>window.confirm(e(`Revoke this token? Scripts that use it stop working.`)),async()=>{await X(`/api/settings/tokens/${t.id}`,{method:`DELETE`}),await h()})}),b=n=>g(async()=>{t&&(await X(`/api/settings/web-password`,{method:`POST`,body:JSON.stringify(n?{clear:!0,revision:t.revision}:{password:l.value,username:l.username,revision:t.revision})}),u({username:``,value:``}),f(e(Dy(n))))}),x=t?.access;return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Keys and access`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Keys and access`)}),t&&(0,H.jsx)($y,{states:Ey(Xy(t))}),x?.configTokenIgnored&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`The config file still sets webServerApiToken. OMMS imported it once as the token “from config file” and no longer reads the key. Use the token table instead.`)}),r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`API tokens`)}),(0,H.jsx)(Uy,{tokens:a,newValue:s,busy:p,onGenerate:(e,t)=>void _(e,t),onRevoke:e=>void y(e)})]}),(0,H.jsxs)(`fieldset`,{className:`space-y-2 rounded-lg border border-border p-3 text-sm`,children:[(0,H.jsx)(`legend`,{className:`px-1 font-medium`,children:e(`Browser password`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:x?.authEnabled?x.authUsername?`${e(`A browser password is set for user`)} ${x.authUsername}.`:e(`A browser password is set for your computer user name.`):e(`No browser password is set.`)}),(0,H.jsx)(eb,{value:l,onChange:u}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:p||!t||!l.value,onClick:()=>void b(!1),children:e(`Save password`)}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:p||!t||!x?.authEnabled,onClick:()=>void b(!0),children:e(`Clear password`)})]})]})]}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`Open this page on the computer that runs OMMS to manage tokens and the password.`)}),d&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:d})]})}function nb(){let e=Y(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``);async function l(){let e=await X(`/api/settings/profiles`);n(e.profiles)}if((0,v.useEffect)(()=>{l().catch(e=>c(e.message))},[]),t.length<2)return null;let u=t=>dy(o,async()=>{if(window.confirm(`${e(`Use this profile for every folder?`)} ${t.userId}`))try{let n=await sy();await X(`/api/settings/profiles/use`,{method:`POST`,body:JSON.stringify({userId:t.userId,revision:n?.revision})}),await sy(),await l(),c(e(`Saved. OMMS now uses this profile in every folder.`))}catch(e){c(e.message)}}),d=n=>dy(o,async()=>{let i=t.find(e=>e.id===(r[n.id]??t.find(e=>e.id!==n.id)?.id));if(i&&window.confirm(`${e(`Merge this profile into the other one? The source profile is turned off, not deleted.`)}\n${n.userId} → ${i.userId}`))try{await X(`/api/settings/profiles/merge`,{method:`POST`,body:JSON.stringify({sourceId:n.id,targetId:i.id})}),await l(),c(e(`Merged.`))}catch(e){c(e.message)}});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Profiles`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Profiles`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`OMMS keeps one profile for each git email. A folder whose repository has its own email starts a second profile. Choose the profile that is yours, or merge the extra one into it.`)}),(0,H.jsx)(`div`,{className:Wy,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:V(Gy,`sr-only`),children:e(`Profiles`)}),(0,H.jsx)(`thead`,{className:Ky,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{className:qy,children:e(`Email`)}),(0,H.jsx)(`th`,{className:qy,children:e(`Preferences`)}),(0,H.jsx)(`th`,{className:qy,children:e(`Patterns`)}),(0,H.jsx)(`th`,{className:qy,children:e(`Workflows`)}),(0,H.jsx)(`th`,{className:qy,children:e(`Prompts analysed`)}),(0,H.jsx)(`th`,{className:qy,children:e(`Last update`)}),(0,H.jsx)(`th`,{className:qy,children:e(`Actions`)})]})}),(0,H.jsx)(`tbody`,{children:t.map(n=>(0,H.jsxs)(`tr`,{className:Jy,children:[(0,H.jsxs)(`td`,{className:V(Yy,`font-medium`),children:[n.userId,n.inUse&&(0,H.jsxs)(`span`,{className:`ms-2 text-xs text-green-700`,children:[`✅ `,e(`in use`)]})]}),(0,H.jsx)(`td`,{className:Yy,children:n.preferences}),(0,H.jsx)(`td`,{className:Yy,children:n.patterns}),(0,H.jsx)(`td`,{className:Yy,children:n.workflows}),(0,H.jsx)(`td`,{className:Yy,children:n.totalPromptsAnalyzed}),(0,H.jsx)(`td`,{className:Yy,children:Qp(n.lastAnalyzedAt)}),(0,H.jsxs)(`td`,{className:V(Yy,`space-y-1`),children:[!n.inUse&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-1`,disabled:a,onClick:()=>void u(n),children:e(`Use this profile`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`label`,{className:`sr-only`,htmlFor:`merge-${n.id}`,children:e(`Merge into`)}),(0,H.jsx)(`select`,{id:`merge-${n.id}`,className:`rounded border border-border bg-background px-1 py-1 text-xs`,value:r[n.id]??``,onChange:e=>i(t=>({...t,[n.id]:e.target.value})),children:t.filter(e=>e.id!==n.id).map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.userId},e.id))}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-2 py-1`,disabled:a,onClick:()=>void d(n),children:e(`Merge into`)})]})]})]},n.id))})]})}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:s})]})}var rb=[`opencode`,`pi`,`claude-code`];function ib(e){return!e.provider&&!e.model?null:`${e.provider??``}/${e.model??``}`}function ab(e){let t=new Map;for(let n of e){let e=t.get(n.host)??{host:n.host,total:0,saved:0,skipped:0,failed:0,models:[]};e.total+=n.total,e.saved+=n.saved,e.skipped+=n.skipped,e.failed+=n.failed;let r=ib(n),i=e.models.find(e=>e.label===r);i?(i.total+=n.total,i.saved+=n.saved,i.skipped+=n.skipped,i.failed+=n.failed):e.models.push({label:r,provider:n.provider,model:n.model,total:n.total,saved:n.saved,skipped:n.skipped,failed:n.failed}),t.set(n.host,e)}let n=e=>{let t=rb.indexOf(e);return t<0?rb.length:t};return[...t.values()].map(e=>({...e,models:e.models.sort((e,t)=>t.total-e.total)})).sort((e,t)=>n(e.host)-n(t.host))}function ob(e,t){return t>0?Math.round(100*e/t):0}function sb(e){let t=new Map;for(let n of e){let e=`${n.host}\u0000${n.reason}`,r=t.get(e)??{host:n.host,reason:n.reason,count:0};r.count+=n.count,t.set(e,r)}return[...t.values()].sort((e,t)=>t.count-e.count)}function cb({row:e}){return(0,H.jsxs)(H.Fragment,{children:[[e.saved,e.skipped,e.failed].map((t,n)=>(0,H.jsxs)(`td`,{className:V(Yy,`text-end tabular-nums`),children:[t,` `,(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[ob(t,e.total),`%`]})]},n)),(0,H.jsx)(`td`,{className:V(Yy,`text-end font-medium tabular-nums`),children:e.total})]})}function lb(e,t){return`/api/settings/diagnostics?days=${e}${t===`all`?``:`&host=${t}`}`}function ub(){let e=Y(),[t,n]=(0,v.useState)(7),[r,i]=(0,v.useState)(`all`),[a,o]=(0,v.useState)(()=>new Set),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(``),[b]=(0,v.useState)(uy),x=(0,v.useCallback)(async(e,t)=>{let n=oy(),r=b.begin();try{let[i,a,o]=await Promise.all([X(lb(e,t)),X(`/api/settings/traces`),X(`/api/settings`)]);if(!r())return;c(i),u(a.traces),n.isCurrent()&&f(o),g(``)}catch(e){if(!r())return;g(e.message)}},[b]);(0,v.useEffect)(()=>{x(t,r)},[t,r,x]),(0,v.useEffect)(()=>cy(e=>f(e)),[]);async function S(n){if(!d)return;let i;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({revision:d.revision,edits:n})})}catch(e){i=e}let a=await sy()!==null;if(!i){y(``),await x(t,r),a||g(e(`Reload the page before saving again.`));return}g(ly(i.message,e(a?`Current settings were reloaded; check the values and save again.`:`The current settings could not be reloaded. Reload the page.`)))}async function C(e){try{let t=await X(`/api/settings/traces/${encodeURIComponent(e)}`);m(t.content)}catch(e){g(e.message)}}async function w(n){if(window.confirm(`${e(`Delete`)} ${n}?`))try{await X(`/api/settings/traces/${encodeURIComponent(n)}`,{method:`DELETE`}),m(``),await x(t,r)}catch(e){g(e.message)}}async function T(n){try{let{result:i}=await X(`/api/settings/capture-retry/${n}/run`,{method:`POST`,body:`{}`});y(e(i===`scheduled`?n===`pi`?`These turns retry at the next Pi session start.`:n===`claude-code`?`These turns retry at the next Claude Code session start.`:`These turns retry at the next OpenCode session start.`:i===`running`?`A retry is already running.`:`Retrying now.`)),await x(t,r)}catch(e){g(e.message)}}let E=d?.settings.captureTrace,D=Number(d?.settings.captureRetryRetentionHours?.value??72);return(0,H.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Capture diagnostics`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Capture diagnostics`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 pb-2 text-sm`,children:[e(`Time range`),(0,H.jsxs)(Dr,{"aria-label":e(`Time range`),className:`rounded-lg border border-border bg-background px-2 py-1`,value:t,onChange:e=>n(Number(e.target.value)),children:[(0,H.jsx)(`option`,{value:1,children:e(`24 hours`)}),(0,H.jsx)(`option`,{value:7,children:e(`7 days`)}),(0,H.jsx)(`option`,{value:30,children:e(`30 days`)}),(0,H.jsx)(`option`,{value:90,children:e(`90 days`)})]}),e(`Host`),(0,H.jsxs)(Dr,{"aria-label":e(`Host`),className:`rounded-lg border border-border bg-background px-2 py-1`,value:r,onChange:e=>i(e.target.value),children:[(0,H.jsx)(`option`,{value:`all`,children:e(`All`)}),[`opencode`,`pi`,`claude-code`].map(e=>(0,H.jsx)(`option`,{value:e,children:Yd(e)},e))]})]}),h&&(0,H.jsx)(`p`,{role:`alert`,children:h}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Saved: a memory was stored. Skipped: the model or a rule found nothing worth keeping, or the turn was private or trivial. Failed: the attempt hit an error. Total: the three added up. Each percentage is a share of its row's total.`)}),(0,H.jsx)(`div`,{className:Wy,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:Gy,children:e(`Outcomes by host`)}),(0,H.jsx)(`thead`,{className:Ky,children:(0,H.jsx)(`tr`,{children:[`Host / model`,`Saved`,`Skipped`,`Failed`,`Total`].map((t,n)=>(0,H.jsx)(`th`,{scope:`col`,className:V(qy,n>0&&`text-end`),children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:ab(s?.byModel??[]).map(t=>{let n=a.has(t.host);return(0,H.jsxs)(v.Fragment,{children:[(0,H.jsxs)(`tr`,{className:V(Jy,`font-medium`),children:[(0,H.jsx)(`td`,{className:Yy,children:(0,H.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1`,"aria-expanded":n,onClick:()=>o(e=>{let r=new Set(e);return n?r.delete(t.host):r.add(t.host),r}),children:[(0,H.jsx)(`span`,{"aria-hidden":!0,children:n?`▾`:`▸`}),Xd(t.host),(0,H.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,t.models.length,` `,e(t.models.length===1?`model`:`models`),`)`]})]})}),(0,H.jsx)(cb,{row:t})]}),n&&t.models.map(n=>(0,H.jsxs)(`tr`,{className:`border-t border-border transition-colors hover:bg-muted/30`,children:[(0,H.jsx)(`td`,{className:V(`px-3 py-1.5`,`ps-8`),children:n.label?(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:n.label}):(0,H.jsx)(`span`,{className:`text-xs italic text-muted-foreground`,title:e(`No model was recorded for these attempts. This happens with records written by older OMMS versions, and when an attempt stops before a model is chosen.`),children:e(`model not recorded`)})}),(0,H.jsx)(cb,{row:n})]},`${t.host}-${n.label??`none`}`))]},t.host)})})]})}),(0,H.jsx)(`div`,{className:Wy,children:(0,H.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,H.jsx)(`caption`,{className:Gy,children:e(`Failure reasons`)}),(0,H.jsx)(`thead`,{className:Ky,children:(0,H.jsxs)(`tr`,{children:[(0,H.jsx)(`th`,{scope:`col`,className:qy,children:e(`Host`)}),(0,H.jsx)(`th`,{scope:`col`,className:qy,children:e(`Reason`)}),(0,H.jsx)(`th`,{scope:`col`,className:V(qy,`text-end`),children:e(`Total`)})]})}),(0,H.jsx)(`tbody`,{children:sb(s?.byReason??[]).map((e,t)=>(0,H.jsxs)(`tr`,{className:Jy,children:[(0,H.jsx)(`td`,{className:V(Yy,`text-muted-foreground`),children:Xd(e.host)}),(0,H.jsx)(`td`,{className:V(Yy,`font-mono text-xs`),children:e.reason}),(0,H.jsx)(`td`,{className:V(Yy,`text-end tabular-nums`),children:e.count})]},`${e.host}-${e.reason}-${t}`))})]})}),(0,H.jsx)(`div`,{className:V(Wy,`max-h-72 overflow-y-auto`),children:(0,H.jsxs)(`table`,{className:`w-full min-w-max text-sm`,children:[(0,H.jsx)(`caption`,{className:Gy,children:e(`Recent attempts`)}),(0,H.jsx)(`thead`,{className:V(Ky,`sticky top-0`),children:(0,H.jsx)(`tr`,{children:[`Time`,`Host`,`Source`,`Session`,`Path`,`Model`,`Stop`,`Blocks`,`Prompt`,`Reply`,`Duration`,`Outcome`,`Reason`].map(t=>(0,H.jsx)(`th`,{scope:`col`,className:qy,children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:s?.recent.map((e,t)=>(0,H.jsx)(`tr`,{className:Jy,children:[Qp(e.timestamp),Xd(e.host),e.sourceType,e.sessionId,e.path,`${e.provider??``}/${e.model??``}`,e.stopReason,e.blockTypes?.join(`, `),e.promptChars,e.replyChars,e.durationMs,e.outcome,e.reason].map((e,t)=>(0,H.jsx)(`td`,{className:V(Yy,`whitespace-nowrap`),children:e??``},t))},`${e.timestamp}-${t}`))})]})}),(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3 text-sm`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:E?.value===!0,disabled:!d,onChange:t=>{t.target.checked&&!window.confirm(e(`Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.`))||S({captureTrace:t.target.checked})}}),` `,e(`Save capture traces`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Traces can contain conversation content after redaction. Keep tracing off unless you need it for debugging.`)}),E?.source===`project`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`This project turns tracing off. The global switch cannot turn it on here.`)}),[`captureTraceRetentionDays`,`captureAttemptRetentionDays`].map(t=>(0,H.jsxs)(`label`,{className:`block`,children:[e(t===`captureTraceRetentionDays`?`Trace retention (days)`:`Attempt retention (days)`),` `,(0,H.jsx)(`input`,{type:`number`,min:1,className:`ms-2 w-20 rounded border border-border bg-background p-1`,defaultValue:Number(d?.settings[t]?.value??30),onBlur:e=>{let n=Number(e.target.value);Number.isSafeInteger(n)&&n>0&&n!==d?.settings[t]?.value&&S({[t]:n})}},`${t}-${d?.settings[t]?.value}`)]},t)),(0,H.jsxs)(`label`,{className:`block`,children:[e(`Retry retention (hours)`),` `,(0,H.jsx)(`input`,{type:`number`,min:0,max:720,className:`ms-2 w-20 rounded border border-border bg-background p-1`,defaultValue:D,onBlur:e=>{let t=Number(e.target.value);Number.isSafeInteger(t)&&t>=0&&t<=720&&t!==D&&S({captureRetryRetentionHours:t})}},`captureRetryRetentionHours-${D}`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`When the capture model cannot be reached, OMMS keeps the turn and tries again later. Queued turns can hold conversation content after redaction. 0 turns the queue off and deletes waiting turns.`)}),(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Turns waiting for retry`)}),[`pi`,`opencode`,`claude-code`].map(t=>{let n=s?.retryQueue?.[t]??0;return(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`w-24`,children:Yd(t)}),(0,H.jsx)(`span`,{className:`tabular-nums`,children:n}),(0,H.jsx)(`button`,{type:`button`,disabled:n===0||D===0,className:`disabled:opacity-50`,onClick:()=>void T(t),children:e(`Retry now`)})]},t)}),_&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_}),(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Trace files`)}),l.map(t=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`span`,{children:[t.file,` (`,t.size,` bytes)`]}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void C(t.file),children:e(`View`)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void w(t.file),children:e(`Delete`)})]},t.file)),p&&(0,H.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:p})]})]})}function db(){let e=Y(),[t,n]=(0,v.useState)([]),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``);async function s(e){i(!0);try{let t=await X(`/api/settings/health`,{method:`POST`,body:JSON.stringify({testModels:e})});n(t.checks),o(``)}catch(e){o(e.message)}finally{i(!1)}}return(0,H.jsxs)(`section`,{id:`settings-health`,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Health`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Health`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:r,onClick:()=>void s(!1),children:e(`Run checks`)}),(0,H.jsx)(`button`,{className:`rounded-lg border border-border px-3 py-1.5 text-sm`,disabled:r,onClick:()=>void s(!0),children:e(`Run checks and test models`)})]}),r&&(0,H.jsx)(`p`,{role:`status`,children:e(`Checking…`)}),a&&(0,H.jsx)(`p`,{role:`alert`,children:a}),(0,H.jsx)(`ul`,{className:`space-y-2 text-sm`,children:t.map(t=>(0,H.jsxs)(`li`,{className:`rounded-lg border border-border p-2`,children:[(0,H.jsx)(`strong`,{className:t.status===`fail`?`text-red-600`:t.status===`warn`?`text-amber-600`:`text-green-600`,children:e(t.status).toUpperCase()}),` `,`· `,e(t.check),`: `,t.reason]},t.check))})]})}function fb(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0;X(`/api/settings`).then(t=>{e&&n(t)}).catch(t=>{e&&c(t.message)}),X(`/api/settings/web-autostart`).then(t=>{e&&i(t)}).catch(t=>{e&&c(t.message)}),X(`/api/settings/version`).then(t=>{e&&o(t)}).catch(()=>{});let t=cy(t=>{e&&n(t)});return()=>{e=!1,t()}},[]);async function d(n){if(t){u(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{webServerAutoStart:n},revision:t.revision})}),c(e(`Saved. The login item changes at the next Pi or OpenCode start.`))}catch(e){c(e.message)}await sy(),u(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Web app`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Web app`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!t?.settings.webServerAutoStart?.globalValue,disabled:l||!t,onChange:e=>void d(e.target.checked)}),e(`Start web app at login`)]}),(0,H.jsxs)(`p`,{className:`text-sm`,children:[e(`Login item`),`: `,e(r?.state??`not installed`)]}),r?.state===`unsupported`&&(0,H.jsx)(`p`,{role:`status`,children:e(`Login items are unsupported on this platform.`)}),r?.state===`no-runtime`&&(0,H.jsx)(`p`,{role:`status`,children:e(`Install Node or Bun to start the web app at login.`)}),a&&(0,H.jsx)(pb,{info:a}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Use these commands to apply the change now:`)}),(0,H.jsxs)(`div`,{className:`space-y-1 font-mono text-xs`,children:[(0,H.jsx)(`p`,{children:`om-memory-system web`}),(0,H.jsx)(`p`,{children:`om-memory-system web install`}),(0,H.jsx)(`p`,{children:`om-memory-system web uninstall`}),(0,H.jsx)(`p`,{children:`om-memory-system web status`})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:s})]})}function pb({info:e}){let t=Y(),n=hy(e);return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsxs)(`p`,{children:[t(`Running version`),`: `,e.running,` · `,t(`Global command`),`:`,` `,e.global??t(`not installed globally`)]}),n.kind===`older`&&(0,H.jsx)(`p`,{role:`status`,children:t(`A newer OMMS copy runs in place of the global install. The global install is optional. To update it:`)}),n.kind===`newer`&&(0,H.jsx)(`p`,{role:`status`,className:`text-amber-600`,children:t(`The global install is newer than the running OMMS. The next Pi or OpenCode start replaces the web app.`)}),n.kind===`missing`&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`OMMS is not installed globally. A global install is optional.`)}),n.command&&(0,H.jsx)(`p`,{className:`font-mono text-xs`,children:n.command})]})}function mb(e){let t=e.trim();return t===``||t.startsWith(`~/`)||t.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(t)||t.startsWith(`\\\\`)}function hb(e,t,n){return n?t:typeof e==`string`?e:``}function gb(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=t=>{e&&(n(t),i(e=>hb(t.settings.claudeConfigDir?.globalValue,e,l.current)))},r=oy();X(`/api/settings`).then(e=>{r.isCurrent()&&t(e)}).catch(t=>{e&&o(t.message)});let a=cy(e=>t(e));return()=>{e=!1,a()}},[]);async function u(){if(t){if(!mb(r)){o(e(`Enter a full path, or a path that starts with ~/.`));return}c(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{claudeConfigDir:r.trim()},revision:t.revision})}),l.current=!1,o(e(`Saved. Capture and import use this folder now.`))}catch(e){o(e.message)}await sy(),c(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Claude Code folder`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Claude Code folder`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`Set this when Claude Code does not use ~/.claude, for example when you start it with CLAUDE_CONFIG_DIR. Leave it empty to use the default.`)}),(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Claude Code folder`)}),(0,H.jsx)(`input`,{className:`w-full rounded border border-border bg-background p-2 font-mono`,placeholder:`~/.claude`,value:r,disabled:s||!t,onChange:e=>{l.current=!0,i(e.target.value)}})]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:s||!t,onClick:()=>void u(),children:e(`Save folder`)}),(0,H.jsx)(_b,{folder:t?.claudeFolder}),a&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:a})]})}function _b({folder:e}){let t=Y();if(!e)return null;let n={setting:t(`this setting`),env:t(`the CLAUDE_CONFIG_DIR variable of the web app`),default:t(`the default folder`)};return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsxs)(`p`,{children:[t(`Transcripts folder in use`),`: `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.root})]}),(0,H.jsxs)(`p`,{children:[t(`From`),`: `,n[e.source]]}),!e.exists&&(0,H.jsxs)(`p`,{role:`status`,className:`text-amber-600`,children:[t(`This folder does not exist. Claude Code capture and import will not work:`),` `,(0,H.jsx)(`span`,{className:`font-mono`,children:e.root})]})]})}function vb(e,t){return`/api/settings/log?lines=200${e===`all`?``:`&level=${e}`}${t?`&filter=capture`:``}`}function yb(e){let t=/^\d{4}-(\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(e);return t?`${t[1]} ${t[2]}`:e}function bb(e){return e.map(e=>{let t=e.message.replace(/\s*\n\s*/g,` `);return`${e.time} ${e.level.toUpperCase()} ${t}${e.data?`: ${e.data}`:``}`}).join(`
|
|
125
125
|
`)}function xb(e){return e.scrollHeight-e.scrollTop-e.clientHeight<24}var Sb={info:`info`,warn:`warning`,error:`destructive`};function Cb({level:e,guessed:t}){let n=Y(),r=(0,H.jsxs)(id,{variant:Sb[e],tabIndex:t?0:void 0,className:`w-14 justify-center`,children:[n(e),t&&(0,H.jsxs)(`span`,{className:`sr-only`,children:[`, `,n(`Level guessed from the message`)]})]});return t?(0,H.jsx)(Hp,{content:n(`Level guessed from the message`),children:r}):r}function wb({records:e,emptyText:t,label:n}){let r=(0,v.useRef)(null),i=(0,v.useRef)(!0);return(0,v.useLayoutEffect)(()=>{let e=r.current;e&&i.current&&(e.scrollTop=e.scrollHeight)},[e]),(0,H.jsx)(`div`,{ref:r,role:`log`,"aria-live":`off`,"aria-label":n,tabIndex:0,onScroll:()=>{r.current&&(i.current=xb(r.current))},className:`max-h-80 overflow-auto rounded-lg bg-background p-3 text-xs`,children:e.length===0?(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:t}):(0,H.jsx)(`ol`,{dir:`ltr`,className:`space-y-1.5 text-start`,children:e.map(e=>(0,H.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-2 gap-y-1`,children:[(0,H.jsx)(`time`,{dateTime:e.time,title:e.time,className:`shrink-0 font-mono text-muted-foreground`,children:yb(e.time)}),(0,H.jsx)(Cb,{level:e.level,guessed:e.guessed}),(0,H.jsxs)(`span`,{className:`min-w-0 basis-full break-words whitespace-pre-wrap sm:basis-0 sm:flex-1`,children:[e.message,e.data&&(0,H.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[` `,e.data]})]})]},e.seq))})})}var Tb=5e3,Eb=[{level:`all`,label:`All`},{level:`warn`,label:`Warning`},{level:`error`,label:`Error`}];function Db(e){let[t,n]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{let t=e.current;if(!t)return;let r=!0,i=document.visibilityState===`visible`,a=()=>n(r&&i),o=typeof IntersectionObserver>`u`?void 0:new IntersectionObserver(([e])=>{r=e?.isIntersecting??!0,a()});o?.observe(t);let s=()=>{i=document.visibilityState===`visible`,a()};return document.addEventListener(`visibilitychange`,s),a(),()=>{o?.disconnect(),document.removeEventListener(`visibilitychange`,s)}},[e]),t}function Ob(){let e=Y(),t=(0,v.useRef)(null),n=(0,v.useRef)(0),[r,i]=(0,v.useState)(`all`),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),h=Db(t),g=(0,v.useCallback)(async()=>{let e=++n.current;try{let t=await X(vb(r,a));if(e!==n.current)return;u(t),f(``)}catch(t){e===n.current&&f(t.message)}},[r,a]);(0,v.useEffect)(()=>{if(s){n.current++;return}g()},[g,s]),(0,v.useEffect)(()=>{if(s||!h)return;let e=setInterval(()=>void g(),Tb);return()=>clearInterval(e)},[s,h,g]);async function _(e){try{await navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3)}catch{m(!1)}}let y=l?.records??[],b=e(r===`all`&&!a?`No log has been written yet.`:`No matching log records.`);return(0,H.jsxs)(`section`,{ref:t,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Log`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Log`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[(0,H.jsx)(`div`,{role:`group`,"aria-label":e(`Level`),className:`flex gap-1.5`,children:Eb.map(t=>(0,H.jsx)(K,{type:`button`,size:`sm`,variant:r===t.level?`default`:`outline`,"aria-pressed":r===t.level,onClick:()=>i(t.level),children:e(t.label)},t.level))}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),` `,e(`Capture attempts only`)]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(K,{type:`button`,size:`sm`,variant:`outline`,"aria-pressed":s,onClick:()=>c(!s),children:e(s?`Resume`:`Pause`)}),(0,H.jsx)(K,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void g(),children:e(`Refresh`)}),(0,H.jsx)(K,{type:`button`,size:`sm`,variant:`outline`,disabled:y.length===0,onClick:()=>void _(bb(y)),children:e(`Copy visible records`)}),l&&(0,H.jsx)(K,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void _(l.path),children:e(`Copy log path`)}),(0,H.jsx)(`span`,{role:`status`,className:`text-xs text-muted-foreground`,children:p?e(`Copied`):s?e(`Paused`):``})]}),(0,H.jsx)(`p`,{dir:`ltr`,className:`break-all text-start font-mono text-xs text-muted-foreground`,children:l?.path}),d&&(0,H.jsx)(`p`,{role:`alert`,children:d}),(0,H.jsx)(wb,{records:y,label:e(`Log lines`),emptyText:l?b:e(`Loading log…`)})]})}var kb=[{code:`en`,name:`English`},{code:`id`,name:`Bahasa Indonesia`},{code:`zh`,name:`中文`},{code:`ja`,name:`日本語`},{code:`es`,name:`Español`},{code:`fr`,name:`Français`},{code:`de`,name:`Deutsch`},{code:`ru`,name:`Русский`},{code:`pt`,name:`Português`},{code:`ar`,name:`العربية`},{code:`ko`,name:`한국어`}];function Ab(e){return typeof e==`string`&&e?e:`auto`}function jb(e){let t=[...kb];return e!==`auto`&&!t.some(t=>t.code===e)&&t.push({code:e}),t}function Mb({value:e,onChange:t,disabled:n}){let r=Y();return(0,H.jsx)(`div`,{className:Er,children:(0,H.jsxs)(Dr,{id:`capture-language`,className:`w-full rounded-lg border border-border bg-background p-2 text-sm`,value:e,disabled:n,onChange:e=>t(e.target.value),children:[(0,H.jsx)(`option`,{value:`auto`,children:r(`Automatic`)}),jb(e).map(e=>(0,H.jsx)(`option`,{value:e.code,children:e.name??e.code},e.code))]})})}function Nb(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(t=>{e&&i(t.message)});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);async function s(n){if(t){o(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:{autoCaptureLanguage:n},revision:t.revision})}),i(e(`Saved. New memories use this language.`))}catch(e){i(e.message)}await sy(),o(!1)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory language`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory language`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`The language that new memory summaries are written in. Automatic detects it from your prompt, but a Latin-script prompt under 100 characters counts as English.`)}),(0,H.jsx)(`label`,{className:`block space-y-1 text-sm`,htmlFor:`capture-language`,children:e(`Summary language`)}),(0,H.jsx)(Mb,{value:Ab(t?.settings.autoCaptureLanguage?.value),disabled:a||!t,onChange:e=>void s(e)}),r&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:r})]})}function Pb({theme:e}){let{canvas:t,elevated:n,text:r,textSecondary:i,accent:a,border:o}=e.colours;return(0,H.jsxs)(`span`,{"aria-hidden":`true`,className:`flex h-9 w-14 shrink-0 flex-col justify-center gap-1 rounded-md border px-1.5`,style:{background:t,borderColor:o},children:[(0,H.jsx)(`span`,{className:`h-1.5 w-8 rounded-full`,style:{background:r}}),(0,H.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,H.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{background:i}}),(0,H.jsx)(`span`,{className:`size-2.5 rounded-full`,style:{background:a,boxShadow:`0 0 0 2px ${n}`}})]})]})}function Fb({variant:e,selected:t,filter:n,inUse:r,onSelect:i}){let a=Y(),o=a(e===`light`?`Light theme`:`Dark theme`),s=Hf(e).filter(e=>e.name.toLowerCase().includes(n));return(0,H.jsxs)(`fieldset`,{"aria-label":o,className:`flex min-w-0 flex-col gap-2`,children:[(0,H.jsxs)(`legend`,{className:`flex w-full items-center gap-2 pb-2`,children:[(0,H.jsx)(`span`,{className:`text-ui font-semibold`,children:o}),r?(0,H.jsx)(id,{children:a(`On screen now`)}):null]}),s.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`No theme matches.`)}):(0,H.jsx)(`div`,{className:`relative flex max-h-80 min-w-0 flex-col overflow-y-auto rounded-[10px] border border-border p-1`,children:s.map(n=>{let r=n.id===t;return(0,H.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 transition-colors duration-150 hover:bg-interactive-hover has-[:checked]:bg-selection has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-[-2px] has-[:focus-visible]:outline-ring`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`theme-${e}`,value:n.id,checked:r,onChange:()=>i(n.id),className:`sr-only`}),(0,H.jsx)(Pb,{theme:n}),(0,H.jsx)(`bdi`,{className:`min-w-0 flex-1 truncate text-ui`,children:n.name}),Wf(n)?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(`Default`)}):null,r?(0,H.jsx)(ae,{"aria-hidden":`true`,className:`size-4 shrink-0 text-primary-label`}):null]},n.id)})})]})}var Ib=[{value:`system`,label:`System`,Icon:tt},{value:`light`,label:`Light`,Icon:Pt},{value:`dark`,label:`Dark`,Icon:nt}],Lb={auto:`Automatic`,dmy:`Day month year`,mdy:`Month day year`,iso:`Year-month-day`},Rb={auto:`Automatic`,h23:`24-hour`,h12:`12-hour`};function zb(){let e=Y(),t=bp(),n=vp(),[r,i]=(0,v.useState)(``),a=r.trim().toLowerCase();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Theme`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`System follows your operating system and switches between the light and the dark theme. The choice stays in this browser.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,H.jsx)(`fieldset`,{"aria-label":e(`Theme mode`),className:`inline-flex rounded-[10px] border border-border p-0.5`,children:Ib.map(({value:n,label:r,Icon:i})=>(0,H.jsxs)(`label`,{className:`flex h-8 cursor-pointer items-center gap-1.5 rounded-md px-3 text-ui text-muted-foreground transition-colors duration-150 hover:bg-interactive-hover has-[:checked]:bg-selection has-[:checked]:text-foreground has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`theme-mode`,value:n,checked:t.mode===n,onChange:()=>xp(n),className:`sr-only`}),(0,H.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),e(r)]},n))}),(0,H.jsx)(ad,{type:`search`,"aria-label":e(`Filter themes`),placeholder:e(`Filter themes`),value:r,onChange:e=>i(e.target.value),className:`w-full sm:w-60`})]}),(0,H.jsxs)(`div`,{className:`grid min-w-0 grid-cols-1 gap-x-6 gap-y-4 md:grid-cols-2`,children:[(0,H.jsx)(Fb,{variant:`light`,selected:t.light,filter:a,inUse:n===`light`,onSelect:e=>Sp(`light`,e)}),(0,H.jsx)(Fb,{variant:`dark`,selected:t.dark,filter:a,inUse:n===`dark`,onSelect:e=>Sp(`dark`,e)})]})]})}function Bb(){let e=Y(),{dateFormat:t}=G(),n=new Date;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:e(`Date and time`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`How dates and times show in this web app. The choice stays in this browser.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Date format`)}),(0,H.jsx)(`div`,{className:Er,children:(0,H.jsx)(Dr,{"aria-label":e(`Date format`),className:`w-full`,value:t.date,onChange:e=>Li({date:e.target.value}),children:yi.map(r=>(0,H.jsx)(`option`,{value:r,children:`${e(Lb[r])} · ${rm(n,{...t,date:r})}`},r))})})]}),(0,H.jsxs)(`label`,{className:`block space-y-1 text-sm`,children:[(0,H.jsx)(`span`,{children:e(`Time format`)}),(0,H.jsx)(`div`,{className:Er,children:(0,H.jsx)(Dr,{"aria-label":e(`Time format`),className:`w-full`,value:t.time,onChange:e=>Li({time:e.target.value}),children:bi.map(r=>(0,H.jsx)(`option`,{value:r,children:`${e(Rb[r])} · ${tm(n,{...t,time:r})}`},r))})})]})]})]})}function Vb(){let e=Y();return(0,H.jsxs)(`section`,{className:`space-y-6 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Appearance`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Appearance`)}),(0,H.jsx)(zb,{}),(0,H.jsx)(Bb,{})]})}async function Hb(e,t){try{let n=await fetch(e,{method:t?`POST`:`GET`,headers:{"x-omms-token":window.__OMMS_TOKEN__??``,...t?{"Content-Type":`application/json`}:{}},...t?{body:JSON.stringify(t)}:{}}),r=await n.json();return r.success?{ok:!0,code:r.code??`ok`,data:r.data,message:r.message}:{ok:!1,code:r.code??`error`,error:r.error??`Request failed (${n.status})`,...r.savedContent===void 0?{}:{savedContent:r.savedContent}}}catch(e){return{ok:!1,code:`network`,error:e instanceof Error?e.message:String(e)}}}var Ub=(e,t)=>e?`path=${encodeURIComponent(e)}`:`name=${encodeURIComponent(t)}`,Wb={overview:()=>Hb(`/api/skills`),skill:(e,t,n)=>Hb(`/api/skills/skill?${Ub(e,t)}${n?`&turnLimit=${n.limit}&turnOffset=${n.offset}`:``}`),activity:(e={days:30})=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&t.set(n,String(r));return Hb(`/api/skills/activity?${t}`)},history:(e,t,n)=>Hb(`/api/skills/history?${Ub(e,t)}&limit=${n.limit}&offset=${n.offset}`),proposals:e=>Hb(e?`/api/skills/proposals?state=${e}`:`/api/skills/proposals`),proposal:e=>Hb(`/api/skills/proposals/${encodeURIComponent(e)}`),stats:()=>Hb(`/api/skills/stats`),turnFailures:e=>Hb(`/api/skills/turns/${e}/failures`),skillFailures:(e,t)=>Hb(`/api/skills/failures?${Ub(e,t)}`),explainFailures:(e,t)=>Hb(`/api/skills/explain-failures`,{path:e??void 0,name:e?void 0:t}),draftImprovement:e=>Hb(`/api/skills/draft`,{skill:e}),draftNew:(e,t)=>Hb(`/api/skills/draft`,{idea:e,folder:t}),ideas:()=>Hb(`/api/skills/ideas`,{}),apply:e=>Hb(`/api/skills/apply`,{id:e}),reject:e=>Hb(`/api/skills/reject`,{id:e}),undo:e=>Hb(`/api/skills/undo`,{id:e}),setMode:(e,t)=>Hb(`/api/skills/mode`,{skillPath:e,mode:t}),deleteTurns:()=>Hb(`/api/skills/delete-turns`,{confirm:!0}),recordPast:()=>Hb(`/api/skills/record-past`,{})};function Gb(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}function Kb(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>e.name.toLowerCase().includes(n)):e}function qb(e){return e.state===`applied`&&e.appliedBy===`automatic`?`applied automatically`:e.state}function Jb(e){return e.filter(e=>e.state!==`pending`).sort((e,t)=>t.updatedAt-e.updatedAt)}function Yb(e){return e.split(`
|
|
126
126
|
`).map(e=>e.startsWith(`@@`)?{kind:`hunk`,text:e}:e.startsWith(`+`)?{kind:`add`,text:e}:e.startsWith(`-`)?{kind:`del`,text:e}:{kind:`ctx`,text:e})}function Xb(e){if(e.diff===null)return{added:e.content.trim()?e.content.split(`
|
|
127
127
|
`).length:0,removed:0};let t=Yb(e.diff);return{added:t.filter(e=>e.kind===`add`).length,removed:t.filter(e=>e.kind===`del`).length}}function Zb(e){let{content:t,diff:n,...r}=e;return{...r,...Xb({content:t,diff:n}),hasDiff:n!==null}}var Qb=160;function $b(e){let t=e.summary??``;return t.length>Qb||t.split(`
|
|
128
|
-
`).length>2||e.hasDiff||e.added>0||e.evidenceTurnIds.length>0}var ex=e=>e.toLocaleString(`en-US`);function tx(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function nx(e,t){let n=t.trim();return n&&!e.includes(n)?[...e,n]:e}function rx(e,t){return e.filter(e=>e!==t)}var ix=[`done`,`failed`,`cancelled`],ax=e=>ix.includes(e.state);function ox(e){return e.summary?.skillTurnsRecorded===void 0?(e.hosts??[]).reduce((e,t)=>e+(t.summary?.skillTurnsRecorded??0),0):e.summary.skillTurnsRecorded}function sx(e){let t=e.total??0;return t>0?Math.min(100,Math.floor((e.processed??0)*100/t)):0}var cx={info:{box:`border-status-info/25 bg-status-info/10`,icon:`text-status-info`,Icon:Be},warning:{box:`border-status-warning/25 bg-status-warning/10`,icon:`text-status-warning`,Icon:Bt},danger:{box:`border-destructive/25 bg-destructive/10`,icon:`text-destructive-label`,Icon:at}};function lx({tone:e,children:t,className:n}){let{box:r,icon:i,Icon:a}=cx[e];return(0,H.jsxs)(`div`,{role:e===`danger`?`alert`:`note`,"data-tone":e,className:V(`flex min-w-0 items-start gap-2.5 rounded-xl border px-3 py-2.5 text-start text-sm`,r,n),children:[(0,H.jsx)(a,{className:V(`mt-0.5 size-4 shrink-0`,i),"aria-hidden":`true`}),(0,H.jsx)(`div`,{className:`min-w-0 space-y-1.5 text-foreground`,children:t})]})}function ux(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),s=(0,v.useRef)(!0),c=(0,v.useRef)(!1),l=(0,v.useRef)(e);l.current=e;let u=t?.id,d=!!t&&!ax(t);(0,v.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,v.useEffect)(()=>{if(!d)return;c.current=!0;let e=setInterval(()=>{X(`/api/settings/imports/current`).then(e=>{!s.current||!e.job||e.job.id!==u||n(e.job)}).catch(e=>{s.current&&o(e.message)})},1e3);return()=>clearInterval(e)},[d,u]),(0,v.useEffect)(()=>{t&&ax(t)&&c.current&&(c.current=!1,l.current())},[t]);async function f(){if(r||d)return;i(!0),o(``);let e=await Wb.recordPast();if(s.current){if(i(!1),!e.ok){o(e.error);return}n(e.data.job)}}return{job:t,running:d,starting:r,error:a,start:f}}function dx({onEnd:e}){let{job:t,running:n,starting:r,error:i,start:a}=ux(e);return(0,H.jsx)(fx,{job:t,running:n,starting:r,error:i,onStart:()=>void a()})}function fx({job:e,running:t,starting:n,error:r,onStart:i}){let a=Y(),o=e?sx(e):0;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:t||n,onClick:i,children:[(0,H.jsx)(Ct,{"aria-hidden":`true`}),a(`Record past turns`)]}),n?(0,H.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Ye,{className:`size-4 animate-spin`,"aria-hidden":`true`}),a(`Finding past sessions…`)]}):null,t&&e?(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-label":a(`Record past turns`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${o}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[a(`Skill turns`),`: `,ex(e.processed??0),` / `,ex(e.total??0),` ·`,` `,o,`%`]})]}):null,e&&ax(e)?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.state===`done`?Gb(a(`Recorded {count} past turns.`),{count:ex(ox(e))}):a(`Record past turns did not finish.`)}):null,r?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:r}):null]})}function px(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(!0);(0,v.useEffect)(()=>{o.current=!0,X(`/api/settings`).then(e=>{o.current&&t(e)}).catch(e=>{o.current&&r(e.message)});let e=cy(e=>{o.current&&t(e)});return()=>{o.current=!1,e()}},[]);async function s(t){if(!e)return n||`Settings are not loaded`;let r=null;return await dy(a,async()=>{try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:e.revision})})}catch(e){r=e.message}await sy()}),r}return{snapshot:e,loadError:n,busy:i,save:s}}function mx({label:e,checked:t,disabled:n,onChange:r}){return(0,H.jsxs)(`label`,{className:`flex min-w-0 items-start gap-2.5 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`mt-1 size-4 shrink-0`,checked:t,disabled:n,onChange:e=>r(e.target.checked)}),(0,H.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:e})]})}function hx(e){let t=Y(),{recording:n,redact:r,stats:i,busy:a,confirm:o}=e;return(0,H.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Skill learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Skill learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Record agent turns so OMMS can rank your skills and draft improvements.`)}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(mx,{label:t(`Record agent turns`),checked:n,disabled:a,onChange:e.onRecording}),e.projectOff?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`A project config turns recording off for this project.`)}):null,n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(lx,{tone:`warning`,children:[(0,H.jsx)(`p`,{children:t(`OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.`)}),(0,H.jsx)(`p`,{children:t(`The memory chat sends skill counts and short change summaries to the external API, never turn text.`)})]}),(0,H.jsx)(dx,{onEnd:e.onRecordPastEnd})]}):null]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(mx,{label:t(`Remove private text and secrets`),checked:r,disabled:a,onChange:e.onRedact}),o===`redact`?(0,H.jsxs)(lx,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:t(`Stop removing private text and secrets?`)}),(0,H.jsx)(`p`,{children:t(`New turns will be stored as written.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(K,{type:`button`,variant:`destructive`,size:`sm`,disabled:a,onClick:()=>e.onRedact(!1),children:t(`Turn off`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null,r?null:(0,H.jsx)(lx,{tone:`danger`,children:(0,H.jsx)(`p`,{children:t(`<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.`)})})]}),(0,H.jsxs)(`dl`,{className:`grid max-w-md grid-cols-2 gap-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`Recorded turns`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?ex(i.turns):`…`})]}),(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`File size`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?tx(i.fileSize):`…`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(K,{type:`button`,variant:`destructive`,size:`sm`,disabled:a||!i||i.turns===0,onClick:()=>e.onConfirm(`delete`),children:[(0,H.jsx)(Rt,{"aria-hidden":`true`}),t(`Delete recorded turns`)]}),o===`delete`&&i?(0,H.jsxs)(lx,{tone:`danger`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:Gb(t(`Delete {count} recorded turns? This cannot be undone.`),{count:ex(i.turns)})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(K,{type:`button`,variant:`destructive`,size:`sm`,onClick:e.onDeleteTurns,children:t(`Delete`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null]}),e.message?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.message}):null,e.failure?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:e.failure}):null]})}function gx(){let e=Y(),{snapshot:t,loadError:n,busy:r,save:i}=px(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(null),p=(0,v.useCallback)(async()=>{let e=await Wb.stats();e.ok&&o(e.data)},[]);(0,v.useEffect)(()=>{p()},[p]);let m=t?.settings.skillLearning;async function h(t){c(``),u(``),f(null);let n=await i(t);n?u(n):c(e(`Saved.`)),await p()}async function g(){f(null),u(``);let t=await Wb.deleteTurns();t.ok?c(Gb(e(`Deleted {count} recorded turns.`),{count:ex(t.data.deleted)})):u(t.error),await p()}return(0,H.jsx)(hx,{recording:m?.globalValue===!0,redact:t?.settings.skillLearningRedact?.globalValue!==!1,projectOff:m?.source===`project`&&m.value===!1,stats:a,busy:r||!t,confirm:d,message:s,failure:l||n,onRecording:e=>void h({skillLearning:e}),onRedact:e=>{e||d===`redact`?h({skillLearningRedact:e}):f(`redact`)},onConfirm:f,onDeleteTurns:()=>void g(),onRecordPastEnd:()=>void p()})}var _x={"settings-section-external-api":xy,"settings-section-models":vy,"settings-section-embedding":By,"settings-section-keys":tb,"settings-section-diagnostics":ub,"settings-section-health":db,"settings-section-claude-folder":gb,"settings-section-capture-language":Nb,"settings-section-appearance":Vb,"settings-section-profiles":nb,"settings-section-web-app":fb,"settings-section-skill-learning":gx,"settings-section-log":Ob};function vx(){return(0,v.useEffect)(()=>{sf(window.location.hash,document)},[]),(0,H.jsxs)(`div`,{className:`settings-view space-y-6`,children:[(0,H.jsx)(ty,{storageKey:`omms-settings-toc-open`,sections:Xv}),Xv.map(({id:e})=>{let t=_x[e];return(0,H.jsx)(`div`,{id:e,className:`scroll-mt-20 md:scroll-mt-4`,children:(0,H.jsx)(t,{})},e)})]})}function yx(e,t){return t?t.target:e.suggestion?.kind===`map`?e.suggestion.target:``}function bx(e,t){let n=new Map,r=new Map,i=[];for(let a of e){let e=t[a.directory],o=yx(a,e).trim();if(a.directory!==``&&o){let t=e||a.suggestion?.kind!==`map`?`exact`:a.suggestion.confidence,r=(n.get(a.directory)?.sessions??0)+a.sessions;n.set(a.directory,{from:a.directory,to:o,sessions:r,confidence:t})}else if(a.directory!==``&&!e&&a.suggestion?.kind===`ignore`){let e=(r.get(a.directory)?.sessions??0)+a.sessions;r.set(a.directory,{directory:a.directory,sessions:e,reason:a.suggestion.reason})}else i.push({...a})}return{maps:[...n.values()],ignores:[...r.values()],unmapped:i}}function xx(e){return new Set([...e.maps.filter(e=>e.confidence!==`guess`).map(e=>e.from),...e.ignores.map(e=>e.directory)])}function Sx(e,t,n,r){let i={},a=n.maps.filter(e=>r.has(e.from));if(a.length){let t=new Map(e.map(e=>[e.from,{...e}]));for(let e of a)t.set(e.from,{from:e.from,to:e.to});i.importPathMaps=[...t.values()]}let o=n.ignores.filter(e=>r.has(e.directory));return o.length&&(i.importIgnoredDirectories=[...new Set([...t,...o.map(e=>e.directory)])]),i}function Cx(e){let t=new Map;for(let n of e)t.set(n.to,[...t.get(n.to)??[],n]);return[...t].map(([e,t])=>({target:e,maps:t.sort((e,t)=>e.from.localeCompare(t.from))})).sort((e,t)=>t.maps.length-e.maps.length||e.target.localeCompare(t.target))}function wx(e){return e.filter(e=>e.directory!==``)}function Tx(e,t){return[...new Set([...e,...wx(t).map(e=>e.directory)])]}function Ex(e,t){return e(t===`exact`?`Exact`:t===`name`?`Name match`:`Guess`)}function Dx(e,t){return e(t===`temporary`?`Temporary folder`:t===`node_modules`?`node_modules folder`:t===`app-data`?`App data folder`:`Skills folder`)}function Ox({host:e,rows:t,decisions:n,busy:r,onDecide:i,onResolve:a,onIgnore:o,onIgnoreAll:s,open:c}){let l=Y(),u=t.filter(e=>e.directory!==``),d=u.filter(e=>yx(e,n[e.directory]).trim()).length;return(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{id:`directory-maps-${e}`,className:`scroll-mt-20 cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsxs)(`h3`,{className:`inline text-subsection-title font-semibold`,children:[Yd(e),`: `,l(`Unresolved directories`)]}),(0,H.jsxs)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:[l(`Directories`),`: `,u.length,` · `,l(`Unresolved sessions`),`:`,` `,t.reduce((e,t)=>e+t.sessions,0),` · `,l(`Rows with a target`),`:`,` `,d]})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[t.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`No unresolved directories in the latest run.`)}):(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`[&_button]:h-auto [&_button]:min-h-8 [&_button]:whitespace-normal [&_button]:py-1.5`,children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:r||u.length===0,onClick:a,children:l(`Smart resolve directories`)}),s&&u.length>0&&(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,className:`ms-2`,disabled:r,onClick:s,children:l(`Ignore all`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.`)})]}),t.map(e=>{if(e.directory===``)return(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[l(`No directory recorded`),` ·`,` `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,` ·`,` `,l(`These sessions cannot be mapped.`)]},`no-directory`);let t=n[e.directory],a=yx(e,t),s=!t&&e.suggestion?.kind===`ignore`?e.suggestion:null;return(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsxs)(`details`,{className:`min-w-0 flex-1`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.directory}),` `,`· `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,(0,H.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:s?(0,H.jsxs)(H.Fragment,{children:[l(`Suggested to ignore`),`: `,Dx(l,s.reason)]}):(0,H.jsxs)(H.Fragment,{children:[l(`Target directory`),`:`,` `,a?(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:a}):l(`No target chosen`)]})})]}),(0,H.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[!e.suggestion&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`No suggestion found.`)}),(0,H.jsx)(ad,{"aria-label":`${e.directory} ${l(`Target directory`)}`,dir:`ltr`,placeholder:l(`Target directory`),value:a,disabled:r,onChange:t=>i(e,t.target.value)})]})]}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,"aria-label":`${l(`Ignore`)} ${e.directory}`,disabled:r,onClick:()=>o(e),children:l(`Ignore`)})]},e.directory)})]})]})}function kx({host:e,review:t,busy:n,canConfirm:r,onRefresh:i,error:a,onClose:o,onConfirm:s}){let c=Y(),[l,u]=(0,v.useState)(()=>({review:t,ticked:xx(t)})),d=l.review===t?l.ticked:xx(t),f=(e,n)=>u(r=>{let i=new Set(r.review===t?r.ticked:xx(t));return n?i.add(e):i.delete(e),{review:t,ticked:i}}),p=[...t.maps.map(e=>e.from),...t.ignores.map(e=>e.directory)],m=p.filter(e=>d.has(e)).length,h=e=>(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[c(`Sessions`),`: `,e]});return(0,H.jsx)(zl,{open:!0,onOpenChange:e=>{!e&&!n&&o()},children:(0,H.jsxs)(q,{className:`sm:max-w-2xl flex flex-col overflow-hidden`,showCloseButton:!n,onEscapeKeyDown:e=>{n&&e.preventDefault()},onInteractOutside:e=>{n&&e.preventDefault()},children:[(0,H.jsxs)(Hl,{children:[(0,H.jsxs)(Wl,{children:[c(`Review directory maps`),`: `,Yd(e)]}),(0,H.jsx)(Gl,{children:c(`Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.`)})]}),(0,H.jsxs)(`div`,{className:`min-h-0 overflow-y-auto space-y-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm`,children:[c(`Proposed maps`),`: `,t.maps.length,` · `,c(`Suggested to ignore`),`:`,` `,t.ignores.length,` · `,c(`No target`),`: `,t.unmapped.length]}),!p.length&&(0,H.jsx)(`p`,{className:`text-sm`,children:c(`Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.`)}),t.maps.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Proposed maps`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Save this map`)} ${e.from}`,checked:d.has(e.from),disabled:n,onChange:t=>f(e.from,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.from}),(0,H.jsxs)(`div`,{className:`mt-1`,children:[c(`Target directory`),`:`,` `,(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.to})]}),(0,H.jsxs)(`div`,{className:`text-xs`,children:[c(`Confidence`),`: `,Ex(c,e.confidence)]}),h(e.sessions)]})]},e.from))})]}),t.ignores.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Suggested to ignore`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.ignores.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Ignore`)} ${e.directory}`,checked:d.has(e.directory),disabled:n,onChange:t=>f(e.directory,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{className:`mt-1`,children:Dx(c,e.reason)}),h(e.sessions)]})]},e.directory))})]}),t.unmapped.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`No target`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.unmapped.map((e,t)=>(0,H.jsxs)(`li`,{className:`min-w-0 border-t border-border pt-2 text-sm`,children:[e.directory===``?c(`No directory recorded`):(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{children:e.directory===``?c(`These sessions cannot be mapped.`):c(`No target chosen`)}),h(e.sessions)]},`${e.directory}-${t}`))})]})]}),a&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:n,onClick:o,children:c(`Cancel`)}),!r&&(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:c(`Refresh list`)}),(0,H.jsx)(K,{type:`button`,disabled:n||!r||m===0,onClick:()=>s(new Set(p.filter(e=>d.has(e)))),children:c(n?`Saving…`:`Confirm`)})]})]})})}function Ax({host:e,rows:t,busy:n,onConfirm:r,onCancel:i}){let a=Y(),o=t.reduce((e,t)=>e+t.sessions,0);return(0,H.jsx)(zl,{open:!0,onOpenChange:e=>!e&&!n&&i(),children:(0,H.jsxs)(q,{className:`sm:max-w-xl`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:`${a(`Ignore all`)}: ${Yd(e)}`}),(0,H.jsx)(Gl,{children:`${a(`These directories stay unimported and leave the unresolved counts.`)} ${a(`Directories`)}: ${t.length} · ${a(`Sessions`)}: ${o}`})]}),(0,H.jsx)(`ul`,{className:`max-h-64 space-y-1 overflow-y-auto text-sm`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e.directory}),(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sessions})]},e.directory))}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:a(`Cancel`)}),(0,H.jsx)(K,{type:`button`,disabled:n,onClick:r,children:a(`Ignore all`)})]})]})})}var jx=[`pi`,`opencode`,`claude-code`];function Mx({hosts:e=jx,saved:t=!0,title:n,anchorId:r}={}){let i=Y(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(new Set),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(),E=(0,v.useRef)(!1),D=(0,v.useRef)(void 0),O=()=>X(`/api/settings/import-maps`).then(e=>{u(e),f(new Set),m({})}).catch(e=>g(e.message));(0,v.useEffect)(()=>{let e=!0;X(`/api/settings`).then(t=>{e&&(D.current=t.revision,c(t))}).catch(t=>{e&&g(t.message)}),O();let t=cy(t=>{if(!e)return;let n=t;c(n),n.revision!==D.current&&(D.current=n.revision,X(`/api/settings/import-maps`).then(t=>{e&&D.current===n.revision&&u(t)}).catch(()=>{}))});return()=>{e=!1,t()}},[]);function k(e,t){E.current||w||(C(``),x({host:e,review:bx(t,p)}))}function A(e,t){m(n=>({...n,[e.directory]:{directory:e.directory,target:t}}))}let j=()=>s?.settings?.importPathMaps?.globalValue??l?.saved??[],M=()=>l?.ignored??[];async function N(e,t,n){if(!s||!l||E.current||w)return!E.current&&!w&&g(`The list is still loading. Try again in a moment.`),!1;E.current=!0,y(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:s.revision})})}catch(e){let t=e instanceof ny&&e.status===409;try{if(!t)return g(n),await sy(),!1;g(`Settings changed elsewhere. Check the list and try again.`);try{await te()}catch{T(`conflict`),g(`Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.`)}return!1}finally{E.current=!1,y(!1)}}g(t);try{await te()}catch{T(`saved`),g(`Saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}return!0}function P(){N({importPathMaps:gy(l?.saved??[],d)},`Saved. Removed maps stop applying at the next import or backfill run.`,`Removals could not be saved. Try again.`).then(e=>{e&&f(new Set)})}function ee(e){N({importIgnoredDirectories:[...new Set([...M(),e.directory])]},`Ignored. The directory stays unimported.`,`The directory could not be ignored. Try again.`)}function F(){if(!a)return;let{rows:e}=a;N({importIgnoredDirectories:Tx(M(),e)},`Ignored. The directories stay unimported.`,`The directories could not be ignored. Try again.`).then(e=>{e&&o(void 0)})}function I(e){N({importIgnoredDirectories:M().filter(t=>t!==e)},`Restored. The directory shows again in each host list that reported it.`,`The directory could not be restored. Try again.`)}async function te(){let[e,t]=await Promise.all([X(`/api/settings`),X(`/api/settings/import-maps`)]);D.current=e.revision,ay(e),u(t),T(void 0)}async function L(){if(E.current)return;E.current=!0,y(!0);let e=w===`saved`;try{await te(),e?g(`Saved. Maps apply to the next import or backfill run.`):b?C(`Settings changed elsewhere. Review these maps and confirm again.`):g(`Settings refreshed. No maps were saved.`)}catch{e?g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`):b?C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`):g(`Settings could not be refreshed. Try Refresh list again.`)}finally{E.current=!1,y(!1)}}async function ne(e){if(!s||!l||!b||E.current||w)return;let t=Sx(j(),M(),b.review,e);if(!t.importPathMaps&&!t.importIgnoredDirectories)return;E.current=!0,y(!0),C(``);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:s.revision})})}catch(e){let t=e instanceof ny&&e.status===409;if(C(t?`Settings changed elsewhere. Review these maps and confirm again.`:`Maps could not be saved. Review the targets and confirm again.`),t)try{await te()}catch{T(`conflict`),C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`)}E.current=!1,y(!1);return}let n=new Set(e);m(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))),f(e=>new Set([...e].filter(e=>!n.has(e)))),u(e=>e&&{...e,saved:t.importPathMaps??e.saved,ignored:t.importIgnoredDirectories??e.ignored}),x(void 0);let r=b.review.maps.filter(t=>e.has(t.from)).length,a=b.review.ignores.filter(t=>e.has(t.directory)).length;g(`${i(`Saved maps`)}: ${r} · ${i(`Ignored directories`)}: ${a}. ${i(`They apply to the next import or backfill run. No sessions were imported.`)}`);try{await te()}catch{T(`saved`),g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}}return(0,H.jsxs)(`section`,{id:r??`directory-maps`,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":i(n??`Resolve missing project folders`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:i(n??`Resolve missing project folders`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.`)}),t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Saved maps`)}),` ·`,` `,l?.saved.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Saved maps apply to every host.`)})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:_||!!w||!s||!l||d.size===0,onClick:P,children:i(`Save removals`)}),!l?.saved.length&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`none`)}),Cx(l?.saved??[]).map(e=>(0,H.jsxs)(`details`,{className:`min-w-0 border-t border-border pt-2`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded text-sm focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.target}),` `,`· `,e.maps.length]}),(0,H.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:e.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all ${d.has(e.from)?`line-through`:``}`,children:e.from}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${d.has(e.from)?i(`Keep`):i(`Remove`)} ${e.from}`,disabled:_,onClick:()=>f(t=>{let n=new Set(t);return n.has(e.from)?n.delete(e.from):n.add(e.from),n}),children:d.has(e.from)?i(`Keep`):i(`Remove`)})]},e.from))})]},e.target))]})]}),(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Ignored directories`)}),` `,`· `,l?.ignored?.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Ignored directories stay unimported and leave the unresolved counts.`)})]}),(0,H.jsxs)(`ul`,{className:`mt-3 space-y-1 text-sm`,children:[!l?.ignored?.length&&(0,H.jsx)(`li`,{className:`text-muted-foreground`,children:i(`none`)}),l?.ignored?.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${i(`Restore`)} ${e}`,disabled:_||!!w||!s,onClick:()=>I(e),children:i(`Restore`)})]},e))]})]})]}),e.map(t=>{let n=l?.[t]??[];return(0,H.jsx)(Ox,{host:t,rows:n,decisions:p,busy:_||!!w||!s||!l,onDecide:A,onResolve:()=>k(t,n),onIgnore:ee,onIgnoreAll:()=>o({host:t,rows:wx(n)}),open:e.length===1},t)}),a&&(0,H.jsx)(Ax,{host:a.host,rows:a.rows,busy:_,onConfirm:F,onCancel:()=>o(void 0)}),b&&(0,H.jsx)(kx,{host:b.host,review:b.review,busy:_,canConfirm:!w,error:i(S),onRefresh:()=>void L(),onClose:()=>{E.current||x(void 0)},onConfirm:e=>void ne(e)}),w&&!b&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:_,onClick:()=>void L(),children:i(`Refresh list`)}),h&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i(h)})]})}function Nx(e){return!e||e.total<=0?null:{percent:e.percent,done:`${e.done.toLocaleString(`en-US`)} / ${e.total.toLocaleString(`en-US`)}`,minutesLeft:e.minutesLeft===null?`unknown`:`about ${e.minutesLeft}`}}function Px(e,t){return e??!t}function Fx(e,t){let n=t.indexOf(`/`);if(t!==`inherit`&&t!==`external`&&(n<1||n===t.length-1))throw Error(`Enter a model as provider/model.`);return{[`${e}BackfillModel`]:t}}function Ix(e,t){if(t?.state===`running`)return t.phase===`profile`?{kind:`learning-profile`,done:t.profileDone??0,total:t.profileTotal??0}:{kind:`running`};if(t?.paused)return{kind:`paused`};if(t?.state===`failed`&&(t.updatedAt??t.startedAt??0)>=(e?.updatedAt??0))return{kind:`failed`,error:t.error??e?.error??null};if(!e||e.state===`not-started`)return t?.state===`done`?{kind:`imported`}:{kind:`not-started`};let n=t?.state===`done`&&(e.counts.failed??0)>0;return e.state===`failed`&&!n?{kind:`failed`,error:e.error}:e.state===`running`?{kind:`running`}:e.counts.pending>0?{kind:`stopped`,pending:e.counts.pending}:e.counts.unresolved>0?{kind:`partly`,unresolved:e.counts.unresolved}:{kind:`imported`}}function Lx(e){return e?.state===`running`&&e.phase!==`profile`}function Rx(e){return!e||e.state===`running`||!e.state||!e.updatedAt||!e.surface?null:{finishedAt:e.updatedAt,surface:e.surface,imported:e.imported??0,skipped:e.skipped??0,failed:e.failed??0,state:e.state}}function zx({host:e,backfill:t}){let n=Y(),{snapshot:r,lists:i,busy:a}=t,[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(),u=r?.settings??{},d=String(u[`${e}BackfillModel`]?.globalValue??`inherit`),f=o??d,p=i[e]?.models??[],m=Px(c,f===`inherit`||f===`external`||p.some(e=>`${e.provider}/${e.model}`===f)),h=py({memoryProvider:u.memoryProvider?.globalValue,memoryModel:u.memoryModel?.globalValue,memoryApiUrl:u.memoryApiUrl?.globalValue,keySet:!!r?.secrets?.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":`${Yd(e)} ${n(`settings`)}`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:`${Yd(e)} ${n(`settings`)}`}),e===`claude-code`?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Claude Code backfill always uses the external API. It has no backfill model setting.`)}):(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[n(`Backfill model`),(0,H.jsx)(`div`,{dir:`ltr`,children:(0,H.jsxs)(Dr,{"aria-label":`${Yd(e)} ${n(`Backfill model`)}`,className:`mt-1 block w-full`,value:m?`typed`:f,onChange:e=>{l(e.target.value===`typed`),s(e.target.value)},children:[(0,H.jsx)(`option`,{value:`inherit`,children:n(`Same as live capture`)}),(0,H.jsx)(`option`,{value:`external`,disabled:h.length>0,children:n(`External API`)}),p.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:n(`Manual provider/model`)})]})})]}),m&&(0,H.jsx)(`input`,{"aria-label":`${Yd(e)} ${n(`Manual provider/model`)}`,className:`w-full rounded-[10px] border border-border bg-card p-2`,dir:`ltr`,placeholder:`provider/model`,value:f===`typed`?``:f,onChange:e=>s(e.target.value)}),h.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n(`External API needs`),`: `,h.join(`, `)]}),i[e]?.available===!1&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i[e].reason?n(i[e].reason):n(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:a||!r,onClick:()=>t.saveModel(e,f),children:n(`Save model`)})]}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!u.autoBackfill?.globalValue,disabled:a||!r,onChange:e=>void t.save({autoBackfill:e.target.checked})}),n(`Import past chats automatically`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`This switch applies to every host. Automatic import makes model calls.`)})]})}var Bx={pi:{kind:`default`},opencode:{kind:`default`},"claude-code":{kind:`default`}},Vx=Bx,Hx=!1,Ux=new Set,Wx=e=>{Vx=e;for(let e of Ux)e()},Gx=e=>(Ux.add(e),()=>Ux.delete(e));async function Kx(e,t){let n=await X(e,t);Wx({...Bx,...n.hosts})}function qx(){let e=(0,v.useSyncExternalStore)(Gx,()=>Vx,()=>Bx);return(0,v.useEffect)(()=>{Hx||(Hx=!0,Kx(`/api/host-appearance`).catch(()=>{Hx=!1}))},[]),{looks:e,setIcon:(e,t)=>Kx(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`icon`,icon:t})}),setImage:(e,t)=>Kx(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`image`,png:t})}),reset:e=>Kx(`/api/host-appearance/${e}`,{method:`DELETE`})}}var Jx={anchor:j,atom:F,bird:I,"book-open":te,bot:L,braces:ne,brain:re,bug:R,cat:ie,cloud:pe,code:me,command:he,compass:ge,cpu:ve,database:ye,dog:be,feather:Ce,"file-code":we,fish:Te,flame:Ee,flower:De,folder:Ae,gem:je,ghost:Me,"git-branch":Ne,globe:Fe,hash:Ie,heart:Le,infinity:ze,key:Ve,layers:He,leaf:Ue,library:We,lightbulb:Ge,link:Ke,"message-square":Qe,moon:nt,mountain:rt,network:it,orbit:st,package:ct,"pen-tool":ft,plug:_t,puzzle:bt,rocket:St,server:Dt,settings:Ot,shield:kt,sparkles:At,"square-terminal":Mt,star:Nt,sun:Pt,target:It,terminal:Lt,"wand-sparkles":Wt,wrench:Kt,zap:Jt},Yx=Object.keys(Jx),Xx={pi:`Pi`,opencode:`OC`,"claude-code":`CC`};function Zx({host:e,look:t,className:n}){let r=V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border`,n);if(t.kind===`image`)return(0,H.jsx)(`span`,{className:V(r,`border-border bg-muted`),"aria-hidden":`true`,children:(0,H.jsx)(`img`,{src:t.image,alt:``,className:`size-full object-cover`})});let i=t.kind===`icon`?Jx[t.icon]:void 0,a=td(e);return(0,H.jsx)(`span`,{className:V(r,`text-ui font-semibold [color:oklch(0.42_0.13_var(--host-hue))] dark:[color:oklch(0.8_0.13_var(--host-hue))]`),style:{backgroundColor:`oklch(0.72 0.14 ${a} / 0.18)`,borderColor:`oklch(0.72 0.14 ${a} / 0.45)`,"--host-hue":String(a)},"aria-hidden":`true`,children:i?(0,H.jsx)(i,{className:`size-5`}):Xx[e]})}function Qx({className:e,iconClassName:t=`size-5`}){return(0,H.jsx)(`span`,{"aria-hidden":`true`,className:V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border border-border bg-muted text-muted-foreground`,e),children:(0,H.jsx)(He,{className:t})})}function $x({host:e,run:t,row:n}){let r=Y(),i=Lx(t)?Nx(t):null,a=Rx(t),o=Ix(n,t),s=`${ud(e)}#host-unresolved`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[o.kind===`learning-profile`&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`All exchanges are done. Learning the profile from the imported prompts`),`:`,` `,o.done,` / `,o.total,` `,r(`batches`)]}),i&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i.percent,"aria-label":r(`Import progress`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${i.percent}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[i.percent,`% · `,i.done,` · `,r(`Minutes left`),`:`,` `,i.minutesLeft===`unknown`?r(`unknown`):i.minutesLeft.replace(`about`,r(`about`))]})]}),t?.state===`running`&&t.surface&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:r(`started from ${t.surface}`)}),a&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`Last run`),`: `,Qp(a.finishedAt),` · `,r(`started from ${a.surface}`),` `,`· `,r(a.state),` · `,r(`Imported`),`: `,a.imported,` · `,r(`Skipped`),`:`,` `,a.skipped,` · `,r(`Failed`),`: `,a.failed]}),n&&(0,H.jsxs)(`div`,{className:`space-y-1 text-muted-foreground`,children:[!a&&(0,H.jsxs)(`p`,{children:[r(`Imported`),`: `,n.counts.imported,` · `,r(`Skipped`),`: `,n.counts.skipped,` ·`,` `,r(`Failed`),`: `,n.counts.failed]}),(0,H.jsxs)(`p`,{children:[r(`Pending`),`: `,n.counts.pending,` · `,r(`Unresolved sessions`),`:`,` `,n.counts.unresolved,n.counts.unresolved>0&&(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`a`,{className:`underline focus-visible:outline-2 focus-visible:outline-ring`,href:s,"aria-label":`${Yd(e)}: ${r(`Resolve missing project folders`)}`,onClick:e=>{e.preventDefault(),_f(s)},children:r(`Resolve missing project folders`)})]})]}),(0,H.jsxs)(`p`,{children:[r(`Model`),`: `,(0,H.jsx)(`bdi`,{dir:`ltr`,children:n.model??r(`none`)})]}),(0,H.jsxs)(`p`,{children:[r(`Cutoff`),`: `,Qp(n.cutoff)]}),n.error&&(0,H.jsx)(`p`,{role:`alert`,children:n.error})]})]})}function eS(e){let{run:t,runNowUnavailable:n}=e,r=n===null,i=n!==null&&e.host!==`claude-code`,a={text:`{reason}`,params:{reason:n??``}},o=(e,t,n,r=!0)=>({state:e,action:{kind:t,enabled:r},sentence:n,offerExternal:!1});if(!e.setUp)return o(`not-set-up`,`setup`,{text:`This host is not set up on this machine.`});if(t?.state===`running`){if(t.paused)return o(`running`,`pause`,{text:`Pausing after the current exchange.`},!1);let e=t.minutesLeft;return o(`running`,`pause`,{text:e===null?`Importing {done} / {total}.`:`Importing {done} / {total}. About {minutes} min left.`,params:{done:t.done,total:t.total,...e===null?{}:{minutes:e}}})}if(t?.paused)return{...o(`paused`,`resume`,r?{text:`Paused. Resume to continue.`}:a,r),offerExternal:i};if(t?.state===`failed`)return{...o(`failed`,`retry`,r?{text:`Stopped: {error}`,params:{error:t.error??`unknown error`}}:a,r),offerExternal:i};if(!r||t?.state===`stopped`&&e.pending>0)return{...o(`stopped`,`resume`,r?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:a,r),offerExternal:i};let s=t?.state===`done`&&t.total===0,c;return c=s&&e.cutoff!==null?{text:`Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.`,params:{date:e.formatDate(e.cutoff)}}:e.pending>0?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:{text:`Automatic import is on. Nothing is waiting.`},o(`running`,`pause`,c)}function tS(e){let{run:t}=e;if(!e.setUp)return{text:`Not set up`};if(t?.state===`running`)return{text:`Importing · {percent}%`,params:{percent:t.percent}};if(t?.paused)return{text:`Paused · {pending} pending`,params:{pending:e.pending}};if(t?.state===`failed`)return{text:`Failed`};if(e.runNowUnavailable!==null||t?.state===`stopped`&&e.pending>0)return{text:`Stopped · {pending} pending`,params:{pending:e.pending}};let n=t?.updatedAt&&t.state===`done`?e.formatDate(t.updatedAt):null,r=e.lastSaved===null?null:e.formatSaved(e.lastSaved);return n&&r?{text:`Running · history imported {date} · last saved {when}`,params:{date:n,when:r}}:n?{text:`Running · history imported {date}`,params:{date:n}}:r?{text:`Running · last saved {when}`,params:{when:r}}:{text:`Running`}}function nS(e,t){let n=e(t.text);return Object.entries(t.params??{}).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),n)}var rS={pi:`https://github.com/cmdaltctr/omms/blob/main/docs/pi-adapter.md`,opencode:`https://github.com/cmdaltctr/omms/blob/main/docs/opencode-adapter.md`,"claude-code":`https://github.com/cmdaltctr/omms/blob/main/docs/claude-code-adapter.md`},iS={"not-set-up":`Not set up`,running:`Running`,paused:`Paused`,failed:`Failed`,stopped:`Stopped`};function aS({host:e,statuses:t}){let n=Y(),{looks:r}=qx(),{backfill:i}=t,a=t.status(e),o=i.rows[e],s=i.runs?.[e]?.run??null,c=()=>{let t=a.action.kind;t===`pause`?i.control(e,`pause`):t===`resume`?i.control(e,`resume`):t===`retry`&&i.control(e,`run`)},l={setup:n(`How to set up`),pause:n(`Pause`),resume:n(`Resume`),retry:n(`Retry`)},u={pause:dt,resume:gt,retry:Tt,setup:Se}[a.action.kind];return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":Yd(e),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Zx,{host:e,look:r[e]}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:Yd(e)}),(0,H.jsxs)(`p`,{className:V(`text-sm`,a.state===`failed`?`text-destructive-label`:`text-muted-foreground`),children:[n(`State`),`: `,n(iS[a.state])]})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[a.action.kind===`setup`?(0,H.jsx)(K,{asChild:!0,variant:`outline`,children:(0,H.jsxs)(`a`,{href:rS[e],target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(Se,{"aria-hidden":`true`}),l.setup]})}):(0,H.jsxs)(K,{type:`button`,disabled:i.busy||!a.action.enabled,onClick:c,children:[(0,H.jsx)(u,{"aria-hidden":`true`}),l[a.action.kind]]}),a.offerExternal&&(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:i.busy,onClick:()=>i.saveModel(e,`external`),children:n(`Use external API`)})]}),(0,H.jsx)(`p`,{className:`break-words text-sm text-muted-foreground`,role:`status`,children:nS(n,a.sentence)}),a.state!==`not-set-up`&&(0,H.jsx)($x,{host:e,run:s,row:o}),i.message&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i.message}),a.action.kind!==`setup`&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Importing makes model calls and can cost money.`)})]})}function oS(e,t,n){let r=!n&&e!==null&&e.revision===t.revision;return{page:r?{...t,listedAt:e.listedAt}:t,sameListing:r}}function sS(e,t){let n=0;return async r=>{let i=++n;try{let t=await r;i===n&&e(t)}catch(e){i===n&&t?.(e)}}}function cS(e){let t=document.getElementById(`directory-maps-${e}`),n=t?.parentElement;if(!t||!n){typeof window<`u`&&window.location&&_f(`${J.memory}#directory-maps-${e}`);return}n.open=!0,t.focus({preventScroll:!0}),t.scrollIntoView?.(af)}function lS({badge:e,host:t}){let n=Y(),[r,i]=(()=>{switch(e.kind){case`imported`:return[`${n(`Imported`)} ✅`,`border-green-600/40 text-green-700`];case`partly`:return[`${n(`Partly imported`)} (${e.unresolved} ${n(`unresolved`)})`,`border-amber-500/50 text-amber-700`];case`running`:return[n(`Running`),`border-primary/50 text-primary`];case`learning-profile`:return[`${n(`Learning profile`)} ${e.done} / ${e.total}`,`border-primary/50 text-primary`];case`paused`:return[n(`Paused`),`border-border text-muted-foreground`];case`stopped`:return[`${n(`Stopped`)} (${e.pending} ${n(`pending`)})`,`border-amber-500/50 text-amber-700`];case`failed`:return[`${n(`Failed`)} ⛔️`,`border-red-600/40 text-red-700`];case`not-started`:return[n(`Not started`),`border-border text-muted-foreground`]}})(),a=V(`inline-block rounded-full border px-2 py-0.5 text-xs font-medium`,i);return e.kind===`partly`?(0,H.jsx)(`a`,{href:`/memory#directory-maps-${t}`,onClick:e=>{e.preventDefault(),cS(t)},"aria-label":`${Yd(t)}: ${n(`Resolve missing project folders`)}. ${r}`,className:V(a,`underline focus-visible:outline-2 focus-visible:outline-ring`),children:r}):(0,H.jsx)(`span`,{className:a,title:e.kind===`failed`&&e.error?e.error:void 0,children:r})}var uS=[`pi`,`opencode`,`claude-code`];function dS(){let e=Y(),[t,n]=(0,v.useState)({}),[r,i]=(0,v.useState)({});return(0,v.useEffect)(()=>{let e=sS(n),t=sS(i),r=()=>{e(X(`/api/settings/backfill`)),t(X(`/api/settings/backfill/runs`))};r();let a=setInterval(r,1e4),o=cy(r);return()=>{clearInterval(a),o()}},[]),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,"aria-label":e(`Import status`),children:uS.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:Yd(e)}),(0,H.jsx)(lS,{host:e,badge:Ix(t[e]??null,r[e]?.run??null)})]},e))})}function fS(e){let t=Y(),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),f=`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`;async function p(t){try{let n=await X(`/api/settings/imports/sources/validate`,{method:`POST`,body:JSON.stringify({host:e.host,path:t})});a(n),r(n.displayPath),e.onChoose(n),d(``)}catch(e){d(e.message)}}async function m(t){try{let n=await X(`/api/settings/imports/sources/browse`,{method:`POST`,body:JSON.stringify({host:e.host,...t?{path:t}:{}})});s(n),d(``)}catch(e){let t=e.message;/loopback/i.test(t)&&l(!0),d(t)}}function h(){a(null),r(``),s(null),e.onChoose(null)}return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[e.host===`pi`?t(`Pi sessions folder or one .jsonl session file`):e.host===`claude-code`?t(`Claude Code transcripts folder`):t(`OpenCode database file`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,dir:`ltr`,value:n,placeholder:t(`Absolute path, for example on a mounted volume`),onChange:e=>r(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:f,disabled:!n.trim(),onClick:()=>void p(n.trim()),children:t(`Use this source`)}),!c&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:()=>void m(o?.path),children:t(`Browse`)}),i&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:h,children:t(`Use the default location`)})]}),i&&(0,H.jsxs)(`p`,{role:`status`,children:[t(`Chosen source`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono break-all`,children:i.displayPath})]}),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),o&&(0,H.jsxs)(`div`,{className:`rounded border border-border p-2`,children:[(0,H.jsx)(`p`,{dir:`ltr`,className:`font-mono text-xs break-all`,children:o.path}),(0,H.jsxs)(`ul`,{className:`max-h-60 overflow-auto`,children:[o.parent&&(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(o.parent),children:`..`})}),o.entries.map(n=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2`,children:[n.kind===`folder`?(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(n.path),children:(0,H.jsxs)(`bdi`,{dir:`ltr`,children:[n.name,`/`]})}):(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono text-xs`,children:n.name}),(n.kind!==`folder`||e.host!==`opencode`)&&(0,H.jsx)(`button`,{type:`button`,className:`text-xs underline`,onClick:()=>void p(n.path),children:t(`Choose`)})]},n.path))]}),o.truncated&&(0,H.jsx)(`p`,{className:`text-xs`,children:t(`Only the first 500 entries are shown.`)})]})]})}function pS(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return t?[Number(t[1]),Number(t[2])-1,Number(t[3])]:null}function mS(e){let t=pS(e);return t?new Date(t[0],t[1],t[2],0,0,0,0).getTime():void 0}function hS(e){let t=pS(e);return t?new Date(t[0],t[1],t[2],23,59,59,999).getTime():void 0}var gS=[`pi`,`opencode`,`claude-code`],_S=()=>({mode:`ids`,picked:new Map});function vS(){let e=e=>({enabled:e,source:null,page:null,listedWith:``,selection:_S(),modelChoice:`external`});return{hosts:{pi:e(!0),opencode:e(!1),"claude-code":e(!1)},scope:`current-project`,project:``,maps:``,since:``,until:``,profileBatch:``,force:!1,memories:!0,profile:!0,skills:!0,showHandled:!1}}var yS=[`scope`,`project`,`memories`,`profile`,`skills`,`force`,`showHandled`];function bS(e,t){let n={...e,...t};if(yS.every(t=>n[t]===e[t]))return n;let r={...n.hosts};for(let e of gS)r[e]={...r[e],page:null,listedWith:``,selection:_S()};return{...n,hosts:r}}function xS(e,t){return JSON.stringify([e.hosts[t].source?.sourceToken,e.scope,e.project,e.maps,e.memories,e.profile,e.skills,e.force,e.showHandled])}function SS(e){return{skipMemories:e.skills||!e.memories,skipProfile:e.skills||!e.profile,force:e.force,includeHandled:e.showHandled||e.force,...e.skills&&!e.memories&&!e.profile?{skillTurnsOnly:!0}:{}}}function CS(e,t){let n=e.hosts[t].page;return n?n.total-(e.scope===`all-projects`?n.unresolvedCount:0):0}function wS(e,t){let n=e.hosts[t].selection;return n.mode===`all`?CS(e,t)-n.excluded.size:n.picked.size}function TS(e,t){if(!t.selectable||!t.directory)return e;if(e.mode===`all`){let n=new Set(e.excluded);return n.has(t.key)?n.delete(t.key):n.add(t.key),{mode:`all`,excluded:n}}let n=new Map(e.picked);return n.has(t.key)?n.delete(t.key):n.set(t.key,t.directory),{mode:`ids`,picked:n}}function ES(e){return e.split(`
|
|
128
|
+
`).length>2||e.hasDiff||e.added>0||e.evidenceTurnIds.length>0}var ex=e=>e.toLocaleString(`en-US`);function tx(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function nx(e,t){let n=t.trim();return n&&!e.includes(n)?[...e,n]:e}function rx(e,t){return e.filter(e=>e!==t)}var ix=[`done`,`failed`,`cancelled`],ax=e=>ix.includes(e.state);function ox(e){return e.summary?.skillTurnsRecorded===void 0?(e.hosts??[]).reduce((e,t)=>e+(t.summary?.skillTurnsRecorded??0),0):e.summary.skillTurnsRecorded}function sx(e){let t=e.total??0;return t>0?Math.min(100,Math.floor((e.processed??0)*100/t)):0}var cx={success:{box:`border-status-success/25 bg-status-success/10`,icon:`text-status-success`,Icon:fe},info:{box:`border-status-info/25 bg-status-info/10`,icon:`text-status-info`,Icon:Be},warning:{box:`border-status-warning/25 bg-status-warning/10`,icon:`text-status-warning`,Icon:Bt},danger:{box:`border-destructive/25 bg-destructive/10`,icon:`text-destructive-label`,Icon:at}};function lx({tone:e,children:t,className:n}){let{box:r,icon:i,Icon:a}=cx[e];return(0,H.jsxs)(`div`,{role:e===`danger`?`alert`:`note`,"data-tone":e,className:V(`flex min-w-0 items-start gap-2.5 rounded-xl border px-3 py-2.5 text-start text-sm`,r,n),children:[(0,H.jsx)(a,{className:V(`mt-0.5 size-4 shrink-0`,i),"aria-hidden":`true`}),(0,H.jsx)(`div`,{className:`min-w-0 space-y-1.5 text-foreground`,children:t})]})}function ux(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),s=(0,v.useRef)(!0),c=(0,v.useRef)(!1),l=(0,v.useRef)(e);l.current=e;let u=t?.id,d=!!t&&!ax(t);(0,v.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]),(0,v.useEffect)(()=>{if(!d)return;c.current=!0;let e=setInterval(()=>{X(`/api/settings/imports/current`).then(e=>{!s.current||!e.job||e.job.id!==u||n(e.job)}).catch(e=>{s.current&&o(e.message)})},1e3);return()=>clearInterval(e)},[d,u]),(0,v.useEffect)(()=>{t&&ax(t)&&c.current&&(c.current=!1,l.current())},[t]);async function f(){if(r||d)return;i(!0),o(``);let e=await Wb.recordPast();if(s.current){if(i(!1),!e.ok){o(e.error);return}n(e.data.job)}}return{job:t,running:d,starting:r,error:a,start:f}}function dx({onEnd:e}){let{job:t,running:n,starting:r,error:i,start:a}=ux(e);return(0,H.jsx)(fx,{job:t,running:n,starting:r,error:i,onStart:()=>void a()})}function fx({job:e,running:t,starting:n,error:r,onStart:i}){let a=Y(),o=e?sx(e):0;return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:t||n,onClick:i,children:[(0,H.jsx)(Ct,{"aria-hidden":`true`}),a(`Record past turns`)]}),n?(0,H.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,H.jsx)(Ye,{className:`size-4 animate-spin`,"aria-hidden":`true`}),a(`Finding past sessions…`)]}):null,t&&e?(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,"aria-label":a(`Record past turns`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${o}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[a(`Skill turns`),`: `,ex(e.processed??0),` / `,ex(e.total??0),` ·`,` `,o,`%`]})]}):null,e&&ax(e)?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.state===`done`?Gb(a(`Recorded {count} past turns.`),{count:ex(ox(e))}):a(`Record past turns did not finish.`)}):null,r?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:r}):null]})}function px(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(!0);(0,v.useEffect)(()=>{o.current=!0,X(`/api/settings`).then(e=>{o.current&&t(e)}).catch(e=>{o.current&&r(e.message)});let e=cy(e=>{o.current&&t(e)});return()=>{o.current=!1,e()}},[]);async function s(t){if(!e)return n||`Settings are not loaded`;let r=null;return await dy(a,async()=>{try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:e.revision})})}catch(e){r=e.message}await sy()}),r}return{snapshot:e,loadError:n,busy:i,save:s}}function mx({label:e,checked:t,disabled:n,onChange:r}){return(0,H.jsxs)(`label`,{className:`flex min-w-0 items-start gap-2.5 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`mt-1 size-4 shrink-0`,checked:t,disabled:n,onChange:e=>r(e.target.checked)}),(0,H.jsx)(`span`,{className:`min-w-0 break-words font-medium`,children:e})]})}function hx(e){let t=Y(),{recording:n,redact:r,stats:i,busy:a,confirm:o}=e;return(0,H.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Skill learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Skill learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Record agent turns so OMMS can rank your skills and draft improvements.`)}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(mx,{label:t(`Record agent turns`),checked:n,disabled:a,onChange:e.onRecording}),e.projectOff?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`A project config turns recording off for this project.`)}):null,n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(lx,{tone:`warning`,children:[(0,H.jsx)(`p`,{children:t(`OMMS stores full prompts, replies and tool calls in skills.db on this computer. Drafting sends recorded turns to the external API. The file holds whatever the turns hold.`)}),(0,H.jsx)(`p`,{children:t(`The memory chat sends skill counts and short change summaries to the external API, never turn text.`)})]}),(0,H.jsx)(dx,{onEnd:e.onRecordPastEnd})]}):null]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(mx,{label:t(`Remove private text and secrets`),checked:r,disabled:a,onChange:e.onRedact}),o===`redact`?(0,H.jsxs)(lx,{tone:`warning`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:t(`Stop removing private text and secrets?`)}),(0,H.jsx)(`p`,{children:t(`New turns will be stored as written.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(K,{type:`button`,variant:`destructive`,size:`sm`,disabled:a,onClick:()=>e.onRedact(!1),children:t(`Turn off`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null,r?null:(0,H.jsx)(lx,{tone:`danger`,children:(0,H.jsx)(`p`,{children:t(`<private> text, API keys and passwords will be stored as written and sent to the external API when drafting.`)})})]}),(0,H.jsxs)(`dl`,{className:`grid max-w-md grid-cols-2 gap-3 text-sm`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`Recorded turns`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?ex(i.turns):`…`})]}),(0,H.jsxs)(`div`,{className:`rounded-xl border border-border px-3 py-2.5`,children:[(0,H.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:t(`File size`)}),(0,H.jsx)(`dd`,{className:`font-medium tabular-nums`,children:i?tx(i.fileSize):`…`})]})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(K,{type:`button`,variant:`destructive`,size:`sm`,disabled:a||!i||i.turns===0,onClick:()=>e.onConfirm(`delete`),children:[(0,H.jsx)(Rt,{"aria-hidden":`true`}),t(`Delete recorded turns`)]}),o===`delete`&&i?(0,H.jsxs)(lx,{tone:`danger`,children:[(0,H.jsx)(`p`,{className:`font-medium`,children:Gb(t(`Delete {count} recorded turns? This cannot be undone.`),{count:ex(i.turns)})}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:[(0,H.jsx)(K,{type:`button`,variant:`destructive`,size:`sm`,onClick:e.onDeleteTurns,children:t(`Delete`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e.onConfirm(null),children:t(`Cancel`)})]})]}):null]}),e.message?(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:e.message}):null,e.failure?(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:e.failure}):null]})}function gx(){let e=Y(),{snapshot:t,loadError:n,busy:r,save:i}=px(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(null),p=(0,v.useCallback)(async()=>{let e=await Wb.stats();e.ok&&o(e.data)},[]);(0,v.useEffect)(()=>{p()},[p]);let m=t?.settings.skillLearning;async function h(t){c(``),u(``),f(null);let n=await i(t);n?u(n):c(e(`Saved.`)),await p()}async function g(){f(null),u(``);let t=await Wb.deleteTurns();t.ok?c(Gb(e(`Deleted {count} recorded turns.`),{count:ex(t.data.deleted)})):u(t.error),await p()}return(0,H.jsx)(hx,{recording:m?.globalValue===!0,redact:t?.settings.skillLearningRedact?.globalValue!==!1,projectOff:m?.source===`project`&&m.value===!1,stats:a,busy:r||!t,confirm:d,message:s,failure:l||n,onRecording:e=>void h({skillLearning:e}),onRedact:e=>{e||d===`redact`?h({skillLearningRedact:e}):f(`redact`)},onConfirm:f,onDeleteTurns:()=>void g(),onRecordPastEnd:()=>void p()})}var _x={"settings-section-external-api":xy,"settings-section-models":vy,"settings-section-embedding":By,"settings-section-keys":tb,"settings-section-diagnostics":ub,"settings-section-health":db,"settings-section-claude-folder":gb,"settings-section-capture-language":Nb,"settings-section-appearance":Vb,"settings-section-profiles":nb,"settings-section-web-app":fb,"settings-section-skill-learning":gx,"settings-section-log":Ob};function vx(){return(0,v.useEffect)(()=>{sf(window.location.hash,document)},[]),(0,H.jsxs)(`div`,{className:`settings-view space-y-6`,children:[(0,H.jsx)(ty,{storageKey:`omms-settings-toc-open`,sections:Xv}),Xv.map(({id:e})=>{let t=_x[e];return(0,H.jsx)(`div`,{id:e,className:`scroll-mt-20 md:scroll-mt-4`,children:(0,H.jsx)(t,{})},e)})]})}function yx(e,t){return t?t.target:e.suggestion?.kind===`map`?e.suggestion.target:``}function bx(e,t){let n=new Map,r=new Map,i=[];for(let a of e){let e=t[a.directory],o=yx(a,e).trim();if(a.directory!==``&&o){let t=e||a.suggestion?.kind!==`map`?`exact`:a.suggestion.confidence,r=(n.get(a.directory)?.sessions??0)+a.sessions;n.set(a.directory,{from:a.directory,to:o,sessions:r,confidence:t})}else if(a.directory!==``&&!e&&a.suggestion?.kind===`ignore`){let e=(r.get(a.directory)?.sessions??0)+a.sessions;r.set(a.directory,{directory:a.directory,sessions:e,reason:a.suggestion.reason})}else i.push({...a})}return{maps:[...n.values()],ignores:[...r.values()],unmapped:i}}function xx(e){return new Set([...e.maps.filter(e=>e.confidence!==`guess`).map(e=>e.from),...e.ignores.map(e=>e.directory)])}function Sx(e,t,n,r){let i={},a=n.maps.filter(e=>r.has(e.from));if(a.length){let t=new Map(e.map(e=>[e.from,{...e}]));for(let e of a)t.set(e.from,{from:e.from,to:e.to});i.importPathMaps=[...t.values()]}let o=n.ignores.filter(e=>r.has(e.directory));return o.length&&(i.importIgnoredDirectories=[...new Set([...t,...o.map(e=>e.directory)])]),i}function Cx(e){let t=new Map;for(let n of e)t.set(n.to,[...t.get(n.to)??[],n]);return[...t].map(([e,t])=>({target:e,maps:t.sort((e,t)=>e.from.localeCompare(t.from))})).sort((e,t)=>t.maps.length-e.maps.length||e.target.localeCompare(t.target))}function wx(e){return e.filter(e=>e.directory!==``)}function Tx(e,t){return[...new Set([...e,...wx(t).map(e=>e.directory)])]}function Ex(e,t){return e(t===`exact`?`Exact`:t===`name`?`Name match`:`Guess`)}function Dx(e,t){return e(t===`temporary`?`Temporary folder`:t===`node_modules`?`node_modules folder`:t===`app-data`?`App data folder`:`Skills folder`)}function Ox({host:e,rows:t,decisions:n,busy:r,onDecide:i,onResolve:a,onIgnore:o,onIgnoreAll:s,open:c}){let l=Y(),u=t.filter(e=>e.directory!==``),d=u.filter(e=>yx(e,n[e.directory]).trim()).length;return(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{id:`directory-maps-${e}`,className:`scroll-mt-20 cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsxs)(`h3`,{className:`inline text-subsection-title font-semibold`,children:[Yd(e),`: `,l(`Unresolved directories`)]}),(0,H.jsxs)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:[l(`Directories`),`: `,u.length,` · `,l(`Unresolved sessions`),`:`,` `,t.reduce((e,t)=>e+t.sessions,0),` · `,l(`Rows with a target`),`:`,` `,d]})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[t.length===0?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`No unresolved directories in the latest run.`)}):(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`[&_button]:h-auto [&_button]:min-h-8 [&_button]:whitespace-normal [&_button]:py-1.5`,children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:r||u.length===0,onClick:a,children:l(`Smart resolve directories`)}),s&&u.length>0&&(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,className:`ms-2`,disabled:r,onClick:s,children:l(`Ignore all`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`Smart resolve shows each proposed map and ignore in a dialog. Tick the ones to keep, then press Confirm. Nothing is saved before that.`)})]}),t.map(e=>{if(e.directory===``)return(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[l(`No directory recorded`),` ·`,` `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,` ·`,` `,l(`These sessions cannot be mapped.`)]},`no-directory`);let t=n[e.directory],a=yx(e,t),s=!t&&e.suggestion?.kind===`ignore`?e.suggestion:null;return(0,H.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsxs)(`details`,{className:`min-w-0 flex-1`,open:c||void 0,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.directory}),` `,`· `,e.sessions===1?l(`1 session`):`${e.sessions} ${l(`sessions`)}`,(0,H.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:s?(0,H.jsxs)(H.Fragment,{children:[l(`Suggested to ignore`),`: `,Dx(l,s.reason)]}):(0,H.jsxs)(H.Fragment,{children:[l(`Target directory`),`:`,` `,a?(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:a}):l(`No target chosen`)]})})]}),(0,H.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[!e.suggestion&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`No suggestion found.`)}),(0,H.jsx)(ad,{"aria-label":`${e.directory} ${l(`Target directory`)}`,dir:`ltr`,placeholder:l(`Target directory`),value:a,disabled:r,onChange:t=>i(e,t.target.value)})]})]}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0`,"aria-label":`${l(`Ignore`)} ${e.directory}`,disabled:r,onClick:()=>o(e),children:l(`Ignore`)})]},e.directory)})]})]})}function kx({host:e,review:t,busy:n,canConfirm:r,onRefresh:i,error:a,onClose:o,onConfirm:s}){let c=Y(),[l,u]=(0,v.useState)(()=>({review:t,ticked:xx(t)})),d=l.review===t?l.ticked:xx(t),f=(e,n)=>u(r=>{let i=new Set(r.review===t?r.ticked:xx(t));return n?i.add(e):i.delete(e),{review:t,ticked:i}}),p=[...t.maps.map(e=>e.from),...t.ignores.map(e=>e.directory)],m=p.filter(e=>d.has(e)).length,h=e=>(0,H.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[c(`Sessions`),`: `,e]});return(0,H.jsx)(zl,{open:!0,onOpenChange:e=>{!e&&!n&&o()},children:(0,H.jsxs)(q,{className:`sm:max-w-2xl flex flex-col overflow-hidden`,showCloseButton:!n,onEscapeKeyDown:e=>{n&&e.preventDefault()},onInteractOutside:e=>{n&&e.preventDefault()},children:[(0,H.jsxs)(Hl,{children:[(0,H.jsxs)(Wl,{children:[c(`Review directory maps`),`: `,Yd(e)]}),(0,H.jsx)(Gl,{children:c(`Tick the maps and ignores to keep, then press Confirm to save them. Saved maps apply to every host on the next import or backfill run.`)})]}),(0,H.jsxs)(`div`,{className:`min-h-0 overflow-y-auto space-y-4`,children:[(0,H.jsxs)(`p`,{className:`text-sm`,children:[c(`Proposed maps`),`: `,t.maps.length,` · `,c(`Suggested to ignore`),`:`,` `,t.ignores.length,` · `,c(`No target`),`: `,t.unmapped.length]}),!p.length&&(0,H.jsx)(`p`,{className:`text-sm`,children:c(`Nothing to save. Type a target in a row, or press Ignore for folders that are not projects.`)}),t.maps.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Proposed maps`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Save this map`)} ${e.from}`,checked:d.has(e.from),disabled:n,onChange:t=>f(e.from,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.from}),(0,H.jsxs)(`div`,{className:`mt-1`,children:[c(`Target directory`),`:`,` `,(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.to})]}),(0,H.jsxs)(`div`,{className:`text-xs`,children:[c(`Confidence`),`: `,Ex(c,e.confidence)]}),h(e.sessions)]})]},e.from))})]}),t.ignores.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`Suggested to ignore`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.ignores.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-border pt-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0`,"aria-label":`${c(`Ignore`)} ${e.directory}`,checked:d.has(e.directory),disabled:n,onChange:t=>f(e.directory,t.target.checked)}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{className:`mt-1`,children:Dx(c,e.reason)}),h(e.sessions)]})]},e.directory))})]}),t.unmapped.length>0&&(0,H.jsxs)(`section`,{className:`space-y-2`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:c(`No target`)}),(0,H.jsx)(`ul`,{className:`space-y-3`,children:t.unmapped.map((e,t)=>(0,H.jsxs)(`li`,{className:`min-w-0 border-t border-border pt-2 text-sm`,children:[e.directory===``?c(`No directory recorded`):(0,H.jsx)(`code`,{dir:`ltr`,className:`block break-all`,children:e.directory}),(0,H.jsx)(`div`,{children:e.directory===``?c(`These sessions cannot be mapped.`):c(`No target chosen`)}),h(e.sessions)]},`${e.directory}-${t}`))})]})]}),a&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:n,onClick:o,children:c(`Cancel`)}),!r&&(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:c(`Refresh list`)}),(0,H.jsx)(K,{type:`button`,disabled:n||!r||m===0,onClick:()=>s(new Set(p.filter(e=>d.has(e)))),children:c(n?`Saving…`:`Confirm`)})]})]})})}function Ax({host:e,rows:t,busy:n,onConfirm:r,onCancel:i}){let a=Y(),o=t.reduce((e,t)=>e+t.sessions,0);return(0,H.jsx)(zl,{open:!0,onOpenChange:e=>!e&&!n&&i(),children:(0,H.jsxs)(q,{className:`sm:max-w-xl`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:`${a(`Ignore all`)}: ${Yd(e)}`}),(0,H.jsx)(Gl,{children:`${a(`These directories stay unimported and leave the unresolved counts.`)} ${a(`Directories`)}: ${t.length} · ${a(`Sessions`)}: ${o}`})]}),(0,H.jsx)(`ul`,{className:`max-h-64 space-y-1 overflow-y-auto text-sm`,children:t.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e.directory}),(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sessions})]},e.directory))}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:n,onClick:i,children:a(`Cancel`)}),(0,H.jsx)(K,{type:`button`,disabled:n,onClick:r,children:a(`Ignore all`)})]})]})})}var jx=[`pi`,`opencode`,`claude-code`];function Mx({hosts:e=jx,saved:t=!0,title:n,anchorId:r}={}){let i=Y(),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(),[l,u]=(0,v.useState)(),[d,f]=(0,v.useState)(new Set),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(),E=(0,v.useRef)(!1),D=(0,v.useRef)(void 0),O=()=>X(`/api/settings/import-maps`).then(e=>{u(e),f(new Set),m({})}).catch(e=>g(e.message));(0,v.useEffect)(()=>{let e=!0;X(`/api/settings`).then(t=>{e&&(D.current=t.revision,c(t))}).catch(t=>{e&&g(t.message)}),O();let t=cy(t=>{if(!e)return;let n=t;c(n),n.revision!==D.current&&(D.current=n.revision,X(`/api/settings/import-maps`).then(t=>{e&&D.current===n.revision&&u(t)}).catch(()=>{}))});return()=>{e=!1,t()}},[]);function k(e,t){E.current||w||(C(``),x({host:e,review:bx(t,p)}))}function A(e,t){m(n=>({...n,[e.directory]:{directory:e.directory,target:t}}))}let j=()=>s?.settings?.importPathMaps?.globalValue??l?.saved??[],M=()=>l?.ignored??[];async function N(e,t,n){if(!s||!l||E.current||w)return!E.current&&!w&&g(`The list is still loading. Try again in a moment.`),!1;E.current=!0,y(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:s.revision})})}catch(e){let t=e instanceof ny&&e.status===409;try{if(!t)return g(n),await sy(),!1;g(`Settings changed elsewhere. Check the list and try again.`);try{await te()}catch{T(`conflict`),g(`Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.`)}return!1}finally{E.current=!1,y(!1)}}g(t);try{await te()}catch{T(`saved`),g(`Saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}return!0}function P(){N({importPathMaps:gy(l?.saved??[],d)},`Saved. Removed maps stop applying at the next import or backfill run.`,`Removals could not be saved. Try again.`).then(e=>{e&&f(new Set)})}function ee(e){N({importIgnoredDirectories:[...new Set([...M(),e.directory])]},`Ignored. The directory stays unimported.`,`The directory could not be ignored. Try again.`)}function F(){if(!a)return;let{rows:e}=a;N({importIgnoredDirectories:Tx(M(),e)},`Ignored. The directories stay unimported.`,`The directories could not be ignored. Try again.`).then(e=>{e&&o(void 0)})}function I(e){N({importIgnoredDirectories:M().filter(t=>t!==e)},`Restored. The directory shows again in each host list that reported it.`,`The directory could not be restored. Try again.`)}async function te(){let[e,t]=await Promise.all([X(`/api/settings`),X(`/api/settings/import-maps`)]);D.current=e.revision,ay(e),u(t),T(void 0)}async function L(){if(E.current)return;E.current=!0,y(!0);let e=w===`saved`;try{await te(),e?g(`Saved. Maps apply to the next import or backfill run.`):b?C(`Settings changed elsewhere. Review these maps and confirm again.`):g(`Settings refreshed. No maps were saved.`)}catch{e?g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`):b?C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`):g(`Settings could not be refreshed. Try Refresh list again.`)}finally{E.current=!1,y(!1)}}async function ne(e){if(!s||!l||!b||E.current||w)return;let t=Sx(j(),M(),b.review,e);if(!t.importPathMaps&&!t.importIgnoredDirectories)return;E.current=!0,y(!0),C(``);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:t,revision:s.revision})})}catch(e){let t=e instanceof ny&&e.status===409;if(C(t?`Settings changed elsewhere. Review these maps and confirm again.`:`Maps could not be saved. Review the targets and confirm again.`),t)try{await te()}catch{T(`conflict`),C(`Settings changed elsewhere and could not be refreshed. Refresh the list before confirming again.`)}E.current=!1,y(!1);return}let n=new Set(e);m(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))),f(e=>new Set([...e].filter(e=>!n.has(e)))),u(e=>e&&{...e,saved:t.importPathMaps??e.saved,ignored:t.importIgnoredDirectories??e.ignored}),x(void 0);let r=b.review.maps.filter(t=>e.has(t.from)).length,a=b.review.ignores.filter(t=>e.has(t.directory)).length;g(`${i(`Saved maps`)}: ${r} · ${i(`Ignored directories`)}: ${a}. ${i(`They apply to the next import or backfill run. No sessions were imported.`)}`);try{await te()}catch{T(`saved`),g(`Maps were saved, but the list could not be refreshed. Refresh the list without saving again.`)}finally{E.current=!1,y(!1)}}return(0,H.jsxs)(`section`,{id:r??`directory-maps`,className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":i(n??`Resolve missing project folders`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:i(n??`Resolve missing project folders`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`A directory map links a recorded project folder to its current folder. Saved maps apply globally to every host at the next import or backfill run. Review changes before saving.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`Map a directory that was moved or deleted to the project it belongs to. A change applies to the next import or backfill run.`)}),t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Saved maps`)}),` ·`,` `,l?.saved.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Saved maps apply to every host.`)})]}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`Keep a map after its sessions import. Every import checks the map before it skips a session, so removing a map makes its sessions unresolved again on the next run.`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:_||!!w||!s||!l||d.size===0,onClick:P,children:i(`Save removals`)}),!l?.saved.length&&(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`none`)}),Cx(l?.saved??[]).map(e=>(0,H.jsxs)(`details`,{className:`min-w-0 border-t border-border pt-2`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded text-sm focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`break-all`,children:e.target}),` `,`· `,e.maps.length]}),(0,H.jsx)(`ul`,{className:`mt-2 space-y-1 text-sm`,children:e.maps.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all ${d.has(e.from)?`line-through`:``}`,children:e.from}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${d.has(e.from)?i(`Keep`):i(`Remove`)} ${e.from}`,disabled:_,onClick:()=>f(t=>{let n=new Set(t);return n.has(e.from)?n.delete(e.from):n.add(e.from),n}),children:d.has(e.from)?i(`Keep`):i(`Remove`)})]},e.from))})]},e.target))]})]}),(0,H.jsxs)(`details`,{className:`min-w-0 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`summary`,{className:`cursor-pointer rounded font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h3`,{className:`inline text-subsection-title font-semibold`,children:i(`Ignored directories`)}),` `,`· `,l?.ignored?.length??0,(0,H.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-muted-foreground`,children:i(`Ignored directories stay unimported and leave the unresolved counts.`)})]}),(0,H.jsxs)(`ul`,{className:`mt-3 space-y-1 text-sm`,children:[!l?.ignored?.length&&(0,H.jsx)(`li`,{className:`text-muted-foreground`,children:i(`none`)}),l?.ignored?.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,H.jsx)(`code`,{dir:`ltr`,className:`min-w-0 flex-1 break-all`,children:e}),(0,H.jsx)(`button`,{type:`button`,className:`shrink-0 rounded border border-border px-2 py-0.5 text-xs`,"aria-label":`${i(`Restore`)} ${e}`,disabled:_||!!w||!s,onClick:()=>I(e),children:i(`Restore`)})]},e))]})]})]}),e.map(t=>{let n=l?.[t]??[];return(0,H.jsx)(Ox,{host:t,rows:n,decisions:p,busy:_||!!w||!s||!l,onDecide:A,onResolve:()=>k(t,n),onIgnore:ee,onIgnoreAll:()=>o({host:t,rows:wx(n)}),open:e.length===1},t)}),a&&(0,H.jsx)(Ax,{host:a.host,rows:a.rows,busy:_,onConfirm:F,onCancel:()=>o(void 0)}),b&&(0,H.jsx)(kx,{host:b.host,review:b.review,busy:_,canConfirm:!w,error:i(S),onRefresh:()=>void L(),onClose:()=>{E.current||x(void 0)},onConfirm:e=>void ne(e)}),w&&!b&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,disabled:_,onClick:()=>void L(),children:i(`Refresh list`)}),h&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i(h)})]})}function Nx(e){return!e||e.total<=0?null:{percent:e.percent,done:`${e.done.toLocaleString(`en-US`)} / ${e.total.toLocaleString(`en-US`)}`,minutesLeft:e.minutesLeft===null?`unknown`:`about ${e.minutesLeft}`}}function Px(e,t){return e??!t}function Fx(e,t){let n=t.indexOf(`/`);if(t!==`inherit`&&t!==`external`&&(n<1||n===t.length-1))throw Error(`Enter a model as provider/model.`);return{[`${e}BackfillModel`]:t}}function Ix(e,t){if(t?.state===`running`)return t.phase===`profile`?{kind:`learning-profile`,done:t.profileDone??0,total:t.profileTotal??0}:{kind:`running`};if(t?.paused)return{kind:`paused`};if(t?.state===`failed`&&(t.updatedAt??t.startedAt??0)>=(e?.updatedAt??0))return{kind:`failed`,error:t.error??e?.error??null};if(!e||e.state===`not-started`)return t?.state===`done`?{kind:`imported`}:{kind:`not-started`};let n=t?.state===`done`&&(e.counts.failed??0)>0;return e.state===`failed`&&!n?{kind:`failed`,error:e.error}:e.state===`running`?{kind:`running`}:e.counts.pending>0?{kind:`stopped`,pending:e.counts.pending}:e.counts.unresolved>0?{kind:`partly`,unresolved:e.counts.unresolved}:{kind:`imported`}}function Lx(e){return e?.state===`running`&&e.phase!==`profile`}function Rx(e){return!e||e.state===`running`||!e.state||!e.updatedAt||!e.surface?null:{finishedAt:e.updatedAt,surface:e.surface,imported:e.imported??0,skipped:e.skipped??0,failed:e.failed??0,state:e.state}}function zx({host:e,backfill:t}){let n=Y(),{snapshot:r,lists:i,busy:a}=t,[o,s]=(0,v.useState)(),[c,l]=(0,v.useState)(),u=r?.settings??{},d=String(u[`${e}BackfillModel`]?.globalValue??`inherit`),f=o??d,p=i[e]?.models??[],m=Px(c,f===`inherit`||f===`external`||p.some(e=>`${e.provider}/${e.model}`===f)),h=py({memoryProvider:u.memoryProvider?.globalValue,memoryModel:u.memoryModel?.globalValue,memoryApiUrl:u.memoryApiUrl?.globalValue,keySet:!!r?.secrets?.memoryApiKey?.set});return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":`${Yd(e)} ${n(`settings`)}`,children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:`${Yd(e)} ${n(`settings`)}`}),e===`claude-code`?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Claude Code backfill always uses the external API. It has no backfill model setting.`)}):(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[n(`Backfill model`),(0,H.jsx)(`div`,{dir:`ltr`,children:(0,H.jsxs)(Dr,{"aria-label":`${Yd(e)} ${n(`Backfill model`)}`,className:`mt-1 block w-full`,value:m?`typed`:f,onChange:e=>{l(e.target.value===`typed`),s(e.target.value)},children:[(0,H.jsx)(`option`,{value:`inherit`,children:n(`Same as live capture`)}),(0,H.jsx)(`option`,{value:`external`,disabled:h.length>0,children:n(`External API`)}),p.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsx)(`option`,{value:`typed`,children:n(`Manual provider/model`)})]})})]}),m&&(0,H.jsx)(`input`,{"aria-label":`${Yd(e)} ${n(`Manual provider/model`)}`,className:`w-full rounded-[10px] border border-border bg-card p-2`,dir:`ltr`,placeholder:`provider/model`,value:f===`typed`?``:f,onChange:e=>s(e.target.value)}),h.length>0&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n(`External API needs`),`: `,h.join(`, `)]}),i[e]?.available===!1&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i[e].reason?n(i[e].reason):n(`Model list unavailable. Enter provider/model manually.`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:a||!r,onClick:()=>t.saveModel(e,f),children:n(`Save model`)})]}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:!!u.autoBackfill?.globalValue,disabled:a||!r,onChange:e=>void t.save({autoBackfill:e.target.checked})}),n(`Import past chats automatically`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`This switch applies to every host. Automatic import makes model calls.`)})]})}var Bx={pi:{kind:`default`},opencode:{kind:`default`},"claude-code":{kind:`default`}},Vx=Bx,Hx=!1,Ux=new Set,Wx=e=>{Vx=e;for(let e of Ux)e()},Gx=e=>(Ux.add(e),()=>Ux.delete(e));async function Kx(e,t){let n=await X(e,t);Wx({...Bx,...n.hosts})}function qx(){let e=(0,v.useSyncExternalStore)(Gx,()=>Vx,()=>Bx);return(0,v.useEffect)(()=>{Hx||(Hx=!0,Kx(`/api/host-appearance`).catch(()=>{Hx=!1}))},[]),{looks:e,setIcon:(e,t)=>Kx(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`icon`,icon:t})}),setImage:(e,t)=>Kx(`/api/host-appearance/${e}`,{method:`PUT`,body:JSON.stringify({kind:`image`,png:t})}),reset:e=>Kx(`/api/host-appearance/${e}`,{method:`DELETE`})}}var Jx={anchor:j,atom:F,bird:I,"book-open":te,bot:L,braces:ne,brain:re,bug:R,cat:ie,cloud:pe,code:me,command:he,compass:ge,cpu:ve,database:ye,dog:be,feather:Ce,"file-code":we,fish:Te,flame:Ee,flower:De,folder:Ae,gem:je,ghost:Me,"git-branch":Ne,globe:Fe,hash:Ie,heart:Le,infinity:ze,key:Ve,layers:He,leaf:Ue,library:We,lightbulb:Ge,link:Ke,"message-square":Qe,moon:nt,mountain:rt,network:it,orbit:st,package:ct,"pen-tool":ft,plug:_t,puzzle:bt,rocket:St,server:Dt,settings:Ot,shield:kt,sparkles:At,"square-terminal":Mt,star:Nt,sun:Pt,target:It,terminal:Lt,"wand-sparkles":Wt,wrench:Kt,zap:Jt},Yx=Object.keys(Jx),Xx={pi:`Pi`,opencode:`OC`,"claude-code":`CC`};function Zx({host:e,look:t,className:n}){let r=V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border`,n);if(t.kind===`image`)return(0,H.jsx)(`span`,{className:V(r,`border-border bg-muted`),"aria-hidden":`true`,children:(0,H.jsx)(`img`,{src:t.image,alt:``,className:`size-full object-cover`})});let i=t.kind===`icon`?Jx[t.icon]:void 0,a=td(e);return(0,H.jsx)(`span`,{className:V(r,`text-ui font-semibold [color:oklch(0.42_0.13_var(--host-hue))] dark:[color:oklch(0.8_0.13_var(--host-hue))]`),style:{backgroundColor:`oklch(0.72 0.14 ${a} / 0.18)`,borderColor:`oklch(0.72 0.14 ${a} / 0.45)`,"--host-hue":String(a)},"aria-hidden":`true`,children:i?(0,H.jsx)(i,{className:`size-5`}):Xx[e]})}function Qx({className:e,iconClassName:t=`size-5`}){return(0,H.jsx)(`span`,{"aria-hidden":`true`,className:V(`grid size-10 shrink-0 place-items-center overflow-hidden rounded-[10px] border border-border bg-muted text-muted-foreground`,e),children:(0,H.jsx)(He,{className:t})})}function $x({host:e,run:t,row:n}){let r=Y(),i=Lx(t)?Nx(t):null,a=Rx(t),o=Ix(n,t),s=`${ud(e)}#host-unresolved`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[o.kind===`learning-profile`&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`All exchanges are done. Learning the profile from the imported prompts`),`:`,` `,o.done,` / `,o.total,` `,r(`batches`)]}),i&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i.percent,"aria-label":r(`Import progress`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-primary`,style:{width:`${i.percent}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[i.percent,`% · `,i.done,` · `,r(`Minutes left`),`:`,` `,i.minutesLeft===`unknown`?r(`unknown`):i.minutesLeft.replace(`about`,r(`about`))]})]}),t?.state===`running`&&t.surface&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:r(`started from ${t.surface}`)}),a&&(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[r(`Last run`),`: `,Qp(a.finishedAt),` · `,r(`started from ${a.surface}`),` `,`· `,r(a.state),` · `,r(`Imported`),`: `,a.imported,` · `,r(`Skipped`),`:`,` `,a.skipped,` · `,r(`Failed`),`: `,a.failed]}),n&&(0,H.jsxs)(`div`,{className:`space-y-1 text-muted-foreground`,children:[!a&&(0,H.jsxs)(`p`,{children:[r(`Imported`),`: `,n.counts.imported,` · `,r(`Skipped`),`: `,n.counts.skipped,` ·`,` `,r(`Failed`),`: `,n.counts.failed]}),(0,H.jsxs)(`p`,{children:[r(`Pending`),`: `,n.counts.pending,` · `,r(`Unresolved sessions`),`:`,` `,n.counts.unresolved,n.counts.unresolved>0&&(0,H.jsxs)(H.Fragment,{children:[` `,(0,H.jsx)(`a`,{className:`underline focus-visible:outline-2 focus-visible:outline-ring`,href:s,"aria-label":`${Yd(e)}: ${r(`Resolve missing project folders`)}`,onClick:e=>{e.preventDefault(),_f(s)},children:r(`Resolve missing project folders`)})]})]}),(0,H.jsxs)(`p`,{children:[r(`Model`),`: `,(0,H.jsx)(`bdi`,{dir:`ltr`,children:n.model??r(`none`)})]}),(0,H.jsxs)(`p`,{children:[r(`Cutoff`),`: `,Qp(n.cutoff)]}),n.error&&(0,H.jsx)(`p`,{role:`alert`,children:n.error})]})]})}function eS(e){let{run:t,runNowUnavailable:n}=e,r=n===null,i=n!==null&&e.host!==`claude-code`,a={text:`{reason}`,params:{reason:n??``}},o=(e,t,n,r=!0)=>({state:e,action:{kind:t,enabled:r},sentence:n,offerExternal:!1});if(!e.setUp)return o(`not-set-up`,`setup`,{text:`This host is not set up on this machine.`});if(t?.state===`running`){if(t.paused)return o(`running`,`pause`,{text:`Pausing after the current exchange.`},!1);let e=t.minutesLeft;return o(`running`,`pause`,{text:e===null?`Importing {done} / {total}.`:`Importing {done} / {total}. About {minutes} min left.`,params:{done:t.done,total:t.total,...e===null?{}:{minutes:e}}})}if(t?.paused)return{...o(`paused`,`resume`,r?{text:`Paused. Resume to continue.`}:a,r),offerExternal:i};if(t?.state===`failed`)return{...o(`failed`,`retry`,r?{text:`Stopped: {error}`,params:{error:t.error??`unknown error`}}:a,r),offerExternal:i};if(!r||t?.state===`stopped`&&e.pending>0)return{...o(`stopped`,`resume`,r?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:a,r),offerExternal:i};let s=t?.state===`done`&&t.total===0,c;return c=s&&e.cutoff!==null?{text:`Automatic import is on. Nothing was waiting before {date}. Use Sessions below for newer chats.`,params:{date:e.formatDate(e.cutoff)}}:e.pending>0?{text:`{pending} still waiting to import.`,params:{pending:e.pending}}:{text:`Automatic import is on. Nothing is waiting.`},o(`running`,`pause`,c)}function tS(e){let{run:t}=e;if(!e.setUp)return{text:`Not set up`};if(t?.state===`running`)return{text:`Importing · {percent}%`,params:{percent:t.percent}};if(t?.paused)return{text:`Paused · {pending} pending`,params:{pending:e.pending}};if(t?.state===`failed`)return{text:`Failed`};if(e.runNowUnavailable!==null||t?.state===`stopped`&&e.pending>0)return{text:`Stopped · {pending} pending`,params:{pending:e.pending}};let n=t?.updatedAt&&t.state===`done`?e.formatDate(t.updatedAt):null,r=e.lastSaved===null?null:e.formatSaved(e.lastSaved);return n&&r?{text:`Running · history imported {date} · last saved {when}`,params:{date:n,when:r}}:n?{text:`Running · history imported {date}`,params:{date:n}}:r?{text:`Running · last saved {when}`,params:{when:r}}:{text:`Running`}}function nS(e,t){let n=e(t.text);return Object.entries(t.params??{}).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,String(n)),n)}var rS={pi:`https://github.com/cmdaltctr/omms/blob/main/docs/pi-adapter.md`,opencode:`https://github.com/cmdaltctr/omms/blob/main/docs/opencode-adapter.md`,"claude-code":`https://github.com/cmdaltctr/omms/blob/main/docs/claude-code-adapter.md`},iS={"not-set-up":`Not set up`,running:`Running`,paused:`Paused`,failed:`Failed`,stopped:`Stopped`};function aS({host:e,statuses:t}){let n=Y(),{looks:r}=qx(),{backfill:i}=t,a=t.status(e),o=i.rows[e],s=i.runs?.[e]?.run??null,c=()=>{let t=a.action.kind;t===`pause`?i.control(e,`pause`):t===`resume`?i.control(e,`resume`):t===`retry`&&i.control(e,`run`)},l={setup:n(`How to set up`),pause:n(`Pause`),resume:n(`Resume`),retry:n(`Retry`)},u={pause:dt,resume:gt,retry:Tt,setup:Se}[a.action.kind];return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":Yd(e),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Zx,{host:e,look:r[e]}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:Yd(e)}),(0,H.jsxs)(`p`,{className:V(`text-sm`,a.state===`failed`?`text-destructive-label`:`text-muted-foreground`),children:[n(`State`),`: `,n(iS[a.state])]})]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[a.action.kind===`setup`?(0,H.jsx)(K,{asChild:!0,variant:`outline`,children:(0,H.jsxs)(`a`,{href:rS[e],target:`_blank`,rel:`noreferrer`,children:[(0,H.jsx)(Se,{"aria-hidden":`true`}),l.setup]})}):(0,H.jsxs)(K,{type:`button`,disabled:i.busy||!a.action.enabled,onClick:c,children:[(0,H.jsx)(u,{"aria-hidden":`true`}),l[a.action.kind]]}),a.offerExternal&&(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:i.busy,onClick:()=>i.saveModel(e,`external`),children:n(`Use external API`)})]}),(0,H.jsx)(`p`,{className:`break-words text-sm text-muted-foreground`,role:`status`,children:nS(n,a.sentence)}),a.state!==`not-set-up`&&(0,H.jsx)($x,{host:e,run:s,row:o}),i.message&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:i.message}),a.action.kind!==`setup`&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Importing makes model calls and can cost money.`)})]})}function oS(e,t,n){let r=!n&&e!==null&&e.revision===t.revision;return{page:r?{...t,listedAt:e.listedAt}:t,sameListing:r}}function sS(e,t){let n=0;return async r=>{let i=++n;try{let t=await r;i===n&&e(t)}catch(e){i===n&&t?.(e)}}}function cS(e){let t=document.getElementById(`directory-maps-${e}`),n=t?.parentElement;if(!t||!n){typeof window<`u`&&window.location&&_f(`${J.memory}#directory-maps-${e}`);return}n.open=!0,t.focus({preventScroll:!0}),t.scrollIntoView?.(af)}function lS({badge:e,host:t}){let n=Y(),[r,i]=(()=>{switch(e.kind){case`imported`:return[`${n(`Imported`)} ✅`,`border-green-600/40 text-green-700`];case`partly`:return[`${n(`Partly imported`)} (${e.unresolved} ${n(`unresolved`)})`,`border-amber-500/50 text-amber-700`];case`running`:return[n(`Running`),`border-primary/50 text-primary`];case`learning-profile`:return[`${n(`Learning profile`)} ${e.done} / ${e.total}`,`border-primary/50 text-primary`];case`paused`:return[n(`Paused`),`border-border text-muted-foreground`];case`stopped`:return[`${n(`Stopped`)} (${e.pending} ${n(`pending`)})`,`border-amber-500/50 text-amber-700`];case`failed`:return[`${n(`Failed`)} ⛔️`,`border-red-600/40 text-red-700`];case`not-started`:return[n(`Not started`),`border-border text-muted-foreground`]}})(),a=V(`inline-block rounded-full border px-2 py-0.5 text-xs font-medium`,i);return e.kind===`partly`?(0,H.jsx)(`a`,{href:`/memory#directory-maps-${t}`,onClick:e=>{e.preventDefault(),cS(t)},"aria-label":`${Yd(t)}: ${n(`Resolve missing project folders`)}. ${r}`,className:V(a,`underline focus-visible:outline-2 focus-visible:outline-ring`),children:r}):(0,H.jsx)(`span`,{className:a,title:e.kind===`failed`&&e.error?e.error:void 0,children:r})}var uS=[`pi`,`opencode`,`claude-code`];function dS(){let e=Y(),[t,n]=(0,v.useState)({}),[r,i]=(0,v.useState)({});return(0,v.useEffect)(()=>{let e=sS(n),t=sS(i),r=()=>{e(X(`/api/settings/backfill`)),t(X(`/api/settings/backfill/runs`))};r();let a=setInterval(r,1e4),o=cy(r);return()=>{clearInterval(a),o()}},[]),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,"aria-label":e(`Import status`),children:uS.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:Yd(e)}),(0,H.jsx)(lS,{host:e,badge:Ix(t[e]??null,r[e]?.run??null)})]},e))})}function fS(e){let t=Y(),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),f=`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`;async function p(t){try{let n=await X(`/api/settings/imports/sources/validate`,{method:`POST`,body:JSON.stringify({host:e.host,path:t})});a(n),r(n.displayPath),e.onChoose(n),d(``)}catch(e){d(e.message)}}async function m(t){try{let n=await X(`/api/settings/imports/sources/browse`,{method:`POST`,body:JSON.stringify({host:e.host,...t?{path:t}:{}})});s(n),d(``)}catch(e){let t=e.message;/loopback/i.test(t)&&l(!0),d(t)}}function h(){a(null),r(``),s(null),e.onChoose(null)}return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[e.host===`pi`?t(`Pi sessions folder or one .jsonl session file`):e.host===`claude-code`?t(`Claude Code transcripts folder`):t(`OpenCode database file`),(0,H.jsx)(`input`,{className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`,dir:`ltr`,value:n,placeholder:t(`Absolute path, for example on a mounted volume`),onChange:e=>r(e.target.value)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:f,disabled:!n.trim(),onClick:()=>void p(n.trim()),children:t(`Use this source`)}),!c&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:()=>void m(o?.path),children:t(`Browse`)}),i&&(0,H.jsx)(`button`,{type:`button`,className:f,onClick:h,children:t(`Use the default location`)})]}),i&&(0,H.jsxs)(`p`,{role:`status`,children:[t(`Chosen source`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono break-all`,children:i.displayPath})]}),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),o&&(0,H.jsxs)(`div`,{className:`rounded border border-border p-2`,children:[(0,H.jsx)(`p`,{dir:`ltr`,className:`font-mono text-xs break-all`,children:o.path}),(0,H.jsxs)(`ul`,{className:`max-h-60 overflow-auto`,children:[o.parent&&(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(o.parent),children:`..`})}),o.entries.map(n=>(0,H.jsxs)(`li`,{className:`flex items-center gap-2`,children:[n.kind===`folder`?(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void m(n.path),children:(0,H.jsxs)(`bdi`,{dir:`ltr`,children:[n.name,`/`]})}):(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono text-xs`,children:n.name}),(n.kind!==`folder`||e.host!==`opencode`)&&(0,H.jsx)(`button`,{type:`button`,className:`text-xs underline`,onClick:()=>void p(n.path),children:t(`Choose`)})]},n.path))]}),o.truncated&&(0,H.jsx)(`p`,{className:`text-xs`,children:t(`Only the first 500 entries are shown.`)})]})]})}function pS(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);return t?[Number(t[1]),Number(t[2])-1,Number(t[3])]:null}function mS(e){let t=pS(e);return t?new Date(t[0],t[1],t[2],0,0,0,0).getTime():void 0}function hS(e){let t=pS(e);return t?new Date(t[0],t[1],t[2],23,59,59,999).getTime():void 0}var gS=[`pi`,`opencode`,`claude-code`],_S=()=>({mode:`ids`,picked:new Map});function vS(){let e=e=>({enabled:e,source:null,page:null,listedWith:``,selection:_S(),modelChoice:`external`});return{hosts:{pi:e(!0),opencode:e(!1),"claude-code":e(!1)},scope:`current-project`,project:``,maps:``,since:``,until:``,profileBatch:``,force:!1,memories:!0,profile:!0,skills:!0,showHandled:!1}}var yS=[`scope`,`project`,`memories`,`profile`,`skills`,`force`,`showHandled`];function bS(e,t){let n={...e,...t};if(yS.every(t=>n[t]===e[t]))return n;let r={...n.hosts};for(let e of gS)r[e]={...r[e],page:null,listedWith:``,selection:_S()};return{...n,hosts:r}}function xS(e,t){return JSON.stringify([e.hosts[t].source?.sourceToken,e.scope,e.project,e.maps,e.memories,e.profile,e.skills,e.force,e.showHandled])}function SS(e){return{skipMemories:e.skills||!e.memories,skipProfile:e.skills||!e.profile,force:e.force,includeHandled:e.showHandled||e.force,...e.skills&&!e.memories&&!e.profile?{skillTurnsOnly:!0}:{}}}function CS(e,t){let n=e.hosts[t].page;return n?n.total-(e.scope===`all-projects`?n.unresolvedCount:0):0}function wS(e,t){let n=e.hosts[t].selection;return n.mode===`all`?CS(e,t)-n.excluded.size:n.picked.size}function TS(e,t){if(!t.selectable||!t.directory)return e;if(e.mode===`all`){let n=new Set(e.excluded);return n.has(t.key)?n.delete(t.key):n.add(t.key),{mode:`all`,excluded:n}}let n=new Map(e.picked);return n.has(t.key)?n.delete(t.key):n.set(t.key,t.directory),{mode:`ids`,picked:n}}function ES(e){return e.split(`
|
|
129
129
|
`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.indexOf(`=`);if(t<1||t===e.length-1)throw Error(`Directory maps must be old=new, one per line`);return{from:e.slice(0,t),to:e.slice(t+1)}})}function DS(e){if(!e.memories&&!e.profile&&!e.skills)return`Choose at least one output.`;if(!gS.some(t=>e.hosts[t].enabled))return`Choose at least one host.`;try{ES(e.maps);let t=e.since?mS(e.since):void 0,n=e.until?hS(e.until):void 0;if(t!==void 0&&n!==void 0&&t>n)return`Prompt date from must not be after Prompt date to.`}catch(e){return e.message}return e.profileBatch&&(!Number.isInteger(Number(e.profileBatch))||Number(e.profileBatch)<1)?`Profile batch size must be a positive integer.`:null}function OS(e,t){let n=DS(e);if(n)throw Error(n);return{hosts:gS.filter(t=>e.hosts[t].enabled).map(t=>{let n=e.hosts[t];if(!n.page||n.listedWith!==xS(e,t))throw Error(`Options changed. Refresh the session list first.`);let r=n.selection;return{host:t,source:n.page.source.sourceToken,modelChoice:n.modelChoice||void 0,selection:r.mode===`all`||CS(e,t)===0?{mode:`all`,excludedKeys:r.mode===`all`?[...r.excluded]:[],revision:n.page.revision,listedAt:n.page.listedAt,...e.showHandled||e.force?{includeHandled:!0}:{}}:{mode:`ids`,sessions:[...r.picked].map(([e,t])=>({key:e,directory:t})),listedAt:n.page.listedAt}}}),options:{dryRun:t,force:e.force,skipMemories:!e.memories,skipProfile:!e.profile,skipSkills:!e.skills,scope:e.scope,...e.scope===`current-project`&&e.project?{project:e.project}:{},...e.since?{since:mS(e.since)}:{},...e.until?{until:hS(e.until)}:{},...e.profileBatch?{profileBatch:Number(e.profileBatch)}:{},pathMaps:ES(e.maps)}}}function kS(e){return JSON.stringify({...e,hosts:gS.filter(t=>e.hosts[t].enabled).map(t=>{let n=e.hosts[t];return{host:t,...n,selection:n.selection.mode===`all`?{mode:`all`,excluded:[...n.selection.excluded].sort()}:{mode:`ids`,picked:[...n.selection.picked].sort()}}})})}var AS=`${J.settings}#settings-section-skill-learning`,jS=`mt-1 block w-full min-w-0 rounded border border-border bg-background p-2`,MS=`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`;function NS({draft:e,skillRecording:t,advanced:n,onChange:r,onAdvanced:i}){let a=Y();return(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-sm`,children:[(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Project memories`),checked:e.memories,onChange:e=>r({memories:e.target.checked})}),` `,a(`Project memories`)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`User profile`),checked:e.profile,onChange:e=>r({profile:e.target.checked})}),` `,a(`User profile`),` `,a(`(preferences, patterns, and workflows)`)]}),(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Skill turns`),checked:t&&e.skills,disabled:!t,onChange:e=>r({skills:e.target.checked})}),` `,a(`Skill turns`)]})]}),!t&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a(`Skill turns are recorded only while Record agent turns is on.`),` `,(0,H.jsx)(`a`,{className:`underline`,href:AS,onClick:e=>{e.preventDefault(),_f(AS)},children:a(`Open the Skill learning card`)})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[a(`Scope`),(0,H.jsx)(`div`,{className:Er,children:(0,H.jsxs)(Dr,{"aria-label":a(`Scope`),className:jS,value:e.scope,onChange:e=>r({scope:e.target.value}),children:[(0,H.jsx)(`option`,{value:`current-project`,children:a(`Current project`)}),(0,H.jsx)(`option`,{value:`all-projects`,children:a(`All projects`)})]})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Show handled sessions`),checked:e.showHandled,onChange:e=>r({showHandled:e.target.checked})}),` `,a(`Show handled sessions`)]}),(0,H.jsx)(`button`,{type:`button`,className:MS,onClick:i,"aria-expanded":n,children:a(n?`Hide advanced options`:`Advanced options`)}),(0,H.jsxs)(`div`,{hidden:!n,className:`space-y-3 rounded-lg border border-border p-3`,children:[(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e.scope===`current-project`&&(0,H.jsxs)(`label`,{className:`text-sm`,children:[a(`Project directory`),(0,H.jsx)(`input`,{"aria-label":a(`Project directory`),className:`mt-1 block w-full min-w-0 rounded border border-border bg-background p-2`,dir:`ltr`,value:e.project,placeholder:a(`Current directory`),onChange:e=>r({project:e.target.value})})]}),[[`Prompt date from`,`since`],[`Prompt date to`,`until`],[`Profile batch size`,`profileBatch`]].map(([t,n])=>(0,H.jsxs)(`label`,{className:`text-sm`,children:[a(t),(0,H.jsx)(`input`,{"aria-label":a(t),type:n===`profileBatch`?`text`:`date`,inputMode:n===`profileBatch`?`numeric`:void 0,className:jS,value:e[n],onChange:e=>r({[n]:e.target.value})})]},n))]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`Prompt dates are inclusive, use your time zone, and filter the turns inside each session, not the list. Empty dates include every turn.`)}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[a(`Directory maps (old=new, one per line)`),(0,H.jsx)(`textarea`,{"aria-label":a(`Directory maps (old=new, one per line)`),dir:`ltr`,className:jS,rows:2,value:e.maps,onChange:e=>r({maps:e.target.value})})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":a(`Re-analyse handled history`),checked:e.force,onChange:e=>r({force:e.target.checked})}),` `,a(`Re-analyse handled history`)]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a(`Re-analysis applies to the selected outputs. Each profile prompt can be forcibly re-analysed once. Findings merge into the existing profile.`)})]})]})}function PS({host:e,draft:t,readiness:n,advanced:r,listing:i,onChange:a,onList:o,onUnresolved:s}){let c=Y(),l=t.hosts[e],u=l.page,d=u&&l.listedWith!==xS(t,e),f=CS(t,e),p=e=>l.selection.mode===`all`?!l.selection.excluded.has(e.key):l.selection.picked.has(e.key),m={recorded:c(`recorded`),mapped:c(`mapped`),worktree:c(`project root`),unresolved:c(`missing`)},h=e===`pi`&&n?.piReader.available===!1;return(0,H.jsxs)(`section`,{hidden:!l.enabled,"aria-label":Yd(e),className:`space-y-3 rounded-lg border border-border p-3 min-w-0`,children:[(0,H.jsx)(`h3`,{className:`text-subsection-title font-semibold`,children:Yd(e)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Source`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`break-all`,children:l.source?.displayPath??u?.source.displayPath??c(`default location`)})]}),h&&(0,H.jsx)(`p`,{role:`alert`,children:c(n?.piReader.reason??`Pi session reader is unavailable. Fix the reader or deselect Pi.`)}),e===`claude-code`&&n?.claudeCode&&(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[c(`Claude Code transcripts`),`:`,` `,(0,H.jsx)(`bdi`,{dir:`ltr`,className:`font-mono break-all`,children:n.claudeCode.defaultRoot}),` `,`(`,c(n.claudeCode.defaultRootFound?`found`:`not found`),`).`,` `,c(`Claude Code imports always use the external API.`)]}),(0,H.jsx)(`div`,{hidden:!r,children:(0,H.jsx)(fS,{host:e,onChoose:e=>a({source:e})})}),(0,H.jsx)(`button`,{type:`button`,className:MS,disabled:i||h,onClick:()=>o(0,!0),children:c(u?`Refresh list`:`List sessions`)}),d&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:c(`Options changed. Refresh the session list first.`)}),u&&t.scope===`current-project`&&u.unresolvedCount>0&&(0,H.jsxs)(`p`,{className:`text-sm`,children:[c(`Sessions with directories that no longer exist`),`: `,u.unresolvedCount,`.`,` `,(0,H.jsx)(`button`,{type:`button`,className:`underline`,onClick:s,children:c(`Show them and add a directory map`)})]}),u&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsxs)(`span`,{role:`status`,children:[c(`Selected`),`: `,wS(t,e),` / `,f]}),(0,H.jsxs)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:f===0,onClick:()=>a({selection:{mode:`all`,excluded:new Set}}),children:[c(`Select all matching`),` (`,f,`)`]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,onClick:()=>a({selection:_S()}),children:c(`Clear selection`)})]}),(0,H.jsxs)(`div`,{className:`max-w-full overflow-x-auto`,children:[(0,H.jsxs)(`table`,{className:`w-full text-start text-sm`,children:[(0,H.jsx)(`thead`,{children:(0,H.jsx)(`tr`,{className:`text-muted-foreground`,children:[`Select`,`Created`,`Session`,`Project directory`,`Resolved by`].map(e=>(0,H.jsx)(`th`,{className:`p-1`,children:c(e)},e))})}),(0,H.jsx)(`tbody`,{children:u.rows.map(t=>(0,H.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,H.jsx)(`td`,{className:`p-1`,children:(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":`${Yd(e)}: ${c(`Select`)} ${t.sessionId??t.key}`,checked:t.selectable&&p(t),disabled:!t.selectable,onChange:()=>a({selection:TS(l.selection,t)})})}),(0,H.jsx)(`td`,{className:`p-1 whitespace-nowrap`,children:t.createdAt?Qp(t.createdAt):`—`}),(0,H.jsxs)(`td`,{className:`p-1 font-mono text-xs`,children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:t.sessionId??t.key}),t.handled&&(0,H.jsx)(`span`,{className:`ms-2 rounded border border-border px-1 font-sans text-muted-foreground`,children:c(`Handled`)})]}),(0,H.jsx)(`td`,{className:`p-1 font-mono text-xs break-all`,children:(0,H.jsx)(`bdi`,{dir:`ltr`,children:t.directory??t.recordedDirectory??`—`})}),(0,H.jsx)(`td`,{className:`p-1`,children:m[t.via]})]},t.key))})]}),u.total===0&&(0,H.jsx)(`p`,{className:`text-sm`,children:c(`No sessions match.`)}),(u.hiddenHandled??0)>0&&(0,H.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[c(`Handled sessions hidden`),`: `,u.hiddenHandled]})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:i||u.offset===0,onClick:()=>o(Math.max(0,u.offset-50),!1),children:c(`Previous`)}),(0,H.jsxs)(`span`,{children:[u.total?u.offset+1:0,`–`,Math.min(u.offset+50,u.total),` /`,` `,u.total]}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:i||u.offset+50>=u.total,onClick:()=>o(u.offset+50,!1),children:c(`Next`)})]})]}),(0,H.jsxs)(`label`,{className:`block text-sm`,children:[c(`Import model`),(0,H.jsx)(`div`,{dir:`ltr`,children:(0,H.jsxs)(Dr,{"aria-label":c(`Import model`),className:jS,value:l.modelChoice,onChange:e=>a({modelChoice:e.target.value}),children:[(0,H.jsx)(`option`,{value:``,children:c(`None`)}),e!==`claude-code`&&n?.opencode.models.map(e=>(0,H.jsxs)(`option`,{value:`${e.provider}/${e.model}`,children:[e.name,` (`,e.provider,`/`,e.model,`)`]},`${e.provider}/${e.model}`)),(0,H.jsxs)(`option`,{value:`external`,children:[c(`Saved external API`),n&&n.external.state!==`ready`?` (${c(`not ready`)})`:``]})]})})]}),e!==`claude-code`&&n&&!n.opencode.available&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`An import with an OpenCode signed-in model runs from the terminal or with /import in OpenCode.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c(`Configured, not tested.`)})]})}var FS=`omms-memory-import-hosts`;function IS(e,t){try{let n=t??localStorage,r=gS.filter(t=>e.hosts[t].enabled);n.setItem(FS,JSON.stringify({hosts:r,scope:e.scope,skills:e.skills}))}catch{}}function LS(e,t){try{let n=t??localStorage,r=JSON.parse(n.getItem(`omms-memory-import-hosts`)??`null`);if(!r||typeof r!=`object`)return e;let{hosts:i,scope:a,skills:o}=r;return Array.isArray(i)&&i.length>0&&i.every(e=>gS.includes(e))&&(a===`current-project`||a===`all-projects`)?{...e,scope:a,skills:typeof o==`boolean`?o:e.skills,hosts:Object.fromEntries(gS.map(t=>[t,{...e.hosts[t],enabled:i.includes(t)}]))}:e}catch{return e}}var RS={"missing-model":`The external API has no memoryModel in the global config`,"missing-url":`The external API has no memoryApiUrl in the global config`,"missing-key":`The external API key is missing in the OpenCode process; check memoryApiKey and its env:// or file:// source`,"unsupported-provider":`The memoryProvider in the global config is not supported for imports`};function zS(e,t,n,r){return!t.memories&&!t.profile?null:e.map(e=>{let i=t.hosts[e].modelChoice,a=null;return n?i?i===`external`&&n.external.state!==`ready`?a=RS[n.external.state]??`The external API is not ready`:e===`claude-code`&&i!==`external`?a=`Claude Code imports use the external API. Complete the external API settings.`:i!==`external`&&!n.opencode.models.some(e=>`${e.provider}/${e.model}`===i)&&(a=`No import model is ready. Connect a model in OpenCode or complete the external API settings.`):a=`No import model is ready. Connect a model in OpenCode or complete the external API settings.`:a=`Model readiness is unknown. Reload the page.`,a?`${Yd(e)}: ${r(a)}`:null}).find(Boolean)??null}var BS=[`running`,`cancelling`],VS=[`done`,`failed`,`cancelled`];function HS(e){if(!e||e.dryRun||!BS.includes(e.state))return null;let t=e.hosts?.find(e=>e.state===`running`);if(!t)return null;let n=t.phase===`profile`,r=(n?t.profileProcessed:t.processed)??0,i=(n?t.profileTotal:t.total)??0;return{host:t.host,phase:n?`profile`:t.phase===`skill-turns`?`skill-turns`:`memory`,done:r,total:i,percent:i>0?Math.min(100,Math.floor(r*100/i)):0}}function US(e,t,n){return!t||t.dryRun||!VS.includes(t.state)||t.state===`cancelled`||t.id===n?`none`:e?e.id===t.id&&VS.includes(e.state)?`none`:`dialog`:`banner`}function WS(e){return e?e.hosts?.length?e.hosts.reduce((e,t)=>e+(t.summary?.unitsFailed??0),0):e.summary?.unitsFailed??0:0}function GS(e){return e.hosts?.find(e=>e.error)?.error??e.error}var KS=`Could not reload the settings. Reload the page.`;async function qS(e,t){let[n]=await Promise.all([e(),t().catch(()=>{})]);return n===null?KS:null}var JS=`omms.import.dismissedEnd`;function YS(){try{return window.localStorage.getItem(JS)}catch{return null}}function XS(e){try{window.localStorage.setItem(JS,e)}catch{}}function ZS(e,t){let n=e.summary,r=n?.profile;return[[`sessions`,e.sessions],[`Memory units`,n?.unitsTotal??e.total],[`Pending memory units`,n?.unitsWouldImport],[`Imported memory units`,n?.unitsImported],[`Already handled memory units`,n?.unitsAlreadyHandled],[`Skipped memory units`,n?.unitsSkipped],[`Failed memory units`,n?.unitsFailed],[`Held-back turns`,n?.unitsHeldBack],[`Untimed turns`,n?.unitsUntimed],[`Skill turns to record`,n?.skillTurnsWouldRecord],[`Skill turns already recorded`,n?.skillTurnsAlreadyRecorded],[`Skill turns recorded`,n?.skillTurnsRecorded],[`Skill turns already present`,n?.skillTurnsAlreadyPresent],[`Load errors`,n?.loadErrors],[`Profile prompts`,r?r.promptsRecorded+r.promptsWouldRecord:void 0],[`Already handled profile prompts`,r?.promptsAlreadyHandled],[`Profile batches`,r?.batchesBuilt],[`Estimated profile analysis calls`,e.profileEstimate?.analysisCalls],[`Waiting prompts inside OMMS`,e.profileEstimate?.waitingPrompts],[`Unresolved sessions`,n?.unresolved]].filter(([,e])=>e!==void 0).map(([e,n])=>`${t(String(e))}: ${n}`).join(` · `)}function QS(e,t){let n=e.match(/^(Pi|OpenCode|Claude Code): /),r=n?e.slice(n[0].length):e,i=`Refresh the preview and retry.`,a=r.endsWith(` ${i}`),o=a?r.slice(0,-31):r,s=a&&/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*\.$/.test(o),c=t(o);return(0,H.jsxs)(H.Fragment,{children:[n&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:n[1]}),`: `]}),s?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:o.slice(0,-1)}),`.`]}):c===o?(0,H.jsx)(`bdi`,{dir:`ltr`,children:o}):c.split(/(Pi|OpenCode|Claude Code)/).map((e,t)=>/^(Pi|OpenCode|Claude Code)$/.test(e)?(0,H.jsx)(`bdi`,{dir:`ltr`,children:e},t):e),a&&(0,H.jsxs)(H.Fragment,{children:[` `,t(i)]})]})}function $S({job:e}){let t=Y();if(!e)return null;let n=e.hosts??(e.host?[{...e,host:e.host}]:[]);return(0,H.jsxs)(`div`,{role:`status`,className:`space-y-3 text-sm`,"aria-label":t(`Import results`),children:[(0,H.jsxs)(`p`,{children:[t(e.dryRun?`Preview (dry run)`:`Import`),` · `,t(e.state),e.activeHost&&(0,H.jsxs)(H.Fragment,{children:[` `,`· `,t(`Current host`),`: `,Yd(e.activeHost)]})]}),(0,H.jsxs)(`p`,{children:[t(`Combined counts`),`: `,ZS(e,t)]}),(0,H.jsx)(`ul`,{className:`space-y-2`,children:n.map(e=>(0,H.jsxs)(`li`,{className:`rounded border border-border p-2`,children:[(0,H.jsxs)(`p`,{children:[Yd(e.host),` ·`,` `,t(e.state===`no-work`?`No work to process`:e.state),e.phase&&(0,H.jsxs)(H.Fragment,{children:[` `,`·`,` `,t(e.phase===`profile`?`Learning profile`:e.phase===`preparing`?`preparing`:e.phase===`skill-turns`?`Skill turns`:`Memory extraction`)]})]}),e.phase===`profile`?(0,H.jsxs)(`p`,{children:[t(`Profile batches`),`: `,e.profileProcessed??0,`/`,e.profileTotal??0]}):(e.phase===`memory`||e.phase===`skill-turns`)&&e.total!==void 0&&(0,H.jsxs)(`p`,{children:[t(e.phase===`skill-turns`?`Skill turns`:`Memory units`),`:`,` `,e.processed??0,`/`,e.total]}),(0,H.jsx)(`p`,{children:ZS(e,t)}),(e.error||e.blocker)&&(0,H.jsx)(`p`,{role:`alert`,children:QS(e.error??e.blocker,t)}),e.report&&(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:e.report})]},e.host))}),e.error&&(0,H.jsx)(`p`,{role:`alert`,children:QS(e.error,t)}),e.report&&(0,H.jsx)(`pre`,{dir:`ltr`,className:`max-w-full overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-xs`,children:e.report}),e.dryRun&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.`)})]})}function eC({job:e}){let t=Y(),n=e.state===`failed`,r=GS(e),i=WS(e);return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[n&&r&&(0,H.jsx)(`p`,{role:`alert`,children:QS(r,t)}),i>0&&(0,H.jsxs)(`p`,{children:[t(`Failed memory units`),`: `,i]}),!n&&(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:ZS({summary:{unitsImported:e.summary?.unitsImported,unitsFailed:e.summary?.unitsFailed??0}},t)})]})}function tC({job:e,onReload:t}){let n=Y(),r=(0,v.useRef)(null),[i,a]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!e)return;let t=US(r.current,e,YS());r.current=e,t!==`none`&&a({job:e,view:t})},[e]);let o=()=>{i&&XS(i.job.id),a(null)},s=i?n(i.job.state===`failed`?`Import failed`:`Import successful 🎉`):``;return(0,H.jsxs)(H.Fragment,{children:[e?.state===`cancelled`&&!e.dryRun&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:n(`Import cancelled`)}),i?.view===`banner`&&(0,H.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-start justify-between gap-2 rounded-lg border border-border bg-card p-3`,children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`p`,{className:`text-sm font-semibold`,children:s}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`The import finished while you were away.`)}),(0,H.jsx)(eC,{job:i.job})]}),(0,H.jsx)(K,{variant:`outline`,size:`sm`,onClick:o,children:n(`Dismiss`)})]}),(0,H.jsx)(zl,{open:i?.view===`dialog`,onOpenChange:e=>{e||(o(),t())},children:(0,H.jsxs)(q,{showCloseButton:!1,className:i?.job.state===`failed`?`border-destructive/40`:void 0,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:s}),(0,H.jsx)(Gl,{className:`sr-only`,children:s})]}),i&&(0,H.jsx)(eC,{job:i.job}),(0,H.jsx)(Ul,{children:(0,H.jsx)(K,{autoFocus:!0,onClick:()=>{o(),t()},children:n(`OK`)})})]})})]})}var nC={memory:`Memory units`,"skill-turns":`Skill turns`,profile:`Profile batches`};function rC({job:e}){let t=Y(),n=HS(e);return n?(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n.percent,"aria-label":t(`Import progress`),className:`h-2 w-full overflow-hidden rounded bg-muted`,children:(0,H.jsx)(`div`,{className:`h-full bg-green-600`,style:{width:`${n.percent}%`}})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[(0,H.jsx)(`bdi`,{dir:`ltr`,children:Yd(n.host)}),` · `,t(nC[n.phase]),`: `,n.done,` /`,` `,n.total,` · `,n.percent,`%`]})]}):null}var iC=[`queued`,`preparing`,`running`,`cancelling`];function aC(e){return e&&iC.includes(e.state)?e:null}function oC(e,t){if(!e||!t)return e;if(!e.hosts)return e.host===t?e:null;let n=e.hosts.find(e=>e.host===t);if(!n)return null;if(e.hosts.length===1)return e;let r=e.hosts.some(e=>e.state===`failed`||e.error);return{...e,state:n.state,activeHost:e.activeHost===t?t:null,error:n.error??(r?void 0:e.error),sessions:n.sessions,processed:n.processed,total:n.total,summary:n.summary,profileEstimate:n.profileEstimate,hosts:[n]}}function sC(e){return cy(()=>e())}function cC({profilePreset:e=0,host:t}={}){let n=Y(),[r,i]=(0,v.useState)(()=>{let e=vS();if(!t)return LS(e);for(let n of gS)e.hosts[n].enabled=n===t;return e}),{snapshot:a}=px(),o=a?.settings?.skillLearning?.value===!0,s=e=>o?e:{...e,skills:!1},c=s(r),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)({}),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(``),w=(0,v.useRef)(!1),T=(0,v.useRef)({pi:0,opencode:0,"claude-code":0}),E=(0,v.useRef)(!0),D=(0,v.useRef)(uy()),O=kS(c),k=(0,v.useRef)(O);k.current=O;let A=oC(p,t),j=gS.filter(e=>c.hosts[e].enabled),M=t?[t]:gS,N=(0,v.useRef)(r.skills);(0,v.useEffect)(()=>{t||IS({...r,skills:N.current})},[r,t]);let P=p?.state===`running`||p?.state===`cancelling`||p?.state===`preparing`||p?.state===`queued`;function ee(e=!1){let t=D.current.begin();return X(`/api/settings/imports/current`).then(n=>{E.current&&t()&&m(e?aC(n.job):n.job)})}(0,v.useEffect)(()=>{E.current=!0;let e=()=>{g(null),X(`/api/settings/imports/readiness`).then(e=>{E.current&&f(e)}).catch(()=>{E.current&&f(null)})};e(),ee(!0).catch(()=>{});let t=sC(e);return()=>{E.current=!1,t()}},[]);function F(){qS(sy,ee).then(e=>{E.current&&e&&C(e)})}(0,v.useEffect)(()=>{if(!P)return;let e=setInterval(()=>{w.current||ee().catch(e=>{E.current&&C(e.message)})},1e3);return()=>clearInterval(e)},[P]),(0,v.useEffect)(()=>{e&&(i(e=>bS(e,{memories:!1,profile:!0,skills:!1,force:!0})),g(null))},[e]);function I(e){e.skills!==void 0&&(N.current=e.skills),g(null),i(t=>bS(t,e))}function te(e,t){g(null),i(n=>({...n,hosts:{...n.hosts,[e]:{...n.hosts[e],...t}}}))}async function L(e,t,n){let r=++T.current[e],a=xS(c,e);g(null),y(t=>({...t,[e]:!0}));try{let o=await X(`/api/settings/imports/sessions`,{method:`POST`,body:JSON.stringify({host:e,...c.hosts[e].source?{source:c.hosts[e].source.sourceToken}:{},scope:c.scope,...c.scope===`current-project`&&c.project?{project:c.project}:{},pathMaps:ES(c.maps),offset:t,limit:50,refresh:n,...SS(c)})});if(!E.current||T.current[e]!==r)return;i(t=>{if(xS(s(t),e)!==a)return t;let r=t.hosts[e],i=oS(r.page,o,n);return{...t,hosts:{...t.hosts,[e]:{...r,page:i.page,listedWith:a,selection:i.sameListing?r.selection:_S()}}}}),C(``)}catch(t){E.current&&T.current[e]===r&&C(t.message)}finally{E.current&&T.current[e]===r&&y(t=>({...t,[e]:!1}))}}let ne=DS(c),re=j.some(e=>e===`pi`&&d?.piReader.available===!1),R=j.map(e=>{let t=c.hosts[e];return t.page?t.listedWith===xS(c,e)?CS(c,e)>0&&wS(c,e)===0?`${Yd(e)}: ${n(`Select at least one session.`)}`:t.selection.mode===`ids`&&t.selection.picked.size>1e3?`${Yd(e)}: ${n(`Select at most 1000 sessions one by one, or use Select all matching.`)}`:null:`${Yd(e)}: ${n(`Options changed. Refresh the session list first.`)}`:`${Yd(e)}: ${n(`List sessions first.`)}`}).find(Boolean),ie=zS(j,c,d,n),ae=!!(h&&h.fingerprint===O&&h.id===p?.id&&p.dryRun&&p.state===`done`&&!p.error&&!p.hosts?.some(e=>e.error||e.blocker||[`failed`,`cancelled`,`not-run`].includes(e.state))),oe=b||P||j.some(e=>_[e])||re||!!(ne||R);async function se(e){if(w.current||oe||!e&&(!ae||ie))return;if(!e){let e=[c.memories&&n(`Project memories`),c.profile&&n(`User profile`),c.skills&&n(`Skill turns`)].filter(Boolean).join(` · `),t=j.map(e=>`${Yd(e)}: ${c.hosts[e].modelChoice===`external`?`${n(`Saved external API`)} (${d?.external.provider}/${d?.external.model})`:c.hosts[e].modelChoice}`).join(`
|
|
130
130
|
`);if((c.memories||c.profile)&&!window.confirm([n(`This import makes model calls. Continue?`),j.map(Yd).join(` · `),n(c.scope===`current-project`?`Current project`:`All projects`),c.project,e,t,ZS(p??{},n),...(p?.hosts??[]).map(e=>`${Yd(e.host)}: ${ZS(e,n)}`)].filter(Boolean).join(`
|
|
131
|
-
`)))return}w.current=!0,D.current.begin(),x(!0);let t=O;g(null);try{let n=await X(`/api/settings/imports`,{method:`POST`,body:JSON.stringify(OS(c,e))});if(!E.current)return;m(n),e&&t===k.current&&g({id:n.id,fingerprint:t}),C(``)}catch(e){E.current&&C(e.message),ee().catch(()=>{})}finally{w.current=!1,E.current&&x(!1)}}async function ce(){if(!w.current){w.current=!0,D.current.begin();try{let e=await X(`/api/settings/imports/current/cancel`,{method:`POST`,body:`{}`});E.current&&m(e.job)}catch(e){E.current&&C(e.message)}finally{w.current=!1}}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4 min-w-0`,"aria-label":n(t?`Sessions`:`Import chat history`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:n(t?`Sessions`:`Import chat history`)}),!t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.`)}),(0,H.jsxs)(`p`,{className:`flex flex-wrap gap-3 text-sm`,children:[(0,H.jsx)(`a`,{className:`underline`,href:J.project,onClick:e=>{e.preventDefault(),_f(J.project)},children:n(`Project memories`)}),(0,H.jsx)(`a`,{className:`underline`,href:J.profile,onClick:e=>{e.preventDefault(),_f(J.profile)},children:n(`User profile`)}),(0,H.jsx)(`a`,{className:`underline`,href:`${J.settings}#settings-section-profiles`,onClick:e=>{e.preventDefault(),_f(`${J.settings}#settings-section-profiles`)},children:n(`Profile identity in Settings`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Hosts keep their existing user identities. All hosts does not merge profiles with different identities.`)}),(0,H.jsx)(dS,{}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[gS.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":Yd(e),checked:c.hosts[e].enabled,onChange:t=>te(e,{enabled:t.target.checked})}),` `,Yd(e)]},e)),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,onClick:()=>I({hosts:{pi:{...c.hosts.pi,enabled:!0},opencode:{...c.hosts.opencode,enabled:!0},"claude-code":{...c.hosts[`claude-code`],enabled:!0}}}),children:n(`All hosts`)}),(0,H.jsxs)(`span`,{role:`status`,children:[n(`Selected hosts`),`: `,j.length]})]})]}),(0,H.jsx)(NS,{draft:c,skillRecording:o,advanced:l,onChange:I,onAdvanced:()=>u(e=>!e)}),M.map(e=>(0,H.jsx)(PS,{host:e,draft:c,readiness:d,advanced:l,listing:!!_[e],onChange:t=>te(e,t),onList:(t,n)=>L(e,t,n),onUnresolved:()=>{I({scope:`all-projects`}),u(!0)}},e)),ne&&(0,H.jsx)(`p`,{role:`alert`,children:n(ne)}),!P&&(R||ie)&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:R??ie}),!ae&&!P&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Preview the current selection before starting an import.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:MS,disabled:oe,onClick:()=>se(!0),children:n(`Preview (dry run)`)}),(0,H.jsx)(`button`,{type:`button`,className:MS,disabled:oe||!ae||!!ie,onClick:()=>se(!1),children:n(`Start import`)}),P&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:p?.state===`cancelling`,onClick:()=>ce(),children:n(`Cancel after current unit`)})]}),S&&(0,H.jsx)(`p`,{role:`alert`,children:QS(S,n)}),(0,H.jsx)(rC,{job:A}),(0,H.jsx)(tC,{job:A,onReload:F}),(0,H.jsx)($S,{job:A})]})}var lC=3e5,uC=null,dC,fC=new Set,pC=new Set;async function mC(e){try{uC=await X(`/api/memory/write-health${e?`?fresh=1`:``}`)}catch{}for(let e of[...fC,...pC])e()}function hC(e){return fC.add(e),fC.size===1&&(mC(!1),dC=setInterval(()=>{document.hidden||mC(!1)},lC)),()=>{fC.delete(e),fC.size===0&&clearInterval(dC)}}function gC(){return{health:(0,v.useSyncExternalStore)(hC,()=>uC,()=>null),recheck:()=>mC(!0)}}function _C(e){return pC.add(e),()=>pC.delete(e)}function vC(){return(0,v.useSyncExternalStore)(_C,()=>uC,()=>null)}function yC(e){let t=(t,...n)=>n.every((n,r)=>e[t+r]===n);return t(0,137,80,78,71,13,10,26,10)?`png`:t(0,255,216,255)?`jpeg`:t(0,71,73,70,56)?`gif`:t(0,82,73,70,70)&&t(8,87,69,66,80)?`webp`:null}async function bC(e){return e.size>20971520?`size`:yC(new Uint8Array(await e.slice(0,16).arrayBuffer()))?null:`type`}function xC(e,t){let n=Math.min(e,t);return{x:Math.floor((e-n)/2),y:Math.floor((t-n)/2),side:n}}async function SC(e){let t=await createImageBitmap(e);try{let{x:e,y:n,side:r}=xC(t.width,t.height),i=document.createElement(`canvas`);i.width=128,i.height=128;let a=i.getContext(`2d`);if(!a)throw Error(`This browser cannot draw the image`);a.imageSmoothingQuality=`high`,a.drawImage(t,e,n,r,r,0,0,128,128);let o=await new Promise(e=>i.toBlob(e,`image/png`));if(!o)throw Error(`This browser cannot save the image`);let s=new Uint8Array(await o.arrayBuffer()),c=``;for(let e of s)c+=String.fromCharCode(e);return btoa(c)}finally{t.close()}}function CC({host:e,onClose:t}){let n=Y(),{looks:r,setIcon:i,setImage:a,reset:o}=qx(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),h=s===null?r[e]:`reset`in s?{kind:`default`}:s.look,g=Yx.filter(e=>e.includes(l.trim().toLowerCase()));async function _(e){if(!e)return;f(``);let t=await bC(e);if(t){f(n(t===`size`?`The image is larger than 20 MB.`:`Only PNG, JPEG, WebP and GIF images are accepted.`));return}try{let t=await SC(e);c({look:{kind:`image`,image:`data:image/png;base64,${t}`},png:t})}catch{f(n(`This browser could not read the image.`))}}async function y(){if(s===null)return t();m(!0);try{`reset`in s?await o(e):s.look.kind===`icon`?await i(e,s.look.icon):s.png&&await a(e,s.png),t()}catch(e){f(e.message),m(!1)}}return(0,H.jsx)(zl,{open:!0,onOpenChange:e=>!e&&!p&&t(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:`${n(`Change icon`)}: ${Yd(e)}`}),(0,H.jsx)(Gl,{children:n(`Every avatar is shown at the same size. Images are cropped to a square.`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Zx,{host:e,look:h}),(0,H.jsxs)(`label`,{className:`inline-flex`,children:[(0,H.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,className:`sr-only peer`,onChange:e=>void _(e.target.files?.[0])}),(0,H.jsxs)(`span`,{className:`inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-[9px] border border-border px-3 text-ui font-medium hover:bg-interactive-hover peer-focus-visible:outline-2 peer-focus-visible:outline-ring`,children:[(0,H.jsx)(Re,{className:`size-4`,"aria-hidden":`true`}),n(`Upload image`)]})]}),(0,H.jsxs)(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c({reset:!0}),children:[(0,H.jsx)(wt,{"aria-hidden":`true`}),n(`Reset to default`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`PNG, JPEG, WebP or GIF, up to 20 MB.`)}),(0,H.jsx)(ad,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":n(`Search icons`),placeholder:n(`Search icons`)}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":n(`Choose icon`),className:`grid max-h-48 grid-cols-6 gap-1 overflow-y-auto sm:grid-cols-8`,children:[g.map(e=>{let t=Jx[e],n=h.kind===`icon`&&h.icon===e;return(0,H.jsx)(`button`,{type:`button`,title:e,"aria-label":e,"aria-pressed":n,onClick:()=>c({look:{kind:`icon`,icon:e}}),className:V(`grid size-10 place-items-center rounded-[9px] border border-transparent text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,n&&`border-primary bg-primary/10 text-primary-label`),children:(0,H.jsx)(t,{className:`size-5`,"aria-hidden":`true`})},e)}),g.length===0&&(0,H.jsx)(`p`,{className:`col-span-full text-sm text-muted-foreground`,children:n(`No icon matches.`)})]}),d&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:d}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,onClick:t,disabled:p,children:n(`Cancel`)}),(0,H.jsx)(K,{type:`button`,onClick:()=>void y(),disabled:p||s===null,children:n(`Save`)})]})]})})}function wC({view:e,line:t,warning:n,notSetUp:r,current:i,compact:a}){let o=Y(),{looks:s}=qx(),[c,l]=(0,v.useState)(!1),u=e===`shared`?null:e,d=u?Yd(u):o(`Shared`),f=ud(e),p=u?(0,H.jsx)(Zx,{host:u,look:s[u],className:a?`size-8`:void 0}):(0,H.jsx)(Qx,{className:a?`size-8`:void 0});return(0,H.jsxs)(`div`,{className:`relative h-full min-w-0`,children:[(0,H.jsxs)(`a`,{href:f,"aria-current":i?`page`:void 0,onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||(e.preventDefault(),_f(f))},className:V(`flex h-full min-w-0 flex-col gap-3 rounded-xl border bg-card p-4 text-start transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,a&&`flex-row items-center gap-2 p-2 pe-10`,n?`border-[var(--status-warning)]`:`border-border`,i&&`bg-sidebar-accent`,r&&`opacity-70`),children:[p,(0,H.jsxs)(`span`,{className:`min-w-0 space-y-1`,children:[(0,H.jsx)(`span`,{className:`block break-words text-subsection-title font-semibold`,children:d}),(0,H.jsx)(`span`,{className:`block break-words text-xs text-muted-foreground`,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium text-status-warning`,children:o(`Memories not saved`)}),!a&&(0,H.jsx)(`span`,{className:`block`,children:n})]}):t})]})]}),u&&(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:a?`icon-xs`:`icon-sm`,className:`absolute end-2 top-2`,"aria-label":`${o(`Change icon`)}: ${d}`,title:o(`Change icon`),onClick:()=>l(!0),children:(0,H.jsx)(mt,{"aria-hidden":`true`})}),c&&u&&(0,H.jsx)(CC,{host:u,onClose:()=>l(!1)})]})}function TC({current:e,statuses:t}){let n=Y(),{health:r}=gC(),i=r&&!r.ok?r.reason??``:null;return(0,H.jsx)(`nav`,{"aria-label":n(`Memory views`),children:(0,H.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 lg:grid-cols-4`,children:ld.map(r=>{let a=r===`shared`?null:r,o=a?t.line(a):{text:`Every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(wC,{compact:!0,view:r,current:r===e,line:nS(n,o),warning:a&&t.input(a).setUp?i:null,notSetUp:a?!t.input(a).setUp:!1})},r)})})})}function EC({reason:e,checking:t,onCheck:n}){let r=Y();return(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-[var(--status-warning)] bg-card p-3 text-sm`,children:[(0,H.jsx)(Bt,{className:`size-4 shrink-0 text-status-warning`,"aria-hidden":`true`}),(0,H.jsxs)(`p`,{className:`min-w-0 flex-1 break-words`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:r(`Memories are not being saved.`)}),` `,e?/[.!?]$/.test(e)?e:`${e}.`:``,` `,r(`Fix the service named here, then press Check again.`)]}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:t,onClick:n,children:r(`Check again`)})]})}function DC(){let{health:e,recheck:t}=gC(),[n,r]=(0,v.useState)(!1);return!e||e.ok?null:(0,H.jsx)(EC,{reason:e.reason,checking:n,onCheck:()=>{r(!0),t().finally(()=>r(!1))}})}function OC({host:e,statuses:t,profilePreset:n}){let r=Y(),i=!t.input(e).setUp;return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(TC,{current:e,statuses:t}),(0,H.jsx)(DC,{}),(0,H.jsx)(aS,{host:e,statuses:t}),i?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`${Yd(e)}: ${r(`OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.`)}`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(cC,{host:e,profilePreset:n}),(0,H.jsx)(Mx,{hosts:[e],saved:!1,title:`Sessions that need a folder`,anchorId:`host-unresolved`}),(0,H.jsx)(zx,{host:e,backfill:t.backfill})]})]})}var kC=`project architecture, setup, conventions and key decisions`,AC=10,jC={opening:!1,query:kC,subagent:!0,restore:!0,limit:String(AC)};function MC(e){let t=t=>e?.[t]?.globalValue,n=(e,n)=>typeof t(e)==`boolean`?t(e):n,r=t(`compaction.memoryLimit`),i=t(`openingContextQuery`);return{opening:n(`openingContext`,jC.opening),query:typeof i==`string`?i:jC.query,subagent:n(`subagentMemory`,jC.subagent),restore:n(`compaction.enabled`,jC.restore),limit:typeof r==`number`?String(r):jC.limit}}function NC(e){let t=e.trim();if(!/^\d+$/.test(t))return;let n=Number(t);return Number.isSafeInteger(n)&&n>0?n:void 0}function PC(e){return NC(e.limit)===void 0?`limit`:e.query.trim().length>500?`query`:null}function FC(e,t){if(PC(e))return{};let n={};e.opening!==t.opening&&(n.openingContext=e.opening===jC.opening?null:e.opening);let r=e.query.trim();r!==t.query.trim()&&(n.openingContextQuery=r===`project architecture, setup, conventions and key decisions`?null:r),e.subagent!==t.subagent&&(n.subagentMemory=e.subagent===jC.subagent?null:e.subagent),e.restore!==t.restore&&(n[`compaction.enabled`]=e.restore===jC.restore?null:e.restore);let i=NC(e.limit);return i!==NC(t.limit)&&(n[`compaction.memoryLimit`]=i===AC?null:i),n}function IC(e,t){return Object.keys(FC(e,t)).length>0}function LC(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(jC),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(jC),d=(0,v.useRef)(r);d.current=r,(0,v.useEffect)(()=>{let e=!0,t=e=>{let t=MC(e.settings),r=JSON.stringify(d.current)===JSON.stringify(u.current);u.current=t,n(e),r&&i(t)},r=oy();X(`/api/settings`).then(n=>{e&&r.isCurrent()&&t(n)}).catch(()=>{e&&c({kind:`load-failed`})});let a=cy(n=>{e&&t(n)});return()=>{e=!1,a()}},[]);let f=PC(r),p=IC(r,u.current),m=e=>i(t=>({...t,...e}));async function h(){if(!t||!p||l.current)return;l.current=!0,o(!0);let e;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:FC(r,u.current),revision:t.revision})})}catch(t){e=t}let n=await sy()!==null;o(!1),l.current=!1,c(e?{kind:`save-failed`,message:e.message,reloaded:n}:{kind:`saved`,reloaded:n})}function g(t){if(t.kind===`load-failed`)return e(`The memory injection settings could not be loaded. Reload the page to try again.`);if(t.kind===`saved`)return t.reloaded?e(`Saved. The next session uses these options.`):ly(e(`Saved. The next session uses these options.`),e(`Reload the page before saving again.`));let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return ly(e(t.message),n)}let _=`${r.query.length} / 500`;return(0,H.jsxs)(`section`,{id:`memory-injection`,className:`scroll-mt-20 space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory injection`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory injection`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Applies to OpenCode V2, Pi and Claude Code. OpenCode V1 is not covered. On Pi, subagent memory needs om-pi-subagents to load OMMS.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project config can turn the session-start and subagent options off. It can turn restore on or off.`)}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`injection-opening`,role:`switch`,checked:r.opening,disabled:a,"aria-describedby":`injection-opening-help`,onChange:e=>m({opening:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`injection-opening`,children:e(`Inject memories at session start`)})]}),(0,H.jsx)(`p`,{id:`injection-opening-help`,className:`text-xs text-muted-foreground`,children:e(`Added to the first message of a new session. OMMS searches the query below and adds only matching memories.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`injection-query`,children:e(`Session-start search query`)}),(0,H.jsx)(Ip,{id:`injection-query`,maxLength:500,rows:3,disabled:a,value:r.query,"aria-invalid":f===`query`||void 0,"aria-describedby":`injection-query-count`,onChange:e=>m({query:e.target.value})}),(0,H.jsx)(`span`,{id:`injection-query-count`,dir:`ltr`,className:`block text-xs tabular-nums text-muted-foreground`,children:_})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`injection-subagent`,role:`switch`,checked:r.subagent,disabled:a,"aria-describedby":`injection-subagent-help`,onChange:e=>m({subagent:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`injection-subagent`,children:e(`Subagent memory`)})]}),(0,H.jsx)(`p`,{id:`injection-subagent-help`,className:`text-xs text-muted-foreground`,children:e(`Subagents get memories that match their task. No rows are shown for them.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`injection-restore`,role:`switch`,checked:r.restore,disabled:a,onChange:e=>m({restore:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`injection-restore`,children:e(`Restore memories after compaction or resume`)})]}),(0,H.jsx)(Fp,{htmlFor:`injection-limit`,children:e(`Most memories to restore`)}),(0,H.jsx)(ad,{type:`number`,id:`injection-limit`,className:`w-36 tabular-nums`,inputMode:`numeric`,step:1,min:1,disabled:a,value:r.limit,"aria-invalid":f===`limit`||void 0,"aria-describedby":`injection-limit-help`,onChange:e=>m({limit:e.target.value})}),(0,H.jsx)(`span`,{id:`injection-limit-help`,className:`block text-xs ${f===`limit`?`text-red-600`:`text-muted-foreground`}`,children:e(`Enter a positive whole number.`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(K,{type:`submit`,disabled:a||!t||!p,children:e(`Save`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a,onClick:()=>i(jC),children:e(`Reset to default`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:g(s)})]})}function RC({statuses:e,profilePreset:t}){let n=Y(),{health:r}=gC(),[i,a]=(0,v.useState)(!1),o=r&&!r.ok?r.reason??``:null;return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Choose a host to see its history import, sessions and settings.`)}),(0,H.jsx)(`ul`,{className:`grid grid-cols-2 items-stretch gap-3 lg:grid-cols-4`,children:ld.map(t=>{let r=t===`shared`?null:t,i=r?e.line(r):{text:`Settings for every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(wC,{view:t,line:nS(n,i),warning:r&&e.input(r).setUp?o:null,notSetUp:r?!e.input(r).setUp:!1})},t)})}),(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`Import all hosts`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,"aria-expanded":i,"aria-controls":`memory-import-all`,onClick:()=>a(e=>!e),children:n(`Import all hosts`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Runs one import for every host you tick. It makes model calls and can cost money.`)})]}),(0,H.jsx)(`div`,{id:`memory-import-all`,hidden:!i,children:i&&(0,H.jsx)(cC,{profilePreset:t})})]}),(0,H.jsx)(LC,{})]})}var zC=[{value:`boost`,label:`Boost (default)`},{value:`rrf`,label:`Rank fusion (experimental)`}];function BC(e){return e===`boost`||e===`rrf`}function VC(e){return BC(e)?e:`boost`}function HC(e){return{keywordMode:e}}function UC(e){let t=t=>{let n=e[t]?.value;return typeof n==`string`&&n.trim().length>0};return e.rerankerEnabled?.value===!0&&t(`rerankerApiUrl`)&&t(`rerankerModel`)}function WC(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(`boost`),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(VC(r.settings.keywordMode?.globalValue)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=cy(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||e===VC(r.settings.keywordMode?.globalValue)?VC(a.settings.keywordMode?.globalValue):e)});return()=>{e=!1,r()}},[]);let d=VC(t?.settings.keywordMode?.globalValue),f=t?.settings.keywordMode?.source===`project`,p=t?UC(t.settings):!1;async function m(){if(!t||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:HC(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await sy()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function h(t){if(t.kind===`load-failed`)return e(`The keyword matching setting could not be loaded. Reload the page to try again.`);let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ly(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use this mode.`):ly(e(`The keyword matching setting could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Keyword matching`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Keyword matching`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search finds memories by meaning and by exact words from your prompt.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`keyword-mode`,children:e(`Word matching mode`)}),(0,H.jsx)(`div`,{className:`w-72 max-w-full`,children:(0,H.jsx)(Dr,{id:`keyword-mode`,className:`w-full`,value:r,disabled:a,onChange:e=>{BC(e.target.value)&&i(e.target.value)},children:zC.map(t=>(0,H.jsx)(`option`,{value:t.value,children:e(t.label)},t.value))})}),(0,H.jsx)(`span`,{id:`keyword-mode-help`,className:`block text-xs text-muted-foreground`,children:`keywordMode`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(r===`rrf`?`Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.`:`Boost adds a small score bonus to memories that contain a word of your prompt.`)}),p&&r===`rrf`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`Rank fusion is not used while the reranker is on. Search uses the boost.`)}),f&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file can override this setting. This page edits the global value.`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(K,{type:`submit`,disabled:a||!t||r===d,children:e(`Save`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a||r===d,onClick:()=>i(d),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:h(s)})]})}var GC=`Enter a positive whole number.`,KC=[{key:`maxMemories`,id:`memory-maxMemories`,default:10,unit:`Results`,affects:`Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.`,min:1,max:2**53-1,accepted:GC,kind:`integer`},{key:`chatMessage.maxMemories`,id:`memory-chatMessage-maxMemories`,default:3,unit:`Memories`,affects:`Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.`,min:1,max:2**53-1,accepted:GC,kind:`integer`},{key:`autoCaptureMaxContextBytes`,id:`memory-autoCaptureMaxContextBytes`,default:131072,unit:`Bytes`,affects:`Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.`,min:16384,max:16777216,accepted:`Enter a whole number from 16,384 to 16,777,216.`,kind:`integer`},{key:`userProfileMaxContextBytes`,id:`memory-userProfileMaxContextBytes`,default:32768,unit:`Bytes`,affects:`OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.`,min:1024,max:16777216,accepted:`Enter a whole number from 1,024 to 16,777,216.`,kind:`integer`},{key:`retrievalMaxTokens`,id:`memory-retrievalMaxTokens`,default:2e3,unit:`Approximate tokens`,affects:`Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.`,min:256,max:65536,accepted:`Enter a whole number from 256 to 65,536.`,kind:`integer`},{key:`similarityThreshold`,id:`memory-similarityThreshold`,default:.6,unit:`Similarity score`,affects:`Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.`,min:0,max:1,accepted:`Enter a number from 0 to 1.`,kind:`decimal`}];[...KC.flatMap(e=>[e.unit,e.affects,e.accepted])];function qC(e,t){let n=typeof t==`string`?t.trim():``;if(!n||!/^-?\d+(\.\d+)?$/.test(n))return;let r=Number(n);if(!(e.kind===`integer`&&!Number.isInteger(r)))return r>=e.min&&r<=e.max?r:void 0}function JC(e){return e.toLocaleString(`en-US`)}function YC(e,t,n){let r=t[e.key];return typeof r==`string`?r:String(n[e.key]??e.default)}function XC(e,t){let n=!1;for(let r of KC){let i=e[r.key];if(typeof i!=`string`)continue;let a=qC(r,i);if(a===void 0)return!1;a!==(t[r.key]??r.default)&&(n=!0)}return n}function ZC(e,t){let n={};if(!XC(e,t))return n;for(let r of KC){let i=e[r.key];if(typeof i!=`string`)continue;let a=qC(r,i);a!==(t[r.key]??r.default)&&(n[r.key]=a)}return n}var QC=`Config changed. Reload settings and save again.`;function $C(e){if(e===`Config changed. Reload settings and save again.`)return{kind:`stale`};let t=KC.map(e=>e.key.replace(/\./g,`\\.`)).join(`|`),n=RegExp(`^Invalid (${t}) setting\\b`).exec(e);return n?{kind:`invalid`,key:n[1]}:{kind:`unknown`}}function ew(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(()=>{e&&c({kind:`load-failed`})});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let u={},d={};for(let e of KC){let n=t?.settings[e.key];u[e.key]=typeof n?.globalValue==`number`?n.globalValue:void 0,d[e.key]=typeof n?.default==`number`?n.default:e.default}let f=XC(r,u),p=`~/.config/omms/omms.jsonc`,m=e(`Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.`).split(p);async function h(){if(!t||!f||l.current)return;let e=ZC(r,u);Object.keys(e).length&&await _(e)}async function g(e){!t||a||l.current||t.settings[e]?.hasGlobal&&await _({[e]:null})}async function _(e){if(!t||l.current)return;l.current=!0,o(!0);let n=!1,r;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:t.revision})}),n=!0}catch(e){r=e}let a=await sy()!==null;o(!1),l.current=!1,n?(i(t=>{let n={...t};for(let t of Object.keys(e))delete n[t];return n}),c({kind:`saved`,reloaded:a})):c({kind:`save-failed`,failure:$C(r?.message??``),reloaded:a})}function y(t){if(t.kind===`load-failed`)return e(`The memory settings could not be loaded. Reload the page to try again.`);if(t.kind===`saved`)return t.reloaded?e(`Saved. New memory operations use these limits.`):`${e(`Saved. New memory operations use these limits.`)} ${e(`Reload the page before saving again.`)}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);if(t.failure.kind===`stale`)return ly(e(QC),n);if(t.failure.kind===`invalid`){let r=t.failure,i=KC.find(e=>e.key===r.key);return ly(`${e(`Invalid setting`)} ${i.key}: ${e(i.accepted)}`,n)}return ly(e(`The memory settings could not be saved.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory limits`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory limits`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Byte limits count UTF-8 bytes.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[m[0],(0,H.jsx)(`code`,{dir:`ltr`,children:p}),m[1]]}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,H.jsx)(`div`,{className:Wy,children:(0,H.jsxs)(`table`,{className:`w-full min-w-[56rem] text-sm`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:e(`Memory limits`)}),(0,H.jsx)(`thead`,{className:Ky,children:(0,H.jsx)(`tr`,{children:[`Setting`,`Value`,`Default`,`Unit`,`Affects`].map(t=>(0,H.jsx)(`th`,{className:qy,children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:KC.map(n=>{let o=r[n.key],s=YC(n,r,u),c=typeof o==`string`&&qC(n,o)===void 0,l=t?.settings[n.key],f=l?.source===`project`,p=l?.hasGlobal===!0,m=p&&typeof l?.globalValue==`number`&&l.globalValue!==d[n.key];return(0,H.jsxs)(`tr`,{className:Jy,children:[(0,H.jsxs)(`td`,{className:Yy,children:[(0,H.jsx)(`code`,{dir:`ltr`,children:n.key}),f&&(0,H.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-xs text-amber-600`,children:[(0,H.jsxs)(`p`,{children:[e(`Effective value`),`: `,String(l?.value??``),` (`,e(`project`),`)`]}),(0,H.jsx)(`p`,{children:e(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`p`,{children:e(`The project value stays in force. Saving edits the global file only.`)})]})]}),(0,H.jsxs)(`td`,{className:Yy,children:[(0,H.jsx)(`input`,{type:`number`,id:`${n.id}-input`,className:`w-36 tabular-nums`,inputMode:n.kind===`decimal`?`decimal`:`numeric`,step:n.kind===`decimal`?.01:1,min:n.min,max:n.max,"aria-label":`${n.key} ${e(`Value`)}`,"aria-describedby":`${n.id}-help`,"aria-invalid":c||void 0,disabled:a,value:s,onChange:e=>i(t=>({...t,[n.key]:e.target.value}))}),(0,H.jsx)(`span`,{id:`${n.id}-help`,className:`block text-xs ${c?`text-red-600`:`text-muted-foreground`}`,children:e(n.accepted)}),(0,H.jsx)(`button`,{type:`button`,"data-reset":n.key,className:`mt-1 block text-xs underline`,disabled:a||!p,"aria-label":`${n.key} ${e(`Reset to default`)}`,onClick:()=>void g(n.key),children:e(`Reset to default`)})]}),(0,H.jsxs)(`td`,{className:`${Yy} tabular-nums`,children:[JC(d[n.key]),m&&(0,H.jsx)(`span`,{className:`block text-xs text-amber-600`,children:e(`Differs from default`)})]}),(0,H.jsx)(`td`,{className:Yy,children:e(n.unit)}),(0,H.jsx)(`td`,{className:Yy,children:e(n.affects)})]},n.key)})})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`submit`,disabled:a||!t||!f,onClick:()=>void h(),children:e(`Save memory limits`)}),(0,H.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i({}),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:y(s)})]})}var tw=`Enter a whole number from 50 to 100000.`;function nw(e){let t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,message:tw};let n=Number(t);return n<50||n>1e5?{ok:!1,message:tw}:{ok:!0,value:n}}function rw(e,t){let n=nw(t);return n.ok?n.value===e?{kind:`none`}:{kind:`edit`,edits:{userProfileAutoCleanupInterval:n.value}}:{kind:`error`,message:n.message}}function iw(e,t){return e===t?null:{userProfileAutoCleanupEnabled:t}}var aw=500;function ow(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),d=t?.settings.userProfileAutoCleanupEnabled?.globalValue!==!1,f=Number(t?.settings.userProfileAutoCleanupInterval?.globalValue??aw);(0,v.useEffect)(()=>{let e=!0;X(`/api/settings`).then(t=>{e&&n(t)}).catch(t=>{e&&c(t.message)});let t=cy(t=>{e&&n(t)});return()=>{e=!1,t()}},[]),(0,v.useEffect)(()=>{t&&i(String(f))},[t,f]);async function p(n){if(t){u(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),c(e(`Saved. Changes apply at the next learning pass.`))}catch(e){c(e.message)}await sy(),u(!1)}}function m(){let t=rw(f,r);if(t.kind===`error`){o(e(t.message));return}o(``),t.kind===`edit`&&p(t.edits)}return(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e(`Automatic profile cleanup`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,disabled:l||!t,onChange:e=>{let t=iw(d,e.target.checked);t&&p(t)}}),e(`Clean up the profile automatically`)]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-cleanup-interval`,children:e(`Run every this many analysed prompts`)}),(0,H.jsx)(`input`,{id:`auto-cleanup-interval`,className:`w-28 rounded border border-border bg-background px-2 py-1`,inputMode:`numeric`,value:r,disabled:l||!t,"aria-invalid":a?!0:void 0,"aria-describedby":a?`auto-cleanup-interval-error`:void 0,onChange:e=>{i(e.target.value),o(``)}}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:l||!t||r.trim()===String(f),onClick:m,children:e(`Save interval`)})]}),a&&(0,H.jsx)(`p`,{id:`auto-cleanup-interval-error`,role:`alert`,className:`text-sm text-destructive`,children:a}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:s})]})}function sw({preview:e,job:t,busy:n,onStart:r,onPause:i}){let a=Y(),o=t.state===`running`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`p`,{children:[a(`Prompts waiting for profile learning`),`: `,e.waiting,` ·`,` `,a(`Estimated profile analysis calls`),`: `,e.calls]}),t.state!==`idle`&&(0,H.jsxs)(`p`,{role:`status`,children:[a(`Batches done`),`: `,t.batchesBuilt,` · `,a(`Prompts waiting`),`: `,t.remaining,t.state===`paused`&&` · ${a(`Paused`)}`,t.state===`done`&&` · ${a(`Finished`)}`]}),t.state===`superseded`&&(0,H.jsx)(`p`,{children:a(`A newer catch-up run took over.`)}),t.state===`failed`&&(0,H.jsxs)(`p`,{className:`text-red-600`,children:[a(`Stopped`),`: `,t.reason??`error`]}),o?(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:i,children:a(`Pause`)}):(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:n||e.waiting===0,onClick:r,children:a(t.state===`idle`||t.state===`done`?`Analyse waiting prompts`:`Resume`)})]})}function cw({onReanalyse:e}={}){let t=Y(),[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)({state:`idle`,batchesBuilt:0,remaining:0}),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);async function f(){let e=await X(`/api/settings/profile/catch-up`);r(e.preview),a(e.job)}(0,v.useEffect)(()=>{f().catch(e=>d(e.message)),X(`/api/web/status`).then(e=>s(!!e.isLocal)).catch(()=>{})},[]),(0,v.useEffect)(()=>{if(i.state!==`running`)return;let e=setInterval(()=>void f().catch(()=>{}),2e3);return()=>clearInterval(e)},[i.state]);async function p(){if(!n)return;let e=i.state!==`idle`&&i.state!==`done`;if(window.confirm(`${t(`Start profile learning for the waiting prompts? Model calls`)}: ${n.calls}`)){l(!0);try{a(await X(`/api/settings/profile/catch-up/${e?`resume`:`start`}`,{method:`POST`,body:`{}`})),d(``)}catch(e){d(e.message)}l(!1)}}async function m(){try{a(await X(`/api/settings/profile/catch-up/pause`,{method:`POST`,body:`{}`}))}catch(e){d(e.message)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Profile learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Profile learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.`)}),e&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,onClick:e,children:t(`Re-analyse chat history`)}),n&&(o?(0,H.jsx)(sw,{preview:n,job:i,busy:c,onStart:()=>void p(),onPause:()=>void m()}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Open this page on the computer that runs OMMS to start a catch-up run.`)})),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),(0,H.jsx)(ow,{})]})}function lw(e){let t=typeof e==`string`?e.trim():``;if(!t||!/^\d+$/.test(t))return;let n=Number(t);return n>=500&&n<=3e4?n:void 0}function uw(e){return/^(env:\/\/[A-Za-z_][A-Za-z0-9_]*|file:\/\/.+)$/.test(e.trim())}function dw(e){try{let t=new URL(e.trim()).hostname.toLowerCase();return!(t===`localhost`||t===`::1`||t===`[::1]`||/^127\.\d+\.\d+\.\d+$/.test(t))}catch{return!1}}function fw(e){if(e.enabled&&(e.url.trim().length===0||e.model.trim().length===0))return{field:`url-model`};if(e.key.trim().length>0&&!uw(e.key))return{field:`key`};if(lw(e.timeout)===void 0)return{field:`timeout`}}function pw(e){return fw(e)===void 0}function mw(e){return{rerankerEnabled:e.enabled,rerankerApiUrl:e.url.trim()||null,rerankerModel:e.model.trim()||null,rerankerApiKey:e.key.trim()||null,rerankerTimeoutMs:lw(e.timeout)??4e3}}function hw(e){let t=e?.settings,n=e?.secrets.rerankerApiKey?.reference;return{enabled:t?.rerankerEnabled?.value===!0,url:typeof t?.rerankerApiUrl?.value==`string`?t.rerankerApiUrl.value:``,model:typeof t?.rerankerModel?.value==`string`?t.rerankerModel.value:``,key:e?.secrets.rerankerApiKey?.set?`${e.secrets.rerankerApiKey.source}://${n??``}`:``,timeout:typeof t?.rerankerTimeoutMs?.value==`number`?String(t.rerankerTimeoutMs.value):`4000`}}function gw(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({enabled:!1,url:``,model:``,key:``,timeout:`4000`}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(hw(r)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=cy(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||JSON.stringify(e)===JSON.stringify(hw(r))?hw(a):e)});return()=>{e=!1,r()}},[]);let d=fw(r),f=pw(r),p=r.url.trim().length>0&&dw(r.url);function m(e){i(t=>({...t,...e}))}async function h(){if(a||l.current||!f)return;l.current=!0,o(!0);let e=!1,t;try{let n=await X(`/api/settings/reranker/test`,{method:`POST`,body:JSON.stringify({rerankerApiUrl:r.url.trim()||void 0,rerankerModel:r.model.trim()||void 0,rerankerApiKey:r.key.trim()||void 0,rerankerTimeoutMs:lw(r.timeout)??4e3})});e=n.success===!0,t=n.code}catch{t=`reranker_unreachable`}o(!1),l.current=!1,c({kind:`test`,ok:e,code:t})}async function g(){if(!t||!f||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:mw(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await sy()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function _(t){if(t.kind===`load-failed`)return e(`The reranker settings could not be loaded. Reload the page to try again.`);if(t.kind===`test`)return t.ok?e(`Test passed.`):`${e(`Test failed:`)} ${t.code??`reranker_unreachable`}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ly(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use these settings.`):ly(e(`The reranker settings could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Reranker`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Reranker`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker reorders the best memory search results with your reranker server and keeps the top results.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file cannot change these settings. The reranker settings are global only.`)}),!r.enabled&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search is unchanged while the switch is off.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`reranker-enabled`,role:`switch`,checked:r.enabled,disabled:a,"aria-label":e(`Use a reranker`),onChange:e=>m({enabled:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`reranker-enabled`,children:e(`Use a reranker`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-url`,children:e(`Server URL`)}),(0,H.jsx)(ad,{type:`url`,id:`reranker-url`,dir:`ltr`,placeholder:`http://127.0.0.1:3008/v1`,disabled:a,value:r.url,"aria-invalid":d?.field===`url-model`||void 0,"aria-describedby":`reranker-url-help`,onChange:e=>m({url:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-url-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`url-model`?e(`Enter the server URL and model before turning the reranker on.`):`rerankerApiUrl`}),p&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`This URL is not on this machine: memory text leaves this machine.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-model`,children:e(`Model`)}),(0,H.jsx)(ad,{type:`text`,id:`reranker-model`,dir:`ltr`,disabled:a,value:r.model,"aria-invalid":d?.field===`url-model`||void 0,onChange:e=>m({model:e.target.value})}),(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`rerankerModel`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-key`,children:e(`Key`)}),(0,H.jsx)(ad,{type:`text`,id:`reranker-key`,dir:`ltr`,disabled:a,value:r.key,"aria-invalid":d?.field===`key`||void 0,"aria-describedby":`reranker-key-help`,onChange:e=>m({key:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-key-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`key`?e(`The key must be an env:// or file:// reference, or left empty.`):e(`Optional env:// or file:// key reference.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-timeout`,children:e(`Timeout`)}),(0,H.jsx)(ad,{type:`number`,id:`reranker-timeout`,className:`tabular-nums`,inputMode:`numeric`,step:1,min:500,max:3e4,disabled:a,value:r.timeout,"aria-invalid":d?.field===`timeout`||void 0,"aria-describedby":`reranker-timeout-help`,onChange:e=>m({timeout:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-timeout-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`timeout`?e(`Enter a whole number from 500 to 30,000.`):e(`milliseconds`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.`)})]})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(K,{type:`submit`,disabled:a||!t||!f,onClick:()=>void g(),children:e(`Save`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a||!f,onClick:()=>void h(),children:e(`Test`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a,onClick:()=>i(hw(t)),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:_(s)})]})}var _w=e=>{let t=e?.value??e?.globalValue;return t==null||t===``?null:String(t)};function vw(e,t){let n=_w(e?.maxMemories),r=_w(e?.similarityThreshold),i=_w(e?.keywordMode),a=_w(e?.rerankerModel);return{profile:{text:`Prompts waiting for profile learning, and re-analysis of old chats`},limits:n&&r?{text:`Results {results} · Similarity {similarity}`,params:{results:n,similarity:r}}:{text:`How many memories a search returns`},keywords:i?{text:`Mode: {mode}`,params:{mode:i}}:{text:`Keyword matching`},reranker:_w(e?.rerankerApiUrl)?a?{text:`On · {model}`,params:{model:a}}:{text:`On`}:{text:`Off`},maps:t?{text:`{saved} saved · {ignored} ignored`,params:t}:{text:`Saved maps and ignored directories`}}}function yw({id:e,title:t,summary:n,children:r}){return(0,H.jsxs)(`details`,{id:e,"data-shared-row":!0,className:`scroll-mt-20 rounded-xl border border-border bg-card`,children:[(0,H.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer flex-wrap items-baseline gap-x-3 gap-y-1 rounded-xl p-4 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h2`,{className:`text-subsection-title font-semibold`,children:t}),(0,H.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:n})]}),(0,H.jsx)(`div`,{className:`border-t border-border p-4`,children:r})]})}function bw({title:e,summary:t}){let n=`/memory#memory-injection`;return(0,H.jsxs)(`a`,{id:`shared-memory-injection`,href:n,onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||(e.preventDefault(),_f(n))},className:`flex min-h-11 flex-wrap items-baseline gap-x-3 gap-y-1 rounded-xl border border-border bg-card p-4 transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h2`,{className:`text-subsection-title font-semibold`,children:e}),(0,H.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:t})]})}function xw({statuses:e,onReanalyse:t}){let n=Y(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let e=!0,t=()=>{X(`/api/settings`).then(t=>e&&i(t.settings)).catch(()=>{}),X(`/api/settings/import-maps`).then(t=>e&&o({saved:t.saved.length,ignored:t.ignored?.length??0})).catch(()=>{})};t();let n=cy(t);return()=>{e=!1,n()}},[]);let s=vw(r,a),c=e=>nS(n,s[e]),l=MC(r),u=e=>n(e?`On`:`Off`),d=nS(n,{text:`Session start {opening} · Subagents {subagent} · Restore {restore}`,params:{opening:u(l.opening),subagent:u(l.subagent),restore:u(l.restore)}});return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(TC,{current:`shared`,statuses:e}),(0,H.jsxs)(`header`,{className:`space-y-1`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:n(`Shared`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`These settings apply to every host. Open a row to change it.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(yw,{id:`shared-profile`,title:n(`Profile learning`),summary:c(`profile`),children:(0,H.jsx)(cw,{onReanalyse:t})}),(0,H.jsx)(yw,{id:`shared-limits`,title:n(`Memory limits`),summary:c(`limits`),children:(0,H.jsx)(ew,{})}),(0,H.jsx)(bw,{title:n(`Memory injection`),summary:d}),(0,H.jsx)(yw,{id:`shared-keywords`,title:n(`Keyword matching`),summary:c(`keywords`),children:(0,H.jsx)(WC,{})}),(0,H.jsx)(yw,{id:`shared-reranker`,title:n(`Reranker`),summary:c(`reranker`),children:(0,H.jsx)(gw,{})}),(0,H.jsx)(yw,{id:`shared-directory-maps`,title:n(`Directory maps`),summary:c(`maps`),children:(0,H.jsx)(Mx,{hosts:[]})})]})]})}var Sw=3e3;function Cw(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({pi:null,opencode:null,"claude-code":null}),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)({}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(sS(i,e=>u(e.message))),m=(0,v.useRef)(sS(o,e=>u(e.message))),h=()=>p.current(X(`/api/settings/backfill`)),g=()=>m.current(X(`/api/settings/backfill/runs`));(0,v.useEffect)(()=>{let e=!0;X(`/api/settings`).then(t=>e&&n(t)).catch(t=>e&&u(t.message)),h(),g();for(let t of[`pi`,`opencode`])X(`/api/settings/models?host=${t}`).then(n=>e&&c(e=>({...e,[t]:n}))).catch(()=>e&&c(e=>({...e,[t]:{available:!1}})));let t=cy(t=>{e&&(n(t),h())}),r=setInterval(()=>{e&&(h(),g())},Sw);return()=>{e=!1,clearInterval(r),t()}},[]);async function _(n){if(t){f(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),u(e(`Saved. Changes apply at the next run.`))}catch(e){u(e.message)}await sy(),f(!1)}}async function y(t,n){f(!0);let r=a?.[t]?.run?.state===`running`;try{await X(`/api/settings/backfill/${t}/${n}`,{method:`POST`,body:`{}`}),u(e(n===`pause`?r?`Pausing after the current exchange.`:`Paused. No import starts until you resume.`:`Backfill started.`))}catch(e){u(e.message)}await Promise.all([g(),h()]),f(!1)}function b(t,n){try{_(Fx(t,n.trim()))}catch(t){u(e(t.message))}}return{snapshot:t,rows:r,runs:a,lists:s,message:l,busy:d,save:_,control:y,saveModel:b,setMessage:u}}var ww=6e4;function Tw(){let e=Cw(),[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(null),a=Y();(0,v.useEffect)(()=>{let e=!0,t=()=>void X(`/api/settings/imports/readiness`).then(t=>e&&n(t)).catch(()=>e&&n(null));t();let r=cy(t);return()=>{e=!1,r()}},[]),(0,v.useEffect)(()=>{let e=!0,t=()=>void X(`/api/settings/last-saved`).then(t=>e&&i(t.hosts)).catch(()=>void 0);t();let n=cy(t),r=setInterval(t,ww);return()=>{e=!1,n(),clearInterval(r)}},[]);let o=e=>{let t=Mi(new Date(e),new Date),n=tm(e);return t===`earlier`?`${em(e)} ${n}`:a(t===`today`?`today {time}`:`yesterday {time}`).replaceAll(`{time}`,n)},s=n=>({host:n,run:e.runs?.[n]?.run??null,pending:e.rows[n]?.counts.pending??0,cutoff:e.rows[n]?.cutoff??null,runNowUnavailable:e.runs?.[n]?.runNowUnavailable??null,setUp:t?.defaultSourceFound?.[n]!==!1,formatDate:em,lastSaved:r?.[n]??null,formatSaved:o});return{backfill:e,readiness:t,input:s,status:e=>eS(s(e)),line:e=>tS(s(e))}}function Ew(){let e=fd(yf().split(`#`)[0]),t=Tw(),[n,r]=(0,v.useState)(0);(0,v.useEffect)(()=>{cf(window.location.hash)},[e]);function i(){r(e=>e+1),_f(J.memory)}return(0,H.jsxs)(`div`,{className:`settings-view`,children:[e===null&&(0,H.jsx)(RC,{statuses:t,profilePreset:n}),e===`shared`&&(0,H.jsx)(xw,{statuses:t,onReanalyse:i}),e!==null&&e!==`shared`&&(0,H.jsx)(OC,{host:e,statuses:t,profilePreset:n})]})}var Dw=`/api/chat`,Ow={"Content-Type":`application/json`},kw=15e4,Aw=(e,t,n,r)=>oi(`${Dw}${e}`,{method:t,headers:Ow,body:n===void 0?void 0:JSON.stringify(n),timeout:r}),jw={status:()=>oi(`${Dw}/status`),list:()=>oi(`${Dw}/conversations`),get:e=>oi(`${Dw}/conversations/${encodeURIComponent(e)}`),create:(e,t)=>Aw(`/conversations`,`POST`,{folderId:e,scopeTag:t}),rename:(e,t)=>Aw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{title:t}),move:(e,t)=>Aw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{folderId:t}),remove:e=>Aw(`/conversations/${encodeURIComponent(e)}`,`DELETE`),removeMany:e=>Aw(`/conversations/bulk-delete`,`POST`,{ids:e}),ask:(e,t,n,r=!1)=>Aw(`/conversations/${encodeURIComponent(e)}/messages`,`POST`,{question:t,scopeTag:n,retry:r},kw),createFolder:e=>Aw(`/folders`,`POST`,{name:e}),renameFolder:(e,t)=>Aw(`/folders/${encodeURIComponent(e)}`,`PATCH`,{name:t}),removeFolder:e=>Aw(`/folders/${encodeURIComponent(e)}`,`DELETE`)},Mw={conversations:[],folders:[],readOnly:!1};function Nw(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(Mw),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),m=(0,v.useCallback)(async()=>{let e=await jw.list();e.success&&e.data&&r(e.data)},[]);(0,v.useEffect)(()=>{jw.status().then(e=>e.success&&e.data&&t(e.data)),oi(`/api/tags`).then(e=>e.success&&e.data&&a(e.data.project)),m()},[m]);let h=(0,v.useCallback)(e=>e===null||i.some(t=>t.tag===e),[i]),g=(0,v.useCallback)(async e=>{let t=await jw.get(e);if(!t.success||!t.data)return void U.error(t.error??``);s(e),l(t.data);let n=t.data.conversation.scopeTag;d(h(n)?n:void 0)},[h]),_=(0,v.useCallback)(async(e=null)=>{let t=await jw.create(e,null);if(!t.success||!t.data)return void U.error(t.error??``);await m(),s(t.data.id),l({conversation:t.data,messages:[]}),d(null)},[m]),y=(0,v.useCallback)(async(e,t=!1)=>{if(u===void 0)return;let n=o;if(!n){let e=await jw.create(null,u);if(!e.success||!e.data)return void U.error(e.error??``);n=e.data.id,s(n),l({conversation:e.data,messages:[]})}p(e);let r=await jw.ask(n,e,u,t);if(p(null),!r.success||!r.data)return void U.error(r.error??``);await g(n),await m()},[o,u,g,m]),b=(0,v.useCallback)(e=>{let t=c?.messages??[],n=t[t.findIndex(t=>t.id===e.id)-1];n?.role===`user`&&y(n.content,!0)},[c,y]),x=(0,v.useCallback)(async e=>{o&&e.includes(o)&&(s(null),l(null),d(null)),await m()},[o,m]),S=(0,v.useCallback)(async e=>{let t=e.length===1?await jw.remove(e[0]):await jw.removeMany(e);if(!t.success)return void U.error(t.error??``);await x(e)},[x]),C=(0,v.useCallback)(async e=>{let t=n.conversations.filter(t=>t.folderId===e).map(e=>e.id),r=await jw.removeFolder(e);if(!r.success)return void U.error(r.error??``);await x(t)},[n,x]),w=(0,v.useCallback)(async e=>{let t=await e();return t.success?(await m(),o&&await g(o),null):t.code===`conflict`?`conflict`:t.error??`error`},[m,o,g]);return{status:e,list:n,projects:i,activeId:o,detail:c,scope:u,setScope:d,pending:f,scopeMissing:!!c&&u===void 0,open:g,newChat:_,ask:y,retry:b,deleteChats:S,deleteFolder:C,change:w}}function Pw(e,t){return e||t?[`S`,`P`,`K`]:[`S`,`P`]}function Fw(e,t,n){return e?e.kind===`memory`?t.has(e.id):e.kind===`skill`&&n.has(e.id):!1}function Iw(e,t,n){return e.modified&&e.lastAppliedAt!==null?t(`chat-skill-modified-yes`,{date:n(e.lastAppliedAt)}):t(`chat-skill-modified-no`)}var Lw=e=>`chat-skill-kind-${e}`;function Rw(e,t){let n=[[t(`chat-search-phrases`),e.queries],[t(`chat-search-tags`),e.tags],[t(`chat-search-categories`),e.profileCategories]];return e.skills&&n.push([t(`chat-search-skills`),e.skills]),e.skillIntent&&n.push([t(`chat-search-skill-intent`),[t(`chat-intent-${e.skillIntent}`)]]),n}function zw(e){return e.startsWith(`P`)?`border-blue-600/40 bg-blue-500/10 text-blue-700 hover:bg-blue-500/20 dark:text-blue-400`:e.startsWith(`K`)?`border-violet-600/40 bg-violet-500/10 text-violet-700 hover:bg-violet-500/20 dark:text-violet-400`:`border-primary/30 bg-primary/10 text-primary-label hover:bg-primary/20`}function Bw({label:e,deleted:t,onOpen:n}){let{t:r}=G();return(0,H.jsx)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-label":r(`chat-cite-label`,{label:e}),onClick:n,className:V(`mx-0.5 inline-flex h-5 cursor-pointer items-center rounded-md border px-1.5 align-baseline text-[11px] font-medium tabular-nums transition-colors duration-200 ease-in focus-visible:outline-2 focus-visible:outline-ring`,zw(e),t&&`line-through opacity-70`),children:e})}var Vw={S:`chat-legend-memory`,P:`chat-legend-profile`,K:`chat-legend-skill`};function Hw({label:e,text:t}){return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:V(`inline-flex h-5 items-center rounded-md border px-1.5 text-[11px] font-medium`,zw(e)),children:e}),(0,H.jsx)(`span`,{dir:`auto`,children:t})]})}function Uw({letters:e}){let{t}=G();return(0,H.jsx)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:e.map(e=>(0,H.jsx)(Hw,{label:e,text:t(Vw[e])},e))})}var Ww=`__all__`,Gw=`__choose__`;function Kw({projects:e,scope:t,scopeMissing:n,disabled:r,onScope:i,onAsk:a}){let{t:o}=G(),[s,c]=(0,v.useState)(``),l=r||t===void 0;function u(e){e?.preventDefault(),!(l||!s.trim())&&(a(s.trim()),c(``))}function d(e){e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),u())}return(0,H.jsxs)(`form`,{onSubmit:u,className:`grid gap-2 rounded-2xl border border-border bg-card p-2.5 shadow-sm`,children:[(0,H.jsx)(Ip,{value:s,disabled:r,rows:2,maxLength:4e3,placeholder:o(`chat-input-placeholder`),"aria-label":o(`chat-input-placeholder`),className:`min-h-14 resize-none bg-transparent`,onChange:e=>c(e.target.value),onKeyDown:d}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`shrink-0`,children:o(`chat-scope-label`)}),(0,H.jsxs)(Dr,{className:`h-8 min-w-0 max-w-64 flex-1 text-xs`,"aria-label":o(`chat-scope-label`),disabled:r,value:t===void 0?Gw:t??Ww,onChange:e=>{let t=e.target.value;t!==Gw&&i(t===Ww?null:t)},children:[t===void 0?(0,H.jsx)(`option`,{value:Gw,children:o(`chat-scope-missing`)}):null,(0,H.jsx)(`option`,{value:Ww,children:o(`chat-scope-all`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.projectName||e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(K,{type:`submit`,size:`sm`,disabled:l||!s.trim(),"aria-label":o(`chat-send`),children:[(0,H.jsx)(ee,{}),o(`chat-send`)]})]}),n?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`chat-scope-choose`)}):null]})}function qw({status:e}){let{t}=G();return(0,H.jsxs)(`div`,{role:`alert`,className:`grid gap-2 rounded-xl border border-border bg-card p-4`,children:[(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,H.jsx)(Bt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t(`chat-setup-title`)]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`chat-setup-body`,{names:e.missing.join(`, `)})}),(0,H.jsxs)(`a`,{href:`/settings#settings-section-external-api`,className:`inline-flex w-fit items-center gap-1.5 text-sm text-primary-label underline-offset-4 hover:underline`,children:[(0,H.jsx)(Ot,{className:`size-3.5`,"aria-hidden":`true`}),t(`chat-setup-link`)]})]})}var Jw=`__none__`;function Yw({folders:e,folderId:t,onMove:n}){let{t:r}=G();return(0,H.jsxs)(Dr,{className:`h-8 w-full text-xs`,"aria-label":r(`chat-move`),value:t??Jw,onChange:e=>n(e.target.value===Jw?null:e.target.value),children:[(0,H.jsx)(`option`,{value:Jw,children:r(`chat-no-folder`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}function Xw(e){let{t}=G(),{conversation:n,active:r,selectMode:i}=e,a=n.title||t(`chat-new`);return i?(0,H.jsx)(`li`,{children:(0,H.jsxs)(`label`,{className:`flex min-h-11 md:min-h-9 cursor-pointer items-center gap-2 rounded-lg px-2 text-sm hover:bg-interactive-hover`,children:[(0,H.jsx)(Qo,{checked:e.selected,onCheckedChange:e.onToggleSelect,"aria-label":t(`chat-select-chat`,{title:a})}),(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate`,title:a,children:a})]})}):(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`div`,{className:V(`group flex items-center gap-1 rounded-lg`,r?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-interactive-hover`),children:[(0,H.jsx)(`button`,{type:`button`,className:`min-h-11 md:min-h-9 min-w-0 flex-1 cursor-pointer overflow-hidden rounded-lg px-2 text-start text-sm focus-visible:outline-2 focus-visible:outline-ring`,"aria-current":r?`true`:void 0,title:a,onClick:e.onOpen,children:(0,H.jsx)(`span`,{dir:`auto`,className:`block truncate`,children:a})}),e.readOnly?null:(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`me-1 shrink-0 text-muted-foreground`,"aria-label":t(`chat-chat-actions`),"aria-expanded":e.actionsOpen,onClick:e.onToggleActions,children:(0,H.jsx)(xe,{})})]}),e.actionsOpen?(0,H.jsxs)(`div`,{className:`ms-2 mt-1 mb-2 grid gap-1.5 rounded-lg border border-border bg-card p-2`,children:[(0,H.jsx)(Yw,{folders:e.folders,folderId:n.folderId,onMove:e.onMove}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`xs`,onClick:e.onRename,children:[(0,H.jsx)(mt,{}),t(`chat-rename`)]}),(0,H.jsxs)(K,{type:`button`,variant:`destructive`,size:`xs`,onClick:e.onDelete,children:[(0,H.jsx)(Rt,{}),t(`chat-delete`)]})]})]}):null]})}function Zw({name:e,count:t,actions:n,onSelectAll:r,children:i}){let{t:a}=G(),[o,s]=(0,v.useState)(!0),c=o?Oe:Ae;return(0,H.jsxs)(`section`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex min-h-11 md:min-h-8 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-lg px-1.5 text-xs font-medium text-muted-foreground transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,"aria-expanded":o,onClick:()=>s(!o),children:[(0,H.jsx)(ce,{className:V(`size-3.5 shrink-0 transition-transform rtl:-scale-x-100`,o&&`rotate-90`),"aria-hidden":`true`}),(0,H.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate uppercase tracking-wide`,children:e}),(0,H.jsx)(`span`,{className:`tabular-nums`,"aria-label":a(t===1?`chat-folder-count-one`:`chat-folder-count`,{count:t}),children:t})]}),r&&t>0?(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`xs`,onClick:r,children:a(`chat-select-all-folder`)}):null,n&&!r?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center`,role:`group`,"aria-label":a(`chat-folder-actions`),children:[(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-new`),title:a(`chat-new`),onClick:n.onNewChat,children:(0,H.jsx)(vt,{})}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-rename`),title:a(`chat-rename`),onClick:n.onRename,children:(0,H.jsx)(mt,{})}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-delete`),title:a(`chat-delete`),onClick:n.onDelete,children:(0,H.jsx)(Rt,{})})]}):null]}),o?(0,H.jsx)(`ul`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5 ps-3`,children:i}):null]})}function Qw(e){let{t}=G(),{chat:n,selectMode:r,selected:i}=e,[a,o]=(0,v.useState)(null),{conversations:s,folders:c,readOnly:l}=n.list,u=s.filter(e=>!e.folderId),d=e=>e===`conflict`?t(`chat-folder-exists`):e,f=t=>{let n=new Set(i);n.has(t)?n.delete(t):n.add(t),e.onSelected(n)},p=t=>e.onSelected(new Set([...i,...t])),m=r=>e.onName({title:t(`chat-chat-rename-title`),label:t(`chat-chat-title`),initial:r.title,submitLabel:t(`chat-save`),submit:e=>n.change(()=>jw.rename(r.id,e))}),h=t=>t.map(t=>(0,H.jsx)(Xw,{conversation:t,folders:c,active:t.id===n.activeId,selectMode:r,selected:i.has(t.id),actionsOpen:a===t.id,readOnly:l,onOpen:()=>{n.open(t.id),e.onOpened?.()},onToggleSelect:()=>f(t.id),onToggleActions:()=>o(a===t.id?null:t.id),onRename:()=>m(t),onMove:e=>void n.change(()=>jw.move(t.id,e)),onDelete:()=>e.onDelete({kind:`chats`,ids:[t.id]})},t.id));return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:t(`chat-selected-count`,{count:i.size})}),(0,H.jsxs)(K,{type:`button`,variant:`destructive`,size:`xs`,disabled:i.size===0,onClick:()=>e.onDelete({kind:`chats`,ids:[...i]}),children:[(0,H.jsx)(Rt,{}),t(`chat-delete-selected`)]}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>e.onSelectMode(!1),children:t(`chat-select-done`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(K,{type:`button`,size:`xs`,disabled:l,onClick:()=>void n.newChat(),children:[(0,H.jsx)(vt,{}),t(`chat-new`)]}),(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`xs`,disabled:l,onClick:()=>e.onName({title:t(`chat-folder-create-title`),label:t(`chat-folder-name`),initial:``,submitLabel:t(`chat-create`),submit:async e=>d(await n.change(()=>jw.createFolder(e)))}),children:[(0,H.jsx)(ke,{}),t(`chat-new-folder`)]}),(0,H.jsxs)(K,{type:`button`,variant:`ghost`,size:`xs`,disabled:l||s.length===0,onClick:()=>e.onSelectMode(!0),children:[(0,H.jsx)(jt,{}),t(`chat-select`)]})]})}),s.length===0&&c.length===0?(0,H.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:t(`chat-empty-list`)}):null,c.map(i=>{let a=s.filter(e=>e.folderId===i.id);return(0,H.jsx)(Zw,{name:i.name,count:a.length,onSelectAll:r?()=>p(a.map(e=>e.id)):void 0,actions:l?void 0:{onNewChat:()=>void n.newChat(i.id),onRename:()=>e.onName({title:t(`chat-folder-rename-title`),label:t(`chat-folder-name`),initial:i.name,submitLabel:t(`chat-save`),submit:async e=>d(await n.change(()=>jw.renameFolder(i.id,e)))}),onDelete:()=>e.onDelete({kind:`folder`,id:i.id,name:i.name,count:a.length})},children:h(a)},i.id)}),u.length>0?(0,H.jsx)(Zw,{name:t(`chat-no-folder`),count:u.length,onSelectAll:r?()=>p(u.map(e=>e.id)):void 0,children:h(u)}):null]})}function $w({request:e,onConfirm:t,onCancel:n}){let{t:r}=G(),[i,a]=(0,v.useState)(!1);return(0,H.jsx)(zl,{open:e!==null,onOpenChange:e=>!e&&!i&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:e?.kind===`folder`?r(`chat-delete-folder-title`):r(`chat-delete-chats-title`)}),(0,H.jsx)(Gl,{children:e?eT(e,r):null})]}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`secondary`,onClick:n,disabled:i,children:r(`chat-cancel`)}),(0,H.jsx)(K,{type:`button`,variant:`destructive`,disabled:i,onClick:async()=>{e&&(a(!0),await t(e),a(!1))},children:r(`chat-delete-confirm`)})]})]})})}function eT(e,t){if(e.kind===`folder`)return t(e.count===1?`chat-delete-folder-body-one`:`chat-delete-folder-body`,{name:e.name,count:e.count});let n=e.ids.length;return t(n===1?`chat-delete-chats-body-one`:`chat-delete-chats-body`,{count:n})}function tT({request:e,onClose:t}){let{t:n}=G(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{i(e?.initial??``),o(null)},[e]);async function l(n){if(n.preventDefault(),!e||!r.trim())return;c(!0);let i=await e.submit(r.trim());c(!1),i?o(i):t()}return(0,H.jsx)(zl,{open:e!==null,onOpenChange:e=>!e&&t(),children:(0,H.jsx)(q,{className:`sm:max-w-sm`,children:(0,H.jsxs)(`form`,{onSubmit:l,className:`grid gap-4`,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:e?.title})}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(Fp,{htmlFor:`chat-name-input`,children:e?.label}),(0,H.jsx)(ad,{id:`chat-name-input`,value:r,maxLength:80,autoFocus:!0,"aria-invalid":a?!0:void 0,onChange:e=>i(e.target.value)}),a?(0,H.jsx)(`p`,{className:`text-xs text-destructive-label`,children:a}):null]}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`secondary`,onClick:t,children:n(`chat-cancel`)}),(0,H.jsx)(K,{type:`submit`,disabled:s||!r.trim(),children:e?.submitLabel})]})]})})})}var nT=/\[([SPK]\d+)\]/g,rT=/<(?:[^>"']|"[^"]*"|'[^']*')*>/g,iT=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,aT=new Set([`a`,`code`,`pre`,`button`]);function oT(e,t,n,r){let i=new Set(t),a=(e,t)=>{if(!i.has(t))return e;let a=[`cite-chip`];t.startsWith(`P`)&&a.push(`cite-profile`),t.startsWith(`K`)&&a.push(`cite-skill`),n(t)&&a.push(`cite-deleted`);let o=r(t).replace(/["&<>]/g,e=>`&#${e.charCodeAt(0)};`);return`<button type="button" class="${a.join(` `)}" data-cite="${t}" aria-haspopup="dialog" aria-label="${o}">${t}</button>`},o=``,s=0,c=0,l=(t,n)=>{let r=e.slice(t,n);o+=c>0?r:r.replace(nT,a)};for(let t of e.matchAll(rT)){l(s,t.index),o+=t[0],s=t.index+t[0].length;let e=iT.exec(t[0]);!e||!aT.has(e[2].toLowerCase())||(e[1]?c=Math.max(0,c-1):c+=1)}return l(s,e.length),o}var sT=/\[([SPK]\d+)\]/g;function cT(e,t){let n=new Set(t),r=[],i=``,a=0;for(let t of e.matchAll(sT)){let o=t[1];n.has(o)&&(i+=e.slice(a,t.index),i&&r.push({kind:`text`,text:i}),i=``,r.push({kind:`cite`,label:o}),a=t.index+t[0].length)}return i+=e.slice(a),i&&r.push({kind:`text`,text:i}),r}function lT(e,t){let n=[];for(let r of cT(e,t))r.kind===`cite`&&!n.includes(r.label)&&n.push(r.label);return n}function uT({plan:e}){let{t}=G(),n=Rw(e,t);return(0,H.jsxs)(`details`,{className:`group text-xs text-muted-foreground`,children:[(0,H.jsxs)(`summary`,{className:`inline-flex cursor-pointer list-none items-center gap-1.5 rounded-md py-0.5 transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(Et,{className:`size-3`,"aria-hidden":`true`}),t(`chat-how-searched`)]}),(0,H.jsxs)(`div`,{className:`mt-2 grid gap-1.5 rounded-lg border border-border p-2.5`,children:[e.skipped?(0,H.jsx)(`p`,{children:t(`chat-plan-skipped`)}):null,e.skillFacts===`unavailable`?(0,H.jsx)(`p`,{children:t(`chat-skill-facts-unavailable`)}):null,(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:n.map(([e,n])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{children:e}),(0,H.jsx)(`dd`,{dir:`auto`,className:`min-w-0 break-words text-foreground`,children:n.length?n.join(` · `):t(`chat-none`)})]},e))})]})]})}var dT={no_sources:`chat-no-sources`,insufficient:`chat-insufficient`,uncited:`chat-uncited`};function fT({message:e,missingMemoryIds:t,missingSkillNames:n,readOnly:r,onOpenSource:i,onRetry:a}){let{t:o}=G(),s=e.sources.map(e=>e.label),c=new Map(e.sources.map(e=>[e.label,e])),l=e=>Fw(e,t,n),u=(0,v.useMemo)(()=>oT(g_(e.content),s,e=>l(c.get(e)),e=>o(`chat-cite-label`,{label:e})),[e.content,e.sources,t,n,o]),d=e=>{let t=e.target.closest(`[data-cite]`),n=t?c.get(t.dataset.cite??``):void 0;n&&i(n)},f=lT(e.content,s).map(e=>c.get(e)).filter(e=>!!e);return(0,H.jsxs)(`article`,{className:`grid min-w-0 gap-2.5`,children:[e.errorCode?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-2.5 text-sm text-destructive-label`,children:[(0,H.jsx)(Bt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:o(`chat-error`,{code:e.errorCode})}),r?null:(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>a(e),children:[(0,H.jsx)(Tt,{}),o(`chat-retry`)]})]}):null,e.content?(0,H.jsx)(`div`,{dir:`auto`,className:`markdown-content chat-answer break-words text-sm leading-7`,onClick:d,dangerouslySetInnerHTML:{__html:u}}):null,e.notice?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),o(dT[e.notice])]}):null,f.length?(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:o(`chat-sources`)}),(0,H.jsx)(`ul`,{className:`grid gap-1`,children:f.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 text-xs`,children:[(0,H.jsx)(Bw,{label:e.label,deleted:l(e),onOpen:()=>i(e)}),(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate leading-5 text-muted-foreground`,children:e.kind===`skill`?e.id:`${e.projectName?`${e.projectName} · `:``}${e.text}`})]},e.label))})]}):null,e.plan?(0,H.jsx)(uT,{plan:e.plan}):null]})}function pT({text:e}){let{t}=G();return(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsxs)(`div`,{className:`max-w-[85%] rounded-2xl rounded-ee-md bg-secondary px-3.5 py-2.5`,children:[(0,H.jsxs)(`span`,{className:`sr-only`,children:[t(`chat-you`),`: `]}),(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e})]})})}function mT({messages:e,pending:t,missingMemoryIds:n,missingSkillNames:r,readOnly:i,onOpenSource:a,onRetry:o}){let{t:s}=G();return e.length===0&&!t?(0,H.jsx)(`p`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:s(`chat-empty-thread`)}):(0,H.jsxs)(`ol`,{className:`grid gap-6`,"aria-live":`polite`,children:[e.map(e=>(0,H.jsx)(`li`,{children:e.role===`user`?(0,H.jsx)(pT,{text:e.content}):(0,H.jsx)(fT,{message:e,missingMemoryIds:n,missingSkillNames:r,readOnly:i,onOpenSource:a,onRetry:o})},e.id)),t?(0,H.jsxs)(`li`,{className:`grid gap-4`,children:[e.at(-1)?.role===`user`&&e.at(-1)?.content===t?null:(0,H.jsx)(pT,{text:t}),(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,children:[(0,H.jsx)(Ye,{className:`size-4 animate-spin`,"aria-hidden":`true`}),s(`chat-thinking`)]})]}):null]})}var hT={person:`chat-skill-by-person`,agent:`chat-skill-by-agent`,automatic:`chat-skill-by-automatic`};function gT({skill:e}){let{t}=G(),n=[[t(`chat-skill-uses`),String(e.uses)],[t(`chat-skill-failed`),String(e.failedTurns)],[t(`chat-skill-attention`),e.attention.toFixed(2)],[t(`chat-skill-modified`),Iw(e,t,$p)]];return(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 rounded-lg border border-border p-2.5 text-xs text-muted-foreground`,children:n.map(([e,t])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{children:e}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words text-foreground`,children:t})]},e))}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t(`chat-skill-window`),` `,t(`chat-skill-modified-note`)]}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:t(`chat-skill-history`)}),e.history.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`chat-skill-history-empty`)}):(0,H.jsx)(`ol`,{className:`grid gap-2`,children:e.history.map((e,n)=>(0,H.jsxs)(`li`,{className:`grid gap-0.5 rounded-lg border border-border p-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:t(Lw(e.kind))}),(0,H.jsx)(`span`,{children:Qp(e.at)}),e.appliedBy&&e.appliedBy in hT?(0,H.jsx)(`span`,{children:t(hT[e.appliedBy])}):null]}),(0,H.jsx)(`span`,{dir:`auto`,className:`break-words`,children:e.summary})]},n))})]})]})}var _T={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function vT({source:e,deleted:t}){let{t:n,language:r}=G(),i=e.kind===`memory`;return e.kind===`skill`?(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[t?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-border bg-muted/40 p-2.5 text-xs`,children:[(0,H.jsx)(Bt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),n(`chat-skill-missing`)]}):null,e.skill?(0,H.jsx)(gT,{skill:e.skill}):null,(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`chat-source-note`)})]}):(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[t?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-border bg-muted/40 p-2.5 text-xs`,children:[(0,H.jsx)(Bt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),n(`chat-source-deleted`)]}):null,(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[i&&e.projectName?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-project`)}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words text-foreground`,children:e.projectName})]}):null,i&&e.createdAt?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-date`)}),(0,H.jsx)(`dd`,{className:`text-foreground`,children:Qp(new Date(e.createdAt).toISOString())})]}):null,!i&&e.section?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-profile`)}),(0,H.jsxs)(`dd`,{className:`text-foreground`,children:[n(_T[e.section]),e.category?` · ${e.category}`:``]})]}):null]}),e.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n(`chat-source-tags`),children:e.tags.map(e=>(0,H.jsx)(id,{variant:`outline`,children:e},e))}):null,(0,H.jsx)(Fv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[45vh] rounded-lg border`,children:(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words p-3 text-sm leading-6`,children:e.text})}),!i&&e.evidence?.length?(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:n(`chat-source-evidence`)}),(0,H.jsx)(`ul`,{className:`grid gap-1 text-xs`,children:e.evidence.map((e,t)=>(0,H.jsx)(`li`,{dir:`auto`,className:`break-words`,children:e},t))})]}):null,(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`chat-source-note`)}),i?(0,H.jsx)(`a`,{href:J.project,className:`text-xs text-primary-label underline-offset-4 hover:underline`,children:n(`chat-source-open-project`)}):null]})}function yT({source:e,deleted:t,onClose:n}){let{t:r}=G();return(0,H.jsx)(zl,{open:e!==null,onOpenChange:e=>!e&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:e?`${e.label} · ${e.kind===`memory`?r(`chat-source-memory`):e.kind===`skill`?`${r(`chat-source-skill`)} ${e.id}`:r(`chat-source-profile`)}`:``}),(0,H.jsx)(Gl,{className:`sr-only`,children:e?.text.slice(0,120)})]}),e?(0,H.jsx)(vT,{source:e,deleted:t}):null]})})}function bT(){let{t:e}=G(),t=Nw(),[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null),a=(0,v.useRef)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(new Set),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!n)return;let e=i.current;return a.current?.focus(),()=>e?.focus()},[n]);let g=new Set(t.detail?.missingMemoryIds??[]),_=new Set(t.detail?.missingSkillNames??[]),y=!!t.detail?.messages.some(e=>e.sources.some(e=>e.kind===`skill`)),b=t.list.readOnly,x=t.status?.ready??!1;function S(e){s(e),l(new Set)}async function C(e){e.kind===`folder`?await t.deleteFolder(e.id):await t.deleteChats(e.ids),d(null),S(!1)}let w=(0,H.jsx)(Qw,{chat:t,selectMode:o,selected:c,onSelectMode:S,onSelected:l,onDelete:d,onName:p,onOpened:()=>r(!1)});return(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100svh-9rem)] gap-4 md:grid-cols-[17rem_minmax(0,1fr)]`,children:[(0,H.jsx)(`aside`,{className:`hidden min-h-0 overflow-y-auto border-e border-border pe-4 md:sticky md:top-6 md:block md:max-h-[calc(100svh-3rem)] md:self-start`,children:w}),n?(0,H.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`chat-show-list`),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:[(0,H.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/50`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1)}),(0,H.jsxs)(`div`,{className:`absolute inset-y-0 start-0 flex w-[min(20rem,85vw)] flex-col gap-3 overflow-y-auto bg-background p-4 shadow-xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:e(`chat-conversations`)}),(0,H.jsx)(K,{ref:a,type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1),children:(0,H.jsx)(qt,{})})]}),w]})]}):null,(0,H.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,children:[(0,H.jsxs)(K,{ref:i,type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(!0),children:[(0,H.jsx)($e,{}),e(`chat-show-list`)]}),t.detail?(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-sm text-muted-foreground`,children:t.detail.conversation.title}):null]}),(0,H.jsx)(Uw,{letters:Pw(t.status?.skillFacts===!0,y)}),t.status&&!x?(0,H.jsx)(qw,{status:t.status}):null,b?(0,H.jsx)(`p`,{role:`alert`,className:`rounded-xl border border-border bg-card p-3 text-sm`,children:e(`chat-read-only`)}):null,(0,H.jsx)(`div`,{className:V(`flex min-h-48 flex-1 flex-col overflow-y-auto`),children:(0,H.jsx)(mT,{messages:t.detail?.messages??[],pending:t.pending,missingMemoryIds:g,missingSkillNames:_,readOnly:b||!x,onOpenSource:h,onRetry:t.retry})}),(0,H.jsxs)(`div`,{className:`sticky bottom-0 grid gap-1.5 bg-background pb-1`,children:[(0,H.jsx)(Kw,{projects:t.projects,scope:t.scope,scopeMissing:t.scopeMissing,disabled:!x||b||t.pending!==null,onScope:t.setScope,onAsk:e=>void t.ask(e)}),x&&t.status?.apiHost?(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":`true`}),e(`chat-provider-note`,{host:t.status.apiHost})]}):null,x&&t.status?.skillFacts?(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":`true`}),e(`chat-skill-privacy`)]}):null]})]}),(0,H.jsx)($w,{request:u,onConfirm:C,onCancel:()=>d(null)}),(0,H.jsx)(tT,{request:f,onClose:()=>p(null)}),(0,H.jsx)(yT,{source:m,deleted:Fw(m??void 0,g,_),onClose:()=>h(null)})]})}var xT=[{id:`skills-section-activity`,title:`Activity`},{id:`skills-section-ranked`,title:`Ranked skills`},{id:`skills-section-pending`,title:`Pending proposals`},{id:`skills-section-recent`,title:`Recent proposals`},{id:`skills-section-folders`,title:`Watched folders`}],ST=e=>xT.map(t=>({id:t.id,label:Qv(t.title,e)})),CT=[`all`,`not-modified`,`modified`,`suggested`],wT=`omms-skills-modified-filter`;function TT(e){let t=e.filter(e=>e.modified).length,n=e.filter(e=>e.suggested).length;return{all:e.length,"not-modified":e.length-t,modified:t,suggested:n}}function ET(e,t){return t===`all`?e:t===`suggested`?e.filter(e=>e.suggested):e.filter(e=>e.modified===(t===`modified`))}function DT(){try{let e=localStorage.getItem(wT);return CT.find(t=>t===e)??`all`}catch{return`all`}}function OT(e){try{localStorage.setItem(wT,e)}catch{}}var kT=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0,AT=e=>Array.isArray(e)?e:[],jT=e=>e&&typeof e==`object`?e:{};function MT(e){return AT(e).map(jT).filter(e=>typeof e.day==`string`).map(e=>({day:e.day,uses:kT(e.uses),failed:kT(e.failed)}))}var NT=e=>e.map(({day:e,uses:t,failed:n})=>({key:e,uses:t,failed:n})),PT=[`day`,`month`,`year`],FT=/^\d{4}-(0[1-9]|1[0-2])$/;function IT(e){let t=jT(e);return{months:AT(t.months).filter(e=>typeof e==`string`&&FT.test(e)),years:AT(t.years).filter(e=>Number.isInteger(e))}}function LT(e){let t=jT(e),n=jT(t.totals),r=MT(t.days),i=Array.isArray(t.series)?t.series.map(jT).filter(e=>typeof e.key==`string`).map(e=>({key:e.key,uses:kT(e.uses),failed:kT(e.failed)})):NT(r),a=AT(t.topSkills).map(jT).filter(e=>typeof e.name==`string`).map(e=>({name:e.name,path:typeof e.path==`string`?e.path:null,uses:kT(e.uses),failed:kT(e.failed)}));return{bucket:PT.includes(t.bucket)?t.bucket:`day`,series:i,days:r,topSkills:a,topTotal:Math.max(kT(t.topTotal),a.length),totals:{uses:kT(n.uses),failed:kT(n.failed),activeSkills:kT(n.activeSkills)},available:IT(t.available)}}var RT=[`created`,`applied`,`rejected`,`undone`,`stale`];function zT(e){let t=jT(e),n=AT(t.entries).map(jT).filter(e=>RT.includes(e.kind)&&typeof e.id==`string`).map(e=>({id:e.id,proposalId:typeof e.proposalId==`string`?e.proposalId:``,kind:e.kind,at:kT(e.at),summary:typeof e.summary==`string`?e.summary:``,appliedBy:typeof e.appliedBy==`string`?e.appliedBy:null,versionId:typeof e.versionId==`string`?e.versionId:null,canUndo:e.canUndo===!0,laterAppliedCount:kT(e.laterAppliedCount),added:kT(e.added),removed:kT(e.removed)}));return{total:Math.max(kT(t.total),n.length),entries:n}}var BT=e=>e.every(e=>e.uses===0),VT=e=>({...e,succeeded:Math.max(0,e.uses-e.failed),failed:Math.min(e.failed,e.uses)}),HT=[`pending`,`applied`,`rejected`,`stale`,`undone`];function UT(e){return HT.map(t=>({state:t,count:e.filter(e=>e.state===t).length}))}var WT=e=>Date.parse(`${e}T12:00:00`),GT={bucket:`day`,month:null},KT=`omms-skills-activity-range`,qT=`last-30`,JT=30,YT=(e,t)=>Math.min(t,e+8),XT={day:`Uses per day`,month:`Uses per month`,year:`Uses per year`},ZT={day:`Day`,month:`Month`,year:`Year`};function QT(e){return e.bucket===`year`?{bucket:`year`}:e.bucket===`month`?{bucket:`month`,year:e.year}:e.month?{bucket:`day`,month:e.month}:{bucket:`day`,days:JT}}function $T(e){return e.bucket===`year`?`year`:e.bucket===`month`?`month:${e.year}`:e.month?`day:${e.month}`:`day`}function eE(e){if(e===`year`)return{bucket:`year`};let t=/^day:(\d{4}-\d{2})$/.exec(e??``)?.[1];if(t&&FT.test(t))return{bucket:`day`,month:t};let n=/^month:(\d{4})$/.exec(e??``)?.[1];return n?{bucket:`month`,year:Number(n)}:GT}function tE(e,t){return e.bucket===`day`&&e.month&&!t.months.includes(e.month)||e.bucket===`month`&&!t.years.includes(e.year)?GT:e}function nE(e,t){return e===`year`?{bucket:e}:e===`month`?{bucket:e,year:t}:GT}var rE=e=>e.bucket===`month`?String(e.year):e.bucket===`day`?e.month??`last-30`:``;function iE(e,t){return e.bucket===`month`?{bucket:`month`,year:Number(t)}:t===`last-30`?GT:{bucket:`day`,month:t}}function aE(e,t,n,r){if(e===`year`)return t;if(e===`day`){let e=new Date(WT(t));return n?Ai(e,r.choice,r.locale):ki(e,r.choice,r.locale)}let[i,a]=t.split(`-`).map(Number);return new Intl.DateTimeFormat(r.locale,{month:n?`long`:`short`,...n?{year:`numeric`}:{},timeZone:`UTC`,calendar:`gregory`}).format(Date.UTC(i,a-1,1))}function oE(e,t,n,r){if(e.bucket===`month`)return String(e.year);if(e.bucket===`day`)return e.month?aE(`month`,e.month,!0,n):r(`Last 30 days`);let i=t[0]?.key??``,a=t.at(-1)?.key??``;return i===a?a:Gb(r(`{from} to {to}`),{from:i,to:a})}function sE(e,t,n,r,i){if(e.bucket===`year`)return[];if(e.bucket===`month`)return[...new Set([n,e.year,...t.years])].sort((e,t)=>t-e).map(e=>({value:String(e),label:String(e)}));let a=[...new Set([...e.month?[e.month]:[],...t.months])];return[{value:qT,label:i},...a.sort((e,t)=>t.localeCompare(e)).map(e=>({value:e,label:aE(`month`,e,!0,r)}))]}var cE=[`day`,`month`,`year`],lE={day:`Days`,month:`Months`,year:`Years`},uE={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function dE({range:e,available:t,currentYear:n,loading:r,onChange:i}){let a=Y(),o=(0,v.useRef)([]),s=t=>{let r=cE[t];o.current[t]?.focus(),r!==e.bucket&&i(nE(r,n))};return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":a(`Show uses by`),className:`inline-flex gap-1.5`,onKeyDown:t=>{let n=uE[t.key];if(!n)return;t.preventDefault();let r=getComputedStyle(t.currentTarget).direction===`rtl`,i=t.key===`ArrowLeft`||t.key===`ArrowRight`,a=r&&i?-n:n,o=cE.indexOf(e.bucket);s((o+a+cE.length)%cE.length)},children:cE.map((t,n)=>(0,H.jsx)(`button`,{ref:e=>{o.current[n]=e},type:`button`,role:`radio`,"aria-checked":e.bucket===t,tabIndex:e.bucket===t?0:-1,className:V(`min-h-9 rounded-[10px] border px-3 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring`,e.bucket===t?`border-primary/40 bg-selection text-foreground`:`border-input bg-card text-muted-foreground hover:bg-interactive-hover`),onClick:()=>s(n),children:a(lE[t])},t))}),e.bucket===`year`?(0,H.jsx)(`span`,{className:`h-9 w-44`,"aria-hidden":`true`}):(0,H.jsx)(Dr,{className:`w-44`,"aria-label":a(e.bucket===`day`?`Days to show`:`Year to show`),value:rE(e),onChange:t=>i(iE(e,t.target.value)),children:sE(e,t,n,nm(),a(`Last 30 days`)).map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,H.jsx)(Ye,{"aria-hidden":`true`,className:V(`size-4 animate-spin text-muted-foreground`,!r&&`invisible`)}),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:r?a(`Loading…`):``})]})}var fE=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function pE(e){return typeof e==`string`&&fE.includes(e)}var mE=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function hE(e){return typeof e==`string`&&mE.has(e)}function gE(e){return typeof e==`string`&&e.startsWith(`data-`)}function _E(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(hE(n)||gE(n))&&(t[n]=e[n]);return t}function vE(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return _E(t)}return typeof e==`object`&&!Array.isArray(e)?_E(e):null}function yE(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(hE(n)||gE(n)||pE(n))&&(t[n]=e[n]);return t}var bE=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function xE(){return xE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xE.apply(null,arguments)}function SE(e,t){if(e==null)return{};var n,r,i=CE(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function CE(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var wE=(0,v.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:c,desc:l}=e,u=SE(e,bE),d=a||{width:r,height:i,x:0,y:0},f=Xt(`recharts-surface`,o);return v.createElement(`svg`,xE({},yE(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),TE=[`children`,`className`];function EE(){return EE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},EE.apply(null,arguments)}function DE(e,t){if(e==null)return{};var n,r,i=OE(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function OE(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var kE=v.forwardRef((e,t)=>{var{children:n,className:r}=e,i=DE(e,TE),a=Xt(`recharts-layer`,r);return v.createElement(`g`,EE({className:a},yE(i),{ref:t}),n)}),AE=(0,v.createContext)(null);function jE(e){return function(){return e}}var ME=Math.cos,NE=Math.sin,PE=Math.sqrt,FE=Math.PI;FE/2;var IE=2*FE,LE=Math.PI,RE=2*LE,zE=1e-6,BE=RE-zE;function VE(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function HE(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return VE;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var UE=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?VE:HE(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>zE){if(!(Math.abs(u*s-c*l)>zE)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((LE-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>zE&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>zE||Math.abs(this._y1-l)>zE)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%RE+RE),d>BE?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>zE&&this._append`A${n},${n},0,${+(d>=LE)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};UE.prototype;function WE(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new UE(t)}Array.prototype.slice;function GE(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function KE(e){this._context=e}KE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function qE(e){return new KE(e)}function JE(e){return e[0]}function YE(e){return e[1]}function XE(e,t){var n=jE(!0),r=null,i=qE,a=null,o=WE(s);e=typeof e==`function`?e:e===void 0?JE:jE(e),t=typeof t==`function`?t:t===void 0?YE:jE(t);function s(s){var c,l=(s=GE(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:jE(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:jE(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function ZE(e,t,n){var r=null,i=jE(!0),a=null,o=qE,s=null,c=WE(l);e=typeof e==`function`?e:e===void 0?JE:jE(+e),t=typeof t==`function`?t:jE(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?YE:jE(+n);function l(l){var u,d,f,p=(l=GE(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return XE().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:jE(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:jE(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:jE(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:jE(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:jE(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var QE=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function $E(e){return new QE(e,!0)}function eD(e){return new QE(e,!1)}var tD={draw(e,t){let n=PE(t/FE);e.moveTo(n,0),e.arc(0,0,n,0,IE)}},nD={draw(e,t){let n=PE(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},rD=PE(1/3),iD=rD*2,aD={draw(e,t){let n=PE(t/iD),r=n*rD;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},oD={draw(e,t){let n=PE(t),r=-n/2;e.rect(r,r,n,n)}},sD=.8908130915292852,cD=NE(FE/10)/NE(7*FE/10),lD=NE(IE/10)*cD,uD=-ME(IE/10)*cD,dD={draw(e,t){let n=PE(t*sD),r=lD*n,i=uD*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=IE*t/5,o=ME(a),s=NE(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},fD=PE(3),pD={draw(e,t){let n=-PE(t/(fD*3));e.moveTo(0,n*2),e.lineTo(-fD*n,-n),e.lineTo(fD*n,-n),e.closePath()}},mD=-.5,hD=PE(3)/2,gD=1/PE(12),_D=(gD/2+1)*3,vD={draw(e,t){let n=PE(t/_D),r=n/2,i=n*gD,a=r,o=n*gD+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(mD*r-hD*i,hD*r+mD*i),e.lineTo(mD*a-hD*o,hD*a+mD*o),e.lineTo(mD*s-hD*c,hD*s+mD*c),e.lineTo(mD*r+hD*i,mD*i-hD*r),e.lineTo(mD*a+hD*o,mD*o-hD*a),e.lineTo(mD*s+hD*c,mD*c-hD*s),e.closePath()}};function yD(e,t){let n=null,r=WE(i);e=typeof e==`function`?e:jE(e||tD),t=typeof t==`function`?t:jE(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:jE(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function bD(){}function xD(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function SD(e){this._context=e}SD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:xD(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:xD(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function CD(e){return new SD(e)}function wD(e){this._context=e}wD.prototype={areaStart:bD,areaEnd:bD,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:xD(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function TD(e){return new wD(e)}function ED(e){this._context=e}ED.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:xD(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function DD(e){return new ED(e)}function OD(e){this._context=e}OD.prototype={areaStart:bD,areaEnd:bD,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function kD(e){return new OD(e)}function AD(e){return e<0?-1:1}function jD(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(AD(a)+AD(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function MD(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ND(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function PD(e){this._context=e}PD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ND(this,this._t0,MD(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ND(this,MD(this,n=jD(this,e,t)),n);break;default:ND(this,this._t0,n=jD(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function FD(e){this._context=new ID(e)}(FD.prototype=Object.create(PD.prototype)).point=function(e,t){PD.prototype.point.call(this,t,e)};function ID(e){this._context=e}ID.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function LD(e){return new PD(e)}function RD(e){return new FD(e)}function zD(e){this._context=e}zD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=BD(e),i=BD(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function BD(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function VD(e){return new zD(e)}function HD(e,t){this._context=e,this._t=t}HD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function UD(e){return new HD(e,.5)}function WD(e){return new HD(e,0)}function GD(e){return new HD(e,1)}function KD(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function qD(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function JD(e,t){return e[t]}function YD(e){let t=[];return t.key=e,t}function XD(){var e=jE([]),t=qD,n=KD,r=JD;function i(i){var a=Array.from(e.apply(this,arguments),YD),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=GE(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:jE(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:jE(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?qD:typeof e==`function`?e:jE(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??KD,i):n},i}function ZD(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}KD(e,t)}}function QD(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}KD(e,t)}}function $D(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,KD(e,t)}}function eO(e){return e===`__proto__`}var tO=Object.prototype.hasOwnProperty;function nO(e,t){return tO.call(e,t)}var rO=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function iO(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:rO.test(e);default:return!1}}function aO(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function oO(e){return typeof e==`symbol`||e instanceof Symbol}function sO(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n<e.length;n++)n>0&&(t+=`,`),t+=sO(e[n]);return t}if(oO(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function cO(e){return e==null?``:sO(e)}function lO(e){if(Array.isArray(e))return e.map(aO);if(typeof e==`symbol`)return[e];e=cO(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let l=e[r];if(a)l===`\\`&&r+1<n?(r++,i+=e[r]):l===a?a=``:i+=l;else if(o){if(l===`"`||l===`'`)a=l,s=!0;else if(l===`]`){if(o=!1,!s&&i.includes(`.`)&&!c.test(i)){let e=i.split(`.`);for(let n=0;n<e.length;n++)e[n]!==``&&t.push(e[n])}else t.push(i);i=``}else i+=l}else if(l===`[`)o=!0,s=!1,i&&=(t.push(i),``);else if(l===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=l;r++}return i&&t.push(i),t}function uO(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(eO(t))return n;let r=e[t];return r===void 0?iO(t)&&!nO(e,t)?uO(e,lO(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=aO(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return dO(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),eO(t))return n;let r=e[t];return r===void 0?n:r}}}function dO(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||eO(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var fO=4;function pO(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:fO),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function mO(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+pO(i)+n},``)}var hO=e=>e===0?0:e>0?1:-1,gO=e=>typeof e==`number`&&e!=+e,_O=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,Z=e=>(typeof e==`number`||e instanceof Number)&&!gO(e),vO=e=>Z(e)||typeof e==`string`,yO=0,bO=e=>{var t=++yO;return`${e||``}${t}`},xO=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!Z(e)&&typeof e!=`string`)return n;var i;if(_O(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return gO(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},SO=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function CO(e,t,n){return Z(e)&&Z(t)?pO(e+n*(t-e)):t}function wO(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):uO(e,t))===n)}var TO=e=>e==null,EO=e=>TO(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function DO(e){return e!=null}function OO(){}var kO=[`type`,`size`,`sizeType`];function AO(){return AO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},AO.apply(null,arguments)}function jO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jO(Object(n),!0).forEach(function(t){NO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function NO(e,t,n){return(t=PO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PO(e){var t=FO(e,`string`);return typeof t==`symbol`?t:t+``}function FO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function IO(e,t){if(e==null)return{};var n,r,i=LO(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function LO(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var RO={symbolCircle:tD,symbolCross:nD,symbolDiamond:aD,symbolSquare:oD,symbolStar:dD,symbolTriangle:pD,symbolWye:vD},zO=Math.PI/180,BO=e=>RO[`symbol${EO(e)}`]||tD,VO=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*zO;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},HO=(e,t)=>{RO[`symbol${EO(e)}`]=t},UO=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=MO(MO({},IO(e,kO)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=BO(a),t=yD().type(e).size(VO(n,r,a))();if(t!==null)return t},{className:s,cx:c,cy:l}=i,u=yE(i);return Z(c)&&Z(l)&&Z(n)?v.createElement(`path`,AO({},u,{className:Xt(`recharts-symbols`,s),transform:`translate(${c}, ${l})`,d:o()})):null};UO.registerSymbol=HO;var WO=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,GO=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{pE(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},KO=(e,t,n)=>r=>(e(t,n,r),null),qO=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];pE(i)&&typeof a==`function`&&(r||={},r[i]=KO(a,t,n))}),r};function JO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function YO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?JO(Object(n),!0).forEach(function(t){XO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XO(e,t,n){return(t=ZO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZO(e){var t=QO(e,`string`);return typeof t==`symbol`?t:t+``}function QO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function $O(e,t){var n=YO({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function ek(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function tk(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function nk(e){return e}function rk(e){return Number.isSafeInteger(e)&&e>=0}function ik(e){return e!=null&&typeof e!=`function`&&rk(e.length)}function ak(e){return function(t){return uO(t,e)}}function ok(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function sk(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var ck=`[object RegExp]`,lk=`[object String]`,uk=`[object Number]`,dk=`[object Boolean]`,fk=`[object Arguments]`,pk=`[object Symbol]`,mk=`[object Date]`,hk=`[object Map]`,gk=`[object Set]`,_k=`[object Array]`,vk=`[object ArrayBuffer]`,yk=`[object Object]`,bk=`[object DataView]`,xk=`[object Uint8Array]`,Sk=`[object Uint8ClampedArray]`,Ck=`[object Uint16Array]`,wk=`[object Uint32Array]`,Tk=`[object Int8Array]`,Ek=`[object Int16Array]`,Dk=`[object Int32Array]`,Ok=`[object Float32Array]`,kk=`[object Float64Array]`;function Ak(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function jk(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Mk(e,t,n){return typeof n==`function`?Nk(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?Nk(t,r,e,s,!1):!!c},new Map,!0):Mk(e,t,()=>void 0)}function Nk(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return Pk(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Nk(e,Object.assign({},t),n,r,i):Ak(e,t);default:return jk(e)&&i?typeof t!=`string`||t===``:Ak(e,t)}}function Pk(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Ik(e,t,n,r);if(t instanceof Map)return Fk(e,t,n,r);if(t instanceof Set)return Lk(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)ok(e)&&(e=Object(e));else{if(sk(t)===`[object Error]`)return sk(e)===`[object Error]`&&e.name===t.name&&e.message===t.message;let n=sk(e);if(n!==`[object Object]`&&n!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;i<a.length;i++){let o=a[i];if(!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function Fk(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function Ik(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function Lk(e,t,n,r){return t.size===0||e instanceof Set&&Ik([...e],[...t],n,r)}function Rk(e,t){return Mk(e,t,()=>void 0)}function zk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var Bk=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function Vk(e){return Bk.Buffer!==void 0&&Bk.Buffer.isBuffer(e)}function Hk(e){return Vk(e)}function Uk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Wk(e){return Uk(e)}function Gk(e,t){return Kk(e,void 0,e,new Map,t)}function Kk(e,t,n,r,i){if(i!=null){let a=i(e,t,n,r);if(a!==void 0)return a}if(ok(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Kk(e[a],a,n,r,i);return nO(e,`index`)&&(t.index=e.index),nO(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;return r.set(e,t),e.forEach((e,a)=>{t.set(a,Kk(e,a,n,r,i))}),t}if(e instanceof Set){let t=new Set;return r.set(e,t),e.forEach(e=>{t.add(Kk(e,void 0,n,r,i))}),t}if(Hk(e))return e.subarray();if(Wk(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Kk(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),qk(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),qk(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),qk(t,e,n,r,i),t}let a=sk(e);if(a===`[object Error]`)return e===n?{}:e;switch(a){case uk:case lk:case dk:{let t=new e.constructor(e.valueOf());return r.set(e,t),qk(t,e,n,r,i),t}case fk:{let t={};return r.set(e,t),qk(t,e,n,r,i),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}}if(typeof e==`object`&&Jk(a)){let t=a===`[object Object]`&&typeof e.constructor!=`function`?{}:Object.create(Object.getPrototypeOf(e));return r.set(e,t),qk(t,e,n,r,i),t}return e}function qk(e,t,n,r,i){let a=[...Object.keys(t),...zk(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=Kk(t[s],s,n,r,i))}}function Jk(e){switch(e){case fk:case _k:case vk:case bk:case dk:case mk:case Ok:case kk:case Tk:case Ek:case Dk:case hk:case uk:case yk:case ck:case gk:case lk:case pk:case xk:case Sk:case Ck:case wk:return!0;default:return!1}}function Yk(e){return Gk(e)}function Xk(e){return e=Yk(e),t=>Rk(t,e)}var Zk=/^(?:0|[1-9]\d*)$/;function Qk(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return Zk.test(e)}}function $k(e){return typeof e==`object`&&!!e&&sk(e)===`[object Arguments]`}function eA(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&iO(t)&&!(t in Object(e))?lO(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=aO(n[e]);if((r==null||!nO(r,t))&&!((Array.isArray(r)||$k(r))&&Qk(t)&&Number(t)<r.length))return!1;r=r[t]}return!0}function tA(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=aO(e)}return t=Yk(t),function(n){let r=uO(n,e);return r===void 0?eA(n,e):t===void 0?r===void 0:Rk(r,t)}}function nA(e){if(e==null)return nk;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?tA(e[0],e[1]):Xk(e);default:return ak(e)}}function rA(e){return e===0?0:e}function iA(e,t=nk){return ik(e)?ek(Array.from(e),tk(nA(t),1)).map(rA):[]}function aA(e,t,n){return t===!0?iA(e,n):typeof t==`function`?iA(e,t):e}var oA=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),sA=o(((e,t)=>{t.exports=oA()})),cA=o((e=>{var t=d(),n=sA();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),lA=o(((e,t)=>{t.exports=cA()})),uA=(0,v.createContext)(null),dA=lA(),fA=e=>e,pA=()=>{var e=(0,v.useContext)(uA);return e?e.store.dispatch:fA},mA=()=>{},hA=()=>mA,gA=(e,t)=>e===t;function Q(e){var t=(0,v.useContext)(uA),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:mA,[t,e]);return(0,dA.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:hA,t?t.store.getState:mA,t?t.store.getState:mA,n,gA)}function _A(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function vA(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function yA(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var bA=e=>Array.isArray(e)?e:[e];function xA(e){let t=Array.isArray(e[0])?e[0]:e;return yA(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function SA(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var CA=class{constructor(e){this.value=e}deref(){return this.value}},wA=typeof WeakRef<`u`?WeakRef:CA,TA=0,EA=1;function DA(){return{s:TA,v:void 0,o:null,p:null}}function OA(e,t={}){let n=DA(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=DA(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=DA(),e.set(n,t)):t=r}}let s=t,c;if(t.s===EA)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new wA(c):c}return s.s=EA,s.v=c,c}return o.clearCache=()=>{n=DA(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function kA(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),_A(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=OA,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=bA(c),p=bA(u),m=xA(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=SA(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=kA(OA),AA=Object.assign((e,t=$)=>{vA(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>AA});function jA(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function MA(e,t,n){return jk(n)&&(typeof t==`number`&&ik(n)&&Qk(t)&&t<n.length||typeof t==`string`&&t in n)?Ak(n[t],e):!1}function NA(e){let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n}function PA(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var FA=(e,t,n)=>{if(e!==t){let r=PA(e),i=PA(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},IA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,LA=/^\w*$/;function RA(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||oO(e)?!0:typeof e==`string`&&(LA.test(e)||!IA.test(e))||t!=null&&nO(t,e)}function zA(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=ik(e)?Array.from(e):NA(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r<t.length&&n!=null;++r)n=n[t[r]];return r>0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?nO(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||RA(e)?e:{key:e,path:lO(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=FA(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function BA(e,...t){let n=t.length;return n>1&&MA(e,t[0],t[1])?t=[]:n>2&&MA(t[0],t[1],t[2])&&(t=[t[0]]),zA(e,jA(t),[`asc`])}var VA=e=>e.legend.settings,HA=e=>e.legend.size;$([e=>e.legend.payload,VA],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?BA(r,n):r});var UA=1;function WA(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,v.useState)({height:0,left:0,top:0,width:0});return[t,(0,v.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>UA||Math.abs(i.left-t.left)>UA||Math.abs(i.top-t.top)>UA||Math.abs(i.width-t.width)>UA)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function GA(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var KA=typeof Symbol==`function`&&Symbol.observable||`@@observable`,qA=()=>Math.random().toString(36).substring(7).split(``).join(`.`),JA={INIT:`@@redux/INIT${qA()}`,REPLACE:`@@redux/REPLACE${qA()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${qA()}`};function YA(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function XA(e,t,n){if(typeof e!=`function`)throw Error(GA(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(GA(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(GA(1));return n(XA)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(GA(3));return i}function d(e){if(typeof e!=`function`)throw Error(GA(4));if(c)throw Error(GA(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(GA(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!YA(e))throw Error(GA(7));if(e.type===void 0)throw Error(GA(8));if(typeof e.type!=`string`)throw Error(GA(17));if(c)throw Error(GA(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(GA(10));r=e,f({type:JA.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(GA(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[KA](){return this}}}return f({type:JA.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[KA]:m}}function ZA(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:JA.INIT})===void 0)throw Error(GA(12));if(n(void 0,{type:JA.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(GA(13))})}function QA(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{ZA(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(GA(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function $A(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function ej(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(GA(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=$A(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function tj(e){return YA(e)&&`type`in e&&typeof e.type==`string`}var nj=Symbol.for(`immer-nothing`),rj=Symbol.for(`immer-draftable`),ij=Symbol.for(`immer-state`);function aj(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var oj=Object,sj=oj.getPrototypeOf,cj=`constructor`,lj=`prototype`,uj=`configurable`,dj=`enumerable`,fj=`writable`,pj=`value`,mj=e=>!!e&&!!e[ij];function hj(e){return e?vj(e)||Tj(e)||!!e[rj]||!!e[cj]?.[rj]||Ej(e)||Dj(e):!1}var gj=oj[lj][cj].toString(),_j=new WeakMap;function vj(e){if(!e||!Oj(e))return!1;let t=sj(e);if(t===null||t===oj[lj])return!0;let n=oj.hasOwnProperty.call(t,cj)&&t[cj];if(n===Object)return!0;if(!kj(n))return!1;let r=_j.get(n);return r===void 0&&(r=Function.toString.call(n),_j.set(n,r)),r===gj}function yj(e,t,n=!0){bj(e)===0?(n?Reflect.ownKeys(e):oj.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function bj(e){let t=e[ij];return t?t.type_:Tj(e)?1:Ej(e)?2:Dj(e)?3:0}var xj=(e,t,n=bj(e))=>n===2?e.has(t):oj[lj].hasOwnProperty.call(e,t),Sj=(e,t,n=bj(e))=>n===2?e.get(t):e[t],Cj=(e,t,n,r=bj(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function wj(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Tj=Array.isArray,Ej=e=>e instanceof Map,Dj=e=>e instanceof Set,Oj=e=>typeof e==`object`,kj=e=>typeof e==`function`,Aj=e=>typeof e==`boolean`;function jj(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Mj=e=>e.copy_||e.base_,Nj=e=>e.modified_?e.copy_:e.base_;function Pj(e,t){if(Ej(e))return new Map(e);if(Dj(e))return new Set(e);if(Tj(e))return Array[lj].slice.call(e);let n=vj(e);if(t===!0||t===`class_only`&&!n){let t=oj.getOwnPropertyDescriptors(e);delete t[ij];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[fj]===!1&&(a[fj]=!0,a[uj]=!0),(a.get||a.set)&&(t[i]={[uj]:!0,[fj]:!0,[dj]:a[dj],[pj]:e[i]})}return oj.create(sj(e),t)}{let t=sj(e);if(t!==null&&n)return{...e};let r=oj.create(t);return oj.assign(r,e)}}function Fj(e,t=!1){return Rj(e)||mj(e)||!hj(e)?e:(bj(e)>1&&oj.defineProperties(e,{set:Lj,add:Lj,clear:Lj,delete:Lj}),oj.freeze(e),t&&yj(e,(e,t)=>{Fj(t,!0)},!1),e)}function Ij(){aj(2)}var Lj={[pj]:Ij};function Rj(e){return e===null||!Oj(e)||oj.isFrozen(e)}var zj=`MapSet`,Bj=`Patches`,Vj=`ArrayMethods`,Hj={};function Uj(e){let t=Hj[e];return t||aj(0,e),t}var Wj=e=>!!Hj[e],Gj,Kj=()=>Gj,qj=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Wj(zj)?Uj(zj):void 0,arrayMethodsPlugin_:Wj(Vj)?Uj(Vj):void 0});function Jj(e,t){t&&(e.patchPlugin_=Uj(Bj),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Yj(e){Xj(e),e.drafts_.forEach(Qj),e.drafts_=null}function Xj(e){e===Gj&&(Gj=e.parent_)}var Zj=e=>Gj=qj(Gj,e);function Qj(e){let t=e[ij];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $j(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[ij].modified_&&(Yj(t),aj(4)),hj(e)&&(e=eM(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ij].base_,e,t)}else e=eM(t,n);return tM(t,e,!0),Yj(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===nj?void 0:e}function eM(e,t){if(Rj(t))return t;let n=t[ij];if(!n)return lM(t,e.handledSet_,e);if(!rM(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);sM(n,e)}return n.copy_}function tM(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Fj(t,n)}function nM(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var rM=(e,t)=>e.scope_===t,iM=[];function aM(e,t,n,r){let i=Mj(e),a=e.type_;if(r!==void 0&&Sj(i,r,a)===t){Cj(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;yj(i,(e,n)=>{if(mj(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??iM;for(let e of o)Cj(i,e,n,a)}function oM(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!rM(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Nj(i);aM(e,i.draft_??i,a,n),sM(i,r)})}function sM(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}nM(e)}}function cM(e,t,n){let{scope_:r}=e;if(mj(n)){let i=n[ij];rM(i,r)&&i.callbacks_.push(function(){vM(e),aM(e,n,Nj(i),t)})}else hj(n)&&e.callbacks_.push(function(){let i=Mj(e);e.type_===3?i.has(n)&&lM(n,r.handledSet_,r):Sj(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&lM(Sj(e.copy_,t,e.type_),r.handledSet_,r)})}function lM(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||mj(e)||t.has(e)||!hj(e)||Rj(e)?e:(t.add(e),yj(e,(r,i)=>{if(mj(i)){let t=i[ij];rM(t,n)&&(Cj(e,r,Nj(t),e.type_),nM(t))}else hj(i)&&lM(i,t,n)}),e)}function uM(e,t){let n=Tj(e),r={type_:+!!n,scope_:t?t.scope_:Kj(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=dM;n&&(i=[r],a=fM);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var dM={get(e,t){if(t===ij)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Mj(e);if(!xj(i,t,e.type_))return hM(e,i,t);let a=i[t];if(e.finalized_||!hj(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&jj(t))return a;if(a===pM(e.base_,t)||mM(e,t,a)){vM(e);let n=e.type_===1?+t:t,r=bM(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Mj(e)},ownKeys(e){return Reflect.ownKeys(Mj(e))},set(e,t,n){let r=gM(Mj(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=pM(Mj(e),t),i=r?.[ij];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(wj(n,r)&&(n!==void 0||xj(e.base_,t,e.type_)))return!0;vM(e),_M(e)}return e.copy_[t]===n&&(n!==void 0||xj(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),cM(e,t,n),!0)},deleteProperty(e,t){return vM(e),pM(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),_M(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Mj(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[fj]:!0,[uj]:e.type_!==1||t!==`length`,[dj]:r[dj],[pj]:n[t]}},defineProperty(){aj(11)},getPrototypeOf(e){return sj(e.base_)},setPrototypeOf(){aj(12)}},fM={};for(let e in dM){let t=dM[e];fM[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}fM.deleteProperty=function(e,t){return fM.set.call(this,e,t,void 0)},fM.set=function(e,t,n){return dM.set.call(this,e[0],t,n,e[0])};function pM(e,t){let n=e[ij];return(n?Mj(n):e)[t]}function mM(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!hj(n)||n[ij]?!1:e.baseRefs_.has(n)}function hM(e,t,n){let r=gM(t,n);return r?pj in r?r[pj]:r.get?.call(e.draft_):void 0}function gM(e,t){if(!(t in e))return;let n=sj(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=sj(n)}}function _M(e){e.modified_||(e.modified_=!0,e.parent_&&_M(e.parent_))}function vM(e){e.copy_||=(e.assigned_=new Map,Pj(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var yM=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(kj(e)&&!kj(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}kj(t)||aj(6),n!==void 0&&!kj(n)&&aj(7);let r;if(hj(e)){let i=Zj(this),a=bM(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Yj(i):Xj(i)}return Jj(i,n),$j(r,i)}if(!e||!Oj(e)){if(r=t(e),r===void 0&&(r=e),r===nj&&(r=void 0),this.autoFreeze_&&Fj(r,!0),n){let t=[],i=[];Uj(Bj).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}aj(1,e)},this.produceWithPatches=(e,t)=>{if(kj(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Aj(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Aj(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Aj(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){hj(e)||aj(8),mj(e)&&(e=xM(e));let t=Zj(this),n=bM(t,e,void 0);return n[ij].isManual_=!0,Xj(t),n}finishDraft(e,t){let n=e&&e[ij];(!n||!n.isManual_)&&aj(9);let{scope_:r}=n;return Jj(r,t),$j(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Uj(Bj).applyPatches_;return mj(e)?r(e,t):this.produce(e,e=>r(e,t))}};function bM(e,t,n,r){let[i,a]=Ej(t)?Uj(zj).proxyMap_(t,n):Dj(t)?Uj(zj).proxySet_(t,n):uM(t,n);return(n?.scope_??Kj()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?oM(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function xM(e){return mj(e)||aj(10,e),SM(e)}function SM(e){if(!hj(e)||Rj(e))return e;let t=e[ij],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Pj(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Pj(e,!0);let i=n;return Dj(n)&&(n=new Set),yj(i,(e,t)=>{Cj(n,e,SM(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var CM=new yM().produce;function wM(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var TM=wM(),EM=wM,DM=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?$A:$A.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function OM(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(LN(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>tj(t)&&t.type===e,n}var kM=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function AM(e){return hj(e)?CM(e,()=>{}):e}function jM(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function MM(e){return typeof e==`boolean`}var NM=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new kM;return t&&(MM(t)?a.push(TM):a.push(EM(t.extraArgument))),a},PM=`RTK_autoBatch`,FM=()=>e=>({payload:e,meta:{[PM]:!0}}),IM=e=>t=>{setTimeout(t,e)},LM=(e,t)=>n=>{let r=!1,i,a,o=()=>{r||(r=!0,cancelAnimationFrame(i),clearTimeout(a),n())};i=e(o),a=setTimeout(o,t)},RM=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?LM(window.requestAnimationFrame,100):IM(10):e.type===`callback`?e.queueNotification:IM(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[PM],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},zM=e=>function(t){let{autoBatch:n=!0}=t??{},r=new kM(e);return n&&r.push(RM(typeof n==`object`?n:void 0)),r};function BM(e){let t=NM(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(YA(n))c=QA(n);else throw Error(LN(1));let l;l=typeof r==`function`?r(t):t();let u=$A;i&&(u=DM({trace:!1,...typeof i==`object`&&i}));let d=zM(ej(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return XA(c,o,p)}function VM(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(LN(28));if(r in t)throw Error(LN(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function HM(e){return typeof e==`function`}function UM(e,t){let[n,r,i]=VM(t),a;if(HM(e))a=()=>AM(e());else{let t=AM(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(mj(e)){let r=n(e,t);return r===void 0?e:r}if(hj(e))return CM(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(LN(9))}return r}}return e},e)}return o.getInitialState=a,o}var WM=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,GM=(e=21)=>{let t=``,n=e;for(;n--;)t+=WM[Math.random()*64|0];return t},KM=Symbol.for(`rtk-slice-createasyncthunk`);function qM(e,t){return`${e}/${t}`}function JM({creators:e}={}){let t=e?.asyncThunk?.[KM];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(LN(11));let i=(typeof e.reducers==`function`?e.reducers(ZM()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(LN(12));if(n in o.sliceCaseReducersByType)throw Error(LN(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:qM(n,r),createNotation:typeof e.reducers==`function`};$M(a)?tN(o,a,s,t):QM(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?VM(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return UM(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=jM(d,r,m)),i}function i(t=l){return jM(jM(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=YM(a,t,()=>jM(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function YM(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var XM=JM();function ZM(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function QM({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!eN(r))throw Error(LN(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?OM(e,o):OM(e))}function $M(e){return e._reducerDefinitionType===`asyncThunk`}function eN(e){return e._reducerDefinitionType===`reducerWithPrepare`}function tN({type:e,reducerName:t},n,r,i){if(!i)throw Error(LN(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||nN,pending:s||nN,rejected:c||nN,settled:l||nN})}function nN(){}var rN=`task`,iN=`listener`,aN=`completed`,oN=`cancelled`,sN=`task-${oN}`,cN=`task-${aN}`,lN=`${iN}-${oN}`,uN=`${iN}-${aN}`,dN=class{code;name=`TaskAbortError`;message;constructor(e){this.code=e,this.message=`${rN} ${oN} (reason: ${e})`}},fN=(e,t)=>{if(typeof e!=`function`)throw TypeError(LN(32))},pN=()=>{},mN=(e,t=pN)=>(e.catch(t),e),hN=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),gN=e=>{if(e.aborted)throw new dN(e.reason)};function _N(e,t){let n=pN;return new Promise((r,i)=>{let a=()=>i(new dN(e.reason));if(e.aborted){a();return}n=hN(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=pN})}var vN=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof dN?`cancelled`:`rejected`,error:e}}finally{t?.()}},yN=e=>t=>mN(_N(e,t).then(t=>(gN(e),t))),bN=e=>{let t=yN(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:xN}=Object,SN={},CN=`listenerMiddleware`,wN=(e,t)=>{let n=t=>hN(e,()=>t.abort(e.reason));return(r,i)=>{fN(r,`taskExecutor`);let a=new AbortController;n(a);let o=vN(async()=>{gN(e),gN(a.signal);let t=await r({pause:yN(a.signal),delay:bN(a.signal),signal:a.signal});return gN(a.signal),t},()=>a.abort(cN));return i?.autoJoin&&t.push(o.catch(pN)),{result:yN(e)(o),cancel(){a.abort(sN)}}}},TN=(e,t)=>{let n=async(n,r)=>{gN(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await _N(t,Promise.race(a));return gN(t),e}finally{i()}};return((e,t)=>mN(n(e,t)))},EN=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=OM(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(LN(21));return fN(a,`options.listener`),{predicate:i,type:t,effect:a}},DN=xN(e=>{let{type:t,predicate:n,effect:r}=EN(e);return{id:GM(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(LN(22))}}},{withTypes:()=>DN}),ON=(e,t)=>{let{type:n,effect:r,predicate:i}=EN(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},kN=e=>{e.pending.forEach(e=>{e.abort(lN)})},AN=(e,t)=>()=>{for(let e of t.keys())kN(e);e.clear()},jN=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},MN=xN(OM(`${CN}/add`),{withTypes:()=>MN}),NN=OM(`${CN}/removeAll`),PN=xN(OM(`${CN}/remove`),{withTypes:()=>PN}),FN=(...e)=>{console.error(`${CN}/error`,...e)},IN=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=FN}=e;fN(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&kN(e)}),c=(e=>{let n=ON(t,e)??DN(e);return s(n)});xN(c,{withTypes:()=>c});let l=e=>{let n=ON(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kN(n)),!!n};xN(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=TN(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,xN({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:bN(u.signal),pause:yN(u.signal),extra:a,signal:u.signal,fork:wN(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(lN),n.delete(e))})},cancel:()=>{u.abort(lN),e.pending.delete(u)},throwIfCancelled:()=>{gN(u.signal)}})))}catch(e){e instanceof dN||jN(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(uN),i(e),e.pending.delete(u)}},d=AN(t,n);return{middleware:e=>n=>r=>{if(!tj(r))return n(r);if(MN.match(r))return c(r.payload);if(NN.match(r)){d();return}if(PN.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===SN)throw Error(LN(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,jN(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=SN}return s},startListening:c,stopListening:l,clearListeners:d}};function LN(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var RN=XM({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:zN,setLayout:BN,setChartSize:VN,setScale:HN}=RN.actions,UN=RN.reducer;function WN(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function GN(e){return Number.isFinite(e)}function KN(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function qN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function JN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?qN(Object(n),!0).forEach(function(t){YN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function YN(e,t,n){return(t=XN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XN(e){var t=ZN(e,`string`);return typeof t==`symbol`?t:t+``}function ZN(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function QN(e,t,n){return TO(e)||TO(t)?n:vO(t)?uO(e,t,n):typeof t==`function`?t(e):n}var $N=(e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&Z(e[a]))return JN(JN({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&Z(e[o]))return JN(JN({},e),{},{[o]:e[o]+(i||0)})}return e},eP=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,tP=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},nP=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?hO(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return GN(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(DO):c&&l?l.map((e,t)=>{var n=o.map(e);return GN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(DO):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return GN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(DO):o.domain().map((e,t)=>{var n=o.map(e);return GN(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(DO)},rP=(e,t)=>{if(!t||t.length!==2||!Z(t[0])||!Z(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!Z(e[0])||e[0]<n)&&(i[0]=n),(!Z(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},iP={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0,o=0;o<t;++o){var s=e[o]?.[r];if(s!=null){var c=s[1],l=s[0],u=gO(c)?l:c;u>=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:ZD,none:KD,silhouette:QD,wiggle:$D,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0;a<t;++a){var o=e[a]?.[r];if(o!=null){var s=gO(o[1])?o[0]:o[1];s>=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},aP=(e,t,n)=>{var r=iP[n]??KD,i=XD().keys(t).value((e,t)=>Number(QN(e,t,0))).order(qD).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=QN(e[i],t[r],0);Array.isArray(a)&&a.length===2&&Z(a[0])&&Z(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function oP(e){return e==null?void 0:String(e)}var sP=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:o}=e;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=QN(a,t.dataKey,t.scale.domain()[o]);if(TO(s))return null;var c=t.scale.map(s);return Z(c)?c-i/2+r:null},cP=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},lP=e=>{var t=e.flat(2).filter(Z);return[Math.min(...t),Math.max(...t)]},uP=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],dP=(e,t,n)=>{if(e!=null)return uP(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=lP(WN(r,t,n));return!GN(i[0])||!GN(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},fP=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,pP=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,mP=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=BA(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var c=i[o],l=i[o-1];a=Math.min((c?.coordinate||0)-(l?.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function hP(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return JN(JN({},t),{},{dataKey:n,payload:r,value:i,name:a})}function gP(e,t){if(e)return String(e);if(typeof t==`string`)return t}var _P=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},vP=(e,t)=>t===`centric`?e.angle:e.radius,yP=e=>e.layout.width,bP=e=>e.layout.height,xP=e=>e.layout.scale,SP=e=>e.layout.margin,CP=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),wP=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),TP=`data-recharts-item-index`;function EP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?EP(Object(n),!0).forEach(function(t){OP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function OP(e,t,n){return(t=kP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kP(e){var t=AP(e,`string`);return typeof t==`symbol`?t:t+``}function AP(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var jP=e=>e.brush.height;function MP(e){return wP(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function NP(e){return wP(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function PP(e){return CP(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function FP(e){return CP(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var IP=$([yP,bP,SP,jP,MP,NP,PP,FP,VA,HA],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=DP(DP({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=$N(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return DP(DP({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),LP=$(IP,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),RP=$(yP,bP,(e,t)=>({x:0,y:0,width:e,height:t})),zP=(0,v.createContext)(null),BP=()=>(0,v.useContext)(zP)!=null,VP=e=>e.brush,HP=$([VP,IP,SP],(e,t,n)=>({height:e.height,x:Z(e.x)?e.x:t.left,y:Z(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:Z(e.width)?e.width:t.width}));function UP(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function WP(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=UP(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function GP(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return WP(e,t,{leading:r,maxWait:t,trailing:i})}var KP=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},qP={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},JP=(e,t,n)=>{var{width:r=qP.width,height:i=qP.height,aspect:a,maxHeight:o}=n,s=_O(r)?e:Number(r),c=_O(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},YP={width:0,height:0,overflow:`visible`},XP={width:0,overflowX:`visible`},ZP={height:0,overflowY:`visible`},QP={},$P=e=>{var{width:t,height:n}=e,r=_O(t),i=_O(n);return r&&i?YP:r?XP:i?ZP:QP};function eF(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=qP.width,a=qP.height):i===void 0?i=r&&r>0?void 0:qP.width:a===void 0&&(a=r&&r>0?void 0:qP.height),{width:i,height:a}}function tF(){return tF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tF.apply(null,arguments)}function nF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?nF(Object(n),!0).forEach(function(t){iF(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function iF(e,t,n){return(t=aF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aF(e){var t=oF(e,`string`);return typeof t==`symbol`?t:t+``}function oF(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var sF=(0,v.createContext)(qP.initialDimension);function cF(e){return KN(e.width)&&KN(e.height)}function lF(e){var{children:t,width:n,height:r}=e,i=(0,v.useMemo)(()=>({width:n,height:r}),[n,r]);return cF(i)?v.createElement(sF.Provider,{value:i},t):null}var uF=()=>(0,v.useContext)(sF),dF=(0,v.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r=qP.initialDimension,width:i,height:a,minWidth:o=qP.minWidth,minHeight:s,maxHeight:c,children:l,debounce:u=qP.debounce,id:d,className:f,onResize:p,style:m={}}=e,h=(0,v.useRef)(null),g=(0,v.useRef)();g.current=p,(0,v.useImperativeHandle)(t,()=>h.current);var[_,y]=(0,v.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,v.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,v.useEffect)(()=>{if(h.current==null||typeof ResizeObserver>`u`)return OO;var e=e=>{var t,n=e[0];if(n!=null){var{width:r,height:i}=n.contentRect;b(r,i),(t=g.current)==null||t.call(g,r,i)}};u>0&&(e=GP(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=h.current.getBoundingClientRect();return b(n,r),t.observe(h.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:x,containerHeight:S}=_;KP(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:C,calculatedHeight:w}=JP(x,S,{width:i,height:a,aspect:n,maxHeight:c});return KP(C!=null&&C>0||w!=null&&w>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
|
131
|
+
`)))return}w.current=!0,D.current.begin(),x(!0);let t=O;g(null);try{let n=await X(`/api/settings/imports`,{method:`POST`,body:JSON.stringify(OS(c,e))});if(!E.current)return;m(n),e&&t===k.current&&g({id:n.id,fingerprint:t}),C(``)}catch(e){E.current&&C(e.message),ee().catch(()=>{})}finally{w.current=!1,E.current&&x(!1)}}async function ce(){if(!w.current){w.current=!0,D.current.begin();try{let e=await X(`/api/settings/imports/current/cancel`,{method:`POST`,body:`{}`});E.current&&m(e.job)}catch(e){E.current&&C(e.message)}finally{w.current=!1}}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4 min-w-0`,"aria-label":n(t?`Sessions`:`Import chat history`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:n(t?`Sessions`:`Import chat history`)}),!t&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Conversations populate project facts. User prompts populate personal preferences, recurring patterns, and workflow steps.`)}),(0,H.jsxs)(`p`,{className:`flex flex-wrap gap-3 text-sm`,children:[(0,H.jsx)(`a`,{className:`underline`,href:J.project,onClick:e=>{e.preventDefault(),_f(J.project)},children:n(`Project memories`)}),(0,H.jsx)(`a`,{className:`underline`,href:J.profile,onClick:e=>{e.preventDefault(),_f(J.profile)},children:n(`User profile`)}),(0,H.jsx)(`a`,{className:`underline`,href:`${J.settings}#settings-section-profiles`,onClick:e=>{e.preventDefault(),_f(`${J.settings}#settings-section-profiles`)},children:n(`Profile identity in Settings`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Hosts keep their existing user identities. All hosts does not merge profiles with different identities.`)}),(0,H.jsx)(dS,{}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:[gS.map(e=>(0,H.jsxs)(`label`,{children:[(0,H.jsx)(`input`,{type:`checkbox`,"aria-label":Yd(e),checked:c.hosts[e].enabled,onChange:t=>te(e,{enabled:t.target.checked})}),` `,Yd(e)]},e)),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,onClick:()=>I({hosts:{pi:{...c.hosts.pi,enabled:!0},opencode:{...c.hosts.opencode,enabled:!0},"claude-code":{...c.hosts[`claude-code`],enabled:!0}}}),children:n(`All hosts`)}),(0,H.jsxs)(`span`,{role:`status`,children:[n(`Selected hosts`),`: `,j.length]})]})]}),(0,H.jsx)(NS,{draft:c,skillRecording:o,advanced:l,onChange:I,onAdvanced:()=>u(e=>!e)}),M.map(e=>(0,H.jsx)(PS,{host:e,draft:c,readiness:d,advanced:l,listing:!!_[e],onChange:t=>te(e,t),onList:(t,n)=>L(e,t,n),onUnresolved:()=>{I({scope:`all-projects`}),u(!0)}},e)),ne&&(0,H.jsx)(`p`,{role:`alert`,children:n(ne)}),!P&&(R||ie)&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:R??ie}),!ae&&!P&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Preview the current selection before starting an import.`)}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(`button`,{type:`button`,className:MS,disabled:oe,onClick:()=>se(!0),children:n(`Preview (dry run)`)}),(0,H.jsx)(`button`,{type:`button`,className:MS,disabled:oe||!ae||!!ie,onClick:()=>se(!1),children:n(`Start import`)}),P&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm disabled:opacity-50`,disabled:p?.state===`cancelling`,onClick:()=>ce(),children:n(`Cancel after current unit`)})]}),S&&(0,H.jsx)(`p`,{role:`alert`,children:QS(S,n)}),(0,H.jsx)(rC,{job:A}),(0,H.jsx)(tC,{job:A,onReload:F}),(0,H.jsx)($S,{job:A})]})}var lC=3e5,uC=null,dC,fC=new Set,pC=new Set;async function mC(e){try{uC=await X(`/api/memory/write-health${e?`?fresh=1`:``}`)}catch{}for(let e of[...fC,...pC])e()}function hC(e){return fC.add(e),fC.size===1&&(mC(!1),dC=setInterval(()=>{document.hidden||mC(!1)},lC)),()=>{fC.delete(e),fC.size===0&&clearInterval(dC)}}function gC(){return{health:(0,v.useSyncExternalStore)(hC,()=>uC,()=>null),recheck:()=>mC(!0)}}function _C(e){return pC.add(e),()=>pC.delete(e)}function vC(){return(0,v.useSyncExternalStore)(_C,()=>uC,()=>null)}function yC(e){let t=(t,...n)=>n.every((n,r)=>e[t+r]===n);return t(0,137,80,78,71,13,10,26,10)?`png`:t(0,255,216,255)?`jpeg`:t(0,71,73,70,56)?`gif`:t(0,82,73,70,70)&&t(8,87,69,66,80)?`webp`:null}async function bC(e){return e.size>20971520?`size`:yC(new Uint8Array(await e.slice(0,16).arrayBuffer()))?null:`type`}function xC(e,t){let n=Math.min(e,t);return{x:Math.floor((e-n)/2),y:Math.floor((t-n)/2),side:n}}async function SC(e){let t=await createImageBitmap(e);try{let{x:e,y:n,side:r}=xC(t.width,t.height),i=document.createElement(`canvas`);i.width=128,i.height=128;let a=i.getContext(`2d`);if(!a)throw Error(`This browser cannot draw the image`);a.imageSmoothingQuality=`high`,a.drawImage(t,e,n,r,r,0,0,128,128);let o=await new Promise(e=>i.toBlob(e,`image/png`));if(!o)throw Error(`This browser cannot save the image`);let s=new Uint8Array(await o.arrayBuffer()),c=``;for(let e of s)c+=String.fromCharCode(e);return btoa(c)}finally{t.close()}}function CC({host:e,onClose:t}){let n=Y(),{looks:r,setIcon:i,setImage:a,reset:o}=qx(),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),h=s===null?r[e]:`reset`in s?{kind:`default`}:s.look,g=Yx.filter(e=>e.includes(l.trim().toLowerCase()));async function _(e){if(!e)return;f(``);let t=await bC(e);if(t){f(n(t===`size`?`The image is larger than 20 MB.`:`Only PNG, JPEG, WebP and GIF images are accepted.`));return}try{let t=await SC(e);c({look:{kind:`image`,image:`data:image/png;base64,${t}`},png:t})}catch{f(n(`This browser could not read the image.`))}}async function y(){if(s===null)return t();m(!0);try{`reset`in s?await o(e):s.look.kind===`icon`?await i(e,s.look.icon):s.png&&await a(e,s.png),t()}catch(e){f(e.message),m(!1)}}return(0,H.jsx)(zl,{open:!0,onOpenChange:e=>!e&&!p&&t(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:`${n(`Change icon`)}: ${Yd(e)}`}),(0,H.jsx)(Gl,{children:n(`Every avatar is shown at the same size. Images are cropped to a square.`)})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(Zx,{host:e,look:h}),(0,H.jsxs)(`label`,{className:`inline-flex`,children:[(0,H.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif`,className:`sr-only peer`,onChange:e=>void _(e.target.files?.[0])}),(0,H.jsxs)(`span`,{className:`inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-[9px] border border-border px-3 text-ui font-medium hover:bg-interactive-hover peer-focus-visible:outline-2 peer-focus-visible:outline-ring`,children:[(0,H.jsx)(Re,{className:`size-4`,"aria-hidden":`true`}),n(`Upload image`)]})]}),(0,H.jsxs)(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>c({reset:!0}),children:[(0,H.jsx)(wt,{"aria-hidden":`true`}),n(`Reset to default`)]})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`PNG, JPEG, WebP or GIF, up to 20 MB.`)}),(0,H.jsx)(ad,{type:`search`,value:l,onChange:e=>u(e.target.value),"aria-label":n(`Search icons`),placeholder:n(`Search icons`)}),(0,H.jsxs)(`div`,{role:`group`,"aria-label":n(`Choose icon`),className:`grid max-h-48 grid-cols-6 gap-1 overflow-y-auto sm:grid-cols-8`,children:[g.map(e=>{let t=Jx[e],n=h.kind===`icon`&&h.icon===e;return(0,H.jsx)(`button`,{type:`button`,title:e,"aria-label":e,"aria-pressed":n,onClick:()=>c({look:{kind:`icon`,icon:e}}),className:V(`grid size-10 place-items-center rounded-[9px] border border-transparent text-muted-foreground hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,n&&`border-primary bg-primary/10 text-primary-label`),children:(0,H.jsx)(t,{className:`size-5`,"aria-hidden":`true`})},e)}),g.length===0&&(0,H.jsx)(`p`,{className:`col-span-full text-sm text-muted-foreground`,children:n(`No icon matches.`)})]}),d&&(0,H.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-label`,children:d}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,onClick:t,disabled:p,children:n(`Cancel`)}),(0,H.jsx)(K,{type:`button`,onClick:()=>void y(),disabled:p||s===null,children:n(`Save`)})]})]})})}function wC({view:e,line:t,warning:n,notSetUp:r,current:i,compact:a}){let o=Y(),{looks:s}=qx(),[c,l]=(0,v.useState)(!1),u=e===`shared`?null:e,d=u?Yd(u):o(`Shared`),f=ud(e),p=u?(0,H.jsx)(Zx,{host:u,look:s[u],className:a?`size-8`:void 0}):(0,H.jsx)(Qx,{className:a?`size-8`:void 0});return(0,H.jsxs)(`div`,{className:`relative h-full min-w-0`,children:[(0,H.jsxs)(`a`,{href:f,"aria-current":i?`page`:void 0,onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||(e.preventDefault(),_f(f))},className:V(`flex h-full min-w-0 flex-col gap-3 rounded-xl border bg-card p-4 text-start transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2`,a&&`flex-row items-center gap-2 p-2 pe-10`,n?`border-[var(--status-warning)]`:`border-border`,i&&`bg-sidebar-accent`,r&&`opacity-70`),children:[p,(0,H.jsxs)(`span`,{className:`min-w-0 space-y-1`,children:[(0,H.jsx)(`span`,{className:`block break-words text-subsection-title font-semibold`,children:d}),(0,H.jsx)(`span`,{className:`block break-words text-xs text-muted-foreground`,children:n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`font-medium text-status-warning`,children:o(`Memories not saved`)}),!a&&(0,H.jsx)(`span`,{className:`block`,children:n})]}):t})]})]}),u&&(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:a?`icon-xs`:`icon-sm`,className:`absolute end-2 top-2`,"aria-label":`${o(`Change icon`)}: ${d}`,title:o(`Change icon`),onClick:()=>l(!0),children:(0,H.jsx)(mt,{"aria-hidden":`true`})}),c&&u&&(0,H.jsx)(CC,{host:u,onClose:()=>l(!1)})]})}function TC({current:e,statuses:t}){let n=Y(),{health:r}=gC(),i=r&&!r.ok?r.reason??``:null;return(0,H.jsx)(`nav`,{"aria-label":n(`Memory views`),children:(0,H.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 lg:grid-cols-4`,children:ld.map(r=>{let a=r===`shared`?null:r,o=a?t.line(a):{text:`Every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(wC,{compact:!0,view:r,current:r===e,line:nS(n,o),warning:a&&t.input(a).setUp?i:null,notSetUp:a?!t.input(a).setUp:!1})},r)})})})}function EC({reason:e,checking:t,onCheck:n}){let r=Y();return(0,H.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-[var(--status-warning)] bg-card p-3 text-sm`,children:[(0,H.jsx)(Bt,{className:`size-4 shrink-0 text-status-warning`,"aria-hidden":`true`}),(0,H.jsxs)(`p`,{className:`min-w-0 flex-1 break-words`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:r(`Memories are not being saved.`)}),` `,e?/[.!?]$/.test(e)?e:`${e}.`:``,` `,r(`Fix the service named here, then press Check again.`)]}),(0,H.jsx)(K,{type:`button`,variant:`outline`,size:`sm`,disabled:t,onClick:n,children:r(`Check again`)})]})}function DC(){let{health:e,recheck:t}=gC(),[n,r]=(0,v.useState)(!1);return!e||e.ok?null:(0,H.jsx)(EC,{reason:e.reason,checking:n,onCheck:()=>{r(!0),t().finally(()=>r(!1))}})}function OC({host:e,statuses:t,profilePreset:n}){let r=Y(),i=!t.input(e).setUp;return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(TC,{current:e,statuses:t}),(0,H.jsx)(DC,{}),(0,H.jsx)(aS,{host:e,statuses:t}),i?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`${Yd(e)}: ${r(`OMMS did not find this host's chat history on this computer. Install the host and use it once, then reload this page.`)}`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(cC,{host:e,profilePreset:n}),(0,H.jsx)(Mx,{hosts:[e],saved:!1,title:`Sessions that need a folder`,anchorId:`host-unresolved`}),(0,H.jsx)(zx,{host:e,backfill:t.backfill})]})]})}var kC=`project architecture, setup, conventions and key decisions`,AC=10,jC={opening:!1,query:kC,subagent:!0,restore:!0,limit:String(AC)};function MC(e){let t=t=>e?.[t]?.globalValue,n=(e,n)=>typeof t(e)==`boolean`?t(e):n,r=t(`compaction.memoryLimit`),i=t(`openingContextQuery`);return{opening:n(`openingContext`,jC.opening),query:typeof i==`string`?i:jC.query,subagent:n(`subagentMemory`,jC.subagent),restore:n(`compaction.enabled`,jC.restore),limit:typeof r==`number`?String(r):jC.limit}}function NC(e){let t=e.trim();if(!/^\d+$/.test(t))return;let n=Number(t);return Number.isSafeInteger(n)&&n>0?n:void 0}function PC(e){return NC(e.limit)===void 0?`limit`:e.query.trim().length>500?`query`:null}function FC(e,t){if(PC(e))return{};let n={};e.opening!==t.opening&&(n.openingContext=e.opening===jC.opening?null:e.opening);let r=e.query.trim();r!==t.query.trim()&&(n.openingContextQuery=r===`project architecture, setup, conventions and key decisions`?null:r),e.subagent!==t.subagent&&(n.subagentMemory=e.subagent===jC.subagent?null:e.subagent),e.restore!==t.restore&&(n[`compaction.enabled`]=e.restore===jC.restore?null:e.restore);let i=NC(e.limit);return i!==NC(t.limit)&&(n[`compaction.memoryLimit`]=i===AC?null:i),n}function IC(e,t){return Object.keys(FC(e,t)).length>0}function LC(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(jC),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(jC),d=(0,v.useRef)(r);d.current=r,(0,v.useEffect)(()=>{let e=!0,t=e=>{let t=MC(e.settings),r=JSON.stringify(d.current)===JSON.stringify(u.current);u.current=t,n(e),r&&i(t)},r=oy();X(`/api/settings`).then(n=>{e&&r.isCurrent()&&t(n)}).catch(()=>{e&&c({kind:`load-failed`})});let a=cy(n=>{e&&t(n)});return()=>{e=!1,a()}},[]);let f=PC(r),p=IC(r,u.current),m=e=>i(t=>({...t,...e}));async function h(){if(!t||!p||l.current)return;l.current=!0,o(!0);let e;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:FC(r,u.current),revision:t.revision})})}catch(t){e=t}let n=await sy()!==null;o(!1),l.current=!1,c(e?{kind:`save-failed`,message:e.message,reloaded:n}:{kind:`saved`,reloaded:n})}function g(t){if(t.kind===`load-failed`)return e(`The memory injection settings could not be loaded. Reload the page to try again.`);if(t.kind===`saved`)return t.reloaded?e(`Saved. The next session uses these options.`):ly(e(`Saved. The next session uses these options.`),e(`Reload the page before saving again.`));let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return ly(e(t.message),n)}let _=`${r.query.length} / 500`;return(0,H.jsxs)(`section`,{id:`memory-injection`,className:`scroll-mt-20 space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory injection`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory injection`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Sets how OMMS adds memories to the context the model sees.`)}),(0,H.jsxs)(lx,{tone:`success`,children:[(0,H.jsx)(`p`,{children:e(`Memories are added at these moments:`)}),(0,H.jsxs)(`ul`,{className:`list-disc space-y-1 ps-5`,children:[(0,H.jsx)(`li`,{children:e(`With every message: the memories that match that message. On by default. chatMessage.enabled in the config file turns it off, and the first-message and subagent options with it.`)}),(0,H.jsx)(`li`,{children:e(`With the first message of a new session: the memories that match the query below. Needs the first switch.`)}),(0,H.jsx)(`li`,{children:e(`For a subagent: the memories that match its task. Claude Code adds them once, when the subagent starts. OpenCode V2 and Pi add them with each prompt the subagent gets. Needs the Subagent memory switch.`)}),(0,H.jsx)(`li`,{children:e(`After a compaction or resume: the memories that session captured. Needs the Restore switch.`)})]}),(0,H.jsx)(`p`,{children:e(`Nothing is added when a new session opens.`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project config can turn the first-message and subagent options off. It can turn restore on or off.`)}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`injection-opening`,role:`switch`,checked:r.opening,disabled:a,"aria-describedby":`injection-opening-help`,onChange:e=>m({opening:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`injection-opening`,children:e(`Inject memories with the first message`)})]}),(0,H.jsx)(`p`,{id:`injection-opening-help`,className:`text-xs text-muted-foreground`,children:e(`Added once, with the first message of a new session. Nothing is added when a new session opens. OMMS searches the query below and adds only matching memories.`)}),(0,H.jsx)(lx,{tone:`info`,children:(0,H.jsx)(`p`,{children:e(`Claude Code can add memories when a session opens. Pi and OpenCode V2 cannot. To keep all three the same, OMMS adds them with the first message on every host.`)})})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`injection-query`,children:e(`First-message search query`)}),(0,H.jsx)(Ip,{id:`injection-query`,maxLength:500,rows:3,disabled:a,value:r.query,"aria-invalid":f===`query`||void 0,"aria-describedby":`injection-query-count`,onChange:e=>m({query:e.target.value})}),(0,H.jsx)(`span`,{id:`injection-query-count`,dir:`ltr`,className:`block text-xs tabular-nums text-muted-foreground`,children:_})]}),(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`injection-subagent`,role:`switch`,checked:r.subagent,disabled:a,"aria-describedby":`injection-subagent-help`,onChange:e=>m({subagent:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`injection-subagent`,children:e(`Subagent memory`)})]}),(0,H.jsx)(`p`,{id:`injection-subagent-help`,className:`text-xs text-muted-foreground`,children:e(`Subagents get memories that match their task. Claude Code adds them once, at start. OpenCode V2 and Pi add them with each subagent prompt. No rows are shown for them.`)}),(0,H.jsx)(lx,{tone:`warning`,children:(0,H.jsx)(`p`,{children:e(`Applies to OpenCode V2, Pi and Claude Code. OpenCode V1 is not covered. On Pi, a subagent gets memory only when its agent maps the OMMS extension in om-pi-subagents. Turn it on in /omps-settings, Agent capabilities, Memory.`)})})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`injection-restore`,role:`switch`,checked:r.restore,disabled:a,onChange:e=>m({restore:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`injection-restore`,children:e(`Restore memories after compaction or resume`)})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Added when a session resumes or compacts. Restores the memories that session captured.`)}),(0,H.jsx)(Fp,{htmlFor:`injection-limit`,children:e(`Most memories to restore`)}),(0,H.jsx)(ad,{type:`number`,id:`injection-limit`,className:`w-36 tabular-nums`,inputMode:`numeric`,step:1,min:1,disabled:a,value:r.limit,"aria-invalid":f===`limit`||void 0,"aria-describedby":`injection-limit-help`,onChange:e=>m({limit:e.target.value})}),(0,H.jsx)(`span`,{id:`injection-limit-help`,className:`block text-xs ${f===`limit`?`text-red-600`:`text-muted-foreground`}`,children:e(`Enter a positive whole number.`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(K,{type:`submit`,disabled:a||!t||!p,children:e(`Save`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a,onClick:()=>i(jC),children:e(`Reset to default`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:g(s)})]})}function RC({statuses:e,profilePreset:t}){let n=Y(),{health:r}=gC(),[i,a]=(0,v.useState)(!1),o=r&&!r.ok?r.reason??``:null;return(0,H.jsxs)(`div`,{className:`space-y-8`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`Choose a host to see its history import, sessions and settings.`)}),(0,H.jsx)(`ul`,{className:`grid grid-cols-2 items-stretch gap-3 lg:grid-cols-4`,children:ld.map(t=>{let r=t===`shared`?null:t,i=r?e.line(r):{text:`Settings for every host`};return(0,H.jsx)(`li`,{className:`min-w-0`,children:(0,H.jsx)(wC,{view:t,line:nS(n,i),warning:r&&e.input(r).setUp?o:null,notSetUp:r?!e.input(r).setUp:!1})},t)})}),(0,H.jsxs)(`section`,{className:`space-y-3`,"aria-label":n(`Import all hosts`),children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsx)(K,{type:`button`,variant:`outline`,"aria-expanded":i,"aria-controls":`memory-import-all`,onClick:()=>a(e=>!e),children:n(`Import all hosts`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`Runs one import for every host you tick. It makes model calls and can cost money.`)})]}),(0,H.jsx)(`div`,{id:`memory-import-all`,hidden:!i,children:i&&(0,H.jsx)(cC,{profilePreset:t})})]}),(0,H.jsx)(LC,{})]})}var zC=[{value:`boost`,label:`Boost (default)`},{value:`rrf`,label:`Rank fusion (experimental)`}];function BC(e){return e===`boost`||e===`rrf`}function VC(e){return BC(e)?e:`boost`}function HC(e){return{keywordMode:e}}function UC(e){let t=t=>{let n=e[t]?.value;return typeof n==`string`&&n.trim().length>0};return e.rerankerEnabled?.value===!0&&t(`rerankerApiUrl`)&&t(`rerankerModel`)}function WC(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(`boost`),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(VC(r.settings.keywordMode?.globalValue)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=cy(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||e===VC(r.settings.keywordMode?.globalValue)?VC(a.settings.keywordMode?.globalValue):e)});return()=>{e=!1,r()}},[]);let d=VC(t?.settings.keywordMode?.globalValue),f=t?.settings.keywordMode?.source===`project`,p=t?UC(t.settings):!1;async function m(){if(!t||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:HC(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await sy()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function h(t){if(t.kind===`load-failed`)return e(`The keyword matching setting could not be loaded. Reload the page to try again.`);let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ly(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use this mode.`):ly(e(`The keyword matching setting could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Keyword matching`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Keyword matching`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search finds memories by meaning and by exact words from your prompt.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`keyword-mode`,children:e(`Word matching mode`)}),(0,H.jsx)(`div`,{className:`w-72 max-w-full`,children:(0,H.jsx)(Dr,{id:`keyword-mode`,className:`w-full`,value:r,disabled:a,onChange:e=>{BC(e.target.value)&&i(e.target.value)},children:zC.map(t=>(0,H.jsx)(`option`,{value:t.value,children:e(t.label)},t.value))})}),(0,H.jsx)(`span`,{id:`keyword-mode-help`,className:`block text-xs text-muted-foreground`,children:`keywordMode`})]}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(r===`rrf`?`Rank fusion merges a list by meaning and a list by words. A memory that contains a word of your prompt can be returned even when its meaning score is below the similarity threshold. Experimental: it has not been shown to find more relevant memories.`:`Boost adds a small score bonus to memories that contain a word of your prompt.`)}),p&&r===`rrf`&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`Rank fusion is not used while the reranker is on. Search uses the boost.`)}),f&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file can override this setting. This page edits the global value.`)}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(K,{type:`submit`,disabled:a||!t||r===d,children:e(`Save`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a||r===d,onClick:()=>i(d),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:h(s)})]})}var GC=`Enter a positive whole number.`,KC=[{key:`maxMemories`,id:`memory-maxMemories`,default:10,unit:`Results`,affects:`Maximum memory search results. Manual searches can request fewer; prompt retrieval uses this ceiling.`,min:1,max:2**53-1,accepted:GC,kind:`integer`},{key:`chatMessage.maxMemories`,id:`memory-chatMessage-maxMemories`,default:3,unit:`Memories`,affects:`Recent memories added at session start in OpenCode V1 and Claude Code. Pi and OpenCode V2 use prompt-based search instead.`,min:1,max:2**53-1,accepted:GC,kind:`integer`},{key:`autoCaptureMaxContextBytes`,id:`memory-autoCaptureMaxContextBytes`,default:131072,unit:`Bytes`,affects:`Conversation input sent to the memory-summary model through the shared capture pipeline. Smaller values can omit conversation text.`,min:16384,max:16777216,accepted:`Enter a whole number from 16,384 to 16,777,216.`,kind:`integer`},{key:`userProfileMaxContextBytes`,id:`memory-userProfileMaxContextBytes`,default:32768,unit:`Bytes`,affects:`OpenCode profile-learning input. Smaller values can omit prompts from that input. This control does not limit the other hosts' profile input.`,min:1024,max:16777216,accepted:`Enter a whole number from 1,024 to 16,777,216.`,kind:`integer`},{key:`retrievalMaxTokens`,id:`memory-retrievalMaxTokens`,default:2e3,unit:`Approximate tokens`,affects:`Automatic memory context, including profile text and formatting, added to agent requests across all hosts. Smaller values can show fewer or shorter memories.`,min:256,max:65536,accepted:`Enter a whole number from 256 to 65,536.`,kind:`integer`},{key:`similarityThreshold`,id:`memory-similarityThreshold`,default:.6,unit:`Similarity score`,affects:`Lowest score a memory needs to be returned by search. Lower values return more memories, including less relevant ones. Higher values can return none. The default depends on the embedder.`,min:0,max:1,accepted:`Enter a number from 0 to 1.`,kind:`decimal`}];[...KC.flatMap(e=>[e.unit,e.affects,e.accepted])];function qC(e,t){let n=typeof t==`string`?t.trim():``;if(!n||!/^-?\d+(\.\d+)?$/.test(n))return;let r=Number(n);if(!(e.kind===`integer`&&!Number.isInteger(r)))return r>=e.min&&r<=e.max?r:void 0}function JC(e){return e.toLocaleString(`en-US`)}function YC(e,t,n){let r=t[e.key];return typeof r==`string`?r:String(n[e.key]??e.default)}function XC(e,t){let n=!1;for(let r of KC){let i=e[r.key];if(typeof i!=`string`)continue;let a=qC(r,i);if(a===void 0)return!1;a!==(t[r.key]??r.default)&&(n=!0)}return n}function ZC(e,t){let n={};if(!XC(e,t))return n;for(let r of KC){let i=e[r.key];if(typeof i!=`string`)continue;let a=qC(r,i);a!==(t[r.key]??r.default)&&(n[r.key]=a)}return n}var QC=`Config changed. Reload settings and save again.`;function $C(e){if(e===`Config changed. Reload settings and save again.`)return{kind:`stale`};let t=KC.map(e=>e.key.replace(/\./g,`\\.`)).join(`|`),n=RegExp(`^Invalid (${t}) setting\\b`).exec(e);return n?{kind:`invalid`,key:n[1]}:{kind:`unknown`}}function ew(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&n(r)}).catch(()=>{e&&c({kind:`load-failed`})});let r=cy(t=>{e&&n(t)});return()=>{e=!1,r()}},[]);let u={},d={};for(let e of KC){let n=t?.settings[e.key];u[e.key]=typeof n?.globalValue==`number`?n.globalValue:void 0,d[e.key]=typeof n?.default==`number`?n.default:e.default}let f=XC(r,u),p=`~/.config/omms/omms.jsonc`,m=e(`Edit ~/.config/omms/omms.jsonc directly to set these limits without the web UI.`).split(p);async function h(){if(!t||!f||l.current)return;let e=ZC(r,u);Object.keys(e).length&&await _(e)}async function g(e){!t||a||l.current||t.settings[e]?.hasGlobal&&await _({[e]:null})}async function _(e){if(!t||l.current)return;l.current=!0,o(!0);let n=!1,r;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:e,revision:t.revision})}),n=!0}catch(e){r=e}let a=await sy()!==null;o(!1),l.current=!1,n?(i(t=>{let n={...t};for(let t of Object.keys(e))delete n[t];return n}),c({kind:`saved`,reloaded:a})):c({kind:`save-failed`,failure:$C(r?.message??``),reloaded:a})}function y(t){if(t.kind===`load-failed`)return e(`The memory settings could not be loaded. Reload the page to try again.`);if(t.kind===`saved`)return t.reloaded?e(`Saved. New memory operations use these limits.`):`${e(`Saved. New memory operations use these limits.`)} ${e(`Reload the page before saving again.`)}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);if(t.failure.kind===`stale`)return ly(e(QC),n);if(t.failure.kind===`invalid`){let r=t.failure,i=KC.find(e=>e.key===r.key);return ly(`${e(`Invalid setting`)} ${i.key}: ${e(i.accepted)}`,n)}return ly(e(`The memory settings could not be saved.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Memory limits`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Memory limits`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Byte limits count UTF-8 bytes.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Approximate tokens are estimated as ceil(UTF-8 bytes / 4). A provider can count more or fewer tokens for the same text.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`These controls do not delete stored data, set a spending limit, limit model replies, or control Graphify output.`)}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[m[0],(0,H.jsx)(`code`,{dir:`ltr`,children:p}),m[1]]}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,H.jsx)(`div`,{className:Wy,children:(0,H.jsxs)(`table`,{className:`w-full min-w-[56rem] text-sm`,children:[(0,H.jsx)(`caption`,{className:`sr-only`,children:e(`Memory limits`)}),(0,H.jsx)(`thead`,{className:Ky,children:(0,H.jsx)(`tr`,{children:[`Setting`,`Value`,`Default`,`Unit`,`Affects`].map(t=>(0,H.jsx)(`th`,{className:qy,children:e(t)},t))})}),(0,H.jsx)(`tbody`,{children:KC.map(n=>{let o=r[n.key],s=YC(n,r,u),c=typeof o==`string`&&qC(n,o)===void 0,l=t?.settings[n.key],f=l?.source===`project`,p=l?.hasGlobal===!0,m=p&&typeof l?.globalValue==`number`&&l.globalValue!==d[n.key];return(0,H.jsxs)(`tr`,{className:Jy,children:[(0,H.jsxs)(`td`,{className:Yy,children:[(0,H.jsx)(`code`,{dir:`ltr`,children:n.key}),f&&(0,H.jsxs)(`div`,{className:`mt-1 space-y-0.5 text-xs text-amber-600`,children:[(0,H.jsxs)(`p`,{children:[e(`Effective value`),`: `,String(l?.value??``),` (`,e(`project`),`)`]}),(0,H.jsx)(`p`,{children:e(`Project override is active. Changes to the global file may not take effect here.`)}),(0,H.jsx)(`p`,{children:e(`The project value stays in force. Saving edits the global file only.`)})]})]}),(0,H.jsxs)(`td`,{className:Yy,children:[(0,H.jsx)(`input`,{type:`number`,id:`${n.id}-input`,className:`w-36 tabular-nums`,inputMode:n.kind===`decimal`?`decimal`:`numeric`,step:n.kind===`decimal`?.01:1,min:n.min,max:n.max,"aria-label":`${n.key} ${e(`Value`)}`,"aria-describedby":`${n.id}-help`,"aria-invalid":c||void 0,disabled:a,value:s,onChange:e=>i(t=>({...t,[n.key]:e.target.value}))}),(0,H.jsx)(`span`,{id:`${n.id}-help`,className:`block text-xs ${c?`text-red-600`:`text-muted-foreground`}`,children:e(n.accepted)}),(0,H.jsx)(`button`,{type:`button`,"data-reset":n.key,className:`mt-1 block text-xs underline`,disabled:a||!p,"aria-label":`${n.key} ${e(`Reset to default`)}`,onClick:()=>void g(n.key),children:e(`Reset to default`)})]}),(0,H.jsxs)(`td`,{className:`${Yy} tabular-nums`,children:[JC(d[n.key]),m&&(0,H.jsx)(`span`,{className:`block text-xs text-amber-600`,children:e(`Differs from default`)})]}),(0,H.jsx)(`td`,{className:Yy,children:e(n.unit)}),(0,H.jsx)(`td`,{className:Yy,children:e(n.affects)})]},n.key)})})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(`button`,{type:`submit`,disabled:a||!t||!f,onClick:()=>void h(),children:e(`Save memory limits`)}),(0,H.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i({}),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:y(s)})]})}var tw=`Enter a whole number from 50 to 100000.`;function nw(e){let t=e.trim();if(!/^\d+$/.test(t))return{ok:!1,message:tw};let n=Number(t);return n<50||n>1e5?{ok:!1,message:tw}:{ok:!0,value:n}}function rw(e,t){let n=nw(t);return n.ok?n.value===e?{kind:`none`}:{kind:`edit`,edits:{userProfileAutoCleanupInterval:n.value}}:{kind:`error`,message:n.message}}function iw(e,t){return e===t?null:{userProfileAutoCleanupEnabled:t}}var aw=500;function ow(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1),d=t?.settings.userProfileAutoCleanupEnabled?.globalValue!==!1,f=Number(t?.settings.userProfileAutoCleanupInterval?.globalValue??aw);(0,v.useEffect)(()=>{let e=!0;X(`/api/settings`).then(t=>{e&&n(t)}).catch(t=>{e&&c(t.message)});let t=cy(t=>{e&&n(t)});return()=>{e=!1,t()}},[]),(0,v.useEffect)(()=>{t&&i(String(f))},[t,f]);async function p(n){if(t){u(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),c(e(`Saved. Changes apply at the next learning pass.`))}catch(e){c(e.message)}await sy(),u(!1)}}function m(){let t=rw(f,r);if(t.kind===`error`){o(e(t.message));return}o(``),t.kind===`edit`&&p(t.edits)}return(0,H.jsxs)(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:e(`Automatic profile cleanup`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`After a learning pass, OMMS merges duplicate profile items and removes vague ones by itself, in the background. Each run makes about one model call for every 100 items and takes several minutes on a large profile. Undo last automatic cleanup on the Profile page puts the changes back.`)}),(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(`input`,{type:`checkbox`,checked:d,disabled:l||!t,onChange:e=>{let t=iw(d,e.target.checked);t&&p(t)}}),e(`Clean up the profile automatically`)]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,H.jsx)(`label`,{htmlFor:`auto-cleanup-interval`,children:e(`Run every this many analysed prompts`)}),(0,H.jsx)(`input`,{id:`auto-cleanup-interval`,className:`w-28 rounded border border-border bg-background px-2 py-1`,inputMode:`numeric`,value:r,disabled:l||!t,"aria-invalid":a?!0:void 0,"aria-describedby":a?`auto-cleanup-interval-error`:void 0,onChange:e=>{i(e.target.value),o(``)}}),(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:l||!t||r.trim()===String(f),onClick:m,children:e(`Save interval`)})]}),a&&(0,H.jsx)(`p`,{id:`auto-cleanup-interval-error`,role:`alert`,className:`text-sm text-destructive`,children:a}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:s})]})}function sw({preview:e,job:t,busy:n,onStart:r,onPause:i}){let a=Y(),o=t.state===`running`;return(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`p`,{children:[a(`Prompts waiting for profile learning`),`: `,e.waiting,` ·`,` `,a(`Estimated profile analysis calls`),`: `,e.calls]}),t.state!==`idle`&&(0,H.jsxs)(`p`,{role:`status`,children:[a(`Batches done`),`: `,t.batchesBuilt,` · `,a(`Prompts waiting`),`: `,t.remaining,t.state===`paused`&&` · ${a(`Paused`)}`,t.state===`done`&&` · ${a(`Finished`)}`]}),t.state===`superseded`&&(0,H.jsx)(`p`,{children:a(`A newer catch-up run took over.`)}),t.state===`failed`&&(0,H.jsxs)(`p`,{className:`text-red-600`,children:[a(`Stopped`),`: `,t.reason??`error`]}),o?(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,onClick:i,children:a(`Pause`)}):(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5`,disabled:n||e.waiting===0,onClick:r,children:a(t.state===`idle`||t.state===`done`?`Analyse waiting prompts`:`Resume`)})]})}function cw({onReanalyse:e}={}){let t=Y(),[n,r]=(0,v.useState)(),[i,a]=(0,v.useState)({state:`idle`,batchesBuilt:0,remaining:0}),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``);async function f(){let e=await X(`/api/settings/profile/catch-up`);r(e.preview),a(e.job)}(0,v.useEffect)(()=>{f().catch(e=>d(e.message)),X(`/api/web/status`).then(e=>s(!!e.isLocal)).catch(()=>{})},[]),(0,v.useEffect)(()=>{if(i.state!==`running`)return;let e=setInterval(()=>void f().catch(()=>{}),2e3);return()=>clearInterval(e)},[i.state]);async function p(){if(!n)return;let e=i.state!==`idle`&&i.state!==`done`;if(window.confirm(`${t(`Start profile learning for the waiting prompts? Model calls`)}: ${n.calls}`)){l(!0);try{a(await X(`/api/settings/profile/catch-up/${e?`resume`:`start`}`,{method:`POST`,body:`{}`})),d(``)}catch(e){d(e.message)}l(!1)}}async function m(){try{a(await X(`/api/settings/profile/catch-up/pause`,{method:`POST`,body:`{}`}))}catch(e){d(e.message)}}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":t(`Profile learning`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:t(`Profile learning`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analyse waiting prompts reads prompts already inside OMMS with the saved external API, 50 eligible prompts per analysis call. Completed history is not re-analysed. Preferences, patterns, and workflows are the outputs.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Analysis calls are an estimate. Matching, deduplication, retries, and newly waiting prompts can add calls.`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Re-analyse chat history opens a forced profile-only import. It preserves your profile and project memories. Preview and confirmation are required. Each profile prompt can be forcibly re-analysed once.`)}),e&&(0,H.jsx)(`button`,{type:`button`,className:`rounded border border-border px-3 py-1.5 text-sm`,onClick:e,children:t(`Re-analyse chat history`)}),n&&(o?(0,H.jsx)(sw,{preview:n,job:i,busy:c,onStart:()=>void p(),onPause:()=>void m()}):(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`Open this page on the computer that runs OMMS to start a catch-up run.`)})),u&&(0,H.jsx)(`p`,{role:`alert`,children:u}),(0,H.jsx)(ow,{})]})}function lw(e){let t=typeof e==`string`?e.trim():``;if(!t||!/^\d+$/.test(t))return;let n=Number(t);return n>=500&&n<=3e4?n:void 0}function uw(e){return/^(env:\/\/[A-Za-z_][A-Za-z0-9_]*|file:\/\/.+)$/.test(e.trim())}function dw(e){try{let t=new URL(e.trim()).hostname.toLowerCase();return!(t===`localhost`||t===`::1`||t===`[::1]`||/^127\.\d+\.\d+\.\d+$/.test(t))}catch{return!1}}function fw(e){if(e.enabled&&(e.url.trim().length===0||e.model.trim().length===0))return{field:`url-model`};if(e.key.trim().length>0&&!uw(e.key))return{field:`key`};if(lw(e.timeout)===void 0)return{field:`timeout`}}function pw(e){return fw(e)===void 0}function mw(e){return{rerankerEnabled:e.enabled,rerankerApiUrl:e.url.trim()||null,rerankerModel:e.model.trim()||null,rerankerApiKey:e.key.trim()||null,rerankerTimeoutMs:lw(e.timeout)??4e3}}function hw(e){let t=e?.settings,n=e?.secrets.rerankerApiKey?.reference;return{enabled:t?.rerankerEnabled?.value===!0,url:typeof t?.rerankerApiUrl?.value==`string`?t.rerankerApiUrl.value:``,model:typeof t?.rerankerModel?.value==`string`?t.rerankerModel.value:``,key:e?.secrets.rerankerApiKey?.set?`${e.secrets.rerankerApiKey.source}://${n??``}`:``,timeout:typeof t?.rerankerTimeoutMs?.value==`number`?String(t.rerankerTimeoutMs.value):`4000`}}function gw(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({enabled:!1,url:``,model:``,key:``,timeout:`4000`}),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(),l=(0,v.useRef)(!1),u=(0,v.useRef)(void 0);(0,v.useEffect)(()=>{let e=!0,t=oy();X(`/api/settings`).then(r=>{e&&t.isCurrent()&&(u.current=r,n(r),i(hw(r)))}).catch(()=>{e&&c({kind:`load-failed`})});let r=cy(t=>{if(!e)return;let r=u.current,a=t;u.current=a,n(a),i(e=>!r||JSON.stringify(e)===JSON.stringify(hw(r))?hw(a):e)});return()=>{e=!1,r()}},[]);let d=fw(r),f=pw(r),p=r.url.trim().length>0&&dw(r.url);function m(e){i(t=>({...t,...e}))}async function h(){if(a||l.current||!f)return;l.current=!0,o(!0);let e=!1,t;try{let n=await X(`/api/settings/reranker/test`,{method:`POST`,body:JSON.stringify({rerankerApiUrl:r.url.trim()||void 0,rerankerModel:r.model.trim()||void 0,rerankerApiKey:r.key.trim()||void 0,rerankerTimeoutMs:lw(r.timeout)??4e3})});e=n.success===!0,t=n.code}catch{t=`reranker_unreachable`}o(!1),l.current=!1,c({kind:`test`,ok:e,code:t})}async function g(){if(!t||!f||l.current)return;l.current=!0,o(!0);let e=!1,n=!1;try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:mw(r),revision:t.revision})}),e=!0}catch(e){n=e?.message?.includes(`Config changed`)===!0}let i=await sy()!==null;o(!1),l.current=!1,c(n?{kind:`save`,ok:e,reloaded:i,stale:n}:{kind:`save`,ok:e,reloaded:i})}function _(t){if(t.kind===`load-failed`)return e(`The reranker settings could not be loaded. Reload the page to try again.`);if(t.kind===`test`)return t.ok?e(`Test passed.`):`${e(`Test failed:`)} ${t.code??`reranker_unreachable`}`;let n=t.reloaded?e(`Current settings were reloaded; check the values and save again.`):e(`The current settings could not be reloaded. Reload the page.`);return t.stale?ly(e(`Config changed. Reload settings and save again.`),n):t.ok?e(`Saved. New searches use these settings.`):ly(e(`The reranker settings could not be saved. Reload the page to try again.`),n)}return(0,H.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-border bg-card p-4`,"aria-label":e(`Reranker`),children:[(0,H.jsx)(`h2`,{className:`text-section-title font-semibold`,children:e(`Reranker`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker reorders the best memory search results with your reranker server and keeps the top results.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The reranker sends the prompt and the text of candidate memories to the server URL. A server on the same machine is recommended.`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`A project file cannot change these settings. The reranker settings are global only.`)}),!r.enabled&&(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`Search is unchanged while the switch is off.`)}),(0,H.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{type:`checkbox`,id:`reranker-enabled`,role:`switch`,checked:r.enabled,disabled:a,"aria-label":e(`Use a reranker`),onChange:e=>m({enabled:e.target.checked})}),(0,H.jsx)(Fp,{htmlFor:`reranker-enabled`,children:e(`Use a reranker`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-url`,children:e(`Server URL`)}),(0,H.jsx)(ad,{type:`url`,id:`reranker-url`,dir:`ltr`,placeholder:`http://127.0.0.1:3008/v1`,disabled:a,value:r.url,"aria-invalid":d?.field===`url-model`||void 0,"aria-describedby":`reranker-url-help`,onChange:e=>m({url:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-url-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`url-model`?e(`Enter the server URL and model before turning the reranker on.`):`rerankerApiUrl`}),p&&(0,H.jsx)(`p`,{className:`text-xs text-amber-600`,children:e(`This URL is not on this machine: memory text leaves this machine.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-model`,children:e(`Model`)}),(0,H.jsx)(ad,{type:`text`,id:`reranker-model`,dir:`ltr`,disabled:a,value:r.model,"aria-invalid":d?.field===`url-model`||void 0,onChange:e=>m({model:e.target.value})}),(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`rerankerModel`})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-key`,children:e(`Key`)}),(0,H.jsx)(ad,{type:`text`,id:`reranker-key`,dir:`ltr`,disabled:a,value:r.key,"aria-invalid":d?.field===`key`||void 0,"aria-describedby":`reranker-key-help`,onChange:e=>m({key:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-key-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`key`?e(`The key must be an env:// or file:// reference, or left empty.`):e(`Optional env:// or file:// key reference.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(Fp,{htmlFor:`reranker-timeout`,children:e(`Timeout`)}),(0,H.jsx)(ad,{type:`number`,id:`reranker-timeout`,className:`tabular-nums`,inputMode:`numeric`,step:1,min:500,max:3e4,disabled:a,value:r.timeout,"aria-invalid":d?.field===`timeout`||void 0,"aria-describedby":`reranker-timeout-help`,onChange:e=>m({timeout:e.target.value})}),(0,H.jsx)(`span`,{id:`reranker-timeout-help`,className:`block text-xs text-muted-foreground`,children:d?.field===`timeout`?e(`Enter a whole number from 500 to 30,000.`):e(`milliseconds`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`The default of 4000 keeps the search inside OpenCode V2's 5-second wait. A value over 5000 can make OpenCode V2 send the request with no memory.`)})]})]}),(0,H.jsxs)(`div`,{className:`flex gap-2`,children:[(0,H.jsx)(K,{type:`submit`,disabled:a||!t||!f,onClick:()=>void g(),children:e(`Save`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a||!f,onClick:()=>void h(),children:e(`Test`)}),(0,H.jsx)(K,{type:`button`,variant:`outline`,disabled:a,onClick:()=>i(hw(t)),children:e(`Cancel`)})]})]}),s&&(0,H.jsx)(`p`,{role:`status`,className:`text-sm`,children:_(s)})]})}var _w=e=>{let t=e?.value??e?.globalValue;return t==null||t===``?null:String(t)};function vw(e,t){let n=_w(e?.maxMemories),r=_w(e?.similarityThreshold),i=_w(e?.keywordMode),a=_w(e?.rerankerModel);return{profile:{text:`Prompts waiting for profile learning, and re-analysis of old chats`},limits:n&&r?{text:`Results {results} · Similarity {similarity}`,params:{results:n,similarity:r}}:{text:`How many memories a search returns`},keywords:i?{text:`Mode: {mode}`,params:{mode:i}}:{text:`Keyword matching`},reranker:_w(e?.rerankerApiUrl)?a?{text:`On · {model}`,params:{model:a}}:{text:`On`}:{text:`Off`},maps:t?{text:`{saved} saved · {ignored} ignored`,params:t}:{text:`Saved maps and ignored directories`}}}function yw({id:e,title:t,summary:n,children:r}){return(0,H.jsxs)(`details`,{id:e,"data-shared-row":!0,className:`scroll-mt-20 rounded-xl border border-border bg-card`,children:[(0,H.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer flex-wrap items-baseline gap-x-3 gap-y-1 rounded-xl p-4 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h2`,{className:`text-subsection-title font-semibold`,children:t}),(0,H.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:n})]}),(0,H.jsx)(`div`,{className:`border-t border-border p-4`,children:r})]})}function bw({title:e,summary:t}){let n=`/memory#memory-injection`;return(0,H.jsxs)(`a`,{id:`shared-memory-injection`,href:n,onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||(e.preventDefault(),_f(n))},className:`flex min-h-11 flex-wrap items-baseline gap-x-3 gap-y-1 rounded-xl border border-border bg-card p-4 transition-colors duration-150 hover:bg-interactive-hover focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(`h2`,{className:`text-subsection-title font-semibold`,children:e}),(0,H.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:t})]})}function xw({statuses:e,onReanalyse:t}){let n=Y(),[r,i]=(0,v.useState)(),[a,o]=(0,v.useState)();(0,v.useEffect)(()=>{let e=!0,t=()=>{X(`/api/settings`).then(t=>e&&i(t.settings)).catch(()=>{}),X(`/api/settings/import-maps`).then(t=>e&&o({saved:t.saved.length,ignored:t.ignored?.length??0})).catch(()=>{})};t();let n=cy(t);return()=>{e=!1,n()}},[]);let s=vw(r,a),c=e=>nS(n,s[e]),l=MC(r),u=e=>n(e?`On`:`Off`),d=nS(n,{text:`First message {opening} · Subagents {subagent} · Restore {restore}`,params:{opening:u(l.opening),subagent:u(l.subagent),restore:u(l.restore)}});return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(TC,{current:`shared`,statuses:e}),(0,H.jsxs)(`header`,{className:`space-y-1`,children:[(0,H.jsx)(`h2`,{className:`text-page-title font-semibold`,children:n(`Shared`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`These settings apply to every host. Open a row to change it.`)})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(yw,{id:`shared-profile`,title:n(`Profile learning`),summary:c(`profile`),children:(0,H.jsx)(cw,{onReanalyse:t})}),(0,H.jsx)(yw,{id:`shared-limits`,title:n(`Memory limits`),summary:c(`limits`),children:(0,H.jsx)(ew,{})}),(0,H.jsx)(bw,{title:n(`Memory injection`),summary:d}),(0,H.jsx)(yw,{id:`shared-keywords`,title:n(`Keyword matching`),summary:c(`keywords`),children:(0,H.jsx)(WC,{})}),(0,H.jsx)(yw,{id:`shared-reranker`,title:n(`Reranker`),summary:c(`reranker`),children:(0,H.jsx)(gw,{})}),(0,H.jsx)(yw,{id:`shared-directory-maps`,title:n(`Directory maps`),summary:c(`maps`),children:(0,H.jsx)(Mx,{hosts:[]})})]})]})}var Sw=3e3;function Cw(){let e=Y(),[t,n]=(0,v.useState)(),[r,i]=(0,v.useState)({pi:null,opencode:null,"claude-code":null}),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)({}),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(sS(i,e=>u(e.message))),m=(0,v.useRef)(sS(o,e=>u(e.message))),h=()=>p.current(X(`/api/settings/backfill`)),g=()=>m.current(X(`/api/settings/backfill/runs`));(0,v.useEffect)(()=>{let e=!0;X(`/api/settings`).then(t=>e&&n(t)).catch(t=>e&&u(t.message)),h(),g();for(let t of[`pi`,`opencode`])X(`/api/settings/models?host=${t}`).then(n=>e&&c(e=>({...e,[t]:n}))).catch(()=>e&&c(e=>({...e,[t]:{available:!1}})));let t=cy(t=>{e&&(n(t),h())}),r=setInterval(()=>{e&&(h(),g())},Sw);return()=>{e=!1,clearInterval(r),t()}},[]);async function _(n){if(t){f(!0);try{await X(`/api/settings`,{method:`PATCH`,body:JSON.stringify({edits:n,revision:t.revision})}),u(e(`Saved. Changes apply at the next run.`))}catch(e){u(e.message)}await sy(),f(!1)}}async function y(t,n){f(!0);let r=a?.[t]?.run?.state===`running`;try{await X(`/api/settings/backfill/${t}/${n}`,{method:`POST`,body:`{}`}),u(e(n===`pause`?r?`Pausing after the current exchange.`:`Paused. No import starts until you resume.`:`Backfill started.`))}catch(e){u(e.message)}await Promise.all([g(),h()]),f(!1)}function b(t,n){try{_(Fx(t,n.trim()))}catch(t){u(e(t.message))}}return{snapshot:t,rows:r,runs:a,lists:s,message:l,busy:d,save:_,control:y,saveModel:b,setMessage:u}}var ww=6e4;function Tw(){let e=Cw(),[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(null),a=Y();(0,v.useEffect)(()=>{let e=!0,t=()=>void X(`/api/settings/imports/readiness`).then(t=>e&&n(t)).catch(()=>e&&n(null));t();let r=cy(t);return()=>{e=!1,r()}},[]),(0,v.useEffect)(()=>{let e=!0,t=()=>void X(`/api/settings/last-saved`).then(t=>e&&i(t.hosts)).catch(()=>void 0);t();let n=cy(t),r=setInterval(t,ww);return()=>{e=!1,n(),clearInterval(r)}},[]);let o=e=>{let t=Mi(new Date(e),new Date),n=tm(e);return t===`earlier`?`${em(e)} ${n}`:a(t===`today`?`today {time}`:`yesterday {time}`).replaceAll(`{time}`,n)},s=n=>({host:n,run:e.runs?.[n]?.run??null,pending:e.rows[n]?.counts.pending??0,cutoff:e.rows[n]?.cutoff??null,runNowUnavailable:e.runs?.[n]?.runNowUnavailable??null,setUp:t?.defaultSourceFound?.[n]!==!1,formatDate:em,lastSaved:r?.[n]??null,formatSaved:o});return{backfill:e,readiness:t,input:s,status:e=>eS(s(e)),line:e=>tS(s(e))}}function Ew(){let e=fd(yf().split(`#`)[0]),t=Tw(),[n,r]=(0,v.useState)(0);(0,v.useEffect)(()=>{cf(window.location.hash)},[e]);function i(){r(e=>e+1),_f(J.memory)}return(0,H.jsxs)(`div`,{className:`settings-view`,children:[e===null&&(0,H.jsx)(RC,{statuses:t,profilePreset:n}),e===`shared`&&(0,H.jsx)(xw,{statuses:t,onReanalyse:i}),e!==null&&e!==`shared`&&(0,H.jsx)(OC,{host:e,statuses:t,profilePreset:n})]})}var Dw=`/api/chat`,Ow={"Content-Type":`application/json`},kw=15e4,Aw=(e,t,n,r)=>oi(`${Dw}${e}`,{method:t,headers:Ow,body:n===void 0?void 0:JSON.stringify(n),timeout:r}),jw={status:()=>oi(`${Dw}/status`),list:()=>oi(`${Dw}/conversations`),get:e=>oi(`${Dw}/conversations/${encodeURIComponent(e)}`),create:(e,t)=>Aw(`/conversations`,`POST`,{folderId:e,scopeTag:t}),rename:(e,t)=>Aw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{title:t}),move:(e,t)=>Aw(`/conversations/${encodeURIComponent(e)}`,`PATCH`,{folderId:t}),remove:e=>Aw(`/conversations/${encodeURIComponent(e)}`,`DELETE`),removeMany:e=>Aw(`/conversations/bulk-delete`,`POST`,{ids:e}),ask:(e,t,n,r=!1)=>Aw(`/conversations/${encodeURIComponent(e)}/messages`,`POST`,{question:t,scopeTag:n,retry:r},kw),createFolder:e=>Aw(`/folders`,`POST`,{name:e}),renameFolder:(e,t)=>Aw(`/folders/${encodeURIComponent(e)}`,`PATCH`,{name:t}),removeFolder:e=>Aw(`/folders/${encodeURIComponent(e)}`,`DELETE`)},Mw={conversations:[],folders:[],readOnly:!1};function Nw(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(Mw),[i,a]=(0,v.useState)([]),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),m=(0,v.useCallback)(async()=>{let e=await jw.list();e.success&&e.data&&r(e.data)},[]);(0,v.useEffect)(()=>{jw.status().then(e=>e.success&&e.data&&t(e.data)),oi(`/api/tags`).then(e=>e.success&&e.data&&a(e.data.project)),m()},[m]);let h=(0,v.useCallback)(e=>e===null||i.some(t=>t.tag===e),[i]),g=(0,v.useCallback)(async e=>{let t=await jw.get(e);if(!t.success||!t.data)return void U.error(t.error??``);s(e),l(t.data);let n=t.data.conversation.scopeTag;d(h(n)?n:void 0)},[h]),_=(0,v.useCallback)(async(e=null)=>{let t=await jw.create(e,null);if(!t.success||!t.data)return void U.error(t.error??``);await m(),s(t.data.id),l({conversation:t.data,messages:[]}),d(null)},[m]),y=(0,v.useCallback)(async(e,t=!1)=>{if(u===void 0)return;let n=o;if(!n){let e=await jw.create(null,u);if(!e.success||!e.data)return void U.error(e.error??``);n=e.data.id,s(n),l({conversation:e.data,messages:[]})}p(e);let r=await jw.ask(n,e,u,t);if(p(null),!r.success||!r.data)return void U.error(r.error??``);await g(n),await m()},[o,u,g,m]),b=(0,v.useCallback)(e=>{let t=c?.messages??[],n=t[t.findIndex(t=>t.id===e.id)-1];n?.role===`user`&&y(n.content,!0)},[c,y]),x=(0,v.useCallback)(async e=>{o&&e.includes(o)&&(s(null),l(null),d(null)),await m()},[o,m]),S=(0,v.useCallback)(async e=>{let t=e.length===1?await jw.remove(e[0]):await jw.removeMany(e);if(!t.success)return void U.error(t.error??``);await x(e)},[x]),C=(0,v.useCallback)(async e=>{let t=n.conversations.filter(t=>t.folderId===e).map(e=>e.id),r=await jw.removeFolder(e);if(!r.success)return void U.error(r.error??``);await x(t)},[n,x]),w=(0,v.useCallback)(async e=>{let t=await e();return t.success?(await m(),o&&await g(o),null):t.code===`conflict`?`conflict`:t.error??`error`},[m,o,g]);return{status:e,list:n,projects:i,activeId:o,detail:c,scope:u,setScope:d,pending:f,scopeMissing:!!c&&u===void 0,open:g,newChat:_,ask:y,retry:b,deleteChats:S,deleteFolder:C,change:w}}function Pw(e,t){return e||t?[`S`,`P`,`K`]:[`S`,`P`]}function Fw(e,t,n){return e?e.kind===`memory`?t.has(e.id):e.kind===`skill`&&n.has(e.id):!1}function Iw(e,t,n){return e.modified&&e.lastAppliedAt!==null?t(`chat-skill-modified-yes`,{date:n(e.lastAppliedAt)}):t(`chat-skill-modified-no`)}var Lw=e=>`chat-skill-kind-${e}`;function Rw(e,t){let n=[[t(`chat-search-phrases`),e.queries],[t(`chat-search-tags`),e.tags],[t(`chat-search-categories`),e.profileCategories]];return e.skills&&n.push([t(`chat-search-skills`),e.skills]),e.skillIntent&&n.push([t(`chat-search-skill-intent`),[t(`chat-intent-${e.skillIntent}`)]]),n}function zw(e){return e.startsWith(`P`)?`border-blue-600/40 bg-blue-500/10 text-blue-700 hover:bg-blue-500/20 dark:text-blue-400`:e.startsWith(`K`)?`border-violet-600/40 bg-violet-500/10 text-violet-700 hover:bg-violet-500/20 dark:text-violet-400`:`border-primary/30 bg-primary/10 text-primary-label hover:bg-primary/20`}function Bw({label:e,deleted:t,onOpen:n}){let{t:r}=G();return(0,H.jsx)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-label":r(`chat-cite-label`,{label:e}),onClick:n,className:V(`mx-0.5 inline-flex h-5 cursor-pointer items-center rounded-md border px-1.5 align-baseline text-[11px] font-medium tabular-nums transition-colors duration-200 ease-in focus-visible:outline-2 focus-visible:outline-ring`,zw(e),t&&`line-through opacity-70`),children:e})}var Vw={S:`chat-legend-memory`,P:`chat-legend-profile`,K:`chat-legend-skill`};function Hw({label:e,text:t}){return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:V(`inline-flex h-5 items-center rounded-md border px-1.5 text-[11px] font-medium`,zw(e)),children:e}),(0,H.jsx)(`span`,{dir:`auto`,children:t})]})}function Uw({letters:e}){let{t}=G();return(0,H.jsx)(`p`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:e.map(e=>(0,H.jsx)(Hw,{label:e,text:t(Vw[e])},e))})}var Ww=`__all__`,Gw=`__choose__`;function Kw({projects:e,scope:t,scopeMissing:n,disabled:r,onScope:i,onAsk:a}){let{t:o}=G(),[s,c]=(0,v.useState)(``),l=r||t===void 0;function u(e){e?.preventDefault(),!(l||!s.trim())&&(a(s.trim()),c(``))}function d(e){e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),u())}return(0,H.jsxs)(`form`,{onSubmit:u,className:`grid gap-2 rounded-2xl border border-border bg-card p-2.5 shadow-sm`,children:[(0,H.jsx)(Ip,{value:s,disabled:r,rows:2,maxLength:4e3,placeholder:o(`chat-input-placeholder`),"aria-label":o(`chat-input-placeholder`),className:`min-h-14 resize-none bg-transparent`,onChange:e=>c(e.target.value),onKeyDown:d}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`shrink-0`,children:o(`chat-scope-label`)}),(0,H.jsxs)(Dr,{className:`h-8 min-w-0 max-w-64 flex-1 text-xs`,"aria-label":o(`chat-scope-label`),disabled:r,value:t===void 0?Gw:t??Ww,onChange:e=>{let t=e.target.value;t!==Gw&&i(t===Ww?null:t)},children:[t===void 0?(0,H.jsx)(`option`,{value:Gw,children:o(`chat-scope-missing`)}):null,(0,H.jsx)(`option`,{value:Ww,children:o(`chat-scope-all`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.tag,children:e.projectName||e.displayName||e.tag},e.tag))]})]}),(0,H.jsxs)(K,{type:`submit`,size:`sm`,disabled:l||!s.trim(),"aria-label":o(`chat-send`),children:[(0,H.jsx)(ee,{}),o(`chat-send`)]})]}),n?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o(`chat-scope-choose`)}):null]})}function qw({status:e}){let{t}=G();return(0,H.jsxs)(`div`,{role:`alert`,className:`grid gap-2 rounded-xl border border-border bg-card p-4`,children:[(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,H.jsx)(Bt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t(`chat-setup-title`)]}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`chat-setup-body`,{names:e.missing.join(`, `)})}),(0,H.jsxs)(`a`,{href:`/settings#settings-section-external-api`,className:`inline-flex w-fit items-center gap-1.5 text-sm text-primary-label underline-offset-4 hover:underline`,children:[(0,H.jsx)(Ot,{className:`size-3.5`,"aria-hidden":`true`}),t(`chat-setup-link`)]})]})}var Jw=`__none__`;function Yw({folders:e,folderId:t,onMove:n}){let{t:r}=G();return(0,H.jsxs)(Dr,{className:`h-8 w-full text-xs`,"aria-label":r(`chat-move`),value:t??Jw,onChange:e=>n(e.target.value===Jw?null:e.target.value),children:[(0,H.jsx)(`option`,{value:Jw,children:r(`chat-no-folder`)}),e.map(e=>(0,H.jsx)(`option`,{value:e.id,children:e.name},e.id))]})}function Xw(e){let{t}=G(),{conversation:n,active:r,selectMode:i}=e,a=n.title||t(`chat-new`);return i?(0,H.jsx)(`li`,{children:(0,H.jsxs)(`label`,{className:`flex min-h-11 md:min-h-9 cursor-pointer items-center gap-2 rounded-lg px-2 text-sm hover:bg-interactive-hover`,children:[(0,H.jsx)(Qo,{checked:e.selected,onCheckedChange:e.onToggleSelect,"aria-label":t(`chat-select-chat`,{title:a})}),(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate`,title:a,children:a})]})}):(0,H.jsxs)(`li`,{children:[(0,H.jsxs)(`div`,{className:V(`group flex items-center gap-1 rounded-lg`,r?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-interactive-hover`),children:[(0,H.jsx)(`button`,{type:`button`,className:`min-h-11 md:min-h-9 min-w-0 flex-1 cursor-pointer overflow-hidden rounded-lg px-2 text-start text-sm focus-visible:outline-2 focus-visible:outline-ring`,"aria-current":r?`true`:void 0,title:a,onClick:e.onOpen,children:(0,H.jsx)(`span`,{dir:`auto`,className:`block truncate`,children:a})}),e.readOnly?null:(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`me-1 shrink-0 text-muted-foreground`,"aria-label":t(`chat-chat-actions`),"aria-expanded":e.actionsOpen,onClick:e.onToggleActions,children:(0,H.jsx)(xe,{})})]}),e.actionsOpen?(0,H.jsxs)(`div`,{className:`ms-2 mt-1 mb-2 grid gap-1.5 rounded-lg border border-border bg-card p-2`,children:[(0,H.jsx)(Yw,{folders:e.folders,folderId:n.folderId,onMove:e.onMove}),(0,H.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`xs`,onClick:e.onRename,children:[(0,H.jsx)(mt,{}),t(`chat-rename`)]}),(0,H.jsxs)(K,{type:`button`,variant:`destructive`,size:`xs`,onClick:e.onDelete,children:[(0,H.jsx)(Rt,{}),t(`chat-delete`)]})]})]}):null]})}function Zw({name:e,count:t,actions:n,onSelectAll:r,children:i}){let{t:a}=G(),[o,s]=(0,v.useState)(!0),c=o?Oe:Ae;return(0,H.jsxs)(`section`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex min-h-11 md:min-h-8 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-lg px-1.5 text-xs font-medium text-muted-foreground transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,"aria-expanded":o,onClick:()=>s(!o),children:[(0,H.jsx)(ce,{className:V(`size-3.5 shrink-0 transition-transform rtl:-scale-x-100`,o&&`rotate-90`),"aria-hidden":`true`}),(0,H.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate uppercase tracking-wide`,children:e}),(0,H.jsx)(`span`,{className:`tabular-nums`,"aria-label":a(t===1?`chat-folder-count-one`:`chat-folder-count`,{count:t}),children:t})]}),r&&t>0?(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`xs`,onClick:r,children:a(`chat-select-all-folder`)}):null,n&&!r?(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center`,role:`group`,"aria-label":a(`chat-folder-actions`),children:[(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-new`),title:a(`chat-new`),onClick:n.onNewChat,children:(0,H.jsx)(vt,{})}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-rename`),title:a(`chat-rename`),onClick:n.onRename,children:(0,H.jsx)(mt,{})}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":a(`chat-delete`),title:a(`chat-delete`),onClick:n.onDelete,children:(0,H.jsx)(Rt,{})})]}):null]}),o?(0,H.jsx)(`ul`,{className:`grid grid-cols-[minmax(0,1fr)] gap-0.5 ps-3`,children:i}):null]})}function Qw(e){let{t}=G(),{chat:n,selectMode:r,selected:i}=e,[a,o]=(0,v.useState)(null),{conversations:s,folders:c,readOnly:l}=n.list,u=s.filter(e=>!e.folderId),d=e=>e===`conflict`?t(`chat-folder-exists`):e,f=t=>{let n=new Set(i);n.has(t)?n.delete(t):n.add(t),e.onSelected(n)},p=t=>e.onSelected(new Set([...i,...t])),m=r=>e.onName({title:t(`chat-chat-rename-title`),label:t(`chat-chat-title`),initial:r.title,submitLabel:t(`chat-save`),submit:e=>n.change(()=>jw.rename(r.id,e))}),h=t=>t.map(t=>(0,H.jsx)(Xw,{conversation:t,folders:c,active:t.id===n.activeId,selectMode:r,selected:i.has(t.id),actionsOpen:a===t.id,readOnly:l,onOpen:()=>{n.open(t.id),e.onOpened?.()},onToggleSelect:()=>f(t.id),onToggleActions:()=>o(a===t.id?null:t.id),onRename:()=>m(t),onMove:e=>void n.change(()=>jw.move(t.id,e)),onDelete:()=>e.onDelete({kind:`chats`,ids:[t.id]})},t.id));return(0,H.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:t(`chat-selected-count`,{count:i.size})}),(0,H.jsxs)(K,{type:`button`,variant:`destructive`,size:`xs`,disabled:i.size===0,onClick:()=>e.onDelete({kind:`chats`,ids:[...i]}),children:[(0,H.jsx)(Rt,{}),t(`chat-delete-selected`)]}),(0,H.jsx)(K,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>e.onSelectMode(!1),children:t(`chat-select-done`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(K,{type:`button`,size:`xs`,disabled:l,onClick:()=>void n.newChat(),children:[(0,H.jsx)(vt,{}),t(`chat-new`)]}),(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`xs`,disabled:l,onClick:()=>e.onName({title:t(`chat-folder-create-title`),label:t(`chat-folder-name`),initial:``,submitLabel:t(`chat-create`),submit:async e=>d(await n.change(()=>jw.createFolder(e)))}),children:[(0,H.jsx)(ke,{}),t(`chat-new-folder`)]}),(0,H.jsxs)(K,{type:`button`,variant:`ghost`,size:`xs`,disabled:l||s.length===0,onClick:()=>e.onSelectMode(!0),children:[(0,H.jsx)(jt,{}),t(`chat-select`)]})]})}),s.length===0&&c.length===0?(0,H.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:t(`chat-empty-list`)}):null,c.map(i=>{let a=s.filter(e=>e.folderId===i.id);return(0,H.jsx)(Zw,{name:i.name,count:a.length,onSelectAll:r?()=>p(a.map(e=>e.id)):void 0,actions:l?void 0:{onNewChat:()=>void n.newChat(i.id),onRename:()=>e.onName({title:t(`chat-folder-rename-title`),label:t(`chat-folder-name`),initial:i.name,submitLabel:t(`chat-save`),submit:async e=>d(await n.change(()=>jw.renameFolder(i.id,e)))}),onDelete:()=>e.onDelete({kind:`folder`,id:i.id,name:i.name,count:a.length})},children:h(a)},i.id)}),u.length>0?(0,H.jsx)(Zw,{name:t(`chat-no-folder`),count:u.length,onSelectAll:r?()=>p(u.map(e=>e.id)):void 0,children:h(u)}):null]})}function $w({request:e,onConfirm:t,onCancel:n}){let{t:r}=G(),[i,a]=(0,v.useState)(!1);return(0,H.jsx)(zl,{open:e!==null,onOpenChange:e=>!e&&!i&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-md`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:e?.kind===`folder`?r(`chat-delete-folder-title`):r(`chat-delete-chats-title`)}),(0,H.jsx)(Gl,{children:e?eT(e,r):null})]}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`secondary`,onClick:n,disabled:i,children:r(`chat-cancel`)}),(0,H.jsx)(K,{type:`button`,variant:`destructive`,disabled:i,onClick:async()=>{e&&(a(!0),await t(e),a(!1))},children:r(`chat-delete-confirm`)})]})]})})}function eT(e,t){if(e.kind===`folder`)return t(e.count===1?`chat-delete-folder-body-one`:`chat-delete-folder-body`,{name:e.name,count:e.count});let n=e.ids.length;return t(n===1?`chat-delete-chats-body-one`:`chat-delete-chats-body`,{count:n})}function tT({request:e,onClose:t}){let{t:n}=G(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1);(0,v.useEffect)(()=>{i(e?.initial??``),o(null)},[e]);async function l(n){if(n.preventDefault(),!e||!r.trim())return;c(!0);let i=await e.submit(r.trim());c(!1),i?o(i):t()}return(0,H.jsx)(zl,{open:e!==null,onOpenChange:e=>!e&&t(),children:(0,H.jsx)(q,{className:`sm:max-w-sm`,children:(0,H.jsxs)(`form`,{onSubmit:l,className:`grid gap-4`,children:[(0,H.jsx)(Hl,{children:(0,H.jsx)(Wl,{children:e?.title})}),(0,H.jsxs)(`div`,{className:`grid gap-2`,children:[(0,H.jsx)(Fp,{htmlFor:`chat-name-input`,children:e?.label}),(0,H.jsx)(ad,{id:`chat-name-input`,value:r,maxLength:80,autoFocus:!0,"aria-invalid":a?!0:void 0,onChange:e=>i(e.target.value)}),a?(0,H.jsx)(`p`,{className:`text-xs text-destructive-label`,children:a}):null]}),(0,H.jsxs)(Ul,{children:[(0,H.jsx)(K,{type:`button`,variant:`secondary`,onClick:t,children:n(`chat-cancel`)}),(0,H.jsx)(K,{type:`submit`,disabled:s||!r.trim(),children:e?.submitLabel})]})]})})})}var nT=/\[([SPK]\d+)\]/g,rT=/<(?:[^>"']|"[^"]*"|'[^']*')*>/g,iT=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,aT=new Set([`a`,`code`,`pre`,`button`]);function oT(e,t,n,r){let i=new Set(t),a=(e,t)=>{if(!i.has(t))return e;let a=[`cite-chip`];t.startsWith(`P`)&&a.push(`cite-profile`),t.startsWith(`K`)&&a.push(`cite-skill`),n(t)&&a.push(`cite-deleted`);let o=r(t).replace(/["&<>]/g,e=>`&#${e.charCodeAt(0)};`);return`<button type="button" class="${a.join(` `)}" data-cite="${t}" aria-haspopup="dialog" aria-label="${o}">${t}</button>`},o=``,s=0,c=0,l=(t,n)=>{let r=e.slice(t,n);o+=c>0?r:r.replace(nT,a)};for(let t of e.matchAll(rT)){l(s,t.index),o+=t[0],s=t.index+t[0].length;let e=iT.exec(t[0]);!e||!aT.has(e[2].toLowerCase())||(e[1]?c=Math.max(0,c-1):c+=1)}return l(s,e.length),o}var sT=/\[([SPK]\d+)\]/g;function cT(e,t){let n=new Set(t),r=[],i=``,a=0;for(let t of e.matchAll(sT)){let o=t[1];n.has(o)&&(i+=e.slice(a,t.index),i&&r.push({kind:`text`,text:i}),i=``,r.push({kind:`cite`,label:o}),a=t.index+t[0].length)}return i+=e.slice(a),i&&r.push({kind:`text`,text:i}),r}function lT(e,t){let n=[];for(let r of cT(e,t))r.kind===`cite`&&!n.includes(r.label)&&n.push(r.label);return n}function uT({plan:e}){let{t}=G(),n=Rw(e,t);return(0,H.jsxs)(`details`,{className:`group text-xs text-muted-foreground`,children:[(0,H.jsxs)(`summary`,{className:`inline-flex cursor-pointer list-none items-center gap-1.5 rounded-md py-0.5 transition-colors duration-200 ease-in hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,H.jsx)(Et,{className:`size-3`,"aria-hidden":`true`}),t(`chat-how-searched`)]}),(0,H.jsxs)(`div`,{className:`mt-2 grid gap-1.5 rounded-lg border border-border p-2.5`,children:[e.skipped?(0,H.jsx)(`p`,{children:t(`chat-plan-skipped`)}):null,e.skillFacts===`unavailable`?(0,H.jsx)(`p`,{children:t(`chat-skill-facts-unavailable`)}):null,(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:n.map(([e,n])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{children:e}),(0,H.jsx)(`dd`,{dir:`auto`,className:`min-w-0 break-words text-foreground`,children:n.length?n.join(` · `):t(`chat-none`)})]},e))})]})]})}var dT={no_sources:`chat-no-sources`,insufficient:`chat-insufficient`,uncited:`chat-uncited`};function fT({message:e,missingMemoryIds:t,missingSkillNames:n,readOnly:r,onOpenSource:i,onRetry:a}){let{t:o}=G(),s=e.sources.map(e=>e.label),c=new Map(e.sources.map(e=>[e.label,e])),l=e=>Fw(e,t,n),u=(0,v.useMemo)(()=>oT(g_(e.content),s,e=>l(c.get(e)),e=>o(`chat-cite-label`,{label:e})),[e.content,e.sources,t,n,o]),d=e=>{let t=e.target.closest(`[data-cite]`),n=t?c.get(t.dataset.cite??``):void 0;n&&i(n)},f=lT(e.content,s).map(e=>c.get(e)).filter(e=>!!e);return(0,H.jsxs)(`article`,{className:`grid min-w-0 gap-2.5`,children:[e.errorCode?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 p-2.5 text-sm text-destructive-label`,children:[(0,H.jsx)(Bt,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1`,children:o(`chat-error`,{code:e.errorCode})}),r?null:(0,H.jsxs)(K,{type:`button`,variant:`outline`,size:`xs`,onClick:()=>a(e),children:[(0,H.jsx)(Tt,{}),o(`chat-retry`)]})]}):null,e.content?(0,H.jsx)(`div`,{dir:`auto`,className:`markdown-content chat-answer break-words text-sm leading-7`,onClick:d,dangerouslySetInnerHTML:{__html:u}}):null,e.notice?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),o(dT[e.notice])]}):null,f.length?(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:o(`chat-sources`)}),(0,H.jsx)(`ul`,{className:`grid gap-1`,children:f.map(e=>(0,H.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 text-xs`,children:[(0,H.jsx)(Bw,{label:e.label,deleted:l(e),onOpen:()=>i(e)}),(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate leading-5 text-muted-foreground`,children:e.kind===`skill`?e.id:`${e.projectName?`${e.projectName} · `:``}${e.text}`})]},e.label))})]}):null,e.plan?(0,H.jsx)(uT,{plan:e.plan}):null]})}function pT({text:e}){let{t}=G();return(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsxs)(`div`,{className:`max-w-[85%] rounded-2xl rounded-ee-md bg-secondary px-3.5 py-2.5`,children:[(0,H.jsxs)(`span`,{className:`sr-only`,children:[t(`chat-you`),`: `]}),(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words text-sm leading-6`,children:e})]})})}function mT({messages:e,pending:t,missingMemoryIds:n,missingSkillNames:r,readOnly:i,onOpenSource:a,onRetry:o}){let{t:s}=G();return e.length===0&&!t?(0,H.jsx)(`p`,{className:`m-auto max-w-sm text-center text-sm text-muted-foreground`,children:s(`chat-empty-thread`)}):(0,H.jsxs)(`ol`,{className:`grid gap-6`,"aria-live":`polite`,children:[e.map(e=>(0,H.jsx)(`li`,{children:e.role===`user`?(0,H.jsx)(pT,{text:e.content}):(0,H.jsx)(fT,{message:e,missingMemoryIds:n,missingSkillNames:r,readOnly:i,onOpenSource:a,onRetry:o})},e.id)),t?(0,H.jsxs)(`li`,{className:`grid gap-4`,children:[e.at(-1)?.role===`user`&&e.at(-1)?.content===t?null:(0,H.jsx)(pT,{text:t}),(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,role:`status`,children:[(0,H.jsx)(Ye,{className:`size-4 animate-spin`,"aria-hidden":`true`}),s(`chat-thinking`)]})]}):null]})}var hT={person:`chat-skill-by-person`,agent:`chat-skill-by-agent`,automatic:`chat-skill-by-automatic`};function gT({skill:e}){let{t}=G(),n=[[t(`chat-skill-uses`),String(e.uses)],[t(`chat-skill-failed`),String(e.failedTurns)],[t(`chat-skill-attention`),e.attention.toFixed(2)],[t(`chat-skill-modified`),Iw(e,t,$p)]];return(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,H.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 rounded-lg border border-border p-2.5 text-xs text-muted-foreground`,children:n.map(([e,t])=>(0,H.jsxs)(`div`,{className:`contents`,children:[(0,H.jsx)(`dt`,{children:e}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words text-foreground`,children:t})]},e))}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t(`chat-skill-window`),` `,t(`chat-skill-modified-note`)]}),(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:t(`chat-skill-history`)}),e.history.length===0?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`chat-skill-history-empty`)}):(0,H.jsx)(`ol`,{className:`grid gap-2`,children:e.history.map((e,n)=>(0,H.jsxs)(`li`,{className:`grid gap-0.5 rounded-lg border border-border p-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`flex flex-wrap gap-x-2 text-muted-foreground`,children:[(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:t(Lw(e.kind))}),(0,H.jsx)(`span`,{children:Qp(e.at)}),e.appliedBy&&e.appliedBy in hT?(0,H.jsx)(`span`,{children:t(hT[e.appliedBy])}):null]}),(0,H.jsx)(`span`,{dir:`auto`,className:`break-words`,children:e.summary})]},n))})]})]})}var _T={preferences:`profile-preferences`,patterns:`profile-patterns`,workflows:`profile-workflows`};function vT({source:e,deleted:t}){let{t:n,language:r}=G(),i=e.kind===`memory`;return e.kind===`skill`?(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[t?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-border bg-muted/40 p-2.5 text-xs`,children:[(0,H.jsx)(Bt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),n(`chat-skill-missing`)]}):null,e.skill?(0,H.jsx)(gT,{skill:e.skill}):null,(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`chat-source-note`)})]}):(0,H.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[t?(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-border bg-muted/40 p-2.5 text-xs`,children:[(0,H.jsx)(Bt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),n(`chat-source-deleted`)]}):null,(0,H.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[i&&e.projectName?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-project`)}),(0,H.jsx)(`dd`,{className:`min-w-0 break-words text-foreground`,children:e.projectName})]}):null,i&&e.createdAt?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-date`)}),(0,H.jsx)(`dd`,{className:`text-foreground`,children:Qp(new Date(e.createdAt).toISOString())})]}):null,!i&&e.section?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{children:n(`chat-source-profile`)}),(0,H.jsxs)(`dd`,{className:`text-foreground`,children:[n(_T[e.section]),e.category?` · ${e.category}`:``]})]}):null]}),e.tags?.length?(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,"aria-label":n(`chat-source-tags`),children:e.tags.map(e=>(0,H.jsx)(id,{variant:`outline`,children:e},e))}):null,(0,H.jsx)(Fv,{dir:r===`ar`?`rtl`:`ltr`,className:`max-h-[45vh] rounded-lg border`,children:(0,H.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words p-3 text-sm leading-6`,children:e.text})}),!i&&e.evidence?.length?(0,H.jsxs)(`div`,{className:`grid gap-1`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:n(`chat-source-evidence`)}),(0,H.jsx)(`ul`,{className:`grid gap-1 text-xs`,children:e.evidence.map((e,t)=>(0,H.jsx)(`li`,{dir:`auto`,className:`break-words`,children:e},t))})]}):null,(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`chat-source-note`)}),i?(0,H.jsx)(`a`,{href:J.project,className:`text-xs text-primary-label underline-offset-4 hover:underline`,children:n(`chat-source-open-project`)}):null]})}function yT({source:e,deleted:t,onClose:n}){let{t:r}=G();return(0,H.jsx)(zl,{open:e!==null,onOpenChange:e=>!e&&n(),children:(0,H.jsxs)(q,{className:`sm:max-w-lg`,children:[(0,H.jsxs)(Hl,{children:[(0,H.jsx)(Wl,{children:e?`${e.label} · ${e.kind===`memory`?r(`chat-source-memory`):e.kind===`skill`?`${r(`chat-source-skill`)} ${e.id}`:r(`chat-source-profile`)}`:``}),(0,H.jsx)(Gl,{className:`sr-only`,children:e?.text.slice(0,120)})]}),e?(0,H.jsx)(vT,{source:e,deleted:t}):null]})})}function bT(){let{t:e}=G(),t=Nw(),[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null),a=(0,v.useRef)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(new Set),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!n)return;let e=i.current;return a.current?.focus(),()=>e?.focus()},[n]);let g=new Set(t.detail?.missingMemoryIds??[]),_=new Set(t.detail?.missingSkillNames??[]),y=!!t.detail?.messages.some(e=>e.sources.some(e=>e.kind===`skill`)),b=t.list.readOnly,x=t.status?.ready??!1;function S(e){s(e),l(new Set)}async function C(e){e.kind===`folder`?await t.deleteFolder(e.id):await t.deleteChats(e.ids),d(null),S(!1)}let w=(0,H.jsx)(Qw,{chat:t,selectMode:o,selected:c,onSelectMode:S,onSelected:l,onDelete:d,onName:p,onOpened:()=>r(!1)});return(0,H.jsxs)(`div`,{className:`grid min-h-[calc(100svh-9rem)] gap-4 md:grid-cols-[17rem_minmax(0,1fr)]`,children:[(0,H.jsx)(`aside`,{className:`hidden min-h-0 overflow-y-auto border-e border-border pe-4 md:sticky md:top-6 md:block md:max-h-[calc(100svh-3rem)] md:self-start`,children:w}),n?(0,H.jsxs)(`div`,{className:`fixed inset-0 z-40 md:hidden`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`chat-show-list`),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:[(0,H.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/50`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1)}),(0,H.jsxs)(`div`,{className:`absolute inset-y-0 start-0 flex w-[min(20rem,85vw)] flex-col gap-3 overflow-y-auto bg-background p-4 shadow-xl`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`text-sm font-medium`,children:e(`chat-conversations`)}),(0,H.jsx)(K,{ref:a,type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":e(`chat-cancel`),onClick:()=>r(!1),children:(0,H.jsx)(qt,{})})]}),w]})]}):null,(0,H.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,children:[(0,H.jsxs)(K,{ref:i,type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(!0),children:[(0,H.jsx)($e,{}),e(`chat-show-list`)]}),t.detail?(0,H.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-sm text-muted-foreground`,children:t.detail.conversation.title}):null]}),(0,H.jsx)(Uw,{letters:Pw(t.status?.skillFacts===!0,y)}),t.status&&!x?(0,H.jsx)(qw,{status:t.status}):null,b?(0,H.jsx)(`p`,{role:`alert`,className:`rounded-xl border border-border bg-card p-3 text-sm`,children:e(`chat-read-only`)}):null,(0,H.jsx)(`div`,{className:V(`flex min-h-48 flex-1 flex-col overflow-y-auto`),children:(0,H.jsx)(mT,{messages:t.detail?.messages??[],pending:t.pending,missingMemoryIds:g,missingSkillNames:_,readOnly:b||!x,onOpenSource:h,onRetry:t.retry})}),(0,H.jsxs)(`div`,{className:`sticky bottom-0 grid gap-1.5 bg-background pb-1`,children:[(0,H.jsx)(Kw,{projects:t.projects,scope:t.scope,scopeMissing:t.scopeMissing,disabled:!x||b||t.pending!==null,onScope:t.setScope,onAsk:e=>void t.ask(e)}),x&&t.status?.apiHost?(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":`true`}),e(`chat-provider-note`,{host:t.status.apiHost})]}):null,x&&t.status?.skillFacts?(0,H.jsxs)(`p`,{className:`flex items-center gap-1.5 px-1 text-[11px] text-muted-foreground`,children:[(0,H.jsx)(Be,{className:`size-3 shrink-0`,"aria-hidden":`true`}),e(`chat-skill-privacy`)]}):null]})]}),(0,H.jsx)($w,{request:u,onConfirm:C,onCancel:()=>d(null)}),(0,H.jsx)(tT,{request:f,onClose:()=>p(null)}),(0,H.jsx)(yT,{source:m,deleted:Fw(m??void 0,g,_),onClose:()=>h(null)})]})}var xT=[{id:`skills-section-activity`,title:`Activity`},{id:`skills-section-ranked`,title:`Ranked skills`},{id:`skills-section-pending`,title:`Pending proposals`},{id:`skills-section-recent`,title:`Recent proposals`},{id:`skills-section-folders`,title:`Watched folders`}],ST=e=>xT.map(t=>({id:t.id,label:Qv(t.title,e)})),CT=[`all`,`not-modified`,`modified`,`suggested`],wT=`omms-skills-modified-filter`;function TT(e){let t=e.filter(e=>e.modified).length,n=e.filter(e=>e.suggested).length;return{all:e.length,"not-modified":e.length-t,modified:t,suggested:n}}function ET(e,t){return t===`all`?e:t===`suggested`?e.filter(e=>e.suggested):e.filter(e=>e.modified===(t===`modified`))}function DT(){try{let e=localStorage.getItem(wT);return CT.find(t=>t===e)??`all`}catch{return`all`}}function OT(e){try{localStorage.setItem(wT,e)}catch{}}var kT=e=>typeof e==`number`&&Number.isFinite(e)&&e>0?Math.floor(e):0,AT=e=>Array.isArray(e)?e:[],jT=e=>e&&typeof e==`object`?e:{};function MT(e){return AT(e).map(jT).filter(e=>typeof e.day==`string`).map(e=>({day:e.day,uses:kT(e.uses),failed:kT(e.failed)}))}var NT=e=>e.map(({day:e,uses:t,failed:n})=>({key:e,uses:t,failed:n})),PT=[`day`,`month`,`year`],FT=/^\d{4}-(0[1-9]|1[0-2])$/;function IT(e){let t=jT(e);return{months:AT(t.months).filter(e=>typeof e==`string`&&FT.test(e)),years:AT(t.years).filter(e=>Number.isInteger(e))}}function LT(e){let t=jT(e),n=jT(t.totals),r=MT(t.days),i=Array.isArray(t.series)?t.series.map(jT).filter(e=>typeof e.key==`string`).map(e=>({key:e.key,uses:kT(e.uses),failed:kT(e.failed)})):NT(r),a=AT(t.topSkills).map(jT).filter(e=>typeof e.name==`string`).map(e=>({name:e.name,path:typeof e.path==`string`?e.path:null,uses:kT(e.uses),failed:kT(e.failed)}));return{bucket:PT.includes(t.bucket)?t.bucket:`day`,series:i,days:r,topSkills:a,topTotal:Math.max(kT(t.topTotal),a.length),totals:{uses:kT(n.uses),failed:kT(n.failed),activeSkills:kT(n.activeSkills)},available:IT(t.available)}}var RT=[`created`,`applied`,`rejected`,`undone`,`stale`];function zT(e){let t=jT(e),n=AT(t.entries).map(jT).filter(e=>RT.includes(e.kind)&&typeof e.id==`string`).map(e=>({id:e.id,proposalId:typeof e.proposalId==`string`?e.proposalId:``,kind:e.kind,at:kT(e.at),summary:typeof e.summary==`string`?e.summary:``,appliedBy:typeof e.appliedBy==`string`?e.appliedBy:null,versionId:typeof e.versionId==`string`?e.versionId:null,canUndo:e.canUndo===!0,laterAppliedCount:kT(e.laterAppliedCount),added:kT(e.added),removed:kT(e.removed)}));return{total:Math.max(kT(t.total),n.length),entries:n}}var BT=e=>e.every(e=>e.uses===0),VT=e=>({...e,succeeded:Math.max(0,e.uses-e.failed),failed:Math.min(e.failed,e.uses)}),HT=[`pending`,`applied`,`rejected`,`stale`,`undone`];function UT(e){return HT.map(t=>({state:t,count:e.filter(e=>e.state===t).length}))}var WT=e=>Date.parse(`${e}T12:00:00`),GT={bucket:`day`,month:null},KT=`omms-skills-activity-range`,qT=`last-30`,JT=30,YT=(e,t)=>Math.min(t,e+8),XT={day:`Uses per day`,month:`Uses per month`,year:`Uses per year`},ZT={day:`Day`,month:`Month`,year:`Year`};function QT(e){return e.bucket===`year`?{bucket:`year`}:e.bucket===`month`?{bucket:`month`,year:e.year}:e.month?{bucket:`day`,month:e.month}:{bucket:`day`,days:JT}}function $T(e){return e.bucket===`year`?`year`:e.bucket===`month`?`month:${e.year}`:e.month?`day:${e.month}`:`day`}function eE(e){if(e===`year`)return{bucket:`year`};let t=/^day:(\d{4}-\d{2})$/.exec(e??``)?.[1];if(t&&FT.test(t))return{bucket:`day`,month:t};let n=/^month:(\d{4})$/.exec(e??``)?.[1];return n?{bucket:`month`,year:Number(n)}:GT}function tE(e,t){return e.bucket===`day`&&e.month&&!t.months.includes(e.month)||e.bucket===`month`&&!t.years.includes(e.year)?GT:e}function nE(e,t){return e===`year`?{bucket:e}:e===`month`?{bucket:e,year:t}:GT}var rE=e=>e.bucket===`month`?String(e.year):e.bucket===`day`?e.month??`last-30`:``;function iE(e,t){return e.bucket===`month`?{bucket:`month`,year:Number(t)}:t===`last-30`?GT:{bucket:`day`,month:t}}function aE(e,t,n,r){if(e===`year`)return t;if(e===`day`){let e=new Date(WT(t));return n?Ai(e,r.choice,r.locale):ki(e,r.choice,r.locale)}let[i,a]=t.split(`-`).map(Number);return new Intl.DateTimeFormat(r.locale,{month:n?`long`:`short`,...n?{year:`numeric`}:{},timeZone:`UTC`,calendar:`gregory`}).format(Date.UTC(i,a-1,1))}function oE(e,t,n,r){if(e.bucket===`month`)return String(e.year);if(e.bucket===`day`)return e.month?aE(`month`,e.month,!0,n):r(`Last 30 days`);let i=t[0]?.key??``,a=t.at(-1)?.key??``;return i===a?a:Gb(r(`{from} to {to}`),{from:i,to:a})}function sE(e,t,n,r,i){if(e.bucket===`year`)return[];if(e.bucket===`month`)return[...new Set([n,e.year,...t.years])].sort((e,t)=>t-e).map(e=>({value:String(e),label:String(e)}));let a=[...new Set([...e.month?[e.month]:[],...t.months])];return[{value:qT,label:i},...a.sort((e,t)=>t.localeCompare(e)).map(e=>({value:e,label:aE(`month`,e,!0,r)}))]}var cE=[`day`,`month`,`year`],lE={day:`Days`,month:`Months`,year:`Years`},uE={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};function dE({range:e,available:t,currentYear:n,loading:r,onChange:i}){let a=Y(),o=(0,v.useRef)([]),s=t=>{let r=cE[t];o.current[t]?.focus(),r!==e.bucket&&i(nE(r,n))};return(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`div`,{role:`radiogroup`,"aria-label":a(`Show uses by`),className:`inline-flex gap-1.5`,onKeyDown:t=>{let n=uE[t.key];if(!n)return;t.preventDefault();let r=getComputedStyle(t.currentTarget).direction===`rtl`,i=t.key===`ArrowLeft`||t.key===`ArrowRight`,a=r&&i?-n:n,o=cE.indexOf(e.bucket);s((o+a+cE.length)%cE.length)},children:cE.map((t,n)=>(0,H.jsx)(`button`,{ref:e=>{o.current[n]=e},type:`button`,role:`radio`,"aria-checked":e.bucket===t,tabIndex:e.bucket===t?0:-1,className:V(`min-h-9 rounded-[10px] border px-3 text-ui transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-ring`,e.bucket===t?`border-primary/40 bg-selection text-foreground`:`border-input bg-card text-muted-foreground hover:bg-interactive-hover`),onClick:()=>s(n),children:a(lE[t])},t))}),e.bucket===`year`?(0,H.jsx)(`span`,{className:`h-9 w-44`,"aria-hidden":`true`}):(0,H.jsx)(Dr,{className:`w-44`,"aria-label":a(e.bucket===`day`?`Days to show`:`Year to show`),value:rE(e),onChange:t=>i(iE(e,t.target.value)),children:sE(e,t,n,nm(),a(`Last 30 days`)).map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,H.jsx)(Ye,{"aria-hidden":`true`,className:V(`size-4 animate-spin text-muted-foreground`,!r&&`invisible`)}),(0,H.jsx)(`span`,{role:`status`,className:`sr-only`,children:r?a(`Loading…`):``})]})}var fE=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function pE(e){return typeof e==`string`&&fE.includes(e)}var mE=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function hE(e){return typeof e==`string`&&mE.has(e)}function gE(e){return typeof e==`string`&&e.startsWith(`data-`)}function _E(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(hE(n)||gE(n))&&(t[n]=e[n]);return t}function vE(e){if(e==null)return null;if((0,v.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return _E(t)}return typeof e==`object`&&!Array.isArray(e)?_E(e):null}function yE(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(hE(n)||gE(n)||pE(n))&&(t[n]=e[n]);return t}var bE=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function xE(){return xE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xE.apply(null,arguments)}function SE(e,t){if(e==null)return{};var n,r,i=CE(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function CE(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var wE=(0,v.forwardRef)((e,t)=>{var{children:n,width:r,height:i,viewBox:a,className:o,style:s,title:c,desc:l}=e,u=SE(e,bE),d=a||{width:r,height:i,x:0,y:0},f=Xt(`recharts-surface`,o);return v.createElement(`svg`,xE({},yE(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)}),TE=[`children`,`className`];function EE(){return EE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},EE.apply(null,arguments)}function DE(e,t){if(e==null)return{};var n,r,i=OE(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function OE(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var kE=v.forwardRef((e,t)=>{var{children:n,className:r}=e,i=DE(e,TE),a=Xt(`recharts-layer`,r);return v.createElement(`g`,EE({className:a},yE(i),{ref:t}),n)}),AE=(0,v.createContext)(null);function jE(e){return function(){return e}}var ME=Math.cos,NE=Math.sin,PE=Math.sqrt,FE=Math.PI;FE/2;var IE=2*FE,LE=Math.PI,RE=2*LE,zE=1e-6,BE=RE-zE;function VE(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function HE(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return VE;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var UE=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?VE:HE(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>zE){if(!(Math.abs(u*s-c*l)>zE)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((LE-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>zE&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>zE||Math.abs(this._y1-l)>zE)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%RE+RE),d>BE?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>zE&&this._append`A${n},${n},0,${+(d>=LE)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};UE.prototype;function WE(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new UE(t)}Array.prototype.slice;function GE(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function KE(e){this._context=e}KE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function qE(e){return new KE(e)}function JE(e){return e[0]}function YE(e){return e[1]}function XE(e,t){var n=jE(!0),r=null,i=qE,a=null,o=WE(s);e=typeof e==`function`?e:e===void 0?JE:jE(e),t=typeof t==`function`?t:t===void 0?YE:jE(t);function s(s){var c,l=(s=GE(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:jE(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:jE(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function ZE(e,t,n){var r=null,i=jE(!0),a=null,o=qE,s=null,c=WE(l);e=typeof e==`function`?e:e===void 0?JE:jE(+e),t=typeof t==`function`?t:jE(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?YE:jE(+n);function l(l){var u,d,f,p=(l=GE(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h){if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return XE().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:jE(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:jE(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:jE(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:jE(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:jE(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var QE=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function $E(e){return new QE(e,!0)}function eD(e){return new QE(e,!1)}var tD={draw(e,t){let n=PE(t/FE);e.moveTo(n,0),e.arc(0,0,n,0,IE)}},nD={draw(e,t){let n=PE(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},rD=PE(1/3),iD=rD*2,aD={draw(e,t){let n=PE(t/iD),r=n*rD;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},oD={draw(e,t){let n=PE(t),r=-n/2;e.rect(r,r,n,n)}},sD=.8908130915292852,cD=NE(FE/10)/NE(7*FE/10),lD=NE(IE/10)*cD,uD=-ME(IE/10)*cD,dD={draw(e,t){let n=PE(t*sD),r=lD*n,i=uD*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=IE*t/5,o=ME(a),s=NE(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},fD=PE(3),pD={draw(e,t){let n=-PE(t/(fD*3));e.moveTo(0,n*2),e.lineTo(-fD*n,-n),e.lineTo(fD*n,-n),e.closePath()}},mD=-.5,hD=PE(3)/2,gD=1/PE(12),_D=(gD/2+1)*3,vD={draw(e,t){let n=PE(t/_D),r=n/2,i=n*gD,a=r,o=n*gD+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(mD*r-hD*i,hD*r+mD*i),e.lineTo(mD*a-hD*o,hD*a+mD*o),e.lineTo(mD*s-hD*c,hD*s+mD*c),e.lineTo(mD*r+hD*i,mD*i-hD*r),e.lineTo(mD*a+hD*o,mD*o-hD*a),e.lineTo(mD*s+hD*c,mD*c-hD*s),e.closePath()}};function yD(e,t){let n=null,r=WE(i);e=typeof e==`function`?e:jE(e||tD),t=typeof t==`function`?t:jE(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:jE(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:jE(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function bD(){}function xD(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function SD(e){this._context=e}SD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:xD(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:xD(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function CD(e){return new SD(e)}function wD(e){this._context=e}wD.prototype={areaStart:bD,areaEnd:bD,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:xD(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function TD(e){return new wD(e)}function ED(e){this._context=e}ED.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:xD(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function DD(e){return new ED(e)}function OD(e){this._context=e}OD.prototype={areaStart:bD,areaEnd:bD,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function kD(e){return new OD(e)}function AD(e){return e<0?-1:1}function jD(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(AD(a)+AD(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function MD(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ND(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function PD(e){this._context=e}PD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ND(this,this._t0,MD(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ND(this,MD(this,n=jD(this,e,t)),n);break;default:ND(this,this._t0,n=jD(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function FD(e){this._context=new ID(e)}(FD.prototype=Object.create(PD.prototype)).point=function(e,t){PD.prototype.point.call(this,t,e)};function ID(e){this._context=e}ID.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function LD(e){return new PD(e)}function RD(e){return new FD(e)}function zD(e){this._context=e}zD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n){if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=BD(e),i=BD(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o])}(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function BD(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function VD(e){return new zD(e)}function HD(e,t){this._context=e,this._t=t}HD.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function UD(e){return new HD(e,.5)}function WD(e){return new HD(e,0)}function GD(e){return new HD(e,1)}function KD(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function qD(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function JD(e,t){return e[t]}function YD(e){let t=[];return t.key=e,t}function XD(){var e=jE([]),t=qD,n=KD,r=JD;function i(i){var a=Array.from(e.apply(this,arguments),YD),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=GE(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:jE(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:jE(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?qD:typeof e==`function`?e:jE(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??KD,i):n},i}function ZD(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}KD(e,t)}}function QD(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}KD(e,t)}}function $D(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,KD(e,t)}}function eO(e){return e===`__proto__`}var tO=Object.prototype.hasOwnProperty;function nO(e,t){return tO.call(e,t)}var rO=/\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;function iO(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e===``||e.startsWith(`.`)||e.endsWith(`.`)?!1:rO.test(e);default:return!1}}function aO(e){var t;return typeof e==`string`||typeof e==`symbol`?e:Object.is(e==null||(t=e.valueOf)==null?void 0:t.call(e),-0)?`-0`:String(e)}function oO(e){return typeof e==`symbol`||e instanceof Symbol}function sO(e){if(typeof e==`string`)return e;if(Array.isArray(e)){let t=``;for(let n=0;n<e.length;n++)n>0&&(t+=`,`),t+=sO(e[n]);return t}if(oO(e))return e.toString();let t=e+``;return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function cO(e){return e==null?``:sO(e)}function lO(e){if(Array.isArray(e))return e.map(aO);if(typeof e==`symbol`)return[e];e=cO(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1,s=!1,c=/^-?\d+(?:\.\d+)?$/;for(e.charCodeAt(0)===46&&t.push(``);r<n;){let l=e[r];if(a)l===`\\`&&r+1<n?(r++,i+=e[r]):l===a?a=``:i+=l;else if(o){if(l===`"`||l===`'`)a=l,s=!0;else if(l===`]`){if(o=!1,!s&&i.includes(`.`)&&!c.test(i)){let e=i.split(`.`);for(let n=0;n<e.length;n++)e[n]!==``&&t.push(e[n])}else t.push(i);i=``}else i+=l}else if(l===`[`)o=!0,s=!1,i&&=(t.push(i),``);else if(l===`.`){i&&=(t.push(i),``);let n=e[r+1];(n===void 0||n===`.`)&&t.push(``)}else i+=l;r++}return i&&t.push(i),t}function uO(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(eO(t))return n;let r=e[t];return r===void 0?iO(t)&&!nO(e,t)?uO(e,lO(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=aO(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return dO(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),eO(t))return n;let r=e[t];return r===void 0?n:r}}}function dO(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||eO(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}var fO=4;function pO(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:fO),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function mO(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+pO(i)+n},``)}var hO=e=>e===0?0:e>0?1:-1,gO=e=>typeof e==`number`&&e!=+e,_O=e=>typeof e==`string`&&e.indexOf(`%`)===e.length-1,Z=e=>(typeof e==`number`||e instanceof Number)&&!gO(e),vO=e=>Z(e)||typeof e==`string`,yO=0,bO=e=>{var t=++yO;return`${e||``}${t}`},xO=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!Z(e)&&typeof e!=`string`)return n;var i;if(_O(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return gO(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},SO=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function CO(e,t,n){return Z(e)&&Z(t)?pO(e+n*(t-e)):t}function wO(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):uO(e,t))===n)}var TO=e=>e==null,EO=e=>TO(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function DO(e){return e!=null}function OO(){}var kO=[`type`,`size`,`sizeType`];function AO(){return AO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},AO.apply(null,arguments)}function jO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function MO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?jO(Object(n),!0).forEach(function(t){NO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function NO(e,t,n){return(t=PO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PO(e){var t=FO(e,`string`);return typeof t==`symbol`?t:t+``}function FO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function IO(e,t){if(e==null)return{};var n,r,i=LO(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function LO(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var RO={symbolCircle:tD,symbolCross:nD,symbolDiamond:aD,symbolSquare:oD,symbolStar:dD,symbolTriangle:pD,symbolWye:vD},zO=Math.PI/180,BO=e=>RO[`symbol${EO(e)}`]||tD,VO=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*zO;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},HO=(e,t)=>{RO[`symbol${EO(e)}`]=t},UO=e=>{var{type:t=`circle`,size:n=64,sizeType:r=`area`}=e,i=MO(MO({},IO(e,kO)),{},{type:t,size:n,sizeType:r}),a=`circle`;typeof t==`string`&&(a=t);var o=()=>{var e=BO(a),t=yD().type(e).size(VO(n,r,a))();if(t!==null)return t},{className:s,cx:c,cy:l}=i,u=yE(i);return Z(c)&&Z(l)&&Z(n)?v.createElement(`path`,AO({},u,{className:Xt(`recharts-symbols`,s),transform:`translate(${c}, ${l})`,d:o()})):null};UO.registerSymbol=HO;var WO=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,GO=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,v.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{pE(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},KO=(e,t,n)=>r=>(e(t,n,r),null),qO=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];pE(i)&&typeof a==`function`&&(r||={},r[i]=KO(a,t,n))}),r};function JO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function YO(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?JO(Object(n),!0).forEach(function(t){XO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XO(e,t,n){return(t=ZO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZO(e){var t=QO(e,`string`);return typeof t==`symbol`?t:t+``}function QO(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function $O(e,t){var n=YO({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function ek(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function tk(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function nk(e){return e}function rk(e){return Number.isSafeInteger(e)&&e>=0}function ik(e){return e!=null&&typeof e!=`function`&&rk(e.length)}function ak(e){return function(t){return uO(t,e)}}function ok(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function sk(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var ck=`[object RegExp]`,lk=`[object String]`,uk=`[object Number]`,dk=`[object Boolean]`,fk=`[object Arguments]`,pk=`[object Symbol]`,mk=`[object Date]`,hk=`[object Map]`,gk=`[object Set]`,_k=`[object Array]`,vk=`[object ArrayBuffer]`,yk=`[object Object]`,bk=`[object DataView]`,xk=`[object Uint8Array]`,Sk=`[object Uint8ClampedArray]`,Ck=`[object Uint16Array]`,wk=`[object Uint32Array]`,Tk=`[object Int8Array]`,Ek=`[object Int16Array]`,Dk=`[object Int32Array]`,Ok=`[object Float32Array]`,kk=`[object Float64Array]`;function Ak(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function jk(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Mk(e,t,n){return typeof n==`function`?Nk(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?Nk(t,r,e,s,!1):!!c},new Map,!0):Mk(e,t,()=>void 0)}function Nk(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return Pk(e,t,n,r,i);case`function`:return Object.keys(t).length>0?Nk(e,Object.assign({},t),n,r,i):Ak(e,t);default:return jk(e)&&i?typeof t!=`string`||t===``:Ak(e,t)}}function Pk(e,t,n,r,i=!1){if(t==null)return!0;if(Array.isArray(t))return Ik(e,t,n,r);if(t instanceof Map)return Fk(e,t,n,r);if(t instanceof Set)return Lk(e,t,n,r);let a=Object.keys(t);if(e==null)return i&&a.length===0;if(i)ok(e)&&(e=Object(e));else{if(sk(t)===`[object Error]`)return sk(e)===`[object Error]`&&e.name===t.name&&e.message===t.message;let n=sk(e);if(n!==`[object Object]`&&n!==`[object Arguments]`)return!1}if(a.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let i=0;i<a.length;i++){let o=a[i];if(!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function Fk(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function Ik(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function Lk(e,t,n,r){return t.size===0||e instanceof Set&&Ik([...e],[...t],n,r)}function Rk(e,t){return Mk(e,t,()=>void 0)}function zk(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var Bk=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function Vk(e){return Bk.Buffer!==void 0&&Bk.Buffer.isBuffer(e)}function Hk(e){return Vk(e)}function Uk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Wk(e){return Uk(e)}function Gk(e,t){return Kk(e,void 0,e,new Map,t)}function Kk(e,t,n,r,i){if(i!=null){let a=i(e,t,n,r);if(a!==void 0)return a}if(ok(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Kk(e[a],a,n,r,i);return nO(e,`index`)&&(t.index=e.index),nO(e,`input`)&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;return r.set(e,t),e.forEach((e,a)=>{t.set(a,Kk(e,a,n,r,i))}),t}if(e instanceof Set){let t=new Set;return r.set(e,t),e.forEach(e=>{t.add(Kk(e,void 0,n,r,i))}),t}if(Hk(e))return e.subarray();if(Wk(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Kk(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),qk(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),qk(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),qk(t,e,n,r,i),t}let a=sk(e);if(a===`[object Error]`)return e===n?{}:e;switch(a){case uk:case lk:case dk:{let t=new e.constructor(e.valueOf());return r.set(e,t),qk(t,e,n,r,i),t}case fk:{let t={};return r.set(e,t),qk(t,e,n,r,i),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}}if(typeof e==`object`&&Jk(a)){let t=a===`[object Object]`&&typeof e.constructor!=`function`?{}:Object.create(Object.getPrototypeOf(e));return r.set(e,t),qk(t,e,n,r,i),t}return e}function qk(e,t,n,r,i){let a=[...Object.keys(t),...zk(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=Kk(t[s],s,n,r,i))}}function Jk(e){switch(e){case fk:case _k:case vk:case bk:case dk:case mk:case Ok:case kk:case Tk:case Ek:case Dk:case hk:case uk:case yk:case ck:case gk:case lk:case pk:case xk:case Sk:case Ck:case wk:return!0;default:return!1}}function Yk(e){return Gk(e)}function Xk(e){return e=Yk(e),t=>Rk(t,e)}var Zk=/^(?:0|[1-9]\d*)$/;function Qk(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return Zk.test(e)}}function $k(e){return typeof e==`object`&&!!e&&sk(e)===`[object Arguments]`}function eA(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&iO(t)&&!(t in Object(e))?lO(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=aO(n[e]);if((r==null||!nO(r,t))&&!((Array.isArray(r)||$k(r))&&Qk(t)&&Number(t)<r.length))return!1;r=r[t]}return!0}function tA(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=aO(e)}return t=Yk(t),function(n){let r=uO(n,e);return r===void 0?eA(n,e):t===void 0?r===void 0:Rk(r,t)}}function nA(e){if(e==null)return nk;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?tA(e[0],e[1]):Xk(e);default:return ak(e)}}function rA(e){return e===0?0:e}function iA(e,t=nk){return ik(e)?ek(Array.from(e),tk(nA(t),1)).map(rA):[]}function aA(e,t,n){return t===!0?iA(e,n):typeof t==`function`?iA(e,t):e}var oA=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),sA=o(((e,t)=>{t.exports=oA()})),cA=o((e=>{var t=d(),n=sA();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),lA=o(((e,t)=>{t.exports=cA()})),uA=(0,v.createContext)(null),dA=lA(),fA=e=>e,pA=()=>{var e=(0,v.useContext)(uA);return e?e.store.dispatch:fA},mA=()=>{},hA=()=>mA,gA=(e,t)=>e===t;function Q(e){var t=(0,v.useContext)(uA),n=(0,v.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:mA,[t,e]);return(0,dA.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:hA,t?t.store.getState:mA,t?t.store.getState:mA,n,gA)}function _A(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function vA(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function yA(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var bA=e=>Array.isArray(e)?e:[e];function xA(e){let t=Array.isArray(e[0])?e[0]:e;return yA(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function SA(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var CA=class{constructor(e){this.value=e}deref(){return this.value}},wA=typeof WeakRef<`u`?WeakRef:CA,TA=0,EA=1;function DA(){return{s:TA,v:void 0,o:null,p:null}}function OA(e,t={}){let n=DA(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=DA(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=DA(),e.set(n,t)):t=r}}let s=t,c;if(t.s===EA)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new wA(c):c}return s.s=EA,s.v=c,c}return o.clearCache=()=>{n=DA(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function kA(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),_A(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=OA,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=bA(c),p=bA(u),m=xA(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=SA(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var $=kA(OA),AA=Object.assign((e,t=$)=>{vA(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>AA});function jA(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function MA(e,t,n){return jk(n)&&(typeof t==`number`&&ik(n)&&Qk(t)&&t<n.length||typeof t==`string`&&t in n)?Ak(n[t],e):!1}function NA(e){let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n}function PA(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var FA=(e,t,n)=>{if(e!==t){let r=PA(e),i=PA(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0},IA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,LA=/^\w*$/;function RA(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||oO(e)?!0:typeof e==`string`&&(LA.test(e)||!IA.test(e))||t!=null&&nO(t,e)}function zA(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=ik(e)?Array.from(e):NA(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e,r=0;for(;r<t.length&&n!=null;++r)n=n[t[r]];return r>0&&r===t.length?n:void 0},a=(e,t)=>{if(e==null)return t;if(t!=null)return typeof e==`object`&&`key`in e?nO(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):t[e]},o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||RA(e)?e:{key:e,path:lO(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=FA(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function BA(e,...t){let n=t.length;return n>1&&MA(e,t[0],t[1])?t=[]:n>2&&MA(t[0],t[1],t[2])&&(t=[t[0]]),zA(e,jA(t),[`asc`])}var VA=e=>e.legend.settings,HA=e=>e.legend.size;$([e=>e.legend.payload,VA],(e,t)=>{var{itemSorter:n}=t,r=e.flat(1);return n?BA(r,n):r});var UA=1;function WA(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,n]=(0,v.useState)({height:0,left:0,top:0,width:0});return[t,(0,v.useCallback)(e=>{if(e!=null){var r=e.getBoundingClientRect(),i={height:r.height,left:r.left,top:r.top,width:r.width};(Math.abs(i.height-t.height)>UA||Math.abs(i.left-t.left)>UA||Math.abs(i.top-t.top)>UA||Math.abs(i.width-t.width)>UA)&&n({height:i.height,left:i.left,top:i.top,width:i.width})}},[t.width,t.height,t.top,t.left,...e])]}function GA(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var KA=typeof Symbol==`function`&&Symbol.observable||`@@observable`,qA=()=>Math.random().toString(36).substring(7).split(``).join(`.`),JA={INIT:`@@redux/INIT${qA()}`,REPLACE:`@@redux/REPLACE${qA()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${qA()}`};function YA(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function XA(e,t,n){if(typeof e!=`function`)throw Error(GA(2));if(typeof t==`function`&&typeof n==`function`||typeof n==`function`&&typeof arguments[3]==`function`)throw Error(GA(0));if(typeof t==`function`&&n===void 0&&(n=t,t=void 0),n!==void 0){if(typeof n!=`function`)throw Error(GA(1));return n(XA)(e,t)}let r=e,i=t,a=new Map,o=a,s=0,c=!1;function l(){o===a&&(o=new Map,a.forEach((e,t)=>{o.set(t,e)}))}function u(){if(c)throw Error(GA(3));return i}function d(e){if(typeof e!=`function`)throw Error(GA(4));if(c)throw Error(GA(5));let t=!0;l();let n=s++;return o.set(n,e),function(){if(t){if(c)throw Error(GA(6));t=!1,l(),o.delete(n),a=null}}}function f(e){if(!YA(e))throw Error(GA(7));if(e.type===void 0)throw Error(GA(8));if(typeof e.type!=`string`)throw Error(GA(17));if(c)throw Error(GA(9));try{c=!0,i=r(i,e)}finally{c=!1}return(a=o).forEach(e=>{e()}),e}function p(e){if(typeof e!=`function`)throw Error(GA(10));r=e,f({type:JA.REPLACE})}function m(){let e=d;return{subscribe(t){if(typeof t!=`object`||!t)throw Error(GA(11));function n(){let e=t;e.next&&e.next(u())}return n(),{unsubscribe:e(n)}},[KA](){return this}}}return f({type:JA.INIT}),{dispatch:f,subscribe:d,getState:u,replaceReducer:p,[KA]:m}}function ZA(e){Object.keys(e).forEach(t=>{let n=e[t];if(n(void 0,{type:JA.INIT})===void 0)throw Error(GA(12));if(n(void 0,{type:JA.PROBE_UNKNOWN_ACTION()})===void 0)throw Error(GA(13))})}function QA(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];typeof e[i]==`function`&&(n[i]=e[i])}let r=Object.keys(n),i;try{ZA(n)}catch(e){i=e}return function(e={},t){if(i)throw i;let a=!1,o={};for(let i=0;i<r.length;i++){let s=r[i],c=n[s],l=e[s],u=c(l,t);if(u===void 0)throw t&&t.type,Error(GA(14));o[s]=u,a||=u!==l}return a||=r.length!==Object.keys(e).length,a?o:e}}function $A(...e){return e.length===0?e=>e:e.length===1?e[0]:e.reduce((e,t)=>(...n)=>e(t(...n)))}function ej(...e){return t=>(n,r)=>{let i=t(n,r),a=()=>{throw Error(GA(15))},o={getState:i.getState,dispatch:(e,...t)=>a(e,...t)};return a=$A(...e.map(e=>e(o)))(i.dispatch),{...i,dispatch:a}}}function tj(e){return YA(e)&&`type`in e&&typeof e.type==`string`}var nj=Symbol.for(`immer-nothing`),rj=Symbol.for(`immer-draftable`),ij=Symbol.for(`immer-state`);function aj(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var oj=Object,sj=oj.getPrototypeOf,cj=`constructor`,lj=`prototype`,uj=`configurable`,dj=`enumerable`,fj=`writable`,pj=`value`,mj=e=>!!e&&!!e[ij];function hj(e){return e?vj(e)||Tj(e)||!!e[rj]||!!e[cj]?.[rj]||Ej(e)||Dj(e):!1}var gj=oj[lj][cj].toString(),_j=new WeakMap;function vj(e){if(!e||!Oj(e))return!1;let t=sj(e);if(t===null||t===oj[lj])return!0;let n=oj.hasOwnProperty.call(t,cj)&&t[cj];if(n===Object)return!0;if(!kj(n))return!1;let r=_j.get(n);return r===void 0&&(r=Function.toString.call(n),_j.set(n,r)),r===gj}function yj(e,t,n=!0){bj(e)===0?(n?Reflect.ownKeys(e):oj.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function bj(e){let t=e[ij];return t?t.type_:Tj(e)?1:Ej(e)?2:Dj(e)?3:0}var xj=(e,t,n=bj(e))=>n===2?e.has(t):oj[lj].hasOwnProperty.call(e,t),Sj=(e,t,n=bj(e))=>n===2?e.get(t):e[t],Cj=(e,t,n,r=bj(e))=>{r===2?e.set(t,n):r===3?e.add(n):e[t]=n};function wj(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Tj=Array.isArray,Ej=e=>e instanceof Map,Dj=e=>e instanceof Set,Oj=e=>typeof e==`object`,kj=e=>typeof e==`function`,Aj=e=>typeof e==`boolean`;function jj(e){let t=+e;return Number.isInteger(t)&&String(t)===e}var Mj=e=>e.copy_||e.base_,Nj=e=>e.modified_?e.copy_:e.base_;function Pj(e,t){if(Ej(e))return new Map(e);if(Dj(e))return new Set(e);if(Tj(e))return Array[lj].slice.call(e);let n=vj(e);if(t===!0||t===`class_only`&&!n){let t=oj.getOwnPropertyDescriptors(e);delete t[ij];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a[fj]===!1&&(a[fj]=!0,a[uj]=!0),(a.get||a.set)&&(t[i]={[uj]:!0,[fj]:!0,[dj]:a[dj],[pj]:e[i]})}return oj.create(sj(e),t)}{let t=sj(e);if(t!==null&&n)return{...e};let r=oj.create(t);return oj.assign(r,e)}}function Fj(e,t=!1){return Rj(e)||mj(e)||!hj(e)?e:(bj(e)>1&&oj.defineProperties(e,{set:Lj,add:Lj,clear:Lj,delete:Lj}),oj.freeze(e),t&&yj(e,(e,t)=>{Fj(t,!0)},!1),e)}function Ij(){aj(2)}var Lj={[pj]:Ij};function Rj(e){return e===null||!Oj(e)||oj.isFrozen(e)}var zj=`MapSet`,Bj=`Patches`,Vj=`ArrayMethods`,Hj={};function Uj(e){let t=Hj[e];return t||aj(0,e),t}var Wj=e=>!!Hj[e],Gj,Kj=()=>Gj,qj=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Wj(zj)?Uj(zj):void 0,arrayMethodsPlugin_:Wj(Vj)?Uj(Vj):void 0});function Jj(e,t){t&&(e.patchPlugin_=Uj(Bj),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Yj(e){Xj(e),e.drafts_.forEach(Qj),e.drafts_=null}function Xj(e){e===Gj&&(Gj=e.parent_)}var Zj=e=>Gj=qj(Gj,e);function Qj(e){let t=e[ij];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $j(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];if(e!==void 0&&e!==n){n[ij].modified_&&(Yj(t),aj(4)),hj(e)&&(e=eM(t,e));let{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ij].base_,e,t)}else e=eM(t,n);return tM(t,e,!0),Yj(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===nj?void 0:e}function eM(e,t){if(Rj(t))return t;let n=t[ij];if(!n)return lM(t,e.handledSet_,e);if(!rM(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){let{callbacks_:t}=n;if(t)for(;t.length>0;)t.pop()(e);sM(n,e)}return n.copy_}function tM(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Fj(t,n)}function nM(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var rM=(e,t)=>e.scope_===t,iM=[];function aM(e,t,n,r){let i=Mj(e),a=e.type_;if(r!==void 0&&Sj(i,r,a)===t){Cj(i,r,n,a);return}if(!e.draftLocations_){let t=e.draftLocations_=new Map;yj(i,(e,n)=>{if(mj(n)){let r=t.get(n)||[];r.push(e),t.set(n,r)}})}let o=e.draftLocations_.get(t)??iM;for(let e of o)Cj(i,e,n,a)}function oM(e,t,n){e.callbacks_.push(function(r){let i=t;if(!i||!rM(i,r))return;r.mapSetPlugin_?.fixSetContents(i);let a=Nj(i);aM(e,i.draft_??i,a,n),sM(i,r)})}function sM(e,t){if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){let{patchPlugin_:n}=t;if(n){let r=n.getPath(e);r&&n.generatePatches_(e,r,t)}nM(e)}}function cM(e,t,n){let{scope_:r}=e;if(mj(n)){let i=n[ij];rM(i,r)&&i.callbacks_.push(function(){vM(e),aM(e,n,Nj(i),t)})}else hj(n)&&e.callbacks_.push(function(){let i=Mj(e);e.type_===3?i.has(n)&&lM(n,r.handledSet_,r):Sj(i,t,e.type_)===n&&r.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&lM(Sj(e.copy_,t,e.type_),r.handledSet_,r)})}function lM(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||mj(e)||t.has(e)||!hj(e)||Rj(e)?e:(t.add(e),yj(e,(r,i)=>{if(mj(i)){let t=i[ij];rM(t,n)&&(Cj(e,r,Nj(t),e.type_),nM(t))}else hj(i)&&lM(i,t,n)}),e)}function uM(e,t){let n=Tj(e),r={type_:+!!n,scope_:t?t.scope_:Kj(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0},i=r,a=dM;n&&(i=[r],a=fM);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,[s,r]}var dM={get(e,t){if(t===ij)return e;let n=e.scope_.arrayMethodsPlugin_,r=e.type_===1&&typeof t==`string`;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);let i=Mj(e);if(!xj(i,t,e.type_))return hM(e,i,t);let a=i[t];if(e.finalized_||!hj(a)||r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&jj(t))return a;if(a===pM(e.base_,t)||mM(e,t,a)){vM(e);let n=e.type_===1?+t:t,r=bM(e.scope_,a,e,n);return e.copy_[n]=r}return a},has(e,t){return t in Mj(e)},ownKeys(e){return Reflect.ownKeys(Mj(e))},set(e,t,n){let r=gM(Mj(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=pM(Mj(e),t),i=r?.[ij];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_.delete(t),!0;if(wj(n,r)&&(n!==void 0||xj(e.base_,t,e.type_)))return!0;vM(e),_M(e)}return e.copy_[t]===n&&(n!==void 0||xj(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_.set(t,!0),cM(e,t,n),!0)},deleteProperty(e,t){return vM(e),pM(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),_M(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=Mj(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{[fj]:!0,[uj]:e.type_!==1||t!==`length`,[dj]:r[dj],[pj]:n[t]}},defineProperty(){aj(11)},getPrototypeOf(e){return sj(e.base_)},setPrototypeOf(){aj(12)}},fM={};for(let e in dM){let t=dM[e];fM[e]=function(){let e=arguments;return e[0]=e[0][0],t.apply(this,e)}}fM.deleteProperty=function(e,t){return fM.set.call(this,e,t,void 0)},fM.set=function(e,t,n){return dM.set.call(this,e[0],t,n,e[0])};function pM(e,t){let n=e[ij];return(n?Mj(n):e)[t]}function mM(e,t,n){return e.type_!==1||!e.allIndicesReassigned_||!hj(n)||n[ij]?!1:e.baseRefs_.has(n)}function hM(e,t,n){let r=gM(t,n);return r?pj in r?r[pj]:r.get?.call(e.draft_):void 0}function gM(e,t){if(!(t in e))return;let n=sj(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=sj(n)}}function _M(e){e.modified_||(e.modified_=!0,e.parent_&&_M(e.parent_))}function vM(e){e.copy_||=(e.assigned_=new Map,Pj(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var yM=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(kj(e)&&!kj(t)){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}kj(t)||aj(6),n!==void 0&&!kj(n)&&aj(7);let r;if(hj(e)){let i=Zj(this),a=bM(i,e,void 0),o=!0;try{r=t(a),o=!1}finally{o?Yj(i):Xj(i)}return Jj(i,n),$j(r,i)}if(!e||!Oj(e)){if(r=t(e),r===void 0&&(r=e),r===nj&&(r=void 0),this.autoFreeze_&&Fj(r,!0),n){let t=[],i=[];Uj(Bj).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}aj(1,e)},this.produceWithPatches=(e,t)=>{if(kj(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Aj(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Aj(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Aj(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){hj(e)||aj(8),mj(e)&&(e=xM(e));let t=Zj(this),n=bM(t,e,void 0);return n[ij].isManual_=!0,Xj(t),n}finishDraft(e,t){let n=e&&e[ij];(!n||!n.isManual_)&&aj(9);let{scope_:r}=n;return Jj(r,t),$j(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Uj(Bj).applyPatches_;return mj(e)?r(e,t):this.produce(e,e=>r(e,t))}};function bM(e,t,n,r){let[i,a]=Ej(t)?Uj(zj).proxyMap_(t,n):Dj(t)?Uj(zj).proxySet_(t,n):uM(t,n);return(n?.scope_??Kj()).drafts_.push(i),a.callbacks_=n?.callbacks_??[],a.key_=r,n&&r!==void 0?oM(n,a,r):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);let{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function xM(e){return mj(e)||aj(10,e),SM(e)}function SM(e){if(!hj(e)||Rj(e))return e;let t=e[ij],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Pj(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=Pj(e,!0);let i=n;return Dj(n)&&(n=new Set),yj(i,(e,t)=>{Cj(n,e,SM(t))},r),t&&(t.finalized_=!1),n}globalThis.Iterator?.from;var CM=new yM().produce;function wM(e){return({dispatch:t,getState:n})=>r=>i=>typeof i==`function`?i(t,n,e):r(i)}var TM=wM(),EM=wM,DM=typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]==`object`?$A:$A.apply(null,arguments)};typeof window<`u`&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;function OM(e,t){function n(...n){if(t){let r=t(...n);if(!r)throw Error(LN(0));return{type:e,payload:r.payload,...`meta`in r&&{meta:r.meta},...`error`in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>tj(t)&&t.type===e,n}var kM=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...e){return super.concat.apply(this,e)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function AM(e){return hj(e)?CM(e,()=>{}):e}function jM(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function MM(e){return typeof e==`boolean`}var NM=()=>function(e){let{thunk:t=!0,immutableCheck:n=!0,serializableCheck:r=!0,actionCreatorCheck:i=!0}=e??{},a=new kM;return t&&(MM(t)?a.push(TM):a.push(EM(t.extraArgument))),a},PM=`RTK_autoBatch`,FM=()=>e=>({payload:e,meta:{[PM]:!0}}),IM=e=>t=>{setTimeout(t,e)},LM=(e,t)=>n=>{let r=!1,i,a,o=()=>{r||(r=!0,cancelAnimationFrame(i),clearTimeout(a),n())};i=e(o),a=setTimeout(o,t)},RM=(e={type:`raf`})=>t=>(...n)=>{let r=t(...n),i=!0,a=!1,o=!1,s=new Set,c=e.type===`tick`?queueMicrotask:e.type===`raf`?typeof window<`u`&&window.requestAnimationFrame?LM(window.requestAnimationFrame,100):IM(10):e.type===`callback`?e.queueNotification:IM(e.timeout),l=()=>{o=!1,a&&(a=!1,s.forEach(e=>e()))};return Object.assign({},r,{subscribe(e){let t=r.subscribe(()=>i&&e());return s.add(e),()=>{t(),s.delete(e)}},dispatch(e){try{return i=!e?.meta?.[PM],a=!i,a&&(o||(o=!0,c(l))),r.dispatch(e)}finally{i=!0}}})},zM=e=>function(t){let{autoBatch:n=!0}=t??{},r=new kM(e);return n&&r.push(RM(typeof n==`object`?n:void 0)),r};function BM(e){let t=NM(),{reducer:n=void 0,middleware:r,devTools:i=!0,duplicateMiddlewareCheck:a=!0,preloadedState:o=void 0,enhancers:s=void 0}=e||{},c;if(typeof n==`function`)c=n;else if(YA(n))c=QA(n);else throw Error(LN(1));let l;l=typeof r==`function`?r(t):t();let u=$A;i&&(u=DM({trace:!1,...typeof i==`object`&&i}));let d=zM(ej(...l)),f=typeof s==`function`?s(d):d(),p=u(...f);return XA(c,o,p)}function VM(e){let t={},n=[],r,i={addCase(e,n){let r=typeof e==`string`?e:e.type;if(!r)throw Error(LN(28));if(r in t)throw Error(LN(29));return t[r]=n,i},addAsyncThunk(e,r){return r.pending&&(t[e.pending.type]=r.pending),r.rejected&&(t[e.rejected.type]=r.rejected),r.fulfilled&&(t[e.fulfilled.type]=r.fulfilled),r.settled&&n.push({matcher:e.settled,reducer:r.settled}),i},addMatcher(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){return r=e,i}};return e(i),[t,n,r]}function HM(e){return typeof e==`function`}function UM(e,t){let[n,r,i]=VM(t),a;if(HM(e))a=()=>AM(e());else{let t=AM(e);a=()=>t}function o(e=a(),t){let o=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o.filter(e=>!!e).length===0&&(o=[i]),o.reduce((e,n)=>{if(n){if(mj(e)){let r=n(e,t);return r===void 0?e:r}if(hj(e))return CM(e,e=>n(e,t));{let r=n(e,t);if(r===void 0){if(e===null)return e;throw Error(LN(9))}return r}}return e},e)}return o.getInitialState=a,o}var WM=`ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW`,GM=(e=21)=>{let t=``,n=e;for(;n--;)t+=WM[Math.random()*64|0];return t},KM=Symbol.for(`rtk-slice-createasyncthunk`);function qM(e,t){return`${e}/${t}`}function JM({creators:e}={}){let t=e?.asyncThunk?.[KM];return function(e){let{name:n,reducerPath:r=n}=e;if(!n)throw Error(LN(11));let i=(typeof e.reducers==`function`?e.reducers(ZM()):e.reducers)||{},a=Object.keys(i),o={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},s={addCase(e,t){let n=typeof e==`string`?e:e.type;if(!n)throw Error(LN(12));if(n in o.sliceCaseReducersByType)throw Error(LN(13));return o.sliceCaseReducersByType[n]=t,s},addMatcher(e,t){return o.sliceMatchers.push({matcher:e,reducer:t}),s},exposeAction(e,t){return o.actionCreators[e]=t,s},exposeCaseReducer(e,t){return o.sliceCaseReducersByName[e]=t,s}};a.forEach(r=>{let a=i[r],o={reducerName:r,type:qM(n,r),createNotation:typeof e.reducers==`function`};$M(a)?tN(o,a,s,t):QM(o,a,s)});function c(){let[t={},n=[],r=void 0]=typeof e.extraReducers==`function`?VM(e.extraReducers):[e.extraReducers],i={...t,...o.sliceCaseReducersByType};return UM(e.initialState,e=>{for(let t in i)e.addCase(t,i[t]);for(let t of o.sliceMatchers)e.addMatcher(t.matcher,t.reducer);for(let t of n)e.addMatcher(t.matcher,t.reducer);r&&e.addDefaultCase(r)})}let l=e=>e,u=new Map,d=new WeakMap,f;function p(e,t){return f||=c(),f(e,t)}function m(){return f||=c(),f.getInitialState()}function h(t,n=!1){function r(e){let i=e[t];return i===void 0&&n&&(i=jM(d,r,m)),i}function i(t=l){return jM(jM(u,n,()=>new WeakMap),t,()=>{let r={};for(let[i,a]of Object.entries(e.selectors??{}))r[i]=YM(a,t,()=>jM(d,t,m),n);return r})}return{reducerPath:t,getSelectors:i,get selectors(){return i(r)},selectSlice:r}}let g={name:n,reducer:p,actions:o.actionCreators,caseReducers:o.sliceCaseReducersByName,getInitialState:m,...h(r),injectInto(e,{reducerPath:t,...n}={}){let i=t??r;return e.inject({reducerPath:i,reducer:p},n),{...g,...h(i,!0)}}};return g}}function YM(e,t,n,r){function i(i,...a){let o=t(i);return o===void 0&&r&&(o=n()),e(o,...a)}return i.unwrapped=e,i}var XM=JM();function ZM(){function e(e,t){return{_reducerDefinitionType:`asyncThunk`,payloadCreator:e,...t}}return e.withTypes=()=>e,{reducer(e){return Object.assign({[e.name](...t){return e(...t)}}[e.name],{_reducerDefinitionType:`reducer`})},preparedReducer(e,t){return{_reducerDefinitionType:`reducerWithPrepare`,prepare:e,reducer:t}},asyncThunk:e}}function QM({type:e,reducerName:t,createNotation:n},r,i){let a,o;if(`reducer`in r){if(n&&!eN(r))throw Error(LN(17));a=r.reducer,o=r.prepare}else a=r;i.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,o?OM(e,o):OM(e))}function $M(e){return e._reducerDefinitionType===`asyncThunk`}function eN(e){return e._reducerDefinitionType===`reducerWithPrepare`}function tN({type:e,reducerName:t},n,r,i){if(!i)throw Error(LN(18));let{payloadCreator:a,fulfilled:o,pending:s,rejected:c,settled:l,options:u}=n,d=i(e,a,u);r.exposeAction(t,d),o&&r.addCase(d.fulfilled,o),s&&r.addCase(d.pending,s),c&&r.addCase(d.rejected,c),l&&r.addMatcher(d.settled,l),r.exposeCaseReducer(t,{fulfilled:o||nN,pending:s||nN,rejected:c||nN,settled:l||nN})}function nN(){}var rN=`task`,iN=`listener`,aN=`completed`,oN=`cancelled`,sN=`task-${oN}`,cN=`task-${aN}`,lN=`${iN}-${oN}`,uN=`${iN}-${aN}`,dN=class{code;name=`TaskAbortError`;message;constructor(e){this.code=e,this.message=`${rN} ${oN} (reason: ${e})`}},fN=(e,t)=>{if(typeof e!=`function`)throw TypeError(LN(32))},pN=()=>{},mN=(e,t=pN)=>(e.catch(t),e),hN=(e,t)=>(e.addEventListener(`abort`,t,{once:!0}),()=>e.removeEventListener(`abort`,t)),gN=e=>{if(e.aborted)throw new dN(e.reason)};function _N(e,t){let n=pN;return new Promise((r,i)=>{let a=()=>i(new dN(e.reason));if(e.aborted){a();return}n=hN(e,a),t.finally(()=>n()).then(r,i)}).finally(()=>{n=pN})}var vN=async(e,t)=>{try{return await Promise.resolve(),{status:`ok`,value:await e()}}catch(e){return{status:e instanceof dN?`cancelled`:`rejected`,error:e}}finally{t?.()}},yN=e=>t=>mN(_N(e,t).then(t=>(gN(e),t))),bN=e=>{let t=yN(e);return e=>t(new Promise(t=>setTimeout(t,e)))},{assign:xN}=Object,SN={},CN=`listenerMiddleware`,wN=(e,t)=>{let n=t=>hN(e,()=>t.abort(e.reason));return(r,i)=>{fN(r,`taskExecutor`);let a=new AbortController;n(a);let o=vN(async()=>{gN(e),gN(a.signal);let t=await r({pause:yN(a.signal),delay:bN(a.signal),signal:a.signal});return gN(a.signal),t},()=>a.abort(cN));return i?.autoJoin&&t.push(o.catch(pN)),{result:yN(e)(o),cancel(){a.abort(sN)}}}},TN=(e,t)=>{let n=async(n,r)=>{gN(t);let i=()=>{},a=[new Promise((t,r)=>{let a=e({predicate:n,effect:(e,n)=>{n.unsubscribe(),t([e,n.getState(),n.getOriginalState()])}});i=()=>{a(),r()}})];r!=null&&a.push(new Promise(e=>setTimeout(e,r,null)));try{let e=await _N(t,Promise.race(a));return gN(t),e}finally{i()}};return((e,t)=>mN(n(e,t)))},EN=e=>{let{type:t,actionCreator:n,matcher:r,predicate:i,effect:a}=e;if(t)i=OM(t).match;else if(n)t=n.type,i=n.match;else if(r)i=r;else if(!i)throw Error(LN(21));return fN(a,`options.listener`),{predicate:i,type:t,effect:a}},DN=xN(e=>{let{type:t,predicate:n,effect:r}=EN(e);return{id:GM(),effect:r,type:t,predicate:n,pending:new Set,unsubscribe:()=>{throw Error(LN(22))}}},{withTypes:()=>DN}),ON=(e,t)=>{let{type:n,effect:r,predicate:i}=EN(t);return Array.from(e.values()).find(e=>(typeof n==`string`?e.type===n:e.predicate===i)&&e.effect===r)},kN=e=>{e.pending.forEach(e=>{e.abort(lN)})},AN=(e,t)=>()=>{for(let e of t.keys())kN(e);e.clear()},jN=(e,t,n)=>{try{e(t,n)}catch(e){setTimeout(()=>{throw e},0)}},MN=xN(OM(`${CN}/add`),{withTypes:()=>MN}),NN=OM(`${CN}/removeAll`),PN=xN(OM(`${CN}/remove`),{withTypes:()=>PN}),FN=(...e)=>{console.error(`${CN}/error`,...e)},IN=(e={})=>{let t=new Map,n=new Map,r=e=>{let t=n.get(e)??0;n.set(e,t+1)},i=e=>{let t=n.get(e)??1;t===1?n.delete(e):n.set(e,t-1)},{extra:a,onError:o=FN}=e;fN(o,`onError`);let s=e=>(e.unsubscribe=()=>t.delete(e.id),t.set(e.id,e),t=>{e.unsubscribe(),t?.cancelActive&&kN(e)}),c=(e=>{let n=ON(t,e)??DN(e);return s(n)});xN(c,{withTypes:()=>c});let l=e=>{let n=ON(t,e);return n&&(n.unsubscribe(),e.cancelActive&&kN(n)),!!n};xN(l,{withTypes:()=>l});let u=async(e,n,s,l)=>{let u=new AbortController,d=TN(c,u.signal),f=[];try{e.pending.add(u),r(e),await Promise.resolve(e.effect(n,xN({},s,{getOriginalState:l,condition:(e,t)=>d(e,t).then(Boolean),take:d,delay:bN(u.signal),pause:yN(u.signal),extra:a,signal:u.signal,fork:wN(u.signal,f),unsubscribe:e.unsubscribe,subscribe:()=>{t.set(e.id,e)},cancelActiveListeners:()=>{e.pending.forEach((e,t,n)=>{e!==u&&(e.abort(lN),n.delete(e))})},cancel:()=>{u.abort(lN),e.pending.delete(u)},throwIfCancelled:()=>{gN(u.signal)}})))}catch(e){e instanceof dN||jN(o,e,{raisedBy:`effect`})}finally{await Promise.all(f),u.abort(uN),i(e),e.pending.delete(u)}},d=AN(t,n);return{middleware:e=>n=>r=>{if(!tj(r))return n(r);if(MN.match(r))return c(r.payload);if(NN.match(r)){d();return}if(PN.match(r))return l(r.payload);let i=e.getState(),a=()=>{if(i===SN)throw Error(LN(23));return i},s;try{if(s=n(r),t.size>0){let n=e.getState(),s=Array.from(t.values());for(let t of s){let s=!1;try{s=t.predicate(r,n,i)}catch(e){s=!1,jN(o,e,{raisedBy:`predicate`})}s&&u(t,r,e,a)}}}finally{i=SN}return s},startListening:c,stopListening:l,clearListeners:d}};function LN(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var RN=XM({name:`chartLayout`,initialState:{layoutType:`horizontal`,width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){e.margin.top=t.payload.top??0,e.margin.right=t.payload.right??0,e.margin.bottom=t.payload.bottom??0,e.margin.left=t.payload.left??0},setScale(e,t){e.scale=t.payload}}}),{setMargin:zN,setLayout:BN,setChartSize:VN,setScale:HN}=RN.actions,UN=RN.reducer;function WN(e,t,n){return Array.isArray(e)&&e&&t+n!==0?e.slice(t,n+1):e}function GN(e){return Number.isFinite(e)}function KN(e){return typeof e==`number`&&e>0&&Number.isFinite(e)}function qN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function JN(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?qN(Object(n),!0).forEach(function(t){YN(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qN(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function YN(e,t,n){return(t=XN(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XN(e){var t=ZN(e,`string`);return typeof t==`symbol`?t:t+``}function ZN(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function QN(e,t,n){return TO(e)||TO(t)?n:vO(t)?uO(e,t,n):typeof t==`function`?t(e):n}var $N=(e,t,n)=>{if(t&&n){var{width:r,height:i}=n,{align:a,verticalAlign:o,layout:s}=t;if((s===`vertical`||s===`horizontal`&&o===`middle`)&&a!==`center`&&Z(e[a]))return JN(JN({},e),{},{[a]:e[a]+(r||0)});if((s===`horizontal`||s===`vertical`&&a===`center`)&&o!==`middle`&&Z(e[o]))return JN(JN({},e),{},{[o]:e[o]+(i||0)})}return e},eP=(e,t)=>e===`horizontal`&&t===`xAxis`||e===`vertical`&&t===`yAxis`||e===`centric`&&t===`angleAxis`||e===`radial`&&t===`radiusAxis`,tP=(e,t,n,r)=>{if(r)return e.map(e=>e.coordinate);var i,a,o=e.map(e=>(e.coordinate===t&&(i=!0),e.coordinate===n&&(a=!0),e.coordinate));return i||o.push(t),a||o.push(n),o},nP=(e,t,n)=>{if(!e)return null;var{duplicateDomain:r,type:i,range:a,scale:o,realScaleType:s,isCategorical:c,categoricalDomain:l,tickCount:u,ticks:d,niceTicks:f,axisType:p}=e;if(!o)return null;var m=s===`scaleBand`&&o.bandwidth?o.bandwidth()/2:2,h=(t||n)&&i===`category`&&o.bandwidth?o.bandwidth()/m:0;return h=p===`angleAxis`&&a&&a.length>=2?hO(a[0]-a[1])*2*h:h,t&&(d||f)?(d||f||[]).map((e,t)=>{var n=r?r.indexOf(e):e,i=o.map(n);return GN(i)?{coordinate:i+h,value:e,offset:h,index:t}:null}).filter(DO):c&&l?l.map((e,t)=>{var n=o.map(e);return GN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(DO):o.ticks&&!n&&u!=null?o.ticks(u).map((e,t)=>{var n=o.map(e);return GN(n)?{coordinate:n+h,value:e,index:t,offset:h}:null}).filter(DO):o.domain().map((e,t)=>{var n=o.map(e);return GN(n)?{coordinate:n+h,value:r?r[e]:e,index:t,offset:h}:null}).filter(DO)},rP=(e,t)=>{if(!t||t.length!==2||!Z(t[0])||!Z(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!Z(e[0])||e[0]<n)&&(i[0]=n),(!Z(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i},iP={sign:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0,o=0;o<t;++o){var s=e[o]?.[r];if(s!=null){var c=s[1],l=s[0],u=gO(c)?l:c;u>=0?(s[0]=i,i+=u,s[1]=i):(s[0]=a,a+=u,s[1]=a)}}}},expand:ZD,none:KD,silhouette:QD,wiggle:$D,positive:e=>{var t=e.length;if(!(t<=0)){var n=e[0]?.length;if(!(n==null||n<=0))for(var r=0;r<n;++r)for(var i=0,a=0;a<t;++a){var o=e[a]?.[r];if(o!=null){var s=gO(o[1])?o[0]:o[1];s>=0?(o[0]=i,i+=s,o[1]=i):(o[0]=0,o[1]=0)}}}}},aP=(e,t,n)=>{var r=iP[n]??KD,i=XD().keys(t).value((e,t)=>Number(QN(e,t,0))).order(qD).offset(r)(e);return i.forEach((n,r)=>{n.forEach((n,i)=>{var a=QN(e[i],t[r],0);Array.isArray(a)&&a.length===2&&Z(a[0])&&Z(a[1])&&(n[0]=a[0],n[1]=a[1])})}),i};function oP(e){return e==null?void 0:String(e)}var sP=e=>{var{axis:t,ticks:n,offset:r,bandSize:i,entry:a,index:o}=e;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=QN(a,t.dataKey,t.scale.domain()[o]);if(TO(s))return null;var c=t.scale.map(s);return Z(c)?c-i/2+r:null},cP=e=>{var{numericAxis:t}=e,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},lP=e=>{var t=e.flat(2).filter(Z);return[Math.min(...t),Math.max(...t)]},uP=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],dP=(e,t,n)=>{if(e!=null)return uP(Object.keys(e).reduce((r,i)=>{var a=e[i];if(!a)return r;var{stackedData:o}=a,s=o.reduce((e,r)=>{var i=lP(WN(r,t,n));return!GN(i[0])||!GN(i[1])?e:[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(s[0],r[0]),Math.max(s[1],r[1])]},[1/0,-1/0]))},fP=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,pP=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,mP=(e,t,n)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=BA(t,e=>e.coordinate),a=1/0,o=1,s=i.length;o<s;o++){var c=i[o],l=i[o-1];a=Math.min((c?.coordinate||0)-(l?.coordinate||0),a)}return a===1/0?0:a}return n?void 0:0};function hP(e){var{tooltipEntrySettings:t,dataKey:n,payload:r,value:i,name:a}=e;return JN(JN({},t),{},{dataKey:n,payload:r,value:i,name:a})}function gP(e,t){if(e)return String(e);if(typeof t==`string`)return t}var _P=(e,t)=>{if(t===`horizontal`)return e.relativeX;if(t===`vertical`)return e.relativeY},vP=(e,t)=>t===`centric`?e.angle:e.radius,yP=e=>e.layout.width,bP=e=>e.layout.height,xP=e=>e.layout.scale,SP=e=>e.layout.margin,CP=$(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),wP=$(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),TP=`data-recharts-item-index`;function EP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function DP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?EP(Object(n),!0).forEach(function(t){OP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):EP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function OP(e,t,n){return(t=kP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kP(e){var t=AP(e,`string`);return typeof t==`symbol`?t:t+``}function AP(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var jP=e=>e.brush.height;function MP(e){return wP(e).reduce((e,t)=>t.orientation===`left`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function NP(e){return wP(e).reduce((e,t)=>t.orientation===`right`&&!t.mirror&&!t.hide?e+(typeof t.width==`number`?t.width:60):e,0)}function PP(e){return CP(e).reduce((e,t)=>t.orientation===`top`&&!t.mirror&&!t.hide?e+t.height:e,0)}function FP(e){return CP(e).reduce((e,t)=>t.orientation===`bottom`&&!t.mirror&&!t.hide?e+t.height:e,0)}var IP=$([yP,bP,SP,jP,MP,NP,PP,FP,VA,HA],(e,t,n,r,i,a,o,s,c,l)=>{var u={left:(n.left||0)+i,right:(n.right||0)+a},d=DP(DP({},{top:(n.top||0)+o,bottom:(n.bottom||0)+s}),u),f=d.bottom;d.bottom+=r,d=$N(d,c,l);var p=e-d.left-d.right,m=t-d.top-d.bottom;return DP(DP({brushBottom:f},d),{},{width:Math.max(p,0),height:Math.max(m,0)})}),LP=$(IP,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),RP=$(yP,bP,(e,t)=>({x:0,y:0,width:e,height:t})),zP=(0,v.createContext)(null),BP=()=>(0,v.useContext)(zP)!=null,VP=e=>e.brush,HP=$([VP,IP,SP],(e,t,n)=>({height:e.height,x:Z(e.x)?e.x:t.left,y:Z(e.y)?e.y:t.top+t.height+t.brushBottom-(n?.bottom||0),width:Z(e.width)?e.width:t.width}));function UP(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function WP(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=UP(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?((r||i)&&(s=e.apply(this,t)),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function GP(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return WP(e,t,{leading:r,maxWait:t,trailing:i})}var KP=function(e,t){var n=[...arguments].slice(2);if(typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e)){if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,()=>n[r++]))}}},qP={width:`100%`,height:`100%`,debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},JP=(e,t,n)=>{var{width:r=qP.width,height:i=qP.height,aspect:a,maxHeight:o}=n,s=_O(r)?e:Number(r),c=_O(i)?t:Number(i);return a&&a>0&&(s?c=s/a:c&&(s=c*a),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:s,calculatedHeight:c}},YP={width:0,height:0,overflow:`visible`},XP={width:0,overflowX:`visible`},ZP={height:0,overflowY:`visible`},QP={},$P=e=>{var{width:t,height:n}=e,r=_O(t),i=_O(n);return r&&i?YP:r?XP:i?ZP:QP};function eF(e){var{width:t,height:n,aspect:r}=e,i=t,a=n;return i===void 0&&a===void 0?(i=qP.width,a=qP.height):i===void 0?i=r&&r>0?void 0:qP.width:a===void 0&&(a=r&&r>0?void 0:qP.height),{width:i,height:a}}function tF(){return tF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tF.apply(null,arguments)}function nF(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rF(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?nF(Object(n),!0).forEach(function(t){iF(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nF(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function iF(e,t,n){return(t=aF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aF(e){var t=oF(e,`string`);return typeof t==`symbol`?t:t+``}function oF(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var sF=(0,v.createContext)(qP.initialDimension);function cF(e){return KN(e.width)&&KN(e.height)}function lF(e){var{children:t,width:n,height:r}=e,i=(0,v.useMemo)(()=>({width:n,height:r}),[n,r]);return cF(i)?v.createElement(sF.Provider,{value:i},t):null}var uF=()=>(0,v.useContext)(sF),dF=(0,v.forwardRef)((e,t)=>{var{aspect:n,initialDimension:r=qP.initialDimension,width:i,height:a,minWidth:o=qP.minWidth,minHeight:s,maxHeight:c,children:l,debounce:u=qP.debounce,id:d,className:f,onResize:p,style:m={}}=e,h=(0,v.useRef)(null),g=(0,v.useRef)();g.current=p,(0,v.useImperativeHandle)(t,()=>h.current);var[_,y]=(0,v.useState)({containerWidth:r.width,containerHeight:r.height}),b=(0,v.useCallback)((e,t)=>{y(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]);(0,v.useEffect)(()=>{if(h.current==null||typeof ResizeObserver>`u`)return OO;var e=e=>{var t,n=e[0];if(n!=null){var{width:r,height:i}=n.contentRect;b(r,i),(t=g.current)==null||t.call(g,r,i)}};u>0&&(e=GP(e,u,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),{width:n,height:r}=h.current.getBoundingClientRect();return b(n,r),t.observe(h.current),()=>{t.disconnect()}},[b,u]);var{containerWidth:x,containerHeight:S}=_;KP(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var{calculatedWidth:C,calculatedHeight:w}=JP(x,S,{width:i,height:a,aspect:n,maxHeight:c});return KP(C!=null&&C>0||w!=null&&w>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
|
132
132
|
please check the style of container, or the props width(%s) and height(%s),
|
|
133
133
|
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
|
|
134
134
|
height and width.`,C,w,i,a,o,s,n),v.createElement(`div`,{id:d?`${d}`:void 0,className:Xt(`recharts-responsive-container`,f),style:rF(rF({},m),{},{width:i,height:a,minWidth:o,minHeight:s,maxHeight:c}),ref:h},v.createElement(`div`,{style:$P({width:i,height:a})},v.createElement(lF,{width:C,height:w},l)))}),fF=(0,v.forwardRef)((e,t)=>{var n=uF();if(KN(n.width)&&KN(n.height))return e.children;var{width:r,height:i}=eF({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:a,calculatedHeight:o}=JP(void 0,void 0,{width:r,height:i,aspect:e.aspect,maxHeight:e.maxHeight});return Z(a)&&Z(o)?v.createElement(lF,{width:a,height:o},e.children):v.createElement(dF,tF({},e,{width:r,height:i,ref:t}))});function pF(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var mF=()=>{var e=BP(),t=Q(LP),n=Q(HP),r=Q(VP)?.padding;return!e||!n||!r?t:{width:n.width-r.left-r.right,height:n.height-r.top-r.bottom,x:r.left,y:r.top}},hF={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},gF=()=>Q(IP)??hF,_F=()=>Q(yP),vF=()=>Q(bP),yF=e=>e.layout.layoutType,bF=()=>Q(yF),xF=()=>{var e=bF();if(e===`horizontal`||e===`vertical`)return e},SF=e=>{var t=e.layout.layoutType;if(t===`centric`||t===`radial`)return t},CF=()=>bF()!==void 0,wF=e=>{var t=pA(),n=BP(),{width:r,height:i}=e,a=uF(),o=r,s=i;return a&&(o=a.width>0?a.width:r,s=a.height>0?a.height:i),(0,v.useEffect)(()=>{!n&&KN(o)&&KN(s)&&t(VN({width:o,height:s}))},[t,n,o,s]),null},TF=Symbol.for(`immer-nothing`),EF=Symbol.for(`immer-draftable`),DF=Symbol.for(`immer-state`);function OF(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var kF=Object.getPrototypeOf;function AF(e){return!!e&&!!e[DF]}function jF(e){return e?PF(e)||Array.isArray(e)||!!e[EF]||!!e.constructor?.[EF]||BF(e)||VF(e):!1}var MF=Object.prototype.constructor.toString(),NF=new WeakMap;function PF(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;if(n===Object)return!0;if(typeof n!=`function`)return!1;let r=NF.get(n);return r===void 0&&(r=Function.toString.call(n),NF.set(n,r)),r===MF}function FF(e,t,n=!0){IF(e)===0?(n?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function IF(e){let t=e[DF];return t?t.type_:Array.isArray(e)?1:BF(e)?2:VF(e)?3:0}function LF(e,t){return IF(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function RF(e,t,n){let r=IF(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function zF(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function BF(e){return e instanceof Map}function VF(e){return e instanceof Set}function HF(e){return e.copy_||e.base_}function UF(e,t){if(BF(e))return new Map(e);if(VF(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=PF(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[DF];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(kF(e),t)}{let t=kF(e);if(t!==null&&n)return{...e};let r=Object.create(t);return Object.assign(r,e)}}function WF(e,t=!1){return qF(e)||AF(e)||!jF(e)?e:(IF(e)>1&&Object.defineProperties(e,{set:KF,add:KF,clear:KF,delete:KF}),Object.freeze(e),t&&Object.values(e).forEach(e=>WF(e,!0)),e)}function GF(){OF(2)}var KF={value:GF};function qF(e){return typeof e!=`object`||!e||Object.isFrozen(e)}var JF={};function YF(e){let t=JF[e];return t||OF(0,e),t}var XF;function ZF(){return XF}function QF(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function $F(e,t){t&&(YF(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function eI(e){tI(e),e.drafts_.forEach(rI),e.drafts_=null}function tI(e){e===XF&&(XF=e.parent_)}function nI(e){return XF=QF(XF,e)}function rI(e){let t=e[DF];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function iI(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[DF].modified_&&(eI(t),OF(4)),jF(e)&&(e=aI(t,e),t.parent_||sI(t,e)),t.patches_&&YF(`Patches`).generateReplacementPatches_(n[DF].base_,e,t.patches_,t.inversePatches_)):e=aI(t,n,[]),eI(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===TF?void 0:e}function aI(e,t,n){if(qF(t))return t;let r=e.immer_.shouldUseStrictIteration(),i=t[DF];if(!i)return FF(t,(r,a)=>oI(e,i,t,r,a,n),r),t;if(i.scope_!==e)return t;if(!i.modified_)return sI(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let t=i.copy_,a=t,o=!1;i.type_===3&&(a=new Set(t),t.clear(),o=!0),FF(a,(r,a)=>oI(e,i,t,r,a,n,o),r),sI(e,t,!1),n&&e.patches_&&YF(`Patches`).generatePatches_(i,n,e.patches_,e.inversePatches_)}return i.copy_}function oI(e,t,n,r,i,a,o){if(i==null||typeof i!=`object`&&!o)return;let s=qF(i);if(!(s&&!o)){if(AF(i)){let o=aI(e,i,a&&t&&t.type_!==3&&!LF(t.assigned_,r)?a.concat(r):void 0);if(RF(n,r,o),AF(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(jF(i)&&!s){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[r]===i&&s)return;aI(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&(BF(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&sI(e,i)}}}function sI(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&WF(t,n)}function cI(e,t){let n=Array.isArray(e),r={type_:+!!n,scope_:t?t.scope_:ZF(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=lI;n&&(i=[r],a=uI);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var lI={get(e,t){if(t===DF)return e;let n=HF(e);if(!LF(n,t))return fI(e,n,t);let r=n[t];return e.finalized_||!jF(r)?r:r===dI(e.base_,t)?(hI(e),e.copy_[t]=_I(r,e)):r},has(e,t){return t in HF(e)},ownKeys(e){return Reflect.ownKeys(HF(e))},set(e,t,n){let r=pI(HF(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=dI(HF(e),t),i=r?.[DF];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(zF(n,r)&&(n!==void 0||LF(e.base_,t)))return!0;hI(e),mI(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])?!0:(e.copy_[t]=n,e.assigned_[t]=!0,!0)},deleteProperty(e,t){return dI(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,hI(e),mI(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=HF(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){OF(11)},getPrototypeOf(e){return kF(e.base_)},setPrototypeOf(){OF(12)}},uI={};FF(lI,(e,t)=>{uI[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),uI.deleteProperty=function(e,t){return uI.set.call(this,e,t,void 0)},uI.set=function(e,t,n){return lI.set.call(this,e[0],t,n,e[0])};function dI(e,t){let n=e[DF];return(n?HF(n):e)[t]}function fI(e,t,n){let r=pI(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function pI(e,t){if(!(t in e))return;let n=kF(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=kF(n)}}function mI(e){e.modified_||(e.modified_=!0,e.parent_&&mI(e.parent_))}function hI(e){e.copy_||=UF(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var gI=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&OF(6),n!==void 0&&typeof n!=`function`&&OF(7);let r;if(jF(e)){let i=nI(this),a=_I(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?eI(i):tI(i)}return $F(i,n),iI(r,i)}if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===TF&&(r=void 0),this.autoFreeze_&&WF(r,!0),n){let t=[],i=[];YF(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}OF(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration==`boolean`&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){jF(e)||OF(8),AF(e)&&(e=vI(e));let t=nI(this),n=_I(e,void 0);return n[DF].isManual_=!0,tI(t),n}finishDraft(e,t){let n=e&&e[DF];(!n||!n.isManual_)&&OF(9);let{scope_:r}=n;return $F(r,t),iI(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=YF(`Patches`).applyPatches_;return AF(e)?r(e,t):this.produce(e,e=>r(e,t))}};function _I(e,t){let n=BF(e)?YF(`MapSet`).proxyMap_(e,t):VF(e)?YF(`MapSet`).proxySet_(e,t):cI(e,t);return(t?t.scope_:ZF()).drafts_.push(n),n}function vI(e){return AF(e)||OF(10,e),yI(e)}function yI(e){if(!jF(e)||qF(e))return e;let t=e[DF],n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=UF(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=UF(e,!0);return FF(n,(e,t)=>{RF(n,e,yI(t))},r),t&&(t.finalized_=!1),n}new gI().produce;function bI(e){return e}var xI=XM({name:`legend`,initialState:{settings:{layout:`horizontal`,align:`center`,verticalAlign:`middle`,itemSorter:`value`},size:{width:0,height:0},payload:[]},reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(bI(t.payload))},prepare:FM()},replaceLegendPayload:{reducer(e,t){var{prev:n,next:r}=t.payload,i=xM(e).payload.indexOf(bI(n));i>-1&&(e.payload[i]=bI(r))},prepare:FM()},removeLegendPayload:{reducer(e,t){var n=xM(e).payload.indexOf(bI(t.payload));n>-1&&e.payload.splice(n,1)},prepare:FM()}}}),{setLegendSize:SI,setLegendSettings:CI,addLegendPayload:wI,replaceLegendPayload:TI,removeLegendPayload:EI}=xI.actions,DI=xI.reducer,OI=o((e=>{var t=d();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));o(((e,t)=>{t.exports=OI()}))();function kI(e){e()}function AI(){let e=null,t=null;return{clear(){e=null,t=null},notify(){kI(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var jI={notify(){},get:()=>[]};function MI(e,t){let n,r=jI,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=AI())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=jI)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var NI=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,PI=typeof navigator<`u`&&navigator.product===`ReactNative`,FI=NI||PI?v.useLayoutEffect:v.useEffect;function II(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function LI(e,t){if(II(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!II(e[n[r]],t[n[r]]))return!1;return!0}var RI=Symbol.for(`react-redux-context`),zI=typeof globalThis<`u`?globalThis:{};function BI(){if(!v.createContext)return{};let e=zI[RI]??=new Map,t=e.get(v.createContext);return t||(t=v.createContext(null),e.set(v.createContext,t)),t}var VI=BI();function HI(e){let{children:t,context:n,serverState:r,store:i}=e,a=v.useMemo(()=>{let e=MI(i);return{store:i,subscription:e,getServerState:r==null?void 0:()=>r}},[i,r]),o=v.useMemo(()=>i.getState(),[i]);FI(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||VI;return v.createElement(s.Provider,{value:a},t)}var UI=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function WI(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function GI(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(UI.has(n)){if(e[n]==null&&t[n]==null)continue;if(!LI(e[n],t[n]))return!1}else if(!WI(e[n],t[n]))return!1;return!0}function KI(){return KI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},KI.apply(null,arguments)}function qI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function JI(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?qI(Object(n),!0).forEach(function(t){YI(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qI(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function YI(e,t,n){return(t=XI(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XI(e){var t=ZI(e,`string`);return typeof t==`symbol`?t:t+``}function ZI(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function QI(e){return Array.isArray(e)&&vO(e[0])&&vO(e[1])?e.join(` ~ `):e}var $I={separator:` : `,contentStyle:{margin:0,padding:10,backgroundColor:`#fff`,border:`1px solid #ccc`,whiteSpace:`nowrap`},itemStyle:{display:`block`,paddingTop:4,paddingBottom:4,color:`#000`},labelStyle:{},accessibilityLayer:!1};function eL(e,t){return t==null?e:BA(e,t)}var tL=e=>{var{separator:t=$I.separator,contentStyle:n,itemStyle:r,labelStyle:i=$I.labelStyle,payload:a,formatter:o,itemSorter:s,wrapperClassName:c,labelClassName:l,label:u,labelFormatter:d,accessibilityLayer:f=$I.accessibilityLayer}=e,p=()=>{if(a&&a.length){var e={padding:0,margin:0},n=eL(a,s).map((e,n)=>{if(e.type===`none`)return null;var i=e.formatter||o||QI,{value:s,name:c}=e,l=s,u=c;if(i){var d=i(s,c,e,n,a);if(Array.isArray(d))[l,u]=d;else if(d!=null)l=d;else return null}var f=JI(JI({},$I.itemStyle),{},{color:e.color||$I.itemStyle.color},r);return v.createElement(`li`,{className:`recharts-tooltip-item`,key:`tooltip-item-${n}`,style:f},vO(u)?v.createElement(`span`,{className:`recharts-tooltip-item-name`},u):null,vO(u)?v.createElement(`span`,{className:`recharts-tooltip-item-separator`},t):null,v.createElement(`span`,{className:`recharts-tooltip-item-value`},l),v.createElement(`span`,{className:`recharts-tooltip-item-unit`},e.unit||``))});return v.createElement(`ul`,{className:`recharts-tooltip-item-list`,style:e},n)}return null},m=JI(JI({},$I.contentStyle),n),h=JI({margin:0},i),g=!TO(u),_=g?u:``,y=Xt(`recharts-default-tooltip`,c),b=Xt(`recharts-tooltip-label`,l);g&&d&&a!=null&&(_=d(u,a));var x=f?{role:`status`,"aria-live":`assertive`}:{};return v.createElement(`div`,KI({className:y,style:m},x),v.createElement(`p`,{className:b,style:h},v.isValidElement(_)?_:`${_}`),p())},nL=`recharts-tooltip-wrapper`,rL={visibility:`hidden`};function iL(e){var{coordinate:t,translateX:n,translateY:r}=e;return Xt(nL,{[`${nL}-right`]:Z(n)&&t&&Z(t.x)&&n>=t.x,[`${nL}-left`]:Z(n)&&t&&Z(t.x)&&n<t.x,[`${nL}-bottom`]:Z(r)&&t&&Z(t.y)&&r>=t.y,[`${nL}-top`]:Z(r)&&t&&Z(t.y)&&r<t.y})}function aL(e){var{allowEscapeViewBox:t,coordinate:n,key:r,offset:i,position:a,reverseDirection:o,tooltipDimension:s,viewBox:c,viewBoxDimension:l}=e;if(a&&Z(a[r]))return a[r];var u=n[r]-s-(i>0?i:0),d=n[r]+i;if(t[r])return o[r]?u:d;var f=c[r];return f==null?0:o[r]?Math.max(u<f?d:u,f):l==null?0:d+s>f+l?Math.max(u,f):Math.max(d,f)}function oL(e){var{translateX:t,translateY:n,useTranslate3d:r}=e;return{transform:r?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function sL(e){var{allowEscapeViewBox:t,coordinate:n,offsetTop:r,offsetLeft:i,position:a,reverseDirection:o,tooltipBox:s,useTranslate3d:c,viewBox:l}=e,u,d,f;return s.height>0&&s.width>0&&n?(d=aL({allowEscapeViewBox:t,coordinate:n,key:`x`,offset:i,position:a,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=aL({allowEscapeViewBox:t,coordinate:n,key:`y`,offset:r,position:a,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=oL({translateX:d,translateY:f,useTranslate3d:c})):u=rL,{cssProperties:u,cssClasses:iL({translateX:d,translateY:f,coordinate:n})}}var cL={devToolsEnabled:!0,isSsr:!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)};function lL(){var[e,t]=(0,v.useState)(()=>cL.isSsr||!window.matchMedia?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches);return(0,v.useEffect)(()=>{if(window.matchMedia){var e=window.matchMedia(`(prefers-reduced-motion: reduce)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}}},[]),e}function uL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?uL(Object(n),!0).forEach(function(t){fL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fL(e,t,n){return(t=pL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pL(e){var t=mL(e,`string`);return typeof t==`symbol`?t:t+``}function mL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function hL(e){if(!(e.prefersReducedMotion&&e.isAnimationActive===`auto`)&&e.isAnimationActive&&e.active)return`transform ${e.animationDuration}ms ${e.animationEasing}`}function gL(e){var t=lL(),[n,r]=v.useState(()=>({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}));v.useEffect(()=>{var t=t=>{t.key===`Escape`&&r({dismissed:!0,dismissedAtCoordinate:{x:e.coordinate?.x??0,y:e.coordinate?.y??0}})};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e.coordinate?.x,e.coordinate?.y]),n.dismissed&&((e.coordinate?.x??0)!==n.dismissedAtCoordinate.x||(e.coordinate?.y??0)!==n.dismissedAtCoordinate.y)&&r(dL(dL({},n),{},{dismissed:!1}));var{cssClasses:i,cssProperties:a}=sL({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset==`number`?e.offset:e.offset.x,offsetTop:typeof e.offset==`number`?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),o=dL(dL({},e.hasPortalFromProps?{}:dL(dL({transition:hL({prefersReducedMotion:t,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},a),{},{pointerEvents:`none`,position:`absolute`,top:0,left:0})),{},{visibility:!n.dismissed&&e.active&&e.hasPayload?`visible`:`hidden`},e.wrapperStyle);return v.createElement(`div`,{xmlns:`http://www.w3.org/1999/xhtml`,tabIndex:-1,className:i,style:o,ref:e.innerRef},e.children)}var _L=v.memo(gL),vL=()=>Q(e=>e.rootProps.accessibilityLayer)??!0;function yL(){return yL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yL.apply(null,arguments)}function bL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?bL(Object(n),!0).forEach(function(t){SL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function SL(e,t,n){return(t=CL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function CL(e){var t=wL(e,`string`);return typeof t==`symbol`?t:t+``}function wL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var TL={curveBasisClosed:TD,curveBasisOpen:DD,curveBasis:CD,curveBumpX:$E,curveBumpY:eD,curveLinearClosed:kD,curveLinear:qE,curveMonotoneX:LD,curveMonotoneY:RD,curveNatural:VD,curveStep:UD,curveStepAfter:GD,curveStepBefore:WD},EL=e=>GN(e.x)&&GN(e.y),DL=e=>e.base!=null&&EL(e.base)&&EL(e),OL=e=>e.x,kL=e=>e.y,AL=(e,t)=>{if(typeof e==`function`)return e;var n=`curve${EO(e)}`;if((n===`curveMonotone`||n===`curveBump`)&&t){var r=TL[`${n}${t===`vertical`?`Y`:`X`}`];if(r)return r}return TL[n]||qE},jL={connectNulls:!1,type:`linear`},ML=e=>{var{type:t=jL.type,points:n=[],baseLine:r,layout:i,connectNulls:a=jL.connectNulls}=e,o=AL(t,i),s=a?n.filter(EL):n;if(Array.isArray(r)){var c,l=n.map((e,t)=>xL(xL({},e),{},{base:r[t]}));return c=i===`vertical`?ZE().y(kL).x1(OL).x0(e=>e.base.x):ZE().x(OL).y1(kL).y0(e=>e.base.y),c.defined(DL).curve(o)(a?l.filter(DL):l)}return(i===`vertical`&&Z(r)?ZE().y(kL).x1(OL).x0(r):Z(r)?ZE().x(OL).y1(kL).y0(r):XE().x(OL).y(kL)).defined(EL).curve(o)(s)},NL=e=>{var{className:t,points:n,path:r,pathRef:i}=e,a=bF();if((!n||!n.length)&&!r)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||a,connectNulls:e.connectNulls},s=n&&n.length?ML(o):r;return v.createElement(`path`,yL({},_E(e),GO(e),{className:Xt(`recharts-curve`,t),d:s===null?void 0:s,ref:i}))},PL=[`x`,`y`,`top`,`left`,`width`,`height`,`className`];function FL(){return FL=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},FL.apply(null,arguments)}function IL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function LL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?IL(Object(n),!0).forEach(function(t){RL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RL(e,t,n){return(t=zL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zL(e){var t=BL(e,`string`);return typeof t==`symbol`?t:t+``}function BL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function VL(e,t){if(e==null)return{};var n,r,i=HL(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function HL(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var UL=(e,t,n,r,i,a)=>`M${e},${i}v${r}M${a},${t}h${n}`,WL=e=>{var{x:t=0,y:n=0,top:r=0,left:i=0,width:a=0,height:o=0,className:s}=e,c=VL(e,PL),l=LL({x:t,y:n,top:r,left:i,width:a,height:o},c);return!Z(t)||!Z(n)||!Z(a)||!Z(o)||!Z(r)||!Z(i)?null:v.createElement(`path`,FL({},yE(l),{className:Xt(`recharts-cross`,s),d:UL(t,n,a,o,r,i)}))};function GL(e,t,n,r){var i=r/2;return{stroke:`none`,fill:`#ccc`,x:e===`horizontal`?t.x-i:n.left+.5,y:e===`horizontal`?n.top+.5:t.y-i,width:e===`horizontal`?r:n.width-1,height:e===`horizontal`?n.height-1:r}}function KL(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qL(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?KL(Object(n),!0).forEach(function(t){JL(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function JL(e,t,n){return(t=YL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function YL(e){var t=XL(e,`string`);return typeof t==`symbol`?t:t+``}function XL(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var ZL=e=>e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`),QL=(e,t,n)=>e.map(e=>`${ZL(e)} ${t}ms ${n}`).join(`,`),$L=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((e,t)=>e.filter(e=>t.includes(e))),eR=(e,t)=>Object.keys(t).reduce((n,r)=>qL(qL({},n),{},{[r]:e(r,t[r])}),{});function tR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tR(Object(n),!0).forEach(function(t){rR(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rR(e,t,n){return(t=iR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iR(e){var t=aR(e,`string`);return typeof t==`symbol`?t:t+``}function aR(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var oR=(e,t,n)=>e+(t-e)*n,sR=e=>{var{from:t,to:n}=e;return t!==n},cR=(e,t,n)=>{var r=eR((t,n)=>{if(sR(n)){var[r,i]=e(n.from,n.to,n.velocity);return nR(nR({},n),{},{from:r,velocity:i})}return n},t);return n<1?eR((e,t)=>sR(t)&&r[e]!=null?nR(nR({},t),{},{velocity:oR(t.velocity,r[e].velocity,n),from:oR(t.from,r[e].from,n)}):t,t):cR(e,r,n-1)};function lR(e,t,n,r,i,a){var o,s=r.reduce((n,r)=>nR(nR({},n),{},{[r]:{from:e[r],velocity:0,to:t[r]}}),{}),c=()=>eR((e,t)=>t.from,s),l=()=>!Object.values(s).filter(sR).length,u=null,d=r=>{o||=r;var f=(r-o)/n.dt;s=cR(n,s,f),i(nR(nR(nR({},e),t),c())),o=r,l()||(u=a.setTimeout(d))};return()=>(u=a.setTimeout(d),()=>{var e;(e=u)==null||e()})}function uR(e,t,n,r,i,a,o){var s=null,c=i.reduce((n,r)=>{var i=e[r],a=t[r];return i==null||a==null?n:nR(nR({},n),{},{[r]:[i,a]})},{}),l,u=i=>{l||=i;var d=(i-l)/r,f=eR((e,t)=>oR(...t,n(d)),c);if(a(nR(nR(nR({},e),t),f)),d<1)s=o.setTimeout(u);else{var p=eR((e,t)=>oR(...t,n(1)),c);a(nR(nR(nR({},e),t),p))}};return()=>(s=o.setTimeout(u),()=>{var e;(e=s)==null||e()})}var dR=(e,t,n,r,i,a)=>{var o=$L(e,t);return n==null?()=>(i(nR(nR({},e),t)),()=>{}):n.isStepper===!0?lR(e,t,n,o,i,a):uR(e,t,n,r,o,i,a)},fR=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],pR=(e,t)=>e.map((e,n)=>e*t**n).reduce((e,t)=>e+t),mR=(e,t)=>n=>pR(fR(e,t),n),hR=(e,t)=>n=>pR([...fR(e,t).map((e,t)=>e*t).slice(1),0],n),gR=e=>{var t,n=e.split(`(`);if(n.length!==2||n[0]!==`cubic-bezier`)return null;var r=(t=n[1])==null||(t=t.split(`)`)[0])==null?void 0:t.split(`,`);if(r==null||r.length!==4)return null;var i=r.map(e=>parseFloat(e));return[i[0],i[1],i[2],i[3]]},_R=function(){var e=[...arguments];if(e.length===1)switch(e[0]){case`linear`:return[0,0,1,1];case`ease`:return[.25,.1,.25,1];case`ease-in`:return[.42,0,1,1];case`ease-out`:return[.42,0,.58,1];case`ease-in-out`:return[0,0,.58,1];default:var t=gR(e[0]);if(t)return t}return e.length===4?e:[0,0,1,1]},vR=(e,t,n,r)=>{var i=mR(e,n),a=mR(t,r),o=hR(e,n),s=e=>e>1?1:e<0?0:e,c=e=>{for(var t=e>1?1:e,n=t,r=0;r<8;++r){var c=i(n)-t,l=o(n);if(Math.abs(c-t)<1e-4||l<1e-4)return a(n);n=s(n-c/l)}return a(n)};return c.isStepper=!1,c},yR=function(){return vR(..._R(...arguments))},bR=function(){var{stiff:e=100,damping:t=8,dt:n=17}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=(r,i,a)=>{var o=a+(-(r-i)*e-a*t)*n/1e3,s=a*n/1e3+r;return Math.abs(s-i)<1e-4&&Math.abs(o)<1e-4?[i,0]:[s,o]};return r.isStepper=!0,r.dt=n,r},xR=e=>{if(typeof e==`string`)switch(e){case`ease`:case`ease-in-out`:case`ease-out`:case`ease-in`:case`linear`:return yR(e);case`spring`:return bR();default:if(e.split(`(`)[0]===`cubic-bezier`)return yR(e)}return typeof e==`function`?e:null};function SR(e){var t,n=()=>null,r=!1,i=null,a=o=>{if(!r){if(Array.isArray(o)){if(!o.length)return;var[s,...c]=o;if(typeof s==`number`){i=e.setTimeout(a.bind(null,c),s);return}a(s),i=e.setTimeout(a.bind(null,c));return}typeof o==`string`&&(t=o,n(t)),typeof o==`object`&&(t=o,n(t)),typeof o==`function`&&o()}};return{stop:()=>{r=!0},start:e=>{r=!1,i&&=(i(),null),a(e)},subscribe:e=>(n=e,()=>{n=()=>null}),getTimeoutController:()=>e}}var CR=class{setTimeout(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),r=null,i=a=>{a-n>=t?e(a):typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(i))};return r=requestAnimationFrame(i),()=>{r!=null&&cancelAnimationFrame(r)}}};function wR(){return SR(new CR)}var TR=(0,v.createContext)(wR);function ER(e,t){var n=(0,v.useContext)(TR);return(0,v.useMemo)(()=>t??n(e),[e,t,n])}var DR={begin:0,duration:1e3,easing:`ease`,isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},OR={t:0},kR={t:1};function AR(e){var t=$O(e,DR),{isActive:n,canBegin:r,duration:i,easing:a,begin:o,onAnimationEnd:s,onAnimationStart:c,children:l}=t,u=lL(),d=n===`auto`?!cL.isSsr&&!u:n,f=ER(t.animationId,t.animationManager),[p,m]=(0,v.useState)(d?OR:kR),h=(0,v.useRef)(null);return(0,v.useEffect)(()=>{d||m(kR)},[d]),(0,v.useEffect)(()=>{if(!d||!r)return OO;var e=dR(OR,kR,xR(a),i,m,f.getTimeoutController());return f.start([c,o,()=>{h.current=e()},i,s]),()=>{f.stop(),h.current&&h.current(),s()}},[d,r,i,a,o,c,s,f]),l(p.t)}function jR(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`animation-`,n=(0,v.useRef)(bO(t)),r=(0,v.useRef)(e);return r.current!==e&&(n.current=bO(t),r.current=e),n.current}var MR=[`radius`],NR=[`radius`],PR,FR,IR,LR,RR,zR,BR,VR,HR,UR;function WR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GR(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?WR(Object(n),!0).forEach(function(t){KR(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WR(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function KR(e,t,n){return(t=qR(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qR(e){var t=JR(e,`string`);return typeof t==`symbol`?t:t+``}function JR(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function YR(){return YR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},YR.apply(null,arguments)}function XR(e,t){if(e==null)return{};var n,r,i=ZR(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ZR(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function QR(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var $R=(e,t,n,r,i)=>{var a=pO(n),o=pO(r),s=Math.min(Math.abs(a)/2,Math.abs(o)/2),c=o>=0?1:-1,l=a>=0?1:-1,u=+(o>=0&&a>=0||o<0&&a<0),d;if(s>0&&Array.isArray(i)){for(var f=[0,0,0,0],p=0,m=4;p<m;p++){var h=i[p]??0;f[p]=h>s?s:h}d=mO(PR||=QR([`M`,`,`,``]),e,t+c*f[0]),f[0]>0&&(d+=mO(FR||=QR([`A `,`,`,`,0,0,`,`,`,`,`,``]),f[0],f[0],u,e+l*f[0],t)),d+=mO(IR||=QR([`L `,`,`,``]),e+n-l*f[1],t),f[1]>0&&(d+=mO(LR||=QR([`A `,`,`,`,0,0,`,`,
|