dsh-cost-meter 1.9.7 → 1.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/docs/update-notes-1.9.8.md +49 -0
- package/docs/update-notes-1.9.9.md +37 -0
- package/lib/client.js +5 -5
- package/lib/index.js +60 -28
- package/package.json +3 -1
package/lib/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated from src/client/*.js by node scripts/build.mjs; do not edit.
|
|
2
|
-
window.__ModuleLoader__.load({id:"dsh-cost-meter",factory:dt=>{var ba={exports:{}},Mt=ba.exports;Object.defineProperty(Mt,Symbol.toStringTag,{value:"Module"});const Te=dt("react"),{Tooltip:$}=dt("@deepseek-ai/dsh-client-ui-primitives"),mt=!1,Cn="var(--dsw-alias-~.cm-~background:~align-items:center;~font-size:~border-radius:~display:flex;~display:~align-items:~flex-direction:column;~padding:~min-width:~font-weight:~overflow:hidden;~white-space:nowrap;~line-height:~justify-content:~max-width:~text-overflow:ellipsis~gap:~border:~white-space:nowrap~font-variant-numeric:tabular-nums~width:100%;~flex:none;~cursor:pointer~var(--dsh-frame-top-clearance,0px)~margin:~height:100%;~position:relative;~flex-wrap:wrap;~box-sizing:border-box~transform:translate(-50%);~grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));~position:absolute;~flex-wrap:wrap~text-align:right;~overflow:hidden~flex-wrap:nowrap;~font:inherit;~overflow-wrap:anywhere~padding-bottom:env(safe-area-inset-bottom)~flex:0 1 auto;~left:50%;~border-right:5px solid transparent;~border-left:5px solid transparent;~transform:translate(-50%,-50%);~grid-template-columns:1fr;~margin-top:4px~overflow:auto;~var(--cm-opaque-base,#fff)~grid-template-columns:1fr~transition:left .4s ease;~flex-shrink:0~transition:top .4s ease;~flex:none~grid-auto-flow:column;~outline:none~border-color:#34a853~height:6px;~height:8px;~var(--cm-dialog-top)~width:40px;~outline-offset:1px~text-align:center;~width:auto~user-select:none;~grid-column:1/-1~margin-top:6px~height:4px~z-index:2".split("~"),ga='@property --cm-dialog-top{syntax:"<length>";inherits:true;initial-value:0px}Ɓstat-dialog{--cm-dialog-top:var(--dsh-frame-chrome-top,ƚ);inset:ƽ 0 0 0;ƛauto;width:min(1000px,94vw);Ƒcalc(100vw - 32px);max-height:calc(100vh - ƽ - 32px);ƍƟ;Ɗ0;ƅ16px;Ɣ1px solid ƀborder-l1);color:ƀlabel-primary);Ƃƀbg-layer-2,ƀbg-base,#fff))}Ɓstat-dialog[open]{Ɔflex-direction:column}Ɓloading{Ɗ24px;min-height:160px;Ƈgrid;Ɠ18px}Ɓloading i{height:18px;ƅ5px;Ƃƀbg-layer-1,#f2f3f5)}Ɓloading i:first-child{width:35%}Ɓloading i:last-child{width:65%}Ɓstat-dialog-head{ƆƃƐspace-between;Ɠ16px;Ɗ16px 24px;border-bottom:1px solid ƀborder-l3);Ʒ}Ɓstat-dialog-head strong{Ƅ15px;ƌ500}Ɓstat-dialog-body{Ʊmin-height:0;Ɗ20px 24px;overscroll-behavior:contain}Ɓstat-dialog::backdrop{inset:var(--dsh-frame-chrome-top,ƚ) 0 0;Ƃ#0005}Ɓroot{ƪƋ0;Ƒ100%;ǀƄ12px;Ə20px;color:ƀlabel-tertiary);Ǝƍƒ}Ɓsession-cost{Ƈgrid;grid-template-columns:max-content minmax(0,1fr);Ƌmin-content}Ɓsession-amount{Ƒ40vw;ƍƒ}Ɓsession-detail{Ƌ0;ƍƒ}Ɓchip{Ƈinline-flex;ƃƓ4px;Ƒ180px;Ɗ0 8px;height:22px;ƅ6px;Ƃƀbg-layer-2);Ƅ12px;Ə22px;color:ƀlabel-secondary);Ǝƍƒ}Ɓfoot{ƆƃƓ6px;height:32px;Ɗ0 8px;ƅ8px;Ƅ12px;color:ƀlabel-secondary);Ǝƥ}Ɓfoot:hover,Ɓfoot-rail:hover,Ɓcorner-chip:hover,Ɓqchip:hover,Ɓtab:hover,Ɓbtn:hover{Ƃƀinteractive-bg-hover)}Ɓfoot-rail{ƗƐcenter;Ɗ0;Ƅ13px;ƌ600;color:ƀlabel-primary)}Ɓnum{Ɩ}Ɓgo-rail{Ƅ11px;ƌ700;color:ƀlabel-primary)}Ɓgo-list{ƆƉƓ10px}Ɓgo-row{ƆƃƓ8px;Ƅ12px}Ɓgo-label{Ƙwidth:88px;color:ƀlabel-secondary)}Ɓgo-bar{flex:1;ƻƅ3px;Ƃƀinteractive-bg-hover);ƥ}Ɓgo-fill{Ɯƅ3px;Ƃƀbrand-primary)}Ɓgo-num{ƘƋ44px;Ƥƌ600;Ɩ}Ɓgo-reset{ƘƑ230px;Ƅ11px;color:ƀlabel-tertiary);Ǝƍƒ}Ɓgo-time{Ƅ11px;color:ƀlabel-tertiary)}Ɓgo-row.main Ɓgo-label{ƌ600;color:ƀlabel-primary)}Ɓcorner{Ƈinline-flex;ƪƞƐcenter;ƃƓ6px;Ƌ0;Ƒ100%}Ɓcorner-chip{Ƈinline-flex;ƃheight:20px;Ɗ0 8px;ƅ6px;Ƃƀbg-layer-2);Ƅ11px;Ə20px;color:ƀlabel-secondary);ƎƖ}Ɓqstrip{ƆƞƐcenter;ƃƓ6px;ƗƑvar(--dsh-chat-content-width,720px);ƛ0 auto;Ɵ;Ɗ0 calc(var(--dsh-composer-side-clearance,0px) + 16px)}Ɓqchip{Ƈinline-flex;ƃƓ6px;height:22px;Ɗ0 8px;ƅ6px;Ƃtransparent;Ƅ11px;Ə22px;color:ƀlabel-secondary);ƎƖ;cursor:default}Ɓqchip Ɓqlabel{color:ƀlabel-primary);ƌ600}Ɓqchip Ɓqbar{Ƈblock;width:44px;Dž;ƅ2px;Ƃƀborder-l1);ƍƷ}Ɓqchip Ɓqfill{Ƈblock;Ɯƅ2px;Ƃƀstate-ok-primary,#3ba272)}Ɓqchip Ɓqseg{Ƈinline-flex;ƃƓ4px}Ɓqchip Ɓqsep{width:1px;height:12px;Ƃƀborder-l1);Ʒ}Ɓqchip Ɓqtext{color:ƀlabel-secondary)}Ɓqchip.warn Ɓqfill{Ƃƀstate-warn-primary)}Ɓqchip.over Ɓqfill{Ƃƀstate-error-primary)}Ɓqchip.action{ƙ;ǂƹ}Ɓqchip.action:focus-visible{box-shadow:0 0 0 2px ƀbrand-primary)}Ɓqchip.action:active{transform:translateY(.5px)}Ɓplan-provider{ƆƉƓ8px}Ɓplan-provider+Ɓplan-provider{margin-top:14px}Ɓplan-provider-name{ƆƃƓ8px;Ƅ13px;ƌ600}Ɓplan-updated{Ƅ11px;ƌ400;color:ƀlabel-tertiary)}Ɓplan-tag{Ƙmargin-left:6px;Ɗ0 6px;ƅ999px;Ɣ1px solid ƀborder-l1);Ƅ10px;Ə16px;color:ƀstate-warn-primary)}Ɓplan-reset,Ɓplan-method{Ƅ11px;color:ƀlabel-tertiary)}Ɓqguide{--cm-guide-top:var(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,ƚ) + 18px));position:fixed;inset:auto;ƛ0;top:max(var(--cm-guide-top),env(safe-area-inset-top,0px));pointer-events:auto;-webkit-app-region:no-drag;ƫƠz-index:9999;Ƒ440px;width:calc(100% - 32px);Ɣ1px solid ƀborder-l1);ƅ12px;Ƃƀbg-layer-2);box-shadow:0 8px 28px #0000002e;Ɗ14px 16px;Ƅ13px;color:ƀlabel-primary);ƆƉƓ8px}Ɓqguide h4{ƛ0;Ƅ13px;ƌ600}Ɓqguide p{ƛ0;Ƅ12px;Ə1.6;color:ƀlabel-secondary)}Ɓqguide Ɓbuttons{ƆƓ8px;Ɛflex-end}Ɓsection{ƆƉƓ20px;Ɗ4px 2px 24px;Ƅ13px;color:ƀlabel-primary)}Ɓcards{Ƈgrid;ơƓ12px}Ɓoverview-grid{container:cm-overview / inline-size;Ƌ0}Ɓoverview-grid>Ɓcards{grid-template-columns:repeat(var(--cm-overview-count,3),minmax(0,1fr))}Ɓoverview-grid Ɓcard{Ƌ0;ƆƉƓ6px;Ɗ12px 14px}Ɓoverview-grid :is(Ɓcard-title,Ɓcard-sub){ƛ0}Ɓoverview-grid Ɓcard-value{Ə1.35;Ɩ;ƨ}Ɓoverview-grid Ɓcard-sub{Ə1.5;ƨ}@container cm-overview (Ƒ460px){Ɓoverview-grid>Ɓcards{Ƴ}}Ɓcards-toggle{ƆƃƓ6px;ƛ-6px 2px 0 auto;width:fit-content;Ƅ12px;color:ƀlabel-tertiary);ƙ;user-select:none}Ɓcards-toggle:hover{color:ƀlabel-primary)}Ɓcards-toggle input{ƛ0;ƙ}Ɓcard,Ɓbudget{Ɣ1px solid ƀborder-l1);ƅ12px;Ɗ14px 16px;Ƃƀbg-layer-1)}Ɓcard-title{Ƅ12px;color:ƀlabel-tertiary);ƛ0 0 8px}Ɓcard-value{Ƅ20px;Ə28px;ƌ600}Ɓcard-sub{Ƅ12px;color:ƀlabel-tertiary);ư}Ɓh{Ƅ13px;ƌ600;ƛ0}Ɓcollapse-h{ƆƃƓ8px;Ƃnone;Ɣnone;Ɗ0;ƛ0;ƙ;color:inherit;Ƨtext-align:left}Ɓcollapse-h:hover Ɓh{color:ƀinteractive-text-hover,ƀlabel-primary))}Ɓcaret{Ƙwidth:0;height:0;ƭƬborder-top:6px solid ƀlabel-secondary);transform:rotate(-90deg);transition:transform .15s ease}Ɓcaret.open{transform:rotate(0)}Ɓcollapse-body{ƆƉƓ12px;margin-top:12px}Ɓtoolbar{ƆƐflex-end;ƃƓ10px}Ɓtoolbar Ɓfield{flex-direction:row;ƃƓ8px}Ɓtoolbar Ɓfield label{ƛ0;Ƅ12px;color:ƀlabel-tertiary)}Ɓtoolbar Ɓinput{Ƌ150px;Ɗ4px 10px}Ɓtabs-row{ƆƃƐspace-between;Ɠ12px;ƞborder-bottom:1px solid var(--dsh-alias-border-l1);padding-bottom:10px}Ɓtabs{ƆƃƓ4px;ƣ}Ɓtab{ƧƄ13px;color:ƀlabel-secondary);Ƃtransparent;Ɣnone;ƅ8px;Ɗ6px 14px;ƙ;ƕ}Ɓtab.active{Ƃƀstate-business-primary);color:ƀlabel-primary-inverted);ƌ600}Ɓtabs-row Ɓmsg{Ɗ2px 10px}Ɓtabs-row>Ɓhint,Ɓtabs-row>Ɓmsg{margin-inline-start:auto}Ɓnote{Ƅ12px;color:ƀlabel-tertiary);ƛ0}Ɓtable{Ɨborder-collapse:collapse;Ƅ12px}Ɓtable th,Ɓtable td{text-align:left;Ɗ7px 10px;border-bottom:1px solid ƀborder-l1);ƕ}Ɓtable th{color:ƀlabel-tertiary);ƌ500}Ɓtable td.num,Ɓtable th.num{ƤƖ}Ɓtable tr:last-child td{border-bottom:none}Ɓtable trƁrow-click{ƙ}Ɓtable trƁrow-click:hover td{Ƃƀbg-hover,rgba(127,127,127,.08))}Ɓsess-title{Ƒ260px;ƍƒ;ƕ}Ɓsess-id{Ƅ11px;font-family:ui-monospace,Consolas,monospace;color:ƀlabel-tertiary)}Ɓempty{Ƅ12px;color:ƀlabel-tertiary);Ɗ8px 0}Ɓscroll{max-height:320px;ƱƔ1px solid ƀborder-l1);ƅ10px}Ɓgrid{Ƈgrid;ơƓ12px}Ɓfield{ƆƉƓ6px;Ƌ0}Ɓfield label{Ƅ12px;color:ƀlabel-secondary)}Ɓinput,Ɓinput option{color:ƀlabel-primary);Ƃƀbg-base)}Ɓinput{ƧƄ13px;Ɣ1px solid ƀborder-l1);ƅ8px;Ɗ6px 10px;ƹ}Ɓinput:focus{border-color:ƀstate-business-primary)}Ɓinput.narrow{Ƒ120px}Ɓrange-row{ƆƃƓ10px}Ɓrange{flex:1;Ƌ0;accent-color:ƀstate-business-primary)}Ɓrange-value{ƘƋ44px;Ƅ12px;color:ƀlabel-tertiary);text-align:right}Ɓcheck{ƆƃƓ8px;Ƅ13px;color:ƀlabel-primary);ƙ}Ɓpricing-page,Ɓpricing-content{Ƈgrid;Ɠ20px;Ƌ0}Ɓpricing-heading{ƆƃƐspace-between;Ɠ12px}Ɓpricing-heading Ɓh{Ƅ16px;margin-bottom:6px}Ɓpricing-heading Ɓnote{Ə1.6}Ɓpricing-unit{Ƶ;color:ƀlabel-tertiary);Ƅ11px}Ɓpricing-nav{ƆƓ4px;Ɗ4px;ƅ10px;Ƃƀbg-layer-1);Ɣ1px solid ƀborder-l1)}Ɓpricing-nav-item{flex:1;Ƌ0;Ƨcolor:ƀlabel-secondary);Ƃtransparent;Ɣ0;ƅ7px;Ɗ8px 10px;ƙ}Ɓpricing-nav-item.active{color:ƀstate-business-primary);Ƃƀbg-base);box-shadow:0 1px 3px #0000000d;ƌ600}Ɓpricing-nav-item:focus-visible{outline:2px solid ƀstate-business-primary)}Ɓpricing-tools{Ƈgrid;Ɠ16px}Ɓpricing-tool{ƆƉƓ12px;Ɗ16px;Ɣ1px solid ƀborder-l1);ƅ12px;Ƌ0}Ɓpricing-tool>Ɓpeak-panel{Ɗ0;Ɣ0;Ƃnone}Ɓpricing-tool p{Ə1.65}@media(Ƒ480px){Ɓpricing-heading{ƈflex-start;ƉƓ4px}Ɓpricing-nav-item{Ɗ8px 4px;Ƅ12px}Ɓpricing-tool{Ɗ12px}}Ɓprice-card{Ɣ1px solid ƀborder-l1);ƅ10px;Ɗ12px 14px;ƆƉƓ10px;Ƃƀbg-layer-1)}Ɓprice-head{ƆƃƓ8px;ƣ}Ɓprice-name{ƌ600;Ƅ13px;ƨ;Ƌ0;flex:1 1 180px}Ɓprice-legacy{Ƅ11px;color:ƀlabel-tertiary);Ɣ1px solid ƀborder-l1);ƅ999px;Ɗ1px 8px}Ɓprice-locked{Ƅ11px;color:ƀstate-business-primary);Ɣ1px solid ƀstate-business-primary);ƅ999px;Ɗ1px 8px;cursor:help}Ɓprice-row{Ƈgrid;grid-template-columns:52px repeat(4,minmax(0,1fr));Ɠ8px;ƈcenter}Ɓprice-row span{Ƅ12px;color:ƀlabel-tertiary)}Ɓprice-row input{ƗƋ0;Ɵ;Ɗ6px 5px}Ɓprice-multiplier{ƆƃƐspace-between;Ɠ6px 12px;ƞƄ12px;color:ƀlabel-tertiary)}Ɓprice-multiplier label{Ƈinline-flex;ƃƓ5px;ƙ}Ɓprice-multiplier input{ƛ0;accent-color:ƀbrand-primary,#4d6bfe)}Ɓprice-row input[aria-invalid=true]{border-color:#d64c4c}Ɓbuttons{ƆƞƓ10px;ƈcenter}Ɓbtn{ƧƄ13px;color:ƀlabel-primary);Ƃƀbutton-elevated-fill);Ɣ1px solid ƀborder-l1);ƅ8px;Ɗ6px 14px;ƙ}ƁbtnƁstat-entry{Ƅ12px;Ə20px;Ɗ0 6px;Ƌ0;Ƒ100%;Ǝƍƒ;Ƶ}@media(Ƒ640px){Ɓstat-header{Ƈnone}}Ɓbtn.primary{Ƃƀstate-business-primary);border-color:transparent;color:ƀlabel-primary-inverted)}Ɓbtn.primary:hover{opacity:.88;Ƃƀstate-business-primary)}Ɓbtn.danger,Ɓmsg.err,Ɓbal-line.err,Ɓbal-err{color:ƀstate-error-primary)}Ɓbtn.small{Ɗ3px 10px;Ƅ12px}div:has(>[data-slot="conversation.composer.dock"] Ɓstat-entry){Ʀcolumn-Ɠ6px}Ɓmsg{Ƅ12px;Ə18px;Ɗ8px 12px;ƅ8px;Ɣ1px solid ƀborder-l1)}Ɓmsg.ok{color:ƀstate-success-primary)}Ɓhint{Ƅ12px;color:ƀlabel-tertiary)}Ɓbudget{ƆƉƓ10px}Ɓpeak-alert{position:fixed;z-index:9999;width:340px;Ƒcalc(100vw - 32px);Ɗ16px;ƅ14px;Ƃƀbg-layer-2);Ɣ1px solid ƀborder-l2);box-shadow:0 14px 36px #00000038;ƆƉƓ8px;Ƅ12px;animation:cm-peak-alert-in .22s cubic-bezier(.2,.8,.2,1)}Ɓpeak-alertƁpeak-alert-corner{right:20px;bottom:20px}Ɓpeak-alertƁpeak-alert-center{top:50%;ƫƮanimation-name:cm-peak-alert-in-center}Ɓpeak-alert-peak{border-top:3px solid ƀstate-warn-primary)}Ɓpeak-alert-offpeak{border-top:3px solid ƀstate-info-primary,#3b82f6)}Ɓpeak-alert-badge{Ƈinline-flex;ƃƓ6px;Ƅ11px;ƌ600;letter-spacing:.4px;text-transform:uppercase}Ɓpeak-alert-badge:before{content:"";width:8px;Ƽƅ50%;ƂcurrentColor;box-shadow:0 0 0 4px color-mix(in srgb,currentColor 16%,transparent)}Ɓpeak-alert-peak Ɓpeak-alert-badge{color:ƀstate-warn-primary)}Ɓpeak-alert-offpeak Ɓpeak-alert-badge{color:ƀstate-info-primary,#3b82f6)}Ɓpeak-alert-title{Ƅ14px;ƌ600;color:ƀlabel-primary)}Ɓpeak-alert-body{color:ƀlabel-secondary);Ə1.55}Ɓpeak-alert-actions{ƆƐflex-end;Ɠ8px;margin-top:2px}Ɓrow{ƆƓ8px;ƃƣ}@keyframes cm-peak-alert-in{0%{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes cm-peak-alert-in-center{0%{opacity:0;transform:translate(-50%,calc(-50% + 10px))}to{opacity:1;transform:translate(-50%,-50%)}}Ɓbudget-head{ƆƃƐspace-between;Ɠ8px}Ɓquota-name{flex:1;Ƌ0}Ɓbudget-bar{Ƽƅ999px;Ƃƀbg-layer-3);ƥ}Ɓbudget-fill{Ɯƅ999px;Ƃƀstate-business-primary);transition:width .3s ease}Ɓug{ƆƉƓ12px}Ɓug-total{Ƅ13px;color:ƀlabel-primary)}Ɓug-grid{Ƈgrid;Ƹgrid-template-rows:repeat(7,auto);Ɠ3px;width:100%}Ɓug-cell{Ɨaspect-ratio:1/1;ƅ3px;Ɵ;Ƃcolor-mix(in srgb,ƀlabel-primary) 8%,transparent);Ɣ1px solid ƀborder-l1)}Ɓug-cell.l1,Ɓug-cell.l2,Ɓug-cell.l3,Ɓug-cell.l4{border-color:transparent}Ɓug-cell.l1{Ƃcolor-mix(in srgb,ƀstate-business-primary) 25%,ƀbg-layer-3))}Ɓug-cell.l2{Ƃcolor-mix(in srgb,ƀstate-business-primary) 50%,ƀbg-layer-3))}Ɓug-cell.l3{Ƃcolor-mix(in srgb,ƀstate-business-primary) 75%,ƀbg-layer-3))}Ɓug-cell.l4{Ƃƀstate-business-primary)}Ɓug-cell.today{outline:1px solid ƀlabel-secondary);ƿ}Ɓug-months{Ƈgrid;ƸƓ3px;ƗƄ10px;color:ƀlabel-tertiary);ư}Ɓug-monthc{ƕ}Ɓbudget-line{Ƅ13px;color:ƀlabel-secondary)}Ɓbudget-line.over{color:ƀstate-error-primary)}Ɓpeak-strip{ƆƃƓ6px;ư;Ƌ0}Ɓpeak-track{ƝƆflex:1;ƻƋ0;ƅ999px;ƍƔ1px solid ƀborder-l1);Ƃƀbg-layer-3)}Ɓpeak-segment{Ɯflex:1}Ɓpeak-high{Ƃ#ff9800}Ɓpeak-low{Ƃƀstate-business-primary)}Ɓpeak-marker{Ƣtop:0;ƫwidth:2px;ƜƂƀbg-base);box-shadow:0 0 0 1px ƀlabel-tertiary);Ơƴdž}Ɓpeak-chip{Ƅ11px;ƌ600;Ə1.2;Ǝcolor:ƀlabel-secondary)}Ɓpeak-classic{ƝƆƉƓ5px;DŽ;Ƌ0}Ɓpeak-classic Ɓpeak-track{Ƙheight:8px}Ɓpeak-classic-marker{Ƣtop:0;ƫwidth:4px;height:12px;Ƃƀbg-base);Ɣ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);Ơƴdž;ƅ2px}Ɓpeak-classic-marker:after{content:"";Ƣtop:-7px;ƫƠƭƬborder-top:6px solid #ff9800}Ɓpeak-classic.off Ɓpeak-classic-marker{border-color:ƀstate-business-primary)}Ɓpeak-classic.off Ɓpeak-classic-marker:after{border-top-color:ƀstate-business-primary)}Ɓpeak-classic-chip{align-self:flex-start;Ƅ11px;ƌ600;Ə1.4;Ƃƀbg-layer-2);Ɣ1px solid ƀborder-l1);ƅ999px;Ɗ2px 8px;Ǝcolor:ƀlabel-secondary)}Ɓpeak-strip.peak Ɓpeak-chip,Ɓpeak-classic.peak Ɓpeak-classic-chip,Ɓpeak-rail.peak Ɓpeak-rail-label,Ɓpeak-rail-classic.peak Ɓpeak-rail-classic-label{color:#ff9800}Ɓpeak-strip.off Ɓpeak-chip,Ɓpeak-classic.off Ɓpeak-classic-chip,Ɓpeak-rail.off Ɓpeak-rail-label,Ɓpeak-rail-classic.off Ɓpeak-rail-classic-label{color:ƀstate-business-primary)}Ɓpeak-strip.weekend Ɓpeak-chip,Ɓpeak-classic.weekend Ɓpeak-classic-chip,Ɓpeak-rail.weekend Ɓpeak-rail-label,Ɓpeak-rail-classic.weekend Ɓpeak-rail-classic-label{color:#34a853}Ɓpeak-classic.weekend Ɓpeak-classic-marker{ƺ}Ɓpeak-classic.weekend Ɓpeak-classic-marker:after{border-top-color:#34a853}Ɓpeak-rail{ƆƉƃƓ3px;ƾƟ}Ɓpeak-rail-track{ƝƆƉwidth:6px;height:56px;ƅ999px;ƍƔ1px solid ƀborder-l1);Ƃƀbg-layer-3)}Ɓpeak-rail-segment{Ɨflex:1}Ɓpeak-rail-high{Ƃ#ff9800}Ɓpeak-rail-low{Ƃƀstate-business-primary)}Ɓpeak-rail-marker{Ƣleft:0;top:50%;Ɨheight:2px;Ƃƀbg-base);box-shadow:0 0 0 1px ƀlabel-tertiary);transform:translateY(-50%);ƶdž}Ɓpeak-rail-label{Ƅ10px;ƌ600;Ə1.2;Ǝcolor:ƀlabel-secondary)}Ɓpeak-rail-classic{ƆƉƃƓ3px;ƾƟ}Ɓpeak-rail-classic-track{ƝƆƉwidth:14px;height:56px;ƅ999px;Ɣ1px solid ƀborder-l1);Ƃƀbg-layer-3)}Ɓpeak-rail-classic-segment{ƝƗflex:1;ƥ}Ɓpeak-rail-classic-segment.peak{Ƃ#ff9800;ƅ999px 999px 0 0}Ɓpeak-rail-classic-segment.off{Ƃƀstate-business-primary);ƅ0 0 999px 999px}Ɓpeak-rail-classic-marker{Ƣƫtop:50%;width:12px;Dž;Ƃƀbg-base);Ɣ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);Ʈƶdž;ƅ2px}Ɓpeak-rail-classic.off Ɓpeak-rail-classic-marker{border-color:ƀstate-business-primary)}Ɓpeak-rail-classic-label{Ƅ10px;ƌ600;Ə1.2;ƕ}Ɓpeak-rail-classic.weekend Ɓpeak-rail-classic-marker{ƺ}Ɓgrid-group{grid-column:1 / -1;margin-top:8px;Ƅ12px;ƌ600;color:ƀlabel-tertiary);border-bottom:1px solid ƀborder-l1);padding-bottom:4px}Ɓgrid-group:first-child{margin-top:0}Ɓpeak-preview{margin-top:8px}Ɓtoggle-btn{Ƃnone;Ɣnone;Ɗ0;Ƅ12px;ƌ600;color:ƀstate-business-primary);ƙ}Ɓtoggle-btn:hover{text-decoration:underline}Ɓcollapsed-note{ư}Ɓcatalog-vendor{margin-top:10px;Ƅ12px;ƌ600;color:ƀlabel-tertiary);border-bottom:1px solid ƀborder-l1);padding-bottom:2px;ƆƃƐspace-between;Ɠ8px}Ɓvendor-toggle{ƙ;user-select:none}Ɓvendor-toggle:hover{color:ƀlabel-secondary)}Ɓvendor-display{Ƈinline-flex;ƃƓ4px;ƌ400;Ƅ11px;color:ƀlabel-tertiary);ƕ}Ɓmstats-tabs{ƆƓ8px;margin-bottom:8px}Ɓmstats-tab{Ƃnone;Ɣ1px solid ƀborder-l1);ƅ999px;Ɗ2px 12px;Ƅ12px;color:ƀlabel-secondary);ƙ}Ɓmstats-tab.active{Ƃƀstate-business-primary);border-color:ƀstate-business-primary);color:ƀbg-base);ƌ600}Ɓmstats-h{ƛ10px 0 4px;Ƅ12px;ƌ600;color:ƀlabel-secondary)}Ɓmstats-row{Ƈgrid;grid-template-columns:minmax(90px,170px) 1fr auto;Ɠ8px;ƃƄ11px;Ə1.7}Ɓmstats-name{ƍƒ;Ǝcolor:ƀlabel-secondary)}Ɓmstats-label{ǃ;ƆƞƃƓ6px;DŽ}Ɓmstats-label Ɓmstats-name{flex:1;Ƌ90px}Ɓmstats-label~Ɓmstats-barbg{grid-column:1/3}Ɓmstats-label select{Ƒ100%;Ƌ0}Ɓmstats-barbg{Ɲheight:10px;ƅ999px;Ƃƀbg-layer-3);ƍƇflex}Ɓmstats-bar{ƜƋ0;ƅ999px}Ɓmstats-bar.cost{Ƃ#ff9800}Ɓmstats-bar.hit{Ƃ#34a853}Ɓmstats-bar.value{Ƃ#a142f4}Ɓmstats-seg{ƜƋ0}Ɓmstats-seg.in{Ƃƀstate-business-primary)}Ɓmstats-seg.cache{Ƃ#ff9800}Ɓmstats-seg.out{Ƃ#34a853}Ɓmstats-val{Ǝcolor:ƀlabel-secondary)}Ɓmstats-legend{ƆƓ12px;Ƅ10px;color:ƀlabel-tertiary);ƛ2px 0 4px}Ɓmstats-dot{Ƈinline-block;width:8px;Ƽƅ2px;margin-right:3px}Ɓmstats-note{margin-top:10px;Ƅ10px;Ə1.6;color:ƀlabel-tertiary)}Ɓmatch-row{ƆƃƓ8px;Ɗ3px 0;Ƅ12px;ƣ}Ɓmatch-row Ɓinput{flex:1;Ƌ160px}Ɓbudget-controls{Ƈgrid;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));Ɠ12px}Ɓbbox{Ɣ1px solid ƀborder-l1);ƅ12px;Ɗ8px 10px;Ƃƀbg-layer-1);ƆƉƓ6px;Ƌ148px;Ɵ}Ɓbbox.rail{Ɗ6px;Ƌ0;ƾƃƐcenter;ƅ10px}Ɓbbox.warn{border-color:ƀstate-warn-primary)}Ɓbbox.over{border-color:ƀstate-error-primary)}Ɓbbox-head{ƆƃƐspace-between;Ɠ8px}Ɓbbox-label,Ɓbbox-pct{Ƅ12px;ƌ600;color:ƀlabel-primary)}Ɓbbox.warn Ɓbbox-pct{color:ƀstate-warn-primary)}Ɓbbox.over Ɓbbox-pct{color:ƀstate-error-primary)}Ɓbbox-bar{ƻƅ999px;Ƃƀbg-layer-3);ƥ}Ɓbbox-bar.segments{Ɔheight:8px}Ɓbbox-bar.segments Ɓbbox-fill{Ƙƅ0;height:100%}Ɓbbox-bar.segments Ɓbbox-fill:first-child{ƅ999px 0 0 999px}Ɓbbox-bar.segments Ɓbbox-seg-today{ƘƜƂ#ff9800}Ɓbbox-bar.segments Ɓbbox-seg-spent{ƘƜƂƀinteractive-bg-hover);ƅ0 999px 999px 0}Ɓbbox-bar.segments.rev Ɓbbox-fill:first-child,Ɓbbox-bar.segments.rev Ɓbbox-seg-today:first-child{ƅ999px 0 0 999px}Ɓbbox-bar.segments.rev Ɓbbox-fill,Ɓbbox-bar.segments.rev Ɓbbox-fill:last-child,Ɓbbox-bar.segments.rev Ɓbbox-seg-today:last-child,Ɓbbox-bar.segments.rev Ɓbbox-seg-spent:last-child{ƅ0 999px 999px 0}Ɓbbox-bar.segments.rev Ɓbbox-seg-spent{ƅ0}Ɓdir-row{ƆƃƓ8px;DŽ}Ɓdir-label{flex:1 1 40%;Ƅ12px;color:ƀlabel-secondary)}Ɓdir-row Ɓinput{flex:1 1 60%;ǁ}Ɓbbox-fill{Ɯƅ999px;Ƃƀstate-business-primary)}Ɓbalance-name{Ƈinline-flex;ƃƓ4px;Ƌ0}Ɓmodel-costs{Ƅ12px}Ɓmodel-costs Ɓbal-label{ƕ}Ɓmodel-top{Ɠ4px;Ƒ180px;ƍƒ}Ɓmodel-costs Ɓcollapse-h{Ƌ0;Ɨƕ}Ɓmodel-costs Ɓbbox-bar{margin-top:3px}Ɓbal-label{Ƌ0;ƍƒ}Ɓbal-amt{margin-left:auto;ƤƵ}Ɓbbox-pctƁbal-amt{color:ƀstate-business-primary)}Ɓbal-link{ƘƇinline-flex;ƃƐcenter;Ɗ2px;ƅ4px;Ƅ12px;Ə16px;color:ƀlabel-tertiary);text-decoration:none;ƹ}Ɓbal-link:hover{color:ƀbrand-primary);Ƃƀinteractive-bg-hover)}Ɓbal-link:focus-visible{box-shadow:0 0 0 2px ƀbrand-primary)}Ɓbbox.warn Ɓbbox-fill,Ɓbbox Ɓbbox-section.warn Ɓbbox-fill,Ɓbbox Ɓmm-row.warn Ɓbbox-fill,Ɓbudget-fill.warn{Ƃƀstate-warn-primary)}Ɓbbox.over Ɓbbox-fill,Ɓbbox-section.over Ɓbbox-fill,Ɓmm-row.over Ɓbbox-fill,Ɓbudget-fill.over{Ƃƀstate-error-primary)}Ɓbbox-line{Ƅ12px;color:ƀlabel-tertiary)}Ɓbbox-rail{Ƅ11px;ƌ600;color:ƀlabel-primary)}Ɓbbox.warn Ɓbbox-pct,Ɓbbox.warn Ɓbbox-rail,Ɓbbox Ɓbbox-section.warn Ɓbbox-pct,Ɓbbox Ɓmm-row.warn Ɓbbox-pct,Ɓmm-row.warn Ɓbbox-label,Ɓcorner-chip.warn,Ɓqchip.warn,Ɓsimple-summary.warn{color:ƀstate-warn-primary)}Ɓbbox.over Ɓbbox-pct,Ɓbbox.over Ɓbbox-rail,Ɓbbox-section.over Ɓbbox-pct,Ɓmm-row.over Ɓbbox-pct,Ɓmm-row.over Ɓbbox-label,Ɓcorner-chip.over,Ɓqchip.over,Ɓsimple-summary.over{color:ƀstate-error-primary)}Ɓbbox-pair{ƆƉƓ0;Ɗ2px 10px}Ɓbbox-pair Ɓbbox-section{ƆƉƓ4px;Ɗ4px 0}Ɓbbox-pair Ɓbbox-bar{Dž}Ɓbbox-divider{height:1px;Ƃƀborder-l1);ƛ0}Ɓbbox.clickable,Ɓfoot.clickable{ƙ}Ɓbbox.clickable:hover{border-color:ƀstate-business-primary)}Ɓbbox.clickable:focus-visible,Ɓfoot.clickable:focus-visible{outline:2px solid ƀstate-business-primary);ƿ}@keyframes cm-click-refresh-pulse{0%,to{opacity:.55}50%{opacity:1}}Ɓbbox.clickable.busy,Ɓfoot.clickable.busy{animation:cm-click-refresh-pulse 1.1s ease-in-out 2;cursor:progress}Ɓmm{Ɗ8px 10px;Ɠ4px}Ɓmm-title{Ƅ12px;ƌ600;color:ƀlabel-primary)}Ɓmm-reset{Ƅ11px;color:ƀlabel-tertiary);ǃ}Ɓcodex-window{Ɔƞƈbaseline;Ɠ4px 6px;Ƅ12px}Ɓcodex-window strong{ƕ}Ɓbbox.rail[data-cm-display=codex] Ɓbbox-rail{Ƒ100%;ƨ;ǀƄ10px}Ɓgw-switcher{ƙ;ǂƄ11px;Ɗ1px 6px;ƅ999px;Ɣ1px solid ƀborder-l1);Ƃƀbg-layer-2);color:ƀlabel-secondary)}Ɓgw-switcher:hover{Ƃƀinteractive-bg-hover);color:ƀlabel-primary)}Ɓgw-sub{Ƅ11px;color:ƀlabel-tertiary);ƍƒ;ƕ}Ɓmm-row{ƆƃƓ8px;Ɗ2px 0}Ɓmm-row Ɓbbox-label{Ƙǁ;Ƌ22px;Ƒ115px;ƌ400;color:ƀlabel-secondary);Ɩ;Ǝƍƒ;word-break:keep-all}Ɓmm-row Ɓbbox-bar{flex:1;Ƌ40px;height:6px}Ɓmm-row Ɓbbox-pct{ƘƋ2.4em;ƤƖ}Ɓmm-row.wide Ɓbbox-label{ǁ;Ƒ64px;ƪƎƍƒ}Ɓmm-row.wide Ɓmm-text{flex:1;Ƌ0;Ƅ12px;color:ƀlabel-secondary);ƤƖ;Ǝƍƒ}Ɓbal-line{Ƅ13px;color:ƀlabel-secondary)}Ɓbal-line.warn{color:ƀstate-warn-primary,#b45309)}:has(>Ɓfooter-stack),:has(>[data-slot="sidebar.footer.action"]>Ɓfooter-stack){ƣ}:has(>Ɓfooter-stack.rail),:has(>[data-slot="sidebar.footer.action"]>Ɓfooter-stack.rail){ƉƦƃƓ6px}Ɓfooter-stack{ƆƘorder:-1;ƉƓ6px;ƗƋ0;Ƒ100%;ƈstretch;Ɵ}Ɓfooter-stack.rail{ƃorder:1}Ɓfooter-stack Ɓbbox{ƗƋ0}Ɓfooter-stack Ɓfoot{ƗƟ}Ɓfooter-stack.compact Ɓbbox{Ƈgrid;grid-template-columns:repeat(2,minmax(0,1fr));column-Ɠ12px;row-Ɠ2px;ƈcenter}Ɓfooter-stack.compact Ɓbbox>*{ǃ}Ɓfooter-stack.compact Ɓbbox>Ɓmm-row{grid-column:auto}Ɓfooter-stack.compact Ɓmm-row{Ƌ0;Ɠ4px;flex-wrap:nowrap}Ɓfooter-stack.compact Ɓmm-row Ɓbbox-label{ƪƋ0;Ƒ45%;ǁ}Ɓfooter-stack.compact Ɓmm-row Ɓbbox-bar{Ƌ0;flex:1 1 0}Ɓfooter-stack.simple{Ɠ0;max-height:38vh;max-height:min(38dvh,320px);Ʊoverscroll-behavior:contain;scrollbar-width:thin;Ɣ1px solid ƀborder-l1);ƅ10px;Ƃƀbg-layer-1)}Ɓfooter-stack.simple>*{Ƶ}Ɓfooter-stack.simple:focus-visible{outline:2px solid ƀstate-business-primary);outline-offset:2px}Ɓfooter-stack.simple Ɓbbox{Ɣ0;ƅ0;Ɗ4px 8px;Ɠ2px;Ƃtransparent;box-shadow:inset 0 -1px ƀborder-l1)}Ɓfooter-stack.simple Ɓmm-title{Ƅ11px;Ə16px;ƛ0}Ɓfooter-stack.simple Ɓmm-row{Ɠ6px;min-height:16px;Ə16px;ƛ0;Ɗ0}Ɓfooter-stack.simple Ɓmm-text{Ƅ11px}Ɓfooter-stack.simple>Ɓpeak-strip,Ɓfooter-stack.simple>Ɓpeak-classic{ƛ0;Ɗ4px 8px}Ɓsimple-summary>span{Ƌ0;Ǝƍƒ}Ɓfooter-stack.simple Ɓbbox-pct{Ƅ12px;Ə18px}Ɓfooter-stack.simple Ɓbbox-bar{Dž}Ɓfooter-stack.simple Ɓbbox-line{Ƈnone}Ɓfooter-stack.simple Ɓfoot{height:26px;Ɗ0 8px}Ɓfooter-stack.simple Ɓpeak-classic{margin-top:2px;Ɠ2px}Ɓfooter-stack.simple Ɓpeak-classic-chip{Ɗ0 4px;Ɣ0;Ƃtransparent}Ɓsimple-summary{position:sticky;top:0;z-index:1;Ƃƀbg-layer-1);ƆƐspace-between;ƃƓ8px;Ɗ5px 8px;Ƅ12px;ƌ600;border-bottom:1px solid ƀborder-l1)}Ɓfooter-stack.simple.rail{Ɣ0;Ƃtransparent}Ɓfooter-stack.simple.rail Ɓbbox{Ɗ4px 2px}Ɓfooter-stack.simple Ɓpeak-rail-track,Ɓfooter-stack.simple Ɓpeak-rail-classic-track{height:28px}@media(Ƒ640px){Ɓcards,Ɓgrid,Ɓbudget-controls{Ƴ}}@media(Ƒ1023px){Ɓsection{padding-bottom:calc(16px + env(safe-area-inset-bottom))}Ɓcards,Ɓoverview-grid>Ɓcards,Ɓgrid,Ɓbudget-controls{ƯƓ8px}Ɓcard{Ɗ10px 12px}Ɓcard-value{Ƅ17px}Ɓcard-sub,Ɓbal-line,Ɓbal-amt{ƨ}Ɓbuttons,Ɓtoolbar,Ɓrow,Ɓbudget-head{ƣ}Ɓbtn,Ɓtab,Ɓfoot,Ɓcorner-chip{min-height:36px;height:auto}Ɓtabs{Ʀoverflow-x:auto}Ɓtab{Ʒ}Ɓqstrip{Ɗ0 8px}Ɓqguide{Ƒcalc(100vw - 24px);--cm-guide-top:var(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,ƚ) + 10px + env(safe-area-inset-top)))}Ɓpeak-alert{Ƒcalc(100vw - 24px)}Ɓpeak-alertƁpeak-alert-corner{right:12px;left:12px;bottom:calc(12px + env(safe-area-inset-bottom));ǁ}Ɓfooter-stack{Ʃ}Ɓstat-dialog-body{Ɗ14px;padding-bottom:calc(14px + env(safe-area-inset-bottom))}}body[data-dsh-pocket-layout=mobile] :is(Ɓcards,Ɓoverview-grid>Ɓcards,Ɓgrid,Ɓbudget-controls){ƯƓ8px}body[data-dsh-pocket-layout=mobile] Ɓtabs{Ʀoverflow-x:auto}body[data-dsh-pocket-layout=mobile] Ɓfooter-stack{Ʃ}body[data-dsh-pocket-layout=mobile] :is(Ɓpeak-alert,Ɓqguide){Ƒcalc(100vw - 24px)}body{--cm-opaque-base:#fff}body[data-ds-dark-theme],body[data-theme=dark],html[data-theme=dark] body{--cm-opaque-base:#151517}Ɓsection,Ɓstat-dialog,Ɓqguide,Ɓpeak-alert,Ɓfooter-stack.simple{ƂƲ;Ƃrgb(from ƀbg-layer-2,ƀbg-base,#fff)) r g b / 1)}Ɓsimple-summary{ƂƲ;Ƃrgb(from ƀbg-layer-1,ƀbg-base,#fff)) r g b / 1)}'.replace(/[ƀ-ǿ]/g,e=>Cn[e.charCodeAt(0)-384]),ha="dsh-cost-meter/client.css";if(typeof document<"u"&&document.head!==void 0){const e=document.querySelector("style[data-plugin-css="+JSON.stringify(ha)+"]");if(e?.textContent!==ga){const n=e??document.createElement("style");n.dataset.plugin="dsh-cost-meter",n.dataset.pluginCss=ha,n.textContent=ga,e===null&&document.head.appendChild(n)}}const An="sessionCostTitle|sessionDetailTokens|sessionDetailCache|cost|sessionLine|sessionLineCompact|sessionCostCompact|quotaUnlimited|pricingCnyHint|balanceQueryFailed|unknownError|balance|queryFailed|balanceTitle|reconcileLabel|totalBalance|grantedToppedUp|updatedAt|budgetOf|usedOf|todayShare|monthTotal|budget|todayCostTitle|todayTokensTitle|tokensUnit|callsTokens|monthCost|totalCost|today|sidebarTodayMetric|sidebarTodayCost|sidebarTodayTokens|periodDay|periodMonth|periodAll|periodCustomRange|noHistory|colDate|colCalls|colInTok|colCacheTok|colOutTok|colCost|noSessionsToday|colSession|enableBudget|budgetAmountLabel|budgetPeriodLabel|startDate|endDate|rangeText|budgetDisabledNote|budgetStatus|overLimit|nearLimit|legacyModel|defaultFallback|remove|tierBase|tierOffPeak|tierPeak|balanceApiKey|balanceKeyHint|balanceLine|balanceQueryFailedHint|balanceNotQueried|accountBalance|refreshing|refreshBalance|customBalanceTitle|customBalanceAdd|tokenRhythmBalanceAdd|tokenRhythmBalanceNote|aliyunBalanceAdd|aliyunBalanceNote|customBalanceConfigNote|customBalanceLabelZh|customBalanceLabelEn|customBalanceUrl|customBalanceUrlHint|customBalanceHttp|workBuddyBalanceAdd|workBuddyBalanceNote|customBalanceMethod|customBalanceHeaders|customBalanceBody|customBalanceBodyNote|customBalanceExtract|customBalanceDisplayLabel|customBalanceRefreshInterval|customBalanceUnitLabel|customBalanceConvert|customBalanceConvertNote|balanceBarRemaining|balanceBarToday|balanceBarSpent|balanceShowProgressBar|barDirectionsTitle|barDirectionsHint|barDirection_balance|barDirection_budget|barDirection_go|barDirection_plan|barDirectionRemaining|barDirectionUsed|balanceBudgetCapLabel|balanceBudgetCapHint|customBalanceInvalidJson|customBalanceHeadersVarNote|customBalanceAllowedHosts|customBalanceAllowedHostsHint|customBalanceCredentialsTitle|customBalanceCredentialsHint|customBalanceNoPlaceholders|enable|customBalanceLine|customBalanceRemaining|refreshCustomBalance|goQuotaTitle|goQuotaRowLabel|goWindowRolling|goWindowWeekly|goWindowMonthly|goResetAt|resetReached|resetDays|resetHours|resetMinutes|quotaUsed|quotaRemaining|goQuotaPercent|goQuotaFetchedAt|goQuotaDisplayLabel|goQuotaRefreshIntervalLabel|goQuotaRefreshMinutesUnit|goQuotaKeyLabel|goMainLabel|goDetailLabel|credentialConfiguredOf|credentialNotConfigured|credentialSave|credentialEdit|credentialClear|credentialSaving|credentialInputHint|secretMigrationPending|budgetDetailLabel|refreshGoQuota|goQuotaNotQueried|codingPlanAnthropic|codingPlanZai|codingPlanMinimax|codingPlanMinimaxTitle|minimaxOrigin|minimaxOriginNote|codingPlanRemain5h|codingPlanRemain7d|balanceRechargeLink|codexQuotaTitle|codexQuotaFive|codexQuotaWeek|codexQuotaReset|codexQuotaUnavailable|codexQuotaEnabled|codexQuotaSidebar|codexQuotaStrip|includeSubagentCost|gatewayQuotaEmpty|codingPlanDisplayLabel|codingPlanDisplayNote|codingPlanKeyLabel|codingPlanRefreshIntervalLabel|refreshCodingPlan|loginCodingPlan|loggingIn|codingPlanNotQueried|gatewayQuotaTitle|gatewaySourceAdd|gatewaySourceLabel|gatewaySourceBaseURL|gatewaySourceDisplay|gatewaySourceRefreshInterval|gatewaySourceAllowlist|gatewaySourceCredential|gatewaySourceStatus|gatewaySourceUnsupported|gatewaySourceUnknown|gatewaySourceNoAccounts|gatewaySourceFetchedAt|gatewaySwitchAccount|gatewayOnlyGemini|refresh|quotaEnableFirst|quotaRefreshReady|quotaRemove|quotaSectionNote|codingPlanDisabledNote|goQuotaDisabledNote|cornerLabel|cornerEnabledLabel|cornerGoRolling|cornerGoWeekly|cornerGoMonthly|cornerBudget|goShortRolling|goShortWeekly|goShortMonthly|goShortDaily|budgetShort|ledgerReadFailed|readingLedger|ledgerUnavailable|syncFailed|historyCleared|clearFailed|peakOff|peakNotEffective|peakActive|peakNotice|offPeakActive|weekendAllOffPeak|weekendChip|weekendShort|holidayAllOffPeak|holidayChip|holidayShort|peakHolidaysLabel|weekendRuleNote|peakShort|offPeakShort|peakStyleLabel|peakStyleCompact|peakStyleClassic|peakAlertLabel|peakAlertAheadLabel|peakAlertTargetLabel|peakAlertTargetPeak|peakAlertTargetOffPeak|peakAlertTargetBoth|peakAlertTitlePeak|peakAlertTitleOffPeak|peakAlertBody|peakAlertPhasePeak|peakAlertPhaseOffPeak|peakAlertBtn|peakAlertBadgePeak|peakAlertBadgeOffPeak|peakAlertPositionLabel|peakAlertPositionCorner|peakAlertPositionCenter|peakAlertWebNotifyLabel|peakAlertWebNotifyHint|peakAlertPreviewLabel|peakAlertPreviewPeak|peakAlertPreviewOffPeak|peakAlertPreviewTag|peakPanelTitle|peakNoticeHiddenHint|groupGeneral|groupMoney|groupSidebar|sidebarSimple|sidebarSimpleNote|sidebarSimpleTitle|sidebarSimpleBody|sidebarSimpleOn|sidebarSimpleOff|sidebarSimpleError|closeGuide|todayBudget|sidebarStyleLabel|sidebarStyleStandard|sidebarStyleCompact|restorePriceMatches|removePriceMatchHint|groupCorner|groupDetail|unmountBtn|catalogUnpriced|priceLockBadge|priceLockHint|priceLockRelease|modelStatsTitle|modelsTitle|modelsCount|modelsOther|models_enabled|models_defaultOpen|models_remember|models_tokens|models_shares|models_dock|models_period|models_summary|models_position|models_topN|models_refreshSeconds|modelsTotal|modelsTop|modelsFirst|modelsAfter|modelsLast|modelStatsToday|modelStatsHistory|modelStatsCostH|modelStatsTokensH|modelStatsHitH|modelStatsHitUnreported|modelStatsHitUnreportedTip|modelStatsValueH|modelStatsInput|modelStatsCache|modelStatsOutput|modelStatsEmpty|modelStatsBlended|modelStatsNote|modelStatsLegacy|sessionLineSplit|sessionLineSplitCompact|costChipPlan|sessionDetailPlan|planStatsTitle|planStatsEmpty|planStatsWindow|planStatsPercent|planStatsLocal|planStatsPer1|planStatsFull|planStatsResets|planStatsMethodSample|planStatsMethodLive|planStatsMethodNone|planStatsMethodSampleAt|planStatsConfidenceLow|planStatsCurveTitle|planStatsDaily|planStatsWeekly|planStatsMonthly|planStatsCurveEmpty|planStatsBarTip|planStatsNote|billingClassLabel|billingClassPlan|billingClassAuto|billingClassApi|catalogDisplayLabel|catalogDisplayHint|priceTableDisplayHint|priceMultiplySeparate|priceMultiplyHint|priceMultiplyAll|priceMultiplySingle|priceMultiplyInvalid|priceMatchLabel|priceMatchAuto|priceMatchExact|priceMatchNote|unmatchedTitle|unmatchedHint|overrideTargetDefault|overrideRemove|overrideTargetLocal|matchedTitle|matchedHint|matchedKeepAuto|overrideNone|mountedSuffix|flatInput|flatCached|flatCacheWrite|cacheWriteFallback|flatOutput|deepseekMountedHeader|codingPlanKimi|codingPlanOpenrouter|codingPlanSiliconflow|codingPlanCommandcode|codingPlanScnet|codingPlanVolcengine|codingPlanQwen|codingPlanMimo|codingPlanFactory|codingPlanOpendesign|opendesignWorkspace|opendesignNote|factoryPool|factoryPoolBoth|factoryOrg|mimoWindowPlan|mimoWindowCompensation|codingPlanWindowBalance|qwenSource|qwenSourceLocal|qwenSourceCli|qwenSourceBailian|qwenCliNote|qwenBailianNote|qwenPlanCreditsLabel|qwenPlanStartLabel|qwenRatesLabel|qwenRatesModelPlaceholder|qwenRatePlaceholder|qwenRate_input|qwenRate_cachedInput|qwenRate_output|qwenRateDraftNote|qwenRatesAdd|qwenLocalNote|scnetPlanCreditsLabel|scnetPlanStartLabel|scnetLocalNote|volcengineAccessKeyIdLabel|volcengineSecretAccessKeyLabel|volcengineNote|volcengineAccessKeyPlaceholder|volcengineSecretPlaceholder|countdownHoursOnly|countdownHourMinute|countdownMinute|nextOffPeakIn|nextPeakIn|peakSummary|noPeakWindows|unknown|cardToday|cardMonth|cardTotal|cardTotalSub|externalUsage|combinedUsage|externalStale|externalHistory|cardsFootnote|timezoneHint|todaySessions|historyExpandHint|historySessionsLoading|historyNoSessions|historySessionsError|sessionRankTitle|sessionRankHint|sessionRankEmpty|sessionRankLoading|sessionRankError|sessionRankLimit|showSessionIdLabel|cardsTogglePlanTotal|cardsTogglePlanTotalHint|hideOfficialBalanceLabel|hideTodayCostLabel|hideSessionCostHeader|hideSessionCostDock|hideTurnCost|sessionRankSort|sessionSortCostDesc|sessionSortCostAsc|sessionSortTimeDesc|sessionSortTimeAsc|sessionSortRecent|history|usageTitle|usageTotal|usageDay|usageEmpty|usageSectionLabel|usagePositionLabel|usagePositionCost|usagePositionGeneral|usagePositionSection|displaySettings|tabOverview|tabQuotas|tabUsage|tabPricing|tabDisplay|historyDataTitle|positionLabel|positionDock|positionHeader|off|quotaStripGroup|quotaStripEnable|quotaStripShowBudget|quotaStripShowGo|quotaStripShowPlans|quotaStripNote|quotaStripGuideTitle|quotaStripGuideBody|quotaStripGuideOn|quotaStripGuideOff|clickToRefresh|balanceClickGuideTitle|balanceClickGuideBody|balanceClickGuideOk|sidebarLabel|sidebarOn|currencyLabel|currencyCny|currencyUsd|currencyEur|symbolLabel|rateLabel|decimalsLabel|balanceDisplayLabel|balanceSidebar|balanceSettings|balanceBoth|refreshIntervalLabel|peakEnabledLabel|peakNoticeLabel|badgeNote|priceTableTitle|pricingCurrencyLabel|pricingCurrencyUsd|pricingCurrencyCny|pricingCurrencyNote|priceTableNote|datedPriceNote|defaultModelId|newModelPlaceholder|addModel|dataSync|saving|autoSaveFailed|autoSavedAt|autoSaveHint|confirmFetch|apply|cancel|syncFromDocs|syncScopeNote|confirmReset|importLegacy|confirmImportLegacy|legacyImportFailed|legacyImportNote|confirmClear|clearAllHistory|lastSync|neverSynced|source|sourceOfficial|sourceBundled|languageLabel|localeAuto|localeZh|localeEn|sectionLabel|rpcFailed|rpcSyncFailed|rpcBalanceFailed".split("|"),Pn="额度|显示|amount|余额|价格|费用|会话|quota|模型|session|DeepSeek|off-peak|official|输入|缓存|计费|OpenCode Go|Plan|balance|display|prices|刷新|官方|time|OpenDesign|tokens|自动|自定义|weekends and Chinese public holidays are|预算|Token|the|调用|message|侧边栏|input|output|今日|设置|credential|凭据|Balance|cache|用量|金额|Enable|Refresh interval|中国公众假期全天谷价|同步|失败|峰时高价时段显著提示|时段|details|refresh|calls|cost|历史|峰时|已用|输出|and|price|usage|BillingCenterReadOnlyAccess|sidebar|以同一系统账号运行|Settings|budget|currency|interval|position|settings|保存|启用|图框详细信息|开启|当前|Credits|Refresh|account|WorkBuddy2API|period|本地|留空|Codex|model|optional|右下角|Budget|DescribeBillingAccount|failed|history|位置|分钟|匹配|命中|币种|数据|查询|记录|谷时|账本|配置|Coding|Strip includes|rates|剩余|小时|峰谷|提示|时间|更新|统计|订阅|Chinese|credits|minutes|人民币|API|Cache|empty|month|YYYY-MM-DD|auth login|billed|configured|planAmount|source|使用|可选|本月|横条|请求|读取|谷价|进入|隐藏|默认|ArkReadOnlyAccess|Display|Off-peak|Quota not queried|browser|current|default|is an upper bound|local ledger|never echoed back|subscription|法定假日|逗号分隔|AccessKey|Output|Preview entering|Remaining|including|ledger|remaining|this|主机|估算|全部|关闭|密钥|恢复|日期|明细|暂无|框上方|浏览器|清除|登录|百分比|累计|账号|进度条|间隔|Today|Volcano Ark|coding plan|local|percentages|a catalog entry|comma-separated|deepseek-v4-pro|only|peak|导入安装前|开始对话后|汇总在这里|Monthly|Sidebar|Volcano|pricing|Cost|Entering|Failed to load|Input|Official|Provider|a vendor group|built-in table|custom|enough samples|historical|stay unchanged|to restore|toppedUp|上方|卡片|取消|周末|图框|安装|展开|手动|挂载|提醒|方向|来源|消耗|添加|等值|美元|Alibaba Cloud|Authorization|Show|automatically|volcengineapi|Quota|above|effective|estimates|overrides|qianwenai|strip|table|total|白名单|Bottom-right|Content-Type|Custom|English|JSON|MiniMax|Session|This|Updated|bottom-right|console|conversation|date|from|granted|hitRate|method|notification|rate|records|removed|restore|same OS user|used|windows|workspace ID|侧栏|保留|内置|写入|单价|可在|名称|后续|周期|导入|开放平台|按自然月|排行加载|滚动|火山引擎|火山方舟|点击|环境变量|确认|积分|移除|覆盖|计价|账户|这里|采样区间|重置|预览|Control Key|Flash|Peak|SiliconFlow|application|apply|are|auto-detect|bailian-cli|composer|data|environment|estimate|full-window|host|matching|max-preview|pre-install|qianwen-cli|token|unavailable|DSH|Auto-match|Claude Pro|Credential|Management|OpenRouter|Remove|Volcengine|Weekly|aggregated|change|exactly at|hours soon|multiplier|percentage|status|with|下方|不计|优先|修改|倍率|全天|切换|加载|勾选|区间|厂商|可用|基础|实际|当日|影响|文档|日志|未知|档位|渠道|生效|用于|端口|编辑|选择|采样|History|Unknown|Weekend|address|count|headers|hours|missing|ranking|reads|today|ACCESSKEY|Anthropic|Clear all|SECRETKEY|Topped-up|all|auto-sync|direction|for|page|plan|precision|providers|reasoning|signed-in|stay|subagents|use|中复制|主页面|占位符|子代理|工作区|性价比|抵扣率|控制台|未上报|条起步|标题栏|知道了|表条目|起始日|过期后|这一项|阿里云|Base URL|Cookie|Currency|External|HTTPS|Moonshot|Public|Security|Source|Usage|actual|calendar|deepseek|follow|full|notice|override|priority|progress|provider|range|read|recorded|requires|sample|shows|snapshot|store|subtract|when|window|write|不会|中文|充值|其他|分别|列表|删除|北京|千问|发现|发送|只写|可能|后可|地址|填写|外部|套餐|对账|应用|弹窗|快照|悬停|折算|推理|支持|时刻|时区|最多|本周|标准|格式|每日|汇率|满窗|独立|窗口|简化|精度|精确|请在|路径|Key|Amounts|Beijing|Billing|ChatGPT|Compact|Confirm|Default|Extract|Factory|General|Granted|HTTP|Hide|Include|Loading|Mounted|Qwen|Request|Used|accepts|applies|billing|bundled|card|channel|earlier|gateway|here|holiday|include|key|name|not|percent|plugins|qianwen|replace|require|unknown|Click|Enter|Local|ROUTE|USD|alert|click|equiv|first|limit|match|query|saved|start|stats|value|CNY|Change|Gemini|Kimi|Ledger|NewApi|OPENAI|Recent|Rhythm|Saving|VOLC|active|corner|direct|divide|enable|fields|import|logs|manual|openai|origin|pct|plugin|port|reason|remain|resets|select|studio|sync|上下|上界|上限|不再|不是|不足|两者|为准|之后|仍在|保持|允许|入口|分开|包含|即将|原因|发生|同名|后的|后缀|回放|回显|回退|域名|填入|处于|字段|对应|导出|将按|屏幕|工具|平价|底部|开关|总额|打开|按量|插件|放行|新增|早期|最近|月度|权限|条数|样式|样本|概览|版本|状态|现在|界面|百炼|目录|直接|符号|类型|紧凑|缺失|网关|花费|英文|表外|规则|语言|调整|账单|货币|赠送|超出|跟随|通知|重试|钱包|Add|bar|box|Both|CLI|KEY|Keep|Sync|VAR|When|clear|day|dock|docs|each|leave|left|now|show|that|tok|will|yet|your|Pro|com|All|Auto|Not|Save|auto|back|can|chip|its|keep|old|open|per|save|Top|low|row".split("|"),De=Object.fromEntries([["zh",'本Ɔƅ(按每次Ơ˘͎͛Ə)|ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|Ǝ:读 {̩} · 写 {̳}(ʌ按ǟ价Ə)|ƅ {Ƃ}|本Ɔ {Ƃ} · ǟ {ɾ} · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|本Ɔ {Ƃ}|仅ƁƬ|无限制|njǵƬ来自ɟƄ × ͕ {ʁ}。对照ƖǵϹ,请ˤ Ζ,再ưƄ;ư仅˚ʐƠ。|ƃǢƱ:{ơ}|˝错误|ƃ|ǢƱ|Ɗ ʓʠƃ|Ɩƃ变动与ǒǥ交叉͆(偏差超阈时ǭ)|总ƃ {Ƃ}|ϻ {ɽ} · ̶ {ɏ}|ǯǮ {Ɨ}|Ɲ({Ǒ})|ƺ {ʆ} / {Ƃ}|ƥ {Ƃ} · 占Ɲ {ά}|Ȃ {ǹ} · ȭ {ɭ}|Ɲ|ƥƅ(按ƖƄ͛Ə)|ƥ ƞ ƫ|ƙ|Ơ {ƶ} 次 · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|Ȃ {Ƃ}|ȭ {Ƃ}|ƥ|ƢƥƁ|ƅ|ƞ ƫ|ƥ|Ȃ|ȭ|ƛ˔|ȧƸǣ。ȼ,ƅϓ天Ƚ。|ȥ|Ơ|ƍ Е|Ǝ Е|ƻ Е|ƅ|ƥȧƆǣ。|Ɔ|ljƝ|Ɲƀ(按ƁǠ)|Ɲʑ|开始ȥ|结束ȥ(Ǔ = ƥ)|ǰ˔:{̨}|ljƝ后Ɓƀ、ƺƬ及比例(按ƁǠ换算);ȁƥ、Ȃ、ȭ或ƛʑ。|{Ǒ}Ɲ {Ƃ} · ƺ {ʆ} · {ά}%|(已ϼ)|(接近η)|旧ƈ|ȉό|ʝ|˗|Ǥ|ƹ|ƃ专用 Ƕ ͞|ˍȀ此ʓ ͞;未Ǧ时ȅ已ȫƖȮƃ,其次沿用ƈƨ。|总ƃ {ɭ} · ϻ {ɽ} · ̶ {ɏ} · ǯ于 {Ɨ}|ƃǢƱ:{ơ}|未Ǣƃ|Ɩʠƃ|ƕ中…|ƕƃ|ƛ ɇ ƃ|ɝǦ|ɝ ƞ Ξ ƃ|Ɓ官网ʠ页的ǵ˖ƃ。ȫ ʸrhythm.γ,在ȩ开发者ϕ → 网络̃ʠȄ的 ̕,或在存储 / ͇̃ tr_Ɖ 值,ώˋƨ并lj。̕ 仅存 ʺ ƨ库;̑重新̓。|ɝ̼ / ̓ƃ|Ǣ̓中国站˖金。RAM ȗ 需 bss:Ǚ Ϣ。前两项必填;STS 才需 ̛ ƞ。ȣ存ƨ库。|extract ͍点͝、数值和 add/̰/Τ 运算;Λ Ƈ 除以 500000 得到ɟ。|̵ʏ|ϴʏ|Ȅ URL|͍ ̘、本机 ͪ,以及 //… 相对͝(ƚϽ ʺ ˢ)。|π非回环 ͪ(ƨ明文传输;须将准确的 ȟ:ˢ 加入ɮ)|+ ǐ ʜ|ǐ 预设ȅ活跃Ȯ池Ǫʜ,Ȁ管理后台 X-Admin-ƞ(ιƈ Ƕ ͞)。请̓˘͂与ˢ;令牌̑ǯƨ。|Ȅ方法|Ȅ头 (ɳ)|Ȅ体 (ɳ)|Ǔ不̾;ɳ 原文Lj并̾。ȉ ɰ 为 ʩ/json,ʎȄ头ʞ。|解析϶ (ɳ)|ƛƃƁǜ|ƕȰ (ǝ)|ƃ原Ǡ|按ƁǠ͋(Ί ƃ)|ȀƁ͕与͚;ƃǠο端点原Ǡ。̷Ǡ及ʜ不͋。|ƃ {Ƃ}|˙ƺ {Ƃ}|ƺ {Ƃ}|ƃȯ (蓝=ƃ,橙=˙,灰=ƺ)|ȯɚ|各组ȯ可͗ˤ填充ɚ:「Ǫɚ」满̌、随ɜ递减;「ƺɚ」空̌、随ɜ填满。|ƃ条(Ɩ/ƛ)|Ɲ条|Go ƀ条|Ƒ / ǔ ƀ条|Ǫɚ(满 → 空)|ƺɚ(空 → 满)|ƀη (ȁ)|Ǔ则ˍȀ Ƕ 返回的 max_ǃ;仍无则Ɓ整条浅蓝|ɳ ͓无效|{{Љ_NAME}} 从ƨ库或ʚȅ。<Ή>_Ƕ_І 中 Ή 为大写 ɇ ID,Ϯ改下划线,如 Ϊ→Μ_Ƕ_І。χ共用ȣ。|ƨɮ (Ȗ)|Ȅ头带ȣ时仅ϝ̹内ȟ,Ǔ则ϝ并警告,防ʒ他人Ǧ外带ȣ。|ƨƍ|为ɐ {{Љ}} ̅存入ȣ(̳-ȹ,̿ƨ库,不ϋ):|Ȅ头还没有 {{Љ}} ̅:ώ如 "ɡ": "Beʫr {{MY_Ƕ_І}}" 后ʡ会出现ƨƍ框。|lj|Ǫ {ȝ} · ƺ {spend} / ƀ {maxǘ} · ǯ于 {Ɨ}|Ǫ {Ƃ}|ƕƛƃ|Ɛ DZƀ|Go|ʖ 5 ǫ|͑|Ȃ|ʣ:{Ɨ}|已到ʣǮ|Ǫ {d}天{h}ǫ|Ǫ {h}ǫ{m}分|Ǫ {m}ǝ|ƺ {ά}%|Ǫ {ά}%|{}%|ǯ于 {Ɨ}|Go ƀƁǜ|Go ƀƕȰ(ǝ)|ǝ|Ɛ Ƕ ͞(ȁ,Ǔƚ̽)|Go ƀ主˞|Go NJ|已Ǧ(ɛ:{ǿ})|未Ǧ|Lj|ˣƨ|Ȫ|Lj中…|ȣ只ʌ ʺ ƨ库,不Lj在ǥ里,也̴ϋ。|以下ȣξǒǥ,未迁入ƨ库。请ϒϑʚ后重启:|ƝNJ|ƕƀ|未Ǣƀ|˲(ʼ/Max)|Z.ai / 智谱 GLM ǧ Ƒ|ɴ ƞ Ƒ|ɴ Ƒ|Ǣύ(̘)|ǓƚˤƖ站点。̓后 ͞ 仅发往该ύ;Ȁ可信͂,不含͝。|5h|7d|Ϛ Ɗ ̶页(plat˹m.̠.К/ƾ)|͢ (ǔ) ƀ|5h ƀ|周ƀ|{Ɨ} ʣ|未取得ƀ,请lj并ȫ ǔ Ϝ;ʙϿ|Ɓ ǔ ƀ(需ȫ ǔ Ϝ)|在ʉƁ ǔ ƀ|在ƍ区Ɓ ǔ ƀ|本Ɔƅσ̆|ȧƀǡ|Ɓǜ|选「̄Ƣ / λ」后Ɓƀɑ;窄栏ƁȬ。|Ƕ ͞(ȁ,Ǔƚ̽)|ƕȰ(ǝ)|ƕ|ȫ|ȫ中…|未Ǣƀ|ЅЙxyǶ ϲƀ|ɝɛ|ɛʏ|̔|Ɓǜ|ƕȰ(ǝ)|ƨɮ(ȟ:ˢ,Ȗ)|ʾ ͞(̿)|Ϩ|不͍的 ɇ|˝|未̽Ȯ|抓取于 {Ɨ}|ˑȮ (nj: {Ǐ})|只Ɓ Θ ƀ|ƕ|先˓lj̒|lj并LjƁǜ́ƕ|̺|˓lj后会排到最上面;点ʏ可ɖ该项自己的Ǧ。ƛƃ͐ 8 条,ϲɛ͐ 4 条。|未lj。Nj后ϓƕȰǢ该˕的 ȳ ƀ并Ɓ在ʡ。|Nj后ȅ Ɛ 的ʖ 5 ǫ、周、月ƀ,Ɓ在ʉ、Ʀ页及Ǘ;无DZ时ǭυ。|ǗƁ(Ѝ)|在ǗƁ Ɛ ƀ / Ɲ|ʖ 5 ǫƀ|͑ƀ|Ȃƀ|Ɲƺ%|5h|周|月|日|Ɲ|ǥȅƱ:{ơ}|正在ȅǥ…|ǥ不˖|ưƱ:{ơ}|Ƹǣ已Ȫ。|ȪƱ:{ơ}|Ǭʟ已Ȣ,按˗ƄƏ|尚未ˠ(ˠǮ:{Ɨ}),nj按˗ƄƏ|njϏ峰Ƴ,按ƹ价Ə|nj为 Ɗ ƹ高价Ƴ,按ƹ价Ə|njϏ谷Ƴ,按Ǥ价Ə|ɓƳ——全Ȇ(周六及周日ː按Ǥ价Ə)|ɓƳ——全Ȇ|ɓ全谷|ȕ——ːȆ|ȕ——全Ȇ|假日|ȕ(̻ȥ,Ȗ)|自 2026-08-23 ̻Ǯ 00:00 起,ɓ和Ư;调休上班的ɓ仍按Ȇ。|ƹ|ϖ|ǬƳ条Ϥ|简洁(单行ϰ)|经典(分段与胶囊芯片)|峰/谷ˑ前͈ə|提前ə(ǝ,1-30)|əϯ|ȇƹ|ȇǤ|峰和谷|τȇƹ|τȇǤ|约 {Ɨ} 后Ə˞ˑ为{phase}价,请注意本ƳƠ成本。|ƹ|Ǥ|̎|峰价ə|Ȇə|͈ǜ|Ǘ|ϔ中心|ư̾系统Ͼ|Ϙ后͜ȩ͂栏πϾϢ,才能在页面最小化/切走时收到ə。|ʤ͈|ʤ ȇ峰|ʤ ȇ谷|(ʤ)|Ǭʟ与ǭ|ǭ已Ȉ:需ljǬʟ并Nj「Ʋ」。|常规|Ƭ与Ǡ|ƢƁ|͙ʉƁ|精简ɑ,ʊƬ、ƀ和͊详情;高度͐占ϔ 38%,ϼ可ʖ。Ȣ后Ȥ。|试试更轻巧的ʉ|͙Ɓ可以为Ɔ̹留出更多空间。要ϩNj吗?νʎ「Ʀ → ƅ → Ɓ」中ˑ。|Nj͙Ɓ|ʊnjƁ|Ʀ未能Lj。可Ͽ,或Ȣǭ后在Ʀ中ϸ。|Ȣǭ|ƥ / {Ǒ}Ɲ|ƢȯϤ|͒|ϰ(两列)|Ȥ已ʝ的ƈ ({˪})|ʝ会Ȫɗ映射并Ȉ此行,可Ȥ;̴̺ƫǣ,ʐ按ƚǞ϶ʟ。|Ǘ角标|NJ|ɒɘ|未核价|已ƛ|这个Ƅ是你ɗ改过的,ƚư̴ʞ它。|Ȥƚư|按ƈǰ(ʸ 与ƅ)|ʉƈϳ|{n} ƈ|其它|Ɓƈϳɑ|ȉɖ|记住ɖϨ|Ɓ ƞ|Ɓƅ占比条|ǗƁ Щ-1 ƈ|ȉʑ|收起摘要|ɑǜ|ƈ行数(1–10)|ƕȰ(10–60 秒)|ʑϙ与ƈ数|Щ-1 ƈ与Ƭ|顶部|ƃν|ϗ|ƥ|近 90 天|ƅ排行|ƞ ɜ|Ǝǟ率|̋?|长Ơ无Ǝǟ:代理̀ʝƎϐ。Ƭ按全未ǟ计,是ζ;可直连核对。|̈ · 每ɟ ʸ 数|ƍ|Ǝ|ƻ|该Ƴȧƫǡ。|综合ʍ {ƽ}/M|ǟ率=Ǝ读÷(Ǝ读+普通ƍ);「̋?」表示Ǝϐ̀ϱ,Ƭ为ζ。ʍ=ƅ÷ʸ×1M;̈=ʸ÷ƅ。|未分ƈ(ϟǡ · 按当时ǣƏ)|本Ɔ {Ƃ}(Ƕ)· Ƒ ɞ {Ǿ} · ǟ {ɾ} · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|本Ɔ {Ƃ}(Ƕ)· Ƒ ɞ {Ǿ}|ƅ {Ƃ}(+Ƒ)|Ƒ DZƀɜ(ɞ){Ƃ}|ƞ Ƒ ƫǰ(每 1% 与͖Ƞ)|尚无 ǧ Ƒ ƀǡ;͜「ƀ」页Nj并ƕ˕。|͘|ƺ %|本ʑ˘(ǒǥ)|每 1% ƀ ≈|͖ 100% ≈|ʣ {Ɨ}|˥差分|njƫ͋|ϥκ|{ɿ}(基准 {Ɨ})|读数͚受限|Ƒ ƫ曲线(按ʢ聚合)|͔|每周|每月|˥κ:至少两次成功ƕ,且ƀȬφ变化。|{ɻ}:͖估计 ≈ {̢}(每 1% ≈ {Ч1})· ˘ {ƙ} / {Ʒ} · {Džs} 个ʢ|Ƭ是Ϭ价ɞ;DZ耗ƀ,Ɲ只计 Ƕ。Ƞ仅含 dsh Ơ;服务端Ȭ含全Ȯ。短时ϥ͚有限;5h ʖ,周/月按ǒ日历。|Ə方式|Ƒ DZ|ƚ|Ƕ ϛ|在ƅƦϭƁ|仅控制是否在ƅƄ表ϭƁ;不˚ɘ和Ə。ɒ˓后ξƄ表内,可随时改回。|ɖ˕可ˣƄ;ɒɘ的ʋƈʎˋȤ。|̸Ʀˏ|可ƍ 2 × 0.8|ˎˏ会ư到本ƈȡʍ|仅ˎ̒的ˏ;ɒ˓Ȥ统一ˏ|请ƍ非负ʍ或乘法,例如 2 × 0.8|˝ƈ名ƚǞ|ƚ(去ω / 前缀 / 家族相似)|仅͛Ǟ|ɗ指定ˍ;ƚǞ只接受χ及ȥ、ϧ、ε文ω。未ǟ的 Ɗ 用ȉ价,̷˟不ʟ。|待Ǟ与ɗƦ|按˟和ƈ̸Ʀ:ˤƄ̏、ƛƄ,或标记为ǒƈ。ƛƄ只ˡnj˟。|Ɗ ȉ价|ʝ|ǒƈ(零ɜ)|已ǞƄ的ƈ|njȀƚǞ。可改选Ƅ̏、ƛƄ或零ƅ;Lj后移入ɐɗƦ区。ƞ 仍会ǰ。|οƚǟ|ȧɗǞʞ。|已ɘ(参与Ə)|ƍ|Ǝȅ|Ǝʌ|Ǔ时按Ǝȅ价Ə|ƻ|Ɗ Ƅ表(已ɘ)|Ι / ̙|ʿ|ʨ 硅基流动|CommƼCode|SCNet 超算互联网 ƞ Ƒ|ʘ Ȳ ǧ Ƒ|̼ ͯ ƞ Ƒ|小米 MiMo ƞ Ƒ|ͧ (Droid)|Ƙ|Ƙ ̇ ID|仅在 ʺ Ơ Ƙ Ƕ 也可Ə,无需ɕ Ƙ ͇。远端ƀǢ另需 Ƙ Cloud 的̇ ID 与 ʥ(ι͌ Ƕ ͞);未Ǧ时可Ȣƀɑ,ƆƏ照常。͘ͅ与ЀςƁ。公开ϬƄˡ Ƒ ɞȠ;Ѐ扣费͜Ə分类中设为 Ƕ。|ƀϯ|StƼard + Core|组织 ID(ȁ)|ͅʜ|补偿ʜ|ƃ|ƀɛ|ǒȠ|Ɩ Ѕ|ϫ Ѕ|Ѕ 模式需在 ʺ ȟɕ @ɪ/ʷ,并ǁ ǻ。|ϫ Ѕ:在 ʺ ȟɕ ʭ。ȫ按钮会在该ȟϚ授权ȩ;远程或无Ϫȟ请ǁ bl ǻ --ɹ。|ϡ Ǎ ƀ(个人版 Lite 5 万 / ͒版 50 万,以DZ页μ)|DZ̐(ȁ,͓ Ǻ;Ǔʔ)|Ǎ ̉ʞ(ȁ;每百万 ʸ 抵扣的 Ǎ,Ǔ用ʋ表)|ƈ名,如 qwen3.8-ʵ|费率|ƍ|Ǝ读|ƻ|待填齐三项正数后ƚLj;ȡ清空Ȥʋ表。|ɝ|Ǎ ǒȠ,以̊μ。ǰ归属̼ͅ的 Ƒ Ơ;ˌϛ Ƕ。ϵƈ需设̉。|ǒȠϡ Ǎ ƀ(˗ 60,000 / ͒ 240,000 / 高级 600,000)|DZ̐(ȁ,͓ Ǻ;Ǔʔ)|ˍ用 24 ǫ内的͉̊,否则按ǒǥ和Ɩ Ǎ 表Ƞ。̷ϕ和ϵƈˌ入。|ʗ ȗ ID|ʗ Secretȗ|ʘ需 AK/SK、Ȋ 和 ƿ;可填ƨ或ϒ Π_˱/Π_˴。只连接 Ц.ɤ.К。|AK...|SK...|{h}ǫ|{h}ǫ{m}分|{m}ǝ|{Ɨ}后ȇϖ|{Ɨ}后ȇ高峰|峰Ƴ(UTC):{ʇ};ˠǮ:{Ɨ}。{ˉ}|未ǦǬƳ。{ˉ}|˝|ƥƅ|Ȃƅ|ȭƅ|自ǥ建立以来 · Ơ {ƶ} 次|̈́ƫ|ʺ + ̈́合计|͉̈́超过 24 ǫ未ǯ|近期͔ǣ|Ƭ取Ϡ͉,̀比ƖϹ晚几ǝ。ƙ 含ƍ、ƻ、Ǝ和͌;͌并入ƻƏ。以Ƭ͆。|ƥ/Ȃ按宿主͏ {ʳ},ȩ为 {Ȏ}。͏不同会˚日界和͆;可将 dsh 改为ǒ͏。|ƥƆ|ʙȥ行可ɖ˙ƆȦ|ƆȦ˒中…|该日无ƆȦ(ϟǡ或Ɔ˜已清理)|ƆȦ˒Ʊ|按Ɔǰ(ȡƸ)|跨天合并,̆按Ϙ归并。仅列选定ϣ,ȭƅσȡ对话。|ȧƆǡ|Ɔʕ中…|ƆʕƱ|Ɓϣ|Ɔ̹附显Ɔ ID|Ƭ含 Ƒ ϙ|Nj后所有Ƭ按含 Ƒ DZɞ的总ƅ展示;Ȣ(ȉ)仅计真金白银 Ƕ ˟|ȈƖʠƃ(Nj后Ƣ与Ʀ页θƁƖƃ)|ȈƥɜƬ(Nj后Ƣ/ƝȦ/ϦɑθƁƥƅ)|Ȉ̍ƅȦρ|Ȉƍ框ˋƅȦρ|Ȉ每轮回复ψ本轮ƅ|排序|ƅ 高→低|ƅ 低→高|Ǯ 新→旧|Ǯ 旧→新|实时顺序|Ƹǣ|ƞ ƫǰ|ȭ {ƙ} ƙ · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ} · {ƶ} 次Ơ|{ɻ}:共 {ƙ} ƙ(ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ})· {ƶ} 次Ơ · {Ʒ}|ȧƸǡ,ȼ͔ƫ会Ƚ|ƫ|ƞ ƫǰǜ|ƅƦ|通用Ʀ|͗分节(ƫ)|ƁƦ|Ϧ|ƀ|ƫ|Ƅ|Ɓ|Ƹǡ|ƆƅƁǜ|ƍ区ˋ|Ɔ̍|Ȣ|ƍȨƀȃ|ljƀȃ(ƍȨ一条横排Ɓ)|ȃ含Ɲƺ%|ȃ含 Go ƀ|ȃ含 ǧ Ƒ ƀ|ȃ͊可见各͘ʣ͎与ǯǮ;无˖ƀǡ时ƚȈ。|Ϟ:ƍȨƀȃ|在ƍȨƁƝ及 Ɛ/ǧ Ƒ ƀȬ。ϩNj吗?ʎ「Ʀ → ƁƦ」ˎ。|Njȃ|暂不Nj|ʙ立即ƕ|Ϟ:ƃɔʙƕ|ʙƢƃ或 ǧ Ƒ ɔ即可ƕ;ƕ时ɔ闪烁,Ʊ时ʊ原值并在͊ǭ中说明υ。|̎|˙ƅƁ|Ƣϗ|Ϻ单位|ǵ Ζ|ɟ Ί|欧元 EUR|ϺϮ|͕(1 ɟ = ? 目标Ǡ)|小数位数|ƃƁǜ|̄Ƣ|Ʀ页|λ都Ɓ|ƃƕȰ(ǝ)|lj Ɗ ǬƳƄ|Ʋ(ƢƝ框/ƥƅ;Ʀ页Ǭ面板内ʤ)|Ɔ按Ơ时ƄƏ(含Ǭ与Ƹ˞)。ƍ、ƻ、Ǝ读写ςǰ;͗Ǝʌ价与长ε˛位按Ǧˠ。|已ɘ的Ƅ表|ƖƄǠ|ɟ(ϴƖ页)|ǵ(̵Ɩ页)|决定ưƄ所用的Ɩ页Ϸ;ưψƄˡʐƠ。|Й 与 ʦ ̸按ƖʍƏ,旧 ʦ ʏ按 ʦ 价结算。工作日̻Ǯ 09–12、14–18 为峰Ƴ,ɓ及Ư。改价ˡʐƠ,已ǣƬʊ;修正旧ƅ请ʛ后ȀƸ重算。Ǝʌ按ǟ价。|ʡƁnj适用Ƅ。手工ˣ会ɒ此条ʐ预定调价,已φ的ƸƄ仍ʊ。|Ȑ(未Ǟƈ时ό)|新ƈ ID(如 ȸ)|ɝƈ|ǡ与ư|Lj中…|ƚLjƱ:{ơ}|已ƚLj {Ɨ}|Ǧˎ后ƚLj|ʛ用Ɩ˛ƄʞƄ表?|͇|ɒ|从Ɩ˛ưƄ|Ɩư只ǯ Ɗ Ƅ(含Ǭ);z-ai/Ι/ͯ/ɀ 等第三方Ƅ随ϧǯ,ʎƄ表ɖϑ˕ˣ,或用ƈ名Ǟϸ。|ʛȪȡƸ?|ȻƸ|ʛʒ?将ϊȡƆ˜,只补ǥϱ的ȥ与Ɔ,不˚已有ǣ。|ȻƸƱ:{ơ}|首次启动ƚʒ旧ǣ;拷入˜́重跑。按njƄ回推;已̺˜无法ϊ,跨ɕ͎的Ɔˌ此前ƫ。|ʛȪ|ȪȡƸ|Ϡư:{Ɨ}|从未(ȀʋƄ)|;ɛ:{ǿ}|Ɩ˛|ʋȉ|ϪϷ|Ͻ ʺ(ƚ)|简体̵|ɲ|ƅ|{ɿ} ƠƱ|ưƠƱ|ƃƕƠƱ'],["en",`ɂ of Ȟ Ɖ (Ǽ ˅ Џ c˶ Ɨ)|Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|Ƿ: ̩ {̩} · ̳ {̳} (̳s Ǽ at Ɵ hit ƽ)|ɂ {Ƃ}|ɶ Ɖ {Ƃ} · Hit {ɾ} · Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|ɶ Ɖ {Ƃ}|ɢ Ƃ ȹ|UnΏed|Ζ ɭs ̂ Ί Ɣ × {ʁ}. To Кpʫ ƌ Ζ bills, β Ζ, Ɵn δ Ɣ; δing affects ȹ new ƶ.|Ʃ Α ǚ: {ơ}|˧ error|Ʃ|Query ǚ|Ɗ Ц-plat˹m Ǐ ƒ|Cross-check ƌ ƒ ˄s against Ɵ Ȓ (warn ̱ Ɵy diverge)|Total {Ƃ}|ͩ {ɽ} · ˵ {ɏ}|ɷ {Ɨ}|ǘ ({Ǒ})|ͱ {ʆ} / {Ƃ}|ȱ {Ƃ} · {ά} of ǃ|ɶ ǹ {ǹ} · Л Ɨ {ɭ}|ǘ|ȱ's Ʒ (Ǽ ˅ ƌ Ɣ)|ȱ's ʸ ƾ|ƙ|C˶s {ƶ} · Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|ɶ ǹ {Ƃ}|Л Ɨ {Ƃ}|ȱ|ȿ ˰ Ɠ|ɂ|ƞ ƾ|ȱ|ɶ ǹ|Л Ɨ|ɱ ̨|No Ǜ З. Once you Γ chatting, Ʒs ʫ ˃ ͺ Ч Ќ.|Date|C˶s|In Е|Ƿ Е|Out Е|ɂ|No Ɖs ̪ ˰.|ɵ|ƭ ǃ|ǘ Ƃ (in Ɠ DŽ)|ǘ Ǒ|Start ɻ|End ɻ (Ǹ = ˰)|Range: {̨}|ƭ a ǃ to see У Ώ, ʆ Ƃ Ƽ ˈ in Ɵ Ɠ DŽ. Choose ˰, ǹ, ˶ Ɨ or a Ɋ ̨.|{Ǒ} ǃ {Ƃ} · ͱ {ʆ} · {ά}%| (over Ώ)| (near Ώ)|Legacy|ͥ f˶Р|ˀ|Base|Ȍ|ʧ|Ʃ Ƕ ͽ|ɶ Open Plat˹m ͽ takes ̥; oƟrwise Ɵ ˿ ƌ Ǐ ƒ is ̩, Ɵn Ǖ Ƨs.|Total {ɭ} · ͩ {ɽ} · ˵ {ɏ} · ɷ {Ɨ}|Ʃ Α ǚ: {ơ}|Ʃ Ϳ queried|Ac˪ ƒ|ǎing…|ǎ ƒ|ɱ ̧ ƒ|Ё entry|Ё ƞ Ξ ƒ|ɢs available Ζ ƒ ɼ Ɵ ƌ Ǐ ˺. Sign in at ʸrhythm.γ. In Ȏ DevTools, copy Ɵ Ǐ request ̕ ɼ Network, or Ɵ tr_Ɖ Ε ɼ Storage / Application. О it beЪ Ƽ Υ Ȟ Ͷ. ̕s ̀ in Ɵ ʺ Ƨ ̯; Ɵm ̱ expired.|Ё Qianwen / ɠ ƒ|ɢs ɠ China funds. RAM ȗ needs bss:Ǚ. The Ύ two Φ ʫ ΄d; ̛ ƞ is ˹ STS. Secrets ̀ in Ɵ Ƨ ̯.|ͦ Ͳ paths, numbers Ƽ add/̰/Τ. Divide Λ Ƈ by 500000 ˹ Ί.|Dz ;|ɲ ;|Ͱ URL|Supήs ̘, ȴ ͪ Ƽ //… paths Д ̡ Ɵ ȏ ʺ ή.|Лow non-loopР ͪ (plaintext Ƨs; ̫ Ɵ exact ʳ:ή in ˶owed ʳs)|+ ǐ dz|The ǐ preset ˯ ȝ dz across Ρ Ǐs using an admin X-Admin-ƞ, Ϳ a Ǖ Ƕ ͽ. Set Ɵ ̞ ˩ Ƽ ή; Ɵ Ƨ ̱ it expires.|ͪ ɿ|Headers (ɳ)|Ͱ body (ɳ)|Blank sends no body; ɳ text is Β Ƽ sent as entered. ɰ Ȑs to ʩ/json; ˫ С ̤ it.|ͦ rules (ɳ)|ɱ ƒ Ɠ|Ʈ (Ǵ)|̜ DŽ|Convert Ί ƒ to Ɠ DŽ|Uses Ɵ Ɠ ʁ Ƽ ˼. Ї Ɵ ǿ DŽ; oƟr currencies Ƽ dz ɍ.|Ʃ {Ƃ}|ȱ {Ƃ}|Spent {Ƃ}|Ʃ ̦ Ђ (blue=ƒ, ǫ=˰, gray=spent)|Йgress Ђ ˸|Each group of Ђs С independently choose У fill ˸: "Ț" Γs ̢ Ƽ drains ˊ ƾ; "ͱ" Γs Ǹ Ƽ fills up.|Ʃ Ђs (ƌ/Ɋ)|ǘ Ђ|Go Ƈ Ђ|Ƒ / ǔ Ƈ Ђs|Ț (̢ → Ǹ)|ͱ (Ǹ → ̢)|ǘ cap (ǖ)|Leave Ǹ to ̂ Ƕ max_ǃ; if still ˭, Г ̢ light-blue Ђ|Invalid ɳ|{{Љ_NAME}} ˯ a Ƨ or ʰ variable. <Ή>_Ƕ_І ̂s an upЧcase ɇ ID ˊ underscores, such as Ϊ→Μ_Ƕ_І. Names С shʫ a ͽ.|Лowed ʳs (ȷ)|Њ ˫ carry Ƨs ȹ listed ʳs ʫ ˶owed; А Ǹ to ˶ow ˊ a warning. Йtects ͽs ̱ Χing someone else's config.|ʽ ƣ|Store Ɵ ͽ ˹ Џ {{Љ}} placehХer ɦ (̳-ȹ: ̯d in Ɵ ʺ Ƨ ̯, ȓ):|No {{Љ}} placehХers in Ɵ ˫ З — add e.g. "ɡ": "Beʫr {{MY_Ƕ_І}}" Ƽ a Ƨ ƣ Ж appear ͺ.|ƭ|Ț {ȝ} · Spent {spend} / ǘ {maxǘ} · ɷ {Ɨ}|Ț {Ƃ}|ǎ Ɋ ƒ|Ɛ Ȕ Ƈ|Go|Rolling 5h|˂|Ⱦ|Resets: {Ɨ}|Reset Ɨ rЏed|{d}d {h}h Б|{h}h {m}m Б|{m}m Б|{ά}% ʆ|{ά}% ȝ|{}%|ɷ {Ɨ}|Go Ƈ Ɠ dž|Go Ƈ Ƶ Dž (Ǵ)|min|Ɛ Ƕ ͽ (ǖ; Ǹ = ʬ)|Go Ƈ primary ̲|Go Ѓ ƴ|Configured (ǿ: {ǿ})|Н ǽ|О|Edit Ƨ|Clear|Ο…|The ͽ is written to Ɵ ʺ Ƨ ̯ ȹ — it is never Β in Ɵ Ȝ Ƽ ȓ.|These Ƨs ΰ in Ɵ Ȓ. Exή Ɵ ʴ ʰ variables Ƽ reΓ:|ǘ Ѓ ƴ|ǎ Ƈ|ȍ|˲ (ʼ/Max)|Z.ai / Zhipu GLM ǧ Ƒ|ɴ ƞ Ƒ|ɴ Ƒ|ɥ Ϋ (̘)|Empty: ƌ sites. OƟrwise Ɵ ͞ is sent ȹ to Ȟ Ϋ. Use a trusted ˩ ˊout a path.|5h|7d|Open Ɗ top-up ˺ (plat˹m.̠.К/ƾ)|͢ (ǔ) Ƈ|5h Ƈ|˂ Ƈ|α {Ɨ}|ɥ ʹ. ƭ Ƽ sign in to a ǔ έ; Ό to retry.|ɢ ǔ Ƈ (̫ a ˿ ǔ έ)|ɢ ǔ Ƈ in ǀ|ɢ ǔ Ƈ ɦ ʮ|ͬ ́ in Ɖ Ʒ|No Ƈ ʯ|ȋ dž|“Main ǀ / Є” ̭ a Ƈ Ͷ; Ɵ narЫ rail ̭ ȵ.|Ƕ ͽ (ǖ; Ǹ = ʬ)|Ʈ (Ǵ)|ǎ|Login|Signing in…|ȍ|ЅЙxyǶ Ƈs|Ё ǿ|̜ label|̔|ȋ|Ʈ (Ǵ)|ʽ ˶owlist (ʳ:ή, ȷ)|ʾ ͽ (̳-ȹ)|Status|Unsupήed ˽|˧|No Ǐs|fetched {Ɨ}|Switch Ǐ (ȏ: {Ǐ})|Θ Ƈ ȹ|ǎ|ƭ Ȟ item Ύ|ƭ Ƽ Ш a Ɠ dž to Ƶ|ˀ|ƭd items move to Ɵ top; Ό a ; to expƼ У own LJ. Up to 8 Ɋ ƒs Ƽ 4 ǿs.|Disabled. ƭ it to Α Ȟ vendor's ȳ Ƈ on Ɵ Ƶ Dž Ƽ Г it ͺ.|ƭ Ɛ rolling 5h, weekly Ƽ ǹly Ƈs in Ɵ ǀ, ǂ Ƽ ɸ . Missing Ȕs Г a ί.|ɯ (Ѝ) Ɠ|ɢ Ɛ Ƈ / ǃ at Ɵ ɸ|Rolling-5h Ƈ|˂ Ƈ|Ⱦ Ƈ|ǘ ʆ %|5h|Wk|Mo|Daily|ǘ|Κ ̩ ǚ: {ơ}|Reading Ȝ…|Κ ʹ|Ј ǚ: {ơ}|˦ cleʫd.|Clear ǚ: {ơ}|ʧ/Ƌ Ɂ is off; base Ɣ ʫ ʆ|Н З ɧ (ɧ at {Ɨ}); base Ɣ ʫ ȏly ʆ|ʧ hour В; Ⱥ Ɣ ʪ|Ɗ Ⱥ-hour Ɂ is Ρ; ȏ ƶ ʫ Ǽ at Ⱥ Ɣ|Ȍ В; Ƌ Ɣ ʪ|˨ — ˶ Ƌ (Sat & Sun Ǽ at Ƌ Ɣ ˶ Ќ)|˨ — ˶ Ƌ|˨|Dz public ͻ — Ƌ ˶ Ќ|̚ ͻ — ˶ Ƌ|HoliЌ|̚ ͻs (͠ ɻs, Кma sepaʁd)|Since Aug 23, 2026 (͠ Ɨ), Ɯ Ƌ ˶ Ќ, ț work-shift weekends.|ʧ|Ȍ|ʧ Ǒ ɫ style|ͣ (one-line)|Classic (segments & Т)|Popup be˹e Ⱥ/Ƌ switch|Lead Ɨ (Ǵ, 1-30)|Alert type|Ƀ Ⱥ|Ƀ Ƌ|Є|Ƀ Ⱥ ˆ|Ƀ Ƌ ˆ|͡ switches to {phase} Ɂ in about {Ɨ}; mind И c˶ Ʒs in Ȟ ̲.|Ⱥ|Ƌ|Got it|ʧ |Ȍ |Popup dž|ɯ|Screen center|Also send a system ʀ|Њ Υd, ˶ow ʀ Чmission in Ɵ Ȏ ˩ Ђ so you get ed even ̱ Ɵ ˺ is minimized or Рgrounded.|Preview Ɵ popup|ș Ⱥ|ș Ƌ| (preview)|ʧ/Ƌ Ɂ & ̣|Нice hidden: Υ Ⱥ/Ƌ Ɂ Ƽ Ɵ “prominent ̣” toggle.|ͨ|Money & DŽ|ȿ Ɠ|Simplify Ɵ ǀ|Condense Ͷs but Ф Ƃs, Ƈs Ƽ hover ƴ. Height is capped at 38% of Ɵ viewή ˊ scrolling. Turn off Ɏ.|A lighter ǀ|Simple Ɠ Аs more room ˹ ɺs. ƭ it В? You С ˄ it in ǂ → ɂ → ȋ anyƗ.|ƭ simple Ɠ|Ї ȏ Ɠ|ǂ could Ϳ be Β. Retry or dismiss Ȟ guide Ƽ ˄ Ɵm later in ǂ.|Dismiss guide|ȱ / {Ǒ} ǃ|ȿ ̦ style|StƼard|ͣ (2 columns)|Re̯ ʃ Ǖs ({˪})|ˀ Ћs Ɵ ̤ Ƽ hides Ɵ Ы until ʄd. ̝ ʂ ʫ kept; Пmatic ƽ ʴ ͳ.|Corner Тs|Box ƴ|Unmount|Unƽd|ɱ|You edited Ȟ ƽ manu˶y; ˷ Ж Ϳ over̳ it.|Resume ˷|Per-Ǖ statistics (ƙ & Ʒ)|ȿ Ǖ Ʒs|{n} Ǖs|OƟr|ɢ Ǖ Ʒ Ͷ|ExpƼ by Ȑ|Remember expansion|ɢ ƙ|ɢ Ʒ shʫs|Щ Ǖ in Ѝ|ͥ Ǒ|Collapsed summary|Card dž|Model Ыs (1–10)|Ʈ (10–60 seconds)|Period ɭ Ƽ Ǖ ˪|Щ Ǖ Ƽ Ʒ|Щ|After ƒs|Bottom|ȱ|Last 90 Ќs|ɂ ˮ|ƞ ƾ|Ƿ hit ʁ|unreήed?|Zero ƪ hУ on long ƶ may mean a relay ʃ ƪ Φ. Л-miss Ʒ ȑ; check ˊ Ɵ Σ Ƕ.|Value · ƙ Ч Ί|Ʌ|Ƿ|Ș|No ƾ ʯ ˹ Ȟ Ǒ.|blended {ƽ}/M|Hit ʁ = ƪ ˯ ÷ (˯ + unƪd ƣ). “Unreήed?” means ƪ ʯ may be ˭, so Ʒ ȑ. Unit ƽ = Ʒ ÷ ƙ × 1M; Ε = ƙ ÷ Ʒ.|Unattributed (early ʯ · Ǽ as ̪)|ɶ Ɖ {Ƃ} (Ƕ) · Ƒ . {Ǿ} · Hit {ɾ} · Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|ɶ Ɖ {Ƃ} (Ƕ) · Ƒ . {Ǿ}|ɂ {Ƃ} (+Ƒ)|Ƒ Ȕ Ƈ ƾ (.) {Ƃ}|ƞ Ƒ ƾ Δ (Ч-1% & ʲ ɨ)|No ǧ Ƒ Ƈ ʯ З. ƭ Ƽ Ƶ a ̧ under ɥs.|Window|ͱ %|ɶ Ǒ ̞ (Ȓ)|Per 1% Ƈ ≈|Full ̲ (100%) ≈|α {Ɨ}|̬ delta|ȏ ƾ ratio|Ϳ ɋ|{ɿ} (as of {Ɨ})|Ъ ̩ing ˼|Ƒ ƾ curves (˃ ɼ ̬ Džs)|Daily|˂|Ⱦ|Н ɋ: Ƶ success̢y twice ˊ a Ƈ ˈ ˄.|{ɻ}: ʲ est. ≈ {̢} (Ч 1% ≈ {Ч1}) · ̞ {ƙ} / {Ʒ} · {Džs} ̬ Dž(s)|͟ ʫ catalog-ƽ alents. Ƒs ̂ Ƈ; ǃs ˪ Ƕ ȹ. Estimates cover dsh ƶ, while server ȵ cover Ɵ Ǐ. Short ̬s ʫ less precise. 5h rolls; week/ǹ ̂ ȴ ɻs.|͡ class|Ƒ Ȕ|М|Ƕ ƾ|ɢ Σly in ɂ LJ|Controls Σ Ɠ in Ɵ ƽ ɬ; mounting Ƽ ʹ ɍ. Hidden Ͷs ̀ rЏable in Ɵ ɬ.|ExpƼ Ɉ to edit Ɣ; ʄ unmounted ͵ Ǖs beЪ.|Sepaʁ ˇs|Try 2 × 0.8|Changing Ɵ ˇ ͳ to ˶ ǩ ˹ Ȟ Ǖ|Η Ȟ ʁ ȹ; uncheck Ɏ Ɵ shʫd ˇ|· a non-negative ʁ or multiplication, e.g. 2 × 0.8|ʻ ΅ Ǖ ;s|М (ɫ suffix / prefix / family similarity)|Exact ΐ ȹ|Manual ɩ take ̥. ʻ Ͳ ȹ Ɵ same ; or ɻ, version Ƽ context suffixes. ˧ Ɗ Ǖs ̂ Ɵ Ȑ ƽ; oƟr ˽ ̀ unƽd.|Unΐed Ƽ manu˶y ǽ Ǖs|Set Џ ͷ Ƽ Ǖ sepaʁly: β ȶ, ̂ a Ɋ ƽ, or mark as ȴ. ɱ Ɣ ʪ ȹ to Д ͷ.|Ɗ Ȑ ƽ|ˀ|Έ Ǖ (zero Ʒ)|Matched Ǖs|Currently ΐed ɣ. Select ȶ, Ɋ ƽ or zero Ʒ. Оd ˄s move to Ɵ Ω list ɦ; ƙ still ˪.|Ї П ΐ|No Ω ΐ ɩ.|ͮ (Ǽ)|Ʌ|Ƿ ̩|Ƿ ̳|Leave blank to ̂ Ɵ ƪ-̩ ƽ|Ș|Ɗ ƽ ɬ (mounted)|Ι / ̙|ʿ|ʨ|CommƼCode|SCNet ƞ Ƒ|Ȳ ǧ Ƒ|ͯ ƞ Ƒ (ɪ.К)|Xiaomi MiMo ƞ Ƒ|ͧ (Droid)|Ƙ|Ƙ ʈ|Using Ƙ Ƕs in ʺ does Ϳ ΄ inst˶ing Ɵ Ƙ app. Remote Ƈ queries sepaʁly ΄ an Ƙ Cloud ʈ Ƽ ʥ (Ϳ an inference Ƕ ͽ); А Ɵ Ƈ Ͷ off to Ф using ɺ Ʒ tracking ˊout Ɵm. Ƒ ʇ Ƽ w˶et ̀ sepaʁ. ̚ Ɣ ʱ Ƒ-alent Ʒ; classify w˶et-funded ƶ as Ƕ in ʹ LJ.|ɥ pool|StƼard + Core|Organization ID (ǖ)|Ƒ dz|Compensation|Ʃ|ɥ ǿ|Έ ʱ|Ɇ Ѕ|Bailian Ѕ|Inst˶ @ɪ/ʷ on Ɵ ʺ ʳ Ƽ run ǻ as Ɵ ʅ.|Inst˶ ʭ on Ɵ ʺ ʳ. Login Цs Д ʳ’s Ȏ; ˹ a remote or headless ʳ, run bl ǻ --ɹ as Ɵ ʅ.|Ⱦ dz Ƈ (Чsonal Lite 50K / StƼard 500K; see И ˻ ˺)|Ƒ Γ ɻ (ǖ, Ǻ; Ǹ = ̟ ǹ)|Ǎ ʁ ɩ (ǖ; dz deducted Ч 1M ƙ; Ǹ = ɉ)|Model ;, e.g. qwen3.8-ʵ|ʁ|Ʌ|Ƿd ƣ|Ș|· ˶ three positive ǩ to Ш ɣ; Ћ ˶ Ɏ Ɵ ɉ.|Ё|Έ Ǎ ʱ; ɹ is authoritative. Counts Ƒ ƶ assigned to ͯ. Excludes pay-as-you-go Ƕ. Ё ǩ ˹ oƟr Ǖs.|Ⱦ dz Ƈ ˹ ȴ ɨ (Basic 60,000 / StƼard 240,000 / Й 600,000)|Ƒ Γ ɻ (ǖ, Ǻ; Ǹ = ̟ ǹ)|Uses ɹ ̮s newer than 24h, Ɵn ɨ ɼ ȴ ʂ Ƽ ƌ Ǎ ǩ. OƟr tools Ƽ unlisted Ǖs ʫ excluded.|ˁ ȗ ID|ˁ Secretȗ|Ȳ needs AK/SK, Ȋ Ƽ ƿ. · Ƨs or exή Π_˱/Π_˴. Only Ц.ɤ.К is contacted.|AK...|SK...|{h}h|{h}h {m}m|{m}m|Ȍ in {Ɨ}|ʧ in {Ɨ}|ʧ ˬ (UTC): {ʇ}; ɧ: {Ɨ}. {ˉ}|No Ⱥ ʇ ǽ. {ˉ}|΅|ȱ|ɶ ǹ|Л Ɨ|Since Ɵ Ȝ was created · C˶s {ƶ}|̗ ƾ|ʺ + external ɭ|̗ ̮ has Ϳ been upɻd ˹ 24 ˬ|Ν daily ʂ|͟ ̂ Ɵ latest ̮ Ƽ may lag Ɵ ƌ bill by Ǵ. ƞs ͼ ƣ, Ƥ, ƪ Ƽ ˾; ˾ is Ǽ ˊ Ƥ. Reconcile by Ƃ.|ȱ/ǹ ̂ ʳ Ɨzone {ʳ}; Ȟ Ȏ ̂s {Ȏ}. Different Ќ boundaries affect reconciliation. Set dsh to И ȴ Ɨzone to align.|ȱ's Ɖs|Ά a ɻ Ы to expƼ У Ɖ ƴ|ͭ Ɖ ƴ…|No Ɖ ƴ ˹ Ȟ Ќ (early ʯ or Ɖ Ψ cleaned)|Ʉ Ɖ ƴ|By Ɖ (˶ Ǜ)|Days Кbined; ́ ̡ LJ. Selected Ыs Гn; cumulative Ʒs ͼ every ɺ.|No Ɖ ʯ З|ͭ Ɖ ˮ…|Ʉ Ɖ ˮ|Rows|ɢ Ɖ IDs in Ɖ lists|ͬ ˻ ɭs|Њ on, every Ƃ ̭ ɭ alent Ʒ ț ˻ Ȕs; off (Ȑ) ˪s real-money Ƕ ͷs ȹ|ͫ ƌ Ǐ ƒ (ƒ UI ʃ ɼ ǀ Ƽ LJ)|ͫ ˰'s Ʒ (˰'s Ƃ ʃ ɼ ǀ, ǃ ƴ Ƽ overview Ͷ)|ͫ header Ʒ ƴ|ͫ ʮ Ʒ ƴ|ͫ turn Ʒ summaries|Sort|ɂ high→Ъ|ɂ Ъ→high|Time new→Х|Time Х→new|Ν order|˦|ƞ ƾ Δ|Л-Ɨ {ƙ} ƙ · ƣ {ƣ} · ƪ {ƪ} · Ƥ {Ƥ} · {ƶ} ƶ|{ɻ}: {ƙ} ƙ (ƣ {ƣ} · ƪ {ƪ} · Ƥ {Ƥ}) · {ƶ} ƶ · {Ʒ}|No Ǜ З — daily ƾ Ж accumulate ͺ|̝|ƞ ƾ Δ dž|ɂ LJ|ͨ LJ|Own section (̝)|ȋ LJ|Overview|ɥs|̝|Pricing|ȋ|˦ ʯ|ɵ Ʒ Ɠ dž|BeЪ Ɵ ʮ|ɵ title Ђ|Off|ɥ ɫ ɦ Ɵ ƣ|ƭ Ɵ Ƈ ɫ (one Ы ɦ Ɵ ƣ Ѓ)|Ǩ ǃ ʆ %|Ǩ Ɵ Go Ƈ|Ǩ ȳ Ƈs|Hover a Т ˹ reset Ɨs Ƽ Ɵ last Ƶ; Ɵ ɫ hides Уelf ̱ Ɵre is no Ƈ ʯ.|New: Ƈ ɫ ɦ Ɵ ƣ|ɢ ǃ Ƽ Ɛ/coding-˻ ȵ ɦ Ɵ ƣ Ѓ. ƭ В? Η it anyƗ in ǂ → ȋ.|ƭ Ɵ ɫ|Н В|Ά to Ƶ В|New: Ό Ɵ ƒ Ѓ to Ƶ|Ά a ǀ ƒ or ˻ Ѓ to Ƶ. It pulses while loading; on failure it Фs Ɵ Х Ε Ƽ ̭ Ɵ ί on hover.|Got it|ȱ Ʒ Ɠ|ȿ footer|̖|Dz Yuan (Ζ)|US Dollar (Ί)|Euro (EUR)|̖ symbol|Ex˄ ʁ (1 Ί = ? target DŽ)|Decimal places|Ʃ Ɠ dž|Main ǀ|ǂ ˺|Є|Ʃ Ƶ Dž (Ǵ)|Use Ɗ Ⱥ-hour Ɣ|Йminent ̣ during Ⱥ ˬ (ǀ ǃ Ѓ, ˰'s Ʒ; previewed in Ɵ ǂ Ⱥ panel)|ɵ Ʒ ̂s c˶-Ɨ Ɣ, ț Ⱥ Ƽ Ɍ ǩ. Ʌ, Ƥ, ƪ ˯ Ƽ ̳s ʫ sepaʁ; ǽ ƪ-̳ Ƽ long-context ǩ ʪ.|ͮ ƽ ɬs|Ɇ ƽ DŽ|Ί (ɲ ƌ ˺)|Ζ (Dz ƌ ˺)|Selects Ɵ ƌ Ɂ-˺ language. Јed Ɣ ʪ to subsequent ƶ.|Й Ƽ ʦ ̂ sepaʁ ƌ ǩ; legacy ʦ ;s ̂ ʦ ǩ. WeekЌ Ⱥs ʫ 01–04 Ƽ 06–10 UTC; Ɯ Ƌ. Rate ˄s ʪ to later ƶ. Recorded Ƃs ΰ until you confirm Ɍ recalculation. Ƿ ̳s ̂ hit ǩ.|Current ǩ ʫ Гn ͺ. Editing Сcels any future scheduled ˄ ˹ Ȟ entry; Ɍ ǩ ʫ retained.|Ȑ (f˶Р ˹ unΐed Ǖs)|New Ǖ ID (e.g. ȸ)|Ё Ǖ|Data & δ|Ο…|М-Ш ǚ: {ơ}|М-Β {Ɨ}|ǂ ʫ П-Β|Over̳ Ɵ ƽ ɬ ˊ Ɣ ɼ Ɵ ƌ Ў?|Apply|Cancel|Ј Ɣ ɼ ƌ Ў|Ɇ δ upɻs Ɗ Ɣ (ț Ⱥ ǩ). Third-party Ɣ (z-ai/Ι/ͯ/ɀ) ̡ releases; expƼ Ɉ in Ɵ ƽ ɬ or ̂ Ǖ ʴ.|˳ Ǜ?|Imή ʶ Ǜ|ͤ Χ? Replays ˶ Ɖ Ψ Ƽ ȹ fills ɻs/Ɖs ˭ ɼ Ɵ Ȝ; existing ʂ ʫ untouched.|Failed to Χ ʶ Ǜ: {ơ}|Pre-inst˶ Ǜ Χs at Ύ launch; rerun after copying Х Ψ. ɂs ̂ ȏ Ɣ. Deleted Ψ СͿ replay; Ɖs spanning inst˶ation exclude ƾ.|ͤ Ћ|˳ Ǜ|Last δ: {Ɨ}|Never (͵ Ɣ)|; ̜: {ǿ}|Ɇ Ў|Bundled|Language|FolЪ ʺ (П)|Simplified Dz|ɲ|ɂ|{ɿ} c˶ ǚ|Ј c˶ ǚ|Ʃ Ƶ c˶ ǚ`]].map(([e,n])=>{const s=n.replace(/[ƀ-߿]/g,a=>Pn[a.charCodeAt(0)-384]).split("|");return[e,Object.fromEntries(An.map((a,o)=>[a,s[o]]).filter(([,a])=>a!=="\0"))]}));function ya(){return(typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language:"").toLowerCase().startsWith("zh")?"zh":"en"}function Ke(e){const n=typeof e=="string"?e.toLowerCase().split(/[-_]/)[0]:"";return n==="zh"||n==="en"?n:null}function H(e){const n=typeof e=="string"?e:e?.locale;return n==="zh"||n==="en"?n:Ke(e?.activeLocale)||ya()}function G(e){const n=e==="zh"?De.zh:De.en;return(s,a)=>{let o=n[s]??De.en[s]??s;if(a)for(const r of Object.keys(a))o=o.split("{"+r+"}").join(String(a[r]));return o}}const ze={day:"periodDay",month:"periodMonth",all:"periodAll",custom:"periodCustomRange"};function ce(e,n){throw new Error("dsh-cost-meter: 服务端数据非法 ("+e+": "+n+")")}function Se(e,n){return(e===null||typeof e!="object"||Array.isArray(e))&&ce(n,"object"),e}function te(e,n){return(typeof e!="number"||!Number.isFinite(e))&&ce(n,"number"),e}function le(e,n){return typeof e!="string"&&ce(n,"string"),e}const He=(e,n,s)=>typeof e=="string"&&n.includes(e)?e:s;function ka(e,n=!1){return e===null||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([s,a])=>n?s.length>0&&["plan","api"].includes(a):["auto","plan","api"].includes(a)))}function Ce(e,n){return typeof e!="boolean"&&ce(n,"boolean"),e}const Ye=(e,n,s)=>Object.fromEntries(n.map(a=>[a,s(e[a])]));function xa(e,n){const s={};if(e!==null&&typeof e=="object"&&!Array.isArray(e))for(const a of Object.keys(e)){const o=e[a];if(o===null||typeof o!="object"||Array.isArray(o))continue;const r=l=>typeof l=="number"&&Number.isFinite(l)&&l>=0?l:0;s[a]={...Tt(o),...Ye(o,["input","output","cacheRead","cacheWrite","reasoning","cost"],r),apiCost:o.apiCost===void 0?r(o.cost):r(o.apiCost)}}return s}const pt=["costCny","apiCostCny","costEur","apiCostEur"],Tt=e=>Object.fromEntries(pt.filter(n=>Number.isFinite(e?.[n])).map(n=>[n,e[n]]));function wa(e,n){Se(e,n);const s={...Tt(e),reasoning:e.reasoning===void 0?0:te(e.reasoning,n+".reasoning"),apiCost:e.apiCost===void 0?void 0:te(e.apiCost,n+".apiCost"),byModel:xa(e.byModel,n+".byModel"),byProviderModel:xa(e.byProviderModel,n+".byProviderModel")};for(const a of["input","output","cacheRead","cacheWrite","calls","cost"])s[a]=te(e[a],n+"."+a);return s}function Mn(e){return e==null?void 0:{source:le(e.source,"source"),requestId:le(e.requestId,"requestId"),attempt:te(e.attempt,"attempt"),complete:Ce(e.complete,"complete"),status:le(e.status,"status"),upstream:le(e.upstream,"upstream")}}function Na(e){return(Array.isArray(e)?e:ce("rows","array")).map(n=>({provider:le(n.provider,"provider"),model:le(n.model,"model"),bucket:le(n.bucket,"bucket"),tokens:te(n.tokens,"tokens"),...n.requests===void 0?{}:{requests:te(n.requests,"requests")},rate:te(n.rate,"rate"),cost:te(n.cost,"cost"),priced:Ce(n.priced,"priced"),plan:Ce(n.plan,"plan")}))}function Rt(e,n){return{...wa(e,n),id:le(e.id,n+".id"),provider:typeof e.provider=="string"?e.provider:"",model:typeof e.model=="string"?e.model:""}}function Ae(e,n){const s={...wa(e,n),date:le(e.date,n+".date"),sessions:[]};return e.sessions!==void 0&&(Array.isArray(e.sessions)||ce(n+".sessions","array"),s.sessions=e.sessions.map((a,o)=>Rt(a,n+".sessions["+o+"]"))),s}function Ot(e,n,s=["cacheWrite","reasoning"]){const a={};for(const o of["cacheHit","cacheMiss","output"])a[o]=te(e[o],n+"."+o);for(const o of s)e[o]!==void 0&&(a[o]=te(e[o],n+"."+o));return a}function Bt(e,n){Se(e,n);const s={...Ot(e,n),...ft(e)};for(const a of["offPeak","peak","legacyBase","longContext"])e[a]!==void 0&&(s[a]=Ot(e[a],n+"."+a,["cacheWrite","reasoning","aboveInputTokens"]));e.cny!==void 0&&(s.cny=Ot(e.cny,n+".cny")),e.legacy!==void 0&&(s.legacy=Ce(e.legacy,n+".legacy")),e.rateHistory!==void 0&&((!Array.isArray(e.rateHistory)||e.rateHistory.length>16)&&ce(n+".rateHistory","price history"),s.rateHistory=e.rateHistory.map((a,o)=>((!a||typeof a.before!="string"||!Number.isFinite(Date.parse(a.before)))&&ce(n+".rateHistory","dated price"),{...Bt({...a,rateHistory:void 0},n+".rateHistory."+o),before:a.before})));for(const a of["billingMode","sourceUrl","checkedAt","notes"])typeof e[a]=="string"&&(s[a]=e[a]);return s}function Tn(e,n){const s=o=>o==null?void 0:{...["aliyun","tokenrhythm"].includes(o.adapter)?{adapter:o.adapter}:{},enabled:o.enabled===!0,label:typeof o.label=="string"?o.label:"",labelEn:typeof o.labelEn=="string"?o.labelEn:"",display:He(o.display,["sidebar","settings","off"],"both"),unit:o.adapter==="tokenrhythm"?"CNY":["CNY","EUR","CREDITS"].includes(o.unit)?o.unit:"USD",convertToDisplayCurrency:o.convertToDisplayCurrency===!0,allowInsecureHttp:o.allowInsecureHttp===!0,refreshMinutes:typeof o.refreshMinutes=="number"&&Number.isFinite(o.refreshMinutes)?o.refreshMinutes:15,request:o.request&&typeof o.request=="object"?o.request:{url:""},extract:o.extract&&typeof o.extract=="object"?o.extract:{},allowedHosts:Array.isArray(o?.allowedHosts)?o.allowedHosts.filter(r=>typeof r=="string"):[]};Se(e,n);const a={};if(e.prices!==null&&typeof e.prices=="object"&&e.prices.models!==null&&typeof e.prices.models=="object")for(const o of Object.keys(e.prices.models))a[o]=Bt(e.prices.models[o],n+".prices.models."+o);return{locale:e.locale==="zh"||e.locale==="en"||e.locale==="auto"?e.locale:"auto",position:e.position==="header"||e.position==="off"?e.position:"dock",sidebar:e.sidebar!==!1,showSessionId:e.showSessionId===!0,hideOfficialBalance:e.hideOfficialBalance===!0,hideBudget:e.hideBudget===!0,hideTodayCost:e.hideTodayCost===!0,modelStatistics:e.modelStatistics??{},...Ye(e,["hideSessionCostHeader","hideSessionCostDock","hideTurnCost"],o=>o===!0),sessionCostCompact:e.sessionCostCompact===!0,contextCostsEnabled:e.contextCostsEnabled===!0,contextCostsPromptSeen:e.contextCostsPromptSeen===!0,sidebarTodayMetric:e.sidebarTodayMetric==="tokens"?"tokens":"cost",statisticsBasis:e.statisticsBasis,showTotalWithPlan:e.showTotalWithPlan===!0,sidebarSimple:e.sidebarSimple===!0,sidebarSimplePromptSeen:e.sidebarSimplePromptSeen===!0,sidebarModels:Object.fromEntries(Object.entries(oa).map(([o,r])=>[o,e.sidebarModels?.[o]??r])),codexQuotaEnabled:e.codexQuotaEnabled===!0,codexQuotaSidebar:e.codexQuotaSidebar!==!1,codexQuotaStrip:e.codexQuotaStrip!==!1,codexQuotaSource:["connect","subscription"].includes(e.codexQuotaSource)?e.codexQuotaSource:"auto",codexCompatPromptDismissed:e.codexCompatPromptDismissed===!0,codexCompatHistoryAppliedAt:be(e.codexCompatHistoryAppliedAt),includeSubagentCost:e.includeSubagentCost===!0,sidebarStyle:e.sidebarStyle==="compact"?"compact":"standard",priceMatchDismissed:Array.isArray(e.priceMatchDismissed)?e.priceMatchDismissed.filter(o=>typeof o=="string"):[],pricingCurrency:e.pricingCurrency==="CNY"?"CNY":"USD",currency:typeof e.currency=="string"?e.currency:"CNY",symbol:typeof e.symbol=="string"?e.symbol:"¥",decimals:te(e.decimals,n+".decimals"),exchangeRate:te(e.exchangeRate,n+".exchangeRate"),exchangeRateAuto:e.exchangeRateAuto!==!1,fxRates:e.fxRates,exchangeRateDate:e.exchangeRateDate??"",exchangeRateCheckedAt:e.exchangeRateCheckedAt??0,peakEnabled:e.peakEnabled===!0,peakEffectiveAt:typeof e.peakEffectiveAt=="string"?e.peakEffectiveAt:"",peakWindows:Array.isArray(e.peakWindows)?e.peakWindows.map((o,r)=>({start:te(o.start,n+".peakWindows["+r+"].start"),end:te(o.end,n+".peakWindows["+r+"].end")})):[],peakHolidays:Array.isArray(e.peakHolidays)?e.peakHolidays.filter(o=>typeof o=="string"):[],peakNotice:e.peakNotice!==!1,peakAlertEnabled:e.peakAlertEnabled!==!1,peakAlertAhead:Number.isFinite(e.peakAlertAhead)&&e.peakAlertAhead>=1&&e.peakAlertAhead<=30?e.peakAlertAhead:2,peakAlertTarget:e.peakAlertTarget==="peak"||e.peakAlertTarget==="offpeak"?e.peakAlertTarget:"both",peakAlertPosition:e.peakAlertPosition==="center"?"center":"corner",peakAlertWebNotify:e.peakAlertWebNotify===!0,peakStyle:["classic","progress"].includes(e.peakStyle)?e.peakStyle:"compact",peakTimeDisplay:["countdown","switch"].includes(e.peakTimeDisplay)?e.peakTimeDisplay:"both",peakProgressPromptSeen:e.peakProgressPromptSeen===!0,priceMatch:e.priceMatch==="exact"?"exact":"auto",priceOverrides:(()=>{const o={};if(e.priceOverrides!==null&&typeof e.priceOverrides=="object"&&!Array.isArray(e.priceOverrides))for(const[r,l]of Object.entries(e.priceOverrides))typeof r=="string"&&typeof l=="string"&&(o[r]=l);return o})(),priceTableDisplay:(()=>{const o={};if(e.priceTableDisplay!==null&&typeof e.priceTableDisplay=="object"&&!Array.isArray(e.priceTableDisplay))for(const[r,l]of Object.entries(e.priceTableDisplay))typeof r=="string"&&(o[r]=l===!0);return o})(),codingPlans:(()=>{const o={};if(e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans))for(const r of Object.keys(e.codingPlans)){const l=e.codingPlans[r];l===null||typeof l!="object"||Array.isArray(l)||(o[r]={enabled:l.enabled===!0,display:l.display==="sidebar"||l.display==="both"||l.display==="off"?l.display:"settings",refreshMinutes:typeof l.refreshMinutes=="number"&&Number.isFinite(l.refreshMinutes)?l.refreshMinutes:15,apiKey:typeof l.apiKey=="string"?l.apiKey:"",...r==="minimax"?{baseUrl:typeof l.baseUrl=="string"?l.baseUrl:""}:{},...r==="factory"?{orgId:typeof l.orgId=="string"?l.orgId:"",factoryPool:["core","both"].includes(l.factoryPool)?l.factoryPool:"standard"}:{},...r==="opendesign"?{workspaceId:typeof l.workspaceId=="string"?l.workspaceId:""}:{},...r==="qwen"?{quotaSource:["cli","bailian"].includes(l.quotaSource)?l.quotaSource:"local"}:{},...typeof l.planCredits=="number"&&Number.isFinite(l.planCredits)&&l.planCredits>0?{planCredits:l.planCredits}:{},...typeof l.planStart=="string"?{planStart:l.planStart}:{},...l.rates!==null&&typeof l.rates=="object"&&!Array.isArray(l.rates)?{rates:l.rates}:{},...typeof l.accessKeyId=="string"?{accessKeyId:l.accessKeyId}:{},...typeof l.secretAccessKey=="string"?{secretAccessKey:l.secretAccessKey}:{}})}return o})(),prices:{models:a,...e.prices?.custom?{custom:e.prices.custom}:{},default:Bt(e.prices?.default??{cacheHit:0,cacheMiss:0,output:0},n+".prices.default"),providers:e.prices?.providers&&typeof e.prices.providers=="object"?e.prices.providers:{},currency:typeof e.prices?.currency=="string"&&e.prices.currency.length>0?e.prices.currency:void 0},historyDays:te(e.historyDays,n+".historyDays"),fetchedAt:e.fetchedAt===null||e.fetchedAt===void 0?null:le(e.fetchedAt,n+".fetchedAt"),priceSource:typeof e.priceSource=="string"?e.priceSource:"bundled",budget:{enabled:e.budget?.enabled===!0,amount:typeof e.budget?.amount=="number"&&Number.isFinite(e.budget.amount)?e.budget.amount:100,period:e.budget?.period==="day"||e.budget?.period==="all"||e.budget?.period==="custom"?e.budget.period:"month",customStart:typeof e.budget?.customStart=="string"?e.budget.customStart:null,customEnd:typeof e.budget?.customEnd=="string"?e.budget.customEnd:null,detail:e.budget?.detail!==!1},balance:{display:He(e.balance?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.balance?.refreshMinutes=="number"&&Number.isFinite(e.balance.refreshMinutes)?e.balance.refreshMinutes:5,showProgressBar:e.balance?.showProgressBar===!0,budgetCap:typeof e.balance?.budgetCap=="number"&&Number.isFinite(e.balance.budgetCap)&&e.balance.budgetCap>0?e.balance.budgetCap:null,clickHintSeen:e.balance?.clickHintSeen===!0},goQuota:{enabled:e.goQuota?.enabled!==!1,display:He(e.goQuota?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.goQuota?.refreshMinutes=="number"&&Number.isFinite(e.goQuota.refreshMinutes)?e.goQuota.refreshMinutes:15,apiKey:typeof e.goQuota?.apiKey=="string"?e.goQuota.apiKey:"",main:e.goQuota?.main==="weekly"||e.goQuota?.main==="monthly"?e.goQuota.main:"rolling",detail:e.goQuota?.detail!==!1},customBalance:s(e.customBalance),gatewayQuotas:(()=>{const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:e.gatewayQuotas?.sources;return{sources:Array.isArray(o)?o.slice(0,4).filter(l=>l!==null&&typeof l=="object"&&!Array.isArray(l)).map(l=>({id:typeof l.id=="string"?l.id.slice(0,48):"",type:"cliproxyapi",label:typeof l.label=="string"?l.label.slice(0,80):"",baseURL:typeof l.baseURL=="string"?l.baseURL:"",enabled:l.enabled!==!1,display:He(l.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof l.refreshMinutes=="number"&&Number.isFinite(l.refreshMinutes)?Math.min(1440,Math.max(1,Math.floor(l.refreshMinutes))):15,includeProviders:Array.isArray(l.includeProviders)?[...new Set(l.includeProviders.filter(i=>typeof i=="string").map(i=>i.toLowerCase()).filter(i=>Et.includes(i)))]:Et,allowedHosts:Array.isArray(l.allowedHosts)?l.allowedHosts.filter(i=>typeof i=="string").slice(0,16):[],allowInsecureHttp:l.allowInsecureHttp===!0,antigravityOnlyGemini:l.antigravityOnlyGemini===!0,keyVar:typeof l.keyVar=="string"?l.keyVar:""})):[]}})(),customBalances:(()=>{if(Array.isArray(e.customBalances))return e.customBalances.filter(r=>r!==null&&typeof r=="object").slice(0,8).map(s).filter(Boolean);const o=s(e.customBalance);return o?[o]:[]})(),corner:{enabled:e.corner?.enabled===!0,goRolling:e.corner?.goRolling!==!1,goWeekly:e.corner?.goWeekly!==!1,goMonthly:e.corner?.goMonthly!==!1,budget:e.corner?.budget!==!1},quotaStrip:{enabled:e.quotaStrip?.enabled===!0,budget:e.quotaStrip?.budget!==!1,go:e.quotaStrip?.go!==!1,plans:e.quotaStrip?.plans!==!1,promptSeen:e.quotaStrip?.promptSeen===!0},usage:{position:e.usage?.position==="general"||e.usage?.position==="section"?e.usage.position:"cost"},barDirections:(()=>{const o=e.barDirections!==null&&typeof e.barDirections=="object"&&!Array.isArray(e.barDirections)?e.barDirections:{},r=(l,i)=>o[l]==="remaining"||o[l]==="used"?o[l]:i;return{balance:r("balance","remaining"),budget:r("budget","used"),go:r("go","used"),plan:r("plan","used")}})(),planBilling:{providers:ka(e.planBilling?.providers),models:ka(e.planBilling?.models,!0),modelPlans:Object.fromEntries(Object.entries(e.planBilling?.modelPlans??{}).filter(([o,r])=>o.includes(":")&&Xe.includes(r)))}}}const Ve=e=>typeof e=="number"&&Number.isFinite(e)?e:null,be=e=>Ve(e)??0,Rn={status:"off",message:"",fetchedAt:0,currency:"",totalBalance:0,grantedBalance:0,toppedUpBalance:0},On={status:"off",message:"",fetchedAt:0,rolling:null,weekly:null,monthly:null},va=(e=null)=>({status:"off",message:"",fetchedAt:0,label:"",unit:"USD",remaining:0,maxBudget:null,spend:null,index:e});function Dt(e,n){return Se(e,n),{status:e.status==="ok"||e.status==="error"?e.status:"off",message:typeof e.message=="string"?e.message:"",fetchedAt:typeof e.fetchedAt=="number"?e.fetchedAt:0}}function Bn(e,n){return{...Dt(e,n),keyConfigured:e.keyConfigured===!0,keySource:typeof e.keySource=="string"?e.keySource:"",currency:typeof e.currency=="string"?e.currency:"",totalBalance:be(e.totalBalance),grantedBalance:be(e.grantedBalance),toppedUpBalance:be(e.toppedUpBalance)}}function Lt(e,n){return e==null?null:((typeof e!="object"||Array.isArray(e))&&ce(n,"object"),{percent:be(e.percent),resetsAt:typeof e.resetsAt=="string"?e.resetsAt:""})}function Dn(e,n){return{...Dt(e,n),rolling:Lt(e.rolling,n+".rolling"),weekly:Lt(e.weekly,n+".weekly"),monthly:Lt(e.monthly,n+".monthly")}}function Sa(e,n){return{...Dt(e,n),label:typeof e.label=="string"?e.label:"",unit:typeof e.unit=="string"?e.unit:"USD",remaining:be(e.remaining),maxBudget:Ve(e.maxBudget),spend:Ve(e.spend),index:typeof e.index=="number"&&Number.isFinite(e.index)&&e.index>=0?Math.floor(e.index):null}}const Ln=new Set(["ok","partial","unknown","error","stale","unsupported","capability_missing"]),En=new Set(["off","loading","ok","partial","stale","error"]),Et=["antigravity","claude","codex","kimi","xai","workbuddy"],Ca={antigravity:"Antigravity",claude:"Claude",codex:"Codex",kimi:"Kimi",xai:"xAI",workbuddy:"WorkBuddy"};function In(e,n){Se(e,n);const s=(l,i="")=>typeof l=="string"?l:i,a=l=>Ve(l),o=l=>l!==null&&typeof l=="object"&&!Array.isArray(l)?{id:s(l.id),label:s(l.label),...a(l.percent)===null?{}:{percent:a(l.percent)},resetsAt:s(l.resetsAt),periodHours:a(l.periodHours),scope:s(l.scope)}:null,r=l=>l!==null&&typeof l=="object"&&!Array.isArray(l)?{unit:s(l.unit,"credits"),used:a(l.used),remaining:a(l.remaining),limit:a(l.limit),fetchedAt:s(l.fetchedAt),packages:Array.isArray(l.packages)?l.packages.filter(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)).map(i=>({id:s(i.id),label:s(i.label),used:a(i.used),remaining:a(i.remaining),limit:a(i.limit),startsAt:s(i.startsAt),resetsAt:s(i.resetsAt)})):[]}:void 0;return{id:s(e.id),type:"cliproxyapi",label:s(e.label),status:En.has(e.status)?e.status:"error",message:s(e.message),fetchedAt:a(e.fetchedAt)??0,attemptedAt:a(e.attemptedAt)??0,serverVersion:s(e.serverVersion),keyConfigured:e.keyConfigured===!0,keySource:s(e.keySource,"none"),accounts:Array.isArray(e.accounts)?e.accounts.filter(l=>l!==null&&typeof l=="object"&&!Array.isArray(l)).slice(0,16).map(l=>({id:s(l.id),provider:s(l.provider,"unknown"),label:s(l.label,"unknown"),status:Ln.has(l.status)?l.status:"unknown",message:s(l.message),plan:s(l.plan),windows:Array.isArray(l.windows)?l.windows.map(o).filter(Boolean):[],credits:r(l.credits)})):[],unsupportedProviders:Array.isArray(e.unsupportedProviders)?e.unsupportedProviders.filter(l=>typeof l=="string").slice(0,32):[]}}function qn(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;const n={};if(e.providers!==null&&typeof e.providers=="object"&&!Array.isArray(e.providers))for(const[s,a]of Object.entries(e.providers)){if(a===null||typeof a!="object"||Array.isArray(a))continue;const o={},r={};if(a.windows!==null&&typeof a.windows=="object"&&!Array.isArray(a.windows))for(const[l,i]of Object.entries(a.windows))i===null||typeof i!="object"||Array.isArray(i)||(o[l]={...Ye(i,["percent","localTokens","localCost","sampleCount"],be),...Ye(i,["sampleAt","per1Tokens","per1Cost","fullTokens","fullCost"],Ve),resetsAt:typeof i.resetsAt=="string"?i.resetsAt:"",method:i.method==="sample"||i.method==="live"?i.method:"none",confidence:i.confidence==="high"||i.confidence==="low"?i.confidence:null});if(a.intervals!==null&&typeof a.intervals=="object"&&!Array.isArray(a.intervals))for(const[l,i]of Object.entries(a.intervals))Array.isArray(i)&&(r[l]=i.filter(d=>d!==null&&typeof d=="object"&&!Array.isArray(d)).map(d=>Ye(d,["t0","t1","tokens","cost","pct","per1Tokens","per1Cost"],be)));n[s]={windows:o,intervals:r}}return{generatedAt:be(e.generatedAt),providers:n}}function jn(e){if(!e||typeof e!="object"||Array.isArray(e))return;const n=e.usage&&typeof e.usage=="object"?e.usage:{};return{installed:e.installed===!0,enabled:e.enabled===!0,version:typeof e.version=="string"?e.version:"",detection:He(e.detection,["package","profile","none"],"none"),planClass:He(e.planClass,["auto","plan","api"],"auto"),usage:{calls:be(n.calls),cost:be(n.cost),tokens:be(n.tokens),days:be(n.days),providers:(Array.isArray(n.providers)?n.providers:[]).filter(s=>typeof s=="string")},historyAppliedAt:be(e.historyAppliedAt),promptDismissed:e.promptDismissed===!0,promptDue:e.promptDue===!0}}function Aa(e,n){return Se(e,n),{today:Ae(e.today,n+".today"),month:Ae(e.month,n+".month"),total:Ae(e.total,n+".total"),budgetUsed:typeof e.budgetUsed=="number"&&Number.isFinite(e.budgetUsed)?e.budgetUsed:void 0,balance:e.balance==null?Rn:Bn(e.balance,n+".balance"),goQuota:e.goQuota==null?On:Dn(e.goQuota,n+".goQuota"),customBalance:e.customBalance==null?va():Sa(e.customBalance,n+".customBalance"),customBalances:Array.isArray(e.customBalances)?e.customBalances.filter(s=>s!==null&&typeof s=="object").map((s,a)=>Sa(s,n+".customBalances["+a+"]")):[],gatewayQuotas:Array.isArray(e.gatewayQuotas)?e.gatewayQuotas.filter(s=>s!==null&&typeof s=="object"&&!Array.isArray(s)).map((s,a)=>In(s,n+".gatewayQuotas["+a+"]")):[],customVarStatus:e.customVarStatus!==null&&typeof e.customVarStatus=="object"&&!Array.isArray(e.customVarStatus)?Object.fromEntries(Object.entries(e.customVarStatus).filter(([,s])=>s!==null&&typeof s=="object").map(([s,a])=>[s,{configured:a.configured===!0,source:typeof a.source=="string"?a.source:""}])):{},codingPlans:e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans)?e.codingPlans:{},planStats:qn(e.planStats),codexCompat:jn(e.codexCompat),history:Array.isArray(e.history)?e.history.map((s,a)=>Ae(s,n+".history["+a+"]")):[],billionContext:e.billionContext?.protocol===1?{protocol:1,connected:e.billionContext.connected===!0,failed:e.billionContext.failed===!0,requests:Number(e.billionContext.requests)||0,unreported:Number(e.billionContext.unreported)||0,partial:Number(e.billionContext.partial)||0,uncovered:Number(e.billionContext.uncovered)||0,detected:e.billionContext.detected===!0,version:typeof e.billionContext.version=="string"?e.billionContext.version.slice(0,100):"",compatibility:["needs_update","changed","bridge_missing","ready"].includes(e.billionContext.compatibility)?e.billionContext.compatibility:"unknown",noticeId:typeof e.billionContext.noticeId=="string"?e.billionContext.noticeId.slice(0,240):""}:void 0,externalUsage:e.externalUsage&&Array.isArray(e.externalUsage.sources)?{fetchedAt:Number(e.externalUsage.fetchedAt)||0,stale:e.externalUsage.stale===!0,sources:e.externalUsage.sources.map(s=>({source:String(s.source),today:Ae(s.today,n+".external.today"),month:Ae(s.month,n+".external.month"),total:Ae(s.total,n+".external.total"),history:(s.history??[]).map(a=>Ae(a,n+".external.history"))})),combined:Object.fromEntries(["today","month","total","history"].map(s=>[s,s==="history"?(e.externalUsage.combined.history??[]).map(a=>Ae(a,n+".external.history")):Ae(e.externalUsage.combined[s],n+".external."+s)]))}:null,config:Tn(e.config,n+".config"),pricesRev:typeof e.pricesRev=="string"?e.pricesRev:void 0,reconcile:e.reconcile===null||e.reconcile===void 0?void 0:{ok:e.reconcile.ok===!0,message:typeof e.reconcile.message=="string"?e.reconcile.message:""},priceLockIds:Array.isArray(e.priceLockIds)?e.priceLockIds.filter(s=>typeof s=="string"):[],meta:{...Ke(e.meta?.locale)?{locale:Ke(e.meta.locale)}:{},now:typeof e.meta?.now=="number"?e.meta.now:Date.now(),timezoneOffsetMinutes:typeof e.meta?.timezoneOffsetMinutes=="number"?e.meta.timezoneOffsetMinutes:0,timezone:typeof e.meta?.timezone=="string"?e.meta.timezone:"",dayKey:typeof e.meta?.dayKey=="string"?e.meta.dayKey:"",monthKey:typeof e.meta?.monthKey=="string"?e.meta.monthKey:""}}}function Hn(e,n){Se(e,n);const s={ok:e.ok===!0,message:typeof e.message=="string"?e.message:""};return e.state!==void 0&&e.state!==null&&(s.state=Aa(e.state,n+".state")),s}function ne(e){return{parse:e}}const $e=ne(Aa),Qn=ne(e=>Se(e,"patch")),Un=ne(Hn),It=ne(e=>le(e,"provider")),_n=ne(e=>{if(e!=null)return(typeof e!="number"||!Number.isInteger(e)||e<0||e>7)&&ce("index","0-7 integer"),e}),Fn=ne(e=>le(e,"date")),Wn=ne(e=>Se(e,"day")),Gn=ne(e=>(Number.isFinite(Number(e))||ce("limit","number"),Number(e))),Pa=ne(e=>le(e,"sort")),Kn=ne(e=>Se(e,"topSessions")),Ma=ne(e=>le(e,"target")),zn=ne(e=>le(e,"value")),xe=(e,n)=>({mode:"strict",typeSymbol:"dsh-cost-meter#"+e,schema:n,create:()=>n}),re=(e,n,s,a=!1)=>({name:e,wire:e,source:"json",codec:xe(n,s),...a?{acceptsUndefined:!0}:{}}),Yn={package:"dsh-cost-meter",descriptors:[{method:"getStateSince",parameters:[re("pricesRev","PricesRev",ne(e=>(typeof e!="string"&&ce("pricesRev","price table revision"),e)))],result:xe("CostState",$e)},...["getState","getLocalState"].map(e=>({method:e,result:xe("CostState",$e)})),{method:"updateConfig",parameters:[re("patch","ConfigPatch",Qn)],result:xe("CostState",$e)},{method:"fetchPrices"},{method:"releasePriceLock",parameters:[re("id","PriceLockId",ne(e=>((typeof e!="string"||e.length===0)&&ce("id","OpenRouter model id"),e)))]},{method:"refreshBalance"},{method:"refreshGoQuota"},{method:"refreshCustomBalance",parameters:[re("index","CustomBalanceIndex",_n,!0)]},{method:"refreshCodingPlan",parameters:[re("provider","CodingPlanProvider",It)]},{method:"loginCodingPlan",parameters:[re("provider","CodingPlanProvider",It)]},{method:"refreshGatewayQuota",parameters:[re("sourceId","GatewayQuotaSourceId",ne(e=>{if(e!=null)return(typeof e!="string"||e.length>48||!/^[a-z0-9][a-z0-9_-]*$/.test(e))&&ce("sourceId","gateway source id"),e}),!0)]},{method:"resetHistory",result:xe("CostState",$e)},{method:"importLegacyHistory"},{method:"getDaySessions",parameters:[re("date","DayKey",Fn)],result:xe("DayRecord",Wn)},{method:"getSessionCost",parameters:[re("sessionId","SessionId",It)],result:xe("SessionCost",ne(e=>({own:Rt(e.own,"own"),subagents:Rt(e.subagents,"subagents"),found:Ce(e.found,"found"),subagentCount:te(e.subagentCount,"subagentCount")})))},{id:"dsh-cost-meter#costMeter/getTurnCost",service:"costMeter",namespace:"costMeter",method:"getTurnCost",invocation:{kind:"direct"},parameters:[re("sessionId","SessionId",ne(e=>le(e,"sessionId"))),...["startSeq","endSeq"].map(e=>re(e,"TurnSeq",ne(n=>((!Number.isSafeInteger(n)||n<0)&&ce(e,"nonnegative integer"),n)))),{...re("displayCurrency","DisplayCurrency",ne(e=>(e!==void 0&&!["USD","CNY","EUR"].includes(e)&&ce("displayCurrency","currency"),e))),acceptsUndefined:!0}],result:xe("TurnCost",ne(e=>({...Tt(e),found:Ce(e.found,"found"),...e.inherited===void 0?{}:{inherited:Ce(e.inherited,"inherited")},cost:te(e.cost,"cost"),apiCost:te(e.apiCost,"apiCost"),rows:Na(e.rows),calls:(Array.isArray(e.calls)?e.calls:ce("calls","array")).map(n=>({kind:le(n.kind,"kind"),provider:le(n.provider,"provider"),model:le(n.model,"model"),atMs:te(n.atMs,"atMs"),cost:te(n.cost,"cost"),apiCost:te(n.apiCost,"apiCost"),plan:Ce(n.plan,"plan"),priced:Ce(n.priced,"priced"),longContext:Ce(n.longContext,"longContext"),rows:Na(n.rows),...n.metering?{metering:Mn(n.metering)}:{}}))})))},{method:"getTopSessions",parameters:[re("limit","SessionLimit",Gn),re("sort","SessionSort",Pa,!0),re("dir","SessionSortDir",Pa,!0)],result:xe("TopSessions",Kn)},{method:"setCredential",parameters:[re("target","CredentialTarget",Ma),re("value","CredentialValue",zn)]},{method:"clearCredential",parameters:[re("target","CredentialTarget",Ma)]},...["applyCodexCompatHistory","dismissCodexCompat"].map(e=>({method:e,result:xe("CostState",$e)}))].map(e=>({id:"dsh-cost-meter#costMeter/"+e.method,service:"costMeter",namespace:"costMeter",invocation:{kind:"direct"},parameters:[],result:xe("FetchPricesResult",Un),...e}))};function Vn(e,n){const s=n?.models??{};return typeof e=="string"&&e.length>0&&s[e]!==void 0?s[e]:n?.default??{cacheHit:0,cacheMiss:0,output:0}}function ft(e){return Object.fromEntries(["multiplier","separateMultipliers","multipliers"].filter(n=>e?.[n]!==void 0).map(n=>[n,e[n]]))}function bt(e,n){return(e.separateMultipliers?e.multipliers?.[n]:void 0)??e.multiplier??1}function Ta(e,n,s="base"){const a={};for(const o of["cacheHit","cacheMiss","cacheWrite","output","reasoning"])e[o]!==void 0&&(a[o]=e[o]*bt(n,s+"."+o));return e.longContext&&(a.longContext={...Ta(e.longContext,n,"longContext"),aboveInputTokens:e.longContext.aboveInputTokens}),a}function $n(e){const n=ft(e);return n.multipliers&&(n.multipliers=Object.fromEntries(Object.entries(n.multipliers).filter(([s])=>s.startsWith("cny.")).map(([s,a])=>[s.replace("cny.","base."),a]))),{...e.cny,...n}}function Qe(e){if(e===null||typeof e!="object")return;const n=l=>{const i=e[l];return typeof i=="number"&&Number.isFinite(i)&&i>=0?i:void 0},s=n("cacheMiss")??n("input")??0,o={cacheHit:n("cacheHit")??n("cachedInput")??n("cacheRead")??s,cacheMiss:s,output:n("output")??0},r=n("reasoning");return r!==void 0&&(o.reasoning=r),n("cacheWrite")!==void 0&&(o.cacheWrite=n("cacheWrite")),o}function Jn(e){const n=Qe(e);if(n===void 0)return null;Object.assign(n,ft(e)),e.billingMode==="utc-peak"&&(n.billingMode="utc-peak");for(const s of["offPeak","peak","legacyBase"]){const a=Qe(e[s]);a!==void 0&&(n[s]=a)}return Number.isFinite(e.longContext?.aboveInputTokens)&&e.longContext.aboveInputTokens>0&&(n.longContext={...Qe(e.longContext),aboveInputTokens:e.longContext.aboveInputTokens}),Array.isArray(e.rateHistory)&&(n.rateHistory=e.rateHistory.slice(0,16).map(s=>{const a={...Qe(s),before:s.before};for(const o of["offPeak","peak"]){const r=Qe(s[o]);r!==void 0&&(a[o]=r)}return a})),n}function Je(e,n=Date.now()){if(!e||!Number.isFinite(n)||!Array.isArray(e.rateHistory))return e;let s=null,a=1/0;for(const l of e.rateHistory){const i=Date.parse(l.before);n<i&&i<a&&(s=l,a=i)}if(!s)return e;const{before:o,...r}=s;return{...e,...r}}const qt=Date.parse("2026-08-22T16:00:00Z");function Ra(e){if(!Number.isFinite(e)||e<qt)return null;const n=Math.floor((e+8*36e5)/864e5),s=(n+4)%7;if(s!==6&&s!==0)return null;const a=s===6?n:n-1;return{start:Math.max(a*864e5-8*36e5,qt),end:(a+2)*864e5-8*36e5}}function Oa(e,n){if(!Number.isFinite(e)||e<qt||!Array.isArray(n))return null;const s=Math.floor((e+8*36e5)/864e5);return n.includes(new Date(s*864e5).toISOString().slice(0,10))?{start:s*864e5-8*36e5,end:(s+1)*864e5-8*36e5}:null}const Zn=(e,n)=>Oa(e,n)??Ra(e);function gt(e,n,s,a){if(!Array.isArray(s)||s.length===0||Zn(e,a)!==null||Number.isFinite(n)&&e<n)return!1;const o=new Date(e).getUTCHours();return s.some(r=>{const l=Number(r.start),i=Number(r.end);return!Number.isFinite(l)||!Number.isFinite(i)?!1:l<i?o>=l&&o<i:o>=l||o<i})}const Xn=Date.parse("2026-08-16T16:00:00Z");function Ba(e,n,s){const a=Je(e,n)??{cacheHit:0,cacheMiss:0,output:0},o=(l,i="base")=>({reasoning:0,...Ta(l,a,i)});if(a.billingMode==="utc-peak"){if(s?.enabled!==!0||!Number.isFinite(n))return o(a);const l=new Date(n),i=l.getUTCDay(),d=l.getUTCHours(),u=i>0&&i<6&&(d>=1&&d<4||d>=6&&d<10);return o((u?a.peak:a.offPeak)??a,(u?a.peak:a.offPeak)?u?"peak":"offPeak":"base")}if(Number.isFinite(n)&&n<Xn){const l=a.legacyBase;return l===void 0?o(a):o(l,"legacyBase")}if(s?.enabled!==!0)return o(a);const r=typeof s.effectiveAtMs=="number"&&Number.isFinite(s.effectiveAtMs)?s.effectiveAtMs:void 0;if(gt(n,r,s.windows,s.holidays)){const l=a.peak;return l===void 0?o(a):o(l,"peak")}if(r!==void 0&&n>=r){const l=a.offPeak;return l===void 0?o(a):o(l,"offPeak")}return o(a)}function Da(e,n){const s=Math.max(0,Number(e.input)||0),a=Math.max(0,Number(e.output)||0),o=Math.max(0,Number(e.cacheRead)||0),r=Math.max(0,Number(e.cacheWrite)||0),l=Math.max(0,Number(e.reasoning)||0);return n.longContext&&s+o+r>n.longContext.aboveInputTokens&&(n=n.longContext),(s*n.cacheMiss+a*n.output+o*n.cacheHit+r*(n.cacheWrite??n.cacheHit)+l*(n.reasoning??0))/1e6}function La(e,n,s){const a=Number(e);if(!Number.isFinite(a)||a<0||a===0)return 0;if(n!=="CNY")return a;const o=Number(s);return!Number.isFinite(o)||o<=0?a:a/o}function ue(e,n){const s=e?.barDirections,a=n==="balance"?"remaining":"used";if(s===null||typeof s!="object"||Array.isArray(s))return a;const o=s[n];return o==="remaining"||o==="used"?o:a}function we(e,n){if(e==null||!Number.isFinite(Number(e)))return{width:0,label:null};const s=Math.max(0,Math.min(100,Number(e))),a=n==="remaining"?Math.round((100-s)*10)/10:Math.round(s*10)/10;return{width:a,label:a}}const Ea=(e,n)=>e.toFixed(n).replace(/(\.\d*?[1-9])0+$|\.0+$/,"$1");function me(e,n){const s=typeof n?.symbol=="string"&&n.symbol.length>0?n.symbol:"$",a=Number(n?.decimals),o=Math.max(0,Math.min(10,Number.isFinite(a)?Math.floor(a):2));let r=o;return e>0&&e<Math.pow(10,-o)&&(r=o+2),s+Ea(e,r)}function z(e,n){const s=Number(n?.exchangeRate),a=e*(Number.isFinite(s)&&s>0?s:1);return me(a,n)}function L(e){const n=Math.max(0,Number(e)||0),s=a=>a>=100?String(Math.round(a)):String(Math.round(a*10)/10);return n<1e3?String(Math.round(n)):n>=999500?s(n/1e6)+"M":n<1e6?s(n/1e3)+"K":s(n/1e6)+"M"}function jt(e){return String(e??"").normalize("NFKC").toLowerCase().replace(/[((]\s*(?:go|zen)\s*[))]/g," ").trim()}function Pe(e){return jt(e).replace(/[^\p{L}\p{N}]+/gu,"")}function eo(e){return jt(e).replace(/[-_./:@](?:\d{4}-?\d{2}-?\d{2}|v\d+(?:\.\d+)*|\d+k|latest)$/,"")}function Ht(e,n,s=e){if(typeof e!="string"||e.length===0)return null;const a=Array.isArray(n)?n.filter(l=>typeof l=="string"&&l.length>0):[],o=a.find(l=>l===s);if(o!==void 0)return o;let r=e.normalize("NFKC").trim();if(/[:((]\s*(?:free|online)\b/i.test(r))return null;for(;;){const l=Pe(r);if(l.length===0)return null;const i=a.filter(u=>Pe(u)===l);if(i.length>0)return i.length===1?i[0]:null;const d=eo(r);if(d===r.toLowerCase())return null;r=d}}const Qt=["opendesign","open-design","open-design-api","amr-link.open-design.ai"],Ut=new Set(["openrouter","opencode-zen","opencode-go","opencode-go-plus","zen","opencode",...Qt]),ht={openai:/^(?:gpt|o\d|codex)/i,anthropic:/^claude/i,google:/^gemini/i,stepfun:/^step-/i,deepseek:/^deepseek/i,moonshot:/^kimi/i,"z-ai":/^glm/i,xai:/^grok/i,alibaba:/^qwen/i,minimax:/^minimax/i,tencent:/^(?:hunyuan|hy\d)/i,xiaomi:/^mimo/i,upstage:/^solar/i,nvidia:/^nemotron/i,mistral:/^mistral/i,meta:/^(?:muse|llama)/i,meituan:/^longcat/i};function _t(e){return["deepseek-peak","utc-peak"].includes(e?.billingMode)?e.billingMode:"flat"}function Ue(e,n,s,a,o){if(typeof e!="string")return null;if(Object.hasOwn(n,e))return e;if(a!=="auto")return null;let r=e.normalize("NFKC").trim().replace(/^models\/(?=gemini)/i,"google/");const l=r.search(/[/:]/);if(l>0){const i=r.slice(0,l).trim().toLowerCase(),d=r.slice(l+1).trim();if(Object.hasOwn(ht,i)&&(i===s||(s==="opencode-zen"||s==="opencode-go")&&(ht[i].test(d)||Ht(d,Object.keys(i==="deepseek"?o?.models??{}:o?.providers?.[i]?.models??{}))!==null)))r=d;else if(Object.hasOwn(ht,i))return null}return Ht(r,Object.keys(n),e)}const to=new Set(["local","lmstudio","ollama","jan","gpt4all","koboldcpp","llamacpp","llama-cpp","localai","vllm","sglang","tabbyapi","lmdeploy","oobabooga","text-generation-webui","llama-server"]),ao=["lmstudio:","lmstudio/","ollama:","ollama/","jan:","jan/","gpt4all:","gpt4all/","koboldcpp:","koboldcpp/","llamacpp:","llamacpp/","llama-cpp:","llama-cpp/","localai:","localai/","vllm:","vllm/","sglang:","sglang/","tabbyapi:","tabbyapi/","lmdeploy:","oobabooga/","text-generation-webui/","llama-server:","gguf:","local:"];function no(e,n){if(typeof e=="string"&&to.has(e))return!0;const s=typeof n=="string"?jt(n):"";return ao.some(a=>s.startsWith(a))}function oo(e,n,s,a){if(e!=="deepseek"&&!e.includes("deepseek")&&typeof n=="string"&&n.length>0&&n!=="__local__"&&!n.includes(":")){const o=s.models??{},r=Object.hasOwn(o,n)?n:a==="auto"?Ht(n,Object.keys(o)):null;if(r!==null&&o[r]?.unpriced!==!0)return{entry:o[r],priced:!0,billingMode:"deepseek-peak",matched:!0}}return null}function so(e,n,s){const a=s?.prices??{},o=s?.priceMatch==="exact"?"exact":"auto",r=s?.priceOverrides&&typeof s.priceOverrides=="object"?s.priceOverrides:{};let l=String(e??"").trim().toLowerCase();l.startsWith("llm-")&&(l=l.slice(4)),l===""&&(l="deepseek");let i=l,d=n;const u=r[l+":"+n];if(u==="__custom__"){const p=a.custom?.[l+":"+n];return{entry:p??null,priced:!!p,billingMode:"flat",matched:!0,currency:p?.currency??"USD"}}if(u==="__local__")return{entry:null,priced:!1,billingMode:"flat",matched:!0};if(typeof u=="string"&&u.length>0){const p=u.indexOf(":");if(p>0&&u.slice(p+1).length>0?(i=u.slice(0,p).trim().toLowerCase(),d=u.slice(p+1)):d=u,i==="deepseek"&&d==="__default__")return{entry:a.default??{cacheHit:0,cacheMiss:0,output:0},priced:a.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}if(["zen","opencode","opencode-go-plus"].includes(i)){const p=Ue(d,a.providers?.[i]?.models??{},"opencode-go",o,a);p===null?i="opencode-go":d=p}if(Qt.includes(i)&&i!=="opendesign"&&Ue(d,a.providers?.[i]?.models??{},i,o,a)===null&&(i="opendesign"),no(i,d))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(i==="openrouter"){const p=a.providers?.openrouter?.models??{},g=Object.hasOwn(p,d)?p[d]:null;return{entry:g,priced:g!==null&&g.unpriced!==!0,billingMode:"flat",matched:g!==null}}if(i==="deepseek"||i.includes("deepseek")){const p=a.models??{},g=Ue(d,p,"deepseek",o,a);if(g!==null)return p[g]?.unpriced===!0?{entry:null,priced:!1,billingMode:"flat",matched:!0}:{entry:p[g],priced:!0,billingMode:"deepseek-peak",matched:!0};if(o==="auto"){let h=null,b=-1,x=!1,A="flat";for(const[w,y]of Object.entries(a.providers??{})){if(Ut.has(w))continue;const m=y?.models??{},k=Ue(d,m,w,o,a);if(k===null)continue;const N=+(k===d||Pe(k)===Pe(d));N>b?(h=m[k],b=N,x=!1,A=_t(m[k])):N===b&&(x=!0)}if(x)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(h!==null)return{entry:h,priced:h.unpriced!==!0,billingMode:A,matched:!0}}return{entry:a.default??{cacheHit:0,cacheMiss:0,output:0},priced:a.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}const c=a.providers?.[i]?.models??{},f=Ue(d,c,i,o,a);if(f!==null)return{entry:c[f],priced:c[f]?.unpriced!==!0,billingMode:_t(c[f]),matched:!0};if(Ut.has(i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(Object.hasOwn(ht,i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(o==="auto"){let p=null,g=-1,h=!1,b="flat";for(const[x,A]of[["deepseek",{models:a.models??{}}],...Object.entries(a.providers??{})]){if(x===i||Ut.has(x))continue;const w=A?.models??{},y=Ue(d,w,x,o,a);if(y===null)continue;const m=+(y===d||Pe(y)===Pe(d));m>g?(p=w[y],g=m,h=!1,b=x==="deepseek"?"deepseek-peak":_t(w[y])):m===g&&(h=!0)}if(h)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(p!==null)return{entry:p,priced:p.unpriced!==!0,billingMode:b,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}function Ia(e,n,s){let a=so(e,n,s);if(a.currency)return a;if(!a.priced){const o=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";a=oo(o,s?.priceOverrides?.[o+":"+n],s?.prices??{},s?.priceMatch==="exact"?"exact":"auto")??a}return a.priced&&s?.prices?.currency==="CNY"&&a.entry?.cny?{...a,entry:$n(a.entry),currency:"CNY"}:{...a,currency:a.priced&&a.billingMode==="deepseek-peak"&&s?.prices?.currency==="CNY"?"CNY":"USD"}}function lo(e){const n=Number(e?.calls)||0,s=Number(e?.input)||0,a=Number(e?.cacheRead)||0;return n>=3&&s>=1e5&&a===0}function yt(e,n){return!e||!n?0:typeof e.cost=="number"&&Number.isFinite(e.cost)?e.cost:ja(e,n).total}function Ze(e){if(e===null||typeof e!="object")return 0;const n=Number(e.cost)||0,s=e.apiCost===void 0||e.apiCost===null?n:Number(e.apiCost);return Number.isFinite(s)&&s>=0?Math.min(s,n):n}function U(e,n){const s={CNY:"Cny",EUR:"Eur"}[n?.currency],a=n?.showTotalWithPlan===!0,o=s&&e?.[(a?"cost":"apiCost")+s],r=a?Number(e?.cost)||0:Ze(e);return!Number.isFinite(o)||o===0&&r>0?r:o/(n.exchangeRate||1)}const ro={opendesign:Qt,go:["go","zen","opencode","opencode-go","opencode-go-plus"],codex:["codex","openai-codex","dsh-openai-codex","codex-chatgpt"],anthropic:["anthropic","claude-subscription"],zai:["zai","glm-coding-plan"],minimax:["minimax","minimax-code"],kimi:["kimi","kimi-code"],commandcode:["commandcode","command-code"],workbuddy:["workbuddy","workbuddy-subscription"],antigravity:["antigravity"],stepfun:["stepfun","step-code"],"volcengine-agent":["volcengine-agent","ark-agent-plan","volcengine-agent-plan"],"tencent-coding":["tencent-coding","tencent-coding-plan","tokenhub-coding-plan"],"tencent-token":["tencent-token","tencent-token-plan","tokenhub-token-plan"],"baidu-coding":["baidu-coding-plan","qianfan-coding-plan"],qwen:["qwen","qwen-tokenplan","qianwen-tokenplan","qwen-token-plan","qianwen-token-plan"],scnet:["scnet","scnet-tokenplan","scnet-token-plan"],mimo:["mimo","xiaomimimo","mimo-token-plan","xiaomi-token-plan","xiaomi-token-plan-cn","xiaomi-token-plan-sgp","xiaomi-token-plan-ams"],factory:["factory","droid","factory-a","factory-g","factory-o"]},Xe=["opendesign","anthropic","zai","minimax","kimi","openrouter","siliconflow","commandcode","scnet","volcengine","qwen","mimo","factory","go","codex","volcengine-agent","tencent-coding","tencent-token","baidu-coding","workbuddy","antigravity","stepfun"],io=Object.entries({opendesign:"opendesign|open[._-]?design",codex:"codex|chatgpt","baidu-coding":"baidu|qianfan|百度|千帆","tencent-coding":"tencent|tokenhub|腾讯",anthropic:"anthropic|claude",zai:"z[._-]?ai|zhipu|glm|智谱",minimax:"minimax|海螺",kimi:"kimi|moonshot|moonshotai|月之暗面",openrouter:"openrouter",siliconflow:"siliconflow|硅基",commandcode:"commandcode",scnet:"scnet|sugon|超算",volcengine:"volcengine|volcano|volc|ark|火山|方舟",qwen:"qwen|qianwen|千问|通义",mimo:"mimo|xiaomi|小米",factory:"factory|droid",go:"opencode(?:[-_\\s]?go)?|zen|go"}).map(([e,n])=>[e,new RegExp("(?:^|[^a-z0-9])(?:"+n+")(?=$|[^a-z0-9])")]);function co(e,n){for(const s of[e,n]){const a=String(s??"").normalize("NFKC").replace(/([a-zA-Z0-9\u3400-\u9fff])(?=(?:Coding|Token|Agent|Plan|Subscription))/g,"$1-").replace(/([a-z0-9])((?:coding|token|agent)?plan|subscription)$/i,"$1-$2").toLowerCase();if(!/(?:^|[^a-z0-9])(?:(?:coding|token|agent)[-_\s]*)?plan(?:$|[^a-z0-9])|(?:^|[^a-z0-9])subscription(?:$|[^a-z0-9])|套餐|订阅/.test(a))continue;const o=io.filter(([,r])=>r.test(a));if(o.length){if(o.length!==1)return null;const r=o[0][0];if(r==="volcengine"&&/agent[-_\s]*plan|智能体.*套餐/.test(a))return"volcengine-agent";if(r==="tencent-coding"){const l=/token[-_\s]*plan|令牌.*套餐/.test(a),i=/coding[-_\s]*plan|编程.*套餐/.test(a);return l===i?null:l?"tencent-token":r}return r}}return null}function qa(e,n,s){const a=String(e??"").trim().toLowerCase().replace(/^llm-/,""),o=n?.planBilling?.modelPlans?.[e+":"+s]??n?.planBilling?.modelPlans?.[a+":"+s];if(Xe.includes(o))return o;if(a.length===0)return null;for(const[r,l]of Object.entries(ro))if(l.includes(a))return r;return Xe.includes(a)?a:co(e,s)}function uo(e){const n=new Set,s=e?.codingPlans;if(s!==null&&typeof s=="object")for(const a of Xe)a!=="go"&&s[a]?.enabled===!0&&n.add(a);return e?.goQuota?.enabled===!0&&n.add("go"),e?.codexQuotaEnabled===!0&&n.add("codex"),n}const mo=new Set(["grok-4.5","glm-5.3","glm-5.3-flash","glm-5.2","glm-5.1","gpt-5.6-luna","kimi-k3","kimi-k2.7-code","kimi-k2.6","mimo-v2.6-flash","mimo-v2.6-pro","mimo-v2.5","mimo-v2.5-pro","minimax-m3","minimax-m2.7","qwen3.8-max","qwen3.7-max","qwen3.7-plus","qwen3.6-plus","hy3","longcat-2.0","muse-spark-1.2-contributor"].map(Pe));function po(e,n,s){const a=String(e??"").trim().toLowerCase();if(a.length>0&&a!=="deepseek"&&!a.includes("deepseek"))return!1;const o=Pe(n);if(o.length===0||!mo.has(o))return!1;const r=s?.prices,l=r?.models??{};for(const i of Object.keys(l))if(Pe(i)===o)return!1;for(const i of Object.keys(r?.providers?.["opencode-go"]?.models??{}))if(Pe(i)===o)return!0;return!1}function et(e,n,s){let a=qa(e,s,n);a===null&&po(e,n,s)&&(a="go");const o=s?.planBilling?.models;if(o!==null&&typeof o=="object"){const l=o[e+":"+n];if(l==="plan"||l==="api")return l;if(a!==null){const i=o[a+":"+n];if(i==="plan"||i==="api")return i}}if(a===null)return"api";const r=s?.planBilling?.providers?.[a];return r==="plan"||r==="api"?r:uo(s).has(a)?"plan":"api"}function ja(e,n){if(!e||!n)return{total:0,api:0};const s=fo(n),a={enabled:n.peakEnabled===!0,effectiveAtMs:Date.parse(n.peakEffectiveAt||""),windows:n.peakWindows,holidays:n.peakHolidays},o=Date.now(),r=e.byProviderModel??e.byModel??{};let l=0,i=0;for(const p of Object.keys(r)){const g=p.indexOf(":"),h=g>0?p.slice(0,g):"deepseek",b=g>0?p.slice(g+1):p,x=Ia(h,b,n);if(x.priced){const A=Da(r[p],Ba(Jn(x.entry),o,{...a,enabled:["deepseek-peak","utc-peak"].includes(x.billingMode)&&a.enabled})),w=La(A,x.currency,s);l+=w,et(h,b,n)==="api"&&(i+=w)}}const d={input:0,output:0,cacheRead:0,cacheWrite:0,reasoning:0};for(const p of Object.keys(r))d.input+=r[p].input??0,d.output+=r[p].output??0,d.cacheRead+=r[p].cacheRead??0,d.cacheWrite+=r[p].cacheWrite??0,d.reasoning+=r[p].reasoning??0;const u={input:Math.max(0,(e.input??0)-d.input),output:Math.max(0,(e.output??0)-d.output),cacheRead:Math.max(0,(e.cacheRead??0)-d.cacheRead),cacheWrite:Math.max(0,(e.cacheWrite??0)-d.cacheWrite),reasoning:Math.max(0,(e.reasoning??0)-d.reasoning)},c=Da(u,Ba(Vn("default",n.prices),o,a)),f=La(c,n.prices?.currency==="CNY"?"CNY":"USD",s);return l+=f,i+=f,{total:l,api:i}}function fo(e){const n=s=>typeof s=="number"&&Number.isFinite(s)&&s>0&&s<1e6;return e.currency==="CNY"&&n(e.exchangeRate)?e.exchangeRate:n(e.fxRates?.CNY)?e.fxRates.CNY:7.2}function Ha(e,n){if(!e||!n)return!1;const s=e.byProviderModel??{};for(const a of Object.keys(s)){const o=a.indexOf(":"),r=o>0?a.slice(0,o):"deepseek",l=o>0?a.slice(o+1):a;if(et(r,l,n)==="plan")return!0}return!1}function Qa(e){return(e?.input??0)+(e?.cacheRead??0)+(e?.cacheWrite??0)}function Ua(e,n){if(e?.apiCost!==void 0)return Ze(e);if(!Ha(e,n))return yt(e,n);let s=0;for(const[a,o]of Object.entries(e.byProviderModel??{})){if(!Number.isFinite(o.cost))return ja(e,n).api;const r=a.indexOf(":");et(a.slice(0,r),a.slice(r+1),n)==="plan"&&(s+=o.cost)}return Math.max(0,yt(e,n)-s)}function Ft(e){const n=Math.abs(Math.round(Number(e)||0)),s=Math.floor(n/60),a=n%60;return"UTC"+(Number(e)<0?"-":"+")+s+(a>0?":"+String(a).padStart(2,"0"):"")}function bo(e){const n=e?.meta,s=Number(n?.timezoneOffsetMinutes);if(!Number.isFinite(s))return null;const a=-new Date().getTimezoneOffset();if(a===s)return null;const o=typeof n?.timezone=="string"&&n.timezone.length>0?n.timezone:"";return{hostLabel:o?o+" ("+Ft(s)+")":Ft(s),browserLabel:Ft(a)}}function go(e,n=s=>s){let s=n(e);const a=new Set;return{getSnapshot:()=>s,subscribe:o=>(a.add(o),()=>{a.delete(o)}),set:o=>{if(o=n(o),o!==s){s=o;for(const r of[...a])r()}}}}const{createElement:t,Fragment:D,useState:O,useEffect:Y,useRef:he}=Te;function Le({target:e,configured:n,source:s,t:a,api:o,placeholder:r,disabled:l}){const[i,d]=O(""),[u,c]=O(!1),[f,p]=O(!1),[g,h]=O(null),b=he(!1),x=l===!0||f,A=async()=>{const m=i.trim();if(!(m.length===0||x||b.current)){b.current=!0,p(!0),h(null);try{const k=await o.setCredential(e,m);d(""),c(!1),h({kind:"ok",text:k?.message??a("credentialSave")})}catch(k){h({kind:"err",text:String(k?.message??k)})}finally{b.current=!1,p(!1)}}},w=async()=>{if(!(x||b.current)){b.current=!0,p(!0),h(null);try{const m=await o.clearCredential(e);d(""),c(!1),h({kind:"ok",text:m?.message??a("credentialClear")})}catch(m){h({kind:"err",text:String(m?.message??m)})}finally{b.current=!1,p(!1)}}},y=()=>{d(""),c(!1)};return t("div",{className:"cm-field"},u?t("form",{className:"cm-field",autoComplete:"off",onSubmit:m=>{m.preventDefault(),A()}},t("input",{className:"cm-input",type:"password",name:"cm-credential-"+e,autoFocus:!0,value:i,placeholder:typeof r=="string"?r:"",disabled:x,autoComplete:"new-password","data-lpignore":"true","data-1p-ignore":"true","data-bwignore":"true","aria-label":a("credentialInputHint"),onChange:m=>d(m.target.value)}),t("div",{className:"cm-buttons"},t("button",{className:"cm-btn small",type:"submit",disabled:x||i.trim().length===0},a(f?"credentialSaving":"credentialSave")),t("button",{className:"cm-btn small",type:"button",onClick:y,disabled:f},a("cancel")))):t("button",{className:"cm-btn small",type:"button",onClick:()=>c(!0),disabled:x},a("credentialEdit")),n===!0?t("button",{className:"cm-btn small",type:"button",onClick:w,disabled:x},a("credentialClear")):null,t("span",{className:"cm-hint"},n===!0?a("credentialConfiguredOf",{source:typeof s=="string"&&s.length>0?s:"unknown"}):a("credentialNotConfigured")),t("span",{className:"cm-hint"},a("credentialInputHint")),da(g))}function ho({pending:e,t:n}){return!Array.isArray(e)||e.length===0?null:t("div",{className:"cm-msg err"},t("div",null,n("secretMigrationPending")),t("div",null,e.join("、")))}function kt({size:e=16,className:n}){return t("svg",{width:e,height:e,className:n,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M4 4H12A2 2 0 0 1 14 6V11.5A2 2 0 0 1 12 13.5H4A2 2 0 0 1 2 11.5V6A2 2 0 0 1 4 4ZM4 5.3H12A0.7 0.7 0 0 1 12.7 6V11.5A0.7 0.7 0 0 1 12 12.2H4A0.7 0.7 0 0 1 3.3 11.5V6A0.7 0.7 0 0 1 4 5.3Z",fill:"currentColor",fillRule:"evenodd"}),t("path",{d:"M3.3 5.3H12.7V7.1H3.3Z",fill:"currentColor"}),t("path",{d:"M8 2.8A1.3 1.3 0 1 0 8 5.4A1.3 1.3 0 1 0 8 2.8Z",fill:"currentColor"}))}function _a(e,n){const s=he(!1),a=he(""),o=n!==null&&typeof n=="object"?[n.input,n.cacheRead,n.cacheWrite,n.output,n.reasoning,n.cost].map(r=>String(r??0)).join("|"):"";Y(()=>{if(!s.current){s.current=!0,a.current=o;return}if(o===""||o===a.current)return;a.current=o;const r=setTimeout(()=>{e.api?.reload?.()},800);return()=>clearTimeout(r)},[o])}function yo(e,n,s,a){const o=n?n.own:e;if(!s||!n?.subagentCount)return o;const r=n.subagents,l={...o};for(const i of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...pt])l[i]=(o?.[i]??0)+(r?.[i]??0);l.apiCost=Ua(o,a)+Ze(r);for(const i of["byModel","byProviderModel"]){l[i]={...o?.[i]};for(const[d,u]of Object.entries(r?.[i]??{})){const c={...l[i][d]};c.apiCost=Ze(c)+Ze(u);for(const f of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...pt])c[f]=(c[f]??0)+(u[f]??0);l[i][d]=c}}return l}function Fa(e){const n=e.useProjection?e.useProjection("costUsage"):void 0,s=e.useCost?.(u=>u)?.state,a=s?.config,[o,r]=O(null);_a(e,n);const l=["input","output","cacheRead","cacheWrite","reasoning","calls","cost","apiCost"].map(u=>n?.[u]??"").join(":");Y(()=>{if(!e.sessionId||!e.api?.getSessionCost)return;let u=!0,c=!1;const f=async()=>{if(!(c||typeof document<"u"&&document.hidden)){c=!0;try{const h=await e.api.getSessionCost(e.sessionId);u&&r({id:e.sessionId,include:a?.includeSubagentCost===!0,value:h})}catch{u&&r(h=>h?.id===e.sessionId&&h.include===(a?.includeSubagentCost===!0)?h:{id:e.sessionId,include:a?.includeSubagentCost===!0,value:null})}finally{c=!1}}};f();const p=a?.includeSubagentCost===!0?setInterval(f,1e4):null,g=()=>{document.hidden||f()};return typeof document<"u"&&document.addEventListener?.("visibilitychange",g),()=>{u=!1,p!==null&&clearInterval(p),typeof document<"u"&&document.removeEventListener?.("visibilitychange",g)}},[e.sessionId,s?.meta?.now,l,a?.includeSubagentCost]);const i=o&&o.id===e.sessionId&&o.include===(a?.includeSubagentCost===!0)?o:null,d=i?.value;return{usage:yo(n,d,a?.includeSubagentCost===!0,a),config:a,pending:!!e.sessionId&&!!e.api?.getSessionCost&&!i,unrecorded:d?.found===!1&&(!a?.includeSubagentCost||!d.subagentCount)}}function Wa(e){const n=H(e.config)==="en";return e.pending?n?"Loading session cost…":"正在读取本会话费用…":e.unrecorded?n?"Session cost: no ledger records":"本会话暂无账本记录":e.usage?"":n?"Session cost unavailable":"本会话费用暂不可用"}function Ga(e,n){if(Number.isFinite(e?.costCny)||Number.isFinite(e?.costEur)){const o=U(e,{...n,showTotalWithPlan:!0}),r=U(e,{...n,showTotalWithPlan:!1});return{cost:n.showTotalWithPlan?o:r,planPart:n.showTotalWithPlan?0:Math.max(0,o-r)}}let s=0,a=yt(e,n);if(n.showTotalWithPlan!==!0&&(e.apiCost!==void 0||Ha(e,n))){const o={total:yt(e,n),api:Ua(e,n)};s=Math.max(0,o.total-o.api),s>0&&(a=o.api)}return{cost:a,planPart:s}}function Ka(e,n){return Object.entries(e?.byProviderModel??{}).filter(([,s])=>s.input||s.output||s.cacheRead||s.cacheWrite||s.reasoning).map(([s,a])=>s+" "+z(U(a,{...n,showTotalWithPlan:!0}),n)).join("; ")}function ko(e){const n=e.useCost?.(b=>b)?.state?.config,[s,a]=O(null),[o,r]=O(""),l=e.turn?.start?.seq,i=e.turn?.end?.seq,d=e.sessionId,u=JSON.stringify([n?.prices,n?.priceOverrides,n?.priceMatch,n?.planBilling,n?.codingPlans,n?.goQuota?.enabled,n?.peakEnabled,n?.peakEffectiveAt,n?.peakWindows,n?.peakHolidays,n?.exchangeRate]);if(Y(()=>{let b=!0;if(a(null),r(""),!(n?.hideTurnCost||!d||l==null||i==null))return e.api.getTurnCost(d,l,i).then(x=>{b&&a(x)},x=>{b&&r(String(x.message??x))}),()=>{b=!1}},[d,l,i,u,n?.hideTurnCost]),!n||n.hideTurnCost||l==null||i==null)return null;const c=H(n)==="en",f=c?{input:"Input",output:"Output",cacheRead:"Cache read",cacheWrite:"Cache write",reasoning:"Reasoning"}:{input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",reasoning:"推理"},p=b=>z(b,{...n,decimals:Math.max(8,n.decimals??2)}),g=c?{model:"Model call",compaction:"Context compaction",search:"Native search",fetch:"Web fetch"}:{model:"模型调用",compaction:"上下文压缩",search:"原生搜索",fetch:"网页抓取"},h=(b,x)=>t("div",{key:x,style:{marginBottom:4,overflowWrap:"anywhere"}},b.provider+":"+b.model+" · "+(f[b.bucket]||(b.bucket==="fetchRequests"?c?"Fetch requests":"抓取请求":c?"Search requests":"搜索请求"))+(b.plan?" (Plan)":"")+": "+(b.requests?b.requests+(c?" requests":" 次"):b.tokens.toLocaleString())+" × "+(b.priced?p(b.rate):"?")+(b.requests?" ≈ ":" / 1,000,000 ≈ ")+(b.priced?p(b.cost):"?"),b.priced?b.bucket==="reasoning"&&b.rate===0?c?" (no separate charge)":"(不单独收费)":"":c?" (price unavailable)":"(未配置价格)");return t("details",{className:"cm-note",style:{fontSize:12,marginTop:6}},t("summary",{style:{cursor:"pointer"},title:c?"Log estimate at configured prices; session cost uses recorded ledger amounts.":"本轮按日志和配置价格估算,本会话按账本已入账金额汇总。"},c?"Turn cost":"本轮费用",s?.found?" ≈ "+p(U(s,n))+(s.rows.some(b=>!b.priced)?c?" + unpriced usage":" + 未定价用量":""):s?.inherited?c?" · inherited history":" · 继承历史":o?" ⚠":""),o?t("div",{role:"alert"},o):s?s.found?t(D,null,t("p",null,c?"Estimated from recorded usage and configured prices; rates per 1M tokens.":"按已记录用量和配置价格估算;单价单位为每百万 Token。"),t("p",null,"API ≈ "+p(U(s,{...n,showTotalWithPlan:!1}))+" · Plan ≈ "+p(U(s,{...n,showTotalWithPlan:!0})-U(s,{...n,showTotalWithPlan:!1}))+(c?" (equivalent)":"(等值)")),s.rows.map(h),t("details",null,t("summary",{style:{cursor:"pointer"}},(c?"Individual calls":"逐次调用明细")+" ("+s.calls.length+")"),s.calls.map((b,x)=>t("details",{key:x,style:{margin:"6px 0"}},t("summary",{style:{cursor:"pointer",overflowWrap:"anywhere"}},"#"+(x+1)+" "+g[b.kind]+" · "+b.provider+":"+b.model+" · "+new Date(b.atMs).toLocaleTimeString()+" · "+(b.plan?"Plan ":"API ")+(b.priced?"≈ "+p(b.cost):c?"price unavailable":"未配置价格")+(b.longContext?c?" · long context":" · 长上下文价格":"")),b.metering?t("p",null,"billion-context · "+b.metering.upstream+(b.metering.attempt>1?(c?" · Retry ":" · 重试 ")+b.metering.attempt:"")+(b.metering.complete?"":c?" · partial usage":" · 用量回执不完整")):null,b.rows.map(h))))):s.inherited?c?"Inherited usage is not billed again in this conversation.":"继承的历史用量不在本会话重复计费。":c?"Complete usage records unavailable":"没有完整用量记录":c?"Loading…":"加载中…")}function xo(e){const n=Fa(e),{usage:s,config:a}=n;if(!a)return null;const o=Wa(n);if(o)return t("div",{className:"cm-chip"},o);const r=G(H(a)),{cost:l,planPart:i}=Ga(s,a),d=[r("sessionCostTitle"),r("sessionDetailTokens",{input:L(s?.input??0),cache:L((s?.cacheRead??0)+(s?.cacheWrite??0)),output:L(s?.output??0)}),r("sessionDetailCache",{read:L(s?.cacheRead??0),write:L(s?.cacheWrite??0)}),r("cost",{amount:z(l,a)}),...i>0?[r("sessionDetailPlan",{amount:z(i,a)})]:[],Ka(s,a)].filter(Boolean).join("; ");return t($,{portal:!0,label:d,side:"top",delayMs:500},t("div",{className:"cm-chip"},i>0?r("costChipPlan",{amount:z(l,a)}):r("cost",{amount:z(l,a)})))}function wo(e){const n=Fa(e),{usage:s,config:a}=n;if(!a)return null;const o=Wa(n);if(o)return t("div",{className:"cm-root",role:"status",title:o},o);const r=s.input??0,l=(s.cacheRead??0)+(s.cacheWrite??0),i=s.output??0,d=G(H(a)),{cost:u,planPart:c}=Ga(s,a),f=Qa(s)>0?((s.cacheRead??0)/Qa(s)*100).toFixed(1)+"%":"—",p={amount:z(u,a),planAmount:z(c,a),hitRate:f,input:L(r),cache:L(l),output:L(i)},g=d(c>0?"sessionLineSplit":"sessionLine",p),h=Ka(s,a),b=a.sessionCostCompact===!0,x=d("sessionLineCompact",p),A=b?d(c>0?"sessionLineSplitCompact":"sessionLineCompact",p):g;return t("div",{className:"cm-root cm-session-cost",title:[g,h].filter(Boolean).join("; ")},t("span",{className:"cm-session-amount"},x),t("span",{className:"cm-session-detail"},A.slice(x.length)))}const No={USD:"$",CNY:"¥",EUR:"€"};function Re(e,n,s){const a=typeof s=="string"?s.toUpperCase():"",o=typeof n?.symbol=="string"&&n.symbol.length>0?n.symbol:"$";return me(e,{symbol:No[a]??o,decimals:Math.max(2,Math.min(10,Math.floor(Number(n?.decimals)||2)))})}function za(e,n){const s=Number(e?.balance?.budgetCap);if(Number.isFinite(s)&&s>0)return s;const a=Number(n?.maxBudget);return Number.isFinite(a)&&a>0?a:null}function vo(e){const n=e.today,s=n?.byProviderModel;if(s===null||typeof s!="object"||Object.keys(s).length===0)return Number(n?.cost)||0;let a=0;for(const[o,r]of Object.entries(s)){const l=o.indexOf(":");let i=l>=0?o.slice(0,l):o;i.startsWith("llm-")&&(i=i.slice(4)),/^deepseek(?:-official|-account)?$/.test(i)&&(a+=Number(r?.cost)||0)}return a}function Ya(e,n,s,a,o=null){const r=s==="official"?vo(e):Number(e.today?.cost)||0,l=s==="custom"?tt(n,a,o):e.balance?.currency;if(l==="USD")return r;if(l==="CREDITS")return 0;const i=Number(n?.exchangeRate);return r*(Number.isFinite(i)&&i>0?i:1)}function Wt({remaining:e,spend:n,todayUsed:s,cap:a}){if(a===null||a<=0)return{remainingPct:100,todayPct:0,spentPct:0,hasCap:!1,pastSpend:0,today:0};const o=Math.max(0,Number(e)||0),r=Math.max(0,Number(n)||0),l=Math.max(0,Math.min(r,Number(s)||0)),i=Math.max(0,r-l),d=Math.max(0,Math.min(100,o/a*100)),u=Math.max(0,Math.min(100-d,l/a*100)),c=Math.max(0,Math.min(100-d-u,i/a*100));return{remainingPct:d,todayPct:u,spentPct:c,hasCap:!0,pastSpend:i,today:l}}function Gt(e,n,s=null,a=null){const o=s??e.customBalance;if((a??n?.customBalance)?.adapter==="tokenrhythm")return{cap:null,...Wt({remaining:o?.remaining,cap:null})};const r=za(tt(n,o,a)==="CREDITS"?null:n,o),l=Number(o?.remaining)||0,i=Number(o?.spend)||0,d=Ya(e,n,"custom",o,a);return{cap:r,...Wt({remaining:l,spend:i,todayUsed:d,cap:r})}}function So(e,n){const s=e.balance,a=za(n,null),o=Number(s?.totalBalance)||0,r=Ya(e,n,"official",null),l=a!==null?Math.max(0,a-o):0;return{cap:a,...Wt({remaining:o,spend:l,todayUsed:r,cap:a})}}function Kt(e){const{segments:n,direction:s="remaining"}=e,{remainingPct:a,todayPct:o,spentPct:r}=n,l=[];a>0&&l.push(t("div",{className:"cm-bbox-fill",style:{width:a+"%"}})),o>0&&l.push(t("div",{className:"cm-bbox-seg-today",style:{width:o+"%"}})),r>0&&l.push(t("div",{className:"cm-bbox-seg-spent",style:{width:r+"%"}})),l.length===0&&l.push(t("div",{className:"cm-bbox-fill",style:{width:"100%"}}));const i=s==="used"?[...l].reverse():l;return t("div",{className:"cm-bbox-bar segments"+(s==="used"?" rev":"")},...i)}function Va(e,n,s,a,o){const r=[e("balanceBarRemaining",{amount:a})];return s.today>0&&r.push(e("balanceBarToday",{amount:n(s.today)})),s.pastSpend>0&&r.push(e("balanceBarSpent",{amount:n(s.pastSpend)})),o!==null&&o>0&&r.push(e("balanceBudgetCapLabel")+": "+n(o)),r.join(" · ")}function Oe(e){const[n,s]=O(!1),[a,o]=O(null);return{busy:n,err:a,run:()=>{n||typeof e!="function"||(s(!0),o(null),Promise.resolve().then(e).catch(l=>{o(l?.message??String(l))}).finally(()=>{s(!1)}))}}}const ye=(e,n)=>({role:"button",tabIndex:0,"aria-busy":e?"true":"false",onClick:n,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),n())}});function Me(e,n){const s=[e("clickToRefresh")];return n.busy&&s.push(e("refreshing")),n.err&&s.push("⚠ "+e("balanceRefreshFailed",{message:n.err})),s}const Co="https://platform.deepseek.com/usage";function $a(e){return t("a",{className:"cm-bal-link",href:Co,target:"_blank",rel:"noreferrer noopener",title:e("balanceRechargeLink"),"aria-label":e("balanceRechargeLink"),onClick:n=>n.stopPropagation(),onKeyDown:n=>n.stopPropagation()},t("svg",{width:14,height:14,viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},t("path",{d:"M8 4H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-4M11 3h6v6M9 11l8-8"})))}function Ao(e){const{state:n,wide:s,api:a}=e,o=n.balance,r=G(H(n.config)),l=Oe(a?()=>a.refreshBalance():null);if(!o||o.status==="off")return null;if(o.status==="error")return t($,{portal:!0,label:[r("balanceQueryFailed",{message:o.message||r("unknownError")}),...Me(r,l)].join("; "),side:"right",delayMs:300},t("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+" cm-bal-err"+(l.busy?" busy":""),...ye(l.busy,l.run)},s?t(D,null,r("balance")," ",t("span",{className:"cm-num"},r("queryFailed"))):"⚠"));const i=[r("balanceTitle"),r("totalBalance",{amount:Re(o.totalBalance,n.config,o.currency)}),r("grantedToppedUp",{granted:Re(o.grantedBalance,n.config,o.currency),toppedUp:Re(o.toppedUpBalance,n.config,o.currency)}),r("updatedAt",{time:o.fetchedAt>0?new Date(o.fetchedAt).toLocaleTimeString():"—"}),...n.reconcile?.ok===!1?["⚠ "+n.reconcile.message]:[],...Me(r,l)].join("; ");return t($,{portal:!0,label:i,side:"right",delayMs:300},t("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+(l.busy?" busy":""),...ye(l.busy,l.run)},s?t(D,null,t("span",{className:"cm-balance-name"},r("balance"),$a(r)),t("span",{className:"cm-num cm-bal-amt"},Re(o.totalBalance,n.config,o.currency)),n.reconcile?.ok===!1?" ⚠":""):t(kt,{size:16})))}function Po(e){const{state:n,wide:s,api:a}=e,o=n.config,r=n.balance,l=G(H(o)),i=Oe(a?()=>a.refreshBalance():null);if(!r||r.status!=="ok")return null;const d=So(n,o),u=Re(r.totalBalance,o,r.currency),c=g=>Re(g,o,r.currency),f=[l("balanceTitle"),Va(l,c,d,u,d.cap),l("grantedToppedUp",{granted:Re(r.grantedBalance,o,r.currency),toppedUp:Re(r.toppedUpBalance,o,r.currency)}),l("updatedAt",{time:r.fetchedAt>0?new Date(r.fetchedAt).toLocaleTimeString():"—"}),...n.reconcile?.ok===!1?["⚠ "+n.reconcile.message]:[],...Me(l,i)].join("; "),p=t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-balance-name"},t("span",{className:"cm-bbox-label"},l("balance")),$a(l)),t("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},u)),t(Kt,{segments:d,direction:ue(o,"balance")}));return t($,{portal:!0,label:f,side:"right",delayMs:300},t("div",{"data-cm-display":"balance",className:"cm-bbox clickable"+(s?"":" rail")+(i.busy?" busy":""),...ye(i.busy,i.run)},s?p:t("div",{className:"cm-bbox-rail cm-num"},Math.round(d.remainingPct)+"%")))}function zt(e,n){const s=typeof e?.label=="string"?e.label:"",a=typeof e?.labelEn=="string"?e.labelEn:"";return n==="en"?a||s||"Custom balance":s||a||"自定义余额"}function tt(e,n,s){if((s??e?.customBalance)?.adapter==="tokenrhythm")return"CNY";if((s??e?.customBalance)?.adapter==="aliyun"&&["CNY","USD","EUR"].includes(n?.unit))return n.unit;const a=s?.unit??e?.customBalance?.unit;return["CNY","EUR","USD","CREDITS"].includes(a)?a:["CNY","EUR","CREDITS"].includes(n?.unit)?n.unit:"USD"}function at(e,n,s,a){const o=tt(n,s,a),r=Number(e);if(!Number.isFinite(r))return"—";const l=n?.currency==="USD"?1:Number(n?.exchangeRate);if((a??n?.customBalance)?.convertToDisplayCurrency===!0&&o==="USD"&&Number.isFinite(l)&&l>0){const c=r*l;return Number.isFinite(c)?me(c,n):"—"}const i=o==="CREDITS",d=Math.max(2,Math.min(6,Math.floor(Number(n?.decimals)||4)));return(i?"":o==="CNY"?"¥":o==="EUR"?"€":"$")+Ea(r,d)+(i?" Credits":"")}function Yt(e,n,s,a,o=null){const r=at(e.remaining,n,e,o);if((o??n?.customBalance)?.adapter==="tokenrhythm")return s("customBalanceRemaining",{amount:r});const l=p=>at(p,n,e,o);if(a&&n.balance?.showProgressBar===!0){const p=Gt(a,n,e,o);return[Va(s,l,p,r,p.cap),s("updatedAt",{time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"})].join(" · ")}const i=e.spend!==null?l(e.spend):"—",d=e.maxBudget!==null?l(e.maxBudget):"—",u=tt(n,e,o)==="CREDITS"?NaN:Number(n?.balance?.budgetCap),c=Number.isFinite(u)&&u>0?s("balanceBudgetCapLabel")+": "+l(u):"",f=e.maxBudget!==null&&e.spend!==null?s("customBalanceLine",{remaining:r,spend:i,maxBudget:d,time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"}):s("customBalanceRemaining",{amount:r});return c?f+" · "+c:f}function Mo(e,n,s,a,o){const r=zt(o??n.customBalance??{},H(n)),l=at(a.remaining,n,a,o),i=Gt(e,n,a,o);return{level:"ok",rail:Math.round(i.remainingPct)+"%",body:t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bbox-label"},r),t("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},l)),t(Kt,{segments:i,direction:ue(n,"balance")}))}}function xt(e,n){const s=n?.customBalances??[],a=Array.isArray(e?.customBalances)?e.customBalances:[],o=[];return s.forEach((r,l)=>{if(r?.enabled!==!0||r.display!=="sidebar"&&r.display!=="both")return;const i=a.find(d=>d.index===l)??(a.length===1&&s.length===1?a[0]:null);o.push({index:l,entry:r,snapshot:i})}),o.length===0&&a.length===0&&n?.customBalance?.enabled===!0&&(n.customBalance.display==="sidebar"||n.customBalance.display==="both")&&e?.customBalance?.status&&e.customBalance.status!=="off"&&o.push({index:null,entry:n.customBalance,snapshot:e.customBalance}),o}function To(e){const{state:n,wide:s,api:a}=e,o=n.config,r=G(H(o)),l=xt(n,o);return l.length===0?null:t(D,null,l.map(({index:i,entry:d,snapshot:u})=>t(d.adapter==="tokenrhythm"?Ja:Ro,{key:"cb-"+i,state:n,wide:s,api:a,t:r,index:i,entry:d,snapshot:u})))}function Ro(e){const{state:n,wide:s,api:a,t:o,index:r,entry:l,snapshot:i}=e,d=n.config;if(i==null||i.status!=="ok")return null;const u=Oe(a?()=>a.refreshCustomBalance(r):null),c=Mo(n,d,o,i,l),f=[Yt(i,d,o,n,l),...Me(o,u)].join(" · ");return t($,{portal:!0,label:f,side:"right",delayMs:300},t("div",{"data-cm-display":"customBalance",className:"cm-bbox clickable"+(c.level==="ok"?"":" "+c.level)+(s?"":" rail")+(u.busy?" busy":""),...ye(u.busy,u.run)},s?c.body:t("div",{className:"cm-bbox-rail cm-num"},c.rail)))}function Oo(e){const{state:n,wide:s,api:a}=e,o=n.config,r=G(H(o)),l=xt(n,o);return l.length===0?null:t(D,null,l.map(({index:i,entry:d,snapshot:u})=>t(Ja,{key:"cbr-"+i,state:n,wide:s,api:a,t:r,index:i,entry:d,snapshot:u})))}function Ja(e){const{state:n,wide:s,api:a,t:o,index:r,entry:l,snapshot:i}=e,d=n.config,u=i??va(r);if(u.status==="off")return null;const c=Oe(a?()=>a.refreshCustomBalance(r):null),f=zt(l??d.customBalance??{},H(d));if(u.status==="error")return t($,{portal:!0,label:[u.message||o("unknownError"),...Me(o,c)].join("; "),side:"right",delayMs:300},t("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+" cm-bal-err"+(c.busy?" busy":""),...ye(c.busy,c.run)},s?t(D,null,t("span",{className:"cm-bal-label",title:f},f),t("span",{className:"cm-num cm-bal-amt"},o("queryFailed"))):"⚠"));const p=at(u.remaining,d,u,l),g=[Yt(u,d,o,n,l),...Me(o,c)].join(" · ");return t($,{portal:!0,label:g,side:"right",delayMs:300},t("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+(c.busy?" busy":""),...ye(c.busy,c.run)},s?t(D,null,t("span",{className:"cm-bal-label",title:f},f),t("span",{className:"cm-num cm-bal-amt"},p)):t(kt,{size:16})))}function Bo(e){const s=(e.useCost?e.useCost(h=>h):void 0)?.state;if(!s)return null;const a=s.config,o=G(H(a)),r=a.corner??{enabled:!1,goRolling:!0,goWeekly:!0,goMonthly:!0,budget:!0},l=s.goQuota,i=a?.goQuota?.enabled!==!1&&l?.status==="ok",d=h=>h!==null&&typeof h?.percent=="number"?Math.round(Math.max(0,Math.min(100,h.percent))):null,u=[];if(a.sidebarModels?.dock){const h=dn(s,a.sidebarModels.period,o);h.length&&u.push({key:"model-top",text:t(D,null,t("span",{className:"cm-bal-label"},h[0].label),t("span",{className:"cm-bal-amt"},z(h[0].cost,a))),tip:h[0].label+" "+z(h[0].cost,a),level:"ok"})}const c=(h,b,x,A)=>{if(!r.enabled||!h||!i)return;const w=d(b);if(w===null)return;const y=typeof b.resetsAt=="string"&&b.resetsAt.length>0?o("goResetAt",{time:new Date(b.resetsAt).toLocaleString()}):"";u.push({key:x,text:o(x)+" "+w+"%",tip:o(A)+": "+w+"%"+(y?" · "+y:""),level:w>=100?"over":w>=80?"warn":"ok"})},f=a?.goQuota?.main==="weekly"||a?.goQuota?.main==="monthly"?a.goQuota.main:"rolling",p=[f,...["rolling","weekly","monthly"].filter(h=>h!==f)],g=h=>h==="rolling"?["goRolling",l?.rolling,"goShortRolling","cornerGoRolling"]:h==="weekly"?["goWeekly",l?.weekly,"goShortWeekly","cornerGoWeekly"]:["goMonthly",l?.monthly,"goShortMonthly","cornerGoMonthly"];for(const h of p){const[b,x,A,w]=g(h);c(r[b]===!0,x,A,w)}if(r.enabled&&r.budget===!0){const h=a.budget??{enabled:!1,amount:100,period:"month"};if(h.enabled===!0){const b=Number(a.exchangeRate),A=(s.budgetUsed??(h.period==="day"?U(s.today,a):h.period==="all"?U(s.total,a):U(s.month,a)))*(Number.isFinite(b)&&b>0?b:1),w=Math.max(0,Number(h.amount)||0),y=w>0?Math.min(999,A/w*100):null;if(y!==null){const m=y>=100?"over":y>=80?"warn":"ok";u.push({key:"budget",text:o("budgetShort")+" "+y.toFixed(1)+"%",tip:o("budgetOf",{period:o(ze[h.period]??"periodMonth")})+" · "+o("usedOf",{used:me(A,a),amount:me(w,a)}),level:m})}}}return u.length===0?null:t("div",{className:"cm-corner"},u.map(h=>t($,{portal:!0,key:h.key,label:h.tip,side:"top",delayMs:500},t("span",{className:"cm-corner-chip"+(h.key==="model-top"?" cm-model-top":"")+(h.level==="ok"?"":" "+h.level)},h.text))))}function nt(e,n,s){if(!Array.isArray(n)||n.length===0||!Number.isFinite(e))return null;const a=(p,g)=>{const h=new Date(e);return h.setUTCDate(h.getUTCDate()+p),h.setUTCHours(g,0,0,0),h.getTime()},o=new Set,r=Math.max(12,Math.min(380,(Array.isArray(s)?s.length:0)+7));for(let p=-r;p<=r;p+=1){o.add(a(p,16));for(const g of n){const h=Number(g?.start),b=Number(g?.end);!Number.isFinite(h)||!Number.isFinite(b)||(o.add(a(p,h)),o.add(a(b<=h?p+1:p,b)))}}const l=[...o].sort((p,g)=>p-g).flatMap(p=>{const g=gt(p-1,void 0,n,s),h=gt(p,void 0,n,s);return g===h?[]:[{at:p,intoPeak:h}]});let i=null,d=null;for(const p of l)p.at<=e&&(i===null||p.at>i.at)&&(i=p),p.at>e&&(d===null||p.at<d.at)&&(d=p);const u=Oa(e,s),c=u??Ra(e);return c!==null?d===null?null:{inPeak:!1,weekend:u===null,...u?{holiday:!0}:{},prevAtMs:c.start,nextAtMs:d.at,nextIntoPeak:d.intoPeak}:i===null||d===null?null:{inPeak:gt(e,void 0,n,s),weekend:!1,prevAtMs:i.at,nextAtMs:d.at,nextIntoPeak:d.intoPeak}}function _e(e,n){if(!e||e.peakNotice===!1||e.peakEnabled!==!0)return null;const s=Date.parse(e.peakEffectiveAt||"");if(Number.isFinite(s)&&n<s)return null;const a=Array.isArray(e.peakWindows)?e.peakWindows:[];return nt(n,a,e.peakHolidays)}function ot(e){return e.holiday===!0?{short:"holidayShort",chip:"holidayChip",notice:"holidayAllOffPeak"}:e.weekend===!0?{short:"weekendShort",chip:"weekendChip",notice:"weekendAllOffPeak"}:e.inPeak?{short:"peakShort",chip:"peakShort",notice:"peakNotice"}:{short:"offPeakShort",chip:"offPeakShort",notice:"offPeakActive"}}function Ne(e,n,s){const a=Math.max(0,e.nextAtMs-n),o=Math.max(1,Math.ceil(a/6e4)),r=Math.floor(o/60),l=o%60;return r>0?l>0?s("countdownHourMinute",{h:r,m:l}):s("countdownHoursOnly",{h:r}):s("countdownMinute",{m:o})}const Vt="cm-peak-alert-preview";let Za=0;function Do(e){const n=e.useCost?e.useCost(b=>b):void 0,s=n?.state?.config,[a,o]=O(Date.now()),[r,l]=O(null),[i,d]=O(null);if(Y(()=>{const b=window.setInterval(()=>o(Date.now()),1e4);return()=>window.clearInterval(b)},[]),Y(()=>{const b=x=>{const A=x.detail?.kind==="offpeak"?"offpeak":"peak";d(A);const w=n?.state?.config;if(w?.peakAlertWebNotify===!0&&window.Notification&&Notification.permission==="granted"){const y=G(H(w));try{new Notification(y(A==="peak"?"peakAlertTitlePeak":"peakAlertTitleOffPeak")+y("peakAlertPreviewTag"),{body:y("peakAlertBody",{time:y("countdownMinute",{m:2}),phase:y(A==="peak"?"peakAlertPhasePeak":"peakAlertPhaseOffPeak")})})}catch{}}};return window.addEventListener(Vt,b),window.__cmPeakAlertLive=!0,()=>{window.removeEventListener(Vt,b),window.__cmPeakAlertLive=!1}},[]),Y(()=>{if(!s||s.peakAlertEnabled!==!0||s.peakEnabled!==!0||s.peakAlertWebNotify!==!0||!window.Notification||Notification.permission!=="granted")return;const b=nt(a,Array.isArray(s.peakWindows)?s.peakWindows:[],s.peakHolidays);if(b===null)return;const x=s.peakAlertTarget==="peak"||s.peakAlertTarget==="offpeak"?s.peakAlertTarget:"both",A=b.nextIntoPeak===!0;if(x!=="both"&&x!==(A?"peak":"offpeak"))return;const w=Number(s.peakAlertAhead),y=(Number.isFinite(w)&&w>=1?w:2)*6e4;if(a<b.nextAtMs-y||a>=b.nextAtMs||Za===b.nextAtMs)return;const m=G(H(s));Za=b.nextAtMs;try{new Notification(m(A?"peakAlertTitlePeak":"peakAlertTitleOffPeak"),{body:m("peakAlertBody",{time:Ne(b,a,m),phase:m(A?"peakAlertPhasePeak":"peakAlertPhaseOffPeak")})})}catch{}},[a]),!s||s.peakEnabled!==!0)return null;let u=null;if(s.peakAlertEnabled===!0){const b=Date.parse(s.peakEffectiveAt||"");if(!(Number.isFinite(b)&&a<b)){const x=nt(a,Array.isArray(s.peakWindows)?s.peakWindows:[],s.peakHolidays);if(x!==null){const A=s.peakAlertTarget==="peak"||s.peakAlertTarget==="offpeak"?s.peakAlertTarget:"both",w=Number(s.peakAlertAhead),y=(Number.isFinite(w)&&w>=1?w:2)*6e4;(A==="both"||A===(x.nextIntoPeak?"peak":"offpeak"))&&a>=x.nextAtMs-y&&a<x.nextAtMs&&r!==x.nextAtMs&&(u=x)}}}let c=null,f=!1,p=null;if(u!==null)c=u,f=u.nextIntoPeak===!0,p=()=>l(u.nextAtMs);else if(i!==null)c={nextAtMs:a+2*6e4,nextIntoPeak:i==="peak"},f=i==="peak",p=()=>d(null);else return null;const g=G(H(s)),h=s.peakAlertPosition==="center"?"cm-peak-alert-center":"cm-peak-alert-corner";return t("div",{className:"cm-peak-alert "+h+" "+(f?"cm-peak-alert-peak":"cm-peak-alert-offpeak"),role:"alert"},t("div",{className:"cm-peak-alert-badge"},g(f?"peakAlertBadgePeak":"peakAlertBadgeOffPeak")),t("div",{className:"cm-peak-alert-title"},g(f?"peakAlertTitlePeak":"peakAlertTitleOffPeak")),t("div",{className:"cm-peak-alert-body"},g("peakAlertBody",{time:Ne(c,a,g),phase:g(f?"peakAlertPhasePeak":"peakAlertPhaseOffPeak")})),t("div",{className:"cm-peak-alert-actions"},t("button",{className:"cm-btn",onClick:p},g("peakAlertBtn"))))}function Lo(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const d=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const r=_e(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)});return t($,{portal:!0,label:s(l.notice),side:"right",delayMs:300},t("div",{"data-cm-display":"peak",className:"cm-peak-strip "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off")},t("div",{className:"cm-peak-track"},t("div",{className:"cm-peak-segment cm-peak-high"}),t("div",{className:"cm-peak-segment cm-peak-low"}),t("div",{className:"cm-peak-marker",style:{left:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}})),t("span",{className:"cm-peak-chip"},s(l.chip)+" · "+i)))}function Eo(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const d=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const r=_e(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)});return t($,{portal:!0,label:s(l.notice),side:"right",delayMs:300},t("div",{"data-cm-display":"peak",className:"cm-peak-classic "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off")},t("div",{className:"cm-peak-classic-marker",style:{left:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}}),t("div",{className:"cm-peak-track"},t("div",{className:"cm-peak-segment cm-peak-high"}),t("div",{className:"cm-peak-segment cm-peak-low"})),t("span",{className:"cm-peak-classic-chip"},s(l.chip)+" · "+i)))}let Xa;function Io(){return Xa??=dt.async("./client.peak.js").then(e=>e.mount({peakView:_e,peakPhaseAt:nt,phaseLabelKeys:ot,countdownText:Ne,resolveLocale:H,makeT:G,Tooltip:$})).catch(e=>{throw Xa=null,e})}function $t(e){return t(ve,{...e,load:Io,quiet:!0})}function qo(e){const n=e.useCost?.(a=>a)?.state,s=n?.config;return s?.peakEnabled&&s.peakNotice!==!1&&!s.peakProgressPromptSeen?t($t,{...e,state:n,config:s,view:"guide"}):null}function en(e,n,s){return t(n?.peakStyle==="progress"?$t:n?.peakStyle==="classic"?Eo:Lo,{config:n,t:s})}function jo(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const u=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(u)},[]);const r=_e(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)}),d=[s(l.notice),i];return t($,{portal:!0,label:d,side:"right",delayMs:300},t("div",{className:"cm-peak-rail "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off"),"aria-label":d.join("; ")},t("div",{className:"cm-peak-rail-track"},t("div",{className:"cm-peak-rail-segment cm-peak-rail-high"}),t("div",{className:"cm-peak-rail-segment cm-peak-rail-low"}),t("div",{className:"cm-peak-rail-marker",style:{top:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}})),t("span",{className:"cm-peak-rail-label"},s(l.short))))}function Ho(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const u=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(u)},[]);const r=_e(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)}),d=[s(l.notice),i];return t($,{portal:!0,label:d,side:"right",delayMs:300},t("div",{className:"cm-peak-rail-classic "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off"),"aria-label":d.join("; ")},t("div",{className:"cm-peak-rail-classic-track"},t("div",{className:"cm-peak-rail-classic-segment peak"}),t("div",{className:"cm-peak-rail-classic-segment off"}),t("div",{className:"cm-peak-rail-classic-marker",style:{top:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}})),t("span",{className:"cm-peak-rail-classic-label"},s(l.short))))}function Qo(e,n,s){return t(n?.peakStyle==="progress"?$t:n?.peakStyle==="classic"?Ho:jo,{config:n,t:s,rail:!0})}function tn(e,n,s){const a=n.budget??{enabled:!1,amount:100,period:"month"},o=Number(n.exchangeRate),l=(e.budgetUsed??(a.period==="day"?U(e.today,n):a.period==="all"?U(e.total,n):U(e.month,n)))*(Number.isFinite(o)&&o>0?o:1),i=Math.max(0,Number(a.amount)||0),d=i>0?Math.min(999,l/i*100):null,u=we(d===null?null:Math.min(100,d),ue(n,"budget")),c=a.detail!==!1;return{level:d===null?"ok":d>=100?"over":d>=80?"warn":"ok",rail:u.label===null?"—":Math.round(u.label)+"%",body:t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bbox-label"},s("budget")),t("span",{className:"cm-bbox-pct cm-num"},u.label===null?"—":u.label.toFixed(1)+"%")),t("div",{className:"cm-bbox-bar"},t("div",{className:"cm-bbox-fill",style:{width:u.width+"%"}})),c?t(D,null,t("div",{className:"cm-bbox-line cm-num"},s("usedOf",{used:me(l,n),amount:me(i,n)}))):null)}}function an(e,n,s){const a=e.goQuota,o=n?.goQuota?.main==="weekly"||n?.goQuota?.main==="monthly"?n.goQuota.main:"rolling",r=a[o],l=r!==null&&typeof r?.percent=="number"?Math.max(0,Math.min(100,Number(r.percent)||0)):0,i=g=>g!==null&&typeof g?.percent=="number"?Math.round(Math.max(0,Math.min(100,g.percent)))+"%":"—",d=g=>s(g==="rolling"?"goShortRolling":g==="weekly"?"goShortWeekly":"goShortMonthly"),u=["rolling","weekly","monthly"].filter(g=>g!==o),c=r!==null&&typeof r?.resetsAt=="string"&&r.resetsAt.length>0?s("goResetAt",{time:new Date(r.resetsAt).toLocaleString()}):"",f=n?.goQuota?.detail!==!1,p=we(l,ue(n,"go"));return{level:l>=100?"over":l>=80?"warn":"ok",rail:p.label===null?"—":Math.round(p.label)+"%",body:t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bbox-label"},s("goQuotaRowLabel")+" "+d(o)),t("span",{className:"cm-bbox-pct cm-num"},p.label===null?"—":Math.round(p.label)+"%")),t("div",{className:"cm-bbox-bar"},t("div",{className:"cm-bbox-fill",style:{width:p.width+"%"}})),f?t(D,null,t("div",{className:"cm-bbox-line cm-num"},u.map(g=>d(g)+" "+i(a[g])).join(" · ")),c?t("div",{className:"cm-bbox-line"},c):null):null)}}function Uo(e){const{state:n,wide:s}=e,a=n.goQuota,o=G(H(n.config));if(!a||a.status!=="ok")return null;const r=n.config?.goQuota?.main==="weekly"||n.config?.goQuota?.main==="monthly"?n.config.goQuota.main:"rolling";if(a[r]===null||typeof a[r]?.percent!="number")return null;const l=an(n,n.config,o),i=[o("goQuotaTitle"),o("goWindowRolling")+": "+(a.rolling===null?"—":Math.round(a.rolling.percent)+"%"),o("goWindowWeekly")+": "+(a.weekly===null?"—":Math.round(a.weekly.percent)+"%"),o("goWindowMonthly")+": "+(a.monthly===null?"—":Math.round(a.monthly.percent)+"%"+(a.monthly!==null&&typeof a.monthly.resetsAt=="string"&&a.monthly.resetsAt.length>0?" · "+o("goResetAt",{time:new Date(a.monthly.resetsAt).toLocaleString()}):"")),o("goQuotaFetchedAt",{time:a.fetchedAt>0?new Date(a.fetchedAt).toLocaleTimeString():"—"})].join("; ");return t($,{portal:!0,label:i,side:"right",delayMs:300},t("div",{"data-cm-display":"go",className:"cm-bbox"+(l.level==="ok"?"":" "+l.level)+(s?"":" rail")},s?l.body:t("div",{className:"cm-bbox-rail cm-num"},l.rail)))}function _o(e){return e===null||typeof e!="object"||e.unlimited||typeof e.percent!="number"?null:Math.max(0,Math.min(100,Math.round(Number(e.percent)||0)))}function Fe(e){const n=e!==null&&typeof e=="object"?e:{};return{five:n["5h"]??null,seven:n["7d"]??n.week??n.weekly??null}}function nn(e,n,s=Date.now()){if(typeof e!="string"||!e)return"";const a=Date.parse(e);if(!Number.isFinite(a))return"";const o=a-s;if(o<=0)return n("resetReached");const r=Math.ceil(o/6e4),l=Math.floor(r/1440),i=Math.floor(r%1440/60),d=r%60;return l>0?n("resetDays",{d:l,h:i}):i>0?n("resetHours",{h:i,m:d}):n("resetMinutes",{m:d})}function st(e,n,s=Date.now()){const a=nn(e?.resetsAt,n,s);return a?n("goResetAt",{time:new Date(e.resetsAt).toLocaleString()})+" ("+a+")":""}function Ee(e,n,s){return e===null?"—":s(n==="remaining"?"quotaRemaining":"quotaUsed",{pct:e})}function wt(e){const[,n]=O(0),s=()=>n(Date.now());return Y(()=>{if(!e)return;const a=setInterval(s,6e4);return()=>clearInterval(a)},[e]),{onMouseEnter:s,onFocus:s}}function Nt(e,n,s,a){const o=_o(n),r=o===null?"ok":o>=100?"over":o>=80?"warn":"ok",l=we(o,s),i=n?.unlimited?"∞":l.label===null?"—":l.label+"%";return{level:r,pct:o,text:i,label:l.label,row:t("div",{className:"cm-mm-row"+(r==="ok"?"":" "+r)},t("span",{className:"cm-bbox-label"},e),t("div",{className:"cm-bbox-bar"},t("div",{className:"cm-bbox-fill",style:{width:l.width+"%"}})),t("span",{className:"cm-bbox-pct cm-num"},i))}}function Jt(e){const{five:n,seven:s,fetchedAt:a,t:o,wide:r,refresh:l,direction:i="used"}=e,d=wt(n?.resetsAt),u=nn(n?.resetsAt,o),c=Nt(o("codingPlanRemain5h"),n,i,o),f=Nt(o("codingPlanRemain7d"),s,i,o),p=c.level==="over"||f.level==="over"?"over":c.level==="warn"||f.level==="warn"?"warn":"ok",g=(A,w,y)=>{const m=w?.unlimited?o("quotaUnlimited"):Ee(y.label,i,o),k=st(w,o);return A+" "+m+(k?" · "+k:"")},h=[o("codingPlanMinimaxTitle"),g(o("codingPlanRemain5h"),n,c),g(o("codingPlanRemain7d"),s,f),a>0?o("goQuotaFetchedAt",{time:new Date(a).toLocaleTimeString()}):null,...l?Me(o,l):[]].filter(Boolean).join(`
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
5
|
-
`),A=f.map(([,m])=>p(m)).filter(m=>m!==null),w=A.some(m=>m>=100)?"over":A.some(m=>m>=80)?"warn":"ok",y=A.length>0?A.slice(0,2).map(m=>we(m,
|
|
6
|
-
`),I=m.map((v,j)=>v.text!=null?t("div",{key:j,className:"cm-mm-row wide"},t("span",{className:"cm-bbox-label"},v.name),t("span",{className:"cm-mm-text cm-num"},v.text)):t(D,{key:j},v.view.row)),C=v=>{if(!v.key||v.key==="Enter"||v.key===" "){v.stopPropagation(),v.preventDefault?.();const j=a.accounts[(b+1)%a.accounts.length];Jo(s.id,j.id),u({source:s.id,id:j.id})}},q=p?t("span",{className:"cm-gw-switcher","aria-label":i("gatewaySwitchAccount",{account:A||b+1}),onClick:C,onKeyDown:C,role:"button",tabIndex:0},`${b+1}/${a.accounts.length} ⇄`):null,Q=p?t("div",{className:"cm-bbox-head"},t("div",{className:"cm-mm-title"},s.label||s.id),q):t("div",{className:"cm-mm-title"},s.label||s.id),oe=p&&A?t("div",{className:"cm-gw-sub"},A):null,ee=t(D,null,Q,oe,...I),W=m.filter(v=>v.view).map(v=>v.view.label).filter(v=>v!==null),V=W.length>0?W.slice(0,2).map(v=>v+"%").join(" "):m[0].text??"—",M=t("div",{className:"cm-bbox-rail cm-num"},V);return t($,{portal:!0,label:t("span",{style:{whiteSpace:"pre-line"}},R),side:"right",delayMs:300},t("div",{...n,className:"cm-bbox cm-mm clickable"+(k==="ok"?"":" "+k)+(r===!1?" rail":"")+(c.busy?" busy":""),...ye(c.busy,c.run)},r===!1?t(D,null,M,q):ee))}function Xo(e,n,s,a){const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:[],r=[];for(const l of n.gatewayQuotas?.sources??[]){if(l.enabled===!1||l.display!=="sidebar"&&l.display!=="both")continue;const i=o.find(d=>d.id===l.id);!i||i.status!=="ok"&&i.status!=="partial"&&i.status!=="stale"||i.accounts.length===0||r.push(t(Zo,{source:l,snapshot:i,state:e,wide:s,api:a}))}return r}const es={anthropic:"Claude",zai:"Z.ai",minimax:"MM",kimi:"Kimi",openrouter:"OR",siliconflow:"SF",commandcode:"CC",scnet:"SCNet",volcengine:"Ark",qwen:"Qwen",mimo:"MiMo",factory:"Factory",opendesign:"OpenDesign"};function ts(e){const n=e.useCost?e.useCost(w=>w):void 0,s=n?.state?.config;ea(s?.codexQuotaEnabled===!0&&s.codexQuotaStrip!==!1&&s.quotaStrip?.enabled===!0,s?.codexQuotaSource);const[a,o]=O(null),[r,l]=O({}),i=n?.state,d=e.api;if(!i)return null;const u=i.config,c=u.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};if(c.enabled!==!0)return null;const f=G(H(u)),p=[];if(c.budget!==!1){const w=u.budget??{enabled:!1,amount:100,period:"month"};if(w.enabled===!0){const y=Number(u.exchangeRate),k=(i.budgetUsed??(w.period==="day"?U(i.today,u):w.period==="all"?U(i.total,u):U(i.month,u)))*(Number.isFinite(y)&&y>0?y:1),N=Math.max(0,Number(w.amount)||0);if(N>0){const P=Math.min(999,k/N*100),R=P>=100?"over":P>=80?"warn":"ok";p.push({key:"budget",label:f("budgetShort"),level:R,tip:f("budgetOf",{period:f(ze[w.period]??"periodMonth")})+" · "+f("usedOf",{used:me(k,u),amount:me(N,u)})+" · "+P.toFixed(1)+"%",segs:[{name:"main",pct:Math.round(we(Math.min(100,P),ue(u,"budget")).width)}]})}}}if(c.go!==!1){const w=i.goQuota;if(u?.goQuota?.enabled!==!1&&w?.status==="ok"){const y=u.goQuota.main==="weekly"||u.goQuota.main==="monthly"?u.goQuota.main:"rolling",m=y==="rolling"?w.rolling:y==="weekly"?w.weekly:w.monthly;if(m!==null&&typeof m=="object"&&typeof m.percent=="number"){const k=Math.max(0,Math.min(100,Math.round(Number(m.percent)||0))),N=k>=100?"over":k>=80?"warn":"ok",P=typeof m.resetsAt=="string"&&m.resetsAt.length>0?" · "+f("goResetAt",{time:new Date(m.resetsAt).toLocaleString()}):"";p.push({key:"go",label:"Go "+f(y==="rolling"?"goShortRolling":y==="weekly"?"goShortWeekly":"goShortMonthly"),level:N,tip:"Go: "+k+"%"+P,segs:[{name:"main",pct:Math.round(we(k,ue(u,"go")).width)}]})}}}if(c.plans!==!1)for(const w of qe){const y=i.codingPlans?.[w.id];if(u.codingPlans?.[w.id]?.enabled!==!0||!y||y.status!=="ok")continue;const m=y.windows!==null&&typeof y.windows=="object"?y.windows:{},k=Object.entries(m),N=w.id==="factory"?[k.filter(([P])=>!P.startsWith("core_")),k.filter(([P])=>P.startsWith("core_"))]:[k];for(const[P,R]of N.entries()){if(R.length===0)continue;const I=es[w.id]??w.id,C=[],q=[];y.message&&q.push(y.message);let Q=0,oe=0;for(const[ee,W]of R){const V=lt(ee,f),M=typeof W?.resetsAt=="string"&&W.resetsAt.length>0?" · "+f("goResetAt",{time:new Date(W.resetsAt).toLocaleString()}):"",v=W!==null&&typeof W=="object"&&typeof W.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(W.percent)||0))):null;if(q.push(V+" "+(v===null?typeof W?.text=="string"?W.text:"—":v+"%")+M),v===null){C.push({name:ee,pct:null,text:typeof W?.text=="string"?W.text:"—"});continue}oe>=(w.id==="factory"?3:2)||(oe+=1,C.push({name:ee,pct:Math.round(we(v,ue(u,"plan")).width)}),Q=Math.max(Q,v>=100?2:v>=80?1:0))}y.fetchedAt>0&&q.push(f("goQuotaFetchedAt",{time:new Date(y.fetchedAt).toLocaleTimeString()})),C.length!==0&&p.push({key:w.id+(P?":core":""),label:I+(w.id==="factory"?P?" Core":" Standard":""),level:["ok","warn","over"][Q],tip:q.join("; "),segs:C})}}const g=u.codexQuotaEnabled===!0&&u.codexQuotaStrip!==!1&&K.source===(u.codexQuotaSource??"auto")&&K.status==="ok"?K.windows:{},h=g.five??null,b=g.weekly??null,x=w=>Math.max(0,Math.min(100,Math.round(Number(w.percent)||0)));if(h!==null||b!==null){const w=h===null?null:x(h),y=b===null?null:x(b),m=Math.max(w??0,y??0);p.push({key:"codex",label:"Codex",level:m>=100?"over":m>=80?"warn":"ok",tip:f("codexQuotaTitle")+": "+[w===null?null:"5h "+Ee(100-w,"remaining",f),y===null?null:f("codingPlanRemain7d")+" "+Ee(100-y,"remaining",f)].filter(Boolean).join(" · "),segs:[w===null?null:{name:"5h",pct:100-w},y===null?null:{name:"weekly",pct:100-y}].filter(Boolean)})}if(p.length===0)return null;const A=w=>{a!==null||!d||(o(w),l(y=>({...y,[w]:null})),Promise.resolve().then(()=>w==="budget"?d.reload():w==="go"?d.refreshGoQuota():w==="codex"?vt(!0,u.codexQuotaEnabled===!0,u.codexQuotaSource):w==="factory:core"?d.refreshCodingPlan("factory"):d.refreshCodingPlan(w)).catch(y=>{l(m=>({...m,[w]:y?.message??String(y)}))}).finally(()=>o(null)))};return t("div",{className:"cm-qstrip"},p.map(w=>{const y=a===w.key,m=r[w.key],k=[t("span",{className:"cm-qlabel",key:"l"},w.label)];y?k.push(t("span",{className:"cm-qtext",key:"busy"},f("refreshing"))):w.segs.forEach((P,R)=>{R>0&&k.push(t("span",{className:"cm-qsep",key:"sep"+R,"aria-hidden":"true"})),P.pct===null?k.push(t("span",{className:"cm-qtext",key:P.name},P.text)):k.push(t("span",{className:"cm-qseg",key:P.name},t("span",{className:"cm-qbar"},t("span",{className:"cm-qfill",style:{width:P.pct+"%"}})),t("span",null,w.key==="codex"?(w.segs.length>1?(P.name==="5h"?"5h":f("goShortWeekly"))+" ":"")+Ee(P.pct,"remaining",f):P.pct+"%")))});const N=[w.tip];return!y&&d&&N.push(f("clickToRefresh")),y&&N.push(f("refreshing")),m&&N.push("⚠ "+f("balanceRefreshFailed",{message:m})),t($,{portal:!0,key:w.key,label:N.join("; "),side:"bottom",delayMs:400},t("span",{className:"cm-qchip"+(d?" action":"")+(w.level==="ok"?"":" "+w.level),...d?ye(y,()=>A(w.key)):{}},k))}))}const rt="dsh-cost-meter:simple-guide-dismissed";function ta(e){if(e?.sidebarSimplePromptSeen===!0)return!0;try{return window.localStorage.getItem(rt)==="1"}catch{return!1}}function as(e){const n=e.useCost?e.useCost(b=>b):void 0,s=he(!1),[a,o]=O(!1),[r,l]=O(!1),[i,d]=O(!1),u=he(null),c=n?.state?.config,f=!!c&&!i&&!ta(c);if(Y(()=>{const b=u.current;if(!(!f||!b)){if(typeof b.showPopover!="function"){b.removeAttribute("popover");return}try{b.showPopover()}catch{b.removeAttribute("popover")}return()=>{try{b.hidePopover()}catch{}}}},[f]),Y(()=>{const b=()=>d(!0);return window.addEventListener?.(rt,b),()=>window.removeEventListener?.(rt,b)},[]),!f)return null;const p=G(H(c)),g=()=>{d(!0);try{window.localStorage.setItem(rt,"1")}catch{}window.dispatchEvent?.(new Event(rt))},h=async b=>{if(!s.current){s.current=!0,o(!0),l(!1);try{if((await e.api.updateConfig({sidebarSimple:b,sidebarSimplePromptSeen:!0}))?.config?.sidebarSimple!==b)throw new Error;g()}catch{l(!0)}finally{s.current=!1,o(!1)}}};return t("div",{ref:u,popover:"manual",className:"cm-qguide",role:"dialog","aria-label":p("sidebarSimpleTitle"),"aria-busy":a,onKeyDown:b=>{b.key==="Escape"&&(b.stopPropagation(),g())}},t("div",{className:"cm-bbox-head"},t("h4",null,p("sidebarSimpleTitle")),t("button",{type:"button",className:"cm-btn small","aria-label":p("closeGuide"),onClick:g},"×")),t("p",null,p("sidebarSimpleBody")),r?t("p",{role:"alert"},p("sidebarSimpleError")):null,t("div",{className:"cm-buttons"},t("button",{type:"button",className:"cm-btn small",disabled:a,onClick:()=>h(!1)},p("sidebarSimpleOff")),t("button",{type:"button",className:"cm-btn small primary",disabled:a,onClick:()=>h(!0)},p("sidebarSimpleOn"))))}function ns(e){const n=e.useCost?e.useCost(i=>i):void 0,s=he(!1),a=n?.state;if(!a)return null;const o=a.config;if(!ta(o)||o.quotaStrip?.promptSeen===!0)return null;const r=G(H(o)),l=i=>{if(s.current===!0)return;s.current=!0;const d=o.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};e.api.updateConfig({quotaStrip:{...d,enabled:i,promptSeen:!0}}).catch(()=>{s.current=!1})};return t("div",{className:"cm-qguide",role:"dialog","aria-label":r("quotaStripGuideTitle")},t("h4",null,r("quotaStripGuideTitle")),t("p",null,r("quotaStripGuideBody")),t("div",{className:"cm-buttons"},t("button",{type:"button",className:"cm-btn small",onClick:()=>l(!1)},r("quotaStripGuideOff")),t("button",{type:"button",className:"cm-btn small primary",onClick:()=>l(!0)},r("quotaStripGuideOn"))))}const rn="dsh-cost-meter:balance-click-hint-seen",os=()=>{try{return window.localStorage.getItem(rn)==="1"}catch{return!1}},ss=()=>{try{window.localStorage.setItem(rn,"1")}catch{}};function ls(e){const n=e.useCost?e.useCost(g=>g):void 0,s=he(!1),[a,o]=O(!1),[r]=O(os),l=n?.state;if(!l)return null;const i=l.config,d=i.balance?.display==="sidebar"||i.balance?.display==="both",u=(i?.customBalances??[]).some(g=>g?.enabled===!0&&(g.display==="sidebar"||g.display==="both"))||i.customBalance?.enabled===!0&&(i.customBalance?.display==="sidebar"||i.customBalance?.display==="both"),c=qe.some(g=>{const h=i.codingPlans?.[g.id];return h?.enabled===!0&&(h.display==="sidebar"||h.display==="both")});if(a||r||i.balance?.clickHintSeen===!0||!d&&!u&&!c||!ta(i)||i.quotaStrip?.promptSeen!==!0)return null;const f=G(H(i)),p=()=>{s.current!==!0&&(o(!0),s.current=!0,ss(),e.api.updateConfig({balance:{...i.balance??{},clickHintSeen:!0}}).catch(()=>{s.current=!1,o(!1)}))};return t("div",{className:"cm-qguide",role:"dialog","aria-label":f("balanceClickGuideTitle")},t("h4",null,f("balanceClickGuideTitle")),t("p",null,f("balanceClickGuideBody")),t("div",{className:"cm-buttons"},t("button",{type:"button",className:"cm-btn small primary",onClick:p},f("balanceClickGuideOk"))))}function cn(e,n,s){return n.sidebarTodayMetric==="tokens"?L(["input","output","cacheRead","cacheWrite","reasoning"].reduce((a,o)=>a+(Number(e?.[o])||0),0))+" "+s("tokensUnit"):z(U(e,n),n)}function aa(e){const{state:n,wide:s}=e,a=n.today,o=n.config,r=G(H(o)),l=cn(a,o,r),i=o.budget??{enabled:!1,amount:100,period:"month"},d=Number(o.exchangeRate),c=(n.budgetUsed??(i.period==="day"?U(n.today,o):i.period==="all"?U(n.total,o):U(n.month,o)))*(Number.isFinite(d)&&d>0?d:1),f=Math.max(0,Number(i.amount)||0),p=f>0?Math.min(999,c/f*100):null,g=p===null?"ok":p>=100?"over":p>=80?"warn":"ok";if(i.enabled===!0&&o.hideBudget!==!0&&e.todayOnly!==!0){const b=[r("budgetOf",{period:r(ze[i.period]??"periodMonth")}),r("usedOf",{used:me(c,o),amount:me(f,o)})+" · "+(p===null?"—":p.toFixed(1)+"%"),r("monthTotal",{month:z(U(n.month,o),o),total:z(U(n.total,o),o)})].join("; ");if(e.summary===!0)return t($,{portal:!0,label:b,side:"right",delayMs:300},t("div",{"data-cm-display":"budget",className:"cm-simple-summary"+(g==="ok"?"":" "+g),tabIndex:0},t("span",null,r("budgetOf",{period:r(ze[i.period]??"periodMonth")})),t("span",{className:"cm-num"},me(c,o)+" / "+me(f,o))));const x=tn(n,o,r);return t($,{portal:!0,label:b,side:"right",delayMs:300},t("div",{"data-cm-display":"budget",className:"cm-bbox"+(g==="ok"?"":" "+g)+(s?"":" rail")},s?x.body:t("div",{className:"cm-bbox-rail cm-num"},x.rail)))}const h=[o.sidebarTodayMetric==="tokens"?r("todayTokensTitle"):r("todayCostTitle"),r("callsTokens",{calls:a.calls,input:L(a.input),cache:L(a.cacheRead+a.cacheWrite),output:L(a.output)}),r("monthCost",{amount:z(U(n.month,o),o)}),r("totalCost",{amount:z(U(n.total,o),o)})].join("; ");return t($,{portal:!0,label:h,side:"right",delayMs:300},t("div",{"data-cm-display":"today",className:"cm-foot"+(s?"":" cm-foot-rail")},s?t(D,null,r("today")," ",t("span",{className:"cm-num"},l)):t(kt,{size:16})))}function rs(e){const n=e.useCost?e.useCost(o=>o):void 0;ea(n?.state?.config?.codexQuotaEnabled===!0&&n?.state?.config?.codexQuotaSidebar!==!1,n?.state?.config?.codexQuotaSource);let s;if(e.useProjection)try{s=e.useProjection("costUsage")}catch{s=void 0}_a(e,s);const a=n?.state;return a?na(a,!!e.wide,e.api):null}function na(e,n,s,a=!1){const o=e.config,r=G(H(o)),l=(o.balance?.display==="sidebar"||o.balance?.display==="both")&&o.hideOfficialBalance!==!0,d=xt(e,o).length>0,u=l&&o.balance?.showProgressBar===!0&&e.balance?.status==="ok",c=d&&o.balance?.showProgressBar===!0,f=o.goQuota?.main==="weekly"||o.goQuota?.main==="monthly"?o.goQuota.main:"rolling",p=o.goQuota?.enabled!==!1&&(o.goQuota?.display==="sidebar"||o.goQuota?.display==="both")&&e.goQuota?.status==="ok"&&e.goQuota?.[f]!==null,g=qe.map(I=>I.id).filter(I=>{const C=o.codingPlans?.[I];if(C?.enabled!==!0||C.display!=="sidebar"&&C.display!=="both")return!1;const q=e.codingPlans?.[I];if(q?.status!=="ok")return!1;const Q=q.windows!==null&&typeof q.windows=="object"?q.windows:{};return Object.keys(Q).length>0}),h=g.length>0,b=Xo(e,o,n,s),x=o.codexQuotaEnabled===!0&&o.codexQuotaSidebar!==!1,A=(o.budget??{}).enabled===!0&&o.hideBudget!==!0,w=o.sidebar!==!1&&o.hideTodayCost!==!0,y=_e(o,Date.now())!==null,m=o.sidebarModels?.enabled===!0;if(!m&&!l&&!d&&!p&&!h&&!x&&!A&&!w&&!y&&b.length===0)return null;const k=o.sidebarSimple===!0,N=!k&&n&&o.sidebarStyle==="compact",P=[];k&&n&&w&&P.push(t("div",{"data-cm-display":"today",className:"cm-simple-summary"},t("span",null,r("today")),t("span",{className:"cm-num"},cn(e.today,o,r)))),u?P.push(t(Po,{state:e,wide:n,api:s})):l&&P.push(t(Ao,{state:e,wide:n,api:s})),c?P.push(t(To,{state:e,wide:n,api:s})):d&&P.push(t(Oo,{state:e,wide:n,api:s}));const R=P.length;if(h&&P.push(...g.map(I=>I==="minimax"?t(Fo,{state:e,wide:n,api:s}):t($o,{id:I,state:e,wide:n,api:s}))),P.push(...b),x&&P.push(t(Vo,{state:e,wide:n,api:s,preview:a})),p&&A&&n&&!k){const I=an(e,o,r),C=tn(e,o,r),q=I.level==="over"||C.level==="over"?"over":I.level==="warn"||C.level==="warn"?"warn":"ok";P.push(t("div",{className:"cm-bbox cm-bbox-pair"+(q==="ok"?"":" "+q)},t("div",{"data-cm-display":"go",className:"cm-bbox-section"+(I.level==="ok"?"":" "+I.level)},I.body),t("div",{className:"cm-bbox-divider"}),t("div",{"data-cm-display":"budget",className:"cm-bbox-section"+(C.level==="ok"?"":" "+C.level)},C.body)))}else p&&P.push(t(Uo,{state:e,wide:n})),A&&P.push(t(aa,{state:e,wide:n,summary:k&&n}));return w&&!(k&&n)&&P.push(t(aa,{state:e,wide:n,todayOnly:!0})),y&&P.push(n?en(e,o,r):Qo(e,o,r)),m&&P.splice(o.sidebarModels.position==="first"?0:o.sidebarModels.position==="afterBalance"?R:P.length,0,t(is,{key:"models",state:e,wide:n,preview:a})),t("div",{...k?{tabIndex:0,role:"region","aria-label":r("sidebarSimple")}:{},className:"cm-footer-stack"+(n?"":" rail")+(N?" compact":"")+(k?" simple":"")},...P)}const oa={enabled:!1,period:"today",topN:5,summary:"total",position:"last",defaultOpen:!1,remember:!0,tokens:!1,shares:!0,refreshSeconds:60,dock:!1},un="dsh-cost-meter:models-open";function dn(e,n,s){return bn(e,e.config,s,n).map(a=>({...a,label:a.key==="deepseek:legacy"?a.label:fn(a.key),cost:U(a,e.config)})).sort((a,o)=>o.cost-a.cost||o.tokens-a.tokens||a.key.localeCompare(o.key))}function is({state:e,wide:n,preview:s=!1}){const a={...oa,...e.config.sidebarModels},o=G(H(e.config)),r=()=>{try{const y=a.remember?window.localStorage.getItem(un):null;if(y!==null)return y==="1"}catch{}return a.defaultOpen},[l,i]=O(r),[d,u]=O(a.period);Y(()=>u(a.period),[a.period]);const c=he(a.defaultOpen);Y(()=>{i(s&&c.current!==a.defaultOpen?a.defaultOpen:r()),c.current=a.defaultOpen},[a.defaultOpen,a.remember]);const f=dn(e,d,o),p=f.reduce((y,m)=>y+m.cost,0),g=y=>z(y,e.config),h=o(d==="history"?"modelStatsHistory":"modelStatsToday")+" "+g(p)+" · "+o("modelsCount",{n:f.length}),b=a.summary==="top"&&f.length?f[0].label+" "+g(f[0].cost):h,x=a.summary==="top"&&f.length?t(D,null,t("span",{className:"cm-bal-label"},f[0].label),t("span",{className:"cm-bal-amt"},g(f[0].cost))):t("span",{className:"cm-bal-label"},b),A=()=>{i(!l);try{a.remember&&!s&&window.localStorage.setItem(un,l?"0":"1")}catch{}};if(!n||e.config.sidebarSimple)return t("div",{"data-cm-display":"models",className:"cm-foot cm-num"+(n?"":" cm-foot-rail"),title:b+" · "+h},n?x:t(kt,{size:16}));const w=f.slice(0,a.topN);return f.length>a.topN&&w.push(f.slice(a.topN).reduce((y,m)=>{for(const k of["cost","input","output","cacheRead","cacheWrite"])y[k]+=m[k];return y},{key:"other",label:o("modelsOther"),cost:0,input:0,output:0,cacheRead:0,cacheWrite:0})),t("div",{"data-cm-display":"models",className:"cm-bbox cm-model-costs"},t("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(l),title:h,onClick:A},t("span",{className:"cm-caret"+(l?" open":"")}),x),l?t(D,null,t("div",{className:"cm-buttons"},["today","history"].map(y=>t("button",{key:y,type:"button",className:"cm-mstats-tab"+(d===y?" active":""),"aria-pressed":d===y,onClick:()=>u(y)},o(y==="today"?"modelStatsToday":"modelStatsHistory")))),w.length?w.map(y=>t("div",{key:y.key},t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bal-label",title:y.label},y.label),t("span",{className:"cm-num cm-bal-amt"},g(y.cost))),a.shares?t("div",{className:"cm-bbox-bar",title:(p>0?y.cost/p*100:0).toFixed(1)+"%"},t("div",{className:"cm-bbox-fill",style:{width:(p>0?y.cost/p*100:0)+"%"}})):null,a.tokens?t("div",{className:"cm-mstats-note"},o("modelStatsInput")+" "+L(y.input)+" · "+o("modelStatsCache")+" "+L(y.cacheRead+y.cacheWrite)+" · "+o("modelStatsOutput")+" "+L(y.output)):null)):t("span",{className:"cm-note"},o("modelStatsEmpty"))):null)}function cs({draft:e,setDraft:n,t:s,visibilityControl:a=!0}){const o={...oa,...e?.sidebarModels},r=(i,d)=>{e&&n({...e,sidebarModels:{...o,[i]:d}})},l=(i,d)=>t("div",{className:"cm-field",key:i},t("label",null,s("models_"+i)),t("select",{className:"cm-input",value:o[i],onChange:u=>r(i,u.target.value)},d.map(([u,c])=>t("option",{key:u,value:u},s(c)))));return t("div",{className:"cm-grid"},a?t("div",{className:"cm-grid-group"},s("modelsTitle")):null,["enabled","defaultOpen","remember","tokens","shares","dock"].filter(i=>a||i!=="enabled").map(i=>t("label",{key:i,className:"cm-check"},t("input",{type:"checkbox",checked:o[i],onChange:d=>r(i,d.target.checked)}),s("models_"+i))),l("period",[["today","modelStatsToday"],["history","modelStatsHistory"]]),l("summary",[["total","modelsTotal"],["top","modelsTop"]]),l("position",[["first","modelsFirst"],["afterBalance","modelsAfter"],["last","modelsLast"]]),["topN","refreshSeconds"].map(i=>t("div",{key:i,className:"cm-field"},t("label",null,s("models_"+i)),Ie({value:o[i]},d=>r(i,Math.max(i==="topN"?1:10,Math.min(i==="topN"?10:60,Math.floor(d))))))))}function St(e){return t("div",{className:"cm-card"},t("p",{className:"cm-card-title"},e.title),t("div",{className:"cm-card-value cm-num"},e.value),t("p",{className:"cm-card-sub"},e.sub))}const sa=new WeakMap,la=(e,n)=>e?.().then(s=>(sa.set(e,s),s.prefetch?.(n))).catch(()=>{});function us(e){const n=e.useCost?.(l=>l)?.state,s=n?.billionContext,[a,o]=O(null),r=s?.noticeId&&["needs_update","changed","bridge_missing"].includes(s.compatibility);return Y(()=>{if(!r)return;let l=!0;return e.api.loadStatistics().then(i=>{l&&o(()=>i.BillionCompatibilityNotice)}).catch(()=>{}),()=>{l=!1}},[!!r,e.api]),r&&a?t(a,{meter:s,locale:H(n?.config??{})}):null}function ve(e){const n=e.load??e.api.loadStatistics,[s,a]=O(()=>sa.get(n)??null),[o,r]=O(""),[l,i]=O(0);return Y(()=>{let d=!0;if(r(""),typeof n=="function")return n().then(u=>{sa.set(n,u),d&&a(()=>u)},u=>{d&&r(String(u.message??u))}),()=>{d=!1}},[e.api,e.load,l]),s?t(s,{...e,formatMoneyUsd:z,formatTokens:L,resolveLocale:H}):e.quiet?null:t("div",{className:o?"":"cm-loading",role:o?"alert":"status","aria-label":H(e.state?.config)==="en"?"Loading":"正在读取"},o||t(D,null,t("i"),t("i"),t("i")),o?t("button",{className:"cm-btn",onClick:()=>i(d=>d+1)},"↻"):null)}const ds="cm-stat-dialog";function ms(e){const n=e.useCost?.(c=>c),s=n?.state,[a,o]=O(null),r=Te.useRef(null),l=s?.config[e.entryPosition==="header"?"hideSessionCostHeader":"hideSessionCostDock"]===!0,i=!l&&!!e.sessionId&&a===e.sessionId;if(Y(()=>{i&&r.current?.showModal()},[i]),Y(()=>{o(null)},[e.sessionId,l]),!e.sessionId||l)return null;const d=H(s?.config)==="en",u=d?"Conversation cost details":"本会话费用明细";return t(D,null,t("button",{type:"button",className:"cm-btn cm-stat-entry cm-stat-"+(e.entryPosition||"dock"),title:u,"aria-label":u,"aria-haspopup":"dialog",onMouseEnter:()=>la(e.api.loadStatistics,{state:s,sessionId:e.sessionId}),onFocus:()=>la(e.api.loadStatistics,{state:s,sessionId:e.sessionId}),onClick:()=>o(e.sessionId)},d?"Cost details":"费用明细"),i?t("dialog",{ref:r,role:"dialog",className:ds,"aria-label":u,onCancel:()=>o(null)},t("header",{className:"cm-stat-dialog-head"},t("strong",null,u),t("button",{type:"button",className:"cm-btn",autoFocus:!0,"aria-label":d?"Close":"关闭",onClick:()=>o(null)},"×")),t("div",{className:"cm-stat-dialog-body"},s?t(ve,{key:e.sessionId,state:s,api:e.api,sessionId:e.sessionId}):t("p",{role:n?.error?"alert":"status"},n?.error||(d?"Loading…":"加载中…"),t("button",{type:"button",className:"cm-btn",onClick:()=>e.api.reload()},d?"Retry":"重试")))):null)}function ps({state:e,t:n}){const s=e.externalUsage;if(!s)return null;const a=e.config,o=u=>z(U(u,a),a),r=u=>n("callsTokens",{calls:u.calls,input:L(u.input),cache:L(u.cacheRead+u.cacheWrite),output:L(u.output)}),l=(u,c)=>({calls:u.calls+c.calls,input:u.input+c.input,output:u.output+c.output,cacheRead:u.cacheRead+c.cacheRead,cacheWrite:u.cacheWrite+c.cacheWrite,cost:U(u,a)+c.cost,apiCost:U(u,a)+c.cost}),i=(u,c)=>t("tr",{key:u},t("td",null,u),t("td",{className:"num"},String(c.calls)),t("td",{className:"num"},L(c.input)),t("td",{className:"num"},L(c.cacheRead+c.cacheWrite)),t("td",{className:"num"},L(c.output)),t("td",{className:"num"},o(c))),d=u=>t("div",{className:"cm-scroll"},t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,n("colDate")),...["colCalls","colInTok","colCacheTok","colOutTok","colCost"].map(c=>t("th",{className:"num"},n(c))))),t("tbody",null,u)));return t("section",{className:"cm-budget"},t("h3",{className:"cm-h"},n("externalUsage")),s.stale?t("p",{className:"cm-note"},n("externalStale")):null,t("div",{className:"cm-cards"},["today","month","total"].map((u,c)=>{const f=l(e[u],s.combined[u]);return t(St,{key:u,title:n("combinedUsage")+" · "+n(["cardToday","cardMonth","cardTotal"][c]),value:o(f),sub:r(f)})})),...s.sources.map(u=>t("details",{key:u.source},t("summary",null,u.source+" · "+n("cardToday")+" "+o(u.today)+" · "+n("cardMonth")+" "+o(u.month)+" · "+r(u.today)),d(["today","month","total"].map((c,f)=>i(n(["cardToday","cardMonth","cardTotal"][f]),u[c]))),t("p",{className:"cm-note"},n("externalHistory")),d(u.history.map(c=>i(c.date,c))))))}const it=(e,n,s)=>t("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(e),onClick:n},t("span",{className:"cm-caret"+(e?" open":"")}),t("h3",{className:"cm-h"},s));function fs(e){const{state:n,api:s}=e,a=G(H(n.config)),[o,r]=O(!1);return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(o,()=>r(!o),a("history"))),o?t("div",{className:"cm-collapse-body"},t(bs,{state:n,api:s})):null)}function bs(e){const{state:n,api:s}=e,a=G(H(n.config)),[o,r]=O(null),[l,i]=O({}),[d,u]=O(()=>new Set),c=n.history??[];if(c.length===0)return t("p",{className:"cm-empty"},a("noHistory"));const f=g=>{if(o===g){r(null);return}r(g),!(l[g]!==void 0||d.has(g))&&(u(h=>{const b=new Set(h);return b.add(g),b}),s.getDaySessions(g).then(h=>i(b=>({...b,[g]:Array.isArray(h?.sessions)?h.sessions:[]}))).catch(()=>i(h=>({...h,[g]:"error"}))).finally(()=>u(h=>{const b=new Set(h);return b.delete(g),b})))},p=g=>g.map(h=>t("tr",{key:h.id},ra(h,n.config?.showSessionId===!0,a),t("td",{className:"num"},String(h.calls)),t("td",{className:"num"},L(h.input)),t("td",{className:"num"},L(h.cacheRead+h.cacheWrite)),t("td",{className:"num"},L(h.output)),t("td",{className:"num"},z(U(h,n.config),n.config))));return t("div",{className:"cm-scroll"},t("p",{className:"cm-hint",style:{padding:"6px 10px 0"}},a("historyExpandHint")),t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("colDate")),t("th",{className:"num"},a("colCalls")),t("th",{className:"num"},a("colInTok")),t("th",{className:"num"},a("colCacheTok")),t("th",{className:"num"},a("colOutTok")),t("th",{className:"num"},a("colCost")))),t("tbody",null,c.flatMap(g=>{const h=t("tr",{key:g.date,className:"cm-row-click",onClick:()=>f(g.date)},t("td",null,(o===g.date?"▾ ":"▸ ")+g.date),t("td",{className:"num"},String(g.calls)),t("td",{className:"num"},L(g.input)),t("td",{className:"num"},L(g.cacheRead+g.cacheWrite)),t("td",{className:"num"},L(g.output)),t("td",{className:"num"},z(U(g,n.config),n.config)));if(o!==g.date)return[h];const b=l[g.date],x=d.has(g.date)&&b===void 0?t("p",{className:"cm-empty"},a("historySessionsLoading")):b==="error"?t("p",{className:"cm-empty"},a("historySessionsError")):!Array.isArray(b)||b.length===0?t("p",{className:"cm-empty"},a("historyNoSessions")):t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("colSession")),t("th",{className:"num"},a("colCalls")),t("th",{className:"num"},a("colInTok")),t("th",{className:"num"},a("colCacheTok")),t("th",{className:"num"},a("colOutTok")),t("th",{className:"num"},a("colCost")))),t("tbody",null,p(b)));return[h,t("tr",{key:g.date+"-sessions"},t("td",{colSpan:6},x))]}))))}function gs(e){const{state:n,api:s}=e,a=G(H(n.config)),[o,r]=O(!1),[l,i]=O(100),[d,u]=O("cost-desc"),[c,f]=O(null),[p,g]=O(!1),[h,b]=O(!1),x=Te.useRef(0),A=(k,N)=>{const[P,R]=N==="recent"?["recent","desc"]:N.split("-"),I=++x.current;g(!0),b(!1),s.getTopSessions(k,P,R).then(C=>{I===x.current&&f(Array.isArray(C?.sessions)?C.sessions:[])}).catch(()=>{I===x.current&&b(!0)}).finally(()=>{I===x.current&&g(!1)})},w=()=>{r(k=>{const N=!k;return N&&c===null&&!p&&A(l,d),N})},y=k=>{i(k),(o||c!==null)&&A(k,d)},m=k=>{u(k),(o||c!==null)&&A(l,k)};return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(o,w,a("sessionRankTitle"))),o?t("div",{className:"cm-collapse-body"},t("p",{className:"cm-hint"},a("sessionRankHint")),t("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",margin:"6px 0"}},t("div",{className:"cm-field"},t("label",null,a("sessionRankSort")),t("select",{className:"cm-input",value:d,onChange:k=>m(k.target.value)},t("option",{value:"cost-desc"},a("sessionSortCostDesc")),t("option",{value:"cost-asc"},a("sessionSortCostAsc")),t("option",{value:"time-desc"},a("sessionSortTimeDesc")),t("option",{value:"time-asc"},a("sessionSortTimeAsc")),t("option",{value:"recent"},a("sessionSortRecent")))),t("div",{className:"cm-field"},t("label",null,a("sessionRankLimit")),t("select",{className:"cm-input",value:String(l),onChange:k=>y(Number(k.target.value))},t("option",{value:"50"},"50"),t("option",{value:"100"},"100"),t("option",{value:"200"},"200")))),p?t("p",{className:"cm-empty"},a("sessionRankLoading")):h?t("p",{className:"cm-empty"},a("sessionRankError")):c===null||c.length===0?t("p",{className:"cm-empty"},a("sessionRankEmpty")):t("div",{className:"cm-scroll"},t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("colDate")),t("th",null,a("colSession")),t("th",{className:"num"},a("colCalls")),t("th",{className:"num"},a("colInTok")),t("th",{className:"num"},a("colCacheTok")),t("th",{className:"num"},a("colOutTok")),t("th",{className:"num"},a("colCost")))),t("tbody",null,c.map(k=>t("tr",{key:k.date+":"+k.id},t("td",null,k.date),ra(k,n.config?.showSessionId===!0,a),t("td",{className:"num"},String(k.calls)),t("td",{className:"num"},L(k.input)),t("td",{className:"num"},L((k.cacheRead??0)+(k.cacheWrite??0))),t("td",{className:"num"},L(k.output)),t("td",{className:"num"},z(U(k,n.config),n.config)))))))):null)}function hs(e){const{state:n}=e,s=G(H(n.config)),a=n.today.sessions??[];if(a.length===0)return t("p",{className:"cm-empty"},s("noSessionsToday"));const o=n.config?.showSessionId===!0;return t("div",{className:"cm-scroll"},t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,s("colSession")),t("th",{className:"num"},s("colCalls")),t("th",{className:"num"},s("colInTok")),t("th",{className:"num"},s("colCacheTok")),t("th",{className:"num"},s("colOutTok")),t("th",{className:"num"},s("colCost")))),t("tbody",null,a.map(r=>t("tr",{key:r.id},ra(r,o,s),t("td",{className:"num"},String(r.calls)),t("td",{className:"num"},L(r.input)),t("td",{className:"num"},L(r.cacheRead+r.cacheWrite)),t("td",{className:"num"},L(r.output)),t("td",{className:"num"},z(U(r,n.config),n.config)))))))}function ra(e,n,s){const a=typeof e.title=="string"?e.title.trim():"",o=String(e.id).slice(0,14)+"…",r=a.length>0?a:o,l=a.length>0?a+" · "+e.id:e.id;return t("td",{title:l},t("div",{className:"cm-sess-title"+(a.length===0?" cm-sess-id":"")},r),n&&a.length>0?t("div",{className:"cm-sess-id"},o):null)}const ys={CNY:{symbol:"¥",decimals:4,exchangeRate:7.2},USD:{symbol:"$",decimals:6,exchangeRate:1},EUR:{symbol:"€",decimals:6,exchangeRate:.92}};function ks(e){const{state:n,draft:s,setDraft:a,t:o}=e,r=n.config,l=s?.budget??r.budget,i=Number(r.exchangeRate),u=(n.budgetUsed??(l.period==="day"?U(n.today,r):l.period==="all"?U(n.total,r):U(n.month,r)))*(Number.isFinite(i)&&i>0?i:1),c=Math.max(0,Number(l.amount)||0),f=l.enabled&&c>0?Math.min(999,u/c*100):null,p=f===null?"ok":f>=100?"over":f>=80?"warn":"ok",g=(x,A)=>{s!==null&&a({...s,budget:{...s.budget??r.budget,[x]:A}})},h=l.period==="custom"?l.customStart+" → "+(l.customEnd??o("periodDay")):null,b=l.enabled&&f!==null?o("budgetStatus",{period:o(ze[l.period]??"periodMonth"),amount:me(c,r),used:me(u,r),pct:f.toFixed(1)})+(p==="over"?o("overLimit"):p==="warn"?o("nearLimit"):""):null;return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},t("h3",{className:"cm-h"},o("budget")),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:l.enabled===!0,onChange:x=>g("enabled",x.target.checked)}),t("span",null,o("enableBudget")))),l.enabled?t(D,null,t("div",{className:"cm-budget-bar"},t("div",{className:"cm-budget-fill "+(p==="ok"?"":p),style:{width:(f===null?0:Math.min(100,f))+"%"}})),t("div",{className:"cm-budget-line"+(p==="over"?" over":"")+" cm-num"},b),t("div",{className:"cm-budget-controls"},t("div",{className:"cm-field"},t("label",null,o("budgetAmountLabel")),Ie({value:l.amount},x=>g("amount",x))),t("div",{className:"cm-field"},t("label",null,o("budgetPeriodLabel")),t("select",{className:"cm-input",value:l.period,onChange:x=>g("period",x.target.value)},t("option",{value:"day"},o("periodDay")),t("option",{value:"month"},o("periodMonth")),t("option",{value:"all"},o("periodAll")),t("option",{value:"custom"},o("periodCustomRange")))),l.period==="custom"?t(D,null,t("div",{className:"cm-field"},t("label",null,o("startDate")),t("input",{className:"cm-input",type:"date",value:l.customStart??"",onChange:x=>g("customStart",x.target.value===""?null:x.target.value)})),t("div",{className:"cm-field"},t("label",null,o("endDate")),t("input",{className:"cm-input",type:"date",value:l.customEnd??"",onChange:x=>g("customEnd",x.target.value===""?null:x.target.value)}))):null),h!==null?t("p",{className:"cm-hint"},o("rangeText",{range:h})):null):t("p",{className:"cm-note"},o("budgetDisabledNote")))}function xs(e){const{state:n,draft:s,setDraft:a,t:o}=e,r=n.config,l=(c,f)=>{s!==null&&a({...s,[c]:f})},i=s===null?r:{...r,...s},d=(()=>{if(i.peakEnabled!==!0)return o("peakOff");const c=Date.parse(i.peakEffectiveAt||""),f=Date.now();if(Number.isFinite(c)&&f<c)return o("peakNotEffective",{time:new Date(c).toLocaleString()});const p=i.peakWindows??[],g=nt(f,p,i.peakHolidays);return g===null?o("offPeakActive"):g.holiday===!0?o("holidayAllOffPeak"):g.weekend===!0?o("weekendAllOffPeak"):g.inPeak?o("peakActive"):o("offPeakActive")})(),u=(i.peakWindows?.length??0)>0?o("peakSummary",{windows:i.peakWindows.map(c=>c.start+":00-"+c.end+":00").join(H(i)==="zh"?"、":", "),time:i.peakEffectiveAt||o("unknown"),status:d}):o("noPeakWindows",{status:d});return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},t("h3",{className:"cm-h"},o("peakPanelTitle")),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakEnabled!==!1,onChange:c=>l("peakEnabled",c.target.checked)}),t("span",null,o("peakEnabledLabel")))),t("div",{className:"cm-grid"},t("div",{className:"cm-field"},t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakNotice!==!1,onChange:c=>l("peakNotice",c.target.checked)}),t("span",null,o("peakNoticeLabel")))),t("div",{className:"cm-field"},t("label",null,o("peakStyleLabel")),t("select",{className:"cm-input",value:s?.peakStyle??"compact",onChange:c=>l("peakStyle",c.target.value)},t("option",{value:"progress"},H(s)==="en"?"Time progress":"时间进度条"),t("option",{value:"compact"},o("peakStyleCompact")),t("option",{value:"classic"},o("peakStyleClassic"))))),t("div",{className:"cm-grid"},t("div",{className:"cm-field"},t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakAlertEnabled!==!1,onChange:c=>l("peakAlertEnabled",c.target.checked)}),t("span",null,o("peakAlertLabel")))),t("div",{className:"cm-field"},t("label",null,o("peakAlertAheadLabel")),t("input",{className:"cm-input narrow",type:"number",min:"1",max:"30",step:"1",value:String(typeof s?.peakAlertAhead=="number"&&Number.isFinite(s.peakAlertAhead)&&s.peakAlertAhead>=1&&s.peakAlertAhead<=30?s.peakAlertAhead:2),onChange:c=>{const f=Number(c.target.value);Number.isInteger(f)&&f>=1&&f<=30&&l("peakAlertAhead",f)}})),t("div",{className:"cm-field"},t("label",null,o("peakAlertTargetLabel")),t("select",{className:"cm-input",value:s?.peakAlertTarget==="peak"||s?.peakAlertTarget==="offpeak"?s.peakAlertTarget:"both",onChange:c=>l("peakAlertTarget",c.target.value)},t("option",{value:"both"},o("peakAlertTargetBoth")),t("option",{value:"peak"},o("peakAlertTargetPeak")),t("option",{value:"offpeak"},o("peakAlertTargetOffPeak"))))),t("div",{className:"cm-grid"},t("div",{className:"cm-field"},t("label",null,o("peakAlertPositionLabel")),t("select",{className:"cm-input",value:s?.peakAlertPosition==="center"?"center":"corner",onChange:c=>l("peakAlertPosition",c.target.value)},t("option",{value:"corner"},o("peakAlertPositionCorner")),t("option",{value:"center"},o("peakAlertPositionCenter")))),t("div",{className:"cm-field"},t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakAlertWebNotify===!0,onChange:c=>{l("peakAlertWebNotify",c.target.checked),c.target.checked&&window.Notification&&Notification.permission==="default"&&Promise.resolve(Notification.requestPermission()).catch(()=>{})}}),t("span",null,o("peakAlertWebNotifyLabel"))),t("p",{className:"cm-hint"},o("peakAlertWebNotifyHint")))),t("div",{className:"cm-field"},t("label",null,o("peakAlertPreviewLabel")),t("div",{className:"cm-row"},t("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("peak")},o("peakAlertPreviewPeak")),t("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("offpeak")},o("peakAlertPreviewOffPeak")))),t("div",{className:"cm-peak-preview"},s?.peakEnabled!==!1&&s?.peakNotice!==!1?en(n,i,o):t("p",{className:"cm-hint"},o("peakNoticeHiddenHint"))),t("p",{className:"cm-hint"},u),t("div",{className:"cm-field"},t("label",null,o("peakHolidaysLabel")),t("input",{className:"cm-input",defaultValue:(i.peakHolidays??[]).join(", "),onBlur:c=>l("peakHolidays",c.target.value.split(/[,,\s]+/).filter(Boolean))})),t("p",{className:"cm-hint"},o("weekendRuleNote")))}function Ie(e,n){const s=e.value;return t("input",{className:"cm-input narrow",type:"number",step:"any",min:"0",placeholder:e.placeholder,title:e.title,"aria-label":e.label,value:typeof s=="number"?String(s):"",onChange:a=>{const o=a.target.value;if(o===""){if(e.emptyMode==="clear"){n(null);return}if(e.emptyMode==="ignore")return;n(0);return}const r=Number(o);Number.isFinite(r)&&r>=0&&n(r)}})}function mn({value:e,entry:n,path:s,emptyMode:a,placeholder:o,label:r,title:l,t:i,onCommit:d}){const u=bt(n,s),c=e==null?"":String(e)+(n.multiplier!==void 0||n.separateMultipliers?" × "+u:""),[f,p]=O(c),[g,h]=O(!1),b=he(!1);Y(()=>{b.current||p(c)},[c]);const x=()=>{if(!b.current)return;const A=f.trim().split(/\s*[×*xX]\s*/),w=/^[+]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;if(f.trim()===""){b.current=!1,h(!1),a==="clear"?d(null):p(c);return}if(A.length>2||!A.every(y=>w.test(y)&&Number.isFinite(Number(y)))||!Number.isFinite(Number(A[0])*(A.length===2?Number(A[1]):u))){h(!0);return}b.current=!1,h(!1),p(String(Number(A[0]))+(n.multiplier!==void 0||n.separateMultipliers||A.length===2?" × "+(A.length===2?Number(A[1]):u):"")),d(Number(A[0]),A.length===2?Number(A[1]):void 0)};return t("input",{className:"cm-input narrow",type:"text",value:f,placeholder:o,"aria-label":r,"aria-invalid":g,title:g?i("priceMultiplyInvalid"):[l,i(n.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll"),e==null?"":"= "+Number((e*u).toPrecision(12))].filter(Boolean).join(" · "),onChange:A=>{b.current=!0,p(A.target.value),h(!1)},onBlur:x,onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),x()),A.key==="Escape"&&(A.stopPropagation(),b.current=!1,h(!1),p(c))}})}function Ct(e,n,s){s!==void 0&&(e.separateMultipliers?e.multipliers={...e.multipliers,[n]:s}:e.multiplier=s)}function ia(e,n,s,a,o,r,l,i=0){const d=a==="cacheWrite",u=n?.[a]??(a==="cacheMiss"?n?.input:a==="cacheHit"?n?.cachedInput:void 0)??null,c=r({cacheHit:"flatCached",cacheMiss:"flatInput",cacheWrite:"flatCacheWrite",output:"flatOutput"}[a]);return t("label",{className:"cm-price-cell"},t("span",{className:"cm-price-cell-label"},c),t(mn,{entry:e,value:u,path:s+"."+a,t:r,emptyMode:d||!["base","cny"].includes(s)?"clear":"ignore",placeholder:d?String(n?.cacheHit??n?.cachedInput??n?.cacheMiss??n?.input??i):void 0,label:o+" · "+c,title:d?r("cacheWriteFallback"):void 0,onCommit:l}))}function ca(e,n,s){return t("div",{className:"cm-price-multiplier"},t("label",null,t("input",{type:"checkbox",checked:e.separateMultipliers===!0,onChange:a=>s(a.target.checked)}),n("priceMultiplySeparate")),t("span",{title:n(e.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll")},n("priceMultiplyHint")))}function ws(e){const{modelId:n,entry:s,isDefault:a,draft:o,setDraft:r,t:l}=e,i=Je(s),d=g=>{const h={...Je(g)};if(Array.isArray(g.rateHistory)){const b=g.rateHistory.filter(x=>Date.parse(x.before)<=Date.now());b.length>0?h.rateHistory=b:delete h.rateHistory}return h},u=g=>{const h=a?{...o.prices,default:g}:{...o.prices,models:{...o.prices.models,[n]:g}};r({...o,prices:h})},c=(g,h,b,x)=>{const A=a?o.prices.default:o.prices.models[n],w=d(A??{cacheHit:0,cacheMiss:0,output:0}),y=g==="base"?w:{...w[g]??(b===null?{}:Qe(w))};b===null?delete y[h]:y[h]=Math.max(0,b),g!=="base"&&(Object.keys(y).length?w[g]=y:delete w[g]),Ct(w,g+"."+h,x),u(w)},f=()=>{const g={...o.prices.models};delete g[n],r({...o,prices:{...o.prices,models:g}})},p=(g,h)=>{const b=h==="base"?i:i[h]??null;return t("div",{className:"cm-price-row",key:h},t("span",null,g),...["cacheMiss","cacheHit","cacheWrite","output"].map(x=>t(D,{key:x},ia(i,b,h,x,g,l,(A,w)=>c(h,x,A,w),i.cacheHit))))};return t("div",{className:"cm-price-card"},t("div",{className:"cm-price-head"},t("span",{className:"cm-price-name"},n),t("span",{className:"cm-price-unit"},o.prices.currency??"USD"),t(D,null,i?.legacy===!0?t("span",{className:"cm-price-legacy"},l("legacyModel")):null,a?t("span",{className:"cm-price-legacy"},l("defaultFallback")):null,a?null:t("button",{className:"cm-btn small danger",onClick:f},l("remove")))),t("div",{className:"cm-price-row cm-price-columns"},t("span",null,""),t("span",null,l("flatInput")),t("span",null,l("flatCached")),t("span",null,l("flatCacheWrite")),t("span",null,l("flatOutput"))),p(l("tierBase"),"base"),p(l("tierOffPeak"),"offPeak"),p(l("tierPeak"),"peak"),ca(i,l,g=>u({...s,separateMultipliers:g,multipliers:{}})),Array.isArray(s?.rateHistory)&&s.rateHistory.length>0?t("p",{className:"cm-note"},l("datedPriceNote")):null)}const Ns={deepseek:"DeepSeek",stepfun:"StepFun",openai:"OpenAI",anthropic:"Anthropic",google:"Google Gemini",moonshot:"Moonshot (Kimi)","z-ai":"Z.ai / 智谱",xai:"xAI",alibaba:"阿里云百炼",minimax:"MiniMax",tencent:"腾讯混元",xiaomi:"小米",upstage:"Upstage",nvidia:"NVIDIA",mistral:"Mistral",meta:"Meta",meituan:"美团 LongCat","opencode-go":"OpenCode Go"},pn=e=>e==="zen"?"go":e,fn=e=>{const n=e.indexOf(":");return n<=0?e:pn(e.slice(0,n).toLowerCase())+e.slice(n)};function bn(e,n,s,a){const o=["input","output","cacheRead","cacheWrite","reasoning","cost","calls"],r=u=>Number.isFinite(Number(u))&&Number(u)>0?Number(u):0,l=(u,c,f)=>{if(!f||typeof f!="object")return;const p=u[c]??(u[c]=Object.fromEntries([...o,"apiCost"].map(h=>[h,0])));for(const h of o)p[h]+=r(f[h]);for(const h of pt)Number.isFinite(f[h])&&(p[h]=(p[h]??0)+f[h]);const g=c.indexOf(":");p.apiCost+=r(f.apiCost??(et(g>0?c.slice(0,g):"deepseek",g>0?c.slice(g+1):c,n)==="plan"?0:f.cost))},i=u=>{if(!u||typeof u!="object")return{};if(u.byProviderModel&&Object.keys(u.byProviderModel).length)return u.byProviderModel;if(u.byModel&&Object.keys(u.byModel).length)return Object.fromEntries(Object.entries(u.byModel).map(([f,p])=>[f.includes(":")?f:"deepseek:"+f,p]));const c={};for(const f of Array.isArray(u.sessions)?u.sessions:[])if(!(!f||typeof f!="object"))if(f.byProviderModel&&Object.keys(f.byProviderModel).length)for(const[p,g]of Object.entries(f.byProviderModel))l(c,p,g);else l(c,(f.provider||"deepseek")+":"+(f.model||"unknown"),f);return Object.keys(c).length?c:o.some(f=>r(u[f])>0)?{"deepseek:legacy":u}:{}};return(u=>{const c={},f=p=>{for(const[g,h]of Object.entries(p??{}))l(c,g,h)};if(u==="today")f(i(e.today));else{const p=Date.parse((e.meta?.dayKey||new Date().toISOString().slice(0,10))+"T00:00:00Z");for(const g of e.history??[]){const h=Date.parse(g.date+"T00:00:00Z");h<=p&&h>=p-76896e5&&f(i(g))}}return Object.entries(c).map(([p,g])=>{const h=p.indexOf(":"),b=(h>0?p.slice(0,h):"deepseek").toLowerCase(),x=h>0?p.slice(h+1):p,A=g.input+g.output+g.cacheRead+g.cacheWrite+g.reasoning,w=g.cacheRead+g.input;return{label:p==="deepseek:legacy"?s("modelStatsLegacy"):b==="deepseek"||b===""?x:pn(b)+":"+x,key:p,...g,tokens:A,cls:et(b,x,n),hitRate:w>0?g.cacheRead/w:null,cacheUnreported:lo(g),blended:A>0&&g.cost>0?g.cost/A*1e6:null,perUsd:g.cost>0?A/g.cost:null}}).filter(p=>(p.tokens>0||p.cost>0)&&n.modelStatistics?.[p.key]?.[u==="today"?"today":"summary"]!==!1)})(a).sort((u,c)=>c.cost-u.cost||c.tokens-u.tokens)}function vs(e){const{state:n,config:s,t:a,initialTab:o,draft:r,setDraft:l}=e,[i,d]=O(o==="history"?"history":"today"),[u,c]=O(!1),f=bn(n,s,a,i),p=m=>(Math.max(0,Math.min(1,m))*100).toFixed(1)+"%",g=f.reduce((m,k)=>Math.max(m,k.cost),0),h=f.reduce((m,k)=>Math.max(m,k.tokens),0),b=f.reduce((m,k)=>Math.max(m,k.perUsd??0),0),x=(m,k)=>t("button",{className:"cm-mstats-tab"+(i===m?" active":""),onClick:()=>d(m)},k),A=m=>m.cls==="plan"?t("span",{className:"cm-plan-tag",title:a("billingClassLabel")+" · "+(ua(qa(m.provider,s,m.model),a)||a("billingClassPlan"))},a("billingClassPlan")):null,w=m=>t("select",{className:"cm-input",title:a("billingClassLabel"),value:s.planBilling?.models?.[m.key]==="plan"&&s.planBilling?.modelPlans?.[m.key]?"plan:"+s.planBilling.modelPlans[m.key]:s.planBilling?.models?.[m.key]??"auto",disabled:r===null,onChange:k=>{const N={...r.planBilling?.models??{}},P={...r.planBilling?.modelPlans??{}},R=k.target.value;delete P[m.key],R.startsWith("plan:")?(N[m.key]="plan",P[m.key]=R.slice(5)):R==="auto"?delete N[m.key]:N[m.key]=R,l({...r,planBilling:{...r.planBilling,models:N,modelPlans:P}})}},t("option",{value:"auto"},a("billingClassAuto")),t("option",{value:"plan"},a("billingClassPlan")),t("option",{value:"api"},a("billingClassApi")),Xe.map(k=>t("option",{key:k,value:"plan:"+k},a("billingClassPlan")+" · "+ua(k,a)))),y=(m,k,N,P,R)=>t("div",{className:"cm-mstats-row"},R?t("div",{className:"cm-mstats-label"},t("span",{className:"cm-mstats-name",title:m},m),R):t("span",{className:"cm-mstats-name",title:m},m),t("div",{className:"cm-mstats-barbg"},t("div",{className:"cm-mstats-bar "+N,style:{width:p(k)}})),t("span",{className:"cm-mstats-val"},P));return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(u,()=>c(!u),a("modelStatsTitle"))),u?t("div",{className:"cm-collapse-body"},t("div",{className:"cm-mstats-tabs"},x("today",a("modelStatsToday")),x("history",a("modelStatsHistory"))),f.length===0?t("p",{className:"cm-note"},a("modelStatsEmpty")):t(D,null,t("div",{className:"cm-mstats-h"},a("modelStatsCostH")),f.map(m=>t(D,{key:"c:"+m.label},y(m.label,g>0?m.cost/g:0,"cost",z(m.cost,s),t(D,null,A(m),w(m),m.cacheUnreported?t("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null)))),t("div",{className:"cm-mstats-h"},a("modelStatsTokensH")),t("div",{className:"cm-mstats-legend"},t("span",null,t("span",{className:"cm-mstats-dot",style:{background:"var(--dsw-alias-state-business-primary)"}}),a("modelStatsInput")),t("span",null,t("span",{className:"cm-mstats-dot",style:{background:"#ff9800"}}),a("modelStatsCache")),t("span",null,t("span",{className:"cm-mstats-dot",style:{background:"#34a853"}}),a("modelStatsOutput"))),[...f].sort((m,k)=>k.tokens-m.tokens).map(m=>t("div",{className:"cm-mstats-row",key:"t:"+m.label},t("span",{className:"cm-mstats-name",title:m.label},m.label),t("div",{className:"cm-mstats-barbg"},t("div",{className:"cm-mstats-seg in",style:{width:p(h>0?m.input/h:0)}}),t("div",{className:"cm-mstats-seg cache",style:{width:p(h>0?(m.cacheRead+m.cacheWrite)/h:0)}}),t("div",{className:"cm-mstats-seg out",style:{width:p(h>0?(m.output+m.reasoning)/h:0)}})),t("span",{className:"cm-mstats-val"},L(m.tokens)))),t("div",{className:"cm-mstats-h"},a("modelStatsHitH")),[...f].sort((m,k)=>(k.hitRate??-1)-(m.hitRate??-1)).map(m=>t(D,{key:"h:"+m.label},y(m.label,m.hitRate??0,"hit",m.cacheUnreported?a("modelStatsHitUnreported"):m.hitRate===null?"—":(m.hitRate*100).toFixed(1)+"%",m.cacheUnreported?t("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null))),t("div",{className:"cm-mstats-h"},a("modelStatsValueH")),[...f].sort((m,k)=>(k.perUsd??-1)-(m.perUsd??-1)).map(m=>t(D,{key:"v:"+m.label},y(m.label,b>0?(m.perUsd??0)/b:0,"value",m.perUsd===null?"—":L(m.perUsd)+" tok/$"+(m.blended!==null?" · "+a("modelStatsBlended",{price:"$"+m.blended.toFixed(2)}):"")))),t("p",{className:"cm-mstats-note"},a("modelStatsNote")))):null)}function Ss(e,n){return e==="fiveHour"?n==="en"?"5-hour":"5 小时":e==="weekly"?n==="en"?"This week":"本周":e==="monthly"?n==="en"?"This month":"本月":e==="daily"?n==="en"?"Today":"当日":e}function ua(e,n){if(e==="go")return"OpenCode Go / Go Plus";const s={codex:"Codex / ChatGPT","volcengine-agent":"Volcengine Agent Plan","tencent-coding":"Tencent Coding Plan","tencent-token":"Tencent Token Plan","baidu-coding":"Baidu Qianfan Coding Plan"};if(s[e])return s[e];const a=qe.find(o=>o.id===e);return a!==void 0?n(a.labelKey):e}const gn=["fiveHour","weekly","monthly","daily"];function Cs(e,n){const s=new Map,a=o=>{const r=new Date(o),l=i=>String(i).padStart(2,"0");if(n==="monthly")return r.getFullYear()+"-"+l(r.getMonth()+1);if(n==="weekly"){const i=new Date(r.getFullYear(),r.getMonth(),r.getDate()-(r.getDay()+6)%7);return i.getFullYear()+"-"+l(i.getMonth()+1)+"-"+l(i.getDate())}return r.getFullYear()+"-"+l(r.getMonth()+1)+"-"+l(r.getDate())};for(const o of Object.values(e??{}))for(const r of o??[]){if(r===null||typeof r!="object"||!(r.tokens>0)&&!(r.cost>0))continue;const l=a(Number(r.t1)||Number(r.t0)),i=s.get(l)??{key:l,tokens:0,cost:0,pct:0,intervals:0};i.tokens+=Number(r.tokens)||0,i.cost+=Number(r.cost)||0,i.pct+=Number(r.pct)||0,i.intervals+=1,s.set(l,i)}return[...s.values()].map(o=>({...o,per1Tokens:o.pct>0?o.tokens/o.pct:null,fullTokens:o.pct>0?o.tokens/o.pct*100:null})).sort((o,r)=>o.key<r.key?-1:o.key>r.key?1:0)}function As(e){const{state:n,config:s,t:a}=e,[o,r]=O(!1),[l,i]=O("daily"),d=H(s),u=n?.planStats,c=u!=null&&typeof u.providers=="object"?u.providers:{},f=Object.keys(c).sort(),p=N=>z(Number(N)||0,s??n?.config),g=N=>N.method==="none"||N.per1Tokens===null?"—":L(N.per1Tokens)+" tok · "+p(N.per1Cost),h=N=>N.method==="none"||N.fullTokens===null?"—":L(N.fullTokens)+" tok · "+p(N.fullCost),b=N=>N.method==="sample"?a("planStatsMethodSample"):N.method==="live"?a("planStatsMethodLive"):a("planStatsMethodNone"),x=N=>{let P=b(N);return N.method==="sample"&&Number(N.sampleAt)>0&&(P=a("planStatsMethodSampleAt",{method:P,time:new Date(Number(N.sampleAt)).toLocaleString(d==="en"?"en-US":"zh-CN")})),(N.method==="sample"||N.method==="live")&&N.confidence==="low"&&(P+=" · "+a("planStatsConfidenceLow")),P},A=([N,P,R])=>t("tr",{key:P+":"+N},t("td",null,Ss(N,d)),t("td",{className:"num"},Math.round(R.percent*10)/10+"%"),t("td",{className:"num"},L(R.localTokens)+" tok · "+p(R.localCost)),t("td",{className:"num"},g(R)),t("td",{className:"num"},h(R)),t("td",{className:"num cm-plan-reset"},R.resetsAt.length>0?a("planStatsResets",{time:new Date(R.resetsAt).toLocaleString(d==="en"?"en-US":"zh-CN")}):"—"),t("td",{className:"cm-plan-method"},x(R))),w=o?f.flatMap(N=>Object.entries(c[N]?.intervals??{})).map(([N,P])=>({winKey:N,list:P})):[],y=Cs(Object.fromEntries(w.map(N=>[N.winKey,N.list])),l),m=y.reduce((N,P)=>Math.max(N,P.fullTokens??0),0),k=(N,P)=>t("button",{key:N,className:"cm-mstats-tab"+(l===N?" active":""),onClick:()=>i(N)},P);return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(o,()=>r(!o),a("planStatsTitle"))),o?t("div",{className:"cm-collapse-body"},f.length===0?t("p",{className:"cm-empty"},a("planStatsEmpty")):t(D,null,f.map(N=>{const P=c[N]?.windows??{},R=[...gn.filter(I=>P[I]!==void 0).map(I=>[I,N,P[I]]),...Object.keys(P).filter(I=>!gn.includes(I)).map(I=>[I,N,P[I]])];return t("div",{key:N,className:"cm-plan-provider"},t("div",{className:"cm-plan-provider-name"},ua(N,a),t("span",{className:"cm-plan-updated"},(()=>{const I=Number(c[N]?.generatedAt)||Number(u?.generatedAt)||0;return I>0?new Date(I).toLocaleTimeString(d==="en"?"en-US":"zh-CN"):""})())),t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("planStatsWindow")),t("th",{className:"num"},a("planStatsPercent")),t("th",null,a("planStatsLocal")),t("th",null,a("planStatsPer1")),t("th",null,a("planStatsFull")),t("th",null,""),t("th",null,""))),t("tbody",null,R.map(A))))}),t("div",{className:"cm-mstats-h",style:{marginTop:"10px"}},a("planStatsCurveTitle")),t("div",{className:"cm-mstats-tabs"},k("daily",a("planStatsDaily")),k("weekly",a("planStatsWeekly")),k("monthly",a("planStatsMonthly"))),y.length===0?t("p",{className:"cm-note"},a("planStatsCurveEmpty")):t(D,null,[...y].reverse().map(N=>t("div",{className:"cm-mstats-row",key:N.key},t("span",{className:"cm-mstats-name"},N.key),t("div",{className:"cm-mstats-barbg"},t("div",{className:"cm-mstats-bar value",style:{width:(m>0?(N.fullTokens??0)/m*100:0).toFixed(1)+"%"}})),t($,{label:a("planStatsBarTip",{date:N.key,full:N.fullTokens===null?"—":L(N.fullTokens),per1:N.per1Tokens===null?"—":L(N.per1Tokens),tokens:L(N.tokens),cost:p(N.cost),intervals:N.intervals}),side:"top",delayMs:200},t("span",{className:"cm-mstats-val"},N.fullTokens===null?"—":L(N.fullTokens)))))),t("p",{className:"cm-note"},a("planStatsNote")))):null)}function Ps(e){const{provider:n,modelId:s,entry:a,draft:o,setDraft:r,t:l,api:i,lockedIds:d,releaseDisabled:u}=e,c=Array.isArray(d)&&d.includes(s),[f,p]=O(!1),[g,h]=O(""),b=async()=>{if(!(f||u)){p(!0),h("");try{await i.releasePriceLock(s)}catch(m){h(String(m.message??m))}finally{p(!1)}}},x=m=>{const k={...o.prices.providers??{}},N=k[n]??{};k[n]={...N,models:m},r({...o,prices:{...o.prices,providers:k}})},A=(m,k,N)=>{if(o===null)return;const P={...(o.prices.providers??{})[n]?.models??{}};P[s]={...P[s]??{},[m]:Math.max(0,k)},k===null&&delete P[s][m],m==="input"&&delete P[s].cacheMiss,m==="cachedInput"&&(delete P[s].cacheHit,delete P[s].cacheRead),Ct(P[s],"base."+({input:"cacheMiss",cachedInput:"cacheHit"}[m]??m),N),x(P)},w=(m,k,N)=>{if(o===null)return;const P={...(o.prices.providers??{})[n]?.models??{}},R=P[s]??{};P[s]={...R,cny:{...R.cny,[m]:Math.max(0,k)}},k===null&&delete P[s].cny[m],Ct(P[s],"cny."+m,N),x(P)},y=()=>{if(o===null)return;const m={...(o.prices.providers??{})[n]?.models??{}};delete m[s],x(m)};return t("div",{className:"cm-price-card"},t("div",{className:"cm-price-head"},t("span",{className:"cm-price-name"},s),t("span",{className:"cm-price-unit"},a.cny?"USD / CNY":"USD"),t(D,null,a?.unpriced===!0?t("span",{className:"cm-price-legacy"},l("catalogUnpriced")):null,c?t("span",{className:"cm-price-locked",title:l("priceLockHint")},l("priceLockBadge")):null,c&&typeof i?.releasePriceLock=="function"?t("button",{className:"cm-btn small",disabled:f||u,onClick:b},l("priceLockRelease")):null,t("button",{className:"cm-btn small danger",onClick:y},l("unmountBtn")))),g?t("p",{className:"cm-err",role:"alert"},g):null,a?.unpriced===!0?null:t(D,null,t("div",{className:"cm-price-row cm-price-columns"},t("span",null,""),t("span",null,l("flatInput")),t("span",null,l("flatCached")),t("span",null,l("flatCacheWrite")),t("span",null,l("flatOutput"))),t("div",{className:"cm-price-row"},t("span",null,"USD"),...["cacheMiss","cacheHit","cacheWrite","output"].map(m=>t(D,{key:m},ia(a,a,"base",m,"USD",l,(k,N)=>A({cacheMiss:"input",cacheHit:"cachedInput"}[m]??m,k,N))))),a?.cny?t("div",{className:"cm-price-row"},t("span",null,"CNY"),...["cacheMiss","cacheHit","cacheWrite","output"].map(m=>t(D,{key:m},ia(a,a.cny,"cny",m,"CNY",l,(k,N)=>w(m,k,N))))):null,ca(a,l,m=>x({...o.prices.providers[n].models,[s]:{...a,separateMultipliers:m,multipliers:{}}}))))}const At=e=>[t("option",{key:"sidebar",value:"sidebar"},e("balanceSidebar")),t("option",{key:"settings",value:"settings"},e("balanceSettings")),t("option",{key:"both",value:"both"},e("balanceBoth")),t("option",{key:"off",value:"off"},e("off"))],da=e=>e!=null?t("div",{className:"cm-msg "+e.kind},e.text):null;function Ms(e){const{state:n,api:s,t:a,draft:o,setDraft:r}=e,[l,i,d]=ct(a,()=>s.refreshBalance()),u=n.balance,c=n.config,f=n.reconcile,p=(o?.balance??c.balance??{}).reconcile!==!1,g=x=>{o===null||typeof r!="function"||r({...o,balance:{...o.balance??c.balance??{},reconcile:x.target.checked}})},h=x=>Re(x,c,u?.currency),b=u.status==="ok"?t("div",{className:"cm-bal-line"},t("span",null,a("balanceLine",{total:h(u.totalBalance),granted:h(u.grantedBalance),toppedUp:h(u.toppedUpBalance),time:u.fetchedAt>0?new Date(u.fetchedAt).toLocaleTimeString():"—"}))):u.status==="error"?t("div",{className:"cm-bal-line err"},a("balanceQueryFailedHint",{message:u.message||a("unknownError")})):t("div",{className:"cm-bal-line"},a("balanceNotQueried"));return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},t("h3",{className:"cm-h"},a("accountBalance")),t("button",{className:"cm-btn small",onClick:d,disabled:l},a(l?"refreshing":"refreshBalance"))),b,t("label",null,a("balanceApiKey")),t(Le,{target:"balance",configured:u.keyConfigured,source:u.keySource,t:a,api:s,placeholder:"sk-…"}),t("p",{className:"cm-hint"},a("balanceKeyHint")),f!==void 0&&f.ok===!1?t("div",{className:"cm-bal-line warn"},"⚠ "+f.message):null,t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:p,onChange:g}),a("reconcileLabel")),da(i))}function Pt(e){const n=he(null);Y(()=>{e.targeted&&(n.current?.scrollIntoView({block:"start"}),n.current?.focus({preventScroll:!0}))},[e.targeted]);const{name:s,enabled:a,saved:o,busy:r,open:l,statusNode:i,configNode:d,errorMsg:u,onToggle:c,onRefresh:f,onLogin:p,loginRequired:g,onRemove:h,onToggleOpen:b,t:x}=e,A=d!=null,w=g?p:f,y=x(r===!0?g?"loggingIn":"refreshing":g?"loginCodingPlan":"refresh");return t("div",{ref:n,"data-quota-plan":e.planId,tabIndex:e.targeted?-1:void 0,className:"cm-budget cm-quota-card"},t("div",{className:"cm-budget-head"},t("label",{className:"cm-check"},t("input",{type:"checkbox","aria-label":x("enable")+": "+s,checked:a===!0,onChange:m=>c(m.target.checked)})),t("div",{className:"cm-quota-name"},A?it(l===!0,b,s):t("h3",{className:"cm-h"},s)),h?t("button",{className:"cm-btn small",onClick:h},x("quotaRemove")):null,t("button",{className:"cm-btn small",onClick:w,disabled:r===!0||a!==!0||o?.enabled!==!0||o.display==="off",title:a!==!0?x("quotaEnableFirst"):o?.enabled!==!0||o.display==="off"?x("quotaRefreshReady"):x(g?"loginCodingPlan":"refresh")},y)),i,A&&l===!0?t("div",{className:"cm-collapse-body"},d):null,u!=null?t("div",{className:"cm-msg "+u.kind},u.text):null)}function ct(e,n){const[s,a]=O(!1),[o,r]=O(null),l=he(!1);return[s,o,async()=>{if(!l.current){l.current=!0,a(!0),r(null);try{const d=await n();r({kind:d.ok?"ok":"err",text:d.message})}catch(d){r({kind:"err",text:e("syncFailed",{message:d?.message??String(d)})})}finally{l.current=!1,a(!1)}}}]}const Ts=e=>{const n=e.filter(a=>a.enabled===!0),s=e.filter(a=>a.enabled!==!0);return[...n,...s]},hn=(e,n,s,a,o,r=n)=>{if(typeof s?.percent!="number")return t("div",{key:r,className:"cm-go-row"+(o?" main":"")},t("span",{className:"cm-go-label"},n),t("span",{className:"cm-go-num"},typeof s?.text=="string"?s.text:"—"));const l=Math.max(0,Math.min(100,Number(s.percent)||0)),i=we(l,a),d=typeof s.resetsAt=="string"&&s.resetsAt.length>0?e("goResetAt",{time:new Date(s.resetsAt).toLocaleString()}):"";return t("div",{key:r,className:"cm-go-row"+(o?" main":"")},t("span",{className:"cm-go-label"},n),t("div",{className:"cm-go-bar"},t("div",{className:"cm-go-fill",style:{width:i.width+"%"}})),t("span",{className:"cm-go-num"},i.label===null?"—":e("goQuotaPercent",{percent:String(Math.round(i.label))})),d?t("span",{className:"cm-go-reset"},d):null)};function Rs(e){const{state:n,api:s,t:a,entry:o,index:r,canRemove:l,onPatch:i,onRemove:d}=e,u=o.adapter==="aliyun",c=o.adapter==="tokenrhythm",f=u||c,[p,g]=O(!1),h=()=>({headers:JSON.stringify(o.request?.headers??{},null,2),extract:JSON.stringify(o.extract??{},null,2),body:typeof o.request?.body=="string"?o.request.body:JSON.stringify(o.request?.body,null,2)??""}),[b,x]=O(h),[A,w]=O(()=>(o.allowedHosts??[]).join(", ")),[y,m]=O({}),k=he(!1),N=n.config,R=(Array.isArray(n.customBalances)?n.customBalances:[]).find(B=>B.index===r)??null,I=o.enabled===!0,C=()=>{g(B=>!B)};Y(()=>{p&&!k.current&&(x(h()),w((o.allowedHosts??[]).join(", ")),m({})),k.current=p},[p]);const q=(B,J)=>i({[B]:J}),Q=(B,J)=>i({request:{...o.request??{},[B]:J}}),oe=u?["ALIBABA_CLOUD_ACCESS_KEY_ID","ALIBABA_CLOUD_ACCESS_KEY_SECRET","ALIBABA_CLOUD_SECURITY_TOKEN"]:c?["TOKENRHYTHM_COOKIE"]:[...new Set(Object.values(o.request?.headers??{}).flatMap(B=>typeof B=="string"?[...B.matchAll(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g)].map(J=>J[1]):[]))],ee=(B,J)=>{x(Z=>({...Z,[B]:J}));try{const Z=B==="body",ae=Z&&!J.trim()?void 0:JSON.parse(J);if(!Z&&(ae===null||typeof ae!="object"||Array.isArray(ae)))throw new Error("invalid");if(B==="headers"&&Object.values(ae).some(T=>typeof T!="string"))throw new Error("invalid");m(T=>({...T,[B]:""})),B==="extract"?q(B,ae):Q(B,Z?ae===void 0?void 0:J:ae)}catch{m(Z=>({...Z,[B]:a("customBalanceInvalidJson")}))}},W=(B,J,Z,ae)=>!f&&t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,a(J)),ae&&t("span",{className:"cm-hint"},a(ae)),t("textarea",{className:"cm-input",rows:Z,value:b[B],onChange:T=>ee(B,T.target.value)}),y[B]?t("span",{className:"cm-hint err"},y[B]):null),V=B=>{w(B);const J=B.split(/[\s,;]+/).map(Z=>Z.trim()).filter(Z=>Z.length>0);q("allowedHosts",J)},[M,v,j]=ct(a,()=>(N.customBalances??[])[r]?.enabled!==!0?Promise.resolve({ok:!1,message:a("quotaEnableFirst")}):s.refreshCustomBalance(r)),ie=R!==null&&R.status==="ok"?t(D,null,N.balance?.showProgressBar===!0&&!c?t("div",{className:"cm-budget",style:{marginTop:"8px"}},t(Kt,{segments:Gt(n,N,R,o),direction:ue(N,"balance")}),t("div",{className:"cm-bal-line"},Yt(R,N,a,n,o))):t("div",{className:"cm-bal-line"},a("customBalanceRemaining",{amount:at(R.remaining,N,R,o)}))):R!==null&&R.status==="error"?t("div",{className:"cm-bal-line err"},R.message||a("unknownError")):t("div",{className:"cm-bal-line"},R?.message||a("balanceNotQueried")),ge=t(D,null,t("p",{className:"cm-note"},a(c?"tokenRhythmBalanceNote":u?"aliyunBalanceNote":"customBalanceConfigNote")),!c&&t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:o.convertToDisplayCurrency===!0,disabled:tt(N,R,o)!=="USD",onChange:B=>q("convertToDisplayCurrency",B.target.checked)}),a("customBalanceConvert")),!c&&t("p",{className:"cm-note"},a("customBalanceConvertNote")),t("div",{className:"cm-grid"},[["label","customBalanceLabelZh"],["labelEn","customBalanceLabelEn"]].map(([B,J])=>t("div",{key:B,className:"cm-field"},t("label",null,a(J)),t("input",{className:"cm-input",value:o[B]??"",onChange:Z=>q(B,Z.target.value)}))),!f&&t("div",{className:"cm-field"},t("label",null,a("customBalanceUnitLabel")),t("select",{className:"cm-input",value:["CNY","EUR","CREDITS"].includes(o.unit)?o.unit:"USD",onChange:B=>q("unit",B.target.value)},t("option",{value:"USD"},"USD ($)"),t("option",{value:"CNY"},"CNY (¥)"),t("option",{value:"EUR"},"EUR (€)"),t("option",{value:"CREDITS"},"CREDITS"))),t("div",{className:"cm-field"},t("label",null,a("customBalanceDisplayLabel")),t("select",{className:"cm-input",value:o.display??"both",onChange:B=>q("display",B.target.value)},...At(a))),t("div",{className:"cm-field"},t("label",null,a("customBalanceRefreshInterval")),Ie({value:o.refreshMinutes??15},B=>q("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(B)))))),!f&&t("div",{className:"cm-field"},t("label",null,a("customBalanceMethod")),t("select",{className:"cm-input",value:o.request?.method??"GET",onChange:B=>Q("method",B.target.value)},t("option",{value:"GET"},"GET"),t("option",{value:"POST"},"POST"))),!f&&t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,a("customBalanceUrl")),t("input",{className:"cm-input",value:o.request?.url??"",placeholder:"/plugins/dsh-workbuddy-connect/status",onChange:B=>Q("url",B.target.value)}),t("span",{className:"cm-hint"},a("customBalanceUrlHint"))),W("headers","customBalanceHeaders",5,"customBalanceHeadersVarNote"),!["GET","HEAD"].includes((o.request?.method??"GET").toUpperCase())&&W("body","customBalanceBody",5,"customBalanceBodyNote"),t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,c?"Token Rhythm Cookie":a("customBalanceCredentialsTitle")),oe.length>0?t(D,null,!f&&t("span",{className:"cm-hint"},a("customBalanceCredentialsHint")),oe.map(B=>t(Le,{key:"cb-var-"+B,target:"customVar:"+B,configured:(n.customVarStatus?.[B]?.configured??!1)===!0,source:n.customVarStatus?.[B]?.source??"",t:a,api:s,placeholder:c?"tr_session=…":"{{"+B+"}}"}))):t("span",{className:"cm-hint"},a("customBalanceNoPlaceholders"))),!f&&t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,a("customBalanceAllowedHosts")),t("input",{className:"cm-input",value:A,placeholder:"api.example.com, relay.example.org",onChange:B=>V(B.target.value)}),t("span",{className:"cm-hint"},a("customBalanceAllowedHostsHint"))),!f&&t("label",{className:"cm-check",style:{gridColumn:"1 / -1"}},t("input",{type:"checkbox",checked:o.allowInsecureHttp===!0,onChange:B=>q("allowInsecureHttp",B.target.checked)}),a("customBalanceHttp")),W("extract","customBalanceExtract",8)));return t(Pt,{name:`#${r+1} · `+(zt(o,H(N))||a("customBalanceTitle")),enabled:I,saved:JSON.stringify(o)===JSON.stringify(N.customBalances?.[r])?N.customBalances[r]:null,busy:M,open:p,statusNode:ie,configNode:ge,errorMsg:v,onToggle:B=>q("enabled",B),onRefresh:j,onRemove:l?d:null,onToggleOpen:C,t:a})}function Os({config:e,draft:n,setDraft:s,t:a,api:o}){const r=n?.goQuota??e.goQuota,l=(i,d)=>{n&&s({...n,goQuota:{...r,[i]:d}})};return t(D,null,[["display","goQuotaDisplayLabel"],["main","goMainLabel"]].map(([i,d])=>t("div",{key:i,className:"cm-field"},t("label",null,a(d)),t("select",{className:"cm-input",value:r[i],onChange:u=>l(i,u.target.value)},i==="display"?At(a):["rolling","weekly","monthly"].map((u,c)=>t("option",{key:u,value:u},a(["goWindowRolling","goWindowWeekly","goWindowMonthly"][c])))))),t("div",{className:"cm-field"},t("label",null,a("goQuotaRefreshIntervalLabel")),Ie({value:r.refreshMinutes},i=>l("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(i)))))),t("label",null,a("goQuotaKeyLabel")),t(Le,{target:"goQuota",configured:e.goQuota?.keyConfigured===!0,source:e.goQuota?.keySource,t:a,api:o,placeholder:"sk-…"}))}function Bs(e){const{state:n,api:s,t:a,draft:o,setDraft:r}=e,[l,i]=O(!1),d=n.goQuota,u=n.config,c=o?.goQuota?.enabled??u.goQuota?.enabled??!0,f=(m,k)=>{o!==null&&r({...o,goQuota:{...o.goQuota??u.goQuota,[m]:k}})},[p,g,h]=ct(a,()=>s.refreshGoQuota()),b=u.goQuota?.main==="weekly"||u.goQuota?.main==="monthly"?u.goQuota.main:"rolling",x=[b,...["rolling","weekly","monthly"].filter(m=>m!==b)],A=m=>m==="rolling"?"goWindowRolling":m==="weekly"?"goWindowWeekly":"goWindowMonthly",w=m=>m==="rolling"?d.rolling:m==="weekly"?d.weekly:d.monthly,y=c===!1?t("p",{className:"cm-note"},a("goQuotaDisabledNote")):d.status==="ok"?t("div",{className:"cm-go-list"},x.map(m=>hn(a,a(A(m)),w(m),ue(u,"go"),m===b)),t("div",{className:"cm-go-time"},a("goQuotaFetchedAt",{time:d.fetchedAt>0?new Date(d.fetchedAt).toLocaleTimeString():"—"}))):d.status==="error"?t("div",{className:"cm-bal-line err"},d.message||a("unknownError")):d.status==="off"&&d.message?t("p",{className:"cm-note"},d.message):t("div",{className:"cm-bal-line"},a("goQuotaNotQueried"));return t(Pt,{name:a("goQuotaTitle"),enabled:c,saved:u.goQuota,busy:p,open:l,statusNode:y,errorMsg:g,configNode:t(Os,{config:u,draft:o,setDraft:r,t:a,api:s}),onToggleOpen:()=>i(m=>!m),onToggle:m=>f("enabled",m),onRefresh:h,t:a})}const Ds=(e,n)=>{if(typeof e?.keyVar=="string"&&e.keyVar.length>0)return e.keyVar;const a="CLIPROXYAPI_MANAGEMENT_KEY_"+(String(e?.id??"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"GATEWAY");return Object.keys(n??{}).find(o=>o===a||o.startsWith(a+"_"))??a};function Ls(e){const{state:n,api:s,t:a,draft:o,setDraft:r,index:l}=e,i=n.config,u=(o??i).gatewayQuotas?.sources??[],c=u[l]??{},p=(Array.isArray(n.gatewayQuotas)?n.gatewayQuotas:[]).find(C=>C.id===c.id)??{id:c.id,status:"off",accounts:[],unsupportedProviders:[]},g=Ds(c,n.customVarStatus),[h,b]=O(!1),[x,A,w]=ct(a,()=>s.refreshGatewayQuota(c.id)),y=C=>{o!==null&&r({...o,gatewayQuotas:{...o.gatewayQuotas??i.gatewayQuotas??{},sources:C}})},m=C=>y(u.map((q,Q)=>Q===l?{...q,...C}:q)),k=(C,q,Q)=>t("div",{className:"cm-field"},t("label",null,C),t("input",{className:"cm-input","aria-label":C,value:q??"",onChange:Q})),N=(C,q)=>{const Q=Nt(C?.label||C?.id||a("gatewaySourceUnknown"),C,ue(i,"plan"),a);return t(D,{key:C?.id||q},Q.row,C?.resetsAt?t("div",{className:"cm-note"},st(C,a)):null)},P=(C,q)=>t("div",{key:C.id||q,className:"cm-mm-row wide"},t("span",{className:"cm-bbox-label"},C.label||"package"),t("span",{className:"cm-bbox-pct cm-num"},(C.used??"—")+" / "+(C.limit??"—")),t("span",{className:"cm-bbox-pct cm-num"},(C.remaining??"—")+" remaining")),R=C=>C==null?null:t(D,null,t("div",{className:"cm-mm-row wide"},t("span",{className:"cm-bbox-label"},C.unit||"credits"),t("span",{className:"cm-bbox-pct cm-num"},(C.used??"—")+" / "+(C.limit??"—")),t("span",{className:"cm-bbox-pct cm-num"},(C.remaining??"—")+" remaining")),(C.packages??[]).map(P)),I=(C,q)=>t("div",{key:C.id||q,className:"cm-budget",style:{marginTop:"8px",padding:"10px 12px"}},t("div",{className:"cm-budget-head"},t("strong",null,(Ca[C.provider]??C.provider??a("gatewaySourceUnknown"))+" · "+(C.label||a("gatewaySourceUnknown"))),t("span",{className:"cm-hint"},C.status)),C.plan?t("div",{className:"cm-note"},C.plan):null,C.windows.length>0?t("div",{className:"cm-go-list"},C.windows.map(N)):null,R(C.credits),C.message?t("div",{className:"cm-note"},C.message):null);return t(Pt,{name:c.label||c.id||a("gatewayQuotaTitle"),enabled:c.enabled===!0,saved:i.gatewayQuotas?.sources?.find(C=>C.id===c.id),busy:x,open:h,errorMsg:A,statusNode:t("div",{className:"cm-note"},a("gatewaySourceStatus")+": "+(p.status??a("gatewaySourceUnknown"))+(p.serverVersion?" · "+p.serverVersion:"")+(p.fetchedAt>0?" · "+a("gatewaySourceFetchedAt",{time:new Date(p.fetchedAt).toLocaleTimeString()}):"")+(p.message?" · "+p.message:"")),configNode:t(D,null,t("div",{className:"cm-grid"},k(a("gatewaySourceLabel"),c.label,C=>m({label:C.target.value})),k(a("gatewaySourceBaseURL"),c.baseURL,C=>m({baseURL:C.target.value})),t("div",{className:"cm-field"},t("label",null,a("gatewaySourceDisplay")),t("select",{className:"cm-input",value:c.display??"both",onChange:C=>m({display:C.target.value})},...At(a))),t("div",{className:"cm-field"},t("label",null,a("gatewaySourceRefreshInterval")),Ie({value:c.refreshMinutes??15},C=>m({refreshMinutes:Math.min(1440,Math.max(1,Math.floor(C)))}))),k(a("gatewaySourceAllowlist"),(c.allowedHosts??[]).join(", "),C=>m({allowedHosts:C.target.value.split(/[\s,;]+/).filter(Boolean)})),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:c.allowInsecureHttp===!0,onChange:C=>m({allowInsecureHttp:C.target.checked})}),t("span",null,a("customBalanceHttp"))),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:c.antigravityOnlyGemini===!0,onChange:C=>m({antigravityOnlyGemini:C.target.checked})}),t("span",null,a("gatewayOnlyGemini")))),g?t("div",{className:"cm-field"},t("label",null,a("gatewaySourceCredential")),t(Le,{target:"customVar:"+g,configured:n.customVarStatus?.[g]?.configured===!0,source:n.customVarStatus?.[g]?.source??"",t:a,api:s,placeholder:g})):null,p.unsupportedProviders.length>0?t("div",{className:"cm-note"},a("gatewaySourceUnsupported")+": "+p.unsupportedProviders.join(", ")):null,p.accounts.length>0?p.accounts.map(I):t("div",{className:"cm-bal-line"},a("gatewaySourceNoAccounts"))),onToggle:C=>m({enabled:C}),onRefresh:w,onRemove:()=>y(u.filter((C,q)=>q!==l)),onToggleOpen:()=>b(C=>!C),t:a})}const qe=[{id:"opendesign",labelKey:"codingPlanOpendesign"},{id:"anthropic",labelKey:"codingPlanAnthropic"},{id:"zai",labelKey:"codingPlanZai"},{id:"minimax",labelKey:"codingPlanMinimax"},{id:"kimi",labelKey:"codingPlanKimi"},{id:"openrouter",labelKey:"codingPlanOpenrouter"},{id:"siliconflow",labelKey:"codingPlanSiliconflow"},{id:"commandcode",labelKey:"codingPlanCommandcode"},{id:"scnet",labelKey:"codingPlanScnet"},{id:"volcengine",labelKey:"codingPlanVolcengine"},{id:"qwen",labelKey:"codingPlanQwen"},{id:"mimo",labelKey:"codingPlanMimo"},{id:"factory",labelKey:"codingPlanFactory"}];function Es(e){const{state:n,api:s,t:a,draft:o,setDraft:r,planId:l,labelKey:i}=e,d=n.config,u=n.codingPlans??{},c=o?.codingPlans?.[l]??d.codingPlans?.[l]??{},f=u[l]??{status:"off",message:"",fetchedAt:0,windows:{}},p=c.enabled===!0,[g,h]=O(e.targeted===!0),b=l==="qwen"&&d.codingPlans?.qwen?.quotaSource==="bailian"&&c.quotaSource==="bailian"&&f.quotaSource==="bailian"&&f.loginRequired===!0,[x,A,w]=ct(a,()=>b?s.loginCodingPlan(l):s.refreshCodingPlan(l)),y=(v,j)=>{if(o===null)return;const ie=o.codingPlans??d.codingPlans??{};r({...o,codingPlans:{...ie,[l]:{...ie[l]??{},[v]:j}}})},[m,k]=O(""),[N,P]=O({}),R=v=>v?.rates!==null&&typeof v?.rates=="object"&&!Array.isArray(v.rates)?v.rates:{},I=["input","cachedInput","output"],C=v=>N[v]??R(c)[v]??{},q=v=>I.every(j=>Number.isFinite(Number(v[j]))&&Number(v[j])>0),Q=(v,j,ie)=>{if(o===null)return;const ge={...C(v),[j]:String(ie)};P(ae=>({...ae,[v]:ge}));const B=I.every(ae=>String(ge[ae]??"").trim()==="");if(!B&&!q(ge))return;const J=o.codingPlans??d.codingPlans??{},Z={...(J.qwen??{}).rates??{}};B?delete Z[v]:Z[v]=Object.fromEntries(I.map(ae=>[ae,Number(ge[ae])])),r({...o,codingPlans:{...J,qwen:{...J.qwen??{},rates:Z}}})},oe=v=>{o!==null&&P(j=>({...j,[v]:j[v]??R(c)[v]??{}}))},ee=v=>{if(o===null)return;P(ge=>{const B={...ge};return delete B[v],B});const j=o.codingPlans??d.codingPlans??{},ie={...(j.qwen??{}).rates??{}};delete ie[v],r({...o,codingPlans:{...j,qwen:{...j.qwen??{},rates:ie}}})},W=f.windows!==null&&typeof f.windows=="object"?f.windows:{},V=p===!1?t("p",{className:"cm-note"},a("codingPlanDisabledNote")):f.status==="ok"?t("div",{className:"cm-go-list"},f.message?t("p",{className:"cm-note"},f.message):null,Object.keys(W).length>0?l==="minimax"&&(Fe(W).five!=null||Fe(W).seven!=null)?t(Jt,{five:Fe(W).five,seven:Fe(W).seven,fetchedAt:f.fetchedAt,t:a,wide:!0,direction:ue(d,"plan")}):Object.entries(W).map(([v,j])=>hn(a,lt(v,a),j,ue(d,"plan"),!1,v)):t("div",{className:"cm-bal-line"},a("codingPlanNotQueried")),t("div",{className:"cm-go-time"},a("goQuotaFetchedAt",{time:f.fetchedAt>0?new Date(f.fetchedAt).toLocaleTimeString():"—"}))):f.status==="error"?t("div",{className:"cm-bal-line err"},f.message||a("unknownError")):f.status==="off"&&f.message?t("p",{className:"cm-note"},f.message):t("div",{className:"cm-bal-line"},a("codingPlanNotQueried")),M=t(D,null,l==="opendesign"?t("div",{className:"cm-field"},t("label",null,a("opendesignWorkspace")),t("input",{className:"cm-input","aria-label":a("opendesignWorkspace"),value:c.workspaceId??"",onChange:v=>y("workspaceId",v.target.value)}),t("p",{className:"cm-note"},a("opendesignNote"))):null,l==="factory"?t(D,null,t("div",{className:"cm-field"},t("label",null,a("factoryPool")),t("select",{className:"cm-input","aria-label":a("factoryPool"),value:c.factoryPool??"standard",onChange:v=>y("factoryPool",v.target.value)},t("option",{value:"standard"},"Standard"),t("option",{value:"core"},"Droid Core"),t("option",{value:"both"},a("factoryPoolBoth")))),t("div",{className:"cm-field"},t("label",null,a("factoryOrg")),t("input",{className:"cm-input","aria-label":a("factoryOrg"),value:c.orgId??"",onChange:v=>y("orgId",v.target.value)}))):null,l==="minimax"?t("div",{className:"cm-field"},t("label",null,a("minimaxOrigin")),t("input",{className:"cm-input",type:"url",value:c.baseUrl??"",placeholder:"https://www.minimax.cn","aria-label":a("minimaxOrigin"),onChange:v=>y("baseUrl",v.target.value)}),t("p",{className:"cm-note"},a("minimaxOriginNote"))):null,l==="qwen"?t("div",{className:"cm-field"},t("label",null,a("qwenSource")),t("select",{className:"cm-input",value:c.quotaSource??"local",onChange:v=>y("quotaSource",v.target.value)},t("option",{value:"local"},a("qwenSourceLocal")),t("option",{value:"cli"},a("qwenSourceCli")),t("option",{value:"bailian"},a("qwenSourceBailian"))),t("p",{className:"cm-note"},a(c.quotaSource==="bailian"?"qwenBailianNote":"qwenCliNote"))):null,t("div",{className:"cm-field"},t("label",null,a("codingPlanDisplayLabel")),t("select",{className:"cm-input",value:typeof c.display=="string"?c.display:l==="minimax"?"both":"settings",onChange:v=>y("display",v.target.value)},t("option",{value:"sidebar"},a("balanceSidebar")),t("option",{value:"settings"},a("balanceSettings")),t("option",{value:"both"},a("balanceBoth")),t("option",{value:"off"},a("off"))),t("span",{className:"cm-hint"},a("codingPlanDisplayNote"))),l!=="scnet"&&(l!=="qwen"||(c.quotaSource??"local")!=="local")?t("div",{className:"cm-field"},t("label",null,a("codingPlanRefreshIntervalLabel")),Ie({value:typeof c.refreshMinutes=="number"&&Number.isFinite(c.refreshMinutes)&&c.refreshMinutes>0?c.refreshMinutes:15},v=>{y("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(v))))})):null,l==="scnet"||l==="qwen"&&(c.quotaSource??"local")==="local"?t(D,null,t("div",{className:"cm-field"},t("label",null,a(l==="qwen"?"qwenPlanCreditsLabel":"scnetPlanCreditsLabel")),t("input",{className:"cm-input",type:"number",min:"1",step:"1000",value:typeof c.planCredits=="number"&&Number.isFinite(c.planCredits)&&c.planCredits>0?c.planCredits:l==="qwen"?5e5:24e4,onChange:v=>{const j=Number(v.target.value);Number.isFinite(j)&&j>0&&y("planCredits",Math.floor(j))}})),t("div",{className:"cm-field"},t("label",null,a(l==="qwen"?"qwenPlanStartLabel":"scnetPlanStartLabel")),t("input",{className:"cm-input",type:"date",value:typeof c.planStart=="string"?c.planStart:"",onChange:v=>y("planStart",v.target.value)})),l==="qwen"?t(D,null,t("div",{className:"cm-field"},t("label",null,a("qwenRatesLabel"))),[...new Set([...Object.keys(R(c)),...Object.keys(N)])].sort().map(v=>t("div",{key:v,className:"cm-match-row"},t("span",{style:{minWidth:"120px"}},v),I.map(j=>t("input",{key:j,className:"cm-input narrow",type:"number",min:"0",step:"0.1",value:C(v)[j]??"",placeholder:a("qwenRate_"+j),"aria-label":v+" · "+a("qwenRate_"+j),onChange:ie=>{const ge=ie.target.value;Q(v,j,ge)}})),t("button",{className:"cm-btn small",onClick:()=>ee(v)},a("overrideRemove")),v in N&&!q(C(v))?t("span",{className:"cm-note"},a("qwenRateDraftNote")):null)),t("div",{className:"cm-buttons"},t("input",{className:"cm-input narrow",type:"text",placeholder:a("qwenRatesModelPlaceholder"),value:m,onChange:v=>k(v.target.value)}),t("button",{className:"cm-btn small",onClick:()=>{const v=m.trim();v.length!==0&&(oe(v),k(""))},disabled:m.trim().length===0},a("qwenRatesAdd")))):null,t("p",{className:"cm-note"},a(l==="qwen"?"qwenLocalNote":"scnetLocalNote"))):l==="qwen"?null:l==="volcengine"?t(D,null,t("div",{className:"cm-field"},t("label",null,a("volcengineAccessKeyIdLabel"))),t(Le,{target:"codingPlans.volcengine.ak",configured:f.keyConfigured===!0,source:f.keySource,t:a,api:s,placeholder:a("volcengineAccessKeyPlaceholder")}),t("div",{className:"cm-field"},t("label",null,a("volcengineSecretAccessKeyLabel"))),t(Le,{target:"codingPlans.volcengine.sk",configured:f.keyConfigured===!0,source:f.keySource,t:a,api:s,placeholder:a("volcengineSecretPlaceholder")}),t("p",{className:"cm-note"},a("volcengineNote"))):t(D,null,t("div",{className:"cm-field"},t("label",null,l==="mimo"?"Cookie (platform.xiaomimimo.com)":l==="factory"?"Factory Token":l==="opendesign"?"OpenDesign Control Key":a("codingPlanKeyLabel"))),t(Le,{target:"codingPlans."+l,configured:f.keyConfigured===!0,source:f.keySource,t:a,api:s,placeholder:l==="mimo"?"api-platform_serviceToken=…; userId=…":l==="factory"?"FACTORY_API_KEY":l==="opendesign"?"OPENDESIGN_CONTROL_KEY":"sk-…"})));return t(Pt,{planId:l,targeted:e.targeted,name:a(i),enabled:p,saved:d.codingPlans?.[l],busy:x,open:g,errorMsg:A,statusNode:V,configNode:M,onToggle:v=>y("enabled",v),onRefresh:w,onLogin:w,loginRequired:b,onToggleOpen:()=>h(v=>!v),t:a})}function Is(e){const{state:n,api:s,t:a,draft:o,setDraft:r}=e,l=n.config,i=o??l,d=i.codingPlans??{},u=i.gatewayQuotas?.sources??[],c=o?.customBalances??l.customBalances??[],f=y=>{o!==null&&r({...o,customBalances:y,...y.length===0?{customBalance:{...l.customBalance??{},enabled:!1,request:{url:"",headers:{}}}}:{}})},p=he({next:0,keys:[]}).current;for(;p.keys.length<c.length;)p.keys.push(p.next++);p.keys.length=c.length;const g=y=>{p.keys.splice(y,1),f(c.filter((m,k)=>k!==y))},h=(y,m)=>f(c.map((k,N)=>N===y?{...k,...m}:k)),b=(y="custom")=>{if(!(c.length>=8)){if(y==="workbuddy2api"){f([...c,{enabled:!1,label:"WorkBuddy2API 积分",labelEn:"WorkBuddy2API credits",display:"both",unit:"CREDITS",refreshMinutes:15,request:{url:"http://127.0.0.1:8790/api/credits/expiry?package_limit=1",method:"GET",headers:{"X-Admin-Token":"{{WORKBUDDY2API_ADMIN_TOKEN}}"}},extract:{remaining:"summary.available_remaining"},allowedHosts:["127.0.0.1:8790"],allowInsecureHttp:!1}]);return}f([...c,{...y!=="custom"?{adapter:y}:{},enabled:!1,label:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"千问 / 阿里云":"",labelEn:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"Qianwen / Alibaba Cloud":"",display:"both",unit:y!=="custom"?"CNY":"USD",refreshMinutes:15,request:{url:y==="tokenrhythm"?"https://tokenrhythm.studio/api/wallet/summary":y==="aliyun"?"https://business.aliyuncs.com/":"",method:y==="aliyun"?"POST":"GET",headers:{}},extract:{},allowedHosts:[]}])}},x=()=>{u.length>=4||o===null||r({...o,gatewayQuotas:{...o.gatewayQuotas??l.gatewayQuotas??{},sources:[...u,{id:"gateway-"+Date.now().toString(36),type:"cliproxyapi",label:"CLIProxyAPI",baseURL:"http://127.0.0.1:8317",enabled:!1,display:"both",refreshMinutes:15,includeProviders:Et,allowedHosts:[],allowInsecureHttp:!1}]}})},A=[...u.map((y,m)=>({kind:"gateway",key:"gw-"+(y.id??m),index:m,enabled:y.enabled===!0})),{kind:"go",key:"go",enabled:i.goQuota?.enabled!==!1},...qe.map(y=>({kind:"plan",key:"plan-"+y.id,planId:y.id,labelKey:y.labelKey,enabled:d[y.id]?.enabled===!0})),...c.map((y,m)=>({kind:"custom",key:"cb-"+p.keys[m],index:m,enabled:y.enabled===!0}))],w=y=>y.kind==="plan"?t(Es,{key:y.key,planId:y.planId,labelKey:y.labelKey,targeted:y.planId===e.targetPlan,state:n,api:s,t:a,draft:o,setDraft:r}):y.kind==="go"?t(Bs,{key:y.key,state:n,api:s,t:a,draft:o,setDraft:r}):y.kind==="gateway"?t(Ls,{key:y.key,index:y.index,state:n,api:s,t:a,draft:o,setDraft:r}):t(Rs,{key:y.key,state:n,api:s,t:a,entry:c[y.index],index:y.index,canRemove:!0,onPatch:m=>h(y.index,m),onRemove:()=>g(y.index)});return t("div",null,t("p",{className:"cm-note"},a("quotaSectionNote")),t("div",{className:"cm-quota-list"},Ts(A).map(w)),t("div",{className:"cm-buttons"},t("button",{className:"cm-btn small",onClick:x,disabled:u.length>=4},a("gatewaySourceAdd")),t("button",{className:"cm-btn small",onClick:()=>b(),disabled:c.length>=8},a("customBalanceAdd")),t("button",{className:"cm-btn small",onClick:()=>b("aliyun"),disabled:c.length>=8},a("aliyunBalanceAdd")),t("button",{className:"cm-btn small",onClick:()=>b("tokenrhythm"),disabled:c.length>=8},a("tokenRhythmBalanceAdd")),t("button",{className:"cm-btn small",onClick:()=>b("workbuddy2api"),disabled:c.length>=8},a("workBuddyBalanceAdd")),t("p",{className:"cm-note"},a("workBuddyBalanceNote"))))}const qs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yn=e=>(e.input??0)+(e.output??0)+(e.cacheRead??0)+(e.cacheWrite??0);function ma(e){const n=e.useCost?e.useCost(m=>m):void 0,s=e.state??n?.state;if(!s)return null;const a=s.config,o=H(a),r=e.t??G(o),l=Array.isArray(s.history)?s.history:[];if(l.length===0)return t("div",null,t("h3",{className:"cm-h"},r("usageTitle")),t("p",{className:"cm-empty"},r("usageEmpty")));const i=s.meta?.dayKey??"",d=new Map(l.map(m=>[m.date,m])),u=m=>{const k=N=>String(N).padStart(2,"0");return m.getFullYear()+"-"+k(m.getMonth()+1)+"-"+k(m.getDate())},c=new Date;c.setHours(0,0,0,0);const f=new Date(c);f.setDate(f.getDate()+(6-(c.getDay()+6)%7));const p=26,g=[],h=[];let b=-1;for(let m=p-1;m>=0;m-=1){for(let N=0;N<7;N+=1){const P=new Date(f);P.setDate(P.getDate()-(m*7+(6-N)));const R=d.get(u(P));g.push(R!==void 0?{day:R,tokens:yn(R)}:{day:{date:u(P)},tokens:0})}const k=new Date(f);k.setDate(k.getDate()-(m*7+6)),h.push(k.getMonth()!==b?o==="en"?qs[k.getMonth()]:String(k.getMonth()+1)+"月":""),b=k.getMonth()}const x=Math.max(...g.map(m=>m.tokens),1),A=m=>{const k=m/x;return k<.25?1:k<.5?2:k<.75?3:4},w=m=>{const{day:k,tokens:N}=m,P="cm-ug-cell"+(N>0?" l"+A(N):"")+(k.date===i?" today":""),R=r("usageDay",{date:k.date,tokens:L(N),input:L(k.input??0),cache:L((k.cacheRead??0)+(k.cacheWrite??0)),output:L(k.output??0),calls:k.calls??0,cost:z(U(k,a),a)});return t($,{key:k.date,label:R,side:"top",delayMs:200},t("div",{className:P}))},y=s.total;return t("div",{className:"cm-ug"},t("h3",{className:"cm-h"},r("usageTitle")),t("div",{className:"cm-ug-total"},r("usageTotal",{tokens:L(yn(y)),input:L(y.input??0),cache:L((y.cacheRead??0)+(y.cacheWrite??0)),output:L(y.output??0),calls:y.calls??0})),t("div",{className:"cm-ug-grid",style:{gridTemplateColumns:"repeat("+p+",1fr)"}},g.map(w)),t("div",{className:"cm-ug-months",style:{gridTemplateColumns:"repeat("+p+",1fr)"}},h.map((m,k)=>t("span",{key:"m"+String(k),className:"cm-ug-monthc"},m))))}function kn(e){return e.ready?t(ve,{...e,load:e.api.loadCodex,quiet:e.view==="prompt"}):null}function js(e){const n=e.useCost?.(a=>a),s=n?.state;return t(kn,{...e,state:s,view:"prompt",ready:s?.codexCompat?.enabled===!0&&s?.codexCompat?.promptDue,locale:n?.locale})}function Hs(e){const n=e.useCost?e.useCost(T=>T):void 0,s=e.api,a=n?.state??null,[o,r]=O(null),[l,i]=O(null),[d,u]=O(!1),[c,f]=O(!1),[p,g]=O(!1),[h,b]=O(!1),[x,A]=O("models"),[w,y]=O("overview"),m=a?.codexCompat?.installed===!0&&a?.codexCompat?.enabled===!0,k=w==="codex"&&!m?"overview":w;Y(()=>{m||y(T=>T==="codex"?"overview":T)},[m]);const[N,P]=O(null),[R,I]=O({status:"idle",at:0,error:null}),C=Te.useRef(null),q=Te.useRef(null),Q=Te.useRef(null),oe=Te.useRef(Promise.resolve()),ee=Te.useRef(0),W=Te.useRef(null);Y(()=>()=>{W.current?.()},[]),Y(()=>{if(a!==null){const T=JSON.stringify(a.config);r(_=>{const pe=_!==null&&JSON.stringify(_)!==C.current;return pe||(q.current=a.config,Q.current=a.config),pe?{..._,activeLocale:a.config.activeLocale}:JSON.parse(T)}),C.current=T}},[a]),Y(()=>{o!==null&&Q.current===null&&q.current!==null&&(Q.current=q.current)},[o]),Y(()=>{const T=++ee.current;if(o===null||s===void 0)return;const _=JSON.stringify(o);if(_===C.current){W.current=null;return}I(de=>de.status==="saving"?de:{...de,status:"saving"});const pe=()=>{oe.current=oe.current.catch(()=>{}).then(async()=>{if(T!==ee.current)return;const de={},fe=Q.current??q.current;if(fe!==null&&typeof fe=="object")for(const se of Object.keys(o))se==="activeLocale"||o[se]===fe[se]||JSON.stringify(o[se])!==JSON.stringify(fe[se])&&(de[se]=o[se]);if(Object.keys(de).length===0){C.current=_,I({status:"saved",at:Date.now(),error:null});return}try{await s.updateConfig(de),C.current=_,fe!==null&&typeof fe=="object"&&(Q.current={...fe,...de}),T===ee.current&&I({status:"saved",at:Date.now(),error:null})}catch(se){T===ee.current&&I({status:"error",at:0,error:se?.message??String(se)})}})};W.current=pe;const ke=setTimeout(pe,120);return()=>{clearTimeout(ke)}},[o,s]),Y(()=>{a!==null&&n?.status==="error"&&n.error&&i({kind:"err",text:M("ledgerReadFailed",{message:n.error})})},[n?.status,n?.error]);const V=H({...o??a?.config,activeLocale:n?.locale}),M=G(V);if(n===void 0||a===null)return t("div",{className:"cm-section"},t("p",{className:"cm-empty"},n?.status==="loading"?M("readingLedger"):M("ledgerUnavailable")),n?.error&&t("p",{className:"cm-err",role:"alert"},M("ledgerReadFailed",{message:n.error})),t("button",{className:"cm-btn",disabled:n?.status==="loading"||!s?.reload,onClick:s?.reload},M("refresh")));const v=a.config,j=async()=>{if(!h){b(!0),i(null);try{const T=await s.fetchPrices();if(i({kind:T.ok?"ok":"err",text:T.message}),T.ok&&T.state&&typeof T.state.config=="object"){const _=JSON.stringify(T.state.config);r(JSON.parse(_)),C.current=_}}catch(T){i({kind:"err",text:M("syncFailed",{message:T?.message??String(T)})})}finally{b(!1),u(!1)}}},ie=async()=>{if(!h){b(!0);try{await s.resetHistory(),i({kind:"ok",text:M("historyCleared")})}catch(T){i({kind:"err",text:M("clearFailed",{message:T?.message??String(T)})})}finally{b(!1),f(!1)}}},ge=async()=>{if(!h){b(!0),i(null);try{const T=await s.importLegacyHistory();i({kind:"ok",text:T.message})}catch(T){i({kind:"err",text:M("legacyImportFailed",{message:T?.message??String(T)})})}finally{b(!1),g(!1)}}},B=(T,_)=>{o!==null&&r({...o,[T]:_})},J=[["overview",M("tabOverview")],["statistics",V==="en"?"Cost statistics":"计费统计"],["quotas",M("tabQuotas")],["usage",M("tabUsage")],["pricing",M("tabPricing")],...m?[["codex","Codex"]]:[],["display",M("tabDisplay")]],Z=T=>la({statistics:s.loadStatistics,pricing:s.loadOpenRouter,codex:s.loadCodex}[T],{state:a}),ae=R.status==="saving"?t("span",{className:"cm-hint"},M("saving")):R.status==="error"?t("span",{className:"cm-msg err"},M("autoSaveFailed",{message:R.error??""})):t("span",{className:"cm-hint"},R.status==="saved"?M("autoSavedAt",{time:new Date(R.at).toLocaleTimeString()}):M("autoSaveHint"));return t("div",{className:"cm-section"},t("div",{className:"cm-tabs-row"},t("div",{className:"cm-tabs",role:"tablist"},J.map(([T,_])=>t("button",{key:T,type:"button",role:"tab","aria-selected":String(k===T),className:"cm-tab"+(k===T?" active":""),onMouseEnter:()=>Z(T),onFocus:()=>Z(T),onClick:()=>y(T)},_))),ae),t(ve,{state:a,api:s,load:s.loadCommunity,locale:V,quiet:!0}),da(l),k==="statistics"?t(ve,{state:a,api:s}):null,k==="overview"?t(D,{key:"overview"},t("div",{className:"cm-overview-grid"},t("div",{className:"cm-cards",style:{"--cm-overview-count":v.hideTodayCost===!0?2:3}},v.hideTodayCost===!0?null:t(St,{title:M("cardToday"),value:z(U(a.today,v),v),sub:M("callsTokens",{calls:a.today.calls,input:L(a.today.input),cache:L(a.today.cacheRead+a.today.cacheWrite),output:L(a.today.output)})}),t(St,{title:M("cardMonth"),value:z(U(a.month,v),v),sub:M("callsTokens",{calls:a.month.calls,input:L(a.month.input),cache:L(a.month.cacheRead+a.month.cacheWrite),output:L(a.month.output)})}),t(St,{title:M("cardTotal"),value:z(U(a.total,v),v),sub:M("cardTotalSub",{calls:a.total.calls})}))),t(ps,{state:a,t:M}),t("p",{className:"cm-note",key:"cards-footnote"},M("cardsFootnote")),(()=>{const T=bo(a);return T!==null?t("p",{className:"cm-note",key:"tz-hint"},M("timezoneHint",{host:T.hostLabel,browser:T.browserLabel})):null})(),t("label",{className:"cm-cards-toggle",title:M("cardsTogglePlanTotalHint")},t("input",{type:"checkbox",checked:(o??v).showTotalWithPlan===!0,onChange:T=>{const _=o??v;_!=null&&r({..._,showTotalWithPlan:T.target.checked})}}),t("span",null,M("cardsTogglePlanTotal"))),t("div",null,t("h3",{className:"cm-h"},M("todaySessions")),t(hs,{state:a,t:M})),t(ks,{state:a,draft:o,setDraft:r,t:M}),(v.balance?.display==="settings"||v.balance?.display==="both")&&v.hideOfficialBalance!==!0?t(Ms,{state:a,api:s,t:M,draft:o,setDraft:r}):null):null,k==="quotas"?t(Is,{key:"quotas",state:a,api:s,t:M,draft:o,setDraft:r,targetPlan:N}):null,k==="usage"?t(D,{key:"usage"},!mt||(v.usage?.position??"cost")==="cost"?t(ma,{state:a,t:M,locale:V}):null,t(vs,{state:a,config:o??v,t:M,draft:o,setDraft:r}),t(As,{state:a,config:o??v,t:M}),t(fs,{state:a,api:s}),t(gs,{state:a,api:s}),t("div",null,t("h3",{className:"cm-h"},M("historyDataTitle")),t("div",{className:"cm-buttons"},p?t(D,null,t("span",{className:"cm-hint"},M("confirmImportLegacy")),t("button",{className:"cm-btn",onClick:ge,disabled:h},M("apply")),t("button",{className:"cm-btn",onClick:()=>g(!1)},M("cancel"))):t("button",{className:"cm-btn",onClick:()=>g(!0),disabled:h},M("importLegacy")),c?t(D,null,t("span",{className:"cm-hint"},M("confirmReset")),t("button",{className:"cm-btn danger",onClick:ie,disabled:h},M("confirmClear")),t("button",{className:"cm-btn",onClick:()=>f(!1)},M("cancel"))):t("button",{className:"cm-btn danger",onClick:()=>f(!0),disabled:h},M("clearAllHistory"))),t("p",{className:"cm-note"},M("legacyImportNote")))):null,k==="codex"?t(kn,{key:"codex",state:a,api:s,t:M,locale:V,view:"panel",ready:m}):null,k==="display"?t(D,{key:"display"},a?.secretMigration?.pending?.length>0?t(ho,{pending:a.secretMigration.pending,t:M}):null,t(ve,{state:{...a,displayPreviewCodex:K.source===(a.config.codexQuotaSource??"auto")?Xt():{status:"idle",windows:{}}},api:s,load:s.loadDisplay,draft:o,setDraft:r,t:M,locale:V,numInput:Ie,displayOptions:At,CURRENCY_PRESETS:ys,USAGE_POSITION_SWITCHABLE:mt,formatMoneyUsd:z,planOptions:qe.map(T=>[T.id,M(T.labelKey)]),onNavigate:(T,_)=>{P(_),y(T)},renderSidebar:(T,_=a)=>na({..._,config:T},!0,void 0,!0),renderStyleSample:(T,_=a,pe=!0)=>{if(!pe)return na({..._,config:T},!0,void 0,!0);const ke=T.sidebarSimple===!0,de={...T,peakNotice:!1,hideBudget:!1,hideTodayCost:!1,budget:{...T.budget,enabled:!0,amount:Number(T.budget?.amount)>0?T.budget.amount:100}},fe={..._,config:de},se=Fe(_.codingPlans?.minimax?.windows??{});return t("div",{className:"cm-footer-stack"+(ke?" simple":T.sidebarStyle==="compact"?" compact":"")},t(aa,{state:fe,wide:!0,summary:ke}),t(Jt,{five:se.five??{percent:24},seven:se.seven??{percent:18},fetchedAt:0,t:M,wide:!0,direction:ue(T,"plan")}))},renderModelsSettings:T=>t(cs,{draft:o,setDraft:r,t:M,...T})})):null,k==="pricing"?t("div",{key:"pricing",className:"cm-pricing-page"},t("div",{className:"cm-pricing-heading"},t("div",null,t("h3",{className:"cm-h"},V==="en"?"Pricing":"价格设置"),t("p",{className:"cm-note"},V==="en"?"New prices apply to future calls. Historical costs keep their original rates.":"价格修改用于后续调用,历史费用沿用原价格。")),t("span",{className:"cm-pricing-unit"},V==="en"?"Per 1M tokens":"每百万 Token")),t("div",{className:"cm-pricing-nav",role:"tablist","aria-label":V==="en"?"Pricing sections":"价格分区"},[["models","模型定价","Model pricing"],["catalog","参考价格表","Price tables"],["tools","同步与规则","Sync & rules"]].map(([T,_,pe])=>t("button",{key:T,id:"cm-pricing-"+T,type:"button",role:"tab","aria-selected":x===T,"aria-controls":"cm-pricing-panel",tabIndex:x===T?0:-1,className:"cm-pricing-nav-item"+(x===T?" active":""),onClick:()=>A(T),onKeyDown:ke=>{const de=["models","catalog","tools"],fe=ke.key==="ArrowRight"?1:ke.key==="ArrowLeft"?-1:0;if(fe){ke.preventDefault();const se=de[(de.indexOf(T)+fe+3)%3];A(se),ke.currentTarget.parentElement.querySelector("#cm-pricing-"+se)?.focus()}}},V==="en"?pe:_))),t("div",{id:"cm-pricing-panel",className:"cm-pricing-content",role:"tabpanel","aria-labelledby":"cm-pricing-"+x},x==="models"?t(ve,{state:a,api:s,load:s.loadPricing,mode:"matching",draft:o,setDraft:r,t:M,locale:V,resolveClientPrice:Ia,prettyProviderKey:fn,setField:B,priceEditor:{PriceInput:mn,priceFactor:bt,setPriceFactor:Ct,multiplierOptions:ca,priceMultiplierSettings:ft,priceAt:Je}}):null,x==="catalog"?t("div",{className:"cm-pricing-catalog"},t("h3",{className:"cm-h"},M("priceTableTitle")),t(ve,{state:a,api:s,load:s.loadPricing,mode:"catalog",draft:o,setDraft:r,t:M,locale:V,vendorLabels:Ns,priceEditor:{priceAt:Je,priceFactor:bt},renderEditor:(T,_,pe)=>T==="deepseek"?t(ws,{modelId:_==="__default__"?M("defaultModelId"):_,entry:pe,isDefault:_==="__default__",draft:o,setDraft:r,t:M}):t(Ps,{provider:T,modelId:_,entry:pe,draft:o,setDraft:r,t:M,api:s,lockedIds:T==="openrouter"?a.priceLockIds??[]:[],releaseDisabled:JSON.stringify(o)!==C.current})})):null,x==="tools"?t("div",{className:"cm-pricing-tools"},t("section",{className:"cm-pricing-tool"},t(xs,{state:a,draft:o,setDraft:r,t:M})),t("section",{className:"cm-pricing-tool"},t(ve,{state:a,api:s,load:s.loadPricing,mode:"history",locale:V,disabled:h||JSON.stringify(o)!==C.current})),t("section",{className:"cm-pricing-tool"},t("h3",{className:"cm-h"},M("dataSync")),(o??v).currency==="CNY"&&(o??v).prices?.currency!=="CNY"?t("div",{className:"cm-note",role:"status"},M("pricingCnyHint",{rate:(o??v).exchangeRate}),(o??v).pricingCurrency!=="CNY"?t("button",{className:"cm-btn small",disabled:h,onClick:()=>B("pricingCurrency","CNY")},M("pricingCurrencyCny")):null):null,t("div",{className:"cm-field"},t("label",null,M("pricingCurrencyLabel")),t("select",{className:"cm-input",value:o?.pricingCurrency==="CNY"?"CNY":"USD",onChange:T=>B("pricingCurrency",T.target.value)},t("option",{value:"USD"},M("pricingCurrencyUsd")),t("option",{value:"CNY"},M("pricingCurrencyCny"))),t("p",{className:"cm-note"},M("pricingCurrencyNote"))),t("div",{className:"cm-buttons"},d?t(D,null,t("span",{className:"cm-hint"},M("confirmFetch")),t("button",{className:"cm-btn",onClick:j,disabled:h},M("apply")),t("button",{className:"cm-btn",onClick:()=>u(!1)},M("cancel"))):t("button",{className:"cm-btn",onClick:()=>u(!0),disabled:h},M("syncFromDocs"))),t("p",{className:"cm-note"},M("lastSync",{time:v.fetchedAt!==null?new Date(v.fetchedAt).toLocaleString():M("neverSynced")})+M("source",{source:v.priceSource==="official"?M("sourceOfficial"):M("sourceBundled")})),t("p",{className:"cm-note"},M("syncScopeNote"))),t("section",{className:"cm-pricing-tool"},t(ve,{state:a,api:s,load:s.loadOpenRouter}))):null)):null,t(ve,{state:a,api:s,load:s.loadCommunity,locale:V,quiet:!0,footer:!0}))}const Qs=["remote"];async function Us(e){const n=e.remote;if(n===void 0||typeof n.$mount!="function")return;const s=await n.$mount(Yn);e.effect(()=>()=>{s()},"cost-meter: remote contribution");const a=e.get("remote.costMeter");if(a===void 0)return;e.inject(["connection"],S=>S.effect(()=>{const E=S.get("connection")?.rpc;return Zt(E),()=>{K.rpc===E&&Zt(null)}},"cost-meter: Codex quota transport"));const o=()=>{try{return Ke(e.get("locale")?.getSnapshot?.().active)}catch{return null}},r=go({status:"loading",error:null,state:null},S=>{const E=o()||Ke(S.state?.meta?.locale)||ya();return{...S,locale:E,...S.state?{state:{...S.state,config:{...S.state.config,activeLocale:E}}}:{}}}),l=()=>G(H(r.getSnapshot().state?.config||{activeLocale:r.getSnapshot().locale})),i=async(S,E)=>{const F=await a[S](...E??[]);if(F===null||typeof F!="object"||F.ok!==!0)throw new Error(F?.error?.message??l()("rpcFailed",{method:S}));return F.value},d=S=>(r.set({status:"ready",error:null,state:S}),S);let u=Date.now(),c=!1,f=!0,p=1,g=0,h=0;const b=(S,E)=>{if(typeof S?.pricesRev!="string"||S.pricesRev!==E?.pricesRev)return S;const F=E?.config?.prices;return F===void 0?S:{...S,config:{...S.config,prices:F}}},x=async()=>{if(!f||c||h)return;const S=g,E=()=>f&&S===g&&h===0;c=!0,u=Date.now();const F=r.getSnapshot();F.state===null&&r.set({...F,status:"loading"});try{const X=F.state?.pricesRev,We=await i(F.state===null?"getLocalState":typeof X=="string"?"getStateSince":"getState",typeof X=="string"?[X]:[]);if(!E())return;if(p=1,r.set({status:"ready",error:null,state:b(We,F.state)}),F.state===null){const je=await i("getState");E()&&r.set({status:"ready",error:null,state:b(je,We)})}}catch(X){if(!E())return;F.state===null&&(u=Date.now()),p=Math.min(p*2,60),r.set({status:"error",error:X?.message??String(X),state:r.getSnapshot().state??F.state})}finally{c=!1}};e.effect(()=>e.on("connection/reset",()=>{x()}),"cost-meter: reconnect reload");const A=setInterval(()=>{const S=r.getSnapshot().state,E=S?.config.sidebarModels,F=S?E?.enabled||E?.dock?E.refreshSeconds:60:p;!document.hidden&&Date.now()-u>=(F||60)*1e3&&x()},1e3);e.effect(()=>()=>{f=!1,clearInterval(A)},"cost-meter: poll timer");const w=()=>{f&&e.fiber?.uid!==null&&r.set(r.getSnapshot())},y=S=>S.effect(()=>{w();const E=S.get("locale")?.subscribe?.(w);return()=>{E?.(),w()}},"cost-meter: DSH locale");typeof e.inject=="function"?e.inject(["locale"],y):o()&&y(e),e.effect(()=>e.on("locale/change",w),"cost-meter: locale change"),window.addEventListener?.("languagechange",w),e.effect(()=>()=>window.removeEventListener?.("languagechange",w),"cost-meter: browser locale");const m=()=>{document.visibilityState==="visible"&&x()};document.addEventListener("visibilitychange",m),e.effect(()=>()=>{document.removeEventListener("visibilitychange",m)},"cost-meter: visibility reload");const k=async(S,E="rpcSyncFailed",F=!1)=>{const X=await S;if(X===null||typeof X!="object"||X.ok!==!0)throw new Error(X?.error?.message??(F?X?.value?.message:void 0)??l()(E));return X.value.state!==void 0&&r.set({status:"ready",error:null,state:X.value.state}),X.value},N={},P=S=>(N[S]||(N[S]=dt.async("./client."+S+".js").then(E=>E.mount(e,r,H)).catch(E=>{throw delete N[S],E})),N[S]),R={loadStatistics:()=>P("statistics"),loadOpenRouter:()=>P("openrouter"),loadCommunity:()=>P("community"),loadPricing:()=>P("pricing"),loadDisplay:()=>P("display"),loadCodex:()=>P("codex"),reload:x,updateConfig:async S=>{const{activeLocale:E,...F}=S;g++,h++;try{const X=await i("updateConfig",[F]);return r.set({status:"ready",error:null,state:X}),S.planBilling&&setTimeout(()=>{x()},1500),X}finally{h--,g++}},fetchPrices:async()=>k(a.fetchPrices()),releasePriceLock:async S=>{const E=await k(a.releasePriceLock(S),"rpcSyncFailed",!0);if(!E.ok)throw new Error(E.message);return E},resetHistory:async()=>{const S=await i("resetHistory");return r.set({status:"ready",error:null,state:S}),S},applyCodexCompatHistory:async()=>d(await i("applyCodexCompatHistory")),dismissCodexCompat:async()=>d(await i("dismissCodexCompat")),importLegacyHistory:async()=>{const S=await a.importLegacyHistory();if(S===null||typeof S!="object"||S.ok!==!0)throw new Error(S?.error?.message??S?.value?.message??l()("legacyImportFailed",{message:"RPC failed"}));return S.value.state!==void 0&&r.set({status:"ready",error:null,state:S.value.state}),S.value},getDaySessions:async S=>i("getDaySessions",[S]),getSessionCost:async S=>i("getSessionCost",[S]),getTurnCost:async(S,E,F)=>i("getTurnCost",[S,E,F,r.getSnapshot().state?.config?.currency]),getTopSessions:async(S,E,F)=>i("getTopSessions",[S,E,F]),refreshBalance:async()=>k(a.refreshBalance(),"rpcBalanceFailed"),refreshGoQuota:async()=>k(a.refreshGoQuota()),refreshGatewayQuota:async(S=null)=>k(S==null?a.refreshGatewayQuota():a.refreshGatewayQuota(S)),refreshCustomBalance:async(S=null)=>k(S==null?a.refreshCustomBalance():a.refreshCustomBalance(S)),refreshCodingPlan:async S=>k(a.refreshCodingPlan(S)),loginCodingPlan:async S=>k(a.loginCodingPlan(S)),setCredential:async(S,E)=>k(a.setCredential(S,E),"rpcSyncFailed",!0),clearCredential:async S=>k(a.clearCredential(S),"rpcSyncFailed",!0)},I=S=>{S.target?.closest?.('[data-slot="conversation.input.model"]')&&R.loadOpenRouter().catch(()=>{})};for(const S of["pointerover","focusin"])e.effect(()=>(document.addEventListener(S,I),()=>document.removeEventListener(S,I)));x();const C=e.get("slots");if(C===void 0)return;const q=S=>{typeof C.entries=="function"&&C.entries(S).some(E=>E.locale==="dsh-context")&&R.loadStatistics().catch(()=>{})};e.on("slots/changed",q),["conversation.view","sidebar.right.pane.tab","conversation.input.overlay"].forEach(q);const Q=()=>({hooks:{cost:r},api:R});for(const[S,E]of[["header","conversation.session.header.actions"],["dock","conversation.composer.dock"]])C.inject(E,()=>C.register({name:E,id:"cost-meter-statistics",order:1,inject:()=>({...Q(),entryPosition:S})},ms));C.inject("conversation.chat.turnTail",()=>C.register({name:"conversation.chat.turnTail",id:"cost-meter-turn",order:10,inject:Q},ko));const oe=()=>({gen:0,dispose:null}),ee=(S,E,F,X,We=!0)=>{S.dispose!==null&&(S.dispose(),S.dispose=null),S.gen+=1;const je=S.gen;We&&C.inject(E,()=>{if(S.gen!==je)return;const Be=typeof F=="function"?F():C.register(F,X);if(S.gen!==je){Be();return}return S.dispose=Be,()=>{S.dispose===Be&&(S.dispose=null),Be()}})},W=oe(),V=S=>{const E=S==="header"?"conversation.session.header.actions":"conversation.composer.dock";ee(W,E,S==="header"?{name:E,id:"cost-meter",order:-5,inject:Q}:{name:E,id:"cost-meter",order:5,inject:Q},S==="header"?xo:wo,S!=="off")},M=oe(),v=S=>{ee(M,"sidebar.footer.action",{name:"sidebar.footer.action",id:"cost-meter",order:0,inject:Q},rs,S)},j=oe(),ie=S=>{ee(j,"conversation.composer.dock",{name:"conversation.composer.dock",id:"cost-meter-corner",order:9,inject:Q},Bo,S)};C.inject("conversation.input.dock",()=>C.register({name:"conversation.input.dock",id:"cost-meter-qstrip",order:5,inject:Q},ts)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-simple-guide",order:1,inject:Q},as)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-billion-compatibility",order:2,inject:Q},us)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-peak-progress-guide",order:1,inject:Q},qo)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-qstrip-guide",order:1,inject:Q},ns)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-balance-click-guide",order:2,inject:Q},ls)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-codex-compat",order:1,inject:Q},js));const ge=oe(),B=S=>{ee(ge,"sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-peak-alert",order:0,inject:Q},Do),null,S)};window.cmPeakAlertPreview=S=>{if(window.__cmPeakAlertLive!==!0){console.warn("[dsh-cost-meter] 弹窗组件未挂载:需启用峰谷计价并重启 dsh web 后再预览。");return}window.dispatchEvent(new CustomEvent(Vt,{detail:{kind:S==="offpeak"?"offpeak":"peak"}}))};const J=oe(),Z=S=>{ee(J,"settings.section",{name:"settings.section",id:"cost-meter",order:30,label:S==="en"?De.en.sectionLabel:De.zh.sectionLabel,inject:Q},Hs,!0)},ae=oe(),T=S=>{ee(ae,"settings.general.item",{name:"settings.general.item",id:"cost-meter-usage",order:30,inject:Q},ma,S)},_=oe(),pe=(S,E)=>{ee(_,"settings.section",{name:"settings.section",id:"cost-meter-usage",order:31,label:E==="en"?De.en.usageSectionLabel:De.zh.usageSectionLabel,inject:Q},ma,S)};let ke=null,de=null,fe=null,se=null,xn=null,wn=null;const Nn=()=>{const S=r.getSnapshot().state,E=S?.config?.position??"dock",F=S?.config?.sidebar!==!1&&S?.config?.hideTodayCost!==!0,X=S?.config?.balance?.display??"both",We=(X==="sidebar"||X==="both")&&S?.config?.hideOfficialBalance!==!0,je=Sn=>Sn?.enabled===!0&&["sidebar","both"].includes(Sn.display),Be=F||We||S?.config?.codexQuotaEnabled===!0||S?.config?.sidebarModels?.enabled===!0||S?.config?.budget?.enabled===!0&&S?.config?.hideBudget!==!0||S?.config?.goQuota?.enabled===!0&&["sidebar","both"].includes(S.config.goQuota.display)||S?.config?.peakEnabled===!0&&S.config.peakNotice!==!1||Object.values(S?.config?.codingPlans??{}).some(je)||(S?.config?.gatewayQuotas?.sources??[]).some(je)||xt(S,S?.config).length>0,pa=S?.config?.corner?.enabled===!0||S?.config?.sidebarModels?.dock===!0,Ge=H(S?.config||{activeLocale:r.getSnapshot().locale}),ut=S?.config?.usage?.position??"cost";E!==ke&&(V(E),ke=E),Be!==de&&(v(Be),de=Be),pa!==fe&&(ie(pa),fe=pa);const fa=S?.config?.peakEnabled===!0;fa!==wn&&(B(fa),wn=fa),Ge!==se&&(Z(Ge),se=Ge),ut!==xn?(mt&&(T(ut==="general"),pe(ut==="section",Ge)),xn=ut):mt&&ut==="section"&&Ge!==se&&pe(!0,Ge)};Nn();const vn=r.subscribe(Nn);return e.effect(()=>()=>{vn()},"cost-meter: slot sync"),vn}return Mt.apply=Us,Mt.inject=Qs,ba.exports}});
|
|
2
|
+
window.__ModuleLoader__.load({id:"dsh-cost-meter",factory:dt=>{var ba={exports:{}},Mt=ba.exports;Object.defineProperty(Mt,Symbol.toStringTag,{value:"Module"});const Te=dt("react"),{Tooltip:$}=dt("@deepseek-ai/dsh-client-ui-primitives"),mt=!1,An="var(--dsw-alias-~.cm-~background:~align-items:center;~font-size:~border-radius:~display:flex;~display:~align-items:~flex-direction:column;~padding:~min-width:~font-weight:~overflow:hidden;~white-space:nowrap;~line-height:~justify-content:~max-width:~text-overflow:ellipsis~gap:~border:~white-space:nowrap~font-variant-numeric:tabular-nums~width:100%;~flex:none;~margin:~cursor:pointer~var(--dsh-frame-top-clearance,0px)~height:100%;~box-sizing:border-box;~position:relative;~flex-wrap:wrap;~box-sizing:border-box~transform:translate(-50%);~grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));~position:absolute;~flex-wrap:wrap~text-align:right;~overflow:hidden~flex-wrap:nowrap;~font:inherit;~overflow-wrap:anywhere~padding-bottom:env(safe-area-inset-bottom)~flex:0 1 auto;~left:50%;~border-right:5px solid transparent;~border-left:5px solid transparent;~transform:translate(-50%,-50%);~-webkit-app-region:no-drag;~grid-template-columns:1fr;~margin-top:4px~overflow:auto;~var(--cm-opaque-base,#fff)~grid-template-columns:1fr~transition:left .4s ease;~flex-shrink:0~transition:top .4s ease;~flex:none~grid-auto-flow:column;~outline:none~border-color:#34a853~height:6px;~height:8px;~pointer-events:auto;~var(--cm-dialog-top)~width:40px;~outline-offset:1px~text-align:center;~width:auto~user-select:none;~grid-column:1/-1~margin-top:6px~height:4px~z-index:2".split("~"),ga='@property --cm-dialog-top{syntax:"<length>";inherits:true;initial-value:0px}Ɓstat-dialog{--cm-dialog-top:var(--dsh-frame-chrome-top,ƛ);inset:ǀ 0 0 0;ƙauto;width:min(1000px,94vw);Ƒcalc(100vw - 32px);max-height:calc(100vh - ǀ - 32px);ƍƝƊ0;ƅ16px;Ɣ1px solid ƀborder-l1);color:ƀlabel-primary);Ƃƀbg-layer-2,ƀbg-base,#fff))}Ɓstat-dialog[open]{Ɔflex-direction:column}Ɓloading{Ɗ24px;min-height:160px;Ƈgrid;Ɠ18px}Ɓloading i{height:18px;ƅ5px;Ƃƀbg-layer-1,#f2f3f5)}Ɓloading i:first-child{width:35%}Ɓloading i:last-child{width:65%}Ɓstat-dialog-head{ƆƃƐspace-between;Ɠ16px;Ɗ16px 24px;border-bottom:1px solid ƀborder-l3);ƹ}Ɓstat-dialog-head strong{Ƅ15px;ƌ500}Ɓstat-dialog-body{Ƴmin-height:0;Ɗ20px 24px;overscroll-behavior:contain}Ɓstat-dialog::backdrop{inset:var(--dsh-frame-chrome-top,ƛ) 0 0;Ƃ#0005}Ɓroot{ƫƋ0;Ƒ100%;ǃƄ12px;Ə20px;color:ƀlabel-tertiary);Ǝƍƒ}Ɓsession-cost{Ƈgrid;grid-template-columns:max-content minmax(0,1fr);Ƌmin-content}Ɓsession-amount{Ƒ40vw;ƍƒ}Ɓsession-detail{Ƌ0;ƍƒ}Ɓchip{Ƈinline-flex;ƃƓ4px;Ƒ180px;Ɗ0 8px;height:22px;ƅ6px;Ƃƀbg-layer-2);Ƅ12px;Ə22px;color:ƀlabel-secondary);Ǝƍƒ}Ɓfoot{ƆƃƓ6px;height:32px;Ɗ0 8px;ƅ8px;Ƅ12px;color:ƀlabel-secondary);ƎƦ}Ɓfoot:hover,Ɓfoot-rail:hover,Ɓcorner-chip:hover,Ɓqchip:hover,Ɓtab:hover,Ɓbtn:hover{Ƃƀinteractive-bg-hover)}Ɓfoot-rail{ƗƐcenter;Ɗ0;Ƅ13px;ƌ600;color:ƀlabel-primary)}Ɓnum{Ɩ}Ɓgo-rail{Ƅ11px;ƌ700;color:ƀlabel-primary)}Ɓgo-list{ƆƉƓ10px}Ɓgo-row{ƆƃƓ8px;Ƅ12px}Ɓgo-label{Ƙwidth:88px;color:ƀlabel-secondary)}Ɓgo-bar{flex:1;ƽƅ3px;Ƃƀinteractive-bg-hover);Ʀ}Ɓgo-fill{Ɯƅ3px;Ƃƀbrand-primary)}Ɓgo-num{ƘƋ44px;ƥƌ600;Ɩ}Ɓgo-reset{ƘƑ230px;Ƅ11px;color:ƀlabel-tertiary);Ǝƍƒ}Ɓgo-time{Ƅ11px;color:ƀlabel-tertiary)}Ɓgo-row.main Ɓgo-label{ƌ600;color:ƀlabel-primary)}Ɓcorner{Ƈinline-flex;ƫƟƐcenter;ƃƓ6px;Ƌ0;Ƒ100%}Ɓcorner-chip{Ƈinline-flex;ƃheight:20px;Ɗ0 8px;ƅ6px;Ƃƀbg-layer-2);Ƅ11px;Ə20px;color:ƀlabel-secondary);ƎƖ}Ɓqstrip{ƆƟƐcenter;ƃƓ6px;ƗƑvar(--dsh-chat-content-width,720px);ƙ0 auto;ƝƊ0 calc(var(--dsh-composer-side-clearance,0px) + 16px)}Ɓqchip{Ƈinline-flex;ƃƓ6px;height:22px;Ɗ0 8px;ƅ6px;Ƃtransparent;Ƅ11px;Ə22px;color:ƀlabel-secondary);ƎƖ;cursor:default}Ɓqchip Ɓqlabel{color:ƀlabel-primary);ƌ600}Ɓqchip Ɓqbar{Ƈblock;width:44px;Lj;ƅ2px;Ƃƀborder-l1);ƍƹ}Ɓqchip Ɓqfill{Ƈblock;Ɯƅ2px;Ƃƀstate-ok-primary,#3ba272)}Ɓqchip Ɓqseg{Ƈinline-flex;ƃƓ4px}Ɓqchip Ɓqsep{width:1px;height:12px;Ƃƀborder-l1);ƹ}Ɓqchip Ɓqtext{color:ƀlabel-secondary)}Ɓqchip.warn Ɓqfill{Ƃƀstate-warn-primary)}Ɓqchip.over Ɓqfill{Ƃƀstate-error-primary)}Ɓqchip.action{ƚ;Džƻ}Ɓqchip.action:focus-visible{box-shadow:0 0 0 2px ƀbrand-primary)}Ɓqchip.action:active{transform:translateY(.5px)}Ɓplan-provider{ƆƉƓ8px}Ɓplan-provider+Ɓplan-provider{margin-top:14px}Ɓplan-provider-name{ƆƃƓ8px;Ƅ13px;ƌ600}Ɓplan-updated{Ƅ11px;ƌ400;color:ƀlabel-tertiary)}Ɓplan-tag{Ƙmargin-left:6px;Ɗ0 6px;ƅ999px;Ɣ1px solid ƀborder-l1);Ƅ10px;Ə16px;color:ƀstate-warn-primary)}Ɓplan-reset,Ɓplan-method{Ƅ11px;color:ƀlabel-tertiary)}Ɓqguide{--cm-guide-top:var(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,ƛ) + 18px));position:fixed;inset:auto;ƙ0;top:max(var(--cm-guide-top),env(safe-area-inset-top,0px));ƿưƬơz-index:9999;Ƒ440px;width:calc(100% - 32px);Ɣ1px solid ƀborder-l1);ƅ12px;Ƃƀbg-layer-2);box-shadow:0 8px 28px #0000002e;Ɗ14px 16px;Ƅ13px;color:ƀlabel-primary);ƆƉƓ8px}Ɓqguide h4{ƙ0;Ƅ13px;ƌ600}Ɓqguide p{ƙ0;Ƅ12px;Ə1.6;color:ƀlabel-secondary)}Ɓqguide Ɓbuttons{ƆƓ8px;Ɛflex-end}Ɓsection{ƆƉƓ20px;Ɗ4px 2px 24px;Ƅ13px;color:ƀlabel-primary)}Ɓcards{Ƈgrid;ƢƓ12px}Ɓoverview-grid{container:cm-overview / inline-size;Ƌ0}Ɓoverview-grid>Ɓcards{grid-template-columns:repeat(var(--cm-overview-count,3),minmax(0,1fr))}Ɓoverview-grid Ɓcard{Ƌ0;ƆƉƓ6px;Ɗ12px 14px}Ɓoverview-grid :is(Ɓcard-title,Ɓcard-sub){ƙ0}Ɓoverview-grid Ɓcard-value{Ə1.35;Ɩ;Ʃ}Ɓoverview-grid Ɓcard-sub{Ə1.5;Ʃ}@container cm-overview (Ƒ460px){Ɓoverview-grid>Ɓcards{Ƶ}}Ɓcards-toggle{ƆƃƓ6px;ƙ-6px 2px 0 auto;width:fit-content;Ƅ12px;color:ƀlabel-tertiary);ƚ;user-select:none}Ɓcards-toggle:hover{color:ƀlabel-primary)}Ɓcards-toggle input{ƙ0;ƚ}Ɓcard,Ɓbudget{Ɣ1px solid ƀborder-l1);ƅ12px;Ɗ14px 16px;Ƃƀbg-layer-1)}Ɓcard-title{Ƅ12px;color:ƀlabel-tertiary);ƙ0 0 8px}Ɓcard-value{Ƅ20px;Ə28px;ƌ600}Ɓcard-sub{Ƅ12px;color:ƀlabel-tertiary);Ʋ}Ɓh{Ƅ13px;ƌ600;ƙ0}Ɓcollapse-h{ƆƃƓ8px;Ƃnone;Ɣnone;Ɗ0;ƙ0;ƚ;color:inherit;ƨtext-align:left}Ɓcollapse-h:hover Ɓh{color:ƀinteractive-text-hover,ƀlabel-primary))}Ɓcaret{Ƙwidth:0;height:0;Ʈƭborder-top:6px solid ƀlabel-secondary);transform:rotate(-90deg);transition:transform .15s ease}Ɓcaret.open{transform:rotate(0)}Ɓcollapse-body{ƆƉƓ12px;margin-top:12px}Ɓtoolbar{ƆƐflex-end;ƃƓ10px}Ɓtoolbar Ɓfield{flex-direction:row;ƃƓ8px}Ɓtoolbar Ɓfield label{ƙ0;Ƅ12px;color:ƀlabel-tertiary)}Ɓtoolbar Ɓinput{Ƌ150px;Ɗ4px 10px}Ɓtabs-row{ƆƃƐspace-between;Ɠ12px;Ɵborder-bottom:1px solid var(--dsh-alias-border-l1);padding-bottom:10px}Ɓtabs{ƆƃƓ4px;Ƥ}Ɓtab{ƨƄ13px;color:ƀlabel-secondary);Ƃtransparent;Ɣnone;ƅ8px;Ɗ6px 14px;ƚ;ƕ}Ɓtab.active{Ƃƀstate-business-primary);color:ƀlabel-primary-inverted);ƌ600}Ɓtabs-row Ɓmsg{Ɗ2px 10px}Ɓtabs-row>Ɓhint,Ɓtabs-row>Ɓmsg{margin-inline-start:auto}Ɓnote{Ƅ12px;color:ƀlabel-tertiary);ƙ0}Ɓtable{Ɨborder-collapse:collapse;Ƅ12px}Ɓtable th,Ɓtable td{text-align:left;Ɗ7px 10px;border-bottom:1px solid ƀborder-l1);ƕ}Ɓtable th{color:ƀlabel-tertiary);ƌ500}Ɓtable td.num,Ɓtable th.num{ƥƖ}Ɓtable tr:last-child td{border-bottom:none}Ɓtable trƁrow-click{ƚ}Ɓtable trƁrow-click:hover td{Ƃƀbg-hover,rgba(127,127,127,.08))}Ɓsess-title{Ƒ260px;ƍƒ;ƕ}Ɓsess-id{Ƅ11px;font-family:ui-monospace,Consolas,monospace;color:ƀlabel-tertiary)}Ɓempty{Ƅ12px;color:ƀlabel-tertiary);Ɗ8px 0}Ɓscroll{max-height:320px;ƳƔ1px solid ƀborder-l1);ƅ10px}Ɓgrid{Ƈgrid;ƢƓ12px}Ɓfield{ƆƉƓ6px;Ƌ0}Ɓfield label{Ƅ12px;color:ƀlabel-secondary)}Ɓinput,Ɓinput option{color:ƀlabel-primary);Ƃƀbg-base)}Ɓinput{ƨƄ13px;Ɣ1px solid ƀborder-l1);ƅ8px;Ɗ6px 10px;ƻ}Ɓinput:focus{border-color:ƀstate-business-primary)}Ɓinput.narrow{Ƒ120px}Ɓrange-row{ƆƃƓ10px}Ɓrange{flex:1;Ƌ0;accent-color:ƀstate-business-primary)}Ɓrange-value{ƘƋ44px;Ƅ12px;color:ƀlabel-tertiary);text-align:right}Ɓcheck{ƆƃƓ8px;Ƅ13px;color:ƀlabel-primary);ƚ}Ɓpricing-page,Ɓpricing-content{Ƈgrid;Ɠ20px;Ƌ0}Ɓpricing-heading{ƆƃƐspace-between;Ɠ12px}Ɓpricing-heading Ɓh{Ƅ16px;margin-bottom:6px}Ɓpricing-heading Ɓnote{Ə1.6}Ɓpricing-unit{Ʒ;color:ƀlabel-tertiary);Ƅ11px}Ɓpricing-nav{ƆƓ4px;Ɗ4px;ƅ10px;Ƃƀbg-layer-1);Ɣ1px solid ƀborder-l1)}Ɓpricing-nav-item{flex:1;Ƌ0;ƨcolor:ƀlabel-secondary);Ƃtransparent;Ɣ0;ƅ7px;Ɗ8px 10px;ƚ}Ɓpricing-nav-item.active{color:ƀstate-business-primary);Ƃƀbg-base);box-shadow:0 1px 3px #0000000d;ƌ600}Ɓpricing-nav-item:focus-visible{outline:2px solid ƀstate-business-primary)}Ɓpricing-tools{Ƈgrid;Ɠ16px}Ɓpricing-tool{ƆƉƓ12px;Ɗ16px;Ɣ1px solid ƀborder-l1);ƅ12px;Ƌ0}Ɓpricing-tool>Ɓpeak-panel{Ɗ0;Ɣ0;Ƃnone}Ɓpricing-tool p{Ə1.65}@media(Ƒ480px){Ɓpricing-heading{ƈflex-start;ƉƓ4px}Ɓpricing-nav-item{Ɗ8px 4px;Ƅ12px}Ɓpricing-tool{Ɗ12px}}Ɓprice-card{Ɣ1px solid ƀborder-l1);ƅ10px;Ɗ12px 14px;ƆƉƓ10px;Ƃƀbg-layer-1)}Ɓprice-head{ƆƃƓ8px;Ƥ}Ɓprice-name{ƌ600;Ƅ13px;Ʃ;Ƌ0;flex:1 1 180px}Ɓprice-legacy{Ƅ11px;color:ƀlabel-tertiary);Ɣ1px solid ƀborder-l1);ƅ999px;Ɗ1px 8px}Ɓprice-locked{Ƅ11px;color:ƀstate-business-primary);Ɣ1px solid ƀstate-business-primary);ƅ999px;Ɗ1px 8px;cursor:help}Ɓprice-row{Ƈgrid;grid-template-columns:52px repeat(4,minmax(0,1fr));Ɠ8px;ƈcenter}Ɓprice-row span{Ƅ12px;color:ƀlabel-tertiary)}Ɓprice-row input{ƗƋ0;ƝƊ6px 5px}Ɓprice-multiplier{ƆƃƐspace-between;Ɠ6px 12px;ƟƄ12px;color:ƀlabel-tertiary)}Ɓprice-multiplier label{Ƈinline-flex;ƃƓ5px;ƚ}Ɓprice-multiplier input{ƙ0;accent-color:ƀbrand-primary,#4d6bfe)}Ɓprice-row input[aria-invalid=true]{border-color:#d64c4c}Ɓbuttons{ƆƟƓ10px;ƈcenter}Ɓbtn{ƨƄ13px;color:ƀlabel-primary);Ƃƀbutton-elevated-fill);Ɣ1px solid ƀborder-l1);ƅ8px;Ɗ6px 14px;ƚ}ƁbtnƁstat-entry{Ƅ12px;Ə20px;Ɗ0 6px;Ƌ0;Ƒ100%;Ǝƍƒ;Ʒ}@media(Ƒ640px){Ɓstat-header{Ƈnone}}Ɓbtn.primary{Ƃƀstate-business-primary);border-color:transparent;color:ƀlabel-primary-inverted)}Ɓbtn.primary:hover{opacity:.88;Ƃƀstate-business-primary)}Ɓbtn.danger,Ɓmsg.err,Ɓbal-line.err,Ɓbal-err{color:ƀstate-error-primary)}Ɓbtn.small{Ɗ3px 10px;Ƅ12px}div:has(>[data-slot="conversation.composer.dock"] Ɓstat-entry){Ƨcolumn-Ɠ6px}Ɓmsg{Ƅ12px;Ə18px;Ɗ8px 12px;ƅ8px;Ɣ1px solid ƀborder-l1)}Ɓmsg.ok{color:ƀstate-success-primary)}Ɓhint{Ƅ12px;color:ƀlabel-tertiary)}Ɓbudget{ƆƉƓ10px}Ɓpeak-alert{position:fixed;inset:auto;ƙ0;Ɲƿưcolor:ƀlabel-primary);z-index:9999;width:340px;Ƒcalc(100vw - 32px);Ɗ16px;ƅ14px;Ƃƀbg-layer-2);Ɣ1px solid ƀborder-l2);box-shadow:0 14px 36px #00000038;ƆƉƓ8px;Ƅ12px;animation:cm-peak-alert-in .22s cubic-bezier(.2,.8,.2,1)}Ɓpeak-alertƁpeak-alert-corner{right:20px;bottom:20px}Ɓpeak-alertƁpeak-alert-center{top:50%;ƬƯanimation-name:cm-peak-alert-in-center}Ɓpeak-alert-peak{border-top:3px solid ƀstate-warn-primary)}Ɓpeak-alert-offpeak{border-top:3px solid ƀstate-info-primary,#3b82f6)}Ɓpeak-alert-badge{Ƈinline-flex;ƃƓ6px;Ƅ11px;ƌ600;letter-spacing:.4px;text-transform:uppercase}Ɓpeak-alert-badge:before{content:"";width:8px;ƾƅ50%;ƂcurrentColor;box-shadow:0 0 0 4px color-mix(in srgb,currentColor 16%,transparent)}Ɓpeak-alert-peak Ɓpeak-alert-badge{color:ƀstate-warn-primary)}Ɓpeak-alert-offpeak Ɓpeak-alert-badge{color:ƀstate-info-primary,#3b82f6)}Ɓpeak-alert-title{Ƅ14px;ƌ600;color:ƀlabel-primary)}Ɓpeak-alert-body{color:ƀlabel-secondary);Ə1.55}Ɓpeak-alert-actions{ƆƐflex-end;Ɠ8px;margin-top:2px}Ɓrow{ƆƓ8px;ƃƤ}@keyframes cm-peak-alert-in{0%{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes cm-peak-alert-in-center{0%{opacity:0;transform:translate(-50%,calc(-50% + 10px))}to{opacity:1;transform:translate(-50%,-50%)}}Ɓbudget-head{ƆƃƐspace-between;Ɠ8px}Ɓquota-name{flex:1;Ƌ0}Ɓbudget-bar{ƾƅ999px;Ƃƀbg-layer-3);Ʀ}Ɓbudget-fill{Ɯƅ999px;Ƃƀstate-business-primary);transition:width .3s ease}Ɓug{ƆƉƓ12px}Ɓug-total{Ƅ13px;color:ƀlabel-primary)}Ɓug-grid{Ƈgrid;ƺgrid-template-rows:repeat(7,auto);Ɠ3px;width:100%}Ɓug-cell{Ɨaspect-ratio:1/1;ƅ3px;ƝƂcolor-mix(in srgb,ƀlabel-primary) 8%,transparent);Ɣ1px solid ƀborder-l1)}Ɓug-cell.l1,Ɓug-cell.l2,Ɓug-cell.l3,Ɓug-cell.l4{border-color:transparent}Ɓug-cell.l1{Ƃcolor-mix(in srgb,ƀstate-business-primary) 25%,ƀbg-layer-3))}Ɓug-cell.l2{Ƃcolor-mix(in srgb,ƀstate-business-primary) 50%,ƀbg-layer-3))}Ɓug-cell.l3{Ƃcolor-mix(in srgb,ƀstate-business-primary) 75%,ƀbg-layer-3))}Ɓug-cell.l4{Ƃƀstate-business-primary)}Ɓug-cell.today{outline:1px solid ƀlabel-secondary);ǂ}Ɓug-months{Ƈgrid;ƺƓ3px;ƗƄ10px;color:ƀlabel-tertiary);Ʋ}Ɓug-monthc{ƕ}Ɓbudget-line{Ƅ13px;color:ƀlabel-secondary)}Ɓbudget-line.over{color:ƀstate-error-primary)}Ɓpeak-strip{ƆƃƓ6px;Ʋ;Ƌ0}Ɓpeak-track{ƞƆflex:1;ƽƋ0;ƅ999px;ƍƔ1px solid ƀborder-l1);Ƃƀbg-layer-3)}Ɓpeak-segment{Ɯflex:1}Ɓpeak-high{Ƃ#ff9800}Ɓpeak-low{Ƃƀstate-business-primary)}Ɓpeak-marker{ƣtop:0;Ƭwidth:2px;ƜƂƀbg-base);box-shadow:0 0 0 1px ƀlabel-tertiary);ơƶlj}Ɓpeak-chip{Ƅ11px;ƌ600;Ə1.2;Ǝcolor:ƀlabel-secondary)}Ɓpeak-classic{ƞƆƉƓ5px;LJ;Ƌ0}Ɓpeak-classic Ɓpeak-track{Ƙheight:8px}Ɓpeak-classic-marker{ƣtop:0;Ƭwidth:4px;height:12px;Ƃƀbg-base);Ɣ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);ơƶlj;ƅ2px}Ɓpeak-classic-marker:after{content:"";ƣtop:-7px;ƬơƮƭborder-top:6px solid #ff9800}Ɓpeak-classic.off Ɓpeak-classic-marker{border-color:ƀstate-business-primary)}Ɓpeak-classic.off Ɓpeak-classic-marker:after{border-top-color:ƀstate-business-primary)}Ɓpeak-classic-chip{align-self:flex-start;Ƅ11px;ƌ600;Ə1.4;Ƃƀbg-layer-2);Ɣ1px solid ƀborder-l1);ƅ999px;Ɗ2px 8px;Ǝcolor:ƀlabel-secondary)}Ɓpeak-strip.peak Ɓpeak-chip,Ɓpeak-classic.peak Ɓpeak-classic-chip,Ɓpeak-rail.peak Ɓpeak-rail-label,Ɓpeak-rail-classic.peak Ɓpeak-rail-classic-label{color:#ff9800}Ɓpeak-strip.off Ɓpeak-chip,Ɓpeak-classic.off Ɓpeak-classic-chip,Ɓpeak-rail.off Ɓpeak-rail-label,Ɓpeak-rail-classic.off Ɓpeak-rail-classic-label{color:ƀstate-business-primary)}Ɓpeak-strip.weekend Ɓpeak-chip,Ɓpeak-classic.weekend Ɓpeak-classic-chip,Ɓpeak-rail.weekend Ɓpeak-rail-label,Ɓpeak-rail-classic.weekend Ɓpeak-rail-classic-label{color:#34a853}Ɓpeak-classic.weekend Ɓpeak-classic-marker{Ƽ}Ɓpeak-classic.weekend Ɓpeak-classic-marker:after{border-top-color:#34a853}Ɓpeak-rail{ƆƉƃƓ3px;ǁƠ}Ɓpeak-rail-track{ƞƆƉwidth:6px;height:56px;ƅ999px;ƍƔ1px solid ƀborder-l1);Ƃƀbg-layer-3)}Ɓpeak-rail-segment{Ɨflex:1}Ɓpeak-rail-high{Ƃ#ff9800}Ɓpeak-rail-low{Ƃƀstate-business-primary)}Ɓpeak-rail-marker{ƣleft:0;top:50%;Ɨheight:2px;Ƃƀbg-base);box-shadow:0 0 0 1px ƀlabel-tertiary);transform:translateY(-50%);Ƹlj}Ɓpeak-rail-label{Ƅ10px;ƌ600;Ə1.2;Ǝcolor:ƀlabel-secondary)}Ɓpeak-rail-classic{ƆƉƃƓ3px;ǁƠ}Ɓpeak-rail-classic-track{ƞƆƉwidth:14px;height:56px;ƅ999px;Ɣ1px solid ƀborder-l1);Ƃƀbg-layer-3)}Ɓpeak-rail-classic-segment{ƞƗflex:1;Ʀ}Ɓpeak-rail-classic-segment.peak{Ƃ#ff9800;ƅ999px 999px 0 0}Ɓpeak-rail-classic-segment.off{Ƃƀstate-business-primary);ƅ0 0 999px 999px}Ɓpeak-rail-classic-marker{ƣƬtop:50%;width:12px;Lj;Ƃƀbg-base);Ɣ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);ƯƸlj;ƅ2px}Ɓpeak-rail-classic.off Ɓpeak-rail-classic-marker{border-color:ƀstate-business-primary)}Ɓpeak-rail-classic-label{Ƅ10px;ƌ600;Ə1.2;ƕ}Ɓpeak-rail-classic.weekend Ɓpeak-rail-classic-marker{Ƽ}Ɓgrid-group{grid-column:1 / -1;margin-top:8px;Ƅ12px;ƌ600;color:ƀlabel-tertiary);border-bottom:1px solid ƀborder-l1);padding-bottom:4px}Ɓgrid-group:first-child{margin-top:0}Ɓpeak-preview{margin-top:8px}Ɓtoggle-btn{Ƃnone;Ɣnone;Ɗ0;Ƅ12px;ƌ600;color:ƀstate-business-primary);ƚ}Ɓtoggle-btn:hover{text-decoration:underline}Ɓcollapsed-note{Ʋ}Ɓcatalog-vendor{margin-top:10px;Ƅ12px;ƌ600;color:ƀlabel-tertiary);border-bottom:1px solid ƀborder-l1);padding-bottom:2px;ƆƃƐspace-between;Ɠ8px}Ɓvendor-toggle{ƚ;user-select:none}Ɓvendor-toggle:hover{color:ƀlabel-secondary)}Ɓvendor-display{Ƈinline-flex;ƃƓ4px;ƌ400;Ƅ11px;color:ƀlabel-tertiary);ƕ}Ɓmstats-tabs{ƆƓ8px;margin-bottom:8px}Ɓmstats-tab{Ƃnone;Ɣ1px solid ƀborder-l1);ƅ999px;Ɗ2px 12px;Ƅ12px;color:ƀlabel-secondary);ƚ}Ɓmstats-tab.active{Ƃƀstate-business-primary);border-color:ƀstate-business-primary);color:ƀbg-base);ƌ600}Ɓmstats-h{ƙ10px 0 4px;Ƅ12px;ƌ600;color:ƀlabel-secondary)}Ɓmstats-row{Ƈgrid;grid-template-columns:minmax(90px,170px) 1fr auto;Ɠ8px;ƃƄ11px;Ə1.7}Ɓmstats-name{ƍƒ;Ǝcolor:ƀlabel-secondary)}Ɓmstats-label{dž;ƆƟƃƓ6px;LJ}Ɓmstats-label Ɓmstats-name{flex:1;Ƌ90px}Ɓmstats-label~Ɓmstats-barbg{grid-column:1/3}Ɓmstats-label select{Ƒ100%;Ƌ0}Ɓmstats-barbg{ƞheight:10px;ƅ999px;Ƃƀbg-layer-3);ƍƇflex}Ɓmstats-bar{ƜƋ0;ƅ999px}Ɓmstats-bar.cost{Ƃ#ff9800}Ɓmstats-bar.hit{Ƃ#34a853}Ɓmstats-bar.value{Ƃ#a142f4}Ɓmstats-seg{ƜƋ0}Ɓmstats-seg.in{Ƃƀstate-business-primary)}Ɓmstats-seg.cache{Ƃ#ff9800}Ɓmstats-seg.out{Ƃ#34a853}Ɓmstats-val{Ǝcolor:ƀlabel-secondary)}Ɓmstats-legend{ƆƓ12px;Ƅ10px;color:ƀlabel-tertiary);ƙ2px 0 4px}Ɓmstats-dot{Ƈinline-block;width:8px;ƾƅ2px;margin-right:3px}Ɓmstats-note{margin-top:10px;Ƅ10px;Ə1.6;color:ƀlabel-tertiary)}Ɓmatch-row{ƆƃƓ8px;Ɗ3px 0;Ƅ12px;Ƥ}Ɓmatch-row Ɓinput{flex:1;Ƌ160px}Ɓbudget-controls{Ƈgrid;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));Ɠ12px}Ɓbbox{Ɣ1px solid ƀborder-l1);ƅ12px;Ɗ8px 10px;Ƃƀbg-layer-1);ƆƉƓ6px;Ƌ148px;Ơ}Ɓbbox.rail{Ɗ6px;Ƌ0;ǁƃƐcenter;ƅ10px}Ɓbbox.warn{border-color:ƀstate-warn-primary)}Ɓbbox.over{border-color:ƀstate-error-primary)}Ɓbbox-head{ƆƃƐspace-between;Ɠ8px}Ɓbbox-label,Ɓbbox-pct{Ƅ12px;ƌ600;color:ƀlabel-primary)}Ɓbbox.warn Ɓbbox-pct{color:ƀstate-warn-primary)}Ɓbbox.over Ɓbbox-pct{color:ƀstate-error-primary)}Ɓbbox-bar{ƽƅ999px;Ƃƀbg-layer-3);Ʀ}Ɓbbox-bar.segments{Ɔheight:8px}Ɓbbox-bar.segments Ɓbbox-fill{Ƙƅ0;height:100%}Ɓbbox-bar.segments Ɓbbox-fill:first-child{ƅ999px 0 0 999px}Ɓbbox-bar.segments Ɓbbox-seg-today{ƘƜƂ#ff9800}Ɓbbox-bar.segments Ɓbbox-seg-spent{ƘƜƂƀinteractive-bg-hover);ƅ0 999px 999px 0}Ɓbbox-bar.segments.rev Ɓbbox-fill:first-child,Ɓbbox-bar.segments.rev Ɓbbox-seg-today:first-child{ƅ999px 0 0 999px}Ɓbbox-bar.segments.rev Ɓbbox-fill,Ɓbbox-bar.segments.rev Ɓbbox-fill:last-child,Ɓbbox-bar.segments.rev Ɓbbox-seg-today:last-child,Ɓbbox-bar.segments.rev Ɓbbox-seg-spent:last-child{ƅ0 999px 999px 0}Ɓbbox-bar.segments.rev Ɓbbox-seg-spent{ƅ0}Ɓdir-row{ƆƃƓ8px;LJ}Ɓdir-label{flex:1 1 40%;Ƅ12px;color:ƀlabel-secondary)}Ɓdir-row Ɓinput{flex:1 1 60%;DŽ}Ɓbbox-fill{Ɯƅ999px;Ƃƀstate-business-primary)}Ɓbalance-name{Ƈinline-flex;ƃƓ4px;Ƌ0}Ɓmodel-costs{Ƅ12px}Ɓmodel-costs Ɓbal-label{ƕ}Ɓmodel-top{Ɠ4px;Ƒ180px;ƍƒ}Ɓmodel-costs Ɓcollapse-h{Ƌ0;Ɨƕ}Ɓmodel-costs Ɓbbox-bar{margin-top:3px}Ɓbal-label{Ƌ0;ƍƒ}Ɓbal-amt{margin-left:auto;ƥƷ}Ɓbbox-pctƁbal-amt{color:ƀstate-business-primary)}Ɓbal-link{ƘƇinline-flex;ƃƐcenter;Ɗ2px;ƅ4px;Ƅ12px;Ə16px;color:ƀlabel-tertiary);text-decoration:none;ƻ}Ɓbal-link:hover{color:ƀbrand-primary);Ƃƀinteractive-bg-hover)}Ɓbal-link:focus-visible{box-shadow:0 0 0 2px ƀbrand-primary)}Ɓbbox.warn Ɓbbox-fill,Ɓbbox Ɓbbox-section.warn Ɓbbox-fill,Ɓbbox Ɓmm-row.warn Ɓbbox-fill,Ɓbudget-fill.warn{Ƃƀstate-warn-primary)}Ɓbbox.over Ɓbbox-fill,Ɓbbox-section.over Ɓbbox-fill,Ɓmm-row.over Ɓbbox-fill,Ɓbudget-fill.over{Ƃƀstate-error-primary)}Ɓbbox-line{Ƅ12px;color:ƀlabel-tertiary)}Ɓbbox-rail{Ƅ11px;ƌ600;color:ƀlabel-primary)}Ɓbbox.warn Ɓbbox-pct,Ɓbbox.warn Ɓbbox-rail,Ɓbbox Ɓbbox-section.warn Ɓbbox-pct,Ɓbbox Ɓmm-row.warn Ɓbbox-pct,Ɓmm-row.warn Ɓbbox-label,Ɓcorner-chip.warn,Ɓqchip.warn,Ɓsimple-summary.warn{color:ƀstate-warn-primary)}Ɓbbox.over Ɓbbox-pct,Ɓbbox.over Ɓbbox-rail,Ɓbbox-section.over Ɓbbox-pct,Ɓmm-row.over Ɓbbox-pct,Ɓmm-row.over Ɓbbox-label,Ɓcorner-chip.over,Ɓqchip.over,Ɓsimple-summary.over{color:ƀstate-error-primary)}Ɓbbox-pair{ƆƉƓ0;Ɗ2px 10px}Ɓbbox-pair Ɓbbox-section{ƆƉƓ4px;Ɗ4px 0}Ɓbbox-pair Ɓbbox-bar{Lj}Ɓbbox-divider{height:1px;Ƃƀborder-l1);ƙ0}Ɓbbox.clickable,Ɓfoot.clickable{ƚ}Ɓbbox.clickable:hover{border-color:ƀstate-business-primary)}Ɓbbox.clickable:focus-visible,Ɓfoot.clickable:focus-visible{outline:2px solid ƀstate-business-primary);ǂ}@keyframes cm-click-refresh-pulse{0%,to{opacity:.55}50%{opacity:1}}Ɓbbox.clickable.busy,Ɓfoot.clickable.busy{animation:cm-click-refresh-pulse 1.1s ease-in-out 2;cursor:progress}Ɓmm{Ɗ8px 10px;Ɠ4px}Ɓmm-title{Ƅ12px;ƌ600;color:ƀlabel-primary)}Ɓmm-reset{Ƅ11px;color:ƀlabel-tertiary);dž}Ɓcodex-window{ƆƟƈbaseline;Ɠ4px 6px;Ƅ12px}Ɓcodex-window strong{ƕ}Ɓbbox.rail[data-cm-display=codex] Ɓbbox-rail{Ƒ100%;Ʃ;ǃƄ10px}Ɓgw-switcher{ƚ;DžƄ11px;Ɗ1px 6px;ƅ999px;Ɣ1px solid ƀborder-l1);Ƃƀbg-layer-2);color:ƀlabel-secondary)}Ɓgw-switcher:hover{Ƃƀinteractive-bg-hover);color:ƀlabel-primary)}Ɓgw-sub{Ƅ11px;color:ƀlabel-tertiary);ƍƒ;ƕ}Ɓmm-row{ƆƃƓ8px;Ɗ2px 0}Ɓmm-row Ɓbbox-label{ƘDŽ;Ƌ22px;Ƒ115px;ƌ400;color:ƀlabel-secondary);Ɩ;Ǝƍƒ;word-break:keep-all}Ɓmm-row Ɓbbox-bar{flex:1;Ƌ40px;height:6px}Ɓmm-row Ɓbbox-pct{ƘƋ2.4em;ƥƖ}Ɓmm-row.wide Ɓbbox-label{DŽ;Ƒ64px;ƫƎƍƒ}Ɓmm-row.wide Ɓmm-text{flex:1;Ƌ0;Ƅ12px;color:ƀlabel-secondary);ƥƖ;Ǝƍƒ}Ɓbal-line{Ƅ13px;color:ƀlabel-secondary)}Ɓbal-line.warn{color:ƀstate-warn-primary,#b45309)}:has(>Ɓfooter-stack),:has(>[data-slot="sidebar.footer.action"]>Ɓfooter-stack){Ƥ}:has(>Ɓfooter-stack.rail),:has(>[data-slot="sidebar.footer.action"]>Ɓfooter-stack.rail){ƉƧƃƓ6px}Ɓfooter-stack{ƆƘorder:-1;ƉƓ6px;ƗƋ0;Ƒ100%;ƈstretch;Ơ}Ɓfooter-stack.rail{ƃorder:1}Ɓfooter-stack Ɓbbox{ƗƋ0}Ɓfooter-stack Ɓfoot{ƗƠ}Ɓfooter-stack.compact Ɓbbox{Ƈgrid;grid-template-columns:repeat(2,minmax(0,1fr));column-Ɠ12px;row-Ɠ2px;ƈcenter}Ɓfooter-stack.compact Ɓbbox>*{dž}Ɓfooter-stack.compact Ɓbbox>Ɓmm-row{grid-column:auto}Ɓfooter-stack.compact Ɓmm-row{Ƌ0;Ɠ4px;flex-wrap:nowrap}Ɓfooter-stack.compact Ɓmm-row Ɓbbox-label{ƫƋ0;Ƒ45%;DŽ}Ɓfooter-stack.compact Ɓmm-row Ɓbbox-bar{Ƌ0;flex:1 1 0}Ɓfooter-stack.simple{Ɠ0;max-height:38vh;max-height:min(38dvh,320px);Ƴoverscroll-behavior:contain;scrollbar-width:thin;Ɣ1px solid ƀborder-l1);ƅ10px;Ƃƀbg-layer-1)}Ɓfooter-stack.simple>*{Ʒ}Ɓfooter-stack.simple:focus-visible{outline:2px solid ƀstate-business-primary);outline-offset:2px}Ɓfooter-stack.simple Ɓbbox{Ɣ0;ƅ0;Ɗ4px 8px;Ɠ2px;Ƃtransparent;box-shadow:inset 0 -1px ƀborder-l1)}Ɓfooter-stack.simple Ɓmm-title{Ƅ11px;Ə16px;ƙ0}Ɓfooter-stack.simple Ɓmm-row{Ɠ6px;min-height:16px;Ə16px;ƙ0;Ɗ0}Ɓfooter-stack.simple Ɓmm-text{Ƅ11px}Ɓfooter-stack.simple>Ɓpeak-strip,Ɓfooter-stack.simple>Ɓpeak-classic{ƙ0;Ɗ4px 8px}Ɓsimple-summary>span{Ƌ0;Ǝƍƒ}Ɓfooter-stack.simple Ɓbbox-pct{Ƅ12px;Ə18px}Ɓfooter-stack.simple Ɓbbox-bar{Lj}Ɓfooter-stack.simple Ɓbbox-line{Ƈnone}Ɓfooter-stack.simple Ɓfoot{height:26px;Ɗ0 8px}Ɓfooter-stack.simple Ɓpeak-classic{margin-top:2px;Ɠ2px}Ɓfooter-stack.simple Ɓpeak-classic-chip{Ɗ0 4px;Ɣ0;Ƃtransparent}Ɓsimple-summary{position:sticky;top:0;z-index:1;Ƃƀbg-layer-1);ƆƐspace-between;ƃƓ8px;Ɗ5px 8px;Ƅ12px;ƌ600;border-bottom:1px solid ƀborder-l1)}Ɓfooter-stack.simple.rail{Ɣ0;Ƃtransparent}Ɓfooter-stack.simple.rail Ɓbbox{Ɗ4px 2px}Ɓfooter-stack.simple Ɓpeak-rail-track,Ɓfooter-stack.simple Ɓpeak-rail-classic-track{height:28px}@media(Ƒ640px){Ɓcards,Ɓgrid,Ɓbudget-controls{Ƶ}}@media(Ƒ1023px){Ɓsection{padding-bottom:calc(16px + env(safe-area-inset-bottom))}Ɓcards,Ɓoverview-grid>Ɓcards,Ɓgrid,Ɓbudget-controls{ƱƓ8px}Ɓcard{Ɗ10px 12px}Ɓcard-value{Ƅ17px}Ɓcard-sub,Ɓbal-line,Ɓbal-amt{Ʃ}Ɓbuttons,Ɓtoolbar,Ɓrow,Ɓbudget-head{Ƥ}Ɓbtn,Ɓtab,Ɓfoot,Ɓcorner-chip{min-height:36px;height:auto}Ɓtabs{Ƨoverflow-x:auto}Ɓtab{ƹ}Ɓqstrip{Ɗ0 8px}Ɓqguide{Ƒcalc(100vw - 24px);--cm-guide-top:var(--dsh-frame-overlay-top,calc(var(--dsh-frame-chrome-top,ƛ) + 10px + env(safe-area-inset-top)))}Ɓpeak-alert{Ƒcalc(100vw - 24px)}Ɓpeak-alertƁpeak-alert-corner{right:12px;left:12px;bottom:calc(12px + env(safe-area-inset-bottom));DŽ}Ɓfooter-stack{ƪ}Ɓstat-dialog-body{Ɗ14px;padding-bottom:calc(14px + env(safe-area-inset-bottom))}}body[data-dsh-pocket-layout=mobile] :is(Ɓcards,Ɓoverview-grid>Ɓcards,Ɓgrid,Ɓbudget-controls){ƱƓ8px}body[data-dsh-pocket-layout=mobile] Ɓtabs{Ƨoverflow-x:auto}body[data-dsh-pocket-layout=mobile] Ɓfooter-stack{ƪ}body[data-dsh-pocket-layout=mobile] :is(Ɓpeak-alert,Ɓqguide){Ƒcalc(100vw - 24px)}body{--cm-opaque-base:#fff}body[data-ds-dark-theme],body[data-theme=dark],html[data-theme=dark] body{--cm-opaque-base:#151517}Ɓsection,Ɓstat-dialog,Ɓqguide,Ɓpeak-alert,Ɓfooter-stack.simple{Ƃƴ;Ƃrgb(from ƀbg-layer-2,ƀbg-base,#fff)) r g b / 1)}Ɓsimple-summary{Ƃƴ;Ƃrgb(from ƀbg-layer-1,ƀbg-base,#fff)) r g b / 1)}'.replace(/[ƀ-ǿ]/g,e=>An[e.charCodeAt(0)-384]),ha="dsh-cost-meter/client.css";if(typeof document<"u"&&document.head!==void 0){const e=document.querySelector("style[data-plugin-css="+JSON.stringify(ha)+"]");if(e?.textContent!==ga){const n=e??document.createElement("style");n.dataset.plugin="dsh-cost-meter",n.dataset.pluginCss=ha,n.textContent=ga,e===null&&document.head.appendChild(n)}}const Pn="sessionCostTitle|sessionDetailTokens|sessionDetailCache|cost|sessionLine|sessionLineCompact|sessionCostCompact|quotaUnlimited|pricingCnyHint|balanceQueryFailed|unknownError|balance|queryFailed|balanceTitle|reconcileLabel|totalBalance|grantedToppedUp|updatedAt|budgetOf|usedOf|todayShare|monthTotal|budget|todayCostTitle|todayTokensTitle|tokensUnit|callsTokens|monthCost|totalCost|today|sidebarTodayMetric|sidebarTodayCost|sidebarTodayTokens|periodDay|periodMonth|periodAll|periodCustomRange|noHistory|colDate|colCalls|colInTok|colCacheTok|colOutTok|colCost|noSessionsToday|colSession|enableBudget|budgetAmountLabel|budgetPeriodLabel|startDate|endDate|rangeText|budgetDisabledNote|budgetStatus|overLimit|nearLimit|legacyModel|defaultFallback|remove|tierBase|tierOffPeak|tierPeak|balanceApiKey|balanceKeyHint|balanceLine|balanceQueryFailedHint|balanceNotQueried|accountBalance|refreshing|refreshBalance|customBalanceTitle|customBalanceAdd|tokenRhythmBalanceAdd|tokenRhythmBalanceNote|aliyunBalanceAdd|aliyunBalanceNote|customBalanceConfigNote|customBalanceLabelZh|customBalanceLabelEn|customBalanceUrl|customBalanceUrlHint|customBalanceHttp|workBuddyBalanceAdd|workBuddyBalanceNote|customBalanceMethod|customBalanceHeaders|customBalanceBody|customBalanceBodyNote|customBalanceExtract|customBalanceDisplayLabel|customBalanceRefreshInterval|customBalanceUnitLabel|customBalanceConvert|customBalanceConvertNote|balanceBarRemaining|balanceBarToday|balanceBarSpent|balanceShowProgressBar|barDirectionsTitle|barDirectionsHint|barDirection_balance|barDirection_budget|barDirection_go|barDirection_plan|barDirectionRemaining|barDirectionUsed|balanceBudgetCapLabel|balanceBudgetCapHint|customBalanceInvalidJson|customBalanceHeadersVarNote|customBalanceAllowedHosts|customBalanceAllowedHostsHint|customBalanceCredentialsTitle|customBalanceCredentialsHint|customBalanceNoPlaceholders|enable|customBalanceLine|customBalanceRemaining|refreshCustomBalance|goQuotaTitle|goQuotaRowLabel|goWindowRolling|goWindowWeekly|goWindowMonthly|goResetAt|resetReached|resetDays|resetHours|resetMinutes|quotaUsed|quotaRemaining|goQuotaPercent|goQuotaFetchedAt|goQuotaDisplayLabel|goQuotaRefreshIntervalLabel|goQuotaRefreshMinutesUnit|goQuotaKeyLabel|goMainLabel|goDetailLabel|credentialConfiguredOf|credentialNotConfigured|credentialSave|credentialEdit|credentialClear|credentialSaving|credentialInputHint|secretMigrationPending|budgetDetailLabel|refreshGoQuota|goQuotaNotQueried|codingPlanAnthropic|codingPlanZai|codingPlanMinimax|codingPlanMinimaxTitle|minimaxOrigin|minimaxOriginNote|codingPlanRemain5h|codingPlanRemain7d|balanceRechargeLink|codexQuotaTitle|codexQuotaFive|codexQuotaWeek|codexQuotaReset|codexQuotaUnavailable|codexQuotaEnabled|codexQuotaSidebar|codexQuotaStrip|includeSubagentCost|gatewayQuotaEmpty|codingPlanDisplayLabel|codingPlanDisplayNote|codingPlanKeyLabel|codingPlanRefreshIntervalLabel|refreshCodingPlan|loginCodingPlan|loggingIn|codingPlanNotQueried|gatewayQuotaTitle|gatewaySourceAdd|gatewaySourceLabel|gatewaySourceBaseURL|gatewaySourceDisplay|gatewaySourceRefreshInterval|gatewaySourceAllowlist|gatewaySourceCredential|gatewaySourceStatus|gatewaySourceUnsupported|gatewaySourceUnknown|gatewaySourceNoAccounts|gatewaySourceFetchedAt|gatewaySwitchAccount|gatewayOnlyGemini|refresh|quotaEnableFirst|quotaRefreshReady|quotaRemove|quotaSectionNote|codingPlanDisabledNote|goQuotaDisabledNote|cornerLabel|cornerEnabledLabel|cornerGoRolling|cornerGoWeekly|cornerGoMonthly|cornerBudget|goShortRolling|goShortWeekly|goShortMonthly|goShortDaily|budgetShort|ledgerReadFailed|readingLedger|ledgerUnavailable|syncFailed|historyCleared|clearFailed|peakOff|peakNotEffective|peakActive|peakNotice|offPeakActive|weekendAllOffPeak|weekendChip|weekendShort|holidayAllOffPeak|holidayChip|holidayShort|peakHolidaysLabel|weekendRuleNote|peakShort|offPeakShort|peakStyleLabel|peakStyleCompact|peakStyleClassic|peakAlertLabel|peakAlertAheadLabel|peakAlertTargetLabel|peakAlertTargetPeak|peakAlertTargetOffPeak|peakAlertTargetBoth|peakAlertTitlePeak|peakAlertTitleOffPeak|peakAlertBody|peakAlertPhasePeak|peakAlertPhaseOffPeak|peakAlertBtn|peakAlertBadgePeak|peakAlertBadgeOffPeak|peakAlertPositionLabel|peakAlertPositionCorner|peakAlertPositionCenter|peakAlertWebNotifyLabel|peakAlertWebNotifyHint|peakAlertPreviewLabel|peakAlertPreviewPeak|peakAlertPreviewOffPeak|peakAlertPreviewTag|peakPanelTitle|peakNoticeHiddenHint|groupGeneral|groupMoney|groupSidebar|sidebarSimple|sidebarSimpleNote|sidebarSimpleTitle|sidebarSimpleBody|sidebarSimpleOn|sidebarSimpleOff|sidebarSimpleError|closeGuide|todayBudget|sidebarStyleLabel|sidebarStyleStandard|sidebarStyleCompact|restorePriceMatches|removePriceMatchHint|groupCorner|groupDetail|unmountBtn|catalogUnpriced|priceLockBadge|priceLockHint|priceLockRelease|modelStatsTitle|modelsTitle|modelsCount|modelsOther|models_enabled|models_defaultOpen|models_remember|models_tokens|models_shares|models_dock|models_period|models_summary|models_position|models_topN|models_refreshSeconds|modelsTotal|modelsTop|modelsFirst|modelsAfter|modelsLast|modelStatsToday|modelStatsHistory|modelStatsCostH|modelStatsTokensH|modelStatsHitH|modelStatsHitUnreported|modelStatsHitUnreportedTip|modelStatsValueH|modelStatsInput|modelStatsCache|modelStatsOutput|modelStatsEmpty|modelStatsBlended|modelStatsNote|modelStatsLegacy|sessionLineSplit|sessionLineSplitCompact|costChipPlan|sessionDetailPlan|planStatsTitle|planStatsEmpty|planStatsWindow|planStatsPercent|planStatsLocal|planStatsPer1|planStatsFull|planStatsResets|planStatsMethodSample|planStatsMethodLive|planStatsMethodNone|planStatsMethodSampleAt|planStatsConfidenceLow|planStatsCurveTitle|planStatsDaily|planStatsWeekly|planStatsMonthly|planStatsCurveEmpty|planStatsBarTip|planStatsNote|billingClassLabel|billingClassPlan|billingClassAuto|billingClassApi|catalogDisplayLabel|catalogDisplayHint|priceTableDisplayHint|priceMultiplySeparate|priceMultiplyHint|priceMultiplyAll|priceMultiplySingle|priceMultiplyInvalid|priceMatchLabel|priceMatchAuto|priceMatchExact|priceMatchNote|unmatchedTitle|unmatchedHint|overrideTargetDefault|overrideRemove|overrideTargetLocal|matchedTitle|matchedHint|matchedKeepAuto|overrideNone|mountedSuffix|flatInput|flatCached|flatCacheWrite|cacheWriteFallback|flatOutput|deepseekMountedHeader|codingPlanKimi|codingPlanOpenrouter|codingPlanSiliconflow|codingPlanCommandcode|codingPlanScnet|codingPlanVolcengine|codingPlanQwen|codingPlanMimo|codingPlanFactory|codingPlanOpendesign|opendesignWorkspace|opendesignNote|factoryPool|factoryPoolBoth|factoryOrg|mimoWindowPlan|mimoWindowCompensation|codingPlanWindowBalance|qwenSource|qwenSourceLocal|qwenSourceCli|qwenSourceBailian|qwenCliNote|qwenBailianNote|qwenPlanCreditsLabel|qwenPlanStartLabel|qwenRatesLabel|qwenRatesModelPlaceholder|qwenRatePlaceholder|qwenRate_input|qwenRate_cachedInput|qwenRate_output|qwenRateDraftNote|qwenRatesAdd|qwenLocalNote|scnetPlanCreditsLabel|scnetPlanStartLabel|scnetLocalNote|volcengineAccessKeyIdLabel|volcengineSecretAccessKeyLabel|volcengineNote|volcengineAccessKeyPlaceholder|volcengineSecretPlaceholder|countdownHoursOnly|countdownHourMinute|countdownMinute|nextOffPeakIn|nextPeakIn|peakSummary|noPeakWindows|unknown|cardToday|cardMonth|cardTotal|cardTotalSub|externalUsage|combinedUsage|externalStale|externalHistory|cardsFootnote|timezoneHint|todaySessions|historyExpandHint|historySessionsLoading|historyNoSessions|historySessionsError|sessionRankTitle|sessionRankHint|sessionRankEmpty|sessionRankLoading|sessionRankError|sessionRankLimit|showSessionIdLabel|cardsTogglePlanTotal|cardsTogglePlanTotalHint|hideOfficialBalanceLabel|hideTodayCostLabel|hideSessionCostHeader|hideSessionCostDock|hideTurnCost|sessionRankSort|sessionSortCostDesc|sessionSortCostAsc|sessionSortTimeDesc|sessionSortTimeAsc|sessionSortRecent|history|usageTitle|usageTotal|usageDay|usageEmpty|usageSectionLabel|usagePositionLabel|usagePositionCost|usagePositionGeneral|usagePositionSection|displaySettings|tabOverview|tabQuotas|tabUsage|tabPricing|tabDisplay|historyDataTitle|positionLabel|positionDock|positionHeader|off|quotaStripGroup|quotaStripEnable|quotaStripShowBudget|quotaStripShowGo|quotaStripShowPlans|quotaStripNote|quotaStripGuideTitle|quotaStripGuideBody|quotaStripGuideOn|quotaStripGuideOff|clickToRefresh|balanceClickGuideTitle|balanceClickGuideBody|balanceClickGuideOk|sidebarLabel|sidebarOn|currencyLabel|currencyCny|currencyUsd|currencyEur|symbolLabel|rateLabel|decimalsLabel|balanceDisplayLabel|balanceSidebar|balanceSettings|balanceBoth|refreshIntervalLabel|peakEnabledLabel|peakNoticeLabel|badgeNote|priceTableTitle|pricingCurrencyLabel|pricingCurrencyUsd|pricingCurrencyCny|pricingCurrencyNote|priceTableNote|datedPriceNote|defaultModelId|newModelPlaceholder|addModel|dataSync|saving|autoSaveFailed|autoSavedAt|autoSaveHint|confirmFetch|apply|cancel|syncFromDocs|syncScopeNote|confirmReset|importLegacy|confirmImportLegacy|legacyImportFailed|legacyImportNote|confirmClear|clearAllHistory|lastSync|neverSynced|source|sourceOfficial|sourceBundled|languageLabel|localeAuto|localeZh|localeEn|sectionLabel|rpcFailed|rpcSyncFailed|rpcBalanceFailed".split("|"),Mn="额度|显示|amount|余额|价格|费用|会话|quota|模型|session|DeepSeek|off-peak|official|输入|缓存|计费|OpenCode Go|Plan|balance|display|prices|刷新|官方|time|OpenDesign|tokens|自动|自定义|weekends and Chinese public holidays are|预算|Token|the|调用|message|侧边栏|input|output|今日|设置|credential|凭据|Balance|cache|用量|金额|Enable|Refresh interval|中国公众假期全天谷价|同步|失败|峰时高价时段显著提示|时段|details|refresh|calls|cost|历史|峰时|已用|输出|and|price|usage|BillingCenterReadOnlyAccess|sidebar|以同一系统账号运行|Settings|budget|currency|interval|position|settings|保存|启用|图框详细信息|开启|当前|Credits|Refresh|account|WorkBuddy2API|period|本地|留空|Codex|model|optional|右下角|Budget|DescribeBillingAccount|failed|history|位置|分钟|匹配|命中|币种|数据|查询|记录|谷时|账本|配置|Coding|Strip includes|rates|剩余|小时|峰谷|提示|时间|更新|统计|订阅|Chinese|credits|minutes|人民币|API|Cache|empty|month|YYYY-MM-DD|auth login|billed|configured|planAmount|source|使用|可选|本月|横条|请求|读取|谷价|进入|隐藏|默认|ArkReadOnlyAccess|Display|Off-peak|Quota not queried|browser|current|default|is an upper bound|local ledger|never echoed back|subscription|法定假日|逗号分隔|AccessKey|Output|Preview entering|Remaining|including|ledger|remaining|this|主机|估算|全部|关闭|密钥|恢复|日期|明细|暂无|框上方|浏览器|清除|登录|百分比|累计|账号|进度条|间隔|Today|Volcano Ark|coding plan|local|percentages|a catalog entry|comma-separated|deepseek-v4-pro|only|peak|导入安装前|开始对话后|汇总在这里|Monthly|Sidebar|Volcano|pricing|Cost|Entering|Failed to load|Input|Official|Provider|a vendor group|built-in table|custom|enough samples|historical|stay unchanged|to restore|toppedUp|上方|卡片|取消|周末|图框|安装|展开|手动|挂载|提醒|方向|来源|消耗|添加|等值|美元|Alibaba Cloud|Authorization|Show|automatically|volcengineapi|Quota|above|effective|estimates|overrides|qianwenai|strip|table|total|白名单|Bottom-right|Content-Type|Custom|English|JSON|MiniMax|Session|This|Updated|bottom-right|console|conversation|date|from|granted|hitRate|method|notification|rate|records|removed|restore|same OS user|used|windows|workspace ID|侧栏|保留|内置|写入|单价|可在|名称|后续|周期|导入|开放平台|按自然月|排行加载|滚动|火山引擎|火山方舟|点击|环境变量|确认|积分|移除|覆盖|计价|账户|这里|采样区间|重置|预览|Control Key|Flash|Peak|SiliconFlow|application|apply|are|auto-detect|bailian-cli|composer|data|environment|estimate|full-window|host|matching|max-preview|pre-install|qianwen-cli|token|unavailable|DSH|Auto-match|Claude Pro|Credential|Management|OpenRouter|Remove|Volcengine|Weekly|aggregated|change|exactly at|hours soon|multiplier|percentage|status|with|下方|不计|优先|修改|倍率|全天|切换|加载|勾选|区间|厂商|可用|基础|实际|当日|影响|文档|日志|未知|档位|渠道|生效|用于|端口|编辑|选择|采样|History|Unknown|Weekend|address|count|headers|hours|missing|ranking|reads|today|ACCESSKEY|Anthropic|Clear all|SECRETKEY|Topped-up|all|auto-sync|direction|for|page|plan|precision|providers|reasoning|signed-in|stay|subagents|use|中复制|主页面|占位符|子代理|工作区|性价比|抵扣率|控制台|未上报|条起步|标题栏|知道了|表条目|起始日|过期后|这一项|阿里云|Base URL|Cookie|Currency|External|HTTPS|Moonshot|Public|Security|Source|Usage|actual|calendar|deepseek|follow|full|notice|override|priority|progress|provider|range|read|recorded|requires|sample|shows|snapshot|store|subtract|when|window|write|不会|中文|充值|其他|分别|列表|删除|北京|千问|发现|发送|只写|可能|后可|地址|填写|外部|套餐|对账|应用|弹窗|快照|悬停|折算|推理|支持|时刻|时区|最多|本周|标准|格式|每日|汇率|满窗|独立|窗口|简化|精度|精确|请在|路径|Key|Amounts|Beijing|Billing|ChatGPT|Compact|Confirm|Default|Extract|Factory|General|Granted|HTTP|Hide|Include|Loading|Mounted|Qwen|Request|Used|accepts|applies|billing|bundled|card|channel|earlier|gateway|here|holiday|include|key|name|not|percent|plugins|qianwen|replace|require|unknown|Click|Enter|Local|ROUTE|USD|alert|click|equiv|first|limit|match|query|saved|start|stats|value|CNY|Change|Gemini|Kimi|Ledger|NewApi|OPENAI|Recent|Rhythm|Saving|VOLC|active|corner|direct|divide|enable|fields|import|logs|manual|openai|origin|pct|plugin|port|reason|remain|resets|select|studio|sync|上下|上界|上限|不再|不是|不足|两者|为准|之后|仍在|保持|允许|入口|分开|包含|即将|原因|发生|同名|后的|后缀|回放|回显|回退|域名|填入|处于|字段|对应|导出|将按|屏幕|工具|平价|底部|开关|总额|打开|按量|插件|放行|新增|早期|最近|月度|权限|条数|样式|样本|概览|版本|状态|现在|界面|百炼|目录|直接|符号|类型|紧凑|缺失|网关|花费|英文|表外|规则|语言|调整|账单|货币|赠送|超出|跟随|通知|重试|钱包|Add|bar|box|Both|CLI|KEY|Keep|Sync|VAR|When|clear|day|dock|docs|each|leave|left|now|show|that|tok|will|yet|your|Pro|com|All|Auto|Not|Save|auto|back|can|chip|its|keep|old|open|per|save|Top|low|row".split("|"),De=Object.fromEntries([["zh",'本Ɔƅ(按每次Ơ˘͎͛Ə)|ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|Ǝ:读 {̩} · 写 {̳}(ʌ按ǟ价Ə)|ƅ {Ƃ}|本Ɔ {Ƃ} · ǟ {ɾ} · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|本Ɔ {Ƃ}|仅ƁƬ|无限制|njǵƬ来自ɟƄ × ͕ {ʁ}。对照ƖǵϹ,请ˤ Ζ,再ưƄ;ư仅˚ʐƠ。|ƃǢƱ:{ơ}|˝错误|ƃ|ǢƱ|Ɗ ʓʠƃ|Ɩƃ变动与ǒǥ交叉͆(偏差超阈时ǭ)|总ƃ {Ƃ}|ϻ {ɽ} · ̶ {ɏ}|ǯǮ {Ɨ}|Ɲ({Ǒ})|ƺ {ʆ} / {Ƃ}|ƥ {Ƃ} · 占Ɲ {ά}|Ȃ {ǹ} · ȭ {ɭ}|Ɲ|ƥƅ(按ƖƄ͛Ə)|ƥ ƞ ƫ|ƙ|Ơ {ƶ} 次 · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|Ȃ {Ƃ}|ȭ {Ƃ}|ƥ|ƢƥƁ|ƅ|ƞ ƫ|ƥ|Ȃ|ȭ|ƛ˔|ȧƸǣ。ȼ,ƅϓ天Ƚ。|ȥ|Ơ|ƍ Е|Ǝ Е|ƻ Е|ƅ|ƥȧƆǣ。|Ɔ|ljƝ|Ɲƀ(按ƁǠ)|Ɲʑ|开始ȥ|结束ȥ(Ǔ = ƥ)|ǰ˔:{̨}|ljƝ后Ɓƀ、ƺƬ及比例(按ƁǠ换算);ȁƥ、Ȃ、ȭ或ƛʑ。|{Ǒ}Ɲ {Ƃ} · ƺ {ʆ} · {ά}%|(已ϼ)|(接近η)|旧ƈ|ȉό|ʝ|˗|Ǥ|ƹ|ƃ专用 Ƕ ͞|ˍȀ此ʓ ͞;未Ǧ时ȅ已ȫƖȮƃ,其次沿用ƈƨ。|总ƃ {ɭ} · ϻ {ɽ} · ̶ {ɏ} · ǯ于 {Ɨ}|ƃǢƱ:{ơ}|未Ǣƃ|Ɩʠƃ|ƕ中…|ƕƃ|ƛ ɇ ƃ|ɝǦ|ɝ ƞ Ξ ƃ|Ɓ官网ʠ页的ǵ˖ƃ。ȫ ʸrhythm.γ,在ȩ开发者ϕ → 网络̃ʠȄ的 ̕,或在存储 / ͇̃ tr_Ɖ 值,ώˋƨ并lj。̕ 仅存 ʺ ƨ库;̑重新̓。|ɝ̼ / ̓ƃ|Ǣ̓中国站˖金。RAM ȗ 需 bss:Ǚ Ϣ。前两项必填;STS 才需 ̛ ƞ。ȣ存ƨ库。|extract ͍点͝、数值和 add/̰/Τ 运算;Λ Ƈ 除以 500000 得到ɟ。|̵ʏ|ϴʏ|Ȅ URL|͍ ̘、本机 ͪ,以及 //… 相对͝(ƚϽ ʺ ˢ)。|π非回环 ͪ(ƨ明文传输;须将准确的 ȟ:ˢ 加入ɮ)|+ ǐ ʜ|ǐ 预设ȅ活跃Ȯ池Ǫʜ,Ȁ管理后台 X-Admin-ƞ(ιƈ Ƕ ͞)。请̓˘͂与ˢ;令牌̑ǯƨ。|Ȅ方法|Ȅ头 (ɳ)|Ȅ体 (ɳ)|Ǔ不̾;ɳ 原文Lj并̾。ȉ ɰ 为 ʩ/json,ʎȄ头ʞ。|解析϶ (ɳ)|ƛƃƁǜ|ƕȰ (ǝ)|ƃ原Ǡ|按ƁǠ͋(Ί ƃ)|ȀƁ͕与͚;ƃǠο端点原Ǡ。̷Ǡ及ʜ不͋。|ƃ {Ƃ}|˙ƺ {Ƃ}|ƺ {Ƃ}|ƃȯ (蓝=ƃ,橙=˙,灰=ƺ)|ȯɚ|各组ȯ可͗ˤ填充ɚ:「Ǫɚ」满̌、随ɜ递减;「ƺɚ」空̌、随ɜ填满。|ƃ条(Ɩ/ƛ)|Ɲ条|Go ƀ条|Ƒ / ǔ ƀ条|Ǫɚ(满 → 空)|ƺɚ(空 → 满)|ƀη (ȁ)|Ǔ则ˍȀ Ƕ 返回的 max_ǃ;仍无则Ɓ整条浅蓝|ɳ ͓无效|{{Љ_NAME}} 从ƨ库或ʚȅ。<Ή>_Ƕ_І 中 Ή 为大写 ɇ ID,Ϯ改下划线,如 Ϊ→Μ_Ƕ_І。χ共用ȣ。|ƨɮ (Ȗ)|Ȅ头带ȣ时仅ϝ̹内ȟ,Ǔ则ϝ并警告,防ʒ他人Ǧ外带ȣ。|ƨƍ|为ɐ {{Љ}} ̅存入ȣ(̳-ȹ,̿ƨ库,不ϋ):|Ȅ头还没有 {{Љ}} ̅:ώ如 "ɡ": "Beʫr {{MY_Ƕ_І}}" 后ʡ会出现ƨƍ框。|lj|Ǫ {ȝ} · ƺ {spend} / ƀ {maxǘ} · ǯ于 {Ɨ}|Ǫ {Ƃ}|ƕƛƃ|Ɛ DZƀ|Go|ʖ 5 ǫ|͑|Ȃ|ʣ:{Ɨ}|已到ʣǮ|Ǫ {d}天{h}ǫ|Ǫ {h}ǫ{m}分|Ǫ {m}ǝ|ƺ {ά}%|Ǫ {ά}%|{}%|ǯ于 {Ɨ}|Go ƀƁǜ|Go ƀƕȰ(ǝ)|ǝ|Ɛ Ƕ ͞(ȁ,Ǔƚ̽)|Go ƀ主˞|Go NJ|已Ǧ(ɛ:{ǿ})|未Ǧ|Lj|ˣƨ|Ȫ|Lj中…|ȣ只ʌ ʺ ƨ库,不Lj在ǥ里,也̴ϋ。|以下ȣξǒǥ,未迁入ƨ库。请ϒϑʚ后重启:|ƝNJ|ƕƀ|未Ǣƀ|˲(ʼ/Max)|Z.ai / 智谱 GLM ǧ Ƒ|ɴ ƞ Ƒ|ɴ Ƒ|Ǣύ(̘)|ǓƚˤƖ站点。̓后 ͞ 仅发往该ύ;Ȁ可信͂,不含͝。|5h|7d|Ϛ Ɗ ̶页(plat˹m.̠.К/ƾ)|͢ (ǔ) ƀ|5h ƀ|周ƀ|{Ɨ} ʣ|未取得ƀ,请lj并ȫ ǔ Ϝ;ʙϿ|Ɓ ǔ ƀ(需ȫ ǔ Ϝ)|在ʉƁ ǔ ƀ|在ƍ区Ɓ ǔ ƀ|本Ɔƅσ̆|ȧƀǡ|Ɓǜ|选「̄Ƣ / λ」后Ɓƀɑ;窄栏ƁȬ。|Ƕ ͞(ȁ,Ǔƚ̽)|ƕȰ(ǝ)|ƕ|ȫ|ȫ中…|未Ǣƀ|ЅЙxyǶ ϲƀ|ɝɛ|ɛʏ|̔|Ɓǜ|ƕȰ(ǝ)|ƨɮ(ȟ:ˢ,Ȗ)|ʾ ͞(̿)|Ϩ|不͍的 ɇ|˝|未̽Ȯ|抓取于 {Ɨ}|ˑȮ (nj: {Ǐ})|只Ɓ Θ ƀ|ƕ|先˓lj̒|lj并LjƁǜ́ƕ|̺|˓lj后会排到最上面;点ʏ可ɖ该项自己的Ǧ。ƛƃ͐ 8 条,ϲɛ͐ 4 条。|未lj。Nj后ϓƕȰǢ该˕的 ȳ ƀ并Ɓ在ʡ。|Nj后ȅ Ɛ 的ʖ 5 ǫ、周、月ƀ,Ɓ在ʉ、Ʀ页及Ǘ;无DZ时ǭυ。|ǗƁ(Ѝ)|在ǗƁ Ɛ ƀ / Ɲ|ʖ 5 ǫƀ|͑ƀ|Ȃƀ|Ɲƺ%|5h|周|月|日|Ɲ|ǥȅƱ:{ơ}|正在ȅǥ…|ǥ不˖|ưƱ:{ơ}|Ƹǣ已Ȫ。|ȪƱ:{ơ}|Ǭʟ已Ȣ,按˗ƄƏ|尚未ˠ(ˠǮ:{Ɨ}),nj按˗ƄƏ|njϏ峰Ƴ,按ƹ价Ə|nj为 Ɗ ƹ高价Ƴ,按ƹ价Ə|njϏ谷Ƴ,按Ǥ价Ə|ɓƳ——全Ȇ(周六及周日ː按Ǥ价Ə)|ɓƳ——全Ȇ|ɓ全谷|ȕ——ːȆ|ȕ——全Ȇ|假日|ȕ(̻ȥ,Ȗ)|自 2026-08-23 ̻Ǯ 00:00 起,ɓ和Ư;调休上班的ɓ仍按Ȇ。|ƹ|ϖ|ǬƳ条Ϥ|简洁(单行ϰ)|经典(分段与胶囊芯片)|峰/谷ˑ前͈ə|提前ə(ǝ,1-30)|əϯ|ȇƹ|ȇǤ|峰和谷|τȇƹ|τȇǤ|约 {Ɨ} 后Ə˞ˑ为{phase}价,请注意本ƳƠ成本。|ƹ|Ǥ|̎|峰价ə|Ȇə|͈ǜ|Ǘ|ϔ中心|ư̾系统Ͼ|Ϙ后͜ȩ͂栏πϾϢ,才能在页面最小化/切走时收到ə。|ʤ͈|ʤ ȇ峰|ʤ ȇ谷|(ʤ)|Ǭʟ与ǭ|ǭ已Ȉ:需ljǬʟ并Nj「Ʋ」。|常规|Ƭ与Ǡ|ƢƁ|͙ʉƁ|精简ɑ,ʊƬ、ƀ和͊详情;高度͐占ϔ 38%,ϼ可ʖ。Ȣ后Ȥ。|试试更轻巧的ʉ|͙Ɓ可以为Ɔ̹留出更多空间。要ϩNj吗?νʎ「Ʀ → ƅ → Ɓ」中ˑ。|Nj͙Ɓ|ʊnjƁ|Ʀ未能Lj。可Ͽ,或Ȣǭ后在Ʀ中ϸ。|Ȣǭ|ƥ / {Ǒ}Ɲ|ƢȯϤ|͒|ϰ(两列)|Ȥ已ʝ的ƈ ({˪})|ʝ会Ȫɗ映射并Ȉ此行,可Ȥ;̴̺ƫǣ,ʐ按ƚǞ϶ʟ。|Ǘ角标|NJ|ɒɘ|未核价|已ƛ|这个Ƅ是你ɗ改过的,ƚư̴ʞ它。|Ȥƚư|按ƈǰ(ʸ 与ƅ)|ʉƈϳ|{n} ƈ|其它|Ɓƈϳɑ|ȉɖ|记住ɖϨ|Ɓ ƞ|Ɓƅ占比条|ǗƁ Щ-1 ƈ|ȉʑ|收起摘要|ɑǜ|ƈ行数(1–10)|ƕȰ(10–60 秒)|ʑϙ与ƈ数|Щ-1 ƈ与Ƭ|顶部|ƃν|ϗ|ƥ|近 90 天|ƅ排行|ƞ ɜ|Ǝǟ率|̋?|长Ơ无Ǝǟ:代理̀ʝƎϐ。Ƭ按全未ǟ计,是ζ;可直连核对。|̈ · 每ɟ ʸ 数|ƍ|Ǝ|ƻ|该Ƴȧƫǡ。|综合ʍ {ƽ}/M|ǟ率=Ǝ读÷(Ǝ读+普通ƍ);「̋?」表示Ǝϐ̀ϱ,Ƭ为ζ。ʍ=ƅ÷ʸ×1M;̈=ʸ÷ƅ。|未分ƈ(ϟǡ · 按当时ǣƏ)|本Ɔ {Ƃ}(Ƕ)· Ƒ ɞ {Ǿ} · ǟ {ɾ} · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ}|本Ɔ {Ƃ}(Ƕ)· Ƒ ɞ {Ǿ}|ƅ {Ƃ}(+Ƒ)|Ƒ DZƀɜ(ɞ){Ƃ}|ƞ Ƒ ƫǰ(每 1% 与͖Ƞ)|尚无 ǧ Ƒ ƀǡ;͜「ƀ」页Nj并ƕ˕。|͘|ƺ %|本ʑ˘(ǒǥ)|每 1% ƀ ≈|͖ 100% ≈|ʣ {Ɨ}|˥差分|njƫ͋|ϥκ|{ɿ}(基准 {Ɨ})|读数͚受限|Ƒ ƫ曲线(按ʢ聚合)|͔|每周|每月|˥κ:至少两次成功ƕ,且ƀȬφ变化。|{ɻ}:͖估计 ≈ {̢}(每 1% ≈ {Ч1})· ˘ {ƙ} / {Ʒ} · {Džs} 个ʢ|Ƭ是Ϭ价ɞ;DZ耗ƀ,Ɲ只计 Ƕ。Ƞ仅含 dsh Ơ;服务端Ȭ含全Ȯ。短时ϥ͚有限;5h ʖ,周/月按ǒ日历。|Ə方式|Ƒ DZ|ƚ|Ƕ ϛ|在ƅƦϭƁ|仅控制是否在ƅƄ表ϭƁ;不˚ɘ和Ə。ɒ˓后ξƄ表内,可随时改回。|ɖ˕可ˣƄ;ɒɘ的ʋƈʎˋȤ。|̸Ʀˏ|可ƍ 2 × 0.8|ˎˏ会ư到本ƈȡʍ|仅ˎ̒的ˏ;ɒ˓Ȥ统一ˏ|请ƍ非负ʍ或乘法,例如 2 × 0.8|˝ƈ名ƚǞ|ƚ(去ω / 前缀 / 家族相似)|仅͛Ǟ|ɗ指定ˍ;ƚǞ只接受χ及ȥ、ϧ、ε文ω。未ǟ的 Ɗ 用ȉ价,̷˟不ʟ。|待Ǟ与ɗƦ|按˟和ƈ̸Ʀ:ˤƄ̏、ƛƄ,或标记为ǒƈ。ƛƄ只ˡnj˟。|Ɗ ȉ价|ʝ|ǒƈ(零ɜ)|已ǞƄ的ƈ|njȀƚǞ。可改选Ƅ̏、ƛƄ或零ƅ;Lj后移入ɐɗƦ区。ƞ 仍会ǰ。|οƚǟ|ȧɗǞʞ。|已ɘ(参与Ə)|ƍ|Ǝȅ|Ǝʌ|Ǔ时按Ǝȅ价Ə|ƻ|Ɗ Ƅ表(已ɘ)|Ι / ̙|ʿ|ʨ 硅基流动|CommƼCode|SCNet 超算互联网 ƞ Ƒ|ʘ Ȳ ǧ Ƒ|̼ ͯ ƞ Ƒ|小米 MiMo ƞ Ƒ|ͧ (Droid)|Ƙ|Ƙ ̇ ID|仅在 ʺ Ơ Ƙ Ƕ 也可Ə,无需ɕ Ƙ ͇。远端ƀǢ另需 Ƙ Cloud 的̇ ID 与 ʥ(ι͌ Ƕ ͞);未Ǧ时可Ȣƀɑ,ƆƏ照常。͘ͅ与ЀςƁ。公开ϬƄˡ Ƒ ɞȠ;Ѐ扣费͜Ə分类中设为 Ƕ。|ƀϯ|StƼard + Core|组织 ID(ȁ)|ͅʜ|补偿ʜ|ƃ|ƀɛ|ǒȠ|Ɩ Ѕ|ϫ Ѕ|Ѕ 模式需在 ʺ ȟɕ @ɪ/ʷ,并ǁ ǻ。|ϫ Ѕ:在 ʺ ȟɕ ʭ。ȫ按钮会在该ȟϚ授权ȩ;远程或无Ϫȟ请ǁ bl ǻ --ɹ。|ϡ Ǎ ƀ(个人版 Lite 5 万 / ͒版 50 万,以DZ页μ)|DZ̐(ȁ,͓ Ǻ;Ǔʔ)|Ǎ ̉ʞ(ȁ;每百万 ʸ 抵扣的 Ǎ,Ǔ用ʋ表)|ƈ名,如 qwen3.8-ʵ|费率|ƍ|Ǝ读|ƻ|待填齐三项正数后ƚLj;ȡ清空Ȥʋ表。|ɝ|Ǎ ǒȠ,以̊μ。ǰ归属̼ͅ的 Ƒ Ơ;ˌϛ Ƕ。ϵƈ需设̉。|ǒȠϡ Ǎ ƀ(˗ 60,000 / ͒ 240,000 / 高级 600,000)|DZ̐(ȁ,͓ Ǻ;Ǔʔ)|ˍ用 24 ǫ内的͉̊,否则按ǒǥ和Ɩ Ǎ 表Ƞ。̷ϕ和ϵƈˌ入。|ʗ ȗ ID|ʗ Secretȗ|ʘ需 AK/SK、Ȋ 和 ƿ;可填ƨ或ϒ Π_˱/Π_˴。只连接 Ц.ɤ.К。|AK...|SK...|{h}ǫ|{h}ǫ{m}分|{m}ǝ|{Ɨ}后ȇϖ|{Ɨ}后ȇ高峰|峰Ƴ(UTC):{ʇ};ˠǮ:{Ɨ}。{ˉ}|未ǦǬƳ。{ˉ}|˝|ƥƅ|Ȃƅ|ȭƅ|自ǥ建立以来 · Ơ {ƶ} 次|̈́ƫ|ʺ + ̈́合计|͉̈́超过 24 ǫ未ǯ|近期͔ǣ|Ƭ取Ϡ͉,̀比ƖϹ晚几ǝ。ƙ 含ƍ、ƻ、Ǝ和͌;͌并入ƻƏ。以Ƭ͆。|ƥ/Ȃ按宿主͏ {ʳ},ȩ为 {Ȏ}。͏不同会˚日界和͆;可将 dsh 改为ǒ͏。|ƥƆ|ʙȥ行可ɖ˙ƆȦ|ƆȦ˒中…|该日无ƆȦ(ϟǡ或Ɔ˜已清理)|ƆȦ˒Ʊ|按Ɔǰ(ȡƸ)|跨天合并,̆按Ϙ归并。仅列选定ϣ,ȭƅσȡ对话。|ȧƆǡ|Ɔʕ中…|ƆʕƱ|Ɓϣ|Ɔ̹附显Ɔ ID|Ƭ含 Ƒ ϙ|Nj后所有Ƭ按含 Ƒ DZɞ的总ƅ展示;Ȣ(ȉ)仅计真金白银 Ƕ ˟|ȈƖʠƃ(Nj后Ƣ与Ʀ页θƁƖƃ)|ȈƥɜƬ(Nj后Ƣ/ƝȦ/ϦɑθƁƥƅ)|Ȉ̍ƅȦρ|Ȉƍ框ˋƅȦρ|Ȉ每轮回复ψ本轮ƅ|排序|ƅ 高→低|ƅ 低→高|Ǯ 新→旧|Ǯ 旧→新|实时顺序|Ƹǣ|ƞ ƫǰ|ȭ {ƙ} ƙ · ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ} · {ƶ} 次Ơ|{ɻ}:共 {ƙ} ƙ(ƍ {ƣ} · Ǝ {ƪ} · ƻ {Ƥ})· {ƶ} 次Ơ · {Ʒ}|ȧƸǡ,ȼ͔ƫ会Ƚ|ƫ|ƞ ƫǰǜ|ƅƦ|通用Ʀ|͗分节(ƫ)|ƁƦ|Ϧ|ƀ|ƫ|Ƅ|Ɓ|Ƹǡ|ƆƅƁǜ|ƍ区ˋ|Ɔ̍|Ȣ|ƍȨƀȃ|ljƀȃ(ƍȨ一条横排Ɓ)|ȃ含Ɲƺ%|ȃ含 Go ƀ|ȃ含 ǧ Ƒ ƀ|ȃ͊可见各͘ʣ͎与ǯǮ;无˖ƀǡ时ƚȈ。|Ϟ:ƍȨƀȃ|在ƍȨƁƝ及 Ɛ/ǧ Ƒ ƀȬ。ϩNj吗?ʎ「Ʀ → ƁƦ」ˎ。|Njȃ|暂不Nj|ʙ立即ƕ|Ϟ:ƃɔʙƕ|ʙƢƃ或 ǧ Ƒ ɔ即可ƕ;ƕ时ɔ闪烁,Ʊ时ʊ原值并在͊ǭ中说明υ。|̎|˙ƅƁ|Ƣϗ|Ϻ单位|ǵ Ζ|ɟ Ί|欧元 EUR|ϺϮ|͕(1 ɟ = ? 目标Ǡ)|小数位数|ƃƁǜ|̄Ƣ|Ʀ页|λ都Ɓ|ƃƕȰ(ǝ)|lj Ɗ ǬƳƄ|Ʋ(ƢƝ框/ƥƅ;Ʀ页Ǭ面板内ʤ)|Ɔ按Ơ时ƄƏ(含Ǭ与Ƹ˞)。ƍ、ƻ、Ǝ读写ςǰ;͗Ǝʌ价与长ε˛位按Ǧˠ。|已ɘ的Ƅ表|ƖƄǠ|ɟ(ϴƖ页)|ǵ(̵Ɩ页)|决定ưƄ所用的Ɩ页Ϸ;ưψƄˡʐƠ。|Й 与 ʦ ̸按ƖʍƏ,旧 ʦ ʏ按 ʦ 价结算。工作日̻Ǯ 09–12、14–18 为峰Ƴ,ɓ及Ư。改价ˡʐƠ,已ǣƬʊ;修正旧ƅ请ʛ后ȀƸ重算。Ǝʌ按ǟ价。|ʡƁnj适用Ƅ。手工ˣ会ɒ此条ʐ预定调价,已φ的ƸƄ仍ʊ。|Ȑ(未Ǟƈ时ό)|新ƈ ID(如 ȸ)|ɝƈ|ǡ与ư|Lj中…|ƚLjƱ:{ơ}|已ƚLj {Ɨ}|Ǧˎ后ƚLj|ʛ用Ɩ˛ƄʞƄ表?|͇|ɒ|从Ɩ˛ưƄ|Ɩư只ǯ Ɗ Ƅ(含Ǭ);z-ai/Ι/ͯ/ɀ 等第三方Ƅ随ϧǯ,ʎƄ表ɖϑ˕ˣ,或用ƈ名Ǟϸ。|ʛȪȡƸ?|ȻƸ|ʛʒ?将ϊȡƆ˜,只补ǥϱ的ȥ与Ɔ,不˚已有ǣ。|ȻƸƱ:{ơ}|首次启动ƚʒ旧ǣ;拷入˜́重跑。按njƄ回推;已̺˜无法ϊ,跨ɕ͎的Ɔˌ此前ƫ。|ʛȪ|ȪȡƸ|Ϡư:{Ɨ}|从未(ȀʋƄ)|;ɛ:{ǿ}|Ɩ˛|ʋȉ|ϪϷ|Ͻ ʺ(ƚ)|简体̵|ɲ|ƅ|{ɿ} ƠƱ|ưƠƱ|ƃƕƠƱ'],["en",`ɂ of Ȟ Ɖ (Ǽ ˅ Џ c˶ Ɨ)|Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|Ƿ: ̩ {̩} · ̳ {̳} (̳s Ǽ at Ɵ hit ƽ)|ɂ {Ƃ}|ɶ Ɖ {Ƃ} · Hit {ɾ} · Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|ɶ Ɖ {Ƃ}|ɢ Ƃ ȹ|UnΏed|Ζ ɭs ̂ Ί Ɣ × {ʁ}. To Кpʫ ƌ Ζ bills, β Ζ, Ɵn δ Ɣ; δing affects ȹ new ƶ.|Ʃ Α ǚ: {ơ}|˧ error|Ʃ|Query ǚ|Ɗ Ц-plat˹m Ǐ ƒ|Cross-check ƌ ƒ ˄s against Ɵ Ȓ (warn ̱ Ɵy diverge)|Total {Ƃ}|ͩ {ɽ} · ˵ {ɏ}|ɷ {Ɨ}|ǘ ({Ǒ})|ͱ {ʆ} / {Ƃ}|ȱ {Ƃ} · {ά} of ǃ|ɶ ǹ {ǹ} · Л Ɨ {ɭ}|ǘ|ȱ's Ʒ (Ǽ ˅ ƌ Ɣ)|ȱ's ʸ ƾ|ƙ|C˶s {ƶ} · Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|ɶ ǹ {Ƃ}|Л Ɨ {Ƃ}|ȱ|ȿ ˰ Ɠ|ɂ|ƞ ƾ|ȱ|ɶ ǹ|Л Ɨ|ɱ ̨|No Ǜ З. Once you Γ chatting, Ʒs ʫ ˃ ͺ Ч Ќ.|Date|C˶s|In Е|Ƿ Е|Out Е|ɂ|No Ɖs ̪ ˰.|ɵ|ƭ ǃ|ǘ Ƃ (in Ɠ DŽ)|ǘ Ǒ|Start ɻ|End ɻ (Ǹ = ˰)|Range: {̨}|ƭ a ǃ to see У Ώ, ʆ Ƃ Ƽ ˈ in Ɵ Ɠ DŽ. Choose ˰, ǹ, ˶ Ɨ or a Ɋ ̨.|{Ǒ} ǃ {Ƃ} · ͱ {ʆ} · {ά}%| (over Ώ)| (near Ώ)|Legacy|ͥ f˶Р|ˀ|Base|Ȍ|ʧ|Ʃ Ƕ ͽ|ɶ Open Plat˹m ͽ takes ̥; oƟrwise Ɵ ˿ ƌ Ǐ ƒ is ̩, Ɵn Ǖ Ƨs.|Total {ɭ} · ͩ {ɽ} · ˵ {ɏ} · ɷ {Ɨ}|Ʃ Α ǚ: {ơ}|Ʃ Ϳ queried|Ac˪ ƒ|ǎing…|ǎ ƒ|ɱ ̧ ƒ|Ё entry|Ё ƞ Ξ ƒ|ɢs available Ζ ƒ ɼ Ɵ ƌ Ǐ ˺. Sign in at ʸrhythm.γ. In Ȏ DevTools, copy Ɵ Ǐ request ̕ ɼ Network, or Ɵ tr_Ɖ Ε ɼ Storage / Application. О it beЪ Ƽ Υ Ȟ Ͷ. ̕s ̀ in Ɵ ʺ Ƨ ̯; Ɵm ̱ expired.|Ё Qianwen / ɠ ƒ|ɢs ɠ China funds. RAM ȗ needs bss:Ǚ. The Ύ two Φ ʫ ΄d; ̛ ƞ is ˹ STS. Secrets ̀ in Ɵ Ƨ ̯.|ͦ Ͳ paths, numbers Ƽ add/̰/Τ. Divide Λ Ƈ by 500000 ˹ Ί.|Dz ;|ɲ ;|Ͱ URL|Supήs ̘, ȴ ͪ Ƽ //… paths Д ̡ Ɵ ȏ ʺ ή.|Лow non-loopР ͪ (plaintext Ƨs; ̫ Ɵ exact ʳ:ή in ˶owed ʳs)|+ ǐ dz|The ǐ preset ˯ ȝ dz across Ρ Ǐs using an admin X-Admin-ƞ, Ϳ a Ǖ Ƕ ͽ. Set Ɵ ̞ ˩ Ƽ ή; Ɵ Ƨ ̱ it expires.|ͪ ɿ|Headers (ɳ)|Ͱ body (ɳ)|Blank sends no body; ɳ text is Β Ƽ sent as entered. ɰ Ȑs to ʩ/json; ˫ С ̤ it.|ͦ rules (ɳ)|ɱ ƒ Ɠ|Ʈ (Ǵ)|̜ DŽ|Convert Ί ƒ to Ɠ DŽ|Uses Ɵ Ɠ ʁ Ƽ ˼. Ї Ɵ ǿ DŽ; oƟr currencies Ƽ dz ɍ.|Ʃ {Ƃ}|ȱ {Ƃ}|Spent {Ƃ}|Ʃ ̦ Ђ (blue=ƒ, ǫ=˰, gray=spent)|Йgress Ђ ˸|Each group of Ђs С independently choose У fill ˸: "Ț" Γs ̢ Ƽ drains ˊ ƾ; "ͱ" Γs Ǹ Ƽ fills up.|Ʃ Ђs (ƌ/Ɋ)|ǘ Ђ|Go Ƈ Ђ|Ƒ / ǔ Ƈ Ђs|Ț (̢ → Ǹ)|ͱ (Ǹ → ̢)|ǘ cap (ǖ)|Leave Ǹ to ̂ Ƕ max_ǃ; if still ˭, Г ̢ light-blue Ђ|Invalid ɳ|{{Љ_NAME}} ˯ a Ƨ or ʰ variable. <Ή>_Ƕ_І ̂s an upЧcase ɇ ID ˊ underscores, such as Ϊ→Μ_Ƕ_І. Names С shʫ a ͽ.|Лowed ʳs (ȷ)|Њ ˫ carry Ƨs ȹ listed ʳs ʫ ˶owed; А Ǹ to ˶ow ˊ a warning. Йtects ͽs ̱ Χing someone else's config.|ʽ ƣ|Store Ɵ ͽ ˹ Џ {{Љ}} placehХer ɦ (̳-ȹ: ̯d in Ɵ ʺ Ƨ ̯, ȓ):|No {{Љ}} placehХers in Ɵ ˫ З — add e.g. "ɡ": "Beʫr {{MY_Ƕ_І}}" Ƽ a Ƨ ƣ Ж appear ͺ.|ƭ|Ț {ȝ} · Spent {spend} / ǘ {maxǘ} · ɷ {Ɨ}|Ț {Ƃ}|ǎ Ɋ ƒ|Ɛ Ȕ Ƈ|Go|Rolling 5h|˂|Ⱦ|Resets: {Ɨ}|Reset Ɨ rЏed|{d}d {h}h Б|{h}h {m}m Б|{m}m Б|{ά}% ʆ|{ά}% ȝ|{}%|ɷ {Ɨ}|Go Ƈ Ɠ dž|Go Ƈ Ƶ Dž (Ǵ)|min|Ɛ Ƕ ͽ (ǖ; Ǹ = ʬ)|Go Ƈ primary ̲|Go Ѓ ƴ|Configured (ǿ: {ǿ})|Н ǽ|О|Edit Ƨ|Clear|Ο…|The ͽ is written to Ɵ ʺ Ƨ ̯ ȹ — it is never Β in Ɵ Ȝ Ƽ ȓ.|These Ƨs ΰ in Ɵ Ȓ. Exή Ɵ ʴ ʰ variables Ƽ reΓ:|ǘ Ѓ ƴ|ǎ Ƈ|ȍ|˲ (ʼ/Max)|Z.ai / Zhipu GLM ǧ Ƒ|ɴ ƞ Ƒ|ɴ Ƒ|ɥ Ϋ (̘)|Empty: ƌ sites. OƟrwise Ɵ ͞ is sent ȹ to Ȟ Ϋ. Use a trusted ˩ ˊout a path.|5h|7d|Open Ɗ top-up ˺ (plat˹m.̠.К/ƾ)|͢ (ǔ) Ƈ|5h Ƈ|˂ Ƈ|α {Ɨ}|ɥ ʹ. ƭ Ƽ sign in to a ǔ έ; Ό to retry.|ɢ ǔ Ƈ (̫ a ˿ ǔ έ)|ɢ ǔ Ƈ in ǀ|ɢ ǔ Ƈ ɦ ʮ|ͬ ́ in Ɖ Ʒ|No Ƈ ʯ|ȋ dž|“Main ǀ / Є” ̭ a Ƈ Ͷ; Ɵ narЫ rail ̭ ȵ.|Ƕ ͽ (ǖ; Ǹ = ʬ)|Ʈ (Ǵ)|ǎ|Login|Signing in…|ȍ|ЅЙxyǶ Ƈs|Ё ǿ|̜ label|̔|ȋ|Ʈ (Ǵ)|ʽ ˶owlist (ʳ:ή, ȷ)|ʾ ͽ (̳-ȹ)|Status|Unsupήed ˽|˧|No Ǐs|fetched {Ɨ}|Switch Ǐ (ȏ: {Ǐ})|Θ Ƈ ȹ|ǎ|ƭ Ȟ item Ύ|ƭ Ƽ Ш a Ɠ dž to Ƶ|ˀ|ƭd items move to Ɵ top; Ό a ; to expƼ У own LJ. Up to 8 Ɋ ƒs Ƽ 4 ǿs.|Disabled. ƭ it to Α Ȟ vendor's ȳ Ƈ on Ɵ Ƶ Dž Ƽ Г it ͺ.|ƭ Ɛ rolling 5h, weekly Ƽ ǹly Ƈs in Ɵ ǀ, ǂ Ƽ ɸ . Missing Ȕs Г a ί.|ɯ (Ѝ) Ɠ|ɢ Ɛ Ƈ / ǃ at Ɵ ɸ|Rolling-5h Ƈ|˂ Ƈ|Ⱦ Ƈ|ǘ ʆ %|5h|Wk|Mo|Daily|ǘ|Κ ̩ ǚ: {ơ}|Reading Ȝ…|Κ ʹ|Ј ǚ: {ơ}|˦ cleʫd.|Clear ǚ: {ơ}|ʧ/Ƌ Ɂ is off; base Ɣ ʫ ʆ|Н З ɧ (ɧ at {Ɨ}); base Ɣ ʫ ȏly ʆ|ʧ hour В; Ⱥ Ɣ ʪ|Ɗ Ⱥ-hour Ɂ is Ρ; ȏ ƶ ʫ Ǽ at Ⱥ Ɣ|Ȍ В; Ƌ Ɣ ʪ|˨ — ˶ Ƌ (Sat & Sun Ǽ at Ƌ Ɣ ˶ Ќ)|˨ — ˶ Ƌ|˨|Dz public ͻ — Ƌ ˶ Ќ|̚ ͻ — ˶ Ƌ|HoliЌ|̚ ͻs (͠ ɻs, Кma sepaʁd)|Since Aug 23, 2026 (͠ Ɨ), Ɯ Ƌ ˶ Ќ, ț work-shift weekends.|ʧ|Ȍ|ʧ Ǒ ɫ style|ͣ (one-line)|Classic (segments & Т)|Popup be˹e Ⱥ/Ƌ switch|Lead Ɨ (Ǵ, 1-30)|Alert type|Ƀ Ⱥ|Ƀ Ƌ|Є|Ƀ Ⱥ ˆ|Ƀ Ƌ ˆ|͡ switches to {phase} Ɂ in about {Ɨ}; mind И c˶ Ʒs in Ȟ ̲.|Ⱥ|Ƌ|Got it|ʧ |Ȍ |Popup dž|ɯ|Screen center|Also send a system ʀ|Њ Υd, ˶ow ʀ Чmission in Ɵ Ȏ ˩ Ђ so you get ed even ̱ Ɵ ˺ is minimized or Рgrounded.|Preview Ɵ popup|ș Ⱥ|ș Ƌ| (preview)|ʧ/Ƌ Ɂ & ̣|Нice hidden: Υ Ⱥ/Ƌ Ɂ Ƽ Ɵ “prominent ̣” toggle.|ͨ|Money & DŽ|ȿ Ɠ|Simplify Ɵ ǀ|Condense Ͷs but Ф Ƃs, Ƈs Ƽ hover ƴ. Height is capped at 38% of Ɵ viewή ˊ scrolling. Turn off Ɏ.|A lighter ǀ|Simple Ɠ Аs more room ˹ ɺs. ƭ it В? You С ˄ it in ǂ → ɂ → ȋ anyƗ.|ƭ simple Ɠ|Ї ȏ Ɠ|ǂ could Ϳ be Β. Retry or dismiss Ȟ guide Ƽ ˄ Ɵm later in ǂ.|Dismiss guide|ȱ / {Ǒ} ǃ|ȿ ̦ style|StƼard|ͣ (2 columns)|Re̯ ʃ Ǖs ({˪})|ˀ Ћs Ɵ ̤ Ƽ hides Ɵ Ы until ʄd. ̝ ʂ ʫ kept; Пmatic ƽ ʴ ͳ.|Corner Тs|Box ƴ|Unmount|Unƽd|ɱ|You edited Ȟ ƽ manu˶y; ˷ Ж Ϳ over̳ it.|Resume ˷|Per-Ǖ statistics (ƙ & Ʒ)|ȿ Ǖ Ʒs|{n} Ǖs|OƟr|ɢ Ǖ Ʒ Ͷ|ExpƼ by Ȑ|Remember expansion|ɢ ƙ|ɢ Ʒ shʫs|Щ Ǖ in Ѝ|ͥ Ǒ|Collapsed summary|Card dž|Model Ыs (1–10)|Ʈ (10–60 seconds)|Period ɭ Ƽ Ǖ ˪|Щ Ǖ Ƽ Ʒ|Щ|After ƒs|Bottom|ȱ|Last 90 Ќs|ɂ ˮ|ƞ ƾ|Ƿ hit ʁ|unreήed?|Zero ƪ hУ on long ƶ may mean a relay ʃ ƪ Φ. Л-miss Ʒ ȑ; check ˊ Ɵ Σ Ƕ.|Value · ƙ Ч Ί|Ʌ|Ƿ|Ș|No ƾ ʯ ˹ Ȟ Ǒ.|blended {ƽ}/M|Hit ʁ = ƪ ˯ ÷ (˯ + unƪd ƣ). “Unreήed?” means ƪ ʯ may be ˭, so Ʒ ȑ. Unit ƽ = Ʒ ÷ ƙ × 1M; Ε = ƙ ÷ Ʒ.|Unattributed (early ʯ · Ǽ as ̪)|ɶ Ɖ {Ƃ} (Ƕ) · Ƒ . {Ǿ} · Hit {ɾ} · Ʌ {ƣ} · Ƿ {ƪ} · Ș {Ƥ}|ɶ Ɖ {Ƃ} (Ƕ) · Ƒ . {Ǿ}|ɂ {Ƃ} (+Ƒ)|Ƒ Ȕ Ƈ ƾ (.) {Ƃ}|ƞ Ƒ ƾ Δ (Ч-1% & ʲ ɨ)|No ǧ Ƒ Ƈ ʯ З. ƭ Ƽ Ƶ a ̧ under ɥs.|Window|ͱ %|ɶ Ǒ ̞ (Ȓ)|Per 1% Ƈ ≈|Full ̲ (100%) ≈|α {Ɨ}|̬ delta|ȏ ƾ ratio|Ϳ ɋ|{ɿ} (as of {Ɨ})|Ъ ̩ing ˼|Ƒ ƾ curves (˃ ɼ ̬ Džs)|Daily|˂|Ⱦ|Н ɋ: Ƶ success̢y twice ˊ a Ƈ ˈ ˄.|{ɻ}: ʲ est. ≈ {̢} (Ч 1% ≈ {Ч1}) · ̞ {ƙ} / {Ʒ} · {Džs} ̬ Dž(s)|͟ ʫ catalog-ƽ alents. Ƒs ̂ Ƈ; ǃs ˪ Ƕ ȹ. Estimates cover dsh ƶ, while server ȵ cover Ɵ Ǐ. Short ̬s ʫ less precise. 5h rolls; week/ǹ ̂ ȴ ɻs.|͡ class|Ƒ Ȕ|М|Ƕ ƾ|ɢ Σly in ɂ LJ|Controls Σ Ɠ in Ɵ ƽ ɬ; mounting Ƽ ʹ ɍ. Hidden Ͷs ̀ rЏable in Ɵ ɬ.|ExpƼ Ɉ to edit Ɣ; ʄ unmounted ͵ Ǖs beЪ.|Sepaʁ ˇs|Try 2 × 0.8|Changing Ɵ ˇ ͳ to ˶ ǩ ˹ Ȟ Ǖ|Η Ȟ ʁ ȹ; uncheck Ɏ Ɵ shʫd ˇ|· a non-negative ʁ or multiplication, e.g. 2 × 0.8|ʻ ΅ Ǖ ;s|М (ɫ suffix / prefix / family similarity)|Exact ΐ ȹ|Manual ɩ take ̥. ʻ Ͳ ȹ Ɵ same ; or ɻ, version Ƽ context suffixes. ˧ Ɗ Ǖs ̂ Ɵ Ȑ ƽ; oƟr ˽ ̀ unƽd.|Unΐed Ƽ manu˶y ǽ Ǖs|Set Џ ͷ Ƽ Ǖ sepaʁly: β ȶ, ̂ a Ɋ ƽ, or mark as ȴ. ɱ Ɣ ʪ ȹ to Д ͷ.|Ɗ Ȑ ƽ|ˀ|Έ Ǖ (zero Ʒ)|Matched Ǖs|Currently ΐed ɣ. Select ȶ, Ɋ ƽ or zero Ʒ. Оd ˄s move to Ɵ Ω list ɦ; ƙ still ˪.|Ї П ΐ|No Ω ΐ ɩ.|ͮ (Ǽ)|Ʌ|Ƿ ̩|Ƿ ̳|Leave blank to ̂ Ɵ ƪ-̩ ƽ|Ș|Ɗ ƽ ɬ (mounted)|Ι / ̙|ʿ|ʨ|CommƼCode|SCNet ƞ Ƒ|Ȳ ǧ Ƒ|ͯ ƞ Ƒ (ɪ.К)|Xiaomi MiMo ƞ Ƒ|ͧ (Droid)|Ƙ|Ƙ ʈ|Using Ƙ Ƕs in ʺ does Ϳ ΄ inst˶ing Ɵ Ƙ app. Remote Ƈ queries sepaʁly ΄ an Ƙ Cloud ʈ Ƽ ʥ (Ϳ an inference Ƕ ͽ); А Ɵ Ƈ Ͷ off to Ф using ɺ Ʒ tracking ˊout Ɵm. Ƒ ʇ Ƽ w˶et ̀ sepaʁ. ̚ Ɣ ʱ Ƒ-alent Ʒ; classify w˶et-funded ƶ as Ƕ in ʹ LJ.|ɥ pool|StƼard + Core|Organization ID (ǖ)|Ƒ dz|Compensation|Ʃ|ɥ ǿ|Έ ʱ|Ɇ Ѕ|Bailian Ѕ|Inst˶ @ɪ/ʷ on Ɵ ʺ ʳ Ƽ run ǻ as Ɵ ʅ.|Inst˶ ʭ on Ɵ ʺ ʳ. Login Цs Д ʳ’s Ȏ; ˹ a remote or headless ʳ, run bl ǻ --ɹ as Ɵ ʅ.|Ⱦ dz Ƈ (Чsonal Lite 50K / StƼard 500K; see И ˻ ˺)|Ƒ Γ ɻ (ǖ, Ǻ; Ǹ = ̟ ǹ)|Ǎ ʁ ɩ (ǖ; dz deducted Ч 1M ƙ; Ǹ = ɉ)|Model ;, e.g. qwen3.8-ʵ|ʁ|Ʌ|Ƿd ƣ|Ș|· ˶ three positive ǩ to Ш ɣ; Ћ ˶ Ɏ Ɵ ɉ.|Ё|Έ Ǎ ʱ; ɹ is authoritative. Counts Ƒ ƶ assigned to ͯ. Excludes pay-as-you-go Ƕ. Ё ǩ ˹ oƟr Ǖs.|Ⱦ dz Ƈ ˹ ȴ ɨ (Basic 60,000 / StƼard 240,000 / Й 600,000)|Ƒ Γ ɻ (ǖ, Ǻ; Ǹ = ̟ ǹ)|Uses ɹ ̮s newer than 24h, Ɵn ɨ ɼ ȴ ʂ Ƽ ƌ Ǎ ǩ. OƟr tools Ƽ unlisted Ǖs ʫ excluded.|ˁ ȗ ID|ˁ Secretȗ|Ȳ needs AK/SK, Ȋ Ƽ ƿ. · Ƨs or exή Π_˱/Π_˴. Only Ц.ɤ.К is contacted.|AK...|SK...|{h}h|{h}h {m}m|{m}m|Ȍ in {Ɨ}|ʧ in {Ɨ}|ʧ ˬ (UTC): {ʇ}; ɧ: {Ɨ}. {ˉ}|No Ⱥ ʇ ǽ. {ˉ}|΅|ȱ|ɶ ǹ|Л Ɨ|Since Ɵ Ȝ was created · C˶s {ƶ}|̗ ƾ|ʺ + external ɭ|̗ ̮ has Ϳ been upɻd ˹ 24 ˬ|Ν daily ʂ|͟ ̂ Ɵ latest ̮ Ƽ may lag Ɵ ƌ bill by Ǵ. ƞs ͼ ƣ, Ƥ, ƪ Ƽ ˾; ˾ is Ǽ ˊ Ƥ. Reconcile by Ƃ.|ȱ/ǹ ̂ ʳ Ɨzone {ʳ}; Ȟ Ȏ ̂s {Ȏ}. Different Ќ boundaries affect reconciliation. Set dsh to И ȴ Ɨzone to align.|ȱ's Ɖs|Ά a ɻ Ы to expƼ У Ɖ ƴ|ͭ Ɖ ƴ…|No Ɖ ƴ ˹ Ȟ Ќ (early ʯ or Ɖ Ψ cleaned)|Ʉ Ɖ ƴ|By Ɖ (˶ Ǜ)|Days Кbined; ́ ̡ LJ. Selected Ыs Гn; cumulative Ʒs ͼ every ɺ.|No Ɖ ʯ З|ͭ Ɖ ˮ…|Ʉ Ɖ ˮ|Rows|ɢ Ɖ IDs in Ɖ lists|ͬ ˻ ɭs|Њ on, every Ƃ ̭ ɭ alent Ʒ ț ˻ Ȕs; off (Ȑ) ˪s real-money Ƕ ͷs ȹ|ͫ ƌ Ǐ ƒ (ƒ UI ʃ ɼ ǀ Ƽ LJ)|ͫ ˰'s Ʒ (˰'s Ƃ ʃ ɼ ǀ, ǃ ƴ Ƽ overview Ͷ)|ͫ header Ʒ ƴ|ͫ ʮ Ʒ ƴ|ͫ turn Ʒ summaries|Sort|ɂ high→Ъ|ɂ Ъ→high|Time new→Х|Time Х→new|Ν order|˦|ƞ ƾ Δ|Л-Ɨ {ƙ} ƙ · ƣ {ƣ} · ƪ {ƪ} · Ƥ {Ƥ} · {ƶ} ƶ|{ɻ}: {ƙ} ƙ (ƣ {ƣ} · ƪ {ƪ} · Ƥ {Ƥ}) · {ƶ} ƶ · {Ʒ}|No Ǜ З — daily ƾ Ж accumulate ͺ|̝|ƞ ƾ Δ dž|ɂ LJ|ͨ LJ|Own section (̝)|ȋ LJ|Overview|ɥs|̝|Pricing|ȋ|˦ ʯ|ɵ Ʒ Ɠ dž|BeЪ Ɵ ʮ|ɵ title Ђ|Off|ɥ ɫ ɦ Ɵ ƣ|ƭ Ɵ Ƈ ɫ (one Ы ɦ Ɵ ƣ Ѓ)|Ǩ ǃ ʆ %|Ǩ Ɵ Go Ƈ|Ǩ ȳ Ƈs|Hover a Т ˹ reset Ɨs Ƽ Ɵ last Ƶ; Ɵ ɫ hides Уelf ̱ Ɵre is no Ƈ ʯ.|New: Ƈ ɫ ɦ Ɵ ƣ|ɢ ǃ Ƽ Ɛ/coding-˻ ȵ ɦ Ɵ ƣ Ѓ. ƭ В? Η it anyƗ in ǂ → ȋ.|ƭ Ɵ ɫ|Н В|Ά to Ƶ В|New: Ό Ɵ ƒ Ѓ to Ƶ|Ά a ǀ ƒ or ˻ Ѓ to Ƶ. It pulses while loading; on failure it Фs Ɵ Х Ε Ƽ ̭ Ɵ ί on hover.|Got it|ȱ Ʒ Ɠ|ȿ footer|̖|Dz Yuan (Ζ)|US Dollar (Ί)|Euro (EUR)|̖ symbol|Ex˄ ʁ (1 Ί = ? target DŽ)|Decimal places|Ʃ Ɠ dž|Main ǀ|ǂ ˺|Є|Ʃ Ƶ Dž (Ǵ)|Use Ɗ Ⱥ-hour Ɣ|Йminent ̣ during Ⱥ ˬ (ǀ ǃ Ѓ, ˰'s Ʒ; previewed in Ɵ ǂ Ⱥ panel)|ɵ Ʒ ̂s c˶-Ɨ Ɣ, ț Ⱥ Ƽ Ɍ ǩ. Ʌ, Ƥ, ƪ ˯ Ƽ ̳s ʫ sepaʁ; ǽ ƪ-̳ Ƽ long-context ǩ ʪ.|ͮ ƽ ɬs|Ɇ ƽ DŽ|Ί (ɲ ƌ ˺)|Ζ (Dz ƌ ˺)|Selects Ɵ ƌ Ɂ-˺ language. Јed Ɣ ʪ to subsequent ƶ.|Й Ƽ ʦ ̂ sepaʁ ƌ ǩ; legacy ʦ ;s ̂ ʦ ǩ. WeekЌ Ⱥs ʫ 01–04 Ƽ 06–10 UTC; Ɯ Ƌ. Rate ˄s ʪ to later ƶ. Recorded Ƃs ΰ until you confirm Ɍ recalculation. Ƿ ̳s ̂ hit ǩ.|Current ǩ ʫ Гn ͺ. Editing Сcels any future scheduled ˄ ˹ Ȟ entry; Ɍ ǩ ʫ retained.|Ȑ (f˶Р ˹ unΐed Ǖs)|New Ǖ ID (e.g. ȸ)|Ё Ǖ|Data & δ|Ο…|М-Ш ǚ: {ơ}|М-Β {Ɨ}|ǂ ʫ П-Β|Over̳ Ɵ ƽ ɬ ˊ Ɣ ɼ Ɵ ƌ Ў?|Apply|Cancel|Ј Ɣ ɼ ƌ Ў|Ɇ δ upɻs Ɗ Ɣ (ț Ⱥ ǩ). Third-party Ɣ (z-ai/Ι/ͯ/ɀ) ̡ releases; expƼ Ɉ in Ɵ ƽ ɬ or ̂ Ǖ ʴ.|˳ Ǜ?|Imή ʶ Ǜ|ͤ Χ? Replays ˶ Ɖ Ψ Ƽ ȹ fills ɻs/Ɖs ˭ ɼ Ɵ Ȝ; existing ʂ ʫ untouched.|Failed to Χ ʶ Ǜ: {ơ}|Pre-inst˶ Ǜ Χs at Ύ launch; rerun after copying Х Ψ. ɂs ̂ ȏ Ɣ. Deleted Ψ СͿ replay; Ɖs spanning inst˶ation exclude ƾ.|ͤ Ћ|˳ Ǜ|Last δ: {Ɨ}|Never (͵ Ɣ)|; ̜: {ǿ}|Ɇ Ў|Bundled|Language|FolЪ ʺ (П)|Simplified Dz|ɲ|ɂ|{ɿ} c˶ ǚ|Ј c˶ ǚ|Ʃ Ƶ c˶ ǚ`]].map(([e,n])=>{const s=n.replace(/[ƀ-߿]/g,a=>Mn[a.charCodeAt(0)-384]).split("|");return[e,Object.fromEntries(Pn.map((a,o)=>[a,s[o]]).filter(([,a])=>a!=="\0"))]}));function ya(){return(typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language:"").toLowerCase().startsWith("zh")?"zh":"en"}function Ke(e){const n=typeof e=="string"?e.toLowerCase().split(/[-_]/)[0]:"";return n==="zh"||n==="en"?n:null}function H(e){const n=typeof e=="string"?e:e?.locale;return n==="zh"||n==="en"?n:Ke(e?.activeLocale)||ya()}function G(e){const n=e==="zh"?De.zh:De.en;return(s,a)=>{let o=n[s]??De.en[s]??s;if(a)for(const r of Object.keys(a))o=o.split("{"+r+"}").join(String(a[r]));return o}}const ze={day:"periodDay",month:"periodMonth",all:"periodAll",custom:"periodCustomRange"};function ce(e,n){throw new Error("dsh-cost-meter: 服务端数据非法 ("+e+": "+n+")")}function Se(e,n){return(e===null||typeof e!="object"||Array.isArray(e))&&ce(n,"object"),e}function te(e,n){return(typeof e!="number"||!Number.isFinite(e))&&ce(n,"number"),e}function le(e,n){return typeof e!="string"&&ce(n,"string"),e}const He=(e,n,s)=>typeof e=="string"&&n.includes(e)?e:s;function ka(e,n=!1){return e===null||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([s,a])=>n?s.length>0&&["plan","api"].includes(a):["auto","plan","api"].includes(a)))}function Ce(e,n){return typeof e!="boolean"&&ce(n,"boolean"),e}const Ye=(e,n,s)=>Object.fromEntries(n.map(a=>[a,s(e[a])]));function xa(e,n){const s={};if(e!==null&&typeof e=="object"&&!Array.isArray(e))for(const a of Object.keys(e)){const o=e[a];if(o===null||typeof o!="object"||Array.isArray(o))continue;const r=l=>typeof l=="number"&&Number.isFinite(l)&&l>=0?l:0;s[a]={...Tt(o),...Ye(o,["input","output","cacheRead","cacheWrite","reasoning","cost"],r),apiCost:o.apiCost===void 0?r(o.cost):r(o.apiCost)}}return s}const pt=["costCny","apiCostCny","costEur","apiCostEur"],Tt=e=>Object.fromEntries(pt.filter(n=>Number.isFinite(e?.[n])).map(n=>[n,e[n]]));function wa(e,n){Se(e,n);const s={...Tt(e),reasoning:e.reasoning===void 0?0:te(e.reasoning,n+".reasoning"),apiCost:e.apiCost===void 0?void 0:te(e.apiCost,n+".apiCost"),byModel:xa(e.byModel,n+".byModel"),byProviderModel:xa(e.byProviderModel,n+".byProviderModel")};for(const a of["input","output","cacheRead","cacheWrite","calls","cost"])s[a]=te(e[a],n+"."+a);return s}function Tn(e){return e==null?void 0:{source:le(e.source,"source"),requestId:le(e.requestId,"requestId"),attempt:te(e.attempt,"attempt"),complete:Ce(e.complete,"complete"),status:le(e.status,"status"),upstream:le(e.upstream,"upstream")}}function Na(e){return(Array.isArray(e)?e:ce("rows","array")).map(n=>({provider:le(n.provider,"provider"),model:le(n.model,"model"),bucket:le(n.bucket,"bucket"),tokens:te(n.tokens,"tokens"),...n.requests===void 0?{}:{requests:te(n.requests,"requests")},rate:te(n.rate,"rate"),cost:te(n.cost,"cost"),priced:Ce(n.priced,"priced"),plan:Ce(n.plan,"plan")}))}function Rt(e,n){return{...wa(e,n),id:le(e.id,n+".id"),provider:typeof e.provider=="string"?e.provider:"",model:typeof e.model=="string"?e.model:""}}function Ae(e,n){const s={...wa(e,n),date:le(e.date,n+".date"),sessions:[]};return e.sessions!==void 0&&(Array.isArray(e.sessions)||ce(n+".sessions","array"),s.sessions=e.sessions.map((a,o)=>Rt(a,n+".sessions["+o+"]"))),s}function Ot(e,n,s=["cacheWrite","reasoning"]){const a={};for(const o of["cacheHit","cacheMiss","output"])a[o]=te(e[o],n+"."+o);for(const o of s)e[o]!==void 0&&(a[o]=te(e[o],n+"."+o));return a}function Bt(e,n){Se(e,n);const s={...Ot(e,n),...ft(e)};for(const a of["offPeak","peak","legacyBase","longContext"])e[a]!==void 0&&(s[a]=Ot(e[a],n+"."+a,["cacheWrite","reasoning","aboveInputTokens"]));e.cny!==void 0&&(s.cny=Ot(e.cny,n+".cny")),e.legacy!==void 0&&(s.legacy=Ce(e.legacy,n+".legacy")),e.rateHistory!==void 0&&((!Array.isArray(e.rateHistory)||e.rateHistory.length>16)&&ce(n+".rateHistory","price history"),s.rateHistory=e.rateHistory.map((a,o)=>((!a||typeof a.before!="string"||!Number.isFinite(Date.parse(a.before)))&&ce(n+".rateHistory","dated price"),{...Bt({...a,rateHistory:void 0},n+".rateHistory."+o),before:a.before})));for(const a of["billingMode","sourceUrl","checkedAt","notes"])typeof e[a]=="string"&&(s[a]=e[a]);return s}function Rn(e,n){const s=o=>o==null?void 0:{...["aliyun","tokenrhythm"].includes(o.adapter)?{adapter:o.adapter}:{},enabled:o.enabled===!0,label:typeof o.label=="string"?o.label:"",labelEn:typeof o.labelEn=="string"?o.labelEn:"",display:He(o.display,["sidebar","settings","off"],"both"),unit:o.adapter==="tokenrhythm"?"CNY":["CNY","EUR","CREDITS"].includes(o.unit)?o.unit:"USD",convertToDisplayCurrency:o.convertToDisplayCurrency===!0,allowInsecureHttp:o.allowInsecureHttp===!0,refreshMinutes:typeof o.refreshMinutes=="number"&&Number.isFinite(o.refreshMinutes)?o.refreshMinutes:15,request:o.request&&typeof o.request=="object"?o.request:{url:""},extract:o.extract&&typeof o.extract=="object"?o.extract:{},allowedHosts:Array.isArray(o?.allowedHosts)?o.allowedHosts.filter(r=>typeof r=="string"):[]};Se(e,n);const a={};if(e.prices!==null&&typeof e.prices=="object"&&e.prices.models!==null&&typeof e.prices.models=="object")for(const o of Object.keys(e.prices.models))a[o]=Bt(e.prices.models[o],n+".prices.models."+o);return{locale:e.locale==="zh"||e.locale==="en"||e.locale==="auto"?e.locale:"auto",position:e.position==="header"||e.position==="off"?e.position:"dock",sidebar:e.sidebar!==!1,showSessionId:e.showSessionId===!0,hideOfficialBalance:e.hideOfficialBalance===!0,hideBudget:e.hideBudget===!0,hideTodayCost:e.hideTodayCost===!0,modelStatistics:e.modelStatistics??{},...Ye(e,["hideSessionCostHeader","hideSessionCostDock","hideTurnCost"],o=>o===!0),sessionCostCompact:e.sessionCostCompact===!0,contextCostsEnabled:e.contextCostsEnabled===!0,contextCostsPromptSeen:e.contextCostsPromptSeen===!0,sidebarTodayMetric:e.sidebarTodayMetric==="tokens"?"tokens":"cost",statisticsBasis:e.statisticsBasis,showTotalWithPlan:e.showTotalWithPlan===!0,sidebarSimple:e.sidebarSimple===!0,sidebarSimplePromptSeen:e.sidebarSimplePromptSeen===!0,sidebarModels:Object.fromEntries(Object.entries(oa).map(([o,r])=>[o,e.sidebarModels?.[o]??r])),codexQuotaEnabled:e.codexQuotaEnabled===!0,codexQuotaSidebar:e.codexQuotaSidebar!==!1,codexQuotaStrip:e.codexQuotaStrip!==!1,codexQuotaSource:["connect","subscription"].includes(e.codexQuotaSource)?e.codexQuotaSource:"auto",codexCompatPromptDismissed:e.codexCompatPromptDismissed===!0,codexCompatHistoryAppliedAt:be(e.codexCompatHistoryAppliedAt),includeSubagentCost:e.includeSubagentCost===!0,sidebarStyle:e.sidebarStyle==="compact"?"compact":"standard",priceMatchDismissed:Array.isArray(e.priceMatchDismissed)?e.priceMatchDismissed.filter(o=>typeof o=="string"):[],pricingCurrency:e.pricingCurrency==="CNY"?"CNY":"USD",currency:typeof e.currency=="string"?e.currency:"CNY",symbol:typeof e.symbol=="string"?e.symbol:"¥",decimals:te(e.decimals,n+".decimals"),exchangeRate:te(e.exchangeRate,n+".exchangeRate"),exchangeRateAuto:e.exchangeRateAuto!==!1,fxRates:e.fxRates,exchangeRateDate:e.exchangeRateDate??"",exchangeRateCheckedAt:e.exchangeRateCheckedAt??0,peakEnabled:e.peakEnabled===!0,peakEffectiveAt:typeof e.peakEffectiveAt=="string"?e.peakEffectiveAt:"",peakWindows:Array.isArray(e.peakWindows)?e.peakWindows.map((o,r)=>({start:te(o.start,n+".peakWindows["+r+"].start"),end:te(o.end,n+".peakWindows["+r+"].end")})):[],peakHolidays:Array.isArray(e.peakHolidays)?e.peakHolidays.filter(o=>typeof o=="string"):[],peakNotice:e.peakNotice!==!1,peakAlertEnabled:e.peakAlertEnabled!==!1,peakAlertAhead:Number.isFinite(e.peakAlertAhead)&&e.peakAlertAhead>=1&&e.peakAlertAhead<=30?e.peakAlertAhead:2,peakAlertTarget:e.peakAlertTarget==="peak"||e.peakAlertTarget==="offpeak"?e.peakAlertTarget:"both",peakAlertPosition:e.peakAlertPosition==="center"?"center":"corner",peakAlertWebNotify:e.peakAlertWebNotify===!0,peakStyle:["classic","progress"].includes(e.peakStyle)?e.peakStyle:"compact",peakTimeDisplay:["countdown","switch"].includes(e.peakTimeDisplay)?e.peakTimeDisplay:"both",peakProgressPromptSeen:e.peakProgressPromptSeen===!0,priceMatch:e.priceMatch==="exact"?"exact":"auto",priceOverrides:(()=>{const o={};if(e.priceOverrides!==null&&typeof e.priceOverrides=="object"&&!Array.isArray(e.priceOverrides))for(const[r,l]of Object.entries(e.priceOverrides))typeof r=="string"&&typeof l=="string"&&(o[r]=l);return o})(),priceTableDisplay:(()=>{const o={};if(e.priceTableDisplay!==null&&typeof e.priceTableDisplay=="object"&&!Array.isArray(e.priceTableDisplay))for(const[r,l]of Object.entries(e.priceTableDisplay))typeof r=="string"&&(o[r]=l===!0);return o})(),codingPlans:(()=>{const o={};if(e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans))for(const r of Object.keys(e.codingPlans)){const l=e.codingPlans[r];l===null||typeof l!="object"||Array.isArray(l)||(o[r]={enabled:l.enabled===!0,display:l.display==="sidebar"||l.display==="both"||l.display==="off"?l.display:"settings",refreshMinutes:typeof l.refreshMinutes=="number"&&Number.isFinite(l.refreshMinutes)?l.refreshMinutes:15,apiKey:typeof l.apiKey=="string"?l.apiKey:"",...r==="minimax"?{baseUrl:typeof l.baseUrl=="string"?l.baseUrl:""}:{},...r==="factory"?{orgId:typeof l.orgId=="string"?l.orgId:"",factoryPool:["core","both"].includes(l.factoryPool)?l.factoryPool:"standard"}:{},...r==="opendesign"?{workspaceId:typeof l.workspaceId=="string"?l.workspaceId:""}:{},...r==="qwen"?{quotaSource:["cli","bailian"].includes(l.quotaSource)?l.quotaSource:"local"}:{},...typeof l.planCredits=="number"&&Number.isFinite(l.planCredits)&&l.planCredits>0?{planCredits:l.planCredits}:{},...typeof l.planStart=="string"?{planStart:l.planStart}:{},...l.rates!==null&&typeof l.rates=="object"&&!Array.isArray(l.rates)?{rates:l.rates}:{},...typeof l.accessKeyId=="string"?{accessKeyId:l.accessKeyId}:{},...typeof l.secretAccessKey=="string"?{secretAccessKey:l.secretAccessKey}:{}})}return o})(),prices:{models:a,...e.prices?.custom?{custom:e.prices.custom}:{},default:Bt(e.prices?.default??{cacheHit:0,cacheMiss:0,output:0},n+".prices.default"),providers:e.prices?.providers&&typeof e.prices.providers=="object"?e.prices.providers:{},currency:typeof e.prices?.currency=="string"&&e.prices.currency.length>0?e.prices.currency:void 0},historyDays:te(e.historyDays,n+".historyDays"),fetchedAt:e.fetchedAt===null||e.fetchedAt===void 0?null:le(e.fetchedAt,n+".fetchedAt"),priceSource:typeof e.priceSource=="string"?e.priceSource:"bundled",budget:{enabled:e.budget?.enabled===!0,amount:typeof e.budget?.amount=="number"&&Number.isFinite(e.budget.amount)?e.budget.amount:100,period:e.budget?.period==="day"||e.budget?.period==="all"||e.budget?.period==="custom"?e.budget.period:"month",customStart:typeof e.budget?.customStart=="string"?e.budget.customStart:null,customEnd:typeof e.budget?.customEnd=="string"?e.budget.customEnd:null,detail:e.budget?.detail!==!1},balance:{display:He(e.balance?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.balance?.refreshMinutes=="number"&&Number.isFinite(e.balance.refreshMinutes)?e.balance.refreshMinutes:5,showProgressBar:e.balance?.showProgressBar===!0,budgetCap:typeof e.balance?.budgetCap=="number"&&Number.isFinite(e.balance.budgetCap)&&e.balance.budgetCap>0?e.balance.budgetCap:null,clickHintSeen:e.balance?.clickHintSeen===!0},goQuota:{enabled:e.goQuota?.enabled!==!1,display:He(e.goQuota?.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof e.goQuota?.refreshMinutes=="number"&&Number.isFinite(e.goQuota.refreshMinutes)?e.goQuota.refreshMinutes:15,apiKey:typeof e.goQuota?.apiKey=="string"?e.goQuota.apiKey:"",main:e.goQuota?.main==="weekly"||e.goQuota?.main==="monthly"?e.goQuota.main:"rolling",detail:e.goQuota?.detail!==!1},customBalance:s(e.customBalance),gatewayQuotas:(()=>{const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:e.gatewayQuotas?.sources;return{sources:Array.isArray(o)?o.slice(0,4).filter(l=>l!==null&&typeof l=="object"&&!Array.isArray(l)).map(l=>({id:typeof l.id=="string"?l.id.slice(0,48):"",type:"cliproxyapi",label:typeof l.label=="string"?l.label.slice(0,80):"",baseURL:typeof l.baseURL=="string"?l.baseURL:"",enabled:l.enabled!==!1,display:He(l.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof l.refreshMinutes=="number"&&Number.isFinite(l.refreshMinutes)?Math.min(1440,Math.max(1,Math.floor(l.refreshMinutes))):15,includeProviders:Array.isArray(l.includeProviders)?[...new Set(l.includeProviders.filter(i=>typeof i=="string").map(i=>i.toLowerCase()).filter(i=>Et.includes(i)))]:Et,allowedHosts:Array.isArray(l.allowedHosts)?l.allowedHosts.filter(i=>typeof i=="string").slice(0,16):[],allowInsecureHttp:l.allowInsecureHttp===!0,antigravityOnlyGemini:l.antigravityOnlyGemini===!0,keyVar:typeof l.keyVar=="string"?l.keyVar:""})):[]}})(),customBalances:(()=>{if(Array.isArray(e.customBalances))return e.customBalances.filter(r=>r!==null&&typeof r=="object").slice(0,8).map(s).filter(Boolean);const o=s(e.customBalance);return o?[o]:[]})(),corner:{enabled:e.corner?.enabled===!0,goRolling:e.corner?.goRolling!==!1,goWeekly:e.corner?.goWeekly!==!1,goMonthly:e.corner?.goMonthly!==!1,budget:e.corner?.budget!==!1},quotaStrip:{enabled:e.quotaStrip?.enabled===!0,budget:e.quotaStrip?.budget!==!1,go:e.quotaStrip?.go!==!1,plans:e.quotaStrip?.plans!==!1,promptSeen:e.quotaStrip?.promptSeen===!0},usage:{position:e.usage?.position==="general"||e.usage?.position==="section"?e.usage.position:"cost"},barDirections:(()=>{const o=e.barDirections!==null&&typeof e.barDirections=="object"&&!Array.isArray(e.barDirections)?e.barDirections:{},r=(l,i)=>o[l]==="remaining"||o[l]==="used"?o[l]:i;return{balance:r("balance","remaining"),budget:r("budget","used"),go:r("go","used"),plan:r("plan","used")}})(),planBilling:{providers:ka(e.planBilling?.providers),models:ka(e.planBilling?.models,!0),modelPlans:Object.fromEntries(Object.entries(e.planBilling?.modelPlans??{}).filter(([o,r])=>o.includes(":")&&Xe.includes(r)))}}}const Ve=e=>typeof e=="number"&&Number.isFinite(e)?e:null,be=e=>Ve(e)??0,On={status:"off",message:"",fetchedAt:0,currency:"",totalBalance:0,grantedBalance:0,toppedUpBalance:0},Bn={status:"off",message:"",fetchedAt:0,rolling:null,weekly:null,monthly:null},va=(e=null)=>({status:"off",message:"",fetchedAt:0,label:"",unit:"USD",remaining:0,maxBudget:null,spend:null,index:e});function Dt(e,n){return Se(e,n),{status:e.status==="ok"||e.status==="error"?e.status:"off",message:typeof e.message=="string"?e.message:"",fetchedAt:typeof e.fetchedAt=="number"?e.fetchedAt:0}}function Dn(e,n){return{...Dt(e,n),keyConfigured:e.keyConfigured===!0,keySource:typeof e.keySource=="string"?e.keySource:"",currency:typeof e.currency=="string"?e.currency:"",totalBalance:be(e.totalBalance),grantedBalance:be(e.grantedBalance),toppedUpBalance:be(e.toppedUpBalance)}}function Lt(e,n){return e==null?null:((typeof e!="object"||Array.isArray(e))&&ce(n,"object"),{percent:be(e.percent),resetsAt:typeof e.resetsAt=="string"?e.resetsAt:""})}function Ln(e,n){return{...Dt(e,n),rolling:Lt(e.rolling,n+".rolling"),weekly:Lt(e.weekly,n+".weekly"),monthly:Lt(e.monthly,n+".monthly")}}function Sa(e,n){return{...Dt(e,n),label:typeof e.label=="string"?e.label:"",unit:typeof e.unit=="string"?e.unit:"USD",remaining:be(e.remaining),maxBudget:Ve(e.maxBudget),spend:Ve(e.spend),index:typeof e.index=="number"&&Number.isFinite(e.index)&&e.index>=0?Math.floor(e.index):null}}const En=new Set(["ok","partial","unknown","error","stale","unsupported","capability_missing"]),In=new Set(["off","loading","ok","partial","stale","error"]),Et=["antigravity","claude","codex","kimi","xai","workbuddy"],Ca={antigravity:"Antigravity",claude:"Claude",codex:"Codex",kimi:"Kimi",xai:"xAI",workbuddy:"WorkBuddy"};function qn(e,n){Se(e,n);const s=(l,i="")=>typeof l=="string"?l:i,a=l=>Ve(l),o=l=>l!==null&&typeof l=="object"&&!Array.isArray(l)?{id:s(l.id),label:s(l.label),...a(l.percent)===null?{}:{percent:a(l.percent)},resetsAt:s(l.resetsAt),periodHours:a(l.periodHours),scope:s(l.scope)}:null,r=l=>l!==null&&typeof l=="object"&&!Array.isArray(l)?{unit:s(l.unit,"credits"),used:a(l.used),remaining:a(l.remaining),limit:a(l.limit),fetchedAt:s(l.fetchedAt),packages:Array.isArray(l.packages)?l.packages.filter(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)).map(i=>({id:s(i.id),label:s(i.label),used:a(i.used),remaining:a(i.remaining),limit:a(i.limit),startsAt:s(i.startsAt),resetsAt:s(i.resetsAt)})):[]}:void 0;return{id:s(e.id),type:"cliproxyapi",label:s(e.label),status:In.has(e.status)?e.status:"error",message:s(e.message),fetchedAt:a(e.fetchedAt)??0,attemptedAt:a(e.attemptedAt)??0,serverVersion:s(e.serverVersion),keyConfigured:e.keyConfigured===!0,keySource:s(e.keySource,"none"),accounts:Array.isArray(e.accounts)?e.accounts.filter(l=>l!==null&&typeof l=="object"&&!Array.isArray(l)).slice(0,16).map(l=>({id:s(l.id),provider:s(l.provider,"unknown"),label:s(l.label,"unknown"),status:En.has(l.status)?l.status:"unknown",message:s(l.message),plan:s(l.plan),windows:Array.isArray(l.windows)?l.windows.map(o).filter(Boolean):[],credits:r(l.credits)})):[],unsupportedProviders:Array.isArray(e.unsupportedProviders)?e.unsupportedProviders.filter(l=>typeof l=="string").slice(0,32):[]}}function jn(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;const n={};if(e.providers!==null&&typeof e.providers=="object"&&!Array.isArray(e.providers))for(const[s,a]of Object.entries(e.providers)){if(a===null||typeof a!="object"||Array.isArray(a))continue;const o={},r={};if(a.windows!==null&&typeof a.windows=="object"&&!Array.isArray(a.windows))for(const[l,i]of Object.entries(a.windows))i===null||typeof i!="object"||Array.isArray(i)||(o[l]={...Ye(i,["percent","localTokens","localCost","sampleCount"],be),...Ye(i,["sampleAt","per1Tokens","per1Cost","fullTokens","fullCost"],Ve),resetsAt:typeof i.resetsAt=="string"?i.resetsAt:"",method:i.method==="sample"||i.method==="live"?i.method:"none",confidence:i.confidence==="high"||i.confidence==="low"?i.confidence:null});if(a.intervals!==null&&typeof a.intervals=="object"&&!Array.isArray(a.intervals))for(const[l,i]of Object.entries(a.intervals))Array.isArray(i)&&(r[l]=i.filter(d=>d!==null&&typeof d=="object"&&!Array.isArray(d)).map(d=>Ye(d,["t0","t1","tokens","cost","pct","per1Tokens","per1Cost"],be)));n[s]={windows:o,intervals:r}}return{generatedAt:be(e.generatedAt),providers:n}}function Hn(e){if(!e||typeof e!="object"||Array.isArray(e))return;const n=e.usage&&typeof e.usage=="object"?e.usage:{};return{installed:e.installed===!0,enabled:e.enabled===!0,version:typeof e.version=="string"?e.version:"",detection:He(e.detection,["package","profile","none"],"none"),planClass:He(e.planClass,["auto","plan","api"],"auto"),usage:{calls:be(n.calls),cost:be(n.cost),tokens:be(n.tokens),days:be(n.days),providers:(Array.isArray(n.providers)?n.providers:[]).filter(s=>typeof s=="string")},historyAppliedAt:be(e.historyAppliedAt),promptDismissed:e.promptDismissed===!0,promptDue:e.promptDue===!0}}function Aa(e,n){return Se(e,n),{today:Ae(e.today,n+".today"),month:Ae(e.month,n+".month"),total:Ae(e.total,n+".total"),budgetUsed:typeof e.budgetUsed=="number"&&Number.isFinite(e.budgetUsed)?e.budgetUsed:void 0,balance:e.balance==null?On:Dn(e.balance,n+".balance"),goQuota:e.goQuota==null?Bn:Ln(e.goQuota,n+".goQuota"),customBalance:e.customBalance==null?va():Sa(e.customBalance,n+".customBalance"),customBalances:Array.isArray(e.customBalances)?e.customBalances.filter(s=>s!==null&&typeof s=="object").map((s,a)=>Sa(s,n+".customBalances["+a+"]")):[],gatewayQuotas:Array.isArray(e.gatewayQuotas)?e.gatewayQuotas.filter(s=>s!==null&&typeof s=="object"&&!Array.isArray(s)).map((s,a)=>qn(s,n+".gatewayQuotas["+a+"]")):[],customVarStatus:e.customVarStatus!==null&&typeof e.customVarStatus=="object"&&!Array.isArray(e.customVarStatus)?Object.fromEntries(Object.entries(e.customVarStatus).filter(([,s])=>s!==null&&typeof s=="object").map(([s,a])=>[s,{configured:a.configured===!0,source:typeof a.source=="string"?a.source:""}])):{},codingPlans:e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans)?e.codingPlans:{},planStats:jn(e.planStats),codexCompat:Hn(e.codexCompat),history:Array.isArray(e.history)?e.history.map((s,a)=>Ae(s,n+".history["+a+"]")):[],billionContext:e.billionContext?.protocol===1?{protocol:1,connected:e.billionContext.connected===!0,failed:e.billionContext.failed===!0,requests:Number(e.billionContext.requests)||0,unreported:Number(e.billionContext.unreported)||0,partial:Number(e.billionContext.partial)||0,uncovered:Number(e.billionContext.uncovered)||0,detected:e.billionContext.detected===!0,version:typeof e.billionContext.version=="string"?e.billionContext.version.slice(0,100):"",compatibility:["needs_update","changed","bridge_missing","ready"].includes(e.billionContext.compatibility)?e.billionContext.compatibility:"unknown",noticeId:typeof e.billionContext.noticeId=="string"?e.billionContext.noticeId.slice(0,240):""}:void 0,externalUsage:e.externalUsage&&Array.isArray(e.externalUsage.sources)?{fetchedAt:Number(e.externalUsage.fetchedAt)||0,stale:e.externalUsage.stale===!0,sources:e.externalUsage.sources.map(s=>({source:String(s.source),today:Ae(s.today,n+".external.today"),month:Ae(s.month,n+".external.month"),total:Ae(s.total,n+".external.total"),history:(s.history??[]).map(a=>Ae(a,n+".external.history"))})),combined:Object.fromEntries(["today","month","total","history"].map(s=>[s,s==="history"?(e.externalUsage.combined.history??[]).map(a=>Ae(a,n+".external.history")):Ae(e.externalUsage.combined[s],n+".external."+s)]))}:null,config:Rn(e.config,n+".config"),pricesRev:typeof e.pricesRev=="string"?e.pricesRev:void 0,reconcile:e.reconcile===null||e.reconcile===void 0?void 0:{ok:e.reconcile.ok===!0,message:typeof e.reconcile.message=="string"?e.reconcile.message:""},priceLockIds:Array.isArray(e.priceLockIds)?e.priceLockIds.filter(s=>typeof s=="string"):[],meta:{...Ke(e.meta?.locale)?{locale:Ke(e.meta.locale)}:{},now:typeof e.meta?.now=="number"?e.meta.now:Date.now(),timezoneOffsetMinutes:typeof e.meta?.timezoneOffsetMinutes=="number"?e.meta.timezoneOffsetMinutes:0,timezone:typeof e.meta?.timezone=="string"?e.meta.timezone:"",dayKey:typeof e.meta?.dayKey=="string"?e.meta.dayKey:"",monthKey:typeof e.meta?.monthKey=="string"?e.meta.monthKey:""}}}function Qn(e,n){Se(e,n);const s={ok:e.ok===!0,message:typeof e.message=="string"?e.message:""};return e.state!==void 0&&e.state!==null&&(s.state=Aa(e.state,n+".state")),s}function ne(e){return{parse:e}}const $e=ne(Aa),Un=ne(e=>Se(e,"patch")),Fn=ne(Qn),It=ne(e=>le(e,"provider")),_n=ne(e=>{if(e!=null)return(typeof e!="number"||!Number.isInteger(e)||e<0||e>7)&&ce("index","0-7 integer"),e}),Wn=ne(e=>le(e,"date")),Gn=ne(e=>Se(e,"day")),Kn=ne(e=>(Number.isFinite(Number(e))||ce("limit","number"),Number(e))),Pa=ne(e=>le(e,"sort")),zn=ne(e=>Se(e,"topSessions")),Ma=ne(e=>le(e,"target")),Yn=ne(e=>le(e,"value")),xe=(e,n)=>({mode:"strict",typeSymbol:"dsh-cost-meter#"+e,schema:n,create:()=>n}),re=(e,n,s,a=!1)=>({name:e,wire:e,source:"json",codec:xe(n,s),...a?{acceptsUndefined:!0}:{}}),Vn={package:"dsh-cost-meter",descriptors:[{method:"getStateSince",parameters:[re("pricesRev","PricesRev",ne(e=>(typeof e!="string"&&ce("pricesRev","price table revision"),e)))],result:xe("CostState",$e)},...["getState","getLocalState"].map(e=>({method:e,result:xe("CostState",$e)})),{method:"updateConfig",parameters:[re("patch","ConfigPatch",Un)],result:xe("CostState",$e)},{method:"fetchPrices"},{method:"releasePriceLock",parameters:[re("id","PriceLockId",ne(e=>((typeof e!="string"||e.length===0)&&ce("id","OpenRouter model id"),e)))]},{method:"refreshBalance"},{method:"refreshGoQuota"},{method:"refreshCustomBalance",parameters:[re("index","CustomBalanceIndex",_n,!0)]},{method:"refreshCodingPlan",parameters:[re("provider","CodingPlanProvider",It)]},{method:"loginCodingPlan",parameters:[re("provider","CodingPlanProvider",It)]},{method:"refreshGatewayQuota",parameters:[re("sourceId","GatewayQuotaSourceId",ne(e=>{if(e!=null)return(typeof e!="string"||e.length>48||!/^[a-z0-9][a-z0-9_-]*$/.test(e))&&ce("sourceId","gateway source id"),e}),!0)]},{method:"resetHistory",result:xe("CostState",$e)},{method:"importLegacyHistory"},{method:"getDaySessions",parameters:[re("date","DayKey",Wn)],result:xe("DayRecord",Gn)},{method:"getSessionCost",parameters:[re("sessionId","SessionId",It)],result:xe("SessionCost",ne(e=>({own:Rt(e.own,"own"),subagents:Rt(e.subagents,"subagents"),found:Ce(e.found,"found"),subagentCount:te(e.subagentCount,"subagentCount")})))},{id:"dsh-cost-meter#costMeter/getTurnCost",service:"costMeter",namespace:"costMeter",method:"getTurnCost",invocation:{kind:"direct"},parameters:[re("sessionId","SessionId",ne(e=>le(e,"sessionId"))),...["startSeq","endSeq"].map(e=>re(e,"TurnSeq",ne(n=>((!Number.isSafeInteger(n)||n<0)&&ce(e,"nonnegative integer"),n)))),{...re("displayCurrency","DisplayCurrency",ne(e=>(e!==void 0&&!["USD","CNY","EUR"].includes(e)&&ce("displayCurrency","currency"),e))),acceptsUndefined:!0}],result:xe("TurnCost",ne(e=>({...Tt(e),found:Ce(e.found,"found"),...e.inherited===void 0?{}:{inherited:Ce(e.inherited,"inherited")},cost:te(e.cost,"cost"),apiCost:te(e.apiCost,"apiCost"),rows:Na(e.rows),calls:(Array.isArray(e.calls)?e.calls:ce("calls","array")).map(n=>({kind:le(n.kind,"kind"),provider:le(n.provider,"provider"),model:le(n.model,"model"),atMs:te(n.atMs,"atMs"),cost:te(n.cost,"cost"),apiCost:te(n.apiCost,"apiCost"),plan:Ce(n.plan,"plan"),priced:Ce(n.priced,"priced"),longContext:Ce(n.longContext,"longContext"),rows:Na(n.rows),...n.metering?{metering:Tn(n.metering)}:{}}))})))},{method:"getTopSessions",parameters:[re("limit","SessionLimit",Kn),re("sort","SessionSort",Pa,!0),re("dir","SessionSortDir",Pa,!0)],result:xe("TopSessions",zn)},{method:"setCredential",parameters:[re("target","CredentialTarget",Ma),re("value","CredentialValue",Yn)]},{method:"clearCredential",parameters:[re("target","CredentialTarget",Ma)]},...["applyCodexCompatHistory","dismissCodexCompat"].map(e=>({method:e,result:xe("CostState",$e)}))].map(e=>({id:"dsh-cost-meter#costMeter/"+e.method,service:"costMeter",namespace:"costMeter",invocation:{kind:"direct"},parameters:[],result:xe("FetchPricesResult",Fn),...e}))};function $n(e,n){const s=n?.models??{};return typeof e=="string"&&e.length>0&&s[e]!==void 0?s[e]:n?.default??{cacheHit:0,cacheMiss:0,output:0}}function ft(e){return Object.fromEntries(["multiplier","separateMultipliers","multipliers"].filter(n=>e?.[n]!==void 0).map(n=>[n,e[n]]))}function bt(e,n){return(e.separateMultipliers?e.multipliers?.[n]:void 0)??e.multiplier??1}function Ta(e,n,s="base"){const a={};for(const o of["cacheHit","cacheMiss","cacheWrite","output","reasoning"])e[o]!==void 0&&(a[o]=e[o]*bt(n,s+"."+o));return e.longContext&&(a.longContext={...Ta(e.longContext,n,"longContext"),aboveInputTokens:e.longContext.aboveInputTokens}),a}function Jn(e){const n=ft(e);return n.multipliers&&(n.multipliers=Object.fromEntries(Object.entries(n.multipliers).filter(([s])=>s.startsWith("cny.")).map(([s,a])=>[s.replace("cny.","base."),a]))),{...e.cny,...n}}function Qe(e){if(e===null||typeof e!="object")return;const n=l=>{const i=e[l];return typeof i=="number"&&Number.isFinite(i)&&i>=0?i:void 0},s=n("cacheMiss")??n("input")??0,o={cacheHit:n("cacheHit")??n("cachedInput")??n("cacheRead")??s,cacheMiss:s,output:n("output")??0},r=n("reasoning");return r!==void 0&&(o.reasoning=r),n("cacheWrite")!==void 0&&(o.cacheWrite=n("cacheWrite")),o}function Zn(e){const n=Qe(e);if(n===void 0)return null;Object.assign(n,ft(e)),e.billingMode==="utc-peak"&&(n.billingMode="utc-peak");for(const s of["offPeak","peak","legacyBase"]){const a=Qe(e[s]);a!==void 0&&(n[s]=a)}return Number.isFinite(e.longContext?.aboveInputTokens)&&e.longContext.aboveInputTokens>0&&(n.longContext={...Qe(e.longContext),aboveInputTokens:e.longContext.aboveInputTokens}),Array.isArray(e.rateHistory)&&(n.rateHistory=e.rateHistory.slice(0,16).map(s=>{const a={...Qe(s),before:s.before};for(const o of["offPeak","peak"]){const r=Qe(s[o]);r!==void 0&&(a[o]=r)}return a})),n}function Je(e,n=Date.now()){if(!e||!Number.isFinite(n)||!Array.isArray(e.rateHistory))return e;let s=null,a=1/0;for(const l of e.rateHistory){const i=Date.parse(l.before);n<i&&i<a&&(s=l,a=i)}if(!s)return e;const{before:o,...r}=s;return{...e,...r}}const qt=Date.parse("2026-08-22T16:00:00Z");function Ra(e){if(!Number.isFinite(e)||e<qt)return null;const n=Math.floor((e+8*36e5)/864e5),s=(n+4)%7;if(s!==6&&s!==0)return null;const a=s===6?n:n-1;return{start:Math.max(a*864e5-8*36e5,qt),end:(a+2)*864e5-8*36e5}}function Oa(e,n){if(!Number.isFinite(e)||e<qt||!Array.isArray(n))return null;const s=Math.floor((e+8*36e5)/864e5);return n.includes(new Date(s*864e5).toISOString().slice(0,10))?{start:s*864e5-8*36e5,end:(s+1)*864e5-8*36e5}:null}const Xn=(e,n)=>Oa(e,n)??Ra(e);function gt(e,n,s,a){if(!Array.isArray(s)||s.length===0||Xn(e,a)!==null||Number.isFinite(n)&&e<n)return!1;const o=new Date(e).getUTCHours();return s.some(r=>{const l=Number(r.start),i=Number(r.end);return!Number.isFinite(l)||!Number.isFinite(i)?!1:l<i?o>=l&&o<i:o>=l||o<i})}const eo=Date.parse("2026-08-16T16:00:00Z");function Ba(e,n,s){const a=Je(e,n)??{cacheHit:0,cacheMiss:0,output:0},o=(l,i="base")=>({reasoning:0,...Ta(l,a,i)});if(a.billingMode==="utc-peak"){if(s?.enabled!==!0||!Number.isFinite(n))return o(a);const l=new Date(n),i=l.getUTCDay(),d=l.getUTCHours(),u=i>0&&i<6&&(d>=1&&d<4||d>=6&&d<10);return o((u?a.peak:a.offPeak)??a,(u?a.peak:a.offPeak)?u?"peak":"offPeak":"base")}if(Number.isFinite(n)&&n<eo){const l=a.legacyBase;return l===void 0?o(a):o(l,"legacyBase")}if(s?.enabled!==!0)return o(a);const r=typeof s.effectiveAtMs=="number"&&Number.isFinite(s.effectiveAtMs)?s.effectiveAtMs:void 0;if(gt(n,r,s.windows,s.holidays)){const l=a.peak;return l===void 0?o(a):o(l,"peak")}if(r!==void 0&&n>=r){const l=a.offPeak;return l===void 0?o(a):o(l,"offPeak")}return o(a)}function Da(e,n){const s=Math.max(0,Number(e.input)||0),a=Math.max(0,Number(e.output)||0),o=Math.max(0,Number(e.cacheRead)||0),r=Math.max(0,Number(e.cacheWrite)||0),l=Math.max(0,Number(e.reasoning)||0);return n.longContext&&s+o+r>n.longContext.aboveInputTokens&&(n=n.longContext),(s*n.cacheMiss+a*n.output+o*n.cacheHit+r*(n.cacheWrite??n.cacheHit)+l*(n.reasoning??0))/1e6}function La(e,n,s){const a=Number(e);if(!Number.isFinite(a)||a<0||a===0)return 0;if(n!=="CNY")return a;const o=Number(s);return!Number.isFinite(o)||o<=0?a:a/o}function ue(e,n){const s=e?.barDirections,a=n==="balance"?"remaining":"used";if(s===null||typeof s!="object"||Array.isArray(s))return a;const o=s[n];return o==="remaining"||o==="used"?o:a}function we(e,n){if(e==null||!Number.isFinite(Number(e)))return{width:0,label:null};const s=Math.max(0,Math.min(100,Number(e))),a=n==="remaining"?Math.round((100-s)*10)/10:Math.round(s*10)/10;return{width:a,label:a}}const Ea=(e,n)=>e.toFixed(n).replace(/(\.\d*?[1-9])0+$|\.0+$/,"$1");function me(e,n){const s=typeof n?.symbol=="string"&&n.symbol.length>0?n.symbol:"$",a=Number(n?.decimals),o=Math.max(0,Math.min(10,Number.isFinite(a)?Math.floor(a):2));let r=o;return e>0&&e<Math.pow(10,-o)&&(r=o+2),s+Ea(e,r)}function z(e,n){const s=Number(n?.exchangeRate),a=e*(Number.isFinite(s)&&s>0?s:1);return me(a,n)}function L(e){const n=Math.max(0,Number(e)||0),s=a=>a>=100?String(Math.round(a)):String(Math.round(a*10)/10);return n<1e3?String(Math.round(n)):n>=999500?s(n/1e6)+"M":n<1e6?s(n/1e3)+"K":s(n/1e6)+"M"}function jt(e){return String(e??"").normalize("NFKC").toLowerCase().replace(/[((]\s*(?:go|zen)\s*[))]/g," ").trim()}function Pe(e){return jt(e).replace(/[^\p{L}\p{N}]+/gu,"")}function to(e){return jt(e).replace(/[-_./:@](?:\d{4}-?\d{2}-?\d{2}|v\d+(?:\.\d+)*|\d+k|latest)$/,"")}function Ht(e,n,s=e){if(typeof e!="string"||e.length===0)return null;const a=Array.isArray(n)?n.filter(l=>typeof l=="string"&&l.length>0):[],o=a.find(l=>l===s);if(o!==void 0)return o;let r=e.normalize("NFKC").trim();if(/[:((]\s*(?:free|online)\b/i.test(r))return null;for(;;){const l=Pe(r);if(l.length===0)return null;const i=a.filter(u=>Pe(u)===l);if(i.length>0)return i.length===1?i[0]:null;const d=to(r);if(d===r.toLowerCase())return null;r=d}}const Qt=["opendesign","open-design","open-design-api","amr-link.open-design.ai"],Ut=new Set(["openrouter","opencode-zen","opencode-go","opencode-go-plus","zen","opencode",...Qt]),ht={openai:/^(?:gpt|o\d|codex)/i,anthropic:/^claude/i,google:/^gemini/i,stepfun:/^step-/i,deepseek:/^deepseek/i,moonshot:/^kimi/i,"z-ai":/^glm/i,xai:/^grok/i,alibaba:/^qwen/i,minimax:/^minimax/i,tencent:/^(?:hunyuan|hy\d)/i,xiaomi:/^mimo/i,upstage:/^solar/i,nvidia:/^nemotron/i,mistral:/^mistral/i,meta:/^(?:muse|llama)/i,meituan:/^longcat/i};function Ft(e){return["deepseek-peak","utc-peak"].includes(e?.billingMode)?e.billingMode:"flat"}function Ue(e,n,s,a,o){if(typeof e!="string")return null;if(Object.hasOwn(n,e))return e;if(a!=="auto")return null;let r=e.normalize("NFKC").trim().replace(/^models\/(?=gemini)/i,"google/");const l=r.search(/[/:]/);if(l>0){const i=r.slice(0,l).trim().toLowerCase(),d=r.slice(l+1).trim();if(Object.hasOwn(ht,i)&&(i===s||(s==="opencode-zen"||s==="opencode-go")&&(ht[i].test(d)||Ht(d,Object.keys(i==="deepseek"?o?.models??{}:o?.providers?.[i]?.models??{}))!==null)))r=d;else if(Object.hasOwn(ht,i))return null}return Ht(r,Object.keys(n),e)}const ao=new Set(["local","lmstudio","ollama","jan","gpt4all","koboldcpp","llamacpp","llama-cpp","localai","vllm","sglang","tabbyapi","lmdeploy","oobabooga","text-generation-webui","llama-server"]),no=["lmstudio:","lmstudio/","ollama:","ollama/","jan:","jan/","gpt4all:","gpt4all/","koboldcpp:","koboldcpp/","llamacpp:","llamacpp/","llama-cpp:","llama-cpp/","localai:","localai/","vllm:","vllm/","sglang:","sglang/","tabbyapi:","tabbyapi/","lmdeploy:","oobabooga/","text-generation-webui/","llama-server:","gguf:","local:"];function oo(e,n){if(typeof e=="string"&&ao.has(e))return!0;const s=typeof n=="string"?jt(n):"";return no.some(a=>s.startsWith(a))}function so(e,n,s,a){if(e!=="deepseek"&&!e.includes("deepseek")&&typeof n=="string"&&n.length>0&&n!=="__local__"&&!n.includes(":")){const o=s.models??{},r=Object.hasOwn(o,n)?n:a==="auto"?Ht(n,Object.keys(o)):null;if(r!==null&&o[r]?.unpriced!==!0)return{entry:o[r],priced:!0,billingMode:"deepseek-peak",matched:!0}}return null}function lo(e,n,s){const a=s?.prices??{},o=s?.priceMatch==="exact"?"exact":"auto",r=s?.priceOverrides&&typeof s.priceOverrides=="object"?s.priceOverrides:{};let l=String(e??"").trim().toLowerCase();l.startsWith("llm-")&&(l=l.slice(4)),l===""&&(l="deepseek");let i=l,d=n;const u=r[l+":"+n];if(u==="__custom__"){const p=a.custom?.[l+":"+n];return{entry:p??null,priced:!!p,billingMode:"flat",matched:!0,currency:p?.currency??"USD"}}if(u==="__local__")return{entry:null,priced:!1,billingMode:"flat",matched:!0};if(typeof u=="string"&&u.length>0){const p=u.indexOf(":");if(p>0&&u.slice(p+1).length>0?(i=u.slice(0,p).trim().toLowerCase(),d=u.slice(p+1)):d=u,i==="deepseek"&&d==="__default__")return{entry:a.default??{cacheHit:0,cacheMiss:0,output:0},priced:a.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}if(["zen","opencode","opencode-go-plus"].includes(i)){const p=Ue(d,a.providers?.[i]?.models??{},"opencode-go",o,a);p===null?i="opencode-go":d=p}if(Qt.includes(i)&&i!=="opendesign"&&Ue(d,a.providers?.[i]?.models??{},i,o,a)===null&&(i="opendesign"),oo(i,d))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(i==="openrouter"){const p=a.providers?.openrouter?.models??{},b=Object.hasOwn(p,d)?p[d]:null;return{entry:b,priced:b!==null&&b.unpriced!==!0,billingMode:"flat",matched:b!==null}}if(i==="deepseek"||i.includes("deepseek")){const p=a.models??{},b=Ue(d,p,"deepseek",o,a);if(b!==null)return p[b]?.unpriced===!0?{entry:null,priced:!1,billingMode:"flat",matched:!0}:{entry:p[b],priced:!0,billingMode:"deepseek-peak",matched:!0};if(o==="auto"){let g=null,h=-1,x=!1,A="flat";for(const[w,y]of Object.entries(a.providers??{})){if(Ut.has(w))continue;const m=y?.models??{},k=Ue(d,m,w,o,a);if(k===null)continue;const N=+(k===d||Pe(k)===Pe(d));N>h?(g=m[k],h=N,x=!1,A=Ft(m[k])):N===h&&(x=!0)}if(x)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(g!==null)return{entry:g,priced:g.unpriced!==!0,billingMode:A,matched:!0}}return{entry:a.default??{cacheHit:0,cacheMiss:0,output:0},priced:a.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}const c=a.providers?.[i]?.models??{},f=Ue(d,c,i,o,a);if(f!==null)return{entry:c[f],priced:c[f]?.unpriced!==!0,billingMode:Ft(c[f]),matched:!0};if(Ut.has(i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(Object.hasOwn(ht,i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(o==="auto"){let p=null,b=-1,g=!1,h="flat";for(const[x,A]of[["deepseek",{models:a.models??{}}],...Object.entries(a.providers??{})]){if(x===i||Ut.has(x))continue;const w=A?.models??{},y=Ue(d,w,x,o,a);if(y===null)continue;const m=+(y===d||Pe(y)===Pe(d));m>b?(p=w[y],b=m,g=!1,h=x==="deepseek"?"deepseek-peak":Ft(w[y])):m===b&&(g=!0)}if(g)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(p!==null)return{entry:p,priced:p.unpriced!==!0,billingMode:h,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}function Ia(e,n,s){let a=lo(e,n,s);if(a.currency)return a;if(!a.priced){const o=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";a=so(o,s?.priceOverrides?.[o+":"+n],s?.prices??{},s?.priceMatch==="exact"?"exact":"auto")??a}return a.priced&&s?.prices?.currency==="CNY"&&a.entry?.cny?{...a,entry:Jn(a.entry),currency:"CNY"}:{...a,currency:a.priced&&a.billingMode==="deepseek-peak"&&s?.prices?.currency==="CNY"?"CNY":"USD"}}function ro(e){const n=Number(e?.calls)||0,s=Number(e?.input)||0,a=Number(e?.cacheRead)||0;return n>=3&&s>=1e5&&a===0}function yt(e,n){return!e||!n?0:typeof e.cost=="number"&&Number.isFinite(e.cost)?e.cost:ja(e,n).total}function Ze(e){if(e===null||typeof e!="object")return 0;const n=Number(e.cost)||0,s=e.apiCost===void 0||e.apiCost===null?n:Number(e.apiCost);return Number.isFinite(s)&&s>=0?Math.min(s,n):n}function U(e,n){const s={CNY:"Cny",EUR:"Eur"}[n?.currency],a=n?.showTotalWithPlan===!0,o=s&&e?.[(a?"cost":"apiCost")+s],r=a?Number(e?.cost)||0:Ze(e);return!Number.isFinite(o)||o===0&&r>0?r:o/(n.exchangeRate||1)}const io={opendesign:Qt,go:["go","zen","opencode","opencode-go","opencode-go-plus"],codex:["codex","openai-codex","dsh-openai-codex","codex-chatgpt"],anthropic:["anthropic","claude-subscription"],zai:["zai","glm-coding-plan"],minimax:["minimax","minimax-code"],kimi:["kimi","kimi-code"],commandcode:["commandcode","command-code"],workbuddy:["workbuddy","workbuddy-subscription"],antigravity:["antigravity"],stepfun:["stepfun","step-code"],"volcengine-agent":["volcengine-agent","ark-agent-plan","volcengine-agent-plan"],"tencent-coding":["tencent-coding","tencent-coding-plan","tokenhub-coding-plan"],"tencent-token":["tencent-token","tencent-token-plan","tokenhub-token-plan"],"baidu-coding":["baidu-coding-plan","qianfan-coding-plan"],qwen:["qwen","qwen-tokenplan","qianwen-tokenplan","qwen-token-plan","qianwen-token-plan"],scnet:["scnet","scnet-tokenplan","scnet-token-plan"],mimo:["mimo","xiaomimimo","mimo-token-plan","xiaomi-token-plan","xiaomi-token-plan-cn","xiaomi-token-plan-sgp","xiaomi-token-plan-ams"],factory:["factory","droid","factory-a","factory-g","factory-o"]},Xe=["opendesign","anthropic","zai","minimax","kimi","openrouter","siliconflow","commandcode","scnet","volcengine","qwen","mimo","factory","go","codex","volcengine-agent","tencent-coding","tencent-token","baidu-coding","workbuddy","antigravity","stepfun"],co=Object.entries({opendesign:"opendesign|open[._-]?design",codex:"codex|chatgpt","baidu-coding":"baidu|qianfan|百度|千帆","tencent-coding":"tencent|tokenhub|腾讯",anthropic:"anthropic|claude",zai:"z[._-]?ai|zhipu|glm|智谱",minimax:"minimax|海螺",kimi:"kimi|moonshot|moonshotai|月之暗面",openrouter:"openrouter",siliconflow:"siliconflow|硅基",commandcode:"commandcode",scnet:"scnet|sugon|超算",volcengine:"volcengine|volcano|volc|ark|火山|方舟",qwen:"qwen|qianwen|千问|通义",mimo:"mimo|xiaomi|小米",factory:"factory|droid",go:"opencode(?:[-_\\s]?go)?|zen|go"}).map(([e,n])=>[e,new RegExp("(?:^|[^a-z0-9])(?:"+n+")(?=$|[^a-z0-9])")]);function uo(e,n){for(const s of[e,n]){const a=String(s??"").normalize("NFKC").replace(/([a-zA-Z0-9\u3400-\u9fff])(?=(?:Coding|Token|Agent|Plan|Subscription))/g,"$1-").replace(/([a-z0-9])((?:coding|token|agent)?plan|subscription)$/i,"$1-$2").toLowerCase();if(!/(?:^|[^a-z0-9])(?:(?:coding|token|agent)[-_\s]*)?plan(?:$|[^a-z0-9])|(?:^|[^a-z0-9])subscription(?:$|[^a-z0-9])|套餐|订阅/.test(a))continue;const o=co.filter(([,r])=>r.test(a));if(o.length){if(o.length!==1)return null;const r=o[0][0];if(r==="volcengine"&&/agent[-_\s]*plan|智能体.*套餐/.test(a))return"volcengine-agent";if(r==="tencent-coding"){const l=/token[-_\s]*plan|令牌.*套餐/.test(a),i=/coding[-_\s]*plan|编程.*套餐/.test(a);return l===i?null:l?"tencent-token":r}return r}}return null}function qa(e,n,s){const a=String(e??"").trim().toLowerCase().replace(/^llm-/,""),o=n?.planBilling?.modelPlans?.[e+":"+s]??n?.planBilling?.modelPlans?.[a+":"+s];if(Xe.includes(o))return o;if(a.length===0)return null;for(const[r,l]of Object.entries(io))if(l.includes(a))return r;return Xe.includes(a)?a:uo(e,s)}function mo(e){const n=new Set,s=e?.codingPlans;if(s!==null&&typeof s=="object")for(const a of Xe)a!=="go"&&s[a]?.enabled===!0&&n.add(a);return e?.goQuota?.enabled===!0&&n.add("go"),e?.codexQuotaEnabled===!0&&n.add("codex"),n}const po=new Set(["grok-4.5","glm-5.3","glm-5.3-flash","glm-5.2","glm-5.1","gpt-5.6-luna","kimi-k3","kimi-k2.7-code","kimi-k2.6","mimo-v2.6-flash","mimo-v2.6-pro","mimo-v2.5","mimo-v2.5-pro","minimax-m3","minimax-m2.7","qwen3.8-max","qwen3.7-max","qwen3.7-plus","qwen3.6-plus","hy3","longcat-2.0","muse-spark-1.2-contributor"].map(Pe));function fo(e,n,s){const a=String(e??"").trim().toLowerCase();if(a.length>0&&a!=="deepseek"&&!a.includes("deepseek"))return!1;const o=Pe(n);if(o.length===0||!po.has(o))return!1;const r=s?.prices,l=r?.models??{};for(const i of Object.keys(l))if(Pe(i)===o)return!1;for(const i of Object.keys(r?.providers?.["opencode-go"]?.models??{}))if(Pe(i)===o)return!0;return!1}function et(e,n,s){let a=qa(e,s,n);a===null&&fo(e,n,s)&&(a="go");const o=s?.planBilling?.models;if(o!==null&&typeof o=="object"){const l=o[e+":"+n];if(l==="plan"||l==="api")return l;if(a!==null){const i=o[a+":"+n];if(i==="plan"||i==="api")return i}}if(a===null)return"api";const r=s?.planBilling?.providers?.[a];return r==="plan"||r==="api"?r:mo(s).has(a)?"plan":"api"}function ja(e,n){if(!e||!n)return{total:0,api:0};const s=bo(n),a={enabled:n.peakEnabled===!0,effectiveAtMs:Date.parse(n.peakEffectiveAt||""),windows:n.peakWindows,holidays:n.peakHolidays},o=Date.now(),r=e.byProviderModel??e.byModel??{};let l=0,i=0;for(const p of Object.keys(r)){const b=p.indexOf(":"),g=b>0?p.slice(0,b):"deepseek",h=b>0?p.slice(b+1):p,x=Ia(g,h,n);if(x.priced){const A=Da(r[p],Ba(Zn(x.entry),o,{...a,enabled:["deepseek-peak","utc-peak"].includes(x.billingMode)&&a.enabled})),w=La(A,x.currency,s);l+=w,et(g,h,n)==="api"&&(i+=w)}}const d={input:0,output:0,cacheRead:0,cacheWrite:0,reasoning:0};for(const p of Object.keys(r))d.input+=r[p].input??0,d.output+=r[p].output??0,d.cacheRead+=r[p].cacheRead??0,d.cacheWrite+=r[p].cacheWrite??0,d.reasoning+=r[p].reasoning??0;const u={input:Math.max(0,(e.input??0)-d.input),output:Math.max(0,(e.output??0)-d.output),cacheRead:Math.max(0,(e.cacheRead??0)-d.cacheRead),cacheWrite:Math.max(0,(e.cacheWrite??0)-d.cacheWrite),reasoning:Math.max(0,(e.reasoning??0)-d.reasoning)},c=Da(u,Ba($n("default",n.prices),o,a)),f=La(c,n.prices?.currency==="CNY"?"CNY":"USD",s);return l+=f,i+=f,{total:l,api:i}}function bo(e){const n=s=>typeof s=="number"&&Number.isFinite(s)&&s>0&&s<1e6;return e.currency==="CNY"&&n(e.exchangeRate)?e.exchangeRate:n(e.fxRates?.CNY)?e.fxRates.CNY:7.2}function Ha(e,n){if(!e||!n)return!1;const s=e.byProviderModel??{};for(const a of Object.keys(s)){const o=a.indexOf(":"),r=o>0?a.slice(0,o):"deepseek",l=o>0?a.slice(o+1):a;if(et(r,l,n)==="plan")return!0}return!1}function Qa(e){return(e?.input??0)+(e?.cacheRead??0)+(e?.cacheWrite??0)}function Ua(e,n){if(e?.apiCost!==void 0)return Ze(e);if(!Ha(e,n))return yt(e,n);let s=0;for(const[a,o]of Object.entries(e.byProviderModel??{})){if(!Number.isFinite(o.cost))return ja(e,n).api;const r=a.indexOf(":");et(a.slice(0,r),a.slice(r+1),n)==="plan"&&(s+=o.cost)}return Math.max(0,yt(e,n)-s)}function _t(e){const n=Math.abs(Math.round(Number(e)||0)),s=Math.floor(n/60),a=n%60;return"UTC"+(Number(e)<0?"-":"+")+s+(a>0?":"+String(a).padStart(2,"0"):"")}function go(e){const n=e?.meta,s=Number(n?.timezoneOffsetMinutes);if(!Number.isFinite(s))return null;const a=-new Date().getTimezoneOffset();if(a===s)return null;const o=typeof n?.timezone=="string"&&n.timezone.length>0?n.timezone:"";return{hostLabel:o?o+" ("+_t(s)+")":_t(s),browserLabel:_t(a)}}function ho(e,n=s=>s){let s=n(e);const a=new Set;return{getSnapshot:()=>s,subscribe:o=>(a.add(o),()=>{a.delete(o)}),set:o=>{if(o=n(o),o!==s){s=o;for(const r of[...a])r()}}}}const{createElement:t,Fragment:D,useState:O,useEffect:Y,useRef:ge}=Te;function Le({target:e,configured:n,source:s,t:a,api:o,placeholder:r,disabled:l}){const[i,d]=O(""),[u,c]=O(!1),[f,p]=O(!1),[b,g]=O(null),h=ge(!1),x=l===!0||f,A=async()=>{const m=i.trim();if(!(m.length===0||x||h.current)){h.current=!0,p(!0),g(null);try{const k=await o.setCredential(e,m);d(""),c(!1),g({kind:"ok",text:k?.message??a("credentialSave")})}catch(k){g({kind:"err",text:String(k?.message??k)})}finally{h.current=!1,p(!1)}}},w=async()=>{if(!(x||h.current)){h.current=!0,p(!0),g(null);try{const m=await o.clearCredential(e);d(""),c(!1),g({kind:"ok",text:m?.message??a("credentialClear")})}catch(m){g({kind:"err",text:String(m?.message??m)})}finally{h.current=!1,p(!1)}}},y=()=>{d(""),c(!1)};return t("div",{className:"cm-field"},u?t("form",{className:"cm-field",autoComplete:"off",onSubmit:m=>{m.preventDefault(),A()}},t("input",{className:"cm-input",type:"password",name:"cm-credential-"+e,autoFocus:!0,value:i,placeholder:typeof r=="string"?r:"",disabled:x,autoComplete:"new-password","data-lpignore":"true","data-1p-ignore":"true","data-bwignore":"true","aria-label":a("credentialInputHint"),onChange:m=>d(m.target.value)}),t("div",{className:"cm-buttons"},t("button",{className:"cm-btn small",type:"submit",disabled:x||i.trim().length===0},a(f?"credentialSaving":"credentialSave")),t("button",{className:"cm-btn small",type:"button",onClick:y,disabled:f},a("cancel")))):t("button",{className:"cm-btn small",type:"button",onClick:()=>c(!0),disabled:x},a("credentialEdit")),n===!0?t("button",{className:"cm-btn small",type:"button",onClick:w,disabled:x},a("credentialClear")):null,t("span",{className:"cm-hint"},n===!0?a("credentialConfiguredOf",{source:typeof s=="string"&&s.length>0?s:"unknown"}):a("credentialNotConfigured")),t("span",{className:"cm-hint"},a("credentialInputHint")),da(b))}function yo({pending:e,t:n}){return!Array.isArray(e)||e.length===0?null:t("div",{className:"cm-msg err"},t("div",null,n("secretMigrationPending")),t("div",null,e.join("、")))}function kt({size:e=16,className:n}){return t("svg",{width:e,height:e,className:n,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M4 4H12A2 2 0 0 1 14 6V11.5A2 2 0 0 1 12 13.5H4A2 2 0 0 1 2 11.5V6A2 2 0 0 1 4 4ZM4 5.3H12A0.7 0.7 0 0 1 12.7 6V11.5A0.7 0.7 0 0 1 12 12.2H4A0.7 0.7 0 0 1 3.3 11.5V6A0.7 0.7 0 0 1 4 5.3Z",fill:"currentColor",fillRule:"evenodd"}),t("path",{d:"M3.3 5.3H12.7V7.1H3.3Z",fill:"currentColor"}),t("path",{d:"M8 2.8A1.3 1.3 0 1 0 8 5.4A1.3 1.3 0 1 0 8 2.8Z",fill:"currentColor"}))}function Fa(e,n){const s=ge(!1),a=ge(""),o=n!==null&&typeof n=="object"?[n.input,n.cacheRead,n.cacheWrite,n.output,n.reasoning,n.cost].map(r=>String(r??0)).join("|"):"";Y(()=>{if(!s.current){s.current=!0,a.current=o;return}if(o===""||o===a.current)return;a.current=o;const r=setTimeout(()=>{e.api?.reload?.()},800);return()=>clearTimeout(r)},[o])}function ko(e,n,s,a){const o=n?n.own:e;if(!s||!n?.subagentCount)return o;const r=n.subagents,l={...o};for(const i of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...pt])l[i]=(o?.[i]??0)+(r?.[i]??0);l.apiCost=Ua(o,a)+Ze(r);for(const i of["byModel","byProviderModel"]){l[i]={...o?.[i]};for(const[d,u]of Object.entries(r?.[i]??{})){const c={...l[i][d]};c.apiCost=Ze(c)+Ze(u);for(const f of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...pt])c[f]=(c[f]??0)+(u[f]??0);l[i][d]=c}}return l}function _a(e){const n=e.useProjection?e.useProjection("costUsage"):void 0,s=e.useCost?.(u=>u)?.state,a=s?.config,[o,r]=O(null);Fa(e,n);const l=["input","output","cacheRead","cacheWrite","reasoning","calls","cost","apiCost"].map(u=>n?.[u]??"").join(":");Y(()=>{if(!e.sessionId||!e.api?.getSessionCost)return;let u=!0,c=!1;const f=async()=>{if(!(c||typeof document<"u"&&document.hidden)){c=!0;try{const g=await e.api.getSessionCost(e.sessionId);u&&r({id:e.sessionId,include:a?.includeSubagentCost===!0,value:g})}catch{u&&r(g=>g?.id===e.sessionId&&g.include===(a?.includeSubagentCost===!0)?g:{id:e.sessionId,include:a?.includeSubagentCost===!0,value:null})}finally{c=!1}}};f();const p=a?.includeSubagentCost===!0?setInterval(f,1e4):null,b=()=>{document.hidden||f()};return typeof document<"u"&&document.addEventListener?.("visibilitychange",b),()=>{u=!1,p!==null&&clearInterval(p),typeof document<"u"&&document.removeEventListener?.("visibilitychange",b)}},[e.sessionId,s?.meta?.now,l,a?.includeSubagentCost]);const i=o&&o.id===e.sessionId&&o.include===(a?.includeSubagentCost===!0)?o:null,d=i?.value;return{usage:ko(n,d,a?.includeSubagentCost===!0,a),config:a,pending:!!e.sessionId&&!!e.api?.getSessionCost&&!i,unrecorded:d?.found===!1&&(!a?.includeSubagentCost||!d.subagentCount)}}function Wa(e){const n=H(e.config)==="en";return e.pending?n?"Loading session cost…":"正在读取本会话费用…":e.unrecorded?n?"Session cost: no ledger records":"本会话暂无账本记录":e.usage?"":n?"Session cost unavailable":"本会话费用暂不可用"}function Ga(e,n){if(Number.isFinite(e?.costCny)||Number.isFinite(e?.costEur)){const o=U(e,{...n,showTotalWithPlan:!0}),r=U(e,{...n,showTotalWithPlan:!1});return{cost:n.showTotalWithPlan?o:r,planPart:n.showTotalWithPlan?0:Math.max(0,o-r)}}let s=0,a=yt(e,n);if(n.showTotalWithPlan!==!0&&(e.apiCost!==void 0||Ha(e,n))){const o={total:yt(e,n),api:Ua(e,n)};s=Math.max(0,o.total-o.api),s>0&&(a=o.api)}return{cost:a,planPart:s}}function Ka(e,n){return Object.entries(e?.byProviderModel??{}).filter(([,s])=>s.input||s.output||s.cacheRead||s.cacheWrite||s.reasoning).map(([s,a])=>s+" "+z(U(a,{...n,showTotalWithPlan:!0}),n)).join("; ")}function xo(e){const n=e.useCost?.(h=>h)?.state?.config,[s,a]=O(null),[o,r]=O(""),l=e.turn?.start?.seq,i=e.turn?.end?.seq,d=e.sessionId,u=JSON.stringify([n?.prices,n?.priceOverrides,n?.priceMatch,n?.planBilling,n?.codingPlans,n?.goQuota?.enabled,n?.peakEnabled,n?.peakEffectiveAt,n?.peakWindows,n?.peakHolidays,n?.exchangeRate]);if(Y(()=>{let h=!0;if(a(null),r(""),!(n?.hideTurnCost||!d||l==null||i==null))return e.api.getTurnCost(d,l,i).then(x=>{h&&a(x)},x=>{h&&r(String(x.message??x))}),()=>{h=!1}},[d,l,i,u,n?.hideTurnCost]),!n||n.hideTurnCost||l==null||i==null)return null;const c=H(n)==="en",f=c?{input:"Input",output:"Output",cacheRead:"Cache read",cacheWrite:"Cache write",reasoning:"Reasoning"}:{input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",reasoning:"推理"},p=h=>z(h,{...n,decimals:Math.max(8,n.decimals??2)}),b=c?{model:"Model call",compaction:"Context compaction",search:"Native search",fetch:"Web fetch"}:{model:"模型调用",compaction:"上下文压缩",search:"原生搜索",fetch:"网页抓取"},g=(h,x)=>t("div",{key:x,style:{marginBottom:4,overflowWrap:"anywhere"}},h.provider+":"+h.model+" · "+(f[h.bucket]||(h.bucket==="fetchRequests"?c?"Fetch requests":"抓取请求":c?"Search requests":"搜索请求"))+(h.plan?" (Plan)":"")+": "+(h.requests?h.requests+(c?" requests":" 次"):h.tokens.toLocaleString())+" × "+(h.priced?p(h.rate):"?")+(h.requests?" ≈ ":" / 1,000,000 ≈ ")+(h.priced?p(h.cost):"?"),h.priced?h.bucket==="reasoning"&&h.rate===0?c?" (no separate charge)":"(不单独收费)":"":c?" (price unavailable)":"(未配置价格)");return t("details",{className:"cm-note",style:{fontSize:12,marginTop:6}},t("summary",{style:{cursor:"pointer"},title:c?"Log estimate at configured prices; session cost uses recorded ledger amounts.":"本轮按日志和配置价格估算,本会话按账本已入账金额汇总。"},c?"Turn cost":"本轮费用",s?.found?" ≈ "+p(U(s,n))+(s.rows.some(h=>!h.priced)?c?" + unpriced usage":" + 未定价用量":""):s?.inherited?c?" · inherited history":" · 继承历史":o?" ⚠":""),o?t("div",{role:"alert"},o):s?s.found?t(D,null,t("p",null,c?"Estimated from recorded usage and configured prices; rates per 1M tokens.":"按已记录用量和配置价格估算;单价单位为每百万 Token。"),t("p",null,"API ≈ "+p(U(s,{...n,showTotalWithPlan:!1}))+" · Plan ≈ "+p(U(s,{...n,showTotalWithPlan:!0})-U(s,{...n,showTotalWithPlan:!1}))+(c?" (equivalent)":"(等值)")),s.rows.map(g),t("details",null,t("summary",{style:{cursor:"pointer"}},(c?"Individual calls":"逐次调用明细")+" ("+s.calls.length+")"),s.calls.map((h,x)=>t("details",{key:x,style:{margin:"6px 0"}},t("summary",{style:{cursor:"pointer",overflowWrap:"anywhere"}},"#"+(x+1)+" "+b[h.kind]+" · "+h.provider+":"+h.model+" · "+new Date(h.atMs).toLocaleTimeString()+" · "+(h.plan?"Plan ":"API ")+(h.priced?"≈ "+p(h.cost):c?"price unavailable":"未配置价格")+(h.longContext?c?" · long context":" · 长上下文价格":"")),h.metering?t("p",null,"billion-context · "+h.metering.upstream+(h.metering.attempt>1?(c?" · Retry ":" · 重试 ")+h.metering.attempt:"")+(h.metering.complete?"":c?" · partial usage":" · 用量回执不完整")):null,h.rows.map(g))))):s.inherited?c?"Inherited usage is not billed again in this conversation.":"继承的历史用量不在本会话重复计费。":c?"Complete usage records unavailable":"没有完整用量记录":c?"Loading…":"加载中…")}function wo(e){const n=_a(e),{usage:s,config:a}=n;if(!a)return null;const o=Wa(n);if(o)return t("div",{className:"cm-chip"},o);const r=G(H(a)),{cost:l,planPart:i}=Ga(s,a),d=[r("sessionCostTitle"),r("sessionDetailTokens",{input:L(s?.input??0),cache:L((s?.cacheRead??0)+(s?.cacheWrite??0)),output:L(s?.output??0)}),r("sessionDetailCache",{read:L(s?.cacheRead??0),write:L(s?.cacheWrite??0)}),r("cost",{amount:z(l,a)}),...i>0?[r("sessionDetailPlan",{amount:z(i,a)})]:[],Ka(s,a)].filter(Boolean).join("; ");return t($,{portal:!0,label:d,side:"top",delayMs:500},t("div",{className:"cm-chip"},i>0?r("costChipPlan",{amount:z(l,a)}):r("cost",{amount:z(l,a)})))}function No(e){const n=_a(e),{usage:s,config:a}=n;if(!a)return null;const o=Wa(n);if(o)return t("div",{className:"cm-root",role:"status",title:o},o);const r=s.input??0,l=(s.cacheRead??0)+(s.cacheWrite??0),i=s.output??0,d=G(H(a)),{cost:u,planPart:c}=Ga(s,a),f=Qa(s)>0?((s.cacheRead??0)/Qa(s)*100).toFixed(1)+"%":"—",p={amount:z(u,a),planAmount:z(c,a),hitRate:f,input:L(r),cache:L(l),output:L(i)},b=d(c>0?"sessionLineSplit":"sessionLine",p),g=Ka(s,a),h=a.sessionCostCompact===!0,x=d("sessionLineCompact",p),A=h?d(c>0?"sessionLineSplitCompact":"sessionLineCompact",p):b;return t("div",{className:"cm-root cm-session-cost",title:[b,g].filter(Boolean).join("; ")},t("span",{className:"cm-session-amount"},x),t("span",{className:"cm-session-detail"},A.slice(x.length)))}const vo={USD:"$",CNY:"¥",EUR:"€"};function Re(e,n,s){const a=typeof s=="string"?s.toUpperCase():"",o=typeof n?.symbol=="string"&&n.symbol.length>0?n.symbol:"$";return me(e,{symbol:vo[a]??o,decimals:Math.max(2,Math.min(10,Math.floor(Number(n?.decimals)||2)))})}function za(e,n){const s=Number(e?.balance?.budgetCap);if(Number.isFinite(s)&&s>0)return s;const a=Number(n?.maxBudget);return Number.isFinite(a)&&a>0?a:null}function So(e){const n=e.today,s=n?.byProviderModel;if(s===null||typeof s!="object"||Object.keys(s).length===0)return Number(n?.cost)||0;let a=0;for(const[o,r]of Object.entries(s)){const l=o.indexOf(":");let i=l>=0?o.slice(0,l):o;i.startsWith("llm-")&&(i=i.slice(4)),/^deepseek(?:-official|-account)?$/.test(i)&&(a+=Number(r?.cost)||0)}return a}function Ya(e,n,s,a,o=null){const r=s==="official"?So(e):Number(e.today?.cost)||0,l=s==="custom"?tt(n,a,o):e.balance?.currency;if(l==="USD")return r;if(l==="CREDITS")return 0;const i=Number(n?.exchangeRate);return r*(Number.isFinite(i)&&i>0?i:1)}function Wt({remaining:e,spend:n,todayUsed:s,cap:a}){if(a===null||a<=0)return{remainingPct:100,todayPct:0,spentPct:0,hasCap:!1,pastSpend:0,today:0};const o=Math.max(0,Number(e)||0),r=Math.max(0,Number(n)||0),l=Math.max(0,Math.min(r,Number(s)||0)),i=Math.max(0,r-l),d=Math.max(0,Math.min(100,o/a*100)),u=Math.max(0,Math.min(100-d,l/a*100)),c=Math.max(0,Math.min(100-d-u,i/a*100));return{remainingPct:d,todayPct:u,spentPct:c,hasCap:!0,pastSpend:i,today:l}}function Gt(e,n,s=null,a=null){const o=s??e.customBalance;if((a??n?.customBalance)?.adapter==="tokenrhythm")return{cap:null,...Wt({remaining:o?.remaining,cap:null})};const r=za(tt(n,o,a)==="CREDITS"?null:n,o),l=Number(o?.remaining)||0,i=Number(o?.spend)||0,d=Ya(e,n,"custom",o,a);return{cap:r,...Wt({remaining:l,spend:i,todayUsed:d,cap:r})}}function Co(e,n){const s=e.balance,a=za(n,null),o=Number(s?.totalBalance)||0,r=Ya(e,n,"official",null),l=a!==null?Math.max(0,a-o):0;return{cap:a,...Wt({remaining:o,spend:l,todayUsed:r,cap:a})}}function Kt(e){const{segments:n,direction:s="remaining"}=e,{remainingPct:a,todayPct:o,spentPct:r}=n,l=[];a>0&&l.push(t("div",{className:"cm-bbox-fill",style:{width:a+"%"}})),o>0&&l.push(t("div",{className:"cm-bbox-seg-today",style:{width:o+"%"}})),r>0&&l.push(t("div",{className:"cm-bbox-seg-spent",style:{width:r+"%"}})),l.length===0&&l.push(t("div",{className:"cm-bbox-fill",style:{width:"100%"}}));const i=s==="used"?[...l].reverse():l;return t("div",{className:"cm-bbox-bar segments"+(s==="used"?" rev":"")},...i)}function Va(e,n,s,a,o){const r=[e("balanceBarRemaining",{amount:a})];return s.today>0&&r.push(e("balanceBarToday",{amount:n(s.today)})),s.pastSpend>0&&r.push(e("balanceBarSpent",{amount:n(s.pastSpend)})),o!==null&&o>0&&r.push(e("balanceBudgetCapLabel")+": "+n(o)),r.join(" · ")}function Oe(e){const[n,s]=O(!1),[a,o]=O(null);return{busy:n,err:a,run:()=>{n||typeof e!="function"||(s(!0),o(null),Promise.resolve().then(e).catch(l=>{o(l?.message??String(l))}).finally(()=>{s(!1)}))}}}const ye=(e,n)=>({role:"button",tabIndex:0,"aria-busy":e?"true":"false",onClick:n,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),n())}});function Me(e,n){const s=[e("clickToRefresh")];return n.busy&&s.push(e("refreshing")),n.err&&s.push("⚠ "+e("balanceRefreshFailed",{message:n.err})),s}const Ao="https://platform.deepseek.com/usage";function $a(e){return t("a",{className:"cm-bal-link",href:Ao,target:"_blank",rel:"noreferrer noopener",title:e("balanceRechargeLink"),"aria-label":e("balanceRechargeLink"),onClick:n=>n.stopPropagation(),onKeyDown:n=>n.stopPropagation()},t("svg",{width:14,height:14,viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},t("path",{d:"M8 4H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-4M11 3h6v6M9 11l8-8"})))}function Po(e){const{state:n,wide:s,api:a}=e,o=n.balance,r=G(H(n.config)),l=Oe(a?()=>a.refreshBalance():null);if(!o||o.status==="off")return null;if(o.status==="error")return t($,{portal:!0,label:[r("balanceQueryFailed",{message:o.message||r("unknownError")}),...Me(r,l)].join("; "),side:"right",delayMs:300},t("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+" cm-bal-err"+(l.busy?" busy":""),...ye(l.busy,l.run)},s?t(D,null,r("balance")," ",t("span",{className:"cm-num"},r("queryFailed"))):"⚠"));const i=[r("balanceTitle"),r("totalBalance",{amount:Re(o.totalBalance,n.config,o.currency)}),r("grantedToppedUp",{granted:Re(o.grantedBalance,n.config,o.currency),toppedUp:Re(o.toppedUpBalance,n.config,o.currency)}),r("updatedAt",{time:o.fetchedAt>0?new Date(o.fetchedAt).toLocaleTimeString():"—"}),...n.reconcile?.ok===!1?["⚠ "+n.reconcile.message]:[],...Me(r,l)].join("; ");return t($,{portal:!0,label:i,side:"right",delayMs:300},t("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+(l.busy?" busy":""),...ye(l.busy,l.run)},s?t(D,null,t("span",{className:"cm-balance-name"},r("balance"),$a(r)),t("span",{className:"cm-num cm-bal-amt"},Re(o.totalBalance,n.config,o.currency)),n.reconcile?.ok===!1?" ⚠":""):t(kt,{size:16})))}function Mo(e){const{state:n,wide:s,api:a}=e,o=n.config,r=n.balance,l=G(H(o)),i=Oe(a?()=>a.refreshBalance():null);if(!r||r.status!=="ok")return null;const d=Co(n,o),u=Re(r.totalBalance,o,r.currency),c=b=>Re(b,o,r.currency),f=[l("balanceTitle"),Va(l,c,d,u,d.cap),l("grantedToppedUp",{granted:Re(r.grantedBalance,o,r.currency),toppedUp:Re(r.toppedUpBalance,o,r.currency)}),l("updatedAt",{time:r.fetchedAt>0?new Date(r.fetchedAt).toLocaleTimeString():"—"}),...n.reconcile?.ok===!1?["⚠ "+n.reconcile.message]:[],...Me(l,i)].join("; "),p=t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-balance-name"},t("span",{className:"cm-bbox-label"},l("balance")),$a(l)),t("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},u)),t(Kt,{segments:d,direction:ue(o,"balance")}));return t($,{portal:!0,label:f,side:"right",delayMs:300},t("div",{"data-cm-display":"balance",className:"cm-bbox clickable"+(s?"":" rail")+(i.busy?" busy":""),...ye(i.busy,i.run)},s?p:t("div",{className:"cm-bbox-rail cm-num"},Math.round(d.remainingPct)+"%")))}function zt(e,n){const s=typeof e?.label=="string"?e.label:"",a=typeof e?.labelEn=="string"?e.labelEn:"";return n==="en"?a||s||"Custom balance":s||a||"自定义余额"}function tt(e,n,s){if((s??e?.customBalance)?.adapter==="tokenrhythm")return"CNY";if((s??e?.customBalance)?.adapter==="aliyun"&&["CNY","USD","EUR"].includes(n?.unit))return n.unit;const a=s?.unit??e?.customBalance?.unit;return["CNY","EUR","USD","CREDITS"].includes(a)?a:["CNY","EUR","CREDITS"].includes(n?.unit)?n.unit:"USD"}function at(e,n,s,a){const o=tt(n,s,a),r=Number(e);if(!Number.isFinite(r))return"—";const l=n?.currency==="USD"?1:Number(n?.exchangeRate);if((a??n?.customBalance)?.convertToDisplayCurrency===!0&&o==="USD"&&Number.isFinite(l)&&l>0){const c=r*l;return Number.isFinite(c)?me(c,n):"—"}const i=o==="CREDITS",d=Math.max(2,Math.min(6,Math.floor(Number(n?.decimals)||4)));return(i?"":o==="CNY"?"¥":o==="EUR"?"€":"$")+Ea(r,d)+(i?" Credits":"")}function Yt(e,n,s,a,o=null){const r=at(e.remaining,n,e,o);if((o??n?.customBalance)?.adapter==="tokenrhythm")return s("customBalanceRemaining",{amount:r});const l=p=>at(p,n,e,o);if(a&&n.balance?.showProgressBar===!0){const p=Gt(a,n,e,o);return[Va(s,l,p,r,p.cap),s("updatedAt",{time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"})].join(" · ")}const i=e.spend!==null?l(e.spend):"—",d=e.maxBudget!==null?l(e.maxBudget):"—",u=tt(n,e,o)==="CREDITS"?NaN:Number(n?.balance?.budgetCap),c=Number.isFinite(u)&&u>0?s("balanceBudgetCapLabel")+": "+l(u):"",f=e.maxBudget!==null&&e.spend!==null?s("customBalanceLine",{remaining:r,spend:i,maxBudget:d,time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"}):s("customBalanceRemaining",{amount:r});return c?f+" · "+c:f}function To(e,n,s,a,o){const r=zt(o??n.customBalance??{},H(n)),l=at(a.remaining,n,a,o),i=Gt(e,n,a,o);return{level:"ok",rail:Math.round(i.remainingPct)+"%",body:t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bbox-label"},r),t("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},l)),t(Kt,{segments:i,direction:ue(n,"balance")}))}}function xt(e,n){const s=n?.customBalances??[],a=Array.isArray(e?.customBalances)?e.customBalances:[],o=[];return s.forEach((r,l)=>{if(r?.enabled!==!0||r.display!=="sidebar"&&r.display!=="both")return;const i=a.find(d=>d.index===l)??(a.length===1&&s.length===1?a[0]:null);o.push({index:l,entry:r,snapshot:i})}),o.length===0&&a.length===0&&n?.customBalance?.enabled===!0&&(n.customBalance.display==="sidebar"||n.customBalance.display==="both")&&e?.customBalance?.status&&e.customBalance.status!=="off"&&o.push({index:null,entry:n.customBalance,snapshot:e.customBalance}),o}function Ro(e){const{state:n,wide:s,api:a}=e,o=n.config,r=G(H(o)),l=xt(n,o);return l.length===0?null:t(D,null,l.map(({index:i,entry:d,snapshot:u})=>t(d.adapter==="tokenrhythm"?Ja:Oo,{key:"cb-"+i,state:n,wide:s,api:a,t:r,index:i,entry:d,snapshot:u})))}function Oo(e){const{state:n,wide:s,api:a,t:o,index:r,entry:l,snapshot:i}=e,d=n.config;if(i==null||i.status!=="ok")return null;const u=Oe(a?()=>a.refreshCustomBalance(r):null),c=To(n,d,o,i,l),f=[Yt(i,d,o,n,l),...Me(o,u)].join(" · ");return t($,{portal:!0,label:f,side:"right",delayMs:300},t("div",{"data-cm-display":"customBalance",className:"cm-bbox clickable"+(c.level==="ok"?"":" "+c.level)+(s?"":" rail")+(u.busy?" busy":""),...ye(u.busy,u.run)},s?c.body:t("div",{className:"cm-bbox-rail cm-num"},c.rail)))}function Bo(e){const{state:n,wide:s,api:a}=e,o=n.config,r=G(H(o)),l=xt(n,o);return l.length===0?null:t(D,null,l.map(({index:i,entry:d,snapshot:u})=>t(Ja,{key:"cbr-"+i,state:n,wide:s,api:a,t:r,index:i,entry:d,snapshot:u})))}function Ja(e){const{state:n,wide:s,api:a,t:o,index:r,entry:l,snapshot:i}=e,d=n.config,u=i??va(r);if(u.status==="off")return null;const c=Oe(a?()=>a.refreshCustomBalance(r):null),f=zt(l??d.customBalance??{},H(d));if(u.status==="error")return t($,{portal:!0,label:[u.message||o("unknownError"),...Me(o,c)].join("; "),side:"right",delayMs:300},t("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+" cm-bal-err"+(c.busy?" busy":""),...ye(c.busy,c.run)},s?t(D,null,t("span",{className:"cm-bal-label",title:f},f),t("span",{className:"cm-num cm-bal-amt"},o("queryFailed"))):"⚠"));const p=at(u.remaining,d,u,l),b=[Yt(u,d,o,n,l),...Me(o,c)].join(" · ");return t($,{portal:!0,label:b,side:"right",delayMs:300},t("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(s?"":" cm-foot-rail")+(c.busy?" busy":""),...ye(c.busy,c.run)},s?t(D,null,t("span",{className:"cm-bal-label",title:f},f),t("span",{className:"cm-num cm-bal-amt"},p)):t(kt,{size:16})))}function Do(e){const s=(e.useCost?e.useCost(g=>g):void 0)?.state;if(!s)return null;const a=s.config,o=G(H(a)),r=a.corner??{enabled:!1,goRolling:!0,goWeekly:!0,goMonthly:!0,budget:!0},l=s.goQuota,i=a?.goQuota?.enabled!==!1&&l?.status==="ok",d=g=>g!==null&&typeof g?.percent=="number"?Math.round(Math.max(0,Math.min(100,g.percent))):null,u=[];if(a.sidebarModels?.dock){const g=mn(s,a.sidebarModels.period,o);g.length&&u.push({key:"model-top",text:t(D,null,t("span",{className:"cm-bal-label"},g[0].label),t("span",{className:"cm-bal-amt"},z(g[0].cost,a))),tip:g[0].label+" "+z(g[0].cost,a),level:"ok"})}const c=(g,h,x,A)=>{if(!r.enabled||!g||!i)return;const w=d(h);if(w===null)return;const y=typeof h.resetsAt=="string"&&h.resetsAt.length>0?o("goResetAt",{time:new Date(h.resetsAt).toLocaleString()}):"";u.push({key:x,text:o(x)+" "+w+"%",tip:o(A)+": "+w+"%"+(y?" · "+y:""),level:w>=100?"over":w>=80?"warn":"ok"})},f=a?.goQuota?.main==="weekly"||a?.goQuota?.main==="monthly"?a.goQuota.main:"rolling",p=[f,...["rolling","weekly","monthly"].filter(g=>g!==f)],b=g=>g==="rolling"?["goRolling",l?.rolling,"goShortRolling","cornerGoRolling"]:g==="weekly"?["goWeekly",l?.weekly,"goShortWeekly","cornerGoWeekly"]:["goMonthly",l?.monthly,"goShortMonthly","cornerGoMonthly"];for(const g of p){const[h,x,A,w]=b(g);c(r[h]===!0,x,A,w)}if(r.enabled&&r.budget===!0){const g=a.budget??{enabled:!1,amount:100,period:"month"};if(g.enabled===!0){const h=Number(a.exchangeRate),A=(s.budgetUsed??(g.period==="day"?U(s.today,a):g.period==="all"?U(s.total,a):U(s.month,a)))*(Number.isFinite(h)&&h>0?h:1),w=Math.max(0,Number(g.amount)||0),y=w>0?Math.min(999,A/w*100):null;if(y!==null){const m=y>=100?"over":y>=80?"warn":"ok";u.push({key:"budget",text:o("budgetShort")+" "+y.toFixed(1)+"%",tip:o("budgetOf",{period:o(ze[g.period]??"periodMonth")})+" · "+o("usedOf",{used:me(A,a),amount:me(w,a)}),level:m})}}}return u.length===0?null:t("div",{className:"cm-corner"},u.map(g=>t($,{portal:!0,key:g.key,label:g.tip,side:"top",delayMs:500},t("span",{className:"cm-corner-chip"+(g.key==="model-top"?" cm-model-top":"")+(g.level==="ok"?"":" "+g.level)},g.text))))}function nt(e,n,s){if(!Array.isArray(n)||n.length===0||!Number.isFinite(e))return null;const a=(p,b)=>{const g=new Date(e);return g.setUTCDate(g.getUTCDate()+p),g.setUTCHours(b,0,0,0),g.getTime()},o=new Set,r=Math.max(12,Math.min(380,(Array.isArray(s)?s.length:0)+7));for(let p=-r;p<=r;p+=1){o.add(a(p,16));for(const b of n){const g=Number(b?.start),h=Number(b?.end);!Number.isFinite(g)||!Number.isFinite(h)||(o.add(a(p,g)),o.add(a(h<=g?p+1:p,h)))}}const l=[...o].sort((p,b)=>p-b).flatMap(p=>{const b=gt(p-1,void 0,n,s),g=gt(p,void 0,n,s);return b===g?[]:[{at:p,intoPeak:g}]});let i=null,d=null;for(const p of l)p.at<=e&&(i===null||p.at>i.at)&&(i=p),p.at>e&&(d===null||p.at<d.at)&&(d=p);const u=Oa(e,s),c=u??Ra(e);return c!==null?d===null?null:{inPeak:!1,weekend:u===null,...u?{holiday:!0}:{},prevAtMs:c.start,nextAtMs:d.at,nextIntoPeak:d.intoPeak}:i===null||d===null?null:{inPeak:gt(e,void 0,n,s),weekend:!1,prevAtMs:i.at,nextAtMs:d.at,nextIntoPeak:d.intoPeak}}function Fe(e,n){if(!e||e.peakNotice===!1||e.peakEnabled!==!0)return null;const s=Date.parse(e.peakEffectiveAt||"");if(Number.isFinite(s)&&n<s)return null;const a=Array.isArray(e.peakWindows)?e.peakWindows:[];return nt(n,a,e.peakHolidays)}function ot(e){return e.holiday===!0?{short:"holidayShort",chip:"holidayChip",notice:"holidayAllOffPeak"}:e.weekend===!0?{short:"weekendShort",chip:"weekendChip",notice:"weekendAllOffPeak"}:e.inPeak?{short:"peakShort",chip:"peakShort",notice:"peakNotice"}:{short:"offPeakShort",chip:"offPeakShort",notice:"offPeakActive"}}function Ne(e,n,s){const a=Math.max(0,e.nextAtMs-n),o=Math.max(1,Math.ceil(a/6e4)),r=Math.floor(o/60),l=o%60;return r>0?l>0?s("countdownHourMinute",{h:r,m:l}):s("countdownHoursOnly",{h:r}):s("countdownMinute",{m:o})}function Za(e){const n=ge(null),s=ge(e.actions);s.current=e.actions,Y(()=>{const l=n.current;if(!l)return;try{typeof l.showPopover=="function"?l.showPopover():l.removeAttribute("popover")}catch{l.removeAttribute("popover")}let i=!1;const d=p=>{l.contains(p.target)&&(i=!0,p.stopPropagation())},u=p=>{i&&(i=!1,p.stopPropagation())},f=[["pointerdown",d],["pointerup",u],["pointercancel",u],["touchstart",d],["click",p=>{if(!l.contains(p.target))return;p.stopPropagation();const b=p.target.closest?.("[data-cm-action]");b&&!b.disabled&&s.current[b.dataset.cmAction]?.()}]];for(const[p,b]of f)window.addEventListener?.(p,b,{capture:!0,passive:!0});return()=>{for(const[p,b]of f)window.removeEventListener?.(p,b,!0);try{l.hidePopover()}catch{}}},[]);const{actions:a,children:o,...r}=e;return t("div",{...r,ref:n,popover:"manual"},o)}const Vt="cm-peak-alert-preview";let Xa=0;function Lo(e){const n=e.useCost?e.useCost(h=>h):void 0,s=n?.state?.config,[a,o]=O(Date.now()),[r,l]=O(null),[i,d]=O(null);if(Y(()=>{const h=window.setInterval(()=>o(Date.now()),1e4);return()=>window.clearInterval(h)},[]),Y(()=>{const h=x=>{const A=x.detail?.kind==="offpeak"?"offpeak":"peak";d(A);const w=n?.state?.config;if(w?.peakAlertWebNotify===!0&&window.Notification&&Notification.permission==="granted"){const y=G(H(w));try{new Notification(y(A==="peak"?"peakAlertTitlePeak":"peakAlertTitleOffPeak")+y("peakAlertPreviewTag"),{body:y("peakAlertBody",{time:y("countdownMinute",{m:2}),phase:y(A==="peak"?"peakAlertPhasePeak":"peakAlertPhaseOffPeak")})})}catch{}}};return window.addEventListener(Vt,h),window.__cmPeakAlertLive=!0,()=>{window.removeEventListener(Vt,h),window.__cmPeakAlertLive=!1}},[]),Y(()=>{if(!s||s.peakAlertEnabled!==!0||s.peakEnabled!==!0||s.peakAlertWebNotify!==!0||!window.Notification||Notification.permission!=="granted")return;const h=nt(a,Array.isArray(s.peakWindows)?s.peakWindows:[],s.peakHolidays);if(h===null)return;const x=s.peakAlertTarget==="peak"||s.peakAlertTarget==="offpeak"?s.peakAlertTarget:"both",A=h.nextIntoPeak===!0;if(x!=="both"&&x!==(A?"peak":"offpeak"))return;const w=Number(s.peakAlertAhead),y=(Number.isFinite(w)&&w>=1?w:2)*6e4;if(a<h.nextAtMs-y||a>=h.nextAtMs||Xa===h.nextAtMs)return;const m=G(H(s));Xa=h.nextAtMs;try{new Notification(m(A?"peakAlertTitlePeak":"peakAlertTitleOffPeak"),{body:m("peakAlertBody",{time:Ne(h,a,m),phase:m(A?"peakAlertPhasePeak":"peakAlertPhaseOffPeak")})})}catch{}},[a]),!s||s.peakEnabled!==!0)return null;let u=null;if(s.peakAlertEnabled===!0){const h=Date.parse(s.peakEffectiveAt||"");if(!(Number.isFinite(h)&&a<h)){const x=nt(a,Array.isArray(s.peakWindows)?s.peakWindows:[],s.peakHolidays);if(x!==null){const A=s.peakAlertTarget==="peak"||s.peakAlertTarget==="offpeak"?s.peakAlertTarget:"both",w=Number(s.peakAlertAhead),y=(Number.isFinite(w)&&w>=1?w:2)*6e4;(A==="both"||A===(x.nextIntoPeak?"peak":"offpeak"))&&a>=x.nextAtMs-y&&a<x.nextAtMs&&r!==x.nextAtMs&&(u=x)}}}let c=null,f=!1,p=null;if(u!==null)c=u,f=u.nextIntoPeak===!0,p=()=>l(u.nextAtMs);else if(i!==null)c={nextAtMs:a+2*6e4,nextIntoPeak:i==="peak"},f=i==="peak",p=()=>d(null);else return null;const b=G(H(s)),g=s.peakAlertPosition==="center"?"cm-peak-alert-center":"cm-peak-alert-corner";return t(Za,{actions:{dismiss:p},className:"cm-peak-alert "+g+" "+(f?"cm-peak-alert-peak":"cm-peak-alert-offpeak"),role:"alert"},t("div",{className:"cm-peak-alert-badge"},b(f?"peakAlertBadgePeak":"peakAlertBadgeOffPeak")),t("div",{className:"cm-peak-alert-title"},b(f?"peakAlertTitlePeak":"peakAlertTitleOffPeak")),t("div",{className:"cm-peak-alert-body"},b("peakAlertBody",{time:Ne(c,a,b),phase:b(f?"peakAlertPhasePeak":"peakAlertPhaseOffPeak")})),t("div",{className:"cm-peak-alert-actions"},t("button",{type:"button",className:"cm-btn","data-cm-action":"dismiss",onClick:p},b("peakAlertBtn"))))}function Eo(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const d=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const r=Fe(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)});return t($,{portal:!0,label:s(l.notice),side:"right",delayMs:300},t("div",{"data-cm-display":"peak",className:"cm-peak-strip "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off")},t("div",{className:"cm-peak-track"},t("div",{className:"cm-peak-segment cm-peak-high"}),t("div",{className:"cm-peak-segment cm-peak-low"}),t("div",{className:"cm-peak-marker",style:{left:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}})),t("span",{className:"cm-peak-chip"},s(l.chip)+" · "+i)))}function Io(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const d=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const r=Fe(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)});return t($,{portal:!0,label:s(l.notice),side:"right",delayMs:300},t("div",{"data-cm-display":"peak",className:"cm-peak-classic "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off")},t("div",{className:"cm-peak-classic-marker",style:{left:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}}),t("div",{className:"cm-peak-track"},t("div",{className:"cm-peak-segment cm-peak-high"}),t("div",{className:"cm-peak-segment cm-peak-low"})),t("span",{className:"cm-peak-classic-chip"},s(l.chip)+" · "+i)))}let en;function qo(){return en??=dt.async("./client.peak.js").then(e=>e.mount({peakView:Fe,peakPhaseAt:nt,phaseLabelKeys:ot,countdownText:Ne,resolveLocale:H,makeT:G,Tooltip:$})).catch(e=>{throw en=null,e})}function $t(e){return t(ve,{...e,load:qo,quiet:!0})}function jo(e){const n=e.useCost?.(a=>a)?.state,s=n?.config;return s?.peakEnabled&&s.peakNotice!==!1&&!s.peakProgressPromptSeen?t($t,{...e,state:n,config:s,view:"guide"}):null}function tn(e,n,s){return t(n?.peakStyle==="progress"?$t:n?.peakStyle==="classic"?Io:Eo,{config:n,t:s})}function Ho(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const u=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(u)},[]);const r=Fe(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)}),d=[s(l.notice),i];return t($,{portal:!0,label:d,side:"right",delayMs:300},t("div",{className:"cm-peak-rail "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off"),"aria-label":d.join("; ")},t("div",{className:"cm-peak-rail-track"},t("div",{className:"cm-peak-rail-segment cm-peak-rail-high"}),t("div",{className:"cm-peak-rail-segment cm-peak-rail-low"}),t("div",{className:"cm-peak-rail-marker",style:{top:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}})),t("span",{className:"cm-peak-rail-label"},s(l.short))))}function Qo(e){const{config:n,t:s}=e,[a,o]=O(Date.now());Y(()=>{const u=window.setInterval(()=>o(Date.now()),3e4);return()=>window.clearInterval(u)},[]);const r=Fe(n,a);if(r===null)return null;const l=ot(r),i=r.nextIntoPeak?s("nextPeakIn",{time:Ne(r,a,s)}):s("nextOffPeakIn",{time:Ne(r,a,s)}),d=[s(l.notice),i];return t($,{portal:!0,label:d,side:"right",delayMs:300},t("div",{className:"cm-peak-rail-classic "+(r.weekend||r.holiday?"weekend":r.inPeak?"peak":"off"),"aria-label":d.join("; ")},t("div",{className:"cm-peak-rail-classic-track"},t("div",{className:"cm-peak-rail-classic-segment peak"}),t("div",{className:"cm-peak-rail-classic-segment off"}),t("div",{className:"cm-peak-rail-classic-marker",style:{top:r.weekend||r.holiday?"50%":r.inPeak?"25%":"75%"}})),t("span",{className:"cm-peak-rail-classic-label"},s(l.short))))}function Uo(e,n,s){return t(n?.peakStyle==="progress"?$t:n?.peakStyle==="classic"?Qo:Ho,{config:n,t:s,rail:!0})}function an(e,n,s){const a=n.budget??{enabled:!1,amount:100,period:"month"},o=Number(n.exchangeRate),l=(e.budgetUsed??(a.period==="day"?U(e.today,n):a.period==="all"?U(e.total,n):U(e.month,n)))*(Number.isFinite(o)&&o>0?o:1),i=Math.max(0,Number(a.amount)||0),d=i>0?Math.min(999,l/i*100):null,u=we(d===null?null:Math.min(100,d),ue(n,"budget")),c=a.detail!==!1;return{level:d===null?"ok":d>=100?"over":d>=80?"warn":"ok",rail:u.label===null?"—":Math.round(u.label)+"%",body:t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bbox-label"},s("budget")),t("span",{className:"cm-bbox-pct cm-num"},u.label===null?"—":u.label.toFixed(1)+"%")),t("div",{className:"cm-bbox-bar"},t("div",{className:"cm-bbox-fill",style:{width:u.width+"%"}})),c?t(D,null,t("div",{className:"cm-bbox-line cm-num"},s("usedOf",{used:me(l,n),amount:me(i,n)}))):null)}}function nn(e,n,s){const a=e.goQuota,o=n?.goQuota?.main==="weekly"||n?.goQuota?.main==="monthly"?n.goQuota.main:"rolling",r=a[o],l=r!==null&&typeof r?.percent=="number"?Math.max(0,Math.min(100,Number(r.percent)||0)):0,i=b=>b!==null&&typeof b?.percent=="number"?Math.round(Math.max(0,Math.min(100,b.percent)))+"%":"—",d=b=>s(b==="rolling"?"goShortRolling":b==="weekly"?"goShortWeekly":"goShortMonthly"),u=["rolling","weekly","monthly"].filter(b=>b!==o),c=r!==null&&typeof r?.resetsAt=="string"&&r.resetsAt.length>0?s("goResetAt",{time:new Date(r.resetsAt).toLocaleString()}):"",f=n?.goQuota?.detail!==!1,p=we(l,ue(n,"go"));return{level:l>=100?"over":l>=80?"warn":"ok",rail:p.label===null?"—":Math.round(p.label)+"%",body:t(D,null,t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bbox-label"},s("goQuotaRowLabel")+" "+d(o)),t("span",{className:"cm-bbox-pct cm-num"},p.label===null?"—":Math.round(p.label)+"%")),t("div",{className:"cm-bbox-bar"},t("div",{className:"cm-bbox-fill",style:{width:p.width+"%"}})),f?t(D,null,t("div",{className:"cm-bbox-line cm-num"},u.map(b=>d(b)+" "+i(a[b])).join(" · ")),c?t("div",{className:"cm-bbox-line"},c):null):null)}}function Fo(e){const{state:n,wide:s}=e,a=n.goQuota,o=G(H(n.config));if(!a||a.status!=="ok")return null;const r=n.config?.goQuota?.main==="weekly"||n.config?.goQuota?.main==="monthly"?n.config.goQuota.main:"rolling";if(a[r]===null||typeof a[r]?.percent!="number")return null;const l=nn(n,n.config,o),i=[o("goQuotaTitle"),o("goWindowRolling")+": "+(a.rolling===null?"—":Math.round(a.rolling.percent)+"%"),o("goWindowWeekly")+": "+(a.weekly===null?"—":Math.round(a.weekly.percent)+"%"),o("goWindowMonthly")+": "+(a.monthly===null?"—":Math.round(a.monthly.percent)+"%"+(a.monthly!==null&&typeof a.monthly.resetsAt=="string"&&a.monthly.resetsAt.length>0?" · "+o("goResetAt",{time:new Date(a.monthly.resetsAt).toLocaleString()}):"")),o("goQuotaFetchedAt",{time:a.fetchedAt>0?new Date(a.fetchedAt).toLocaleTimeString():"—"})].join("; ");return t($,{portal:!0,label:i,side:"right",delayMs:300},t("div",{"data-cm-display":"go",className:"cm-bbox"+(l.level==="ok"?"":" "+l.level)+(s?"":" rail")},s?l.body:t("div",{className:"cm-bbox-rail cm-num"},l.rail)))}function _o(e){return e===null||typeof e!="object"||e.unlimited||typeof e.percent!="number"?null:Math.max(0,Math.min(100,Math.round(Number(e.percent)||0)))}function _e(e){const n=e!==null&&typeof e=="object"?e:{};return{five:n["5h"]??null,seven:n["7d"]??n.week??n.weekly??null}}function on(e,n,s=Date.now()){if(typeof e!="string"||!e)return"";const a=Date.parse(e);if(!Number.isFinite(a))return"";const o=a-s;if(o<=0)return n("resetReached");const r=Math.ceil(o/6e4),l=Math.floor(r/1440),i=Math.floor(r%1440/60),d=r%60;return l>0?n("resetDays",{d:l,h:i}):i>0?n("resetHours",{h:i,m:d}):n("resetMinutes",{m:d})}function st(e,n,s=Date.now()){const a=on(e?.resetsAt,n,s);return a?n("goResetAt",{time:new Date(e.resetsAt).toLocaleString()})+" ("+a+")":""}function Ee(e,n,s){return e===null?"—":s(n==="remaining"?"quotaRemaining":"quotaUsed",{pct:e})}function wt(e){const[,n]=O(0),s=()=>n(Date.now());return Y(()=>{if(!e)return;const a=setInterval(s,6e4);return()=>clearInterval(a)},[e]),{onMouseEnter:s,onFocus:s}}function Nt(e,n,s,a){const o=_o(n),r=o===null?"ok":o>=100?"over":o>=80?"warn":"ok",l=we(o,s),i=n?.unlimited?"∞":l.label===null?"—":l.label+"%";return{level:r,pct:o,text:i,label:l.label,row:t("div",{className:"cm-mm-row"+(r==="ok"?"":" "+r)},t("span",{className:"cm-bbox-label"},e),t("div",{className:"cm-bbox-bar"},t("div",{className:"cm-bbox-fill",style:{width:l.width+"%"}})),t("span",{className:"cm-bbox-pct cm-num"},i))}}function Jt(e){const{five:n,seven:s,fetchedAt:a,t:o,wide:r,refresh:l,direction:i="used"}=e,d=wt(n?.resetsAt),u=on(n?.resetsAt,o),c=Nt(o("codingPlanRemain5h"),n,i,o),f=Nt(o("codingPlanRemain7d"),s,i,o),p=c.level==="over"||f.level==="over"?"over":c.level==="warn"||f.level==="warn"?"warn":"ok",b=(A,w,y)=>{const m=w?.unlimited?o("quotaUnlimited"):Ee(y.label,i,o),k=st(w,o);return A+" "+m+(k?" · "+k:"")},g=[o("codingPlanMinimaxTitle"),b(o("codingPlanRemain5h"),n,c),b(o("codingPlanRemain7d"),s,f),a>0?o("goQuotaFetchedAt",{time:new Date(a).toLocaleTimeString()}):null,...l?Me(o,l):[]].filter(Boolean).join(`
|
|
3
|
+
`),h=t(D,null,t("div",{className:"cm-mm-title"},o("codingPlanMinimaxTitle")),c.row,f.row,u?t("div",{className:"cm-mm-reset"},"5h · "+u):null),x=t(D,null,t("div",{className:"cm-bbox-rail cm-num"},c.text),t("div",{className:"cm-bbox-rail cm-num"},f.text));return t($,{portal:!0,label:t("span",{style:{whiteSpace:"pre-line"}},g),side:"right",delayMs:300},t("div",{...d,"data-cm-display":"plan","data-cm-plan":"minimax",className:"cm-bbox cm-mm"+(p==="ok"?"":" "+p)+(r===!1?" rail":"")+(l?" clickable"+(l.busy?" busy":""):""),...l?ye(l.busy,l.run):{}},r===!1?x:h))}function Wo(e){const{state:n,wide:s,api:a}=e,o=n.codingPlans?.minimax,r=G(H(n.config)),l=Oe(a?()=>a.refreshCodingPlan("minimax"):null);if(!o||o.status!=="ok")return null;const{five:i,seven:d}=_e(o.windows);return i==null&&d==null?null:t(Jt,{five:i,seven:d,fetchedAt:o.fetchedAt,t:r,wide:s,refresh:l,direction:ue(n.config,"plan")})}const Go="/plugins/dsh-openai-codex/auth/status",Ko={18e3:"five",604800:"weekly"};function sn(e){if(!Array.isArray(e))return null;const n=e.find(a=>a!==null&&typeof a=="object"&&a.id==="codex");if(!n||!Array.isArray(n.windows))return null;const s={};for(const a of n.windows){const o=a!==null&&typeof a=="object"?Ko[Number(a.windowSeconds)]:null;if(!o||typeof a.remainingPercent!="number"||!Number.isFinite(Number(a.remainingPercent)))continue;const r=Number(a.resetAt??a.resetsAt);s[o]={percent:Math.max(0,Math.min(100,Math.round((100-Number(a.remainingPercent))*10)/10)),resetsAt:Number.isFinite(r)&&r>0?new Date(r*1e3).toISOString():""}}return s}function zo(e){return e===null||typeof e!="object"||e.status!=="signed-in"?null:sn(e.usage?.rateLimits)}async function Yo(e){try{const n=await K.rpc?.call("/api","codex-subscription/usage",{force:e},AbortSignal.timeout(8e3));return n?.ok?sn(n.value?.rateLimits):null}catch{return null}}const K={source:"auto",listeners:[]},Zt=e=>Object.assign(K,{rpc:e,request:null,inFlight:null,fetchedAt:0,status:"idle",windows:{}});Zt(null);const Xt=()=>{const{rpc:e,request:n,inFlight:s,listeners:a,...o}=K;return o},Vo=e=>(K.listeners.push(e),()=>{K.listeners=K.listeners.filter(n=>n!==e)}),ln=()=>{for(const e of K.listeners)try{e()}catch{}};async function vt(e=!1,n=!1,s="auto"){if(!n)return;if(K.inFlight!==null&&K.source===s)return K.inFlight;if(!e&&K.source===s&&K.fetchedAt>0&&Date.now()-K.fetchedAt<(K.status==="ok"?5:1)*6e4)return;const a={};K.request=a,K.source!==s&&Object.assign(K,{status:"idle",windows:{},fetchedAt:0,source:s}),ln();const o=Promise.resolve().then(async()=>{let r={};try{if(s!=="connect"&&(r=await Yo(e)??{}),Object.keys(r).length===0&&s!=="subscription"){const l=await fetch(Go,{credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});l.ok&&(r=zo(await l.json().catch(()=>null))??{})}}catch{}finally{if(K.request!==a)return;K.status=Object.keys(r).length>0?"ok":"unavailable",K.windows=r,K.fetchedAt=Date.now(),K.inFlight=null,ln()}});return K.inFlight=o,o}function ea(e,n="auto"){const[s,a]=O(Xt);return Y(()=>{if(!e)return;let o=!0;const r=()=>{o&&a(Xt())},l=Vo(r);r(),vt(!1,!0,n);const i=setInterval(()=>{vt(!1,!0,n)},6e4);return()=>{o=!1,clearInterval(i),l()}},[e,n]),s.source===n?s:{status:"idle",windows:{},fetchedAt:0}}function $o(e){const n=wt(),{state:s,wide:a}=e,o=G(H(s.config)),r=s.config?.codexQuotaEnabled===!0&&s.config?.codexQuotaSidebar!==!1,l=s.config?.codexQuotaSource??"auto",i=ea(r&&!e.preview,l),d=e.preview?s.displayPreviewCodex??(K.source===l?K:{status:"idle"}):i,u=Oe(e.preview?null:()=>vt(!0,r,l));if(!r)return null;if(d.status!=="ok")return t("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(a===!1?" rail":""),title:o("codexQuotaUnavailable"),...ye(u.busy,u.run)},t("div",{className:"cm-mm-title"},a===!1?"Codex":o("codexQuotaTitle")),t("span",{className:"cm-hint"},a===!1?"—":o(d.status==="idle"||u.busy?"refreshing":"codexQuotaUnavailable")));const c=[["five","codexQuotaFive"],["weekly","codexQuotaWeek"]].flatMap(([h,x])=>{const A=d.windows[h];if(!A)return[];const w=Ee(we(A.percent,"remaining").label,"remaining",o),y=new Date(typeof A.resetsAt=="string"?A.resetsAt:NaN),m=Number.isFinite(y.getTime())?o("codexQuotaReset",{time:y.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}):"";return[{key:h,label:o(x),text:w,reset:m,win:A}]});if(!c.length)return null;const f=c.some(h=>h.win.percent>=100)?"over":c.some(h=>h.win.percent>=80)?"warn":"ok",p=[o("codexQuotaTitle"),...c.map(h=>h.label+" · "+h.text+(h.reset?" · "+st(h.win,o):"")),d.fetchedAt>0?o("goQuotaFetchedAt",{time:new Date(d.fetchedAt).toLocaleTimeString()}):null,...Me(o,u)].filter(Boolean).join(`
|
|
4
|
+
`),b=t(D,null,t("div",{className:"cm-mm-title"},o("codexQuotaTitle")),...c.map(h=>t("div",{key:h.key,className:"cm-codex-window"},t("span",null,h.label+" ·"),t("strong",null,h.text),h.reset?t("span",{className:"cm-mm-reset"},"· "+h.reset):null))),g=t(D,null,...c.map(h=>t("div",{className:"cm-bbox-rail cm-num"},h.text)));return t($,{portal:!0,label:t("span",{style:{whiteSpace:"pre-line"}},p),side:"right",delayMs:300},t("div",{...n,"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(f==="ok"?"":" "+f)+(a===!1?" rail":"")+(u.busy?" busy":""),...ye(u.busy,u.run)},a===!1?g:b))}function lt(e,n){return e.startsWith("core_")?"Core · "+lt(e.slice(5),n):e==="fiveHour"||e==="5h"?"5h":e==="weekly"||e==="week"||e==="7d"?e==="7d"?"7d":n("goShortWeekly"):e==="monthly"||e==="month"?n("goShortMonthly"):e==="daily"||e==="day"?n("goShortDaily"):e==="plan"?n("mimoWindowPlan"):e==="compensation"?n("mimoWindowCompensation"):e==="balance"?n("codingPlanWindowBalance"):String(e).replace(/_/g," ")}function Jo(e){const n=wt(),{id:s,state:a,wide:o,api:r}=e,l=a.codingPlans?.[s],i=G(H(a.config)),d=Oe(r?()=>r.refreshCodingPlan(s):null),u=qe.find(m=>m.id===s);if(!u||!l||l.status!=="ok")return null;const c=l.windows!==null&&typeof l.windows=="object"?l.windows:{},f=Object.entries(c);if(f.length===0)return null;const p=m=>m!==null&&typeof m=="object"&&typeof m.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(m.percent)||0))):null,b=ue(a.config,"plan"),g=f.map(([m,k])=>{const N=p(k);if(N===null)return t("div",{key:m,className:"cm-mm-row wide"},t("span",{className:"cm-mm-text"},typeof k?.text=="string"?k.text:"—"));const P=N>=100?"over":N>=80?"warn":"ok",R=we(N,b);return t("div",{key:m,className:"cm-mm-row wide"+(P==="ok"?"":" "+P)},t("span",{className:"cm-bbox-label"},lt(m,i)),t("div",{className:"cm-bbox-bar"},t("div",{className:"cm-bbox-fill",style:{width:R.width+"%"}})),t("span",{className:"cm-bbox-pct cm-num"},R.label===null?"—":R.label+"%"))}),h=f.map(([m,k])=>{const N=p(k),P=st(k,i),R=N===null?typeof k?.text=="string"?k.text:"—":Ee(we(N,b).label,b,i);return lt(m,i)+" "+R+(P?" · "+P:"")});l.fetchedAt>0&&h.push(i("goQuotaFetchedAt",{time:new Date(l.fetchedAt).toLocaleTimeString()})),l.message&&h.push(l.message),h.push(...Me(i,d));const x=[i(u.labelKey),...h].join(`
|
|
5
|
+
`),A=f.map(([,m])=>p(m)).filter(m=>m!==null),w=A.some(m=>m>=100)?"over":A.some(m=>m>=80)?"warn":"ok",y=A.length>0?A.slice(0,2).map(m=>we(m,b).label+"%").join(" "):typeof f[0][1]?.text=="string"?f[0][1].text:"—";return t($,{portal:!0,label:t("span",{style:{whiteSpace:"pre-line"}},x),side:"right",delayMs:300},t("div",{...n,"data-cm-display":"plan","data-cm-plan":s,className:"cm-bbox cm-mm clickable"+(w==="ok"?"":" "+w)+(o===!1?" rail":"")+(d.busy?" busy":""),...ye(d.busy,d.run)},o===!1?t("div",{className:"cm-bbox-rail cm-num"},y):t(D,null,t("div",{className:"cm-mm-title"},i(u.labelKey)),...g)))}const rn=e=>{try{return window.localStorage?.getItem?.("cm.gw."+e)??""}catch{return""}},Zo=(e,n)=>{try{window.localStorage?.setItem?.("cm.gw."+e,n)}catch{}};function Xo(e){const n=wt(),{source:s,snapshot:a,state:o,wide:r,api:l}=e,i=G(H(o.config)),[d,u]=O(()=>({source:s.id,id:rn(s.id)})),c=Oe(l?()=>l.refreshGatewayQuota(s.id):null),f=ue(o.config,"plan"),p=a.accounts.length>1,b=d.source===s.id?d.id:rn(s.id),g=a.accounts.findIndex(v=>v.id===b),h=g>=0?g:Math.max(0,a.accounts.findIndex(v=>v.windows.length>0||v.credits!=null)),x=a.accounts[h]??a.accounts[0],A=x?.label||x?.id||"",w=v=>p?(Ca[v.provider]??v.provider)+" · ":"",y=p&&x?[x]:a.accounts,m=[];for(const v of y){if(m.length>=4)break;for(const j of v.windows){if(m.length>=4)break;const ie=w(v)+(j.label||j.id||i("gatewaySourceUnknown"));m.push({win:j,name:ie,view:Nt(ie,j,f,i)})}v.windows.length===0&&v.credits!=null&&m.push({win:null,name:w(v)+(v.credits.unit||"credits"),text:(v.credits.used??"—")+" / "+(v.credits.limit??"—")})}m.length===0&&m.push({name:i("gatewayQuotaEmpty"),text:"—"});const k=m.some(v=>v.view?.level==="over")?"over":m.some(v=>v.view?.level==="warn")?"warn":"ok",N=m.map(v=>{if(v.text!=null)return v.name+" "+v.text;const j=st(v.win,i);return v.name+" "+Ee(v.view.label,f,i)+(j?" · "+j:"")});a.fetchedAt>0&&N.push(i("goQuotaFetchedAt",{time:new Date(a.fetchedAt).toLocaleTimeString()})),N.push(...Me(i,c));const R=[p&&A?`${s.label||s.id} (${h+1}/${a.accounts.length} · ${A})`:s.label||s.id,...N].join(`
|
|
6
|
+
`),I=m.map((v,j)=>v.text!=null?t("div",{key:j,className:"cm-mm-row wide"},t("span",{className:"cm-bbox-label"},v.name),t("span",{className:"cm-mm-text cm-num"},v.text)):t(D,{key:j},v.view.row)),C=v=>{if(!v.key||v.key==="Enter"||v.key===" "){v.stopPropagation(),v.preventDefault?.();const j=a.accounts[(h+1)%a.accounts.length];Zo(s.id,j.id),u({source:s.id,id:j.id})}},q=p?t("span",{className:"cm-gw-switcher","aria-label":i("gatewaySwitchAccount",{account:A||h+1}),onClick:C,onKeyDown:C,role:"button",tabIndex:0},`${h+1}/${a.accounts.length} ⇄`):null,Q=p?t("div",{className:"cm-bbox-head"},t("div",{className:"cm-mm-title"},s.label||s.id),q):t("div",{className:"cm-mm-title"},s.label||s.id),oe=p&&A?t("div",{className:"cm-gw-sub"},A):null,ee=t(D,null,Q,oe,...I),W=m.filter(v=>v.view).map(v=>v.view.label).filter(v=>v!==null),V=W.length>0?W.slice(0,2).map(v=>v+"%").join(" "):m[0].text??"—",M=t("div",{className:"cm-bbox-rail cm-num"},V);return t($,{portal:!0,label:t("span",{style:{whiteSpace:"pre-line"}},R),side:"right",delayMs:300},t("div",{...n,className:"cm-bbox cm-mm clickable"+(k==="ok"?"":" "+k)+(r===!1?" rail":"")+(c.busy?" busy":""),...ye(c.busy,c.run)},r===!1?t(D,null,M,q):ee))}function es(e,n,s,a){const o=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:[],r=[];for(const l of n.gatewayQuotas?.sources??[]){if(l.enabled===!1||l.display!=="sidebar"&&l.display!=="both")continue;const i=o.find(d=>d.id===l.id);!i||i.status!=="ok"&&i.status!=="partial"&&i.status!=="stale"||i.accounts.length===0||r.push(t(Xo,{source:l,snapshot:i,state:e,wide:s,api:a}))}return r}const ts={anthropic:"Claude",zai:"Z.ai",minimax:"MM",kimi:"Kimi",openrouter:"OR",siliconflow:"SF",commandcode:"CC",scnet:"SCNet",volcengine:"Ark",qwen:"Qwen",mimo:"MiMo",factory:"Factory",opendesign:"OpenDesign"};function as(e){const n=e.useCost?e.useCost(w=>w):void 0,s=n?.state?.config;ea(s?.codexQuotaEnabled===!0&&s.codexQuotaStrip!==!1&&s.quotaStrip?.enabled===!0,s?.codexQuotaSource);const[a,o]=O(null),[r,l]=O({}),i=n?.state,d=e.api;if(!i)return null;const u=i.config,c=u.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};if(c.enabled!==!0)return null;const f=G(H(u)),p=[];if(c.budget!==!1){const w=u.budget??{enabled:!1,amount:100,period:"month"};if(w.enabled===!0){const y=Number(u.exchangeRate),k=(i.budgetUsed??(w.period==="day"?U(i.today,u):w.period==="all"?U(i.total,u):U(i.month,u)))*(Number.isFinite(y)&&y>0?y:1),N=Math.max(0,Number(w.amount)||0);if(N>0){const P=Math.min(999,k/N*100),R=P>=100?"over":P>=80?"warn":"ok";p.push({key:"budget",label:f("budgetShort"),level:R,tip:f("budgetOf",{period:f(ze[w.period]??"periodMonth")})+" · "+f("usedOf",{used:me(k,u),amount:me(N,u)})+" · "+P.toFixed(1)+"%",segs:[{name:"main",pct:Math.round(we(Math.min(100,P),ue(u,"budget")).width)}]})}}}if(c.go!==!1){const w=i.goQuota;if(u?.goQuota?.enabled!==!1&&w?.status==="ok"){const y=u.goQuota.main==="weekly"||u.goQuota.main==="monthly"?u.goQuota.main:"rolling",m=y==="rolling"?w.rolling:y==="weekly"?w.weekly:w.monthly;if(m!==null&&typeof m=="object"&&typeof m.percent=="number"){const k=Math.max(0,Math.min(100,Math.round(Number(m.percent)||0))),N=k>=100?"over":k>=80?"warn":"ok",P=typeof m.resetsAt=="string"&&m.resetsAt.length>0?" · "+f("goResetAt",{time:new Date(m.resetsAt).toLocaleString()}):"";p.push({key:"go",label:"Go "+f(y==="rolling"?"goShortRolling":y==="weekly"?"goShortWeekly":"goShortMonthly"),level:N,tip:"Go: "+k+"%"+P,segs:[{name:"main",pct:Math.round(we(k,ue(u,"go")).width)}]})}}}if(c.plans!==!1)for(const w of qe){const y=i.codingPlans?.[w.id];if(u.codingPlans?.[w.id]?.enabled!==!0||!y||y.status!=="ok")continue;const m=y.windows!==null&&typeof y.windows=="object"?y.windows:{},k=Object.entries(m),N=w.id==="factory"?[k.filter(([P])=>!P.startsWith("core_")),k.filter(([P])=>P.startsWith("core_"))]:[k];for(const[P,R]of N.entries()){if(R.length===0)continue;const I=ts[w.id]??w.id,C=[],q=[];y.message&&q.push(y.message);let Q=0,oe=0;for(const[ee,W]of R){const V=lt(ee,f),M=typeof W?.resetsAt=="string"&&W.resetsAt.length>0?" · "+f("goResetAt",{time:new Date(W.resetsAt).toLocaleString()}):"",v=W!==null&&typeof W=="object"&&typeof W.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(W.percent)||0))):null;if(q.push(V+" "+(v===null?typeof W?.text=="string"?W.text:"—":v+"%")+M),v===null){C.push({name:ee,pct:null,text:typeof W?.text=="string"?W.text:"—"});continue}oe>=(w.id==="factory"?3:2)||(oe+=1,C.push({name:ee,pct:Math.round(we(v,ue(u,"plan")).width)}),Q=Math.max(Q,v>=100?2:v>=80?1:0))}y.fetchedAt>0&&q.push(f("goQuotaFetchedAt",{time:new Date(y.fetchedAt).toLocaleTimeString()})),C.length!==0&&p.push({key:w.id+(P?":core":""),label:I+(w.id==="factory"?P?" Core":" Standard":""),level:["ok","warn","over"][Q],tip:q.join("; "),segs:C})}}const b=u.codexQuotaEnabled===!0&&u.codexQuotaStrip!==!1&&K.source===(u.codexQuotaSource??"auto")&&K.status==="ok"?K.windows:{},g=b.five??null,h=b.weekly??null,x=w=>Math.max(0,Math.min(100,Math.round(Number(w.percent)||0)));if(g!==null||h!==null){const w=g===null?null:x(g),y=h===null?null:x(h),m=Math.max(w??0,y??0);p.push({key:"codex",label:"Codex",level:m>=100?"over":m>=80?"warn":"ok",tip:f("codexQuotaTitle")+": "+[w===null?null:"5h "+Ee(100-w,"remaining",f),y===null?null:f("codingPlanRemain7d")+" "+Ee(100-y,"remaining",f)].filter(Boolean).join(" · "),segs:[w===null?null:{name:"5h",pct:100-w},y===null?null:{name:"weekly",pct:100-y}].filter(Boolean)})}if(p.length===0)return null;const A=w=>{a!==null||!d||(o(w),l(y=>({...y,[w]:null})),Promise.resolve().then(()=>w==="budget"?d.reload():w==="go"?d.refreshGoQuota():w==="codex"?vt(!0,u.codexQuotaEnabled===!0,u.codexQuotaSource):w==="factory:core"?d.refreshCodingPlan("factory"):d.refreshCodingPlan(w)).catch(y=>{l(m=>({...m,[w]:y?.message??String(y)}))}).finally(()=>o(null)))};return t("div",{className:"cm-qstrip"},p.map(w=>{const y=a===w.key,m=r[w.key],k=[t("span",{className:"cm-qlabel",key:"l"},w.label)];y?k.push(t("span",{className:"cm-qtext",key:"busy"},f("refreshing"))):w.segs.forEach((P,R)=>{R>0&&k.push(t("span",{className:"cm-qsep",key:"sep"+R,"aria-hidden":"true"})),P.pct===null?k.push(t("span",{className:"cm-qtext",key:P.name},P.text)):k.push(t("span",{className:"cm-qseg",key:P.name},t("span",{className:"cm-qbar"},t("span",{className:"cm-qfill",style:{width:P.pct+"%"}})),t("span",null,w.key==="codex"?(w.segs.length>1?(P.name==="5h"?"5h":f("goShortWeekly"))+" ":"")+Ee(P.pct,"remaining",f):P.pct+"%")))});const N=[w.tip];return!y&&d&&N.push(f("clickToRefresh")),y&&N.push(f("refreshing")),m&&N.push("⚠ "+f("balanceRefreshFailed",{message:m})),t($,{portal:!0,key:w.key,label:N.join("; "),side:"bottom",delayMs:400},t("span",{className:"cm-qchip"+(d?" action":"")+(w.level==="ok"?"":" "+w.level),...d?ye(y,()=>A(w.key)):{}},k))}))}const rt="dsh-cost-meter:simple-guide-dismissed";function ta(e){if(e?.sidebarSimplePromptSeen===!0)return!0;try{return window.localStorage.getItem(rt)==="1"}catch{return!1}}function ns(e){const n=e.useCost?e.useCost(g=>g):void 0,s=ge(!1),[a,o]=O(!1),[r,l]=O(!1),[i,d]=O(!1),u=n?.state?.config,c=!!u&&!i&&!ta(u);if(Y(()=>{const g=()=>d(!0);return window.addEventListener?.(rt,g),()=>window.removeEventListener?.(rt,g)},[]),!c)return null;const f=G(H(u)),p=()=>{d(!0);try{window.localStorage.setItem(rt,"1")}catch{}window.dispatchEvent?.(new Event(rt))},b=async g=>{if(!s.current){s.current=!0,o(!0),l(!1);try{if((await e.api.updateConfig({sidebarSimple:g,sidebarSimplePromptSeen:!0}))?.config?.sidebarSimple!==g)throw new Error;p()}catch{l(!0)}finally{s.current=!1,o(!1)}}};return t(Za,{actions:{close:p,keep:()=>b(!1),enable:()=>b(!0)},className:"cm-qguide",role:"dialog","aria-label":f("sidebarSimpleTitle"),"aria-busy":a,onKeyDown:g=>{g.key==="Escape"&&(g.stopPropagation(),p())}},t("div",{className:"cm-bbox-head"},t("h4",null,f("sidebarSimpleTitle")),t("button",{type:"button",className:"cm-btn small","aria-label":f("closeGuide"),"data-cm-action":"close",onClick:p},"×")),t("p",null,f("sidebarSimpleBody")),r?t("p",{role:"alert"},f("sidebarSimpleError")):null,t("div",{className:"cm-buttons"},t("button",{type:"button",className:"cm-btn small","data-cm-action":"keep",disabled:a,onClick:()=>b(!1)},f("sidebarSimpleOff")),t("button",{type:"button",className:"cm-btn small primary","data-cm-action":"enable",disabled:a,onClick:()=>b(!0)},f("sidebarSimpleOn"))))}function os(e){const n=e.useCost?e.useCost(i=>i):void 0,s=ge(!1),a=n?.state;if(!a)return null;const o=a.config;if(!ta(o)||o.quotaStrip?.promptSeen===!0)return null;const r=G(H(o)),l=i=>{if(s.current===!0)return;s.current=!0;const d=o.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};e.api.updateConfig({quotaStrip:{...d,enabled:i,promptSeen:!0}}).catch(()=>{s.current=!1})};return t("div",{className:"cm-qguide",role:"dialog","aria-label":r("quotaStripGuideTitle")},t("h4",null,r("quotaStripGuideTitle")),t("p",null,r("quotaStripGuideBody")),t("div",{className:"cm-buttons"},t("button",{type:"button",className:"cm-btn small",onClick:()=>l(!1)},r("quotaStripGuideOff")),t("button",{type:"button",className:"cm-btn small primary",onClick:()=>l(!0)},r("quotaStripGuideOn"))))}const cn="dsh-cost-meter:balance-click-hint-seen",ss=()=>{try{return window.localStorage.getItem(cn)==="1"}catch{return!1}},ls=()=>{try{window.localStorage.setItem(cn,"1")}catch{}};function rs(e){const n=e.useCost?e.useCost(b=>b):void 0,s=ge(!1),[a,o]=O(!1),[r]=O(ss),l=n?.state;if(!l)return null;const i=l.config,d=i.balance?.display==="sidebar"||i.balance?.display==="both",u=(i?.customBalances??[]).some(b=>b?.enabled===!0&&(b.display==="sidebar"||b.display==="both"))||i.customBalance?.enabled===!0&&(i.customBalance?.display==="sidebar"||i.customBalance?.display==="both"),c=qe.some(b=>{const g=i.codingPlans?.[b.id];return g?.enabled===!0&&(g.display==="sidebar"||g.display==="both")});if(a||r||i.balance?.clickHintSeen===!0||!d&&!u&&!c||!ta(i)||i.quotaStrip?.promptSeen!==!0)return null;const f=G(H(i)),p=()=>{s.current!==!0&&(o(!0),s.current=!0,ls(),e.api.updateConfig({balance:{...i.balance??{},clickHintSeen:!0}}).catch(()=>{s.current=!1,o(!1)}))};return t("div",{className:"cm-qguide",role:"dialog","aria-label":f("balanceClickGuideTitle")},t("h4",null,f("balanceClickGuideTitle")),t("p",null,f("balanceClickGuideBody")),t("div",{className:"cm-buttons"},t("button",{type:"button",className:"cm-btn small primary",onClick:p},f("balanceClickGuideOk"))))}function un(e,n,s){return n.sidebarTodayMetric==="tokens"?L(["input","output","cacheRead","cacheWrite","reasoning"].reduce((a,o)=>a+(Number(e?.[o])||0),0))+" "+s("tokensUnit"):z(U(e,n),n)}function aa(e){const{state:n,wide:s}=e,a=n.today,o=n.config,r=G(H(o)),l=un(a,o,r),i=o.budget??{enabled:!1,amount:100,period:"month"},d=Number(o.exchangeRate),c=(n.budgetUsed??(i.period==="day"?U(n.today,o):i.period==="all"?U(n.total,o):U(n.month,o)))*(Number.isFinite(d)&&d>0?d:1),f=Math.max(0,Number(i.amount)||0),p=f>0?Math.min(999,c/f*100):null,b=p===null?"ok":p>=100?"over":p>=80?"warn":"ok";if(i.enabled===!0&&o.hideBudget!==!0&&e.todayOnly!==!0){const h=[r("budgetOf",{period:r(ze[i.period]??"periodMonth")}),r("usedOf",{used:me(c,o),amount:me(f,o)})+" · "+(p===null?"—":p.toFixed(1)+"%"),r("monthTotal",{month:z(U(n.month,o),o),total:z(U(n.total,o),o)})].join("; ");if(e.summary===!0)return t($,{portal:!0,label:h,side:"right",delayMs:300},t("div",{"data-cm-display":"budget",className:"cm-simple-summary"+(b==="ok"?"":" "+b),tabIndex:0},t("span",null,r("budgetOf",{period:r(ze[i.period]??"periodMonth")})),t("span",{className:"cm-num"},me(c,o)+" / "+me(f,o))));const x=an(n,o,r);return t($,{portal:!0,label:h,side:"right",delayMs:300},t("div",{"data-cm-display":"budget",className:"cm-bbox"+(b==="ok"?"":" "+b)+(s?"":" rail")},s?x.body:t("div",{className:"cm-bbox-rail cm-num"},x.rail)))}const g=[o.sidebarTodayMetric==="tokens"?r("todayTokensTitle"):r("todayCostTitle"),r("callsTokens",{calls:a.calls,input:L(a.input),cache:L(a.cacheRead+a.cacheWrite),output:L(a.output)}),r("monthCost",{amount:z(U(n.month,o),o)}),r("totalCost",{amount:z(U(n.total,o),o)})].join("; ");return t($,{portal:!0,label:g,side:"right",delayMs:300},t("div",{"data-cm-display":"today",className:"cm-foot"+(s?"":" cm-foot-rail")},s?t(D,null,r("today")," ",t("span",{className:"cm-num"},l)):t(kt,{size:16})))}function is(e){const n=e.useCost?e.useCost(o=>o):void 0;ea(n?.state?.config?.codexQuotaEnabled===!0&&n?.state?.config?.codexQuotaSidebar!==!1,n?.state?.config?.codexQuotaSource);let s;if(e.useProjection)try{s=e.useProjection("costUsage")}catch{s=void 0}Fa(e,s);const a=n?.state;return a?na(a,!!e.wide,e.api):null}function na(e,n,s,a=!1){const o=e.config,r=G(H(o)),l=(o.balance?.display==="sidebar"||o.balance?.display==="both")&&o.hideOfficialBalance!==!0,d=xt(e,o).length>0,u=l&&o.balance?.showProgressBar===!0&&e.balance?.status==="ok",c=d&&o.balance?.showProgressBar===!0,f=o.goQuota?.main==="weekly"||o.goQuota?.main==="monthly"?o.goQuota.main:"rolling",p=o.goQuota?.enabled!==!1&&(o.goQuota?.display==="sidebar"||o.goQuota?.display==="both")&&e.goQuota?.status==="ok"&&e.goQuota?.[f]!==null,b=qe.map(I=>I.id).filter(I=>{const C=o.codingPlans?.[I];if(C?.enabled!==!0||C.display!=="sidebar"&&C.display!=="both")return!1;const q=e.codingPlans?.[I];if(q?.status!=="ok")return!1;const Q=q.windows!==null&&typeof q.windows=="object"?q.windows:{};return Object.keys(Q).length>0}),g=b.length>0,h=es(e,o,n,s),x=o.codexQuotaEnabled===!0&&o.codexQuotaSidebar!==!1,A=(o.budget??{}).enabled===!0&&o.hideBudget!==!0,w=o.sidebar!==!1&&o.hideTodayCost!==!0,y=Fe(o,Date.now())!==null,m=o.sidebarModels?.enabled===!0;if(!m&&!l&&!d&&!p&&!g&&!x&&!A&&!w&&!y&&h.length===0)return null;const k=o.sidebarSimple===!0,N=!k&&n&&o.sidebarStyle==="compact",P=[];k&&n&&w&&P.push(t("div",{"data-cm-display":"today",className:"cm-simple-summary"},t("span",null,r("today")),t("span",{className:"cm-num"},un(e.today,o,r)))),u?P.push(t(Mo,{state:e,wide:n,api:s})):l&&P.push(t(Po,{state:e,wide:n,api:s})),c?P.push(t(Ro,{state:e,wide:n,api:s})):d&&P.push(t(Bo,{state:e,wide:n,api:s}));const R=P.length;if(g&&P.push(...b.map(I=>I==="minimax"?t(Wo,{state:e,wide:n,api:s}):t(Jo,{id:I,state:e,wide:n,api:s}))),P.push(...h),x&&P.push(t($o,{state:e,wide:n,api:s,preview:a})),p&&A&&n&&!k){const I=nn(e,o,r),C=an(e,o,r),q=I.level==="over"||C.level==="over"?"over":I.level==="warn"||C.level==="warn"?"warn":"ok";P.push(t("div",{className:"cm-bbox cm-bbox-pair"+(q==="ok"?"":" "+q)},t("div",{"data-cm-display":"go",className:"cm-bbox-section"+(I.level==="ok"?"":" "+I.level)},I.body),t("div",{className:"cm-bbox-divider"}),t("div",{"data-cm-display":"budget",className:"cm-bbox-section"+(C.level==="ok"?"":" "+C.level)},C.body)))}else p&&P.push(t(Fo,{state:e,wide:n})),A&&P.push(t(aa,{state:e,wide:n,summary:k&&n}));return w&&!(k&&n)&&P.push(t(aa,{state:e,wide:n,todayOnly:!0})),y&&P.push(n?tn(e,o,r):Uo(e,o,r)),m&&P.splice(o.sidebarModels.position==="first"?0:o.sidebarModels.position==="afterBalance"?R:P.length,0,t(cs,{key:"models",state:e,wide:n,preview:a})),t("div",{...k?{tabIndex:0,role:"region","aria-label":r("sidebarSimple")}:{},className:"cm-footer-stack"+(n?"":" rail")+(N?" compact":"")+(k?" simple":"")},...P)}const oa={enabled:!1,period:"today",topN:5,summary:"total",position:"last",defaultOpen:!1,remember:!0,tokens:!1,shares:!0,refreshSeconds:60,dock:!1},dn="dsh-cost-meter:models-open";function mn(e,n,s){return gn(e,e.config,s,n).map(a=>({...a,label:a.key==="deepseek:legacy"?a.label:bn(a.key),cost:U(a,e.config)})).sort((a,o)=>o.cost-a.cost||o.tokens-a.tokens||a.key.localeCompare(o.key))}function cs({state:e,wide:n,preview:s=!1}){const a={...oa,...e.config.sidebarModels},o=G(H(e.config)),r=()=>{try{const y=a.remember?window.localStorage.getItem(dn):null;if(y!==null)return y==="1"}catch{}return a.defaultOpen},[l,i]=O(r),[d,u]=O(a.period);Y(()=>u(a.period),[a.period]);const c=ge(a.defaultOpen);Y(()=>{i(s&&c.current!==a.defaultOpen?a.defaultOpen:r()),c.current=a.defaultOpen},[a.defaultOpen,a.remember]);const f=mn(e,d,o),p=f.reduce((y,m)=>y+m.cost,0),b=y=>z(y,e.config),g=o(d==="history"?"modelStatsHistory":"modelStatsToday")+" "+b(p)+" · "+o("modelsCount",{n:f.length}),h=a.summary==="top"&&f.length?f[0].label+" "+b(f[0].cost):g,x=a.summary==="top"&&f.length?t(D,null,t("span",{className:"cm-bal-label"},f[0].label),t("span",{className:"cm-bal-amt"},b(f[0].cost))):t("span",{className:"cm-bal-label"},h),A=()=>{i(!l);try{a.remember&&!s&&window.localStorage.setItem(dn,l?"0":"1")}catch{}};if(!n||e.config.sidebarSimple)return t("div",{"data-cm-display":"models",className:"cm-foot cm-num"+(n?"":" cm-foot-rail"),title:h+" · "+g},n?x:t(kt,{size:16}));const w=f.slice(0,a.topN);return f.length>a.topN&&w.push(f.slice(a.topN).reduce((y,m)=>{for(const k of["cost","input","output","cacheRead","cacheWrite"])y[k]+=m[k];return y},{key:"other",label:o("modelsOther"),cost:0,input:0,output:0,cacheRead:0,cacheWrite:0})),t("div",{"data-cm-display":"models",className:"cm-bbox cm-model-costs"},t("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(l),title:g,onClick:A},t("span",{className:"cm-caret"+(l?" open":"")}),x),l?t(D,null,t("div",{className:"cm-buttons"},["today","history"].map(y=>t("button",{key:y,type:"button",className:"cm-mstats-tab"+(d===y?" active":""),"aria-pressed":d===y,onClick:()=>u(y)},o(y==="today"?"modelStatsToday":"modelStatsHistory")))),w.length?w.map(y=>t("div",{key:y.key},t("div",{className:"cm-bbox-head"},t("span",{className:"cm-bal-label",title:y.label},y.label),t("span",{className:"cm-num cm-bal-amt"},b(y.cost))),a.shares?t("div",{className:"cm-bbox-bar",title:(p>0?y.cost/p*100:0).toFixed(1)+"%"},t("div",{className:"cm-bbox-fill",style:{width:(p>0?y.cost/p*100:0)+"%"}})):null,a.tokens?t("div",{className:"cm-mstats-note"},o("modelStatsInput")+" "+L(y.input)+" · "+o("modelStatsCache")+" "+L(y.cacheRead+y.cacheWrite)+" · "+o("modelStatsOutput")+" "+L(y.output)):null)):t("span",{className:"cm-note"},o("modelStatsEmpty"))):null)}function us({draft:e,setDraft:n,t:s,visibilityControl:a=!0}){const o={...oa,...e?.sidebarModels},r=(i,d)=>{e&&n({...e,sidebarModels:{...o,[i]:d}})},l=(i,d)=>t("div",{className:"cm-field",key:i},t("label",null,s("models_"+i)),t("select",{className:"cm-input",value:o[i],onChange:u=>r(i,u.target.value)},d.map(([u,c])=>t("option",{key:u,value:u},s(c)))));return t("div",{className:"cm-grid"},a?t("div",{className:"cm-grid-group"},s("modelsTitle")):null,["enabled","defaultOpen","remember","tokens","shares","dock"].filter(i=>a||i!=="enabled").map(i=>t("label",{key:i,className:"cm-check"},t("input",{type:"checkbox",checked:o[i],onChange:d=>r(i,d.target.checked)}),s("models_"+i))),l("period",[["today","modelStatsToday"],["history","modelStatsHistory"]]),l("summary",[["total","modelsTotal"],["top","modelsTop"]]),l("position",[["first","modelsFirst"],["afterBalance","modelsAfter"],["last","modelsLast"]]),["topN","refreshSeconds"].map(i=>t("div",{key:i,className:"cm-field"},t("label",null,s("models_"+i)),Ie({value:o[i]},d=>r(i,Math.max(i==="topN"?1:10,Math.min(i==="topN"?10:60,Math.floor(d))))))))}function St(e){return t("div",{className:"cm-card"},t("p",{className:"cm-card-title"},e.title),t("div",{className:"cm-card-value cm-num"},e.value),t("p",{className:"cm-card-sub"},e.sub))}const sa=new WeakMap,la=(e,n)=>e?.().then(s=>(sa.set(e,s),s.prefetch?.(n))).catch(()=>{});function ds(e){const n=e.useCost?.(l=>l)?.state,s=n?.billionContext,[a,o]=O(null),r=s?.noticeId&&["needs_update","changed","bridge_missing"].includes(s.compatibility);return Y(()=>{if(!r)return;let l=!0;return e.api.loadStatistics().then(i=>{l&&o(()=>i.BillionCompatibilityNotice)}).catch(()=>{}),()=>{l=!1}},[!!r,e.api]),r&&a?t(a,{meter:s,locale:H(n?.config??{})}):null}function ve(e){const n=e.load??e.api.loadStatistics,[s,a]=O(()=>sa.get(n)??null),[o,r]=O(""),[l,i]=O(0);return Y(()=>{let d=!0;if(r(""),typeof n=="function")return n().then(u=>{sa.set(n,u),d&&a(()=>u)},u=>{d&&r(String(u.message??u))}),()=>{d=!1}},[e.api,e.load,l]),s?t(s,{...e,formatMoneyUsd:z,formatTokens:L,resolveLocale:H}):e.quiet?null:t("div",{className:o?"":"cm-loading",role:o?"alert":"status","aria-label":H(e.state?.config)==="en"?"Loading":"正在读取"},o||t(D,null,t("i"),t("i"),t("i")),o?t("button",{className:"cm-btn",onClick:()=>i(d=>d+1)},"↻"):null)}const ms="cm-stat-dialog";function ps(e){const n=e.useCost?.(c=>c),s=n?.state,[a,o]=O(null),r=Te.useRef(null),l=s?.config[e.entryPosition==="header"?"hideSessionCostHeader":"hideSessionCostDock"]===!0,i=!l&&!!e.sessionId&&a===e.sessionId;if(Y(()=>{i&&r.current?.showModal()},[i]),Y(()=>{o(null)},[e.sessionId,l]),!e.sessionId||l)return null;const d=H(s?.config)==="en",u=d?"Conversation cost details":"本会话费用明细";return t(D,null,t("button",{type:"button",className:"cm-btn cm-stat-entry cm-stat-"+(e.entryPosition||"dock"),title:u,"aria-label":u,"aria-haspopup":"dialog",onMouseEnter:()=>la(e.api.loadStatistics,{state:s,sessionId:e.sessionId}),onFocus:()=>la(e.api.loadStatistics,{state:s,sessionId:e.sessionId}),onClick:()=>o(e.sessionId)},d?"Cost details":"费用明细"),i?t("dialog",{ref:r,role:"dialog",className:ms,"aria-label":u,onCancel:()=>o(null)},t("header",{className:"cm-stat-dialog-head"},t("strong",null,u),t("button",{type:"button",className:"cm-btn",autoFocus:!0,"aria-label":d?"Close":"关闭",onClick:()=>o(null)},"×")),t("div",{className:"cm-stat-dialog-body"},s?t(ve,{key:e.sessionId,state:s,api:e.api,sessionId:e.sessionId}):t("p",{role:n?.error?"alert":"status"},n?.error||(d?"Loading…":"加载中…"),t("button",{type:"button",className:"cm-btn",onClick:()=>e.api.reload()},d?"Retry":"重试")))):null)}function fs({state:e,t:n}){const s=e.externalUsage;if(!s)return null;const a=e.config,o=u=>z(U(u,a),a),r=u=>n("callsTokens",{calls:u.calls,input:L(u.input),cache:L(u.cacheRead+u.cacheWrite),output:L(u.output)}),l=(u,c)=>({calls:u.calls+c.calls,input:u.input+c.input,output:u.output+c.output,cacheRead:u.cacheRead+c.cacheRead,cacheWrite:u.cacheWrite+c.cacheWrite,cost:U(u,a)+c.cost,apiCost:U(u,a)+c.cost}),i=(u,c)=>t("tr",{key:u},t("td",null,u),t("td",{className:"num"},String(c.calls)),t("td",{className:"num"},L(c.input)),t("td",{className:"num"},L(c.cacheRead+c.cacheWrite)),t("td",{className:"num"},L(c.output)),t("td",{className:"num"},o(c))),d=u=>t("div",{className:"cm-scroll"},t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,n("colDate")),...["colCalls","colInTok","colCacheTok","colOutTok","colCost"].map(c=>t("th",{className:"num"},n(c))))),t("tbody",null,u)));return t("section",{className:"cm-budget"},t("h3",{className:"cm-h"},n("externalUsage")),s.stale?t("p",{className:"cm-note"},n("externalStale")):null,t("div",{className:"cm-cards"},["today","month","total"].map((u,c)=>{const f=l(e[u],s.combined[u]);return t(St,{key:u,title:n("combinedUsage")+" · "+n(["cardToday","cardMonth","cardTotal"][c]),value:o(f),sub:r(f)})})),...s.sources.map(u=>t("details",{key:u.source},t("summary",null,u.source+" · "+n("cardToday")+" "+o(u.today)+" · "+n("cardMonth")+" "+o(u.month)+" · "+r(u.today)),d(["today","month","total"].map((c,f)=>i(n(["cardToday","cardMonth","cardTotal"][f]),u[c]))),t("p",{className:"cm-note"},n("externalHistory")),d(u.history.map(c=>i(c.date,c))))))}const it=(e,n,s)=>t("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(e),onClick:n},t("span",{className:"cm-caret"+(e?" open":"")}),t("h3",{className:"cm-h"},s));function bs(e){const{state:n,api:s}=e,a=G(H(n.config)),[o,r]=O(!1);return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(o,()=>r(!o),a("history"))),o?t("div",{className:"cm-collapse-body"},t(gs,{state:n,api:s})):null)}function gs(e){const{state:n,api:s}=e,a=G(H(n.config)),[o,r]=O(null),[l,i]=O({}),[d,u]=O(()=>new Set),c=n.history??[];if(c.length===0)return t("p",{className:"cm-empty"},a("noHistory"));const f=b=>{if(o===b){r(null);return}r(b),!(l[b]!==void 0||d.has(b))&&(u(g=>{const h=new Set(g);return h.add(b),h}),s.getDaySessions(b).then(g=>i(h=>({...h,[b]:Array.isArray(g?.sessions)?g.sessions:[]}))).catch(()=>i(g=>({...g,[b]:"error"}))).finally(()=>u(g=>{const h=new Set(g);return h.delete(b),h})))},p=b=>b.map(g=>t("tr",{key:g.id},ra(g,n.config?.showSessionId===!0,a),t("td",{className:"num"},String(g.calls)),t("td",{className:"num"},L(g.input)),t("td",{className:"num"},L(g.cacheRead+g.cacheWrite)),t("td",{className:"num"},L(g.output)),t("td",{className:"num"},z(U(g,n.config),n.config))));return t("div",{className:"cm-scroll"},t("p",{className:"cm-hint",style:{padding:"6px 10px 0"}},a("historyExpandHint")),t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("colDate")),t("th",{className:"num"},a("colCalls")),t("th",{className:"num"},a("colInTok")),t("th",{className:"num"},a("colCacheTok")),t("th",{className:"num"},a("colOutTok")),t("th",{className:"num"},a("colCost")))),t("tbody",null,c.flatMap(b=>{const g=t("tr",{key:b.date,className:"cm-row-click",onClick:()=>f(b.date)},t("td",null,(o===b.date?"▾ ":"▸ ")+b.date),t("td",{className:"num"},String(b.calls)),t("td",{className:"num"},L(b.input)),t("td",{className:"num"},L(b.cacheRead+b.cacheWrite)),t("td",{className:"num"},L(b.output)),t("td",{className:"num"},z(U(b,n.config),n.config)));if(o!==b.date)return[g];const h=l[b.date],x=d.has(b.date)&&h===void 0?t("p",{className:"cm-empty"},a("historySessionsLoading")):h==="error"?t("p",{className:"cm-empty"},a("historySessionsError")):!Array.isArray(h)||h.length===0?t("p",{className:"cm-empty"},a("historyNoSessions")):t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("colSession")),t("th",{className:"num"},a("colCalls")),t("th",{className:"num"},a("colInTok")),t("th",{className:"num"},a("colCacheTok")),t("th",{className:"num"},a("colOutTok")),t("th",{className:"num"},a("colCost")))),t("tbody",null,p(h)));return[g,t("tr",{key:b.date+"-sessions"},t("td",{colSpan:6},x))]}))))}function hs(e){const{state:n,api:s}=e,a=G(H(n.config)),[o,r]=O(!1),[l,i]=O(100),[d,u]=O("cost-desc"),[c,f]=O(null),[p,b]=O(!1),[g,h]=O(!1),x=Te.useRef(0),A=(k,N)=>{const[P,R]=N==="recent"?["recent","desc"]:N.split("-"),I=++x.current;b(!0),h(!1),s.getTopSessions(k,P,R).then(C=>{I===x.current&&f(Array.isArray(C?.sessions)?C.sessions:[])}).catch(()=>{I===x.current&&h(!0)}).finally(()=>{I===x.current&&b(!1)})},w=()=>{r(k=>{const N=!k;return N&&c===null&&!p&&A(l,d),N})},y=k=>{i(k),(o||c!==null)&&A(k,d)},m=k=>{u(k),(o||c!==null)&&A(l,k)};return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(o,w,a("sessionRankTitle"))),o?t("div",{className:"cm-collapse-body"},t("p",{className:"cm-hint"},a("sessionRankHint")),t("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",margin:"6px 0"}},t("div",{className:"cm-field"},t("label",null,a("sessionRankSort")),t("select",{className:"cm-input",value:d,onChange:k=>m(k.target.value)},t("option",{value:"cost-desc"},a("sessionSortCostDesc")),t("option",{value:"cost-asc"},a("sessionSortCostAsc")),t("option",{value:"time-desc"},a("sessionSortTimeDesc")),t("option",{value:"time-asc"},a("sessionSortTimeAsc")),t("option",{value:"recent"},a("sessionSortRecent")))),t("div",{className:"cm-field"},t("label",null,a("sessionRankLimit")),t("select",{className:"cm-input",value:String(l),onChange:k=>y(Number(k.target.value))},t("option",{value:"50"},"50"),t("option",{value:"100"},"100"),t("option",{value:"200"},"200")))),p?t("p",{className:"cm-empty"},a("sessionRankLoading")):g?t("p",{className:"cm-empty"},a("sessionRankError")):c===null||c.length===0?t("p",{className:"cm-empty"},a("sessionRankEmpty")):t("div",{className:"cm-scroll"},t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("colDate")),t("th",null,a("colSession")),t("th",{className:"num"},a("colCalls")),t("th",{className:"num"},a("colInTok")),t("th",{className:"num"},a("colCacheTok")),t("th",{className:"num"},a("colOutTok")),t("th",{className:"num"},a("colCost")))),t("tbody",null,c.map(k=>t("tr",{key:k.date+":"+k.id},t("td",null,k.date),ra(k,n.config?.showSessionId===!0,a),t("td",{className:"num"},String(k.calls)),t("td",{className:"num"},L(k.input)),t("td",{className:"num"},L((k.cacheRead??0)+(k.cacheWrite??0))),t("td",{className:"num"},L(k.output)),t("td",{className:"num"},z(U(k,n.config),n.config)))))))):null)}function ys(e){const{state:n}=e,s=G(H(n.config)),a=n.today.sessions??[];if(a.length===0)return t("p",{className:"cm-empty"},s("noSessionsToday"));const o=n.config?.showSessionId===!0;return t("div",{className:"cm-scroll"},t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,s("colSession")),t("th",{className:"num"},s("colCalls")),t("th",{className:"num"},s("colInTok")),t("th",{className:"num"},s("colCacheTok")),t("th",{className:"num"},s("colOutTok")),t("th",{className:"num"},s("colCost")))),t("tbody",null,a.map(r=>t("tr",{key:r.id},ra(r,o,s),t("td",{className:"num"},String(r.calls)),t("td",{className:"num"},L(r.input)),t("td",{className:"num"},L(r.cacheRead+r.cacheWrite)),t("td",{className:"num"},L(r.output)),t("td",{className:"num"},z(U(r,n.config),n.config)))))))}function ra(e,n,s){const a=typeof e.title=="string"?e.title.trim():"",o=String(e.id).slice(0,14)+"…",r=a.length>0?a:o,l=a.length>0?a+" · "+e.id:e.id;return t("td",{title:l},t("div",{className:"cm-sess-title"+(a.length===0?" cm-sess-id":"")},r),n&&a.length>0?t("div",{className:"cm-sess-id"},o):null)}const ks={CNY:{symbol:"¥",decimals:4,exchangeRate:7.2},USD:{symbol:"$",decimals:6,exchangeRate:1},EUR:{symbol:"€",decimals:6,exchangeRate:.92}};function xs(e){const{state:n,draft:s,setDraft:a,t:o}=e,r=n.config,l=s?.budget??r.budget,i=Number(r.exchangeRate),u=(n.budgetUsed??(l.period==="day"?U(n.today,r):l.period==="all"?U(n.total,r):U(n.month,r)))*(Number.isFinite(i)&&i>0?i:1),c=Math.max(0,Number(l.amount)||0),f=l.enabled&&c>0?Math.min(999,u/c*100):null,p=f===null?"ok":f>=100?"over":f>=80?"warn":"ok",b=(x,A)=>{s!==null&&a({...s,budget:{...s.budget??r.budget,[x]:A}})},g=l.period==="custom"?l.customStart+" → "+(l.customEnd??o("periodDay")):null,h=l.enabled&&f!==null?o("budgetStatus",{period:o(ze[l.period]??"periodMonth"),amount:me(c,r),used:me(u,r),pct:f.toFixed(1)})+(p==="over"?o("overLimit"):p==="warn"?o("nearLimit"):""):null;return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},t("h3",{className:"cm-h"},o("budget")),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:l.enabled===!0,onChange:x=>b("enabled",x.target.checked)}),t("span",null,o("enableBudget")))),l.enabled?t(D,null,t("div",{className:"cm-budget-bar"},t("div",{className:"cm-budget-fill "+(p==="ok"?"":p),style:{width:(f===null?0:Math.min(100,f))+"%"}})),t("div",{className:"cm-budget-line"+(p==="over"?" over":"")+" cm-num"},h),t("div",{className:"cm-budget-controls"},t("div",{className:"cm-field"},t("label",null,o("budgetAmountLabel")),Ie({value:l.amount},x=>b("amount",x))),t("div",{className:"cm-field"},t("label",null,o("budgetPeriodLabel")),t("select",{className:"cm-input",value:l.period,onChange:x=>b("period",x.target.value)},t("option",{value:"day"},o("periodDay")),t("option",{value:"month"},o("periodMonth")),t("option",{value:"all"},o("periodAll")),t("option",{value:"custom"},o("periodCustomRange")))),l.period==="custom"?t(D,null,t("div",{className:"cm-field"},t("label",null,o("startDate")),t("input",{className:"cm-input",type:"date",value:l.customStart??"",onChange:x=>b("customStart",x.target.value===""?null:x.target.value)})),t("div",{className:"cm-field"},t("label",null,o("endDate")),t("input",{className:"cm-input",type:"date",value:l.customEnd??"",onChange:x=>b("customEnd",x.target.value===""?null:x.target.value)}))):null),g!==null?t("p",{className:"cm-hint"},o("rangeText",{range:g})):null):t("p",{className:"cm-note"},o("budgetDisabledNote")))}function ws(e){const{state:n,draft:s,setDraft:a,t:o}=e,r=n.config,l=(c,f)=>{s!==null&&a({...s,[c]:f})},i=s===null?r:{...r,...s},d=(()=>{if(i.peakEnabled!==!0)return o("peakOff");const c=Date.parse(i.peakEffectiveAt||""),f=Date.now();if(Number.isFinite(c)&&f<c)return o("peakNotEffective",{time:new Date(c).toLocaleString()});const p=i.peakWindows??[],b=nt(f,p,i.peakHolidays);return b===null?o("offPeakActive"):b.holiday===!0?o("holidayAllOffPeak"):b.weekend===!0?o("weekendAllOffPeak"):b.inPeak?o("peakActive"):o("offPeakActive")})(),u=(i.peakWindows?.length??0)>0?o("peakSummary",{windows:i.peakWindows.map(c=>c.start+":00-"+c.end+":00").join(H(i)==="zh"?"、":", "),time:i.peakEffectiveAt||o("unknown"),status:d}):o("noPeakWindows",{status:d});return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},t("h3",{className:"cm-h"},o("peakPanelTitle")),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakEnabled!==!1,onChange:c=>l("peakEnabled",c.target.checked)}),t("span",null,o("peakEnabledLabel")))),t("div",{className:"cm-grid"},t("div",{className:"cm-field"},t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakNotice!==!1,onChange:c=>l("peakNotice",c.target.checked)}),t("span",null,o("peakNoticeLabel")))),t("div",{className:"cm-field"},t("label",null,o("peakStyleLabel")),t("select",{className:"cm-input",value:s?.peakStyle??"compact",onChange:c=>l("peakStyle",c.target.value)},t("option",{value:"progress"},H(s)==="en"?"Time progress":"时间进度条"),t("option",{value:"compact"},o("peakStyleCompact")),t("option",{value:"classic"},o("peakStyleClassic"))))),t("div",{className:"cm-grid"},t("div",{className:"cm-field"},t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakAlertEnabled!==!1,onChange:c=>l("peakAlertEnabled",c.target.checked)}),t("span",null,o("peakAlertLabel")))),t("div",{className:"cm-field"},t("label",null,o("peakAlertAheadLabel")),t("input",{className:"cm-input narrow",type:"number",min:"1",max:"30",step:"1",value:String(typeof s?.peakAlertAhead=="number"&&Number.isFinite(s.peakAlertAhead)&&s.peakAlertAhead>=1&&s.peakAlertAhead<=30?s.peakAlertAhead:2),onChange:c=>{const f=Number(c.target.value);Number.isInteger(f)&&f>=1&&f<=30&&l("peakAlertAhead",f)}})),t("div",{className:"cm-field"},t("label",null,o("peakAlertTargetLabel")),t("select",{className:"cm-input",value:s?.peakAlertTarget==="peak"||s?.peakAlertTarget==="offpeak"?s.peakAlertTarget:"both",onChange:c=>l("peakAlertTarget",c.target.value)},t("option",{value:"both"},o("peakAlertTargetBoth")),t("option",{value:"peak"},o("peakAlertTargetPeak")),t("option",{value:"offpeak"},o("peakAlertTargetOffPeak"))))),t("div",{className:"cm-grid"},t("div",{className:"cm-field"},t("label",null,o("peakAlertPositionLabel")),t("select",{className:"cm-input",value:s?.peakAlertPosition==="center"?"center":"corner",onChange:c=>l("peakAlertPosition",c.target.value)},t("option",{value:"corner"},o("peakAlertPositionCorner")),t("option",{value:"center"},o("peakAlertPositionCenter")))),t("div",{className:"cm-field"},t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:s?.peakAlertWebNotify===!0,onChange:c=>{l("peakAlertWebNotify",c.target.checked),c.target.checked&&window.Notification&&Notification.permission==="default"&&Promise.resolve(Notification.requestPermission()).catch(()=>{})}}),t("span",null,o("peakAlertWebNotifyLabel"))),t("p",{className:"cm-hint"},o("peakAlertWebNotifyHint")))),t("div",{className:"cm-field"},t("label",null,o("peakAlertPreviewLabel")),t("div",{className:"cm-row"},t("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("peak")},o("peakAlertPreviewPeak")),t("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("offpeak")},o("peakAlertPreviewOffPeak")))),t("div",{className:"cm-peak-preview"},s?.peakEnabled!==!1&&s?.peakNotice!==!1?tn(n,i,o):t("p",{className:"cm-hint"},o("peakNoticeHiddenHint"))),t("p",{className:"cm-hint"},u),t("div",{className:"cm-field"},t("label",null,o("peakHolidaysLabel")),t("input",{className:"cm-input",defaultValue:(i.peakHolidays??[]).join(", "),onBlur:c=>l("peakHolidays",c.target.value.split(/[,,\s]+/).filter(Boolean))})),t("p",{className:"cm-hint"},o("weekendRuleNote")))}function Ie(e,n){const s=e.value;return t("input",{className:"cm-input narrow",type:"number",step:"any",min:"0",placeholder:e.placeholder,title:e.title,"aria-label":e.label,value:typeof s=="number"?String(s):"",onChange:a=>{const o=a.target.value;if(o===""){if(e.emptyMode==="clear"){n(null);return}if(e.emptyMode==="ignore")return;n(0);return}const r=Number(o);Number.isFinite(r)&&r>=0&&n(r)}})}function pn({value:e,entry:n,path:s,emptyMode:a,placeholder:o,label:r,title:l,t:i,onCommit:d}){const u=bt(n,s),c=e==null?"":String(e)+(n.multiplier!==void 0||n.separateMultipliers?" × "+u:""),[f,p]=O(c),[b,g]=O(!1),h=ge(!1);Y(()=>{h.current||p(c)},[c]);const x=()=>{if(!h.current)return;const A=f.trim().split(/\s*[×*xX]\s*/),w=/^[+]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;if(f.trim()===""){h.current=!1,g(!1),a==="clear"?d(null):p(c);return}if(A.length>2||!A.every(y=>w.test(y)&&Number.isFinite(Number(y)))||!Number.isFinite(Number(A[0])*(A.length===2?Number(A[1]):u))){g(!0);return}h.current=!1,g(!1),p(String(Number(A[0]))+(n.multiplier!==void 0||n.separateMultipliers||A.length===2?" × "+(A.length===2?Number(A[1]):u):"")),d(Number(A[0]),A.length===2?Number(A[1]):void 0)};return t("input",{className:"cm-input narrow",type:"text",value:f,placeholder:o,"aria-label":r,"aria-invalid":b,title:b?i("priceMultiplyInvalid"):[l,i(n.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll"),e==null?"":"= "+Number((e*u).toPrecision(12))].filter(Boolean).join(" · "),onChange:A=>{h.current=!0,p(A.target.value),g(!1)},onBlur:x,onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),x()),A.key==="Escape"&&(A.stopPropagation(),h.current=!1,g(!1),p(c))}})}function Ct(e,n,s){s!==void 0&&(e.separateMultipliers?e.multipliers={...e.multipliers,[n]:s}:e.multiplier=s)}function ia(e,n,s,a,o,r,l,i=0){const d=a==="cacheWrite",u=n?.[a]??(a==="cacheMiss"?n?.input:a==="cacheHit"?n?.cachedInput:void 0)??null,c=r({cacheHit:"flatCached",cacheMiss:"flatInput",cacheWrite:"flatCacheWrite",output:"flatOutput"}[a]);return t("label",{className:"cm-price-cell"},t("span",{className:"cm-price-cell-label"},c),t(pn,{entry:e,value:u,path:s+"."+a,t:r,emptyMode:d||!["base","cny"].includes(s)?"clear":"ignore",placeholder:d?String(n?.cacheHit??n?.cachedInput??n?.cacheMiss??n?.input??i):void 0,label:o+" · "+c,title:d?r("cacheWriteFallback"):void 0,onCommit:l}))}function ca(e,n,s){return t("div",{className:"cm-price-multiplier"},t("label",null,t("input",{type:"checkbox",checked:e.separateMultipliers===!0,onChange:a=>s(a.target.checked)}),n("priceMultiplySeparate")),t("span",{title:n(e.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll")},n("priceMultiplyHint")))}function Ns(e){const{modelId:n,entry:s,isDefault:a,draft:o,setDraft:r,t:l}=e,i=Je(s),d=b=>{const g={...Je(b)};if(Array.isArray(b.rateHistory)){const h=b.rateHistory.filter(x=>Date.parse(x.before)<=Date.now());h.length>0?g.rateHistory=h:delete g.rateHistory}return g},u=b=>{const g=a?{...o.prices,default:b}:{...o.prices,models:{...o.prices.models,[n]:b}};r({...o,prices:g})},c=(b,g,h,x)=>{const A=a?o.prices.default:o.prices.models[n],w=d(A??{cacheHit:0,cacheMiss:0,output:0}),y=b==="base"?w:{...w[b]??(h===null?{}:Qe(w))};h===null?delete y[g]:y[g]=Math.max(0,h),b!=="base"&&(Object.keys(y).length?w[b]=y:delete w[b]),Ct(w,b+"."+g,x),u(w)},f=()=>{const b={...o.prices.models};delete b[n],r({...o,prices:{...o.prices,models:b}})},p=(b,g)=>{const h=g==="base"?i:i[g]??null;return t("div",{className:"cm-price-row",key:g},t("span",null,b),...["cacheMiss","cacheHit","cacheWrite","output"].map(x=>t(D,{key:x},ia(i,h,g,x,b,l,(A,w)=>c(g,x,A,w),i.cacheHit))))};return t("div",{className:"cm-price-card"},t("div",{className:"cm-price-head"},t("span",{className:"cm-price-name"},n),t("span",{className:"cm-price-unit"},o.prices.currency??"USD"),t(D,null,i?.legacy===!0?t("span",{className:"cm-price-legacy"},l("legacyModel")):null,a?t("span",{className:"cm-price-legacy"},l("defaultFallback")):null,a?null:t("button",{className:"cm-btn small danger",onClick:f},l("remove")))),t("div",{className:"cm-price-row cm-price-columns"},t("span",null,""),t("span",null,l("flatInput")),t("span",null,l("flatCached")),t("span",null,l("flatCacheWrite")),t("span",null,l("flatOutput"))),p(l("tierBase"),"base"),p(l("tierOffPeak"),"offPeak"),p(l("tierPeak"),"peak"),ca(i,l,b=>u({...s,separateMultipliers:b,multipliers:{}})),Array.isArray(s?.rateHistory)&&s.rateHistory.length>0?t("p",{className:"cm-note"},l("datedPriceNote")):null)}const vs={deepseek:"DeepSeek",stepfun:"StepFun",openai:"OpenAI",anthropic:"Anthropic",google:"Google Gemini",moonshot:"Moonshot (Kimi)","z-ai":"Z.ai / 智谱",xai:"xAI",alibaba:"阿里云百炼",minimax:"MiniMax",tencent:"腾讯混元",xiaomi:"小米",upstage:"Upstage",nvidia:"NVIDIA",mistral:"Mistral",meta:"Meta",meituan:"美团 LongCat","opencode-go":"OpenCode Go"},fn=e=>e==="zen"?"go":e,bn=e=>{const n=e.indexOf(":");return n<=0?e:fn(e.slice(0,n).toLowerCase())+e.slice(n)};function gn(e,n,s,a){const o=["input","output","cacheRead","cacheWrite","reasoning","cost","calls"],r=u=>Number.isFinite(Number(u))&&Number(u)>0?Number(u):0,l=(u,c,f)=>{if(!f||typeof f!="object")return;const p=u[c]??(u[c]=Object.fromEntries([...o,"apiCost"].map(g=>[g,0])));for(const g of o)p[g]+=r(f[g]);for(const g of pt)Number.isFinite(f[g])&&(p[g]=(p[g]??0)+f[g]);const b=c.indexOf(":");p.apiCost+=r(f.apiCost??(et(b>0?c.slice(0,b):"deepseek",b>0?c.slice(b+1):c,n)==="plan"?0:f.cost))},i=u=>{if(!u||typeof u!="object")return{};if(u.byProviderModel&&Object.keys(u.byProviderModel).length)return u.byProviderModel;if(u.byModel&&Object.keys(u.byModel).length)return Object.fromEntries(Object.entries(u.byModel).map(([f,p])=>[f.includes(":")?f:"deepseek:"+f,p]));const c={};for(const f of Array.isArray(u.sessions)?u.sessions:[])if(!(!f||typeof f!="object"))if(f.byProviderModel&&Object.keys(f.byProviderModel).length)for(const[p,b]of Object.entries(f.byProviderModel))l(c,p,b);else l(c,(f.provider||"deepseek")+":"+(f.model||"unknown"),f);return Object.keys(c).length?c:o.some(f=>r(u[f])>0)?{"deepseek:legacy":u}:{}};return(u=>{const c={},f=p=>{for(const[b,g]of Object.entries(p??{}))l(c,b,g)};if(u==="today")f(i(e.today));else{const p=Date.parse((e.meta?.dayKey||new Date().toISOString().slice(0,10))+"T00:00:00Z");for(const b of e.history??[]){const g=Date.parse(b.date+"T00:00:00Z");g<=p&&g>=p-76896e5&&f(i(b))}}return Object.entries(c).map(([p,b])=>{const g=p.indexOf(":"),h=(g>0?p.slice(0,g):"deepseek").toLowerCase(),x=g>0?p.slice(g+1):p,A=b.input+b.output+b.cacheRead+b.cacheWrite+b.reasoning,w=b.cacheRead+b.input;return{label:p==="deepseek:legacy"?s("modelStatsLegacy"):h==="deepseek"||h===""?x:fn(h)+":"+x,key:p,...b,tokens:A,cls:et(h,x,n),hitRate:w>0?b.cacheRead/w:null,cacheUnreported:ro(b),blended:A>0&&b.cost>0?b.cost/A*1e6:null,perUsd:b.cost>0?A/b.cost:null}}).filter(p=>(p.tokens>0||p.cost>0)&&n.modelStatistics?.[p.key]?.[u==="today"?"today":"summary"]!==!1)})(a).sort((u,c)=>c.cost-u.cost||c.tokens-u.tokens)}function Ss(e){const{state:n,config:s,t:a,initialTab:o,draft:r,setDraft:l}=e,[i,d]=O(o==="history"?"history":"today"),[u,c]=O(!1),f=gn(n,s,a,i),p=m=>(Math.max(0,Math.min(1,m))*100).toFixed(1)+"%",b=f.reduce((m,k)=>Math.max(m,k.cost),0),g=f.reduce((m,k)=>Math.max(m,k.tokens),0),h=f.reduce((m,k)=>Math.max(m,k.perUsd??0),0),x=(m,k)=>t("button",{className:"cm-mstats-tab"+(i===m?" active":""),onClick:()=>d(m)},k),A=m=>m.cls==="plan"?t("span",{className:"cm-plan-tag",title:a("billingClassLabel")+" · "+(ua(qa(m.provider,s,m.model),a)||a("billingClassPlan"))},a("billingClassPlan")):null,w=m=>t("select",{className:"cm-input",title:a("billingClassLabel"),value:s.planBilling?.models?.[m.key]==="plan"&&s.planBilling?.modelPlans?.[m.key]?"plan:"+s.planBilling.modelPlans[m.key]:s.planBilling?.models?.[m.key]??"auto",disabled:r===null,onChange:k=>{const N={...r.planBilling?.models??{}},P={...r.planBilling?.modelPlans??{}},R=k.target.value;delete P[m.key],R.startsWith("plan:")?(N[m.key]="plan",P[m.key]=R.slice(5)):R==="auto"?delete N[m.key]:N[m.key]=R,l({...r,planBilling:{...r.planBilling,models:N,modelPlans:P}})}},t("option",{value:"auto"},a("billingClassAuto")),t("option",{value:"plan"},a("billingClassPlan")),t("option",{value:"api"},a("billingClassApi")),Xe.map(k=>t("option",{key:k,value:"plan:"+k},a("billingClassPlan")+" · "+ua(k,a)))),y=(m,k,N,P,R)=>t("div",{className:"cm-mstats-row"},R?t("div",{className:"cm-mstats-label"},t("span",{className:"cm-mstats-name",title:m},m),R):t("span",{className:"cm-mstats-name",title:m},m),t("div",{className:"cm-mstats-barbg"},t("div",{className:"cm-mstats-bar "+N,style:{width:p(k)}})),t("span",{className:"cm-mstats-val"},P));return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(u,()=>c(!u),a("modelStatsTitle"))),u?t("div",{className:"cm-collapse-body"},t("div",{className:"cm-mstats-tabs"},x("today",a("modelStatsToday")),x("history",a("modelStatsHistory"))),f.length===0?t("p",{className:"cm-note"},a("modelStatsEmpty")):t(D,null,t("div",{className:"cm-mstats-h"},a("modelStatsCostH")),f.map(m=>t(D,{key:"c:"+m.label},y(m.label,b>0?m.cost/b:0,"cost",z(m.cost,s),t(D,null,A(m),w(m),m.cacheUnreported?t("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null)))),t("div",{className:"cm-mstats-h"},a("modelStatsTokensH")),t("div",{className:"cm-mstats-legend"},t("span",null,t("span",{className:"cm-mstats-dot",style:{background:"var(--dsw-alias-state-business-primary)"}}),a("modelStatsInput")),t("span",null,t("span",{className:"cm-mstats-dot",style:{background:"#ff9800"}}),a("modelStatsCache")),t("span",null,t("span",{className:"cm-mstats-dot",style:{background:"#34a853"}}),a("modelStatsOutput"))),[...f].sort((m,k)=>k.tokens-m.tokens).map(m=>t("div",{className:"cm-mstats-row",key:"t:"+m.label},t("span",{className:"cm-mstats-name",title:m.label},m.label),t("div",{className:"cm-mstats-barbg"},t("div",{className:"cm-mstats-seg in",style:{width:p(g>0?m.input/g:0)}}),t("div",{className:"cm-mstats-seg cache",style:{width:p(g>0?(m.cacheRead+m.cacheWrite)/g:0)}}),t("div",{className:"cm-mstats-seg out",style:{width:p(g>0?(m.output+m.reasoning)/g:0)}})),t("span",{className:"cm-mstats-val"},L(m.tokens)))),t("div",{className:"cm-mstats-h"},a("modelStatsHitH")),[...f].sort((m,k)=>(k.hitRate??-1)-(m.hitRate??-1)).map(m=>t(D,{key:"h:"+m.label},y(m.label,m.hitRate??0,"hit",m.cacheUnreported?a("modelStatsHitUnreported"):m.hitRate===null?"—":(m.hitRate*100).toFixed(1)+"%",m.cacheUnreported?t("span",{className:"cm-plan-tag",title:a("modelStatsHitUnreportedTip")},"⚠"):null))),t("div",{className:"cm-mstats-h"},a("modelStatsValueH")),[...f].sort((m,k)=>(k.perUsd??-1)-(m.perUsd??-1)).map(m=>t(D,{key:"v:"+m.label},y(m.label,h>0?(m.perUsd??0)/h:0,"value",m.perUsd===null?"—":L(m.perUsd)+" tok/$"+(m.blended!==null?" · "+a("modelStatsBlended",{price:"$"+m.blended.toFixed(2)}):"")))),t("p",{className:"cm-mstats-note"},a("modelStatsNote")))):null)}function Cs(e,n){return e==="fiveHour"?n==="en"?"5-hour":"5 小时":e==="weekly"?n==="en"?"This week":"本周":e==="monthly"?n==="en"?"This month":"本月":e==="daily"?n==="en"?"Today":"当日":e}function ua(e,n){if(e==="go")return"OpenCode Go / Go Plus";const s={codex:"Codex / ChatGPT","volcengine-agent":"Volcengine Agent Plan","tencent-coding":"Tencent Coding Plan","tencent-token":"Tencent Token Plan","baidu-coding":"Baidu Qianfan Coding Plan"};if(s[e])return s[e];const a=qe.find(o=>o.id===e);return a!==void 0?n(a.labelKey):e}const hn=["fiveHour","weekly","monthly","daily"];function As(e,n){const s=new Map,a=o=>{const r=new Date(o),l=i=>String(i).padStart(2,"0");if(n==="monthly")return r.getFullYear()+"-"+l(r.getMonth()+1);if(n==="weekly"){const i=new Date(r.getFullYear(),r.getMonth(),r.getDate()-(r.getDay()+6)%7);return i.getFullYear()+"-"+l(i.getMonth()+1)+"-"+l(i.getDate())}return r.getFullYear()+"-"+l(r.getMonth()+1)+"-"+l(r.getDate())};for(const o of Object.values(e??{}))for(const r of o??[]){if(r===null||typeof r!="object"||!(r.tokens>0)&&!(r.cost>0))continue;const l=a(Number(r.t1)||Number(r.t0)),i=s.get(l)??{key:l,tokens:0,cost:0,pct:0,intervals:0};i.tokens+=Number(r.tokens)||0,i.cost+=Number(r.cost)||0,i.pct+=Number(r.pct)||0,i.intervals+=1,s.set(l,i)}return[...s.values()].map(o=>({...o,per1Tokens:o.pct>0?o.tokens/o.pct:null,fullTokens:o.pct>0?o.tokens/o.pct*100:null})).sort((o,r)=>o.key<r.key?-1:o.key>r.key?1:0)}function Ps(e){const{state:n,config:s,t:a}=e,[o,r]=O(!1),[l,i]=O("daily"),d=H(s),u=n?.planStats,c=u!=null&&typeof u.providers=="object"?u.providers:{},f=Object.keys(c).sort(),p=N=>z(Number(N)||0,s??n?.config),b=N=>N.method==="none"||N.per1Tokens===null?"—":L(N.per1Tokens)+" tok · "+p(N.per1Cost),g=N=>N.method==="none"||N.fullTokens===null?"—":L(N.fullTokens)+" tok · "+p(N.fullCost),h=N=>N.method==="sample"?a("planStatsMethodSample"):N.method==="live"?a("planStatsMethodLive"):a("planStatsMethodNone"),x=N=>{let P=h(N);return N.method==="sample"&&Number(N.sampleAt)>0&&(P=a("planStatsMethodSampleAt",{method:P,time:new Date(Number(N.sampleAt)).toLocaleString(d==="en"?"en-US":"zh-CN")})),(N.method==="sample"||N.method==="live")&&N.confidence==="low"&&(P+=" · "+a("planStatsConfidenceLow")),P},A=([N,P,R])=>t("tr",{key:P+":"+N},t("td",null,Cs(N,d)),t("td",{className:"num"},Math.round(R.percent*10)/10+"%"),t("td",{className:"num"},L(R.localTokens)+" tok · "+p(R.localCost)),t("td",{className:"num"},b(R)),t("td",{className:"num"},g(R)),t("td",{className:"num cm-plan-reset"},R.resetsAt.length>0?a("planStatsResets",{time:new Date(R.resetsAt).toLocaleString(d==="en"?"en-US":"zh-CN")}):"—"),t("td",{className:"cm-plan-method"},x(R))),w=o?f.flatMap(N=>Object.entries(c[N]?.intervals??{})).map(([N,P])=>({winKey:N,list:P})):[],y=As(Object.fromEntries(w.map(N=>[N.winKey,N.list])),l),m=y.reduce((N,P)=>Math.max(N,P.fullTokens??0),0),k=(N,P)=>t("button",{key:N,className:"cm-mstats-tab"+(l===N?" active":""),onClick:()=>i(N)},P);return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},it(o,()=>r(!o),a("planStatsTitle"))),o?t("div",{className:"cm-collapse-body"},f.length===0?t("p",{className:"cm-empty"},a("planStatsEmpty")):t(D,null,f.map(N=>{const P=c[N]?.windows??{},R=[...hn.filter(I=>P[I]!==void 0).map(I=>[I,N,P[I]]),...Object.keys(P).filter(I=>!hn.includes(I)).map(I=>[I,N,P[I]])];return t("div",{key:N,className:"cm-plan-provider"},t("div",{className:"cm-plan-provider-name"},ua(N,a),t("span",{className:"cm-plan-updated"},(()=>{const I=Number(c[N]?.generatedAt)||Number(u?.generatedAt)||0;return I>0?new Date(I).toLocaleTimeString(d==="en"?"en-US":"zh-CN"):""})())),t("table",{className:"cm-table"},t("thead",null,t("tr",null,t("th",null,a("planStatsWindow")),t("th",{className:"num"},a("planStatsPercent")),t("th",null,a("planStatsLocal")),t("th",null,a("planStatsPer1")),t("th",null,a("planStatsFull")),t("th",null,""),t("th",null,""))),t("tbody",null,R.map(A))))}),t("div",{className:"cm-mstats-h",style:{marginTop:"10px"}},a("planStatsCurveTitle")),t("div",{className:"cm-mstats-tabs"},k("daily",a("planStatsDaily")),k("weekly",a("planStatsWeekly")),k("monthly",a("planStatsMonthly"))),y.length===0?t("p",{className:"cm-note"},a("planStatsCurveEmpty")):t(D,null,[...y].reverse().map(N=>t("div",{className:"cm-mstats-row",key:N.key},t("span",{className:"cm-mstats-name"},N.key),t("div",{className:"cm-mstats-barbg"},t("div",{className:"cm-mstats-bar value",style:{width:(m>0?(N.fullTokens??0)/m*100:0).toFixed(1)+"%"}})),t($,{label:a("planStatsBarTip",{date:N.key,full:N.fullTokens===null?"—":L(N.fullTokens),per1:N.per1Tokens===null?"—":L(N.per1Tokens),tokens:L(N.tokens),cost:p(N.cost),intervals:N.intervals}),side:"top",delayMs:200},t("span",{className:"cm-mstats-val"},N.fullTokens===null?"—":L(N.fullTokens)))))),t("p",{className:"cm-note"},a("planStatsNote")))):null)}function Ms(e){const{provider:n,modelId:s,entry:a,draft:o,setDraft:r,t:l,api:i,lockedIds:d,releaseDisabled:u}=e,c=Array.isArray(d)&&d.includes(s),[f,p]=O(!1),[b,g]=O(""),h=async()=>{if(!(f||u)){p(!0),g("");try{await i.releasePriceLock(s)}catch(m){g(String(m.message??m))}finally{p(!1)}}},x=m=>{const k={...o.prices.providers??{}},N=k[n]??{};k[n]={...N,models:m},r({...o,prices:{...o.prices,providers:k}})},A=(m,k,N)=>{if(o===null)return;const P={...(o.prices.providers??{})[n]?.models??{}};P[s]={...P[s]??{},[m]:Math.max(0,k)},k===null&&delete P[s][m],m==="input"&&delete P[s].cacheMiss,m==="cachedInput"&&(delete P[s].cacheHit,delete P[s].cacheRead),Ct(P[s],"base."+({input:"cacheMiss",cachedInput:"cacheHit"}[m]??m),N),x(P)},w=(m,k,N)=>{if(o===null)return;const P={...(o.prices.providers??{})[n]?.models??{}},R=P[s]??{};P[s]={...R,cny:{...R.cny,[m]:Math.max(0,k)}},k===null&&delete P[s].cny[m],Ct(P[s],"cny."+m,N),x(P)},y=()=>{if(o===null)return;const m={...(o.prices.providers??{})[n]?.models??{}};delete m[s],x(m)};return t("div",{className:"cm-price-card"},t("div",{className:"cm-price-head"},t("span",{className:"cm-price-name"},s),t("span",{className:"cm-price-unit"},a.cny?"USD / CNY":"USD"),t(D,null,a?.unpriced===!0?t("span",{className:"cm-price-legacy"},l("catalogUnpriced")):null,c?t("span",{className:"cm-price-locked",title:l("priceLockHint")},l("priceLockBadge")):null,c&&typeof i?.releasePriceLock=="function"?t("button",{className:"cm-btn small",disabled:f||u,onClick:h},l("priceLockRelease")):null,t("button",{className:"cm-btn small danger",onClick:y},l("unmountBtn")))),b?t("p",{className:"cm-err",role:"alert"},b):null,a?.unpriced===!0?null:t(D,null,t("div",{className:"cm-price-row cm-price-columns"},t("span",null,""),t("span",null,l("flatInput")),t("span",null,l("flatCached")),t("span",null,l("flatCacheWrite")),t("span",null,l("flatOutput"))),t("div",{className:"cm-price-row"},t("span",null,"USD"),...["cacheMiss","cacheHit","cacheWrite","output"].map(m=>t(D,{key:m},ia(a,a,"base",m,"USD",l,(k,N)=>A({cacheMiss:"input",cacheHit:"cachedInput"}[m]??m,k,N))))),a?.cny?t("div",{className:"cm-price-row"},t("span",null,"CNY"),...["cacheMiss","cacheHit","cacheWrite","output"].map(m=>t(D,{key:m},ia(a,a.cny,"cny",m,"CNY",l,(k,N)=>w(m,k,N))))):null,ca(a,l,m=>x({...o.prices.providers[n].models,[s]:{...a,separateMultipliers:m,multipliers:{}}}))))}const At=e=>[t("option",{key:"sidebar",value:"sidebar"},e("balanceSidebar")),t("option",{key:"settings",value:"settings"},e("balanceSettings")),t("option",{key:"both",value:"both"},e("balanceBoth")),t("option",{key:"off",value:"off"},e("off"))],da=e=>e!=null?t("div",{className:"cm-msg "+e.kind},e.text):null;function Ts(e){const{state:n,api:s,t:a,draft:o,setDraft:r}=e,[l,i,d]=ct(a,()=>s.refreshBalance()),u=n.balance,c=n.config,f=n.reconcile,p=(o?.balance??c.balance??{}).reconcile!==!1,b=x=>{o===null||typeof r!="function"||r({...o,balance:{...o.balance??c.balance??{},reconcile:x.target.checked}})},g=x=>Re(x,c,u?.currency),h=u.status==="ok"?t("div",{className:"cm-bal-line"},t("span",null,a("balanceLine",{total:g(u.totalBalance),granted:g(u.grantedBalance),toppedUp:g(u.toppedUpBalance),time:u.fetchedAt>0?new Date(u.fetchedAt).toLocaleTimeString():"—"}))):u.status==="error"?t("div",{className:"cm-bal-line err"},a("balanceQueryFailedHint",{message:u.message||a("unknownError")})):t("div",{className:"cm-bal-line"},a("balanceNotQueried"));return t("div",{className:"cm-budget"},t("div",{className:"cm-budget-head"},t("h3",{className:"cm-h"},a("accountBalance")),t("button",{className:"cm-btn small",onClick:d,disabled:l},a(l?"refreshing":"refreshBalance"))),h,t("label",null,a("balanceApiKey")),t(Le,{target:"balance",configured:u.keyConfigured,source:u.keySource,t:a,api:s,placeholder:"sk-…"}),t("p",{className:"cm-hint"},a("balanceKeyHint")),f!==void 0&&f.ok===!1?t("div",{className:"cm-bal-line warn"},"⚠ "+f.message):null,t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:p,onChange:b}),a("reconcileLabel")),da(i))}function Pt(e){const n=ge(null);Y(()=>{e.targeted&&(n.current?.scrollIntoView({block:"start"}),n.current?.focus({preventScroll:!0}))},[e.targeted]);const{name:s,enabled:a,saved:o,busy:r,open:l,statusNode:i,configNode:d,errorMsg:u,onToggle:c,onRefresh:f,onLogin:p,loginRequired:b,onRemove:g,onToggleOpen:h,t:x}=e,A=d!=null,w=b?p:f,y=x(r===!0?b?"loggingIn":"refreshing":b?"loginCodingPlan":"refresh");return t("div",{ref:n,"data-quota-plan":e.planId,tabIndex:e.targeted?-1:void 0,className:"cm-budget cm-quota-card"},t("div",{className:"cm-budget-head"},t("label",{className:"cm-check"},t("input",{type:"checkbox","aria-label":x("enable")+": "+s,checked:a===!0,onChange:m=>c(m.target.checked)})),t("div",{className:"cm-quota-name"},A?it(l===!0,h,s):t("h3",{className:"cm-h"},s)),g?t("button",{className:"cm-btn small",onClick:g},x("quotaRemove")):null,t("button",{className:"cm-btn small",onClick:w,disabled:r===!0||a!==!0||o?.enabled!==!0||o.display==="off",title:a!==!0?x("quotaEnableFirst"):o?.enabled!==!0||o.display==="off"?x("quotaRefreshReady"):x(b?"loginCodingPlan":"refresh")},y)),i,A&&l===!0?t("div",{className:"cm-collapse-body"},d):null,u!=null?t("div",{className:"cm-msg "+u.kind},u.text):null)}function ct(e,n){const[s,a]=O(!1),[o,r]=O(null),l=ge(!1);return[s,o,async()=>{if(!l.current){l.current=!0,a(!0),r(null);try{const d=await n();r({kind:d.ok?"ok":"err",text:d.message})}catch(d){r({kind:"err",text:e("syncFailed",{message:d?.message??String(d)})})}finally{l.current=!1,a(!1)}}}]}const Rs=e=>{const n=e.filter(a=>a.enabled===!0),s=e.filter(a=>a.enabled!==!0);return[...n,...s]},yn=(e,n,s,a,o,r=n)=>{if(typeof s?.percent!="number")return t("div",{key:r,className:"cm-go-row"+(o?" main":"")},t("span",{className:"cm-go-label"},n),t("span",{className:"cm-go-num"},typeof s?.text=="string"?s.text:"—"));const l=Math.max(0,Math.min(100,Number(s.percent)||0)),i=we(l,a),d=typeof s.resetsAt=="string"&&s.resetsAt.length>0?e("goResetAt",{time:new Date(s.resetsAt).toLocaleString()}):"";return t("div",{key:r,className:"cm-go-row"+(o?" main":"")},t("span",{className:"cm-go-label"},n),t("div",{className:"cm-go-bar"},t("div",{className:"cm-go-fill",style:{width:i.width+"%"}})),t("span",{className:"cm-go-num"},i.label===null?"—":e("goQuotaPercent",{percent:String(Math.round(i.label))})),d?t("span",{className:"cm-go-reset"},d):null)};function Os(e){const{state:n,api:s,t:a,entry:o,index:r,canRemove:l,onPatch:i,onRemove:d}=e,u=o.adapter==="aliyun",c=o.adapter==="tokenrhythm",f=u||c,[p,b]=O(!1),g=()=>({headers:JSON.stringify(o.request?.headers??{},null,2),extract:JSON.stringify(o.extract??{},null,2),body:typeof o.request?.body=="string"?o.request.body:JSON.stringify(o.request?.body,null,2)??""}),[h,x]=O(g),[A,w]=O(()=>(o.allowedHosts??[]).join(", ")),[y,m]=O({}),k=ge(!1),N=n.config,R=(Array.isArray(n.customBalances)?n.customBalances:[]).find(B=>B.index===r)??null,I=o.enabled===!0,C=()=>{b(B=>!B)};Y(()=>{p&&!k.current&&(x(g()),w((o.allowedHosts??[]).join(", ")),m({})),k.current=p},[p]);const q=(B,J)=>i({[B]:J}),Q=(B,J)=>i({request:{...o.request??{},[B]:J}}),oe=u?["ALIBABA_CLOUD_ACCESS_KEY_ID","ALIBABA_CLOUD_ACCESS_KEY_SECRET","ALIBABA_CLOUD_SECURITY_TOKEN"]:c?["TOKENRHYTHM_COOKIE"]:[...new Set(Object.values(o.request?.headers??{}).flatMap(B=>typeof B=="string"?[...B.matchAll(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g)].map(J=>J[1]):[]))],ee=(B,J)=>{x(Z=>({...Z,[B]:J}));try{const Z=B==="body",ae=Z&&!J.trim()?void 0:JSON.parse(J);if(!Z&&(ae===null||typeof ae!="object"||Array.isArray(ae)))throw new Error("invalid");if(B==="headers"&&Object.values(ae).some(T=>typeof T!="string"))throw new Error("invalid");m(T=>({...T,[B]:""})),B==="extract"?q(B,ae):Q(B,Z?ae===void 0?void 0:J:ae)}catch{m(Z=>({...Z,[B]:a("customBalanceInvalidJson")}))}},W=(B,J,Z,ae)=>!f&&t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,a(J)),ae&&t("span",{className:"cm-hint"},a(ae)),t("textarea",{className:"cm-input",rows:Z,value:h[B],onChange:T=>ee(B,T.target.value)}),y[B]?t("span",{className:"cm-hint err"},y[B]):null),V=B=>{w(B);const J=B.split(/[\s,;]+/).map(Z=>Z.trim()).filter(Z=>Z.length>0);q("allowedHosts",J)},[M,v,j]=ct(a,()=>(N.customBalances??[])[r]?.enabled!==!0?Promise.resolve({ok:!1,message:a("quotaEnableFirst")}):s.refreshCustomBalance(r)),ie=R!==null&&R.status==="ok"?t(D,null,N.balance?.showProgressBar===!0&&!c?t("div",{className:"cm-budget",style:{marginTop:"8px"}},t(Kt,{segments:Gt(n,N,R,o),direction:ue(N,"balance")}),t("div",{className:"cm-bal-line"},Yt(R,N,a,n,o))):t("div",{className:"cm-bal-line"},a("customBalanceRemaining",{amount:at(R.remaining,N,R,o)}))):R!==null&&R.status==="error"?t("div",{className:"cm-bal-line err"},R.message||a("unknownError")):t("div",{className:"cm-bal-line"},R?.message||a("balanceNotQueried")),he=t(D,null,t("p",{className:"cm-note"},a(c?"tokenRhythmBalanceNote":u?"aliyunBalanceNote":"customBalanceConfigNote")),!c&&t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:o.convertToDisplayCurrency===!0,disabled:tt(N,R,o)!=="USD",onChange:B=>q("convertToDisplayCurrency",B.target.checked)}),a("customBalanceConvert")),!c&&t("p",{className:"cm-note"},a("customBalanceConvertNote")),t("div",{className:"cm-grid"},[["label","customBalanceLabelZh"],["labelEn","customBalanceLabelEn"]].map(([B,J])=>t("div",{key:B,className:"cm-field"},t("label",null,a(J)),t("input",{className:"cm-input",value:o[B]??"",onChange:Z=>q(B,Z.target.value)}))),!f&&t("div",{className:"cm-field"},t("label",null,a("customBalanceUnitLabel")),t("select",{className:"cm-input",value:["CNY","EUR","CREDITS"].includes(o.unit)?o.unit:"USD",onChange:B=>q("unit",B.target.value)},t("option",{value:"USD"},"USD ($)"),t("option",{value:"CNY"},"CNY (¥)"),t("option",{value:"EUR"},"EUR (€)"),t("option",{value:"CREDITS"},"CREDITS"))),t("div",{className:"cm-field"},t("label",null,a("customBalanceDisplayLabel")),t("select",{className:"cm-input",value:o.display??"both",onChange:B=>q("display",B.target.value)},...At(a))),t("div",{className:"cm-field"},t("label",null,a("customBalanceRefreshInterval")),Ie({value:o.refreshMinutes??15},B=>q("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(B)))))),!f&&t("div",{className:"cm-field"},t("label",null,a("customBalanceMethod")),t("select",{className:"cm-input",value:o.request?.method??"GET",onChange:B=>Q("method",B.target.value)},t("option",{value:"GET"},"GET"),t("option",{value:"POST"},"POST"))),!f&&t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,a("customBalanceUrl")),t("input",{className:"cm-input",value:o.request?.url??"",placeholder:"/plugins/dsh-workbuddy-connect/status",onChange:B=>Q("url",B.target.value)}),t("span",{className:"cm-hint"},a("customBalanceUrlHint"))),W("headers","customBalanceHeaders",5,"customBalanceHeadersVarNote"),!["GET","HEAD"].includes((o.request?.method??"GET").toUpperCase())&&W("body","customBalanceBody",5,"customBalanceBodyNote"),t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,c?"Token Rhythm Cookie":a("customBalanceCredentialsTitle")),oe.length>0?t(D,null,!f&&t("span",{className:"cm-hint"},a("customBalanceCredentialsHint")),oe.map(B=>t(Le,{key:"cb-var-"+B,target:"customVar:"+B,configured:(n.customVarStatus?.[B]?.configured??!1)===!0,source:n.customVarStatus?.[B]?.source??"",t:a,api:s,placeholder:c?"tr_session=…":"{{"+B+"}}"}))):t("span",{className:"cm-hint"},a("customBalanceNoPlaceholders"))),!f&&t("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},t("label",null,a("customBalanceAllowedHosts")),t("input",{className:"cm-input",value:A,placeholder:"api.example.com, relay.example.org",onChange:B=>V(B.target.value)}),t("span",{className:"cm-hint"},a("customBalanceAllowedHostsHint"))),!f&&t("label",{className:"cm-check",style:{gridColumn:"1 / -1"}},t("input",{type:"checkbox",checked:o.allowInsecureHttp===!0,onChange:B=>q("allowInsecureHttp",B.target.checked)}),a("customBalanceHttp")),W("extract","customBalanceExtract",8)));return t(Pt,{name:`#${r+1} · `+(zt(o,H(N))||a("customBalanceTitle")),enabled:I,saved:JSON.stringify(o)===JSON.stringify(N.customBalances?.[r])?N.customBalances[r]:null,busy:M,open:p,statusNode:ie,configNode:he,errorMsg:v,onToggle:B=>q("enabled",B),onRefresh:j,onRemove:l?d:null,onToggleOpen:C,t:a})}function Bs({config:e,draft:n,setDraft:s,t:a,api:o}){const r=n?.goQuota??e.goQuota,l=(i,d)=>{n&&s({...n,goQuota:{...r,[i]:d}})};return t(D,null,[["display","goQuotaDisplayLabel"],["main","goMainLabel"]].map(([i,d])=>t("div",{key:i,className:"cm-field"},t("label",null,a(d)),t("select",{className:"cm-input",value:r[i],onChange:u=>l(i,u.target.value)},i==="display"?At(a):["rolling","weekly","monthly"].map((u,c)=>t("option",{key:u,value:u},a(["goWindowRolling","goWindowWeekly","goWindowMonthly"][c])))))),t("div",{className:"cm-field"},t("label",null,a("goQuotaRefreshIntervalLabel")),Ie({value:r.refreshMinutes},i=>l("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(i)))))),t("label",null,a("goQuotaKeyLabel")),t(Le,{target:"goQuota",configured:e.goQuota?.keyConfigured===!0,source:e.goQuota?.keySource,t:a,api:o,placeholder:"sk-…"}))}function Ds(e){const{state:n,api:s,t:a,draft:o,setDraft:r}=e,[l,i]=O(!1),d=n.goQuota,u=n.config,c=o?.goQuota?.enabled??u.goQuota?.enabled??!0,f=(m,k)=>{o!==null&&r({...o,goQuota:{...o.goQuota??u.goQuota,[m]:k}})},[p,b,g]=ct(a,()=>s.refreshGoQuota()),h=u.goQuota?.main==="weekly"||u.goQuota?.main==="monthly"?u.goQuota.main:"rolling",x=[h,...["rolling","weekly","monthly"].filter(m=>m!==h)],A=m=>m==="rolling"?"goWindowRolling":m==="weekly"?"goWindowWeekly":"goWindowMonthly",w=m=>m==="rolling"?d.rolling:m==="weekly"?d.weekly:d.monthly,y=c===!1?t("p",{className:"cm-note"},a("goQuotaDisabledNote")):d.status==="ok"?t("div",{className:"cm-go-list"},x.map(m=>yn(a,a(A(m)),w(m),ue(u,"go"),m===h)),t("div",{className:"cm-go-time"},a("goQuotaFetchedAt",{time:d.fetchedAt>0?new Date(d.fetchedAt).toLocaleTimeString():"—"}))):d.status==="error"?t("div",{className:"cm-bal-line err"},d.message||a("unknownError")):d.status==="off"&&d.message?t("p",{className:"cm-note"},d.message):t("div",{className:"cm-bal-line"},a("goQuotaNotQueried"));return t(Pt,{name:a("goQuotaTitle"),enabled:c,saved:u.goQuota,busy:p,open:l,statusNode:y,errorMsg:b,configNode:t(Bs,{config:u,draft:o,setDraft:r,t:a,api:s}),onToggleOpen:()=>i(m=>!m),onToggle:m=>f("enabled",m),onRefresh:g,t:a})}const Ls=(e,n)=>{if(typeof e?.keyVar=="string"&&e.keyVar.length>0)return e.keyVar;const a="CLIPROXYAPI_MANAGEMENT_KEY_"+(String(e?.id??"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"GATEWAY");return Object.keys(n??{}).find(o=>o===a||o.startsWith(a+"_"))??a};function Es(e){const{state:n,api:s,t:a,draft:o,setDraft:r,index:l}=e,i=n.config,u=(o??i).gatewayQuotas?.sources??[],c=u[l]??{},p=(Array.isArray(n.gatewayQuotas)?n.gatewayQuotas:[]).find(C=>C.id===c.id)??{id:c.id,status:"off",accounts:[],unsupportedProviders:[]},b=Ls(c,n.customVarStatus),[g,h]=O(!1),[x,A,w]=ct(a,()=>s.refreshGatewayQuota(c.id)),y=C=>{o!==null&&r({...o,gatewayQuotas:{...o.gatewayQuotas??i.gatewayQuotas??{},sources:C}})},m=C=>y(u.map((q,Q)=>Q===l?{...q,...C}:q)),k=(C,q,Q)=>t("div",{className:"cm-field"},t("label",null,C),t("input",{className:"cm-input","aria-label":C,value:q??"",onChange:Q})),N=(C,q)=>{const Q=Nt(C?.label||C?.id||a("gatewaySourceUnknown"),C,ue(i,"plan"),a);return t(D,{key:C?.id||q},Q.row,C?.resetsAt?t("div",{className:"cm-note"},st(C,a)):null)},P=(C,q)=>t("div",{key:C.id||q,className:"cm-mm-row wide"},t("span",{className:"cm-bbox-label"},C.label||"package"),t("span",{className:"cm-bbox-pct cm-num"},(C.used??"—")+" / "+(C.limit??"—")),t("span",{className:"cm-bbox-pct cm-num"},(C.remaining??"—")+" remaining")),R=C=>C==null?null:t(D,null,t("div",{className:"cm-mm-row wide"},t("span",{className:"cm-bbox-label"},C.unit||"credits"),t("span",{className:"cm-bbox-pct cm-num"},(C.used??"—")+" / "+(C.limit??"—")),t("span",{className:"cm-bbox-pct cm-num"},(C.remaining??"—")+" remaining")),(C.packages??[]).map(P)),I=(C,q)=>t("div",{key:C.id||q,className:"cm-budget",style:{marginTop:"8px",padding:"10px 12px"}},t("div",{className:"cm-budget-head"},t("strong",null,(Ca[C.provider]??C.provider??a("gatewaySourceUnknown"))+" · "+(C.label||a("gatewaySourceUnknown"))),t("span",{className:"cm-hint"},C.status)),C.plan?t("div",{className:"cm-note"},C.plan):null,C.windows.length>0?t("div",{className:"cm-go-list"},C.windows.map(N)):null,R(C.credits),C.message?t("div",{className:"cm-note"},C.message):null);return t(Pt,{name:c.label||c.id||a("gatewayQuotaTitle"),enabled:c.enabled===!0,saved:i.gatewayQuotas?.sources?.find(C=>C.id===c.id),busy:x,open:g,errorMsg:A,statusNode:t("div",{className:"cm-note"},a("gatewaySourceStatus")+": "+(p.status??a("gatewaySourceUnknown"))+(p.serverVersion?" · "+p.serverVersion:"")+(p.fetchedAt>0?" · "+a("gatewaySourceFetchedAt",{time:new Date(p.fetchedAt).toLocaleTimeString()}):"")+(p.message?" · "+p.message:"")),configNode:t(D,null,t("div",{className:"cm-grid"},k(a("gatewaySourceLabel"),c.label,C=>m({label:C.target.value})),k(a("gatewaySourceBaseURL"),c.baseURL,C=>m({baseURL:C.target.value})),t("div",{className:"cm-field"},t("label",null,a("gatewaySourceDisplay")),t("select",{className:"cm-input",value:c.display??"both",onChange:C=>m({display:C.target.value})},...At(a))),t("div",{className:"cm-field"},t("label",null,a("gatewaySourceRefreshInterval")),Ie({value:c.refreshMinutes??15},C=>m({refreshMinutes:Math.min(1440,Math.max(1,Math.floor(C)))}))),k(a("gatewaySourceAllowlist"),(c.allowedHosts??[]).join(", "),C=>m({allowedHosts:C.target.value.split(/[\s,;]+/).filter(Boolean)})),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:c.allowInsecureHttp===!0,onChange:C=>m({allowInsecureHttp:C.target.checked})}),t("span",null,a("customBalanceHttp"))),t("label",{className:"cm-check"},t("input",{type:"checkbox",checked:c.antigravityOnlyGemini===!0,onChange:C=>m({antigravityOnlyGemini:C.target.checked})}),t("span",null,a("gatewayOnlyGemini")))),b?t("div",{className:"cm-field"},t("label",null,a("gatewaySourceCredential")),t(Le,{target:"customVar:"+b,configured:n.customVarStatus?.[b]?.configured===!0,source:n.customVarStatus?.[b]?.source??"",t:a,api:s,placeholder:b})):null,p.unsupportedProviders.length>0?t("div",{className:"cm-note"},a("gatewaySourceUnsupported")+": "+p.unsupportedProviders.join(", ")):null,p.accounts.length>0?p.accounts.map(I):t("div",{className:"cm-bal-line"},a("gatewaySourceNoAccounts"))),onToggle:C=>m({enabled:C}),onRefresh:w,onRemove:()=>y(u.filter((C,q)=>q!==l)),onToggleOpen:()=>h(C=>!C),t:a})}const qe=[{id:"opendesign",labelKey:"codingPlanOpendesign"},{id:"anthropic",labelKey:"codingPlanAnthropic"},{id:"zai",labelKey:"codingPlanZai"},{id:"minimax",labelKey:"codingPlanMinimax"},{id:"kimi",labelKey:"codingPlanKimi"},{id:"openrouter",labelKey:"codingPlanOpenrouter"},{id:"siliconflow",labelKey:"codingPlanSiliconflow"},{id:"commandcode",labelKey:"codingPlanCommandcode"},{id:"scnet",labelKey:"codingPlanScnet"},{id:"volcengine",labelKey:"codingPlanVolcengine"},{id:"qwen",labelKey:"codingPlanQwen"},{id:"mimo",labelKey:"codingPlanMimo"},{id:"factory",labelKey:"codingPlanFactory"}];function Is(e){const{state:n,api:s,t:a,draft:o,setDraft:r,planId:l,labelKey:i}=e,d=n.config,u=n.codingPlans??{},c=o?.codingPlans?.[l]??d.codingPlans?.[l]??{},f=u[l]??{status:"off",message:"",fetchedAt:0,windows:{}},p=c.enabled===!0,[b,g]=O(e.targeted===!0),h=l==="qwen"&&d.codingPlans?.qwen?.quotaSource==="bailian"&&c.quotaSource==="bailian"&&f.quotaSource==="bailian"&&f.loginRequired===!0,[x,A,w]=ct(a,()=>h?s.loginCodingPlan(l):s.refreshCodingPlan(l)),y=(v,j)=>{if(o===null)return;const ie=o.codingPlans??d.codingPlans??{};r({...o,codingPlans:{...ie,[l]:{...ie[l]??{},[v]:j}}})},[m,k]=O(""),[N,P]=O({}),R=v=>v?.rates!==null&&typeof v?.rates=="object"&&!Array.isArray(v.rates)?v.rates:{},I=["input","cachedInput","output"],C=v=>N[v]??R(c)[v]??{},q=v=>I.every(j=>Number.isFinite(Number(v[j]))&&Number(v[j])>0),Q=(v,j,ie)=>{if(o===null)return;const he={...C(v),[j]:String(ie)};P(ae=>({...ae,[v]:he}));const B=I.every(ae=>String(he[ae]??"").trim()==="");if(!B&&!q(he))return;const J=o.codingPlans??d.codingPlans??{},Z={...(J.qwen??{}).rates??{}};B?delete Z[v]:Z[v]=Object.fromEntries(I.map(ae=>[ae,Number(he[ae])])),r({...o,codingPlans:{...J,qwen:{...J.qwen??{},rates:Z}}})},oe=v=>{o!==null&&P(j=>({...j,[v]:j[v]??R(c)[v]??{}}))},ee=v=>{if(o===null)return;P(he=>{const B={...he};return delete B[v],B});const j=o.codingPlans??d.codingPlans??{},ie={...(j.qwen??{}).rates??{}};delete ie[v],r({...o,codingPlans:{...j,qwen:{...j.qwen??{},rates:ie}}})},W=f.windows!==null&&typeof f.windows=="object"?f.windows:{},V=p===!1?t("p",{className:"cm-note"},a("codingPlanDisabledNote")):f.status==="ok"?t("div",{className:"cm-go-list"},f.message?t("p",{className:"cm-note"},f.message):null,Object.keys(W).length>0?l==="minimax"&&(_e(W).five!=null||_e(W).seven!=null)?t(Jt,{five:_e(W).five,seven:_e(W).seven,fetchedAt:f.fetchedAt,t:a,wide:!0,direction:ue(d,"plan")}):Object.entries(W).map(([v,j])=>yn(a,lt(v,a),j,ue(d,"plan"),!1,v)):t("div",{className:"cm-bal-line"},a("codingPlanNotQueried")),t("div",{className:"cm-go-time"},a("goQuotaFetchedAt",{time:f.fetchedAt>0?new Date(f.fetchedAt).toLocaleTimeString():"—"}))):f.status==="error"?t("div",{className:"cm-bal-line err"},f.message||a("unknownError")):f.status==="off"&&f.message?t("p",{className:"cm-note"},f.message):t("div",{className:"cm-bal-line"},a("codingPlanNotQueried")),M=t(D,null,l==="opendesign"?t("div",{className:"cm-field"},t("label",null,a("opendesignWorkspace")),t("input",{className:"cm-input","aria-label":a("opendesignWorkspace"),value:c.workspaceId??"",onChange:v=>y("workspaceId",v.target.value)}),t("p",{className:"cm-note"},a("opendesignNote"))):null,l==="factory"?t(D,null,t("div",{className:"cm-field"},t("label",null,a("factoryPool")),t("select",{className:"cm-input","aria-label":a("factoryPool"),value:c.factoryPool??"standard",onChange:v=>y("factoryPool",v.target.value)},t("option",{value:"standard"},"Standard"),t("option",{value:"core"},"Droid Core"),t("option",{value:"both"},a("factoryPoolBoth")))),t("div",{className:"cm-field"},t("label",null,a("factoryOrg")),t("input",{className:"cm-input","aria-label":a("factoryOrg"),value:c.orgId??"",onChange:v=>y("orgId",v.target.value)}))):null,l==="minimax"?t("div",{className:"cm-field"},t("label",null,a("minimaxOrigin")),t("input",{className:"cm-input",type:"url",value:c.baseUrl??"",placeholder:"https://www.minimax.cn","aria-label":a("minimaxOrigin"),onChange:v=>y("baseUrl",v.target.value)}),t("p",{className:"cm-note"},a("minimaxOriginNote"))):null,l==="qwen"?t("div",{className:"cm-field"},t("label",null,a("qwenSource")),t("select",{className:"cm-input",value:c.quotaSource??"local",onChange:v=>y("quotaSource",v.target.value)},t("option",{value:"local"},a("qwenSourceLocal")),t("option",{value:"cli"},a("qwenSourceCli")),t("option",{value:"bailian"},a("qwenSourceBailian"))),t("p",{className:"cm-note"},a(c.quotaSource==="bailian"?"qwenBailianNote":"qwenCliNote"))):null,t("div",{className:"cm-field"},t("label",null,a("codingPlanDisplayLabel")),t("select",{className:"cm-input",value:typeof c.display=="string"?c.display:l==="minimax"?"both":"settings",onChange:v=>y("display",v.target.value)},t("option",{value:"sidebar"},a("balanceSidebar")),t("option",{value:"settings"},a("balanceSettings")),t("option",{value:"both"},a("balanceBoth")),t("option",{value:"off"},a("off"))),t("span",{className:"cm-hint"},a("codingPlanDisplayNote"))),l!=="scnet"&&(l!=="qwen"||(c.quotaSource??"local")!=="local")?t("div",{className:"cm-field"},t("label",null,a("codingPlanRefreshIntervalLabel")),Ie({value:typeof c.refreshMinutes=="number"&&Number.isFinite(c.refreshMinutes)&&c.refreshMinutes>0?c.refreshMinutes:15},v=>{y("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(v))))})):null,l==="scnet"||l==="qwen"&&(c.quotaSource??"local")==="local"?t(D,null,t("div",{className:"cm-field"},t("label",null,a(l==="qwen"?"qwenPlanCreditsLabel":"scnetPlanCreditsLabel")),t("input",{className:"cm-input",type:"number",min:"1",step:"1000",value:typeof c.planCredits=="number"&&Number.isFinite(c.planCredits)&&c.planCredits>0?c.planCredits:l==="qwen"?5e5:24e4,onChange:v=>{const j=Number(v.target.value);Number.isFinite(j)&&j>0&&y("planCredits",Math.floor(j))}})),t("div",{className:"cm-field"},t("label",null,a(l==="qwen"?"qwenPlanStartLabel":"scnetPlanStartLabel")),t("input",{className:"cm-input",type:"date",value:typeof c.planStart=="string"?c.planStart:"",onChange:v=>y("planStart",v.target.value)})),l==="qwen"?t(D,null,t("div",{className:"cm-field"},t("label",null,a("qwenRatesLabel"))),[...new Set([...Object.keys(R(c)),...Object.keys(N)])].sort().map(v=>t("div",{key:v,className:"cm-match-row"},t("span",{style:{minWidth:"120px"}},v),I.map(j=>t("input",{key:j,className:"cm-input narrow",type:"number",min:"0",step:"0.1",value:C(v)[j]??"",placeholder:a("qwenRate_"+j),"aria-label":v+" · "+a("qwenRate_"+j),onChange:ie=>{const he=ie.target.value;Q(v,j,he)}})),t("button",{className:"cm-btn small",onClick:()=>ee(v)},a("overrideRemove")),v in N&&!q(C(v))?t("span",{className:"cm-note"},a("qwenRateDraftNote")):null)),t("div",{className:"cm-buttons"},t("input",{className:"cm-input narrow",type:"text",placeholder:a("qwenRatesModelPlaceholder"),value:m,onChange:v=>k(v.target.value)}),t("button",{className:"cm-btn small",onClick:()=>{const v=m.trim();v.length!==0&&(oe(v),k(""))},disabled:m.trim().length===0},a("qwenRatesAdd")))):null,t("p",{className:"cm-note"},a(l==="qwen"?"qwenLocalNote":"scnetLocalNote"))):l==="qwen"?null:l==="volcengine"?t(D,null,t("div",{className:"cm-field"},t("label",null,a("volcengineAccessKeyIdLabel"))),t(Le,{target:"codingPlans.volcengine.ak",configured:f.keyConfigured===!0,source:f.keySource,t:a,api:s,placeholder:a("volcengineAccessKeyPlaceholder")}),t("div",{className:"cm-field"},t("label",null,a("volcengineSecretAccessKeyLabel"))),t(Le,{target:"codingPlans.volcengine.sk",configured:f.keyConfigured===!0,source:f.keySource,t:a,api:s,placeholder:a("volcengineSecretPlaceholder")}),t("p",{className:"cm-note"},a("volcengineNote"))):t(D,null,t("div",{className:"cm-field"},t("label",null,l==="mimo"?"Cookie (platform.xiaomimimo.com)":l==="factory"?"Factory Token":l==="opendesign"?"OpenDesign Control Key":a("codingPlanKeyLabel"))),t(Le,{target:"codingPlans."+l,configured:f.keyConfigured===!0,source:f.keySource,t:a,api:s,placeholder:l==="mimo"?"api-platform_serviceToken=…; userId=…":l==="factory"?"FACTORY_API_KEY":l==="opendesign"?"OPENDESIGN_CONTROL_KEY":"sk-…"})));return t(Pt,{planId:l,targeted:e.targeted,name:a(i),enabled:p,saved:d.codingPlans?.[l],busy:x,open:b,errorMsg:A,statusNode:V,configNode:M,onToggle:v=>y("enabled",v),onRefresh:w,onLogin:w,loginRequired:h,onToggleOpen:()=>g(v=>!v),t:a})}function qs(e){const{state:n,api:s,t:a,draft:o,setDraft:r}=e,l=n.config,i=o??l,d=i.codingPlans??{},u=i.gatewayQuotas?.sources??[],c=o?.customBalances??l.customBalances??[],f=y=>{o!==null&&r({...o,customBalances:y,...y.length===0?{customBalance:{...l.customBalance??{},enabled:!1,request:{url:"",headers:{}}}}:{}})},p=ge({next:0,keys:[]}).current;for(;p.keys.length<c.length;)p.keys.push(p.next++);p.keys.length=c.length;const b=y=>{p.keys.splice(y,1),f(c.filter((m,k)=>k!==y))},g=(y,m)=>f(c.map((k,N)=>N===y?{...k,...m}:k)),h=(y="custom")=>{if(!(c.length>=8)){if(y==="workbuddy2api"){f([...c,{enabled:!1,label:"WorkBuddy2API 积分",labelEn:"WorkBuddy2API credits",display:"both",unit:"CREDITS",refreshMinutes:15,request:{url:"http://127.0.0.1:8790/api/credits/expiry?package_limit=1",method:"GET",headers:{"X-Admin-Token":"{{WORKBUDDY2API_ADMIN_TOKEN}}"}},extract:{remaining:"summary.available_remaining"},allowedHosts:["127.0.0.1:8790"],allowInsecureHttp:!1}]);return}f([...c,{...y!=="custom"?{adapter:y}:{},enabled:!1,label:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"千问 / 阿里云":"",labelEn:y==="tokenrhythm"?"Token Rhythm":y==="aliyun"?"Qianwen / Alibaba Cloud":"",display:"both",unit:y!=="custom"?"CNY":"USD",refreshMinutes:15,request:{url:y==="tokenrhythm"?"https://tokenrhythm.studio/api/wallet/summary":y==="aliyun"?"https://business.aliyuncs.com/":"",method:y==="aliyun"?"POST":"GET",headers:{}},extract:{},allowedHosts:[]}])}},x=()=>{u.length>=4||o===null||r({...o,gatewayQuotas:{...o.gatewayQuotas??l.gatewayQuotas??{},sources:[...u,{id:"gateway-"+Date.now().toString(36),type:"cliproxyapi",label:"CLIProxyAPI",baseURL:"http://127.0.0.1:8317",enabled:!1,display:"both",refreshMinutes:15,includeProviders:Et,allowedHosts:[],allowInsecureHttp:!1}]}})},A=[...u.map((y,m)=>({kind:"gateway",key:"gw-"+(y.id??m),index:m,enabled:y.enabled===!0})),{kind:"go",key:"go",enabled:i.goQuota?.enabled!==!1},...qe.map(y=>({kind:"plan",key:"plan-"+y.id,planId:y.id,labelKey:y.labelKey,enabled:d[y.id]?.enabled===!0})),...c.map((y,m)=>({kind:"custom",key:"cb-"+p.keys[m],index:m,enabled:y.enabled===!0}))],w=y=>y.kind==="plan"?t(Is,{key:y.key,planId:y.planId,labelKey:y.labelKey,targeted:y.planId===e.targetPlan,state:n,api:s,t:a,draft:o,setDraft:r}):y.kind==="go"?t(Ds,{key:y.key,state:n,api:s,t:a,draft:o,setDraft:r}):y.kind==="gateway"?t(Es,{key:y.key,index:y.index,state:n,api:s,t:a,draft:o,setDraft:r}):t(Os,{key:y.key,state:n,api:s,t:a,entry:c[y.index],index:y.index,canRemove:!0,onPatch:m=>g(y.index,m),onRemove:()=>b(y.index)});return t("div",null,t("p",{className:"cm-note"},a("quotaSectionNote")),t("div",{className:"cm-quota-list"},Rs(A).map(w)),t("div",{className:"cm-buttons"},t("button",{className:"cm-btn small",onClick:x,disabled:u.length>=4},a("gatewaySourceAdd")),t("button",{className:"cm-btn small",onClick:()=>h(),disabled:c.length>=8},a("customBalanceAdd")),t("button",{className:"cm-btn small",onClick:()=>h("aliyun"),disabled:c.length>=8},a("aliyunBalanceAdd")),t("button",{className:"cm-btn small",onClick:()=>h("tokenrhythm"),disabled:c.length>=8},a("tokenRhythmBalanceAdd")),t("button",{className:"cm-btn small",onClick:()=>h("workbuddy2api"),disabled:c.length>=8},a("workBuddyBalanceAdd")),t("p",{className:"cm-note"},a("workBuddyBalanceNote"))))}const js=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],kn=e=>(e.input??0)+(e.output??0)+(e.cacheRead??0)+(e.cacheWrite??0);function ma(e){const n=e.useCost?e.useCost(m=>m):void 0,s=e.state??n?.state;if(!s)return null;const a=s.config,o=H(a),r=e.t??G(o),l=Array.isArray(s.history)?s.history:[];if(l.length===0)return t("div",null,t("h3",{className:"cm-h"},r("usageTitle")),t("p",{className:"cm-empty"},r("usageEmpty")));const i=s.meta?.dayKey??"",d=new Map(l.map(m=>[m.date,m])),u=m=>{const k=N=>String(N).padStart(2,"0");return m.getFullYear()+"-"+k(m.getMonth()+1)+"-"+k(m.getDate())},c=new Date;c.setHours(0,0,0,0);const f=new Date(c);f.setDate(f.getDate()+(6-(c.getDay()+6)%7));const p=26,b=[],g=[];let h=-1;for(let m=p-1;m>=0;m-=1){for(let N=0;N<7;N+=1){const P=new Date(f);P.setDate(P.getDate()-(m*7+(6-N)));const R=d.get(u(P));b.push(R!==void 0?{day:R,tokens:kn(R)}:{day:{date:u(P)},tokens:0})}const k=new Date(f);k.setDate(k.getDate()-(m*7+6)),g.push(k.getMonth()!==h?o==="en"?js[k.getMonth()]:String(k.getMonth()+1)+"月":""),h=k.getMonth()}const x=Math.max(...b.map(m=>m.tokens),1),A=m=>{const k=m/x;return k<.25?1:k<.5?2:k<.75?3:4},w=m=>{const{day:k,tokens:N}=m,P="cm-ug-cell"+(N>0?" l"+A(N):"")+(k.date===i?" today":""),R=r("usageDay",{date:k.date,tokens:L(N),input:L(k.input??0),cache:L((k.cacheRead??0)+(k.cacheWrite??0)),output:L(k.output??0),calls:k.calls??0,cost:z(U(k,a),a)});return t($,{key:k.date,label:R,side:"top",delayMs:200},t("div",{className:P}))},y=s.total;return t("div",{className:"cm-ug"},t("h3",{className:"cm-h"},r("usageTitle")),t("div",{className:"cm-ug-total"},r("usageTotal",{tokens:L(kn(y)),input:L(y.input??0),cache:L((y.cacheRead??0)+(y.cacheWrite??0)),output:L(y.output??0),calls:y.calls??0})),t("div",{className:"cm-ug-grid",style:{gridTemplateColumns:"repeat("+p+",1fr)"}},b.map(w)),t("div",{className:"cm-ug-months",style:{gridTemplateColumns:"repeat("+p+",1fr)"}},g.map((m,k)=>t("span",{key:"m"+String(k),className:"cm-ug-monthc"},m))))}function xn(e){return e.ready?t(ve,{...e,load:e.api.loadCodex,quiet:e.view==="prompt"}):null}function Hs(e){const n=e.useCost?.(a=>a),s=n?.state;return t(xn,{...e,state:s,view:"prompt",ready:s?.codexCompat?.enabled===!0&&s?.codexCompat?.promptDue,locale:n?.locale})}function Qs(e){const n=e.useCost?e.useCost(T=>T):void 0,s=e.api,a=n?.state??null,[o,r]=O(null),[l,i]=O(null),[d,u]=O(!1),[c,f]=O(!1),[p,b]=O(!1),[g,h]=O(!1),[x,A]=O("models"),[w,y]=O("overview"),m=a?.codexCompat?.installed===!0&&a?.codexCompat?.enabled===!0,k=w==="codex"&&!m?"overview":w;Y(()=>{m||y(T=>T==="codex"?"overview":T)},[m]);const[N,P]=O(null),[R,I]=O({status:"idle",at:0,error:null}),C=Te.useRef(null),q=Te.useRef(null),Q=Te.useRef(null),oe=Te.useRef(Promise.resolve()),ee=Te.useRef(0),W=Te.useRef(null);Y(()=>()=>{W.current?.()},[]),Y(()=>{if(a!==null){const T=JSON.stringify(a.config);r(F=>{const pe=F!==null&&JSON.stringify(F)!==C.current;return pe||(q.current=a.config,Q.current=a.config),pe?{...F,activeLocale:a.config.activeLocale}:JSON.parse(T)}),C.current=T}},[a]),Y(()=>{o!==null&&Q.current===null&&q.current!==null&&(Q.current=q.current)},[o]),Y(()=>{const T=++ee.current;if(o===null||s===void 0)return;const F=JSON.stringify(o);if(F===C.current){W.current=null;return}I(de=>de.status==="saving"?de:{...de,status:"saving"});const pe=()=>{oe.current=oe.current.catch(()=>{}).then(async()=>{if(T!==ee.current)return;const de={},fe=Q.current??q.current;if(fe!==null&&typeof fe=="object")for(const se of Object.keys(o))se==="activeLocale"||o[se]===fe[se]||JSON.stringify(o[se])!==JSON.stringify(fe[se])&&(de[se]=o[se]);if(Object.keys(de).length===0){C.current=F,I({status:"saved",at:Date.now(),error:null});return}try{await s.updateConfig(de),C.current=F,fe!==null&&typeof fe=="object"&&(Q.current={...fe,...de}),T===ee.current&&I({status:"saved",at:Date.now(),error:null})}catch(se){T===ee.current&&I({status:"error",at:0,error:se?.message??String(se)})}})};W.current=pe;const ke=setTimeout(pe,120);return()=>{clearTimeout(ke)}},[o,s]),Y(()=>{a!==null&&n?.status==="error"&&n.error&&i({kind:"err",text:M("ledgerReadFailed",{message:n.error})})},[n?.status,n?.error]);const V=H({...o??a?.config,activeLocale:n?.locale}),M=G(V);if(n===void 0||a===null)return t("div",{className:"cm-section"},t("p",{className:"cm-empty"},n?.status==="loading"?M("readingLedger"):M("ledgerUnavailable")),n?.error&&t("p",{className:"cm-err",role:"alert"},M("ledgerReadFailed",{message:n.error})),t("button",{className:"cm-btn",disabled:n?.status==="loading"||!s?.reload,onClick:s?.reload},M("refresh")));const v=a.config,j=async()=>{if(!g){h(!0),i(null);try{const T=await s.fetchPrices();if(i({kind:T.ok?"ok":"err",text:T.message}),T.ok&&T.state&&typeof T.state.config=="object"){const F=JSON.stringify(T.state.config);r(JSON.parse(F)),C.current=F}}catch(T){i({kind:"err",text:M("syncFailed",{message:T?.message??String(T)})})}finally{h(!1),u(!1)}}},ie=async()=>{if(!g){h(!0);try{await s.resetHistory(),i({kind:"ok",text:M("historyCleared")})}catch(T){i({kind:"err",text:M("clearFailed",{message:T?.message??String(T)})})}finally{h(!1),f(!1)}}},he=async()=>{if(!g){h(!0),i(null);try{const T=await s.importLegacyHistory();i({kind:"ok",text:T.message})}catch(T){i({kind:"err",text:M("legacyImportFailed",{message:T?.message??String(T)})})}finally{h(!1),b(!1)}}},B=(T,F)=>{o!==null&&r({...o,[T]:F})},J=[["overview",M("tabOverview")],["statistics",V==="en"?"Cost statistics":"计费统计"],["quotas",M("tabQuotas")],["usage",M("tabUsage")],["pricing",M("tabPricing")],...m?[["codex","Codex"]]:[],["display",M("tabDisplay")]],Z=T=>la({statistics:s.loadStatistics,pricing:s.loadOpenRouter,codex:s.loadCodex}[T],{state:a}),ae=R.status==="saving"?t("span",{className:"cm-hint"},M("saving")):R.status==="error"?t("span",{className:"cm-msg err"},M("autoSaveFailed",{message:R.error??""})):t("span",{className:"cm-hint"},R.status==="saved"?M("autoSavedAt",{time:new Date(R.at).toLocaleTimeString()}):M("autoSaveHint"));return t("div",{className:"cm-section"},t("div",{className:"cm-tabs-row"},t("div",{className:"cm-tabs",role:"tablist"},J.map(([T,F])=>t("button",{key:T,type:"button",role:"tab","aria-selected":String(k===T),className:"cm-tab"+(k===T?" active":""),onMouseEnter:()=>Z(T),onFocus:()=>Z(T),onClick:()=>y(T)},F))),ae),t(ve,{state:a,api:s,load:s.loadCommunity,locale:V,quiet:!0}),da(l),k==="statistics"?t(ve,{state:a,api:s}):null,k==="overview"?t(D,{key:"overview"},t("div",{className:"cm-overview-grid"},t("div",{className:"cm-cards",style:{"--cm-overview-count":v.hideTodayCost===!0?2:3}},v.hideTodayCost===!0?null:t(St,{title:M("cardToday"),value:z(U(a.today,v),v),sub:M("callsTokens",{calls:a.today.calls,input:L(a.today.input),cache:L(a.today.cacheRead+a.today.cacheWrite),output:L(a.today.output)})}),t(St,{title:M("cardMonth"),value:z(U(a.month,v),v),sub:M("callsTokens",{calls:a.month.calls,input:L(a.month.input),cache:L(a.month.cacheRead+a.month.cacheWrite),output:L(a.month.output)})}),t(St,{title:M("cardTotal"),value:z(U(a.total,v),v),sub:M("cardTotalSub",{calls:a.total.calls})}))),t(fs,{state:a,t:M}),t("p",{className:"cm-note",key:"cards-footnote"},M("cardsFootnote")),(()=>{const T=go(a);return T!==null?t("p",{className:"cm-note",key:"tz-hint"},M("timezoneHint",{host:T.hostLabel,browser:T.browserLabel})):null})(),t("label",{className:"cm-cards-toggle",title:M("cardsTogglePlanTotalHint")},t("input",{type:"checkbox",checked:(o??v).showTotalWithPlan===!0,onChange:T=>{const F=o??v;F!=null&&r({...F,showTotalWithPlan:T.target.checked})}}),t("span",null,M("cardsTogglePlanTotal"))),t("div",null,t("h3",{className:"cm-h"},M("todaySessions")),t(ys,{state:a,t:M})),t(xs,{state:a,draft:o,setDraft:r,t:M}),(v.balance?.display==="settings"||v.balance?.display==="both")&&v.hideOfficialBalance!==!0?t(Ts,{state:a,api:s,t:M,draft:o,setDraft:r}):null):null,k==="quotas"?t(qs,{key:"quotas",state:a,api:s,t:M,draft:o,setDraft:r,targetPlan:N}):null,k==="usage"?t(D,{key:"usage"},!mt||(v.usage?.position??"cost")==="cost"?t(ma,{state:a,t:M,locale:V}):null,t(Ss,{state:a,config:o??v,t:M,draft:o,setDraft:r}),t(Ps,{state:a,config:o??v,t:M}),t(bs,{state:a,api:s}),t(hs,{state:a,api:s}),t("div",null,t("h3",{className:"cm-h"},M("historyDataTitle")),t("div",{className:"cm-buttons"},p?t(D,null,t("span",{className:"cm-hint"},M("confirmImportLegacy")),t("button",{className:"cm-btn",onClick:he,disabled:g},M("apply")),t("button",{className:"cm-btn",onClick:()=>b(!1)},M("cancel"))):t("button",{className:"cm-btn",onClick:()=>b(!0),disabled:g},M("importLegacy")),c?t(D,null,t("span",{className:"cm-hint"},M("confirmReset")),t("button",{className:"cm-btn danger",onClick:ie,disabled:g},M("confirmClear")),t("button",{className:"cm-btn",onClick:()=>f(!1)},M("cancel"))):t("button",{className:"cm-btn danger",onClick:()=>f(!0),disabled:g},M("clearAllHistory"))),t("p",{className:"cm-note"},M("legacyImportNote")))):null,k==="codex"?t(xn,{key:"codex",state:a,api:s,t:M,locale:V,view:"panel",ready:m}):null,k==="display"?t(D,{key:"display"},a?.secretMigration?.pending?.length>0?t(yo,{pending:a.secretMigration.pending,t:M}):null,t(ve,{state:{...a,displayPreviewCodex:K.source===(a.config.codexQuotaSource??"auto")?Xt():{status:"idle",windows:{}}},api:s,load:s.loadDisplay,draft:o,setDraft:r,t:M,locale:V,numInput:Ie,displayOptions:At,CURRENCY_PRESETS:ks,USAGE_POSITION_SWITCHABLE:mt,formatMoneyUsd:z,planOptions:qe.map(T=>[T.id,M(T.labelKey)]),onNavigate:(T,F)=>{P(F),y(T)},renderSidebar:(T,F=a)=>na({...F,config:T},!0,void 0,!0),renderStyleSample:(T,F=a,pe=!0)=>{if(!pe)return na({...F,config:T},!0,void 0,!0);const ke=T.sidebarSimple===!0,de={...T,peakNotice:!1,hideBudget:!1,hideTodayCost:!1,budget:{...T.budget,enabled:!0,amount:Number(T.budget?.amount)>0?T.budget.amount:100}},fe={...F,config:de},se=_e(F.codingPlans?.minimax?.windows??{});return t("div",{className:"cm-footer-stack"+(ke?" simple":T.sidebarStyle==="compact"?" compact":"")},t(aa,{state:fe,wide:!0,summary:ke}),t(Jt,{five:se.five??{percent:24},seven:se.seven??{percent:18},fetchedAt:0,t:M,wide:!0,direction:ue(T,"plan")}))},renderModelsSettings:T=>t(us,{draft:o,setDraft:r,t:M,...T})})):null,k==="pricing"?t("div",{key:"pricing",className:"cm-pricing-page"},t("div",{className:"cm-pricing-heading"},t("div",null,t("h3",{className:"cm-h"},V==="en"?"Pricing":"价格设置"),t("p",{className:"cm-note"},V==="en"?"New prices apply to future calls. Historical costs keep their original rates.":"价格修改用于后续调用,历史费用沿用原价格。")),t("span",{className:"cm-pricing-unit"},V==="en"?"Per 1M tokens":"每百万 Token")),t("div",{className:"cm-pricing-nav",role:"tablist","aria-label":V==="en"?"Pricing sections":"价格分区"},[["models","模型定价","Model pricing"],["catalog","参考价格表","Price tables"],["tools","同步与规则","Sync & rules"]].map(([T,F,pe])=>t("button",{key:T,id:"cm-pricing-"+T,type:"button",role:"tab","aria-selected":x===T,"aria-controls":"cm-pricing-panel",tabIndex:x===T?0:-1,className:"cm-pricing-nav-item"+(x===T?" active":""),onClick:()=>A(T),onKeyDown:ke=>{const de=["models","catalog","tools"],fe=ke.key==="ArrowRight"?1:ke.key==="ArrowLeft"?-1:0;if(fe){ke.preventDefault();const se=de[(de.indexOf(T)+fe+3)%3];A(se),ke.currentTarget.parentElement.querySelector("#cm-pricing-"+se)?.focus()}}},V==="en"?pe:F))),t("div",{id:"cm-pricing-panel",className:"cm-pricing-content",role:"tabpanel","aria-labelledby":"cm-pricing-"+x},x==="models"?t(ve,{state:a,api:s,load:s.loadPricing,mode:"matching",draft:o,setDraft:r,t:M,locale:V,resolveClientPrice:Ia,prettyProviderKey:bn,setField:B,priceEditor:{PriceInput:pn,priceFactor:bt,setPriceFactor:Ct,multiplierOptions:ca,priceMultiplierSettings:ft,priceAt:Je}}):null,x==="catalog"?t("div",{className:"cm-pricing-catalog"},t("h3",{className:"cm-h"},M("priceTableTitle")),t(ve,{state:a,api:s,load:s.loadPricing,mode:"catalog",draft:o,setDraft:r,t:M,locale:V,vendorLabels:vs,priceEditor:{priceAt:Je,priceFactor:bt},renderEditor:(T,F,pe)=>T==="deepseek"?t(Ns,{modelId:F==="__default__"?M("defaultModelId"):F,entry:pe,isDefault:F==="__default__",draft:o,setDraft:r,t:M}):t(Ms,{provider:T,modelId:F,entry:pe,draft:o,setDraft:r,t:M,api:s,lockedIds:T==="openrouter"?a.priceLockIds??[]:[],releaseDisabled:JSON.stringify(o)!==C.current})})):null,x==="tools"?t("div",{className:"cm-pricing-tools"},t("section",{className:"cm-pricing-tool"},t(ws,{state:a,draft:o,setDraft:r,t:M})),t("section",{className:"cm-pricing-tool"},t(ve,{state:a,api:s,load:s.loadPricing,mode:"history",locale:V,disabled:g||JSON.stringify(o)!==C.current})),t("section",{className:"cm-pricing-tool"},t("h3",{className:"cm-h"},M("dataSync")),(o??v).currency==="CNY"&&(o??v).prices?.currency!=="CNY"?t("div",{className:"cm-note",role:"status"},M("pricingCnyHint",{rate:(o??v).exchangeRate}),(o??v).pricingCurrency!=="CNY"?t("button",{className:"cm-btn small",disabled:g,onClick:()=>B("pricingCurrency","CNY")},M("pricingCurrencyCny")):null):null,t("div",{className:"cm-field"},t("label",null,M("pricingCurrencyLabel")),t("select",{className:"cm-input",value:o?.pricingCurrency==="CNY"?"CNY":"USD",onChange:T=>B("pricingCurrency",T.target.value)},t("option",{value:"USD"},M("pricingCurrencyUsd")),t("option",{value:"CNY"},M("pricingCurrencyCny"))),t("p",{className:"cm-note"},M("pricingCurrencyNote"))),t("div",{className:"cm-buttons"},d?t(D,null,t("span",{className:"cm-hint"},M("confirmFetch")),t("button",{className:"cm-btn",onClick:j,disabled:g},M("apply")),t("button",{className:"cm-btn",onClick:()=>u(!1)},M("cancel"))):t("button",{className:"cm-btn",onClick:()=>u(!0),disabled:g},M("syncFromDocs"))),t("p",{className:"cm-note"},M("lastSync",{time:v.fetchedAt!==null?new Date(v.fetchedAt).toLocaleString():M("neverSynced")})+M("source",{source:v.priceSource==="official"?M("sourceOfficial"):M("sourceBundled")})),t("p",{className:"cm-note"},M("syncScopeNote"))),t("section",{className:"cm-pricing-tool"},t(ve,{state:a,api:s,load:s.loadOpenRouter}))):null)):null,t(ve,{state:a,api:s,load:s.loadCommunity,locale:V,quiet:!0,footer:!0}))}const Us=["remote"];async function Fs(e){const n=e.remote;if(n===void 0||typeof n.$mount!="function")return;const s=await n.$mount(Vn);e.effect(()=>()=>{s()},"cost-meter: remote contribution");const a=e.get("remote.costMeter");if(a===void 0)return;e.inject(["connection"],S=>S.effect(()=>{const E=S.get("connection")?.rpc;return Zt(E),()=>{K.rpc===E&&Zt(null)}},"cost-meter: Codex quota transport"));const o=()=>{try{return Ke(e.get("locale")?.getSnapshot?.().active)}catch{return null}},r=ho({status:"loading",error:null,state:null},S=>{const E=o()||Ke(S.state?.meta?.locale)||ya();return{...S,locale:E,...S.state?{state:{...S.state,config:{...S.state.config,activeLocale:E}}}:{}}}),l=()=>G(H(r.getSnapshot().state?.config||{activeLocale:r.getSnapshot().locale})),i=async(S,E)=>{const _=await a[S](...E??[]);if(_===null||typeof _!="object"||_.ok!==!0)throw new Error(_?.error?.message??l()("rpcFailed",{method:S}));return _.value},d=S=>(r.set({status:"ready",error:null,state:S}),S);let u=Date.now(),c=!1,f=!0,p=1,b=0,g=0;const h=(S,E)=>{if(typeof S?.pricesRev!="string"||S.pricesRev!==E?.pricesRev)return S;const _=E?.config?.prices;return _===void 0?S:{...S,config:{...S.config,prices:_}}},x=async()=>{if(!f||c||g)return;const S=b,E=()=>f&&S===b&&g===0;c=!0,u=Date.now();const _=r.getSnapshot();_.state===null&&r.set({..._,status:"loading"});try{const X=_.state?.pricesRev,We=await i(_.state===null?"getLocalState":typeof X=="string"?"getStateSince":"getState",typeof X=="string"?[X]:[]);if(!E())return;if(p=1,r.set({status:"ready",error:null,state:h(We,_.state)}),_.state===null){const je=await i("getState");E()&&r.set({status:"ready",error:null,state:h(je,We)})}}catch(X){if(!E())return;_.state===null&&(u=Date.now()),p=Math.min(p*2,60),r.set({status:"error",error:X?.message??String(X),state:r.getSnapshot().state??_.state})}finally{c=!1}};e.effect(()=>e.on("connection/reset",()=>{x()}),"cost-meter: reconnect reload");const A=setInterval(()=>{const S=r.getSnapshot().state,E=S?.config.sidebarModels,_=S?E?.enabled||E?.dock?E.refreshSeconds:60:p;!document.hidden&&Date.now()-u>=(_||60)*1e3&&x()},1e3);e.effect(()=>()=>{f=!1,clearInterval(A)},"cost-meter: poll timer");const w=()=>{f&&e.fiber?.uid!==null&&r.set(r.getSnapshot())},y=S=>S.effect(()=>{w();const E=S.get("locale")?.subscribe?.(w);return()=>{E?.(),w()}},"cost-meter: DSH locale");typeof e.inject=="function"?e.inject(["locale"],y):o()&&y(e),e.effect(()=>e.on("locale/change",w),"cost-meter: locale change"),window.addEventListener?.("languagechange",w),e.effect(()=>()=>window.removeEventListener?.("languagechange",w),"cost-meter: browser locale");const m=()=>{document.visibilityState==="visible"&&x()};document.addEventListener("visibilitychange",m),e.effect(()=>()=>{document.removeEventListener("visibilitychange",m)},"cost-meter: visibility reload");const k=async(S,E="rpcSyncFailed",_=!1)=>{const X=await S;if(X===null||typeof X!="object"||X.ok!==!0)throw new Error(X?.error?.message??(_?X?.value?.message:void 0)??l()(E));return X.value.state!==void 0&&r.set({status:"ready",error:null,state:X.value.state}),X.value},N={},P=S=>(N[S]||(N[S]=dt.async("./client."+S+".js").then(E=>E.mount(e,r,H)).catch(E=>{throw delete N[S],E})),N[S]),R={loadStatistics:()=>P("statistics"),loadOpenRouter:()=>P("openrouter"),loadCommunity:()=>P("community"),loadPricing:()=>P("pricing"),loadDisplay:()=>P("display"),loadCodex:()=>P("codex"),reload:x,updateConfig:async S=>{const{activeLocale:E,..._}=S;b++,g++;try{const X=await i("updateConfig",[_]);return r.set({status:"ready",error:null,state:X}),S.planBilling&&setTimeout(()=>{x()},1500),X}finally{g--,b++}},fetchPrices:async()=>k(a.fetchPrices()),releasePriceLock:async S=>{const E=await k(a.releasePriceLock(S),"rpcSyncFailed",!0);if(!E.ok)throw new Error(E.message);return E},resetHistory:async()=>{const S=await i("resetHistory");return r.set({status:"ready",error:null,state:S}),S},applyCodexCompatHistory:async()=>d(await i("applyCodexCompatHistory")),dismissCodexCompat:async()=>d(await i("dismissCodexCompat")),importLegacyHistory:async()=>{const S=await a.importLegacyHistory();if(S===null||typeof S!="object"||S.ok!==!0)throw new Error(S?.error?.message??S?.value?.message??l()("legacyImportFailed",{message:"RPC failed"}));return S.value.state!==void 0&&r.set({status:"ready",error:null,state:S.value.state}),S.value},getDaySessions:async S=>i("getDaySessions",[S]),getSessionCost:async S=>i("getSessionCost",[S]),getTurnCost:async(S,E,_)=>i("getTurnCost",[S,E,_,r.getSnapshot().state?.config?.currency]),getTopSessions:async(S,E,_)=>i("getTopSessions",[S,E,_]),refreshBalance:async()=>k(a.refreshBalance(),"rpcBalanceFailed"),refreshGoQuota:async()=>k(a.refreshGoQuota()),refreshGatewayQuota:async(S=null)=>k(S==null?a.refreshGatewayQuota():a.refreshGatewayQuota(S)),refreshCustomBalance:async(S=null)=>k(S==null?a.refreshCustomBalance():a.refreshCustomBalance(S)),refreshCodingPlan:async S=>k(a.refreshCodingPlan(S)),loginCodingPlan:async S=>k(a.loginCodingPlan(S)),setCredential:async(S,E)=>k(a.setCredential(S,E),"rpcSyncFailed",!0),clearCredential:async S=>k(a.clearCredential(S),"rpcSyncFailed",!0)},I=S=>{S.target?.closest?.('[data-slot="conversation.input.model"]')&&R.loadOpenRouter().catch(()=>{})};for(const S of["pointerover","focusin"])e.effect(()=>(document.addEventListener(S,I),()=>document.removeEventListener(S,I)));x();const C=e.get("slots");if(C===void 0)return;const q=S=>{typeof C.entries=="function"&&C.entries(S).some(E=>E.locale==="dsh-context")&&R.loadStatistics().catch(()=>{})};e.on("slots/changed",q),["conversation.view","sidebar.right.pane.tab","conversation.input.overlay"].forEach(q);const Q=()=>({hooks:{cost:r},api:R});for(const[S,E]of[["header","conversation.session.header.actions"],["dock","conversation.composer.dock"]])C.inject(E,()=>C.register({name:E,id:"cost-meter-statistics",order:1,inject:()=>({...Q(),entryPosition:S})},ps));C.inject("conversation.chat.turnTail",()=>C.register({name:"conversation.chat.turnTail",id:"cost-meter-turn",order:10,inject:Q},xo));const oe=()=>({gen:0,dispose:null}),ee=(S,E,_,X,We=!0)=>{S.dispose!==null&&(S.dispose(),S.dispose=null),S.gen+=1;const je=S.gen;We&&C.inject(E,()=>{if(S.gen!==je)return;const Be=typeof _=="function"?_():C.register(_,X);if(S.gen!==je){Be();return}return S.dispose=Be,()=>{S.dispose===Be&&(S.dispose=null),Be()}})},W=oe(),V=S=>{const E=S==="header"?"conversation.session.header.actions":"conversation.composer.dock";ee(W,E,S==="header"?{name:E,id:"cost-meter",order:-5,inject:Q}:{name:E,id:"cost-meter",order:5,inject:Q},S==="header"?wo:No,S!=="off")},M=oe(),v=S=>{ee(M,"sidebar.footer.action",{name:"sidebar.footer.action",id:"cost-meter",order:0,inject:Q},is,S)},j=oe(),ie=S=>{ee(j,"conversation.composer.dock",{name:"conversation.composer.dock",id:"cost-meter-corner",order:9,inject:Q},Do,S)};C.inject("conversation.input.dock",()=>C.register({name:"conversation.input.dock",id:"cost-meter-qstrip",order:5,inject:Q},as)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-simple-guide",order:1,inject:Q},ns)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-billion-compatibility",order:2,inject:Q},ds)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-peak-progress-guide",order:1,inject:Q},jo)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-qstrip-guide",order:1,inject:Q},os)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-balance-click-guide",order:2,inject:Q},rs)),C.inject("sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-codex-compat",order:1,inject:Q},Hs));const he=oe(),B=S=>{ee(he,"sidebar.footer.action",()=>C.register({name:"sidebar.footer.action",id:"cost-meter-peak-alert",order:0,inject:Q},Lo),null,S)};window.cmPeakAlertPreview=S=>{if(window.__cmPeakAlertLive!==!0){console.warn("[dsh-cost-meter] 弹窗组件未挂载:需启用峰谷计价并重启 dsh web 后再预览。");return}window.dispatchEvent(new CustomEvent(Vt,{detail:{kind:S==="offpeak"?"offpeak":"peak"}}))};const J=oe(),Z=S=>{ee(J,"settings.section",{name:"settings.section",id:"cost-meter",order:30,label:S==="en"?De.en.sectionLabel:De.zh.sectionLabel,inject:Q},Qs,!0)},ae=oe(),T=S=>{ee(ae,"settings.general.item",{name:"settings.general.item",id:"cost-meter-usage",order:30,inject:Q},ma,S)},F=oe(),pe=(S,E)=>{ee(F,"settings.section",{name:"settings.section",id:"cost-meter-usage",order:31,label:E==="en"?De.en.usageSectionLabel:De.zh.usageSectionLabel,inject:Q},ma,S)};let ke=null,de=null,fe=null,se=null,wn=null,Nn=null;const vn=()=>{const S=r.getSnapshot().state,E=S?.config?.position??"dock",_=S?.config?.sidebar!==!1&&S?.config?.hideTodayCost!==!0,X=S?.config?.balance?.display??"both",We=(X==="sidebar"||X==="both")&&S?.config?.hideOfficialBalance!==!0,je=Cn=>Cn?.enabled===!0&&["sidebar","both"].includes(Cn.display),Be=_||We||S?.config?.codexQuotaEnabled===!0||S?.config?.sidebarModels?.enabled===!0||S?.config?.budget?.enabled===!0&&S?.config?.hideBudget!==!0||S?.config?.goQuota?.enabled===!0&&["sidebar","both"].includes(S.config.goQuota.display)||S?.config?.peakEnabled===!0&&S.config.peakNotice!==!1||Object.values(S?.config?.codingPlans??{}).some(je)||(S?.config?.gatewayQuotas?.sources??[]).some(je)||xt(S,S?.config).length>0,pa=S?.config?.corner?.enabled===!0||S?.config?.sidebarModels?.dock===!0,Ge=H(S?.config||{activeLocale:r.getSnapshot().locale}),ut=S?.config?.usage?.position??"cost";E!==ke&&(V(E),ke=E),Be!==de&&(v(Be),de=Be),pa!==fe&&(ie(pa),fe=pa);const fa=S?.config?.peakEnabled===!0;fa!==Nn&&(B(fa),Nn=fa),Ge!==se&&(Z(Ge),se=Ge),ut!==wn?(mt&&(T(ut==="general"),pe(ut==="section",Ge)),wn=ut):mt&&ut==="section"&&Ge!==se&&pe(!0,Ge)};vn();const Sn=r.subscribe(vn);return e.effect(()=>()=>{Sn()},"cost-meter: slot sync"),Sn}return Mt.apply=Fs,Mt.inject=Us,ba.exports}});
|