dsh-cost-meter 1.9.39 → 1.9.41

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/lib/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Generated from src/client/*.js by node scripts/build.mjs; do not edit.
2
- window.__ModuleLoader__.load({id:"dsh-cost-meter",factory:ve=>{var Ca={exports:{}},Lt=Ca.exports;Object.defineProperty(Lt,Symbol.toStringTag,{value:"Module"});const Ae=ve("react"),{Tooltip:J}=ve("@deepseek-ai/dsh-client-ui-primitives"),ft=!1,jn='var(--dsw-alias-~.cm-~background:~align-items:center~font-size:~border-radius:~display:flex;~flex-direction:column;~white-space:nowrap~padding:~min-width:~font-weight:600~overflow:hidden~text-overflow:ellipsis~justify-content:~font-variant-numeric:tabular-nums~line-height:~max-width:~display:inline-flex;~box-sizing:border-box~cursor:pointer~gap:~border:~flex-wrap:wrap~flex:none~display:grid;~width:100%~margin:~position:relative;~var(--dsh-frame-top-clearance,0px)~height:100%;~text-align:right~overflow-wrap:anywhere~transform:translate(-50%);~grid-template-columns:1fr~grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));~position:absolute;~font:inherit;~font-weight:~overscroll-behavior:contain~flex-wrap:nowrap;~user-select:none~padding-bottom:env(safe-area-inset-bottom)~display:~flex:0 1 auto;~overflow:auto;~margin-top:4px~left:50%;~border-right:5px solid transparent;~flex-shrink:0~border-left:5px solid transparent;~width:auto~height:8px~transform:translate(-50%,-50%);~grid-column:1/-1~z-index:2~-webkit-app-region:no-drag;~var(--cm-opaque-base,#fff)~margin-top:6px~height:4px~transition:left .4s ease;~transition:top .4s ease;~grid-auto-flow:column;~outline:none~border-color:#34a853~height:6px;~pointer-events:auto;~var(--cm-dialog-top)~width:40px;~outline-offset:1px~text-align:center;~margin-top:10px;~overflow-x:auto~position:fixed;~flex:0 0 auto;~top:50%;~min-height:0;~z-index:9999;~align-items:~height:12px;~height:22px;~height:56px;~height:auto;~content:"";~inset:auto;~opacity:0;~opacity:1;~width:8px;'.split("~"),va='Ɓsection Ɓtabs>Ɓtab{ƒƃ;Ǝcenter;Ɠ;min-height:32px;Ɖ6px 10px;ƛ0;ƥƄ13px;Ɛ20px;vertical-align:middle}Ɓpeak-alert{Ʒ147483647;max-height:calc(100dvh - 32px);ƭƧ}Ɓpeak-alert,Ɓpeak-alert *{-webkit-app-region:no-drag}Ɓpeak-alert Ɓpeak-alert-actions{ƜƘ}Ɓpeak-alert Ɓpeak-alert-actions button{pointer-events:auto}@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;ƙƕ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{ƭnjƉ20px 24px;Ƨ}Ɓstat-dialog::backdrop{inset:var(--dsh-frame-chrome-top,Ɲ) 0 0;Ƃ#0005}Ɓroot{ƬƊ0;Ƒ100%;džƄ12px;Ɛ20px;color:ƀlabel-tertiary);ƈ;ƌ;ƍ}Ɓsession-cost{ƙgrid-template-columns:max-content minmax(0,1fr);Ɗmin-content}Ɓsession-amount{Ƒ40vw;ƌ;ƍ}Ɓsession-detail{Ɗ0;ƌ;ƍ}Ɓchip{ƒƃ;ƕ4px;Ƒ180px;Ɖ0 8px;ǐƅ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;Ƌ;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;Ɵ;Ƌ;Ə}Ɓgo-reset{Ƙ;Ƒ230px;Ƅ11px;color:ƀlabel-tertiary);ƈ;ƌ;ƍ}Ɓgo-time{Ƅ11px;color:ƀlabel-tertiary)}Ɓgo-row.main Ɓgo-label{Ƌ;color:ƀlabel-primary)}Ɓcorner{ƒƬƗ;Ǝcenter;ƃ;ƕ6px;Ɗ0;Ƒ100%}Ɓcorner-chip{ƒƃ;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{ƒƃ;ƕ6px;ǐƉ0 8px;ƅ6px;Ƃtransparent;Ƅ11px;Ɛ22px;color:ƀlabel-secondary);ƈ;Ə;cursor:default}Ɓqchip Ɓqlabel{color:ƀlabel-primary);Ƌ}Ɓqchip Ɓqbar{ƫblock;width:44px;ƻ;ƅ2px;Ƃƀborder-l1);ƌ;Ƙ}Ɓqchip Ɓqfill{ƫblock;ƞƅ2px;Ƃƀstate-ok-primary,#3ba272)}Ɓqchip Ɓqseg{ƒƃ;ƕ4px}Ɓqchip Ɓqsep{width:1px;ǏƂƀ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;Ƌ}Ɓ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));ljǔƛ0;top:max(var(--cm-guide-top),env(safe-area-inset-top,0px));ǂƸƯơǍƑ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;Ƌ}Ɓqguide p{ƛ0;Ƅ12px;Ɛ1.6;color:ƀlabel-secondary)}Ɓqguide Ɓbuttons{Ɔƕ8px;Ǝflex-end}Ɓsection{ƆƇƕ20px;Ɖ4px 2px 24px;Ƅ13px;color:ƀlabel-primary)}Ɓcards{ƙƣƕ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);Ɣ;Ʃ}Ɓ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;Ƌ}Ɓcard-sub{Ƅ12px;color:ƀlabel-tertiary);Ʈ}Ɓh{Ƅ13px;Ƌ;ƛ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);Ƌ}Ɓ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{ƙƣƕ12px}Ɓfield{ƆƇƕ6px;Ɗ0}Ɓfield label{Ƅ12px;color:ƀlabel-secondary)}Ɓinput,Ɓinput option,Ɓinput optgroup{color:ƀlabel-primary);Ƃƀbg-base)}Ɓinput{ƥƄ13px;Ɩ1px solid ƀborder-l1);ƅ8px;Ɖ6px 10px;ƿ}Ɓinput:is(select){color-scheme:light dark}Ɓinput:is(select) :is(option,optgroup){color:ƀlabel-primary)!important;Ƃƀbg-base)!important;Ƃrgb(from ƀbg-base) r g b / 1)!important}Ɓ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);Ɵ}Ɓcheck{Ɔƃ;ƕ8px;Ƅ13px;color:ƀlabel-primary);Ɣ}Ɓpricing-page,Ɓpricing-content{ƙƕ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;Ƌ}Ɓpricing-nav-item:focus-visible{outline:2px solid ƀstate-business-primary)}Ɓpricing-tools{ƙƕ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{Ƌ;Ƅ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-template-columns:52px repeat(4,minmax(0,1fr));ƕ8px;ƃ}Ɓ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{ƒƃ;ƕ5px;Ɣ}Ɓprice-multiplier input{ƛ0;accent-color:ƀbrand-primary,#4d6bfe)}Ɓprice-row input[aria-invalid=true]{border-color:#d64c4c}Ɓbuttons{ƆƗ;ƕ10px;ƃ}Ɓ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{ljǔƛ0;Ɠ;ǂƸcolor:ƀlabel-primary);Ǎ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{NjƯƵ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{ƒƃ;ƕ6px;Ƅ11px;Ƌ;letter-spacing:.4px;text-transform:uppercase}Ɓpeak-alert-badge:before{ǓǗƴ;ƅ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;Ƌ;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%{Ǖtransform:translateY(10px) scale(.98)}to{ǖtransform:translateY(0) scale(1)}}@keyframes cm-peak-alert-in-center{0%{Ǖtransform:translate(-50%,calc(-50% + 10px))}to{ǖ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-template-rows:repeat(7,auto);ƕ3px;ƚ}Ɓ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);Dž}Ɓug-months{ƙƾƕ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);ơƼƷ}Ɓpeak-chip{Ƅ11px;Ƌ;Ɛ1.2;ƈ;color:ƀlabel-secondary)}Ɓpeak-classic{ƜƆƇƕ5px;ƺ;Ɗ0}Ɓpeak-classic Ɓpeak-track{Ƙ;ƴ}Ɓpeak-classic-marker{Ƥtop:0;Ưwidth:4px;ǏƂƀbg-base);Ɩ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);ơƼƷ;ƅ2px}Ɓpeak-classic-marker:after{ǓƤ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;Ƌ;Ɛ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;DŽƓ}Ɓpeak-rail-track{ƜƆƇwidth:6px;Ǒƅ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;Njƚ;height:2px;Ƃƀbg-base);box-shadow:0 0 0 1px ƀlabel-tertiary);transform:translateY(-50%);ƽƷ}Ɓpeak-rail-label{Ƅ10px;Ƌ;Ɛ1.2;ƈ;color:ƀlabel-secondary)}Ɓpeak-rail-classic{ƆƇƃ;ƕ3px;DŽƓ}Ɓpeak-rail-classic-track{ƜƆƇwidth:14px;Ǒƅ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{ƤƯNjwidth:12px;ƻ;Ƃƀbg-base);Ɩ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);ƵƽƷ;ƅ2px}Ɓpeak-rail-classic.off Ɓpeak-rail-classic-marker{border-color:ƀstate-business-primary)}Ɓpeak-rail-classic-label{Ƅ10px;Ƌ;Ɛ1.2;ƈ}Ɓpeak-rail-classic.weekend Ɓpeak-rail-classic-marker{ǀ}Ɓgrid-group{grid-column:1 / -1;margin-top:8px;Ƅ12px;Ƌ;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;Ƌ;color:ƀstate-business-primary);Ɣ}Ɓtoggle-btn:hover{text-decoration:underline}Ɓcollapsed-note{Ʈ}Ɓcatalog-vendor{LJƄ12px;Ƌ;color:ƀlabel-tertiary);border-bottom:1px solid ƀborder-l1);padding-bottom:2px;Ɔƃ;Ǝspace-between;ƕ8px}Ɓvendor-toggle{Ɣ;Ʃ}Ɓvendor-toggle:hover{color:ƀlabel-secondary)}Ɓvendor-display{ƒƃ;ƕ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);Ɣ}Ɓmodel-costs Ɓmstats-tab.active{Ƃcolor-mix(in srgb,ƀstate-business-primary) 14%,ƀbg-base));border-color:ƀstate-business-primary);color:ƀlabel-primary);Ƌ}Ɓmstats-h{ƛ10px 0 4px;Ƅ12px;Ƌ;color:ƀlabel-secondary)}Ɓmstats-row{ƙgrid-template-columns:minmax(90px,170px) 1fr auto;ƕ8px;ƃ;Ƅ11px;Ɛ1.7}Ɓmstats-name{ƌ;ƍ;ƈ;color:ƀlabel-secondary)}Ɓmstats-label{ƶ;ƆƗ;ƃ;ƕ6px;ƺ}Ɓ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;Ǘƴ;ƅ2px;margin-right:3px}Ɓmstats-note{LJƄ10px;Ɛ1.6;color:ƀlabel-tertiary)}Ɓmatch-row{Ɔƃ;ƕ8px;Ɖ3px 0;Ƅ12px;Ɨ}Ɓmatch-row Ɓinput{flex:1;Ɗ160px}Ɓbudget-controls{ƙ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;DŽƃ;Ǝ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;Ƌ;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{Ɔƴ}Ɓ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;ƺ}Ɓ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{ƒƃ;ƕ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{Ƙ;ƒƃ;Ǝ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;Ƌ;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{ƻ}Ɓ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);Dž}@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;Ƌ;color:ƀlabel-primary)}Ɓmm-reset{Ƅ11px;color:ƀlabel-tertiary);ƶ}Ɓcodex-head>Ɓmm-title{Ɗ0;ƌ;ƍ;ƈ}Ɓcodex-resets{Ƙ;Ɵ}Ɓcodex-resets>span{ƫblock}Ɓfooter-stack.compact Ɓbbox[data-cm-display=codex]{grid:auto/1fr}Ɓbbox.rail[data-cm-display=codex] Ɓbbox-rail{Ƒ100%;Ơ;džƄ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){Ɨ;NJǒnjalign-content:flex-start}:has(>div>[data-slot="sidebar.footer.action"]>Ɓfooter-stack){NJǒmin-height:0}: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 Ɓfoot:not(Ɓfoot-rail){Ǝspace-between}Ɓmodel-costs Ɓcollapse-h{ƚ}Ɓmodel-costs Ɓcollapse-h>Ɓbal-amt{margin-left:auto}Ɓfooter-stack.compact Ɓbbox{ƙgrid-template-columns:repeat(2,minmax(0,1fr));column-ƕ12px;row-ƕ2px;ƃ}Ɓfooter-stack.compact Ɓbbox>*{ƶ}Ɓfooter-stack.compact Ɓbbox>Ɓmm-row:not(Ɓmm-title){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);ƭƧ;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{ƻ}Ɓ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;Ƌ;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{ƨLj}Ɓ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{ƨLj}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)}Ɓtoday-values{ƒƗ;Ǝflex-end;ƕ2px 8px;Ɗ0;Ƒ100%}Ɓtoday-values>span{ƈ}Ɓtoday-values[data-both=true]>[data-cm-today=tokens]{Ƅ11px;color:ƀlabel-secondary)}Ɓsimple-summary{Ƃƹ;Ƃrgb(from ƀbg-layer-1,ƀbg-base,#fff)) r g b / 1)}'.replace(/[ƀ-ǿ]/g,e=>jn[e.charCodeAt(0)-384]),Aa="dsh-cost-meter/client.css";if(typeof document<"u"&&document.head!==void 0){const e=document.querySelector("style[data-plugin-css="+JSON.stringify(Aa)+"]");if(e?.textContent!==va){const t=e??document.createElement("style");t.dataset.plugin="dsh-cost-meter",t.dataset.pluginCss=Aa,t.textContent=va,e===null&&document.head.appendChild(t)}}const Hn="sessionCostTitle|sessionDetailTokens|sessionDetailCache|cost|sessionLine|sessionLineCompact|sessionCostCompact|quotaUnlimited|pricingCnyHint|balanceQueryFailed|unknownError|balance|officialBalance|balanceShowSource|quotaComposer|quotaSidebarSettings|quotaSidebarComposer|quotaSettingsComposer|quotaAllPositions|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|codexQuotaEnable|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|codingPlanClinepass|codingPlanScnet|codingPlanVolcengine|codingPlanQwen|codingPlanMimo|wbT|wbH|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("|"),Qn="额度|显示|amount|余额|价格|费用|DeepSeek|会话|quota|模型|输入|session|off-peak|official|balance|缓存|计费|OpenCode Go|Plan|display|prices|刷新|官方|自动|设置|time|OpenDesign|tokens|input|the|自定义|weekends and Chinese public holidays are|预算|Token|调用|message|output|今日|credential|凭据|侧边栏|Balance|cache|settings|用量|金额|Enable|Refresh interval|中国公众假期全天谷价|同步|失败|峰时高价时段显著提示|开启|时段|details|refresh|Settings|and|calls|cost|位置|历史|峰时|已用|输出|price|usage|BillingCenterReadOnlyAccess|sidebar|以同一系统账号运行|框上方|budget|currency|interval|position|保存|图框详细信息|当前|Credits|Refresh|account|WorkBuddy2API|period|启用|数据|本地|留空|Codex|model|optional|右下角|Budget|DescribeBillingAccount|credits|failed|history|source|分钟|匹配|命中|币种|查询|记录|谷时|账本|配置|默认|Coding|Strip includes|rates|上方|剩余|小时|峰谷|提示|时间|更新|横条|统计|订阅|读取|Chinese|Sidebar|default|minutes|人民币|API|Cache|automatically|empty|month|YYYY-MM-DD|auth login|billed|configured|planAmount|使用|侧栏|全部|可选|本月|请求|谷价|进入|隐藏|ArkReadOnlyAccess|Display|Off-peak|Quota not queried|browser|current|is an upper bound|local ledger|never echoed back|subscription|法定假日|逗号分隔|AccessKey|Output|Preview entering|Remaining|WorkBuddy|including|ledger|overrides|remaining|this|主机|估算|关闭|密钥|恢复|日期|明细|暂无|来源|浏览器|清除|登录|积分|累计|账号|进度条|间隔|Today|Volcano Ark|coding plan|local|a catalog entry|comma-separated|deepseek-v4-pro|only|peak|导入安装前|开始对话后|汇总在这里|Monthly|Volcano|pricing|Cost|Entering|Failed to load|Input|Official|Provider|Show|a vendor group|built-in table|custom|enough samples|historical|stay unchanged|strip|takes priority|to restore|toppedUp|优先|取消|周末|图框|安装|展开|手动|挂载|提醒|方向|消耗|添加|确认|等值|美元|Alibaba Cloud|Authorization|volcengineapi|Quota|above|effective|estimates|qianwenai|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|percentages|pre-install|qianwen-cli|token|unavailable|DSH|Auto-match|Claude Pro|Cline Pass|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|placement|plan|precision|providers|reasoning|signed-in|stay|subagents|use|中复制|占位符|子代理|工作区|性价比|抵扣率|控制台|未上报|条起步|标题栏|知道了|表条目|起始日|过期后|这一项|阿里云|Base URL|Cookie|Currency|External|HTTPS|Moonshot|Public|Security|Source|Usage|actual|calendar|click|deepseek|enable|follow|full|notice|override|progress|provider|range|read|recorded|requires|sample|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|box|bundled|channel|earlier|gateway|here|holiday|include|key|name|not|percent|plugins|qianwen|replace|require|unknown|Click|Enter|Local|ROUTE|USD|alert|equiv|first|limit|match|query|saved|start|stats|value|CNY|Change|Choose|Gemini|Kimi|Ledger|NewApi|OPENAI|Recent|Rhythm|Saving|VOLC|active|card|corner|direct|divide|fields|import|logs|manual|openai|origin|pct|port|reason|remain|resets|select|studio|sync|上下|上界|上限|不再|不是|不足|为准|之后|也可|仍在|保持|允许|入口|分开|包含|单家|即将|原因|发生|同名|后的|后缀|回放|回显|回退|域名|填入|处于|字段|对应|导出|将按|屏幕|工具|平价|底部|开关|总额|打开|按量|放行|新增|早期|最近|月度|权限|条数|样式|样本|概览|版本|状态|现在|界面|百炼|目录|直接|符号|类型|紧凑|缺失|网关|花费|英文|表外|规则|语言|调整|账单|货币|赠送|超出|跟随|通知|重试|钱包|页面|Add|bar|CLI|KEY|Keep|Sync|VAR|When|clear|day|dock|docs|each|leave|left|now|show|that|tok|will|yet|your|All|Pro|com|Auto|Not|Save|auto|back|can|chip|its|keep|old|open|per|save|Top|low".split("|"),Ee=Object.fromEntries([["zh",'本Ƈƅ(按每次Ƣ˜͑͞Ɛ)|Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|Ə:读 {̭} · 写 {̶}(ʏ按ǣ价Ɛ)|ƅ {Ƃ}|本Ƈ {Ƃ} · ǣ {ʂ} · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|本Ƈ {Ƃ}|仅Ɓƭ|无限制|Ǎǽƭ来自ɦƄ × ͘ {ʅ}。对照Ɩǽϻ,请ʤ Θ,再ƱƄ;Ʊ仅˞ʔƢ。|ƃǥƲ:{ƣ}|ˡ错误|ƃ|Ɔ ƃ|Ɓƃȯ(Ɔ)|Ɗdž|ȉ和Ƙ页|ȉ和Ɗdž|Ƙ页和Ɗdž|ȊƼ|ǥƲ|Ɔ ʗʢƃ|Ɩƃ变动与ǕǨ交叉͉(偏差超阈时Dz)|总ƃ {Ƃ}|Ͻ {ʁ} · ̹ {ɗ}|Ǵdz {ƙ}|Ơ({ǒ})|ƿ {ʊ} / {Ƃ}|ƥ {Ƃ} · 占Ơ {ί}|Ȍ {Ȃ} · ȴ {ɰ}|Ơ|ƥƅ(按ƖƄ͞Ɛ)|ƥ ơ Ƭ|ƛ|Ƣ {ƺ} 次 · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|Ȍ {Ƃ}|ȴ {Ƃ}|ƥ|ƨƥƁ|ƅ|ơ Ƭ|ƥ|Ȍ|ȴ|ƞ˘|ȮƽǦ。ɂ,ƅϖ天Ƀ。|Ȭ|Ƣ|Ɗ Ж|Ə Ж|ǀ Ж|ƅ|ƥȮƇǦ。|Ƈ|ǓƠ|Ơƀ(按ƁǤ)|Ơʕ|开始Ȭ|结束Ȭ(ǖ = ƥ)|Ƕ˘:{̬}|ǓƠ后Ɓƀ、ƿƭ及比例(按ƁǤ换算);ȋƥ、Ȍ、ȴ或ƞʕ。|{ǒ}Ơ {Ƃ} · ƿ {ʊ} · {ί}%|(已Ͼ)|(接近ι)|旧Ɖ|ǪϏ|ʟ|˛|ǧ|ƾ|ƃ专用 Ǿ ͡|ɘȈ此ʗ ͡;未ǩ时Ǹ已ȲƖȵƃ,其次沿用ƉƧ。|总ƃ {ɰ} · Ͻ {ʁ} · ̹ {ɗ} · Ǵ于 {ƙ}|ƃǥƲ:{ƣ}|未ǥƃ|Ɩʢƃ|ƕ中…|ƕƃ|ƞ Ɍ ƃ|ɣǩ|ɣ ơ Ρ ƃ|Ɓ官网ʢ页的ǽ˚ƃ。Ȳ ʼrhythm.ε,在Ȱ开发者Ϙ → 网络̇ʢȍ的 ̘,或在存储 / ͊̇ tr_Ƌ 值,ϑːƧ并Ǔ。̘ 仅存 ʾ Ƨ库;̔重新͆。|ɣ̿ / ̖ƃ|ǥ̖中国站˚金。RAM ȝ 需 bss:ǜ Ϥ。前两项必填;STS 才需 ̞ ơ。Ȫ存Ƨ库。|extract ͐点͠、数值和 add/̳/Ψ 运算;Ξ ƈ 除以 500000 得到ɦ。|̸ʓ|϶ʓ|ȍ URL|͐ ̛、本机 ͭ,以及 /΄/… 相对͠(ƗϿ ʾ ˦)。|ς非回环 ͭ(Ƨ明文传输;须将准确的 ȧ:˦ 加入ɱ)|+ Ǒ ȳ|Ǒ 预设Ǹ活跃ȵ池ǯȳ,Ȉ管理后台 X-Admin-ơ(λƉ Ǿ ͡)。请͆˜ͅ与˦;令牌̔ǴƧ。|ȍ方法|ȍ头 (ɷ)|ȍ体 (ɷ)|ǖ不́;ɷ 原文Nj并́。Ǫ ɴ 为 ʬ/json,ʒȍ头ʠ。|解析ϸ (ɷ)|ƞƃƁƼ|ƕȷ (ǡ)|ƃ原Ǥ|按ƁǤ͎(΍ ƃ)|ȈƁ͘与͝;ƃǤρ端点原Ǥ。̺Ǥ及ȳ不͎。|ƃ {Ƃ}|˝ƿ {Ƃ}|ƿ {Ƃ}|ƃȶ (蓝=ƃ,橙=˝,灰=ƿ)|ȶɡ|各组ȶ可͚ʤ填充ɡ:「ǯɡ」满̏、随ɢ递减;「ƿɡ」空̏、随ɢ填满。|ƃ条(Ɩ/ƞ)|Ơ条|Go ƀ条|ƒ / Ǘ ƀ条|ǯɡ(满 → 空)|ƿɡ(空 → 满)|ƀι (ȋ)|ǖ则ɘȈ Ǿ 返回的 max_LJ;仍无则Ɓ整条浅蓝|ɷ ͖无效|{{Њ_NAME}} 从Ƨ库或ʞǸ。<Ό>_Ǿ_Ї 中 Ό 为大写 Ɍ ID,ϰ改下划线,如 έ→Ο_Ǿ_Ї。ϊ共用Ȫ。|Ƨɱ (Ȝ)|ȍ头带Ȫ时仅ϟ̼内ȧ,ǖ则ϟ并警告,防ʖ他人ǩ外带Ȫ。|ƧƊ|为Ǯ {{Њ}} ̈存入Ȫ(̶-ȿ,͂Ƨ库,不ώ):|ȍ头还没有 {{Њ}} ̈:ϑ如 "ɨ": "Beʮr {{MY_Ǿ_Ї}}" 后ʣ会出现ƧƊ框。|Ǔ|ǯ {ȥ} · ƿ {spend} / ƀ {maxǛ} · Ǵ于 {ƙ}|ǯ {Ƃ}|ƕƞƃ|Ƒ Ƿƀ|Go|ʚ 5 ǰ|͔|Ȍ|ʦ:{ƙ}|已到ʦdz|ǯ {d}天{h}ǰ|ǯ {h}ǰ{m}分|ǯ {m}ǡ|ƿ {ί}%|ǯ {ί}%|{΃}%|Ǵ于 {ƙ}|Go ƀƁƼ|Go ƀƕȷ(ǡ)|ǡ|Ƒ Ǿ ͡(ȋ,ǖƗ̀)|Go ƀ主ˢ|Go nj|已ǩ(ȯ:{Ǡ})|未ǩ|Nj|˧Ƨ|ȱ|Nj中…|Ȫ只ʏ ʾ Ƨ库,不Nj在Ǩ里,也̷ώ。|以下ȪπǕǨ,未迁入Ƨ库。请ϕϔʞ后重启:|Ơnj|ƕƀ|未ǥƀ|˵(ˀ/Max)|Z.ai / 智谱 GLM ǫ ƒ|ɸ ơ ƒ|ɸ ƒ|ǥϐ(̛)|ǖƗʤƖ站点。͆后 ͡ 仅发往该ϐ;Ȉ可信ͅ,不含͠。|5h|7d|ϝ Ɔ ̹页(plat˼m.̤.М/ǂ)|ͥ (Ǘ) ƀ|Ǘ ƀ未ƴ · 点此ƴ|5h ƀ|周ƀ|{ƙ} ʦ|未取得ƀ,请ɤ所选ǔ源已Ȳ;ʝЁ|Ɓ Ǘ ƀ(需Ȳ Ǘ 插件)|在ȉƁ Ǘ ƀ|在Ɗ区Ɓ Ǘ ƀ|本Ƈƅυ̉|Ȯƀǔ|ƁƼ|可单独ʤȉ、Ƙ页或Ɗdž,ο同时Ɓ。φƼɘ于ǵǪƘ。|Ǿ ͡(ȋ,ǖƗ̀)|ƕȷ(ǡ)|ƕ|Ȳ|Ȳ中…|未ǥƀ|ІЛxyǾ ϴƀ|ɣȯ|ȯʓ|̗|ƁƼ|ƕȷ(ǡ)|Ƨɱ(ȧ:˦,Ȝ)|˃ ͡(͂)|Ϫ|不͐的 Ɍ|ˡ|未̀ȵ|抓取于 {ƙ}|˕ȵ (Ǎ: {ǐ})|只Ɓ Λ ƀ|ƕ|先˗Ǔ̕|Ǔ并NjƁƼ̈́ƕ|̽|˗Ǔ后会排到最上面;点ʓ可ɝ该项自己的ǩ。ƞƃ͓ 8 条,ϴȯ͓ 4 条。|未Ǔ。ƴ后ϖƕȷǥ该˙的 Ⱥ ƀ并Ɓ在ʣ。|ƴ后Ǹ Ƒ 的ʚ 5 ǰ、周、月ƀ,Ɓ在ȉ、Ƙ页及ǚ;无Ƿ时Dzψ。|ǚƁ(Ў)|在ǚƁ Ƒ ƀ / Ơ|ʚ 5 ǰƀ|͔ƀ|Ȍƀ|Ơƿ%|5h|周|月|日|Ơ|ǨǸƲ:{ƣ}|正在ǸǨ…|Ǩ不˚|ƱƲ:{ƣ}|ƽǦ已ȱ。|ȱƲ:{ƣ}|DZʡ已ȩ,按˛ƄƐ|尚未ˤ(ˤdz:{ƙ}),Ǎ按˛ƄƐ|Ǎϒ峰Ƶ,按ƾ价Ɛ|Ǎ为 Ɔ ƾ高价Ƶ,按ƾ价Ɛ|Ǎϒ谷Ƶ,按ǧ价Ɛ|ɚƵ——全Ȏ(周六及周日˔按ǧ价Ɛ)|ɚƵ——全Ȏ|ɚ全谷|ț——˔Ȏ|ț——全Ȏ|假日|ț(̾Ȭ,Ȝ)|自 2026-08-23 ̾dz 00:00 起,ɚ和ư;调休上班的ɚ仍按Ȏ。|ƾ|ϙ|DZƵ条Ϧ|简洁(单行ϲ)|经典(分段与胶囊芯片)|峰/谷˕前͋ɠ|提前ɠ(ǡ,1-30)|ɠϱ|ȏƾ|ȏǧ|峰和谷|χȏƾ|χȏǧ|约 {ƙ} 后Ɛˢ˕为{phase}价,请注意本ƵƢ成本。|ƾ|ǧ|̑|峰价ɠ|Ȏɠ|͋Ƽ|ǚ|ϗ中心|Ʊ́系统Ѐ|ϛ后͟Ȱͅ栏ςЀϤ,才能在Ѓ最小化/切走时收到ɠ。|ʧ͋|ʧ ȏ峰|ʧ ȏ谷|(ʧ)|DZʡ与Dz|Dz已Ȑ:需ǓDZʡ并ƴ「Ƴ」。|常规|ƭ与Ǥ|ƨƁ|͜ȉƁ|精简ʑ,ʍƭ、ƀ和͍详情;高度͓占ϗ 38%,Ͼ可ʚ。ȩ后ȫ。|试试更轻巧的ȉ|͜Ɓ可以为Ƈ̼留出更多空间。要ϫƴ吗?ξʒ「Ƙ → ƅ → Ɓ」中˕。|ƴ͜Ɓ|ʍǍƁ|Ƙ未能Nj。可Ё,或ȩDz后在Ƙ中Ϻ。|ȩDz|ƥ / {ǒ}Ơ|ƨȶϦ|͕|ϲ(两列)|ȫ已ʟ的Ɖ ({˭})|ʟ会ȱɞ映射并Ȑ此行,可ȫ;̷̽ƬǦ,ʔ按ƗǢϸʡ。|ǚ角标|nj|əɟ|未核价|已ƞ|这个Ƅ是你ɞ改过的,ƗƱ̷ʠ它。|ȫƗƱ|按ƉǶ(ʼ 与ƅ)|ȉƉϵ|{n} Ɖ|其它|ƁƉϵʑ|Ǫɝ|记住ɝϪ|Ɓ ơ|Ɓƅ占比条|ǚƁ Ъ-1 Ɖ|Ǫʕ|收起摘要|ʑƼ|Ɖ行数(1–10)|ƕȷ(10–60 秒)|ʕϜ与Ɖ数|Ъ-1 Ɖ与ƭ|顶部|ƃξ|Ϛ|ƥ|近 90 天|ƅ排行|ơ ɢ|Əǣ率|̎?|长Ƣ无Əǣ:代理̓ʟƏϓ。ƭ按全未ǣ计,是θ;可直连核对。|̋ · 每ɦ ʼ 数|Ɗ|Ə|ǀ|该ƵȮƬǔ。|综合ʐ {ǁ}/M|ǣ率=Ə读÷(Ə读+普通Ɗ);「̎?」表示Əϓ̓ϳ,ƭ为θ。ʐ=ƅ÷ʼ×1M;̋=ʼ÷ƅ。|未分Ɖ(ϡǔ · 按当时ǦƐ)|本Ƈ {Ƃ}(Ǿ)· ƒ ɥ {ȇ} · ǣ {ʂ} · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|本Ƈ {Ƃ}(Ǿ)· ƒ ɥ {ȇ}|ƅ {Ƃ}(+ƒ)|ƒ Ƿƀɢ(ɥ){Ƃ}|ơ ƒ ƬǶ(每 1% 与͙Ȩ)|尚无 ǫ ƒ ƀǔ;͟「ƀ」页ƴ并ƕ˙。|͛|ƿ %|本ʕ˜(ǕǨ)|每 1% ƀ ≈|͙ 100% ≈|ʦ {ƙ}|˨差分|ǍƬ͎|ϧμ|{ʃ}(基准 {ƙ})|读数͝受限|ƒ Ƭ曲线(按ʥ聚合)|͗|每周|每月|˨μ:至少两次成功ƕ,且ƀɲω变化。|{ɿ}:͙估计 ≈ {̧}(每 1% ≈ {Ш1})· ˜ {ƛ} / {ƻ} · {ljs} 个ʥ|ƭ是Ϯ价ɥ;Ƿ耗ƀ,Ơ只计 Ǿ。Ȩ仅含 dsh Ƣ;服务端ɲ含全ȵ。短时ϧ͝有限;5h ʚ,周/月按Ǖ日历。|Ɛ方式|ƒ Ƿ|Ɨ|Ǿ Ϟ|在ƅƘϯƁ|仅控制是否在ƅƄ表ϯƁ;不˞ɟ和Ɛ。ə˗后πƄ表内,可随时改回。|ɝ˙可˧Ƅ;əɟ的ʎƉʒːȫ。|̻Ƙ˓|可Ɗ 2 × 0.8|˒˓会Ʊ到本ƉȊʐ|仅˒̕的˓;ə˗ȫ统一˓|请Ɗ非负ʐ或乘法,例如 2 × 0.8|ˡƉ名ƗǢ|Ɨ(去ό / 前缀 / 家族相似)|仅͞Ǣ|ɞ指定ɘ;ƗǢ只接受ϊ及Ȭ、ϩ、η文ό。未ǣ的 Ɔ 用Ǫ价,̺ˣ不ʡ。|待Ǣ与ɞƘ|按ˣ和Ɖ̻Ƙ:ʤƄ̒、ƞƄ,或标记为ǕƉ。ƞƄ只˥Ǎˣ。|Ɔ Ǫ价|ʟ|ǕƉ(零ɢ)|已ǢƄ的Ɖ|ǍȈƗǢ。可改选Ƅ̒、ƞƄ或零ƅ;Nj后移入ǮɞƘ区。ơ 仍会Ƕ。|ρƗǣ|ȮɞǢʠ。|已ɟ(参与Ɛ)|Ɗ|ƏǸ|Əʏ|ǖ时按ƏǸ价Ɛ|ǀ|Ɔ Ƅ表(已ɟ)|Μ / ̜|˄|ʫ 硅基流动|CommƹCode|ˁ|SCNet 超算互联网 ơ ƒ|ʜ ȹ ǫ ƒ|̿ Ͳ ơ ƒ|小米 MiMo ơ ƒ|ȡ ȳ|ƗǸ ȡ ȳ。|ͪ (Droid)|ƚ|ƚ ̊ ID|仅在 ʾ Ƣ ƚ Ǿ οƐ,无需ɜ ƚ ͊。远端ƀǥ另需 ƚ Cloud 的̊ ID 与 ʨ(λ͏ Ǿ ͡);未ǩ时可ȩƀʑ,ƇƐ照常。͈͛与ЂτƁ。公开ϮƄ˥ ƒ ɥȨ;Ђ扣费͟Ɛ分类中设为 Ǿ。|ƀϱ|Stƹard + Core|组织 ID(ȋ)|͈ȳ|补偿ȳ|ƃ|ƀȯ|ǕȨ|Ɩ І|ϭ І|І 模式需在 ʾ ȧɜ @ɮ/ʻ,并Dž ΅ Ȅ。|ϭ І:在 ʾ ȧɜ ʰ。Ȳ按钮会在该ȧϝ授权Ȱ;远程或无Ϭȧ请Dž bl Ȅ --ɽ。|ϣ ǎ ƀ(个人版 Lite 5 万 / ͕版 50 万,以Ƿ页ν)|Ƿ̓(ȋ,͖ ȃ;ǖʘ)|ǎ ̌ʠ(ȋ;每百万 ʼ 抵扣的 ǎ,ǖ用ʎ表)|Ɖ名,如 qwen3.8-ʸ|费率|Ɗ|Ə读|ǀ|待填齐三项正数后ƗNj;Ȋ清空ȫʎ表。|ɣ|ǎ ǕȨ,以̍ν。Ƕ归属͈̿的 ƒ Ƣ;ˑϞ Ǿ。ϷƉ需设̌。|ǕȨϣ ǎ ƀ(˛ 60,000 / ͕ 240,000 / 高级 600,000)|Ƿ̓(ȋ,͖ ȃ;ǖʘ)|ɘ用 24 ǰ内的̍͌,否则按ǕǨ和Ɩ ǎ 表Ȩ。̺Ϙ和ϷƉˑ入。|ʛ ȝ ID|ʛ Secretȝ|ʜ需 AK/SK、ȑ 和 ǃ;可填Ƨ或ϕ Σ_˴/Σ_˷。只连接 Ч.ɩ.М。|AK...|SK...|{h}ǰ|{h}ǰ{m}分|{m}ǡ|{ƙ}后ȏϙ|{ƙ}后ȏ高峰|峰Ƶ(UTC):{ʋ};ˤdz:{ƙ}。{ˎ}|未ǩDZƵ。{ˎ}|ˡ|ƥƅ|Ȍƅ|ȴƅ|自Ǩ建立以来 · Ƣ {ƺ} 次|͇Ƭ|ʾ + ͇合计|͇͌超过 24 ǰ未Ǵ|近期͗Ǧ|ƭ取Ϣ͌,̓比Ɩϻ晚几ǡ。ƛ 含Ɗ、ǀ、Ə和͏;͏并入ǀƐ。以ƭ͉。|ƥ/Ȍ按宿主͒ {ʶ},Ȱ为 {ȕ}。͒不同会˞日界和͉;可将 dsh 改为Ǖ͒。|ƥƇ|ʝȬ行可ɝ˝Ƈȭ|Ƈȭ˖中…|该日无Ƈȭ(ϡǔ或Ƈˠ已清理)|Ƈȭ˖Ʋ|按ƇǶ(Ȋƽ)|跨天合并,̉按ϛ归并。仅列选定ϥ,ȴƅυȊ对话。|ȮƇǔ|Ƈʙ中…|ƇʙƲ|Ɓϥ|Ƈ̼附显Ƈ ID|ƭ含 ƒ Ϝ|ƴ后所有ƭ按含 ƒ Ƿɥ的总ƅ展示;ȩ(Ǫ)仅计真金白银 Ǿ ˣ|ȐƖʢƃ(ƴ后ƨ与Ƙ页κƁƖƃ)|Ȑƥɢƭ(ƴ后ƨ/Ơȭ/ϨʑκƁƥƅ)|Ȑ̐ƅȭσ|ȐƊ框ːƅȭσ|Ȑ每轮回复ϋ本轮ƅ|排序|ƅ 高→低|ƅ 低→高|dz 新→旧|dz 旧→新|实时顺序|ƽǦ|ơ ƬǶ|ȴ {ƛ} ƛ · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ} · {ƺ} 次Ƣ|{ɿ}:共 {ƛ} ƛ(Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ})· {ƺ} 次Ƣ · {ƻ}|Ȯƽǔ,ɂ͗Ƭ会Ƀ|Ƭ|ơ ƬǶƼ|ƅƘ|通用Ƙ|͚分节(Ƭ)|ƁƘ|Ϩ|ƀ|Ƭ|Ƅ|Ɓ|ƽǔ|ƇƅƁƼ|Ɗ区ː|Ƈ̐|ȩ|Ɗdžƀǵ|ǪǓƀǵ(φƁƼɘ)|ǵ含Ơƿ%|ǵ含 Go ƀ|ǵ含 ǫ ƒ ƀ|ǵ͍可见各͛ʦ͑与Ǵdz;无˚ƀǔ时ƗȐ。|Ϡ:Ɗdžƀǵ|在ƊdžƁƠ及 Ƒ/ǫ ƒ ƀɲ。ϫƴ吗?ʒ「Ƙ → ƁƘ」˒。|ƴǵ|暂不ƴ|ʝ立即ƕ|Ϡ:ƃɛʝƕ|ʝƨƃ或 ǫ ƒ ɛ即可ƕ;ƕ时ɛ闪烁,Ʋ时ʍ原值并在͍Dz中说明ψ。|̑|˝ƅƁ|ƨϚ|ϼ单位|ǽ Θ|ɦ ΍|欧元 EUR|ϼϰ|͘(1 ɦ = ? 目标Ǥ)|小数位数|ƃƁƼ|主Ѓƨ|Ƙ页|两者都Ɓ|ƃƕȷ(ǡ)|Ǔ Ɔ DZƵƄ|Ƴ(ƨƠ框/ƥƅ;Ƙ页DZ面板内ʧ)|Ƈ按Ƣ时ƄƐ(含DZ与ƽˢ)。Ɗ、ǀ、Ə读写τǶ;͚Əʏ价与长η˟位按ǩˤ。|已ɟ的Ƅ表|ƖƄǤ|ɦ(϶Ɩ页)|ǽ(̸Ɩ页)|决定ƱƄ所用的Ɩ页Ϲ;ƱϋƄ˥ʔƢ。|Л 与 ʩ ̻按ƖʐƐ,旧 ʩ ʓ按 ʩ 价结算。工作日̾dz 09–12、14–18 为峰Ƶ,ɚ及ư。改价˥ʔƢ,已Ǧƭʍ;修正旧ƅ请ɤ后Ȉƽ重算。Əʏ按ǣ价。|ʣƁǍ适用Ƅ。手工˧会ə此条ʔ预定调价,已ω的ƽƄ仍ʍ。|ǻ(未ǢƉ时Ϗ)|新Ɖ ID(如 Ⱦ)|ɣƉ|ǔ与Ʊ|Nj中…|ƗNjƲ:{ƣ}|已ƗNj {ƙ}|ǩ˒后ƗNj|ɤ用Ɩ˟ƄʠƄ表?|͊|ə|从Ɩ˟ƱƄ|ƖƱ只Ǵ Ɔ Ƅ(含DZ);z-ai/Μ/Ͳ/Ʌ 等第三方Ƅ随ϩǴ,ʒƄ表ɝϔ˙˧,或用Ɖ名ǢϺ。|ɤȱȊƽ?|Ɂƽ|ɤʖ?将ύȊƇˠ,只补Ǩϳ的Ȭ与Ƈ,不˞已有Ǧ。|ɁƽƲ:{ƣ}|首次启动Ɨʖ旧Ǧ;拷入ˠ̈́重跑。按ǍƄ回推;已̽ˠ无法ύ,跨ɜ͑的Ƈˑ此前Ƭ。|ɤȱ|ȱȊƽ|ϢƱ:{ƙ}|从未(ȈʎƄ)|;ȯ:{Ǡ}|Ɩ˟|ʎǪ|ϬϹ|Ͽ ʾ(Ɨ)|简体̸|ɶ|ƅ|{ʃ} ƢƲ|ƱƢƲ|ƃƕƢƲ'],["en",`ɇ of Ȧ Ƌ (ȅ ˊ А c˹ ƙ)|Ɋ {Ɯ} · ǿ {ƪ} · Ȟ {Ƥ}|ǿ: ̭ {̭} · ̶ {̶} (̶s ȅ at Ɲ hit ǁ)|ɇ {Ƃ}|ɺ Ƌ {Ƃ} · Hit {ʂ} · Ɋ {Ɯ} · ǿ {ƪ} · Ȟ {Ƥ}|ɺ Ƌ {Ƃ}|ɍ Ƃ ȿ|UnΑed|Θ ɰs ̆ ΍ Ɣ × {ʅ}. To Мpʮ ƍ Θ bills, δ Θ, Ɲn ζ Ɣ; ζing affects ȿ new ƺ.|Ʃ Γ Ǟ: {ƣ}|˪ error|Ʃ|Ɔ Ǝ|ɍ Ǝ Ǡ (Ɔ)|Above Ɲ Ɯ ͸|Ǻ ƹ ƫ|Ǻ ƹ Ɯ ͸|Ƹ ƹ Ɯ ͸|К locations|Query Ǟ|Ɔ Ч-plat˼m ǐ Ǝ|Cross-check ƍ Ǝ ˉs against Ɲ Ș (warn ̴ Ɲy diverge)|Total {Ƃ}|ͬ {ʁ} · ˸ {ɗ}|ɻ {ƙ}|Ǜ ({ǒ})|ʹ {ʊ} / {Ƃ}|ȸ {Ƃ} · {ί} of LJ|ɺ Ȃ {Ȃ} · К ƙ {ɰ}|Ǜ|ȸ's ƻ (ȅ ˊ ƍ Ɣ)|ȸ's ʼ ǂ|ƛ|C˹s {ƺ} · Ɋ {Ɯ} · ǿ {ƪ} · Ȟ {Ƥ}|ɺ Ȃ {Ƃ}|К ƙ {Ƃ}|ȸ|Ǻ ˳ Ɠ|ɇ|ơ ǂ|ȸ|ɺ Ȃ|К ƙ|ɵ ̬|No ǟ И. Once you Ε chatting, ƻs ʮ ˈ ͽ Ш Ѝ.|Date|C˹s|In Ж|ǿ Ж|Out Ж|ɇ|No Ƌs ̮ ˳.|ɹ|Ʈ LJ|Ǜ Ƃ (in Ɠ Lj)|Ǜ ǒ|Start ɿ|End ɿ (ȁ = ˳)|Range: {̬}|Ʈ a LJ to see Ф Α, ʊ Ƃ ƹ ˍ in Ɲ Ɠ Lj. Κ ˳, Ȃ, ˹ ƙ or a ɐ ̬.|{ǒ} LJ {Ƃ} · ʹ {ʊ} · {ί}%| (over Α)| (near Α)|Legacy|ͨ f˹С|˅|Base|ȓ|ʪ|Ʃ Ǿ ΀|ɺ Open Plat˼m ΀ ɕ; 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 ˼ ΍.|ǹ ΁|ɶ ΁|ͳ URL|Supΰs ̛, Ȼ ͭ ƹ /΄/… paths Е ̦ Ɲ Ȗ ʾ ΰ.|Кow non-loopС ͭ (plaintext Ʀs; ̯ Ɲ exact ʶ:ΰ in ˹owed ʶs)|+ Ǒ ǝ|The Ǒ preset ˲ ȥ ǝ 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 (ɷ)|ɵ Ǝ Ɠ|Ư (Ǽ)|̟ Lj|Convert ΍ Ǝ to Ɠ Lj|Uses Ɲ Ɠ ʅ ƹ ̀. Ј Ɲ Ǡ Lj; oƝr currencies ƹ ǝ ɓ.|Ʃ {Ƃ}|ȸ {Ƃ}|Spent {Ƃ}|Ʃ ̪ Ѕ (blue=Ǝ, o̬=˳, gray=spent)|Лgress Ѕ ˻|Each group of Ѕs Т independently choose Ф fill ˻: "Ƞ" Εs ̧ ƹ drains ˏ ǂ; "ʹ" Εs ȁ ƹ fills up.|Ʃ Ѕs (ƍ/ɐ)|Ǜ Ѕ|Go ƈ Ѕ|ƒ / Ǘ ƈ Ѕs|Ƞ (̧ → ȁ)|ʹ (ȁ → ̧)|Ǜ cap (Ǚ)|Leave ȁ to ̆ Ǿ max_LJ; 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 ƈ Ɠ NJ|Go ƈ Ʒ lj (Ǽ)|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.̤.М/ǂ)|ͥ (Ǘ) ƈ|Ǘ ƈ is disabled · ̣ to ̥|5h ƈ|ˇ ƈ|γ {ƙ}|ɪ ʽ. Ʈ ƹ sign in to Ɲ δed Ǡ; ̣ to retry.|ɍ Ǘ ƈ (̯ a ̃ Ǘ plugin)|ɍ Ǘ ƈ in DŽ|ɍ Ǘ ƈ ɫ ʱ|ͯ ̅ in Ƌ ƻ|No ƈ ʲ|Ȓ NJ|Κ Ɲ DŽ, ƫ, Ɲ ʮa ɫ Ɲ Ɯ ͸, or a Мbination. Individual ˾ Ȥ ɔ ǻs.|Ǿ ΀ (Ǚ; ȁ = ʯ)|Ư (Ǽ)|Ǐ|Login|Signing in…|Ȕ|ІЛxyǾ ͼ ƈs|Є Ǡ|̟ label|̗|Ȓ|Ư (Ǽ)|˂ ˹owlist (ʶ:ΰ, Ƚ)|˃ ΀ (̶-ȿ)|Status|Unsupΰed ́|˪|No ǐs|fetched {ƙ}|Switch ǐ (Ȗ: {ǐ})|Λ ƈ ȿ|Ǐ|Ʈ Ȧ item ΐ|Ʈ ƹ Щ a Ɠ NJ to Ʒ|˅|Ʈd items move to Ɲ top; ̣ a ΁ to expƹ Ф own ƫ. Up to 8 ɐ Ǝs ƹ 4 ͼ Ǡs.|Disabled. Ʈ it to Γ Ȧ vendor's Ⱥ ƈ on Ɲ Ʒ lj ƹ Д it ͽ.|Ʈ Ƒ rolling 5h, weekly ƹ Ȃly ƈs in Ɲ DŽ, Ƹ ƹ ɼ Φ. Missing Țs Д a α.|ɳ (Ў) Ɠ|ɍ Ƒ ƈ / LJ at Ɲ ɼ|Rolling-5h ƈ|ˇ ƈ|Ʉ ƈ|Ǜ ʊ %|5h|Wk|Mo|Daily|Ǜ|Ν ̭ Ǟ: {ƣ}|Reading ȣ…|Ν ʽ|Љ Ǟ: {ƣ}|˩ cleʮd.|Clear Ǟ: {ƣ}|ʪ/ƌ Ɇ is off; base Ɣ ʮ ʊ|О И ɬ (ɬ at {ƙ}); base Ɣ ʮ Ȗly ʊ|ʪ hour Г; ɀ Ɣ ʭ|Ɔ ɀ-hour Ɇ is Τ; Ȗ ƺ ʮ ȅ at ɀ Ɣ|ȓ Г; ƌ Ɣ ʭ|˫ — ˹ ƌ (Sat & Sun ȅ at ƌ Ɣ ˹ Ѝ)|˫ — ˹ ƌ|˫|ǹ 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|Ɉ ɀ|Ɉ ƌ|Both|Ɉ ɀ ˋ|Ɉ ƌ ˋ|ͤ switches to {phase} Ɇ in about {ƙ}; mind Й c˹ ƻs in Ȧ ̵.|ɀ|ƌ|Got it|ʪ Ύ|ȓ Ύ|Popup NJ|ɳ|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 & Lj|Ǻ Ɠ|Simplify Ɲ DŽ|Condense Υs but Х Ƃs, ƈs ƹ hover ƶ. Height is capped at 38% of Ɲ viewΰ ˏ scrolling. Turn off ɖ.|A lighter DŽ|Simple Ɠ Бs more room ˼ ɾs. Ʈ it Г? You Т ˉ it in Ƹ → ɇ → Ȓ anyƙ.|Ʈ simple Ɠ|Ј Ȗ Ɠ|Ƹ could ΂ be Δ. Retry or dismiss Ȧ guide ƹ ˉ Ɲm later in Ƹ.|Dismiss guide|ȸ / {ǒ} LJ|Ǻ ̪ style|Stƹard|ͦ (2 columns)|Re̲ ʇ ǘs ({˭})|˅ Ќs Ɲ ̩ ƹ hides Ɲ row 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 NJ|Model rows (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 (ˈ ʀ ̰ ljs)|Daily|ˇ|Ʉ|О ɑ: Ʒ succesşy twice ˏ a ƈ ˍ ˉ.|{ɿ}: ʵ est. ≈ {̧} (Ш 1% ≈ {Ш1}) · ̡ {ƛ} / {ƻ} · {ljs} ̰ lj(s)|͢ ʮ catalog-ǁ Ώalents. ƒs ̆ ƈ; LJs ˭ Ǿ ȿ. Estimates cover dsh ƺ, while server ʹ cover Ɲ ǐ. Short ̰s ʮ less precise. 5h rolls; week/Ȃ ̆ Ȼ ɿs.|ͤ class|ƒ Ț|Н|Ǿ ǂ|ɍ Χly in ɇ ƫ|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 priority. ʿ ͵ ȿ Ɲ 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 ơ ƒ|ȡ|Reads ȡ ǝ Ȁ.|ͪ (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 ͷ ƫ.|ɪ pool|Stƹard + Core|Organization ID (Ǚ)|ƒ ǝ|Compensation|Ʃ|ɪ Ǡ|΋ ʴ|ɋ І|Bailian І|Inst˹ @ɮ/ʻ on Ɲ ʾ ʶ ƹ run ΅ Ȅ as Ɲ ʉ.|Inst˹ ʰ on Ɲ ʾ ʶ. Login Чs Е ʶ’s ȕ; ˼ a remote or headless ʶ, run bl Ȅ --ɽ as Ɲ ʉ.|Ʉ ǝ ƈ (Шsonal Lite 50K / Stƹard 500K; see Й ˿ ˽)|ƒ Ε ɿ (Ǚ, ȃ; ȁ = ̢ Ȃ)|ǎ ʅ Ȥ (Ǚ; ǝ deducted Ш 1M ƛ; ȁ = ɏ)|Model ΁, e.g. qwen3.8-ʸ|ʅ|Ɋ|ǿd Ɯ|Ȟ|Ί ˹ three positive ǭ to Щ Ȁ; Ќ ˹ ɖ Ɲ ɏ.|Є|΋ ǎ ʴ; ɽ is authoritative. Counts ƒ ƺ assigned to Ͳ. Excludes pay-as-you-go Ǿ. Є ǭ ˼ oƝr ǘs.|Ʉ ǝ ƈ ˼ Ȼ ɭ (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 ɿ row to expƹ Ф Ƌ ƶ|Ͱ Ƌ ƶ…|No Ƌ ƶ ˼ Ȧ Ѝ (early ʲ or Ƌ Ϋ cleaned)|ɉ Ƌ ƶ|By Ƌ (˹ ǟ)|Days Мbined; ̅ ̦ ƫ. Selected rows Дn; cumulative ƻs Ϳ every ɾ.|No Ƌ ʲ И|Ͱ Ƌ ˱…|ɉ Ƌ ˱|Rows|ɍ Ƌ IDs in Ƌ lists|ͯ ˿ ɰs|Ћ on, every Ƃ Дs ɰ Ώalent ƻ Ȣ ˿ Țs; off (ǻ) ˭s real-money Ǿ ͺs ȿ|ͮ ƍ ǐ Ǝ (Ǝ UI ʇ ʀ DŽ ƹ ƫ)|ͮ ˳'s ƻ (˳'s Ƃ ʇ ʀ DŽ, LJ ƶ ƹ overview Υ)|ͮ header ƻ ƶ|ͮ ʱ ƻ ƶ|ͮ turn ƻ summaries|Sort|ɇ high→Ы|ɇ Ы→high|Time new→Ц|Time Ц→new|Π order|˩|ơ ǂ Ζ|К-ƙ {ƛ} ƛ · Ɯ {Ɯ} · ƪ {ƪ} · Ƥ {Ƥ} · {ƺ} ƺ|{ɿ}: {ƛ} ƛ (Ɯ {Ɯ} · ƪ {ƪ} · Ƥ {Ƥ}) · {ƺ} ƺ · {ƻ}|No ǟ И — daily ǂ З accumulate ͽ|̠|ơ ǂ Ζ NJ|ɇ ƫ|ͫ ƫ|Own section (̠)|Ȓ ƫ|Overview|ɪs|̠|Pricing|Ȓ|˩ ʲ|ɹ ƻ Ɠ NJ|BeЫ Ɲ ʱ|ɹ title Ѕ|Off|ɪ ɔ ɫ Ɲ Ɯ|Ʈ Ɲ ƈ ɔ by ǻ (individual ˾ ɕ)|Ǭ LJ ʊ %|Ǭ Ɲ Go ƈ|Ǭ Ⱥ ƈs|Hover a У ˼ reset ƙs ƹ Ɲ last Ʒ; Ɲ ɔ hides Фelf ̴ Ɲre is no ƈ ʲ.|New: ƈ ɔ ɫ Ɲ Ɯ|ɍ LJ ƹ Ƒ/coding-˿ ʹ ɫ Ɲ Ɯ ͸. Ʈ Г? Ι it anyƙ in Ƹ → Ȓ.|Ʈ Ɲ ɔ|О Г|Ή to Ʒ Г|New: ̣ Ɲ Ǝ ͸ to Ʒ|Ή a DŽ Ǝ or ˿ ͸ to Ʒ. It pulses while loading; on failure it Хs Ɲ Ц Η ƹ Дs Ɲ α on hover.|Got it|ȸ ƻ Ɠ|Ǻ footer|̙|ǹ Yuan (Θ)|US Dollar (΍)|Euro (EUR)|̙ symbol|Exˉ ʅ (1 ΍ = ? target Lj)|Decimal places|Ʃ Ɠ NJ|Main DŽ|Ƹ ˽|Both|Ʃ Ʒ lj (Ǽ)|Use Ɔ ɀ-hour Ɣ|Лminent ̨ during ɀ ˯ (DŽ LJ ͸, ˳'s ƻ; previewed in Ɲ Ƹ ɀ panel)|ɹ ƻ ̆s c˹-ƙ Ɣ, Ȣ ɀ ƹ ɒ ǭ. Ɋ, Ƥ, ƪ ˲ ƹ ̶s ʮ sepaʅ; Ȇ ƪ-̶ ƹ long-context ǭ ʭ.|ͱ ǁ ɯs|ɋ ǁ Lj|΍ (ɶ ƍ ˽)|Θ (ǹ ƍ ˽)|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 ǹ|ɶ|ɇ|{ʃ} c˹ Ǟ|Љ c˹ Ǟ|Ʃ Ʒ c˹ Ǟ`]].map(([e,t])=>{const o=t.replace(/[ƀ-߿]/g,n=>Qn[n.charCodeAt(0)-384]).split("|");return[e,Object.fromEntries(Hn.map((n,s)=>[n,o[s]]).filter(([,n])=>n!=="\0"))]}));function Pa(){return(typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language:"").toLowerCase().startsWith("zh")?"zh":"en"}function ze(e){const t=typeof e=="string"?e.toLowerCase().split(/[-_]/)[0]:"";return t==="zh"||t==="en"?t:null}function H(e){const t=typeof e=="string"?e:e?.locale;return t==="zh"||t==="en"?t:ze(e?.activeLocale)||Pa()}function z(e){const t=e==="zh"?Ee.zh:Ee.en;return(o,n)=>{let s=t[o]??Ee.en[o]??o;if(n)for(const l of Object.keys(n))s=s.split("{"+l+"}").join(String(n[l]));return s}}const Ye={day:"periodDay",month:"periodMonth",all:"periodAll",custom:"periodCustomRange"};function ee(e,t){throw new Error("dsh-cost-meter: 服务端数据非法 ("+e+": "+t+")")}function ue(e,t){return(e===null||typeof e!="object"||Array.isArray(e))&&ee(t,"object"),e}function V(e,t){return(typeof e!="number"||!Number.isFinite(e))&&ee(t,"number"),e}function te(e,t){return typeof e!="string"&&ee(t,"string"),e}const Ie=(e,t,o)=>typeof e=="string"&&t.includes(e)?e:o;function Ma(e,t=!1){return e===null||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([o,n])=>t?o.length>0&&["plan","api"].includes(n):["auto","plan","api"].includes(n)))}function Ne(e,t){return typeof e!="boolean"&&ee(t,"boolean"),e}const Ve=(e,t,o)=>Object.fromEntries(t.map(n=>[n,o(e[n])]));function Ta(e,t){const o={};if(e!==null&&typeof e=="object"&&!Array.isArray(e))for(const n of Object.keys(e)){const s=e[n];if(s===null||typeof s!="object"||Array.isArray(s))continue;const l=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0?r:0;o[n]={...Et(s),...Ve(s,["input","output","cacheRead","cacheWrite","reasoning","cost"],l),apiCost:s.apiCost===void 0?l(s.cost):l(s.apiCost)}}return o}const bt=["costCny","apiCostCny","costEur","apiCostEur"],Et=e=>Object.fromEntries(bt.filter(t=>Number.isFinite(e?.[t])).map(t=>[t,e[t]]));function Ra(e,t){ue(e,t);const o={...Et(e),reasoning:e.reasoning===void 0?0:V(e.reasoning,t+".reasoning"),apiCost:e.apiCost===void 0?void 0:V(e.apiCost,t+".apiCost"),byModel:Ta(e.byModel,t+".byModel"),byProviderModel:Ta(e.byProviderModel,t+".byProviderModel")};for(const n of["input","output","cacheRead","cacheWrite","calls","cost"])o[n]=V(e[n],t+"."+n);return o}function qn(e){return e==null?void 0:{source:te(e.source,"source"),requestId:te(e.requestId,"requestId"),attempt:V(e.attempt,"attempt"),complete:Ne(e.complete,"complete"),status:te(e.status,"status"),upstream:te(e.upstream,"upstream")}}function Ba(e){return(Array.isArray(e)?e:ee("rows","array")).map(t=>({provider:te(t.provider,"provider"),model:te(t.model,"model"),bucket:te(t.bucket,"bucket"),tokens:V(t.tokens,"tokens"),...t.requests===void 0?{}:{requests:V(t.requests,"requests")},rate:V(t.rate,"rate"),cost:V(t.cost,"cost"),priced:Ne(t.priced,"priced"),plan:Ne(t.plan,"plan")}))}function It(e,t){return{...Ra(e,t),id:te(e.id,t+".id"),provider:typeof e.provider=="string"?e.provider:"",model:typeof e.model=="string"?e.model:""}}function Se(e,t){const o={...Ra(e,t),date:te(e.date,t+".date"),sessions:[]};return e.sessions!==void 0&&(Array.isArray(e.sessions)||ee(t+".sessions","array"),o.sessions=e.sessions.map((n,s)=>It(n,t+".sessions["+s+"]"))),o}function jt(e,t,o=["cacheWrite","reasoning"]){const n={};for(const s of["cacheHit","cacheMiss","output"])n[s]=V(e[s],t+"."+s);for(const s of o)e[s]!==void 0&&(n[s]=V(e[s],t+"."+s));return n}function Ht(e,t){ue(e,t);const o={...jt(e,t),...gt(e)};for(const n of["offPeak","peak","legacyBase","longContext"])e[n]!==void 0&&(o[n]=jt(e[n],t+"."+n,["cacheWrite","reasoning","aboveInputTokens"]));e.cny!==void 0&&(o.cny=jt(e.cny,t+".cny")),e.legacy!==void 0&&(o.legacy=Ne(e.legacy,t+".legacy")),e.rateHistory!==void 0&&((!Array.isArray(e.rateHistory)||e.rateHistory.length>16)&&ee(t+".rateHistory","price history"),o.rateHistory=e.rateHistory.map((n,s)=>((!n||typeof n.before!="string"||!Number.isFinite(Date.parse(n.before)))&&ee(t+".rateHistory","dated price"),{...Ht({...n,rateHistory:void 0},t+".rateHistory."+s),before:n.before})));for(const n of["billingMode","sourceUrl","checkedAt","notes"])typeof e[n]=="string"&&(o[n]=e[n]);return o}function Un(e,t){const o=s=>s==null?void 0:{...["aliyun","tokenrhythm"].includes(s.adapter)?{adapter:s.adapter}:{},enabled:s.enabled===!0,label:typeof s.label=="string"?s.label:"",labelEn:typeof s.labelEn=="string"?s.labelEn:"",display:Ie(s.display,["sidebar","settings","off"],"both"),unit:s.adapter==="tokenrhythm"?"CNY":["CNY","EUR","CREDITS"].includes(s.unit)?s.unit:"USD",convertToDisplayCurrency:s.convertToDisplayCurrency===!0,allowInsecureHttp:s.allowInsecureHttp===!0,refreshMinutes:typeof s.refreshMinutes=="number"&&Number.isFinite(s.refreshMinutes)?s.refreshMinutes:15,request:s.request&&typeof s.request=="object"?s.request:{url:""},extract:s.extract&&typeof s.extract=="object"?s.extract:{},allowedHosts:Array.isArray(s?.allowedHosts)?s.allowedHosts.filter(l=>typeof l=="string"):[]};ue(e,t);const n={};if(e.prices!==null&&typeof e.prices=="object"&&e.prices.models!==null&&typeof e.prices.models=="object")for(const s of Object.keys(e.prices.models))n[s]=Ht(e.prices.models[s],t+".prices.models."+s);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,hideTodayCost:e.hideTodayCost===!0,sessionListCostPeriod:e.sessionListCostPeriod==="today"?"today":"total",modelStatistics:e.modelStatistics??{},...Ve(e,["hideSessionCostHeader","hideSessionCostDock","hideTurnCost","followSkinTransparency","sidebarTodayBalanceInline","sessionListCosts","hideBudget","sessionCostCompact","contextCostsEnabled","contextCostsPromptSeen","showTotalWithPlan","sidebarSimple","sidebarSimplePromptSeen","codexQuotaEnabled","codexCompatPromptDismissed","includeSubagentCost","peakEnabled","peakAlertWebNotify","peakProgressPromptSeen"],s=>s===!0),sidebarTodayMetric:["tokens","both"].includes(e.sidebarTodayMetric)?e.sidebarTodayMetric:"cost",...Object.hasOwn(e,"sidebarOrder")?{sidebarOrder:Array.isArray(e.sidebarOrder)?e.sidebarOrder:[]}:{},statisticsBasis:e.statisticsBasis,sidebarModels:Object.fromEntries(Object.entries(wn).map(([s,l])=>[s,e.sidebarModels?.[s]??l])),codexQuotaSidebar:e.codexQuotaSidebar!==!1,codexQuotaStrip:e.codexQuotaStrip!==!1,codexQuotaSource:["connect","subscription","chatgpt","pi-ai","chatgpt-sub"].includes(e.codexQuotaSource)?e.codexQuotaSource:"auto",codexCompatHistoryAppliedAt:me(e.codexCompatHistoryAppliedAt),sidebarStyle:Ie(e.sidebarStyle,["standard","compact","summary"],"standard"),...Object.hasOwn(e,"sidebarSummaryPromptSeen")?{sidebarSummaryPromptSeen:e.sidebarSummaryPromptSeen===!0}:{},billionContextNoticeEnabled:e.billionContextNoticeEnabled!==!1,billionContextNoticesSeen:Array.isArray(e.billionContextNoticesSeen)?e.billionContextNoticesSeen.filter(s=>typeof s=="string").slice(-32):[],priceMatchDismissed:Array.isArray(e.priceMatchDismissed)?e.priceMatchDismissed.filter(s=>typeof s=="string"):[],pricingCurrency:e.pricingCurrency==="CNY"?"CNY":"USD",currency:typeof e.currency=="string"?e.currency:"CNY",symbol:typeof e.symbol=="string"?e.symbol:"¥",decimals:V(e.decimals,t+".decimals"),exchangeRate:V(e.exchangeRate,t+".exchangeRate"),exchangeRateAuto:e.exchangeRateAuto!==!1,fxRates:e.fxRates,exchangeRateDate:e.exchangeRateDate??"",exchangeRateCheckedAt:e.exchangeRateCheckedAt??0,peakEffectiveAt:typeof e.peakEffectiveAt=="string"?e.peakEffectiveAt:"",peakWindows:Array.isArray(e.peakWindows)?e.peakWindows.map((s,l)=>({start:V(s.start,t+".peakWindows["+l+"].start"),end:V(s.end,t+".peakWindows["+l+"].end")})):[],peakHolidays:Array.isArray(e.peakHolidays)?e.peakHolidays.filter(s=>typeof s=="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",peakStyle:["classic","progress"].includes(e.peakStyle)?e.peakStyle:"compact",peakTimeDisplay:["countdown","switch"].includes(e.peakTimeDisplay)?e.peakTimeDisplay:"both",priceMatch:e.priceMatch==="exact"?"exact":"auto",priceOverrides:(()=>{const s={};if(e.priceOverrides!==null&&typeof e.priceOverrides=="object"&&!Array.isArray(e.priceOverrides))for(const[l,r]of Object.entries(e.priceOverrides))typeof l=="string"&&typeof r=="string"&&(s[l]=r);return s})(),priceTableDisplay:(()=>{const s={};if(e.priceTableDisplay!==null&&typeof e.priceTableDisplay=="object"&&!Array.isArray(e.priceTableDisplay))for(const[l,r]of Object.entries(e.priceTableDisplay))typeof l=="string"&&(s[l]=r===!0);return s})(),codingPlans:(()=>{const s={};if(e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans))for(const l of Object.keys(e.codingPlans)){const r=e.codingPlans[l];r===null||typeof r!="object"||Array.isArray(r)||(s[l]={enabled:r.enabled===!0,display:r.display==="sidebar"||r.display==="both"||r.display==="off"?r.display:"settings",...typeof r.showInComposer=="boolean"?{showInComposer:r.showInComposer}:{},refreshMinutes:typeof r.refreshMinutes=="number"&&Number.isFinite(r.refreshMinutes)?r.refreshMinutes:15,apiKey:typeof r.apiKey=="string"?r.apiKey:"",...l==="minimax"?{baseUrl:typeof r.baseUrl=="string"?r.baseUrl:""}:{},...l==="factory"?{orgId:typeof r.orgId=="string"?r.orgId:"",factoryPool:["core","both"].includes(r.factoryPool)?r.factoryPool:"standard"}:{},...l==="workbuddy"?{accountScope:r.accountScope??"current",accountIds:Array.isArray(r.accountIds)?r.accountIds:[],...typeof r.accountSource=="string"?{accountSource:r.accountSource}:{}}:{},...l==="opendesign"?{workspaceId:typeof r.workspaceId=="string"?r.workspaceId:""}:{},...l==="qwen"?{quotaSource:["cli","bailian"].includes(r.quotaSource)?r.quotaSource:"local"}:{},...typeof r.planCredits=="number"&&Number.isFinite(r.planCredits)&&r.planCredits>0?{planCredits:r.planCredits}:{},...typeof r.planStart=="string"?{planStart:r.planStart}:{},...r.rates!==null&&typeof r.rates=="object"&&!Array.isArray(r.rates)?{rates:r.rates}:{},...typeof r.accessKeyId=="string"?{accessKeyId:r.accessKeyId}:{},...typeof r.secretAccessKey=="string"?{secretAccessKey:r.secretAccessKey}:{}})}return s})(),prices:{models:n,...e.prices?.custom?{custom:e.prices.custom}:{},default:Ht(e.prices?.default??{cacheHit:0,cacheMiss:0,output:0},t+".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:V(e.historyDays,t+".historyDays"),billingStorageRetentionDays:[0,7,30].includes(e.billingStorageRetentionDays)?e.billingStorageRetentionDays:7,fetchedAt:e.fetchedAt===null||e.fetchedAt===void 0?null:te(e.fetchedAt,t+".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:Ie(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,showSource:e.balance?.showSource===!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,...typeof e.goQuota?.showInComposer=="boolean"?{showInComposer:e.goQuota.showInComposer}:{},display:Ie(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:o(e.customBalance),gatewayQuotas:(()=>{const s=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:e.gatewayQuotas?.sources;return{sources:Array.isArray(s)?s.slice(0,4).filter(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)).map(r=>({id:typeof r.id=="string"?r.id.slice(0,48):"",type:"cliproxyapi",label:typeof r.label=="string"?r.label.slice(0,80):"",baseURL:typeof r.baseURL=="string"?r.baseURL:"",enabled:r.enabled!==!1,display:Ie(r.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof r.refreshMinutes=="number"&&Number.isFinite(r.refreshMinutes)?Math.min(1440,Math.max(1,Math.floor(r.refreshMinutes))):15,includeProviders:Array.isArray(r.includeProviders)?[...new Set(r.includeProviders.filter(i=>typeof i=="string").map(i=>i.toLowerCase()).filter(i=>Ut.includes(i)))]:Ut,allowedHosts:Array.isArray(r.allowedHosts)?r.allowedHosts.filter(i=>typeof i=="string").slice(0,16):[],allowInsecureHttp:r.allowInsecureHttp===!0,antigravityOnlyGemini:r.antigravityOnlyGemini===!0,keyVar:typeof r.keyVar=="string"?r.keyVar:""})):[]}})(),customBalances:(()=>{if(Array.isArray(e.customBalances))return e.customBalances.filter(l=>l!==null&&typeof l=="object").slice(0,8).map(o).filter(Boolean);const s=o(e.customBalance);return s?[s]:[]})(),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 s=e.barDirections!==null&&typeof e.barDirections=="object"&&!Array.isArray(e.barDirections)?e.barDirections:{},l=(r,i)=>s[r]==="remaining"||s[r]==="used"?s[r]:i;return{balance:l("balance","remaining"),budget:l("budget","used"),go:l("go","used"),plan:l("plan","used")}})(),planBilling:{...Array.isArray(e.planBilling?.autoProviders)?{autoProviders:e.planBilling.autoProviders.filter(s=>Ue.includes(s))}:{},providers:Ma(e.planBilling?.providers),models:Ma(e.planBilling?.models,!0),modelPlans:Object.fromEntries(Object.entries(e.planBilling?.modelPlans??{}).filter(([s,l])=>s.includes(":")&&Ue.includes(l)))}}}const $e=e=>typeof e=="number"&&Number.isFinite(e)?e:null,me=e=>$e(e)??0,Fn={status:"off",message:"",fetchedAt:0,currency:"",totalBalance:0,grantedBalance:0,toppedUpBalance:0},_n={status:"off",message:"",fetchedAt:0,rolling:null,weekly:null,monthly:null},Oa=(e=null)=>({status:"off",message:"",fetchedAt:0,label:"",unit:"USD",remaining:0,maxBudget:null,spend:null,index:e});function Qt(e,t){return ue(e,t),{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 Wn(e,t){return{...Qt(e,t),keyConfigured:e.keyConfigured===!0,keySource:typeof e.keySource=="string"?e.keySource:"",currency:typeof e.currency=="string"?e.currency:"",totalBalance:me(e.totalBalance),grantedBalance:me(e.grantedBalance),toppedUpBalance:me(e.toppedUpBalance)}}function qt(e,t){return e==null?null:((typeof e!="object"||Array.isArray(e))&&ee(t,"object"),{percent:me(e.percent),resetsAt:typeof e.resetsAt=="string"?e.resetsAt:""})}function Gn(e,t){return{...Qt(e,t),rolling:qt(e.rolling,t+".rolling"),weekly:qt(e.weekly,t+".weekly"),monthly:qt(e.monthly,t+".monthly")}}function Da(e,t){return{...Qt(e,t),label:typeof e.label=="string"?e.label:"",unit:typeof e.unit=="string"?e.unit:"USD",remaining:me(e.remaining),maxBudget:$e(e.maxBudget),spend:$e(e.spend),index:typeof e.index=="number"&&Number.isFinite(e.index)&&e.index>=0?Math.floor(e.index):null}}const Kn=new Set(["ok","partial","unknown","error","stale","unsupported","capability_missing"]),zn=new Set(["off","loading","ok","partial","stale","error"]),Ut=["antigravity","claude","codex","kimi","xai","workbuddy"],La={antigravity:"Antigravity",claude:"Claude",codex:"Codex",kimi:"Kimi",xai:"xAI",workbuddy:"WorkBuddy"};function Yn(e,t){ue(e,t);const o=(r,i="")=>typeof r=="string"?r:i,n=r=>$e(r),s=r=>r!==null&&typeof r=="object"&&!Array.isArray(r)?{id:o(r.id),label:o(r.label),...n(r.percent)===null?{}:{percent:n(r.percent)},resetsAt:o(r.resetsAt),periodHours:n(r.periodHours),scope:o(r.scope)}:null,l=r=>r!==null&&typeof r=="object"&&!Array.isArray(r)?{unit:o(r.unit,"credits"),used:n(r.used),remaining:n(r.remaining),limit:n(r.limit),fetchedAt:o(r.fetchedAt),packages:Array.isArray(r.packages)?r.packages.filter(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)).map(i=>({id:o(i.id),label:o(i.label),used:n(i.used),remaining:n(i.remaining),limit:n(i.limit),startsAt:o(i.startsAt),resetsAt:o(i.resetsAt)})):[]}:void 0;return{id:o(e.id),type:"cliproxyapi",label:o(e.label),status:zn.has(e.status)?e.status:"error",message:o(e.message),fetchedAt:n(e.fetchedAt)??0,attemptedAt:n(e.attemptedAt)??0,serverVersion:o(e.serverVersion),keyConfigured:e.keyConfigured===!0,keySource:o(e.keySource,"none"),accounts:Array.isArray(e.accounts)?e.accounts.filter(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)).slice(0,16).map(r=>({id:o(r.id),provider:o(r.provider,"unknown"),label:o(r.label,"unknown"),status:Kn.has(r.status)?r.status:"unknown",message:o(r.message),plan:o(r.plan),windows:Array.isArray(r.windows)?r.windows.map(s).filter(Boolean):[],credits:l(r.credits)})):[],unsupportedProviders:Array.isArray(e.unsupportedProviders)?e.unsupportedProviders.filter(r=>typeof r=="string").slice(0,32):[]}}function Vn(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;const t={};if(e.providers!==null&&typeof e.providers=="object"&&!Array.isArray(e.providers))for(const[o,n]of Object.entries(e.providers)){if(n===null||typeof n!="object"||Array.isArray(n))continue;const s={},l={};if(n.windows!==null&&typeof n.windows=="object"&&!Array.isArray(n.windows))for(const[r,i]of Object.entries(n.windows))i===null||typeof i!="object"||Array.isArray(i)||(s[r]={...Ve(i,["percent","localTokens","localCost","sampleCount"],me),...Ve(i,["sampleAt","per1Tokens","per1Cost","fullTokens","fullCost"],$e),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(n.intervals!==null&&typeof n.intervals=="object"&&!Array.isArray(n.intervals))for(const[r,i]of Object.entries(n.intervals))Array.isArray(i)&&(l[r]=i.filter(d=>d!==null&&typeof d=="object"&&!Array.isArray(d)).map(d=>Ve(d,["t0","t1","tokens","cost","pct","per1Tokens","per1Cost"],me)));t[o]={windows:s,intervals:l}}return{generatedAt:me(e.generatedAt),providers:t}}function $n(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=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:Ie(e.detection,["package","profile","none"],"none"),planClass:Ie(e.planClass,["auto","plan","api"],"auto"),usage:{calls:me(t.calls),cost:me(t.cost),tokens:me(t.tokens),days:me(t.days),providers:(Array.isArray(t.providers)?t.providers:[]).filter(o=>typeof o=="string")},historyAppliedAt:me(e.historyAppliedAt),promptDismissed:e.promptDismissed===!0,promptDue:e.promptDue===!0}}function Ea(e,t){return ue(e,t),{today:Se(e.today,t+".today"),month:Se(e.month,t+".month"),total:Se(e.total,t+".total"),budgetUsed:typeof e.budgetUsed=="number"&&Number.isFinite(e.budgetUsed)?e.budgetUsed:void 0,balance:e.balance==null?Fn:Wn(e.balance,t+".balance"),goQuota:e.goQuota==null?_n:Gn(e.goQuota,t+".goQuota"),customBalance:e.customBalance==null?Oa():Da(e.customBalance,t+".customBalance"),customBalances:Array.isArray(e.customBalances)?e.customBalances.filter(o=>o!==null&&typeof o=="object").map((o,n)=>Da(o,t+".customBalances["+n+"]")):[],gatewayQuotas:Array.isArray(e.gatewayQuotas)?e.gatewayQuotas.filter(o=>o!==null&&typeof o=="object"&&!Array.isArray(o)).map((o,n)=>Yn(o,t+".gatewayQuotas["+n+"]")):[],customVarStatus:e.customVarStatus!==null&&typeof e.customVarStatus=="object"&&!Array.isArray(e.customVarStatus)?Object.fromEntries(Object.entries(e.customVarStatus).filter(([,o])=>o!==null&&typeof o=="object").map(([o,n])=>[o,{configured:n.configured===!0,source:typeof n.source=="string"?n.source:""}])):{},codingPlans:e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans)?e.codingPlans:{},planStats:Vn(e.planStats),codexCompat:$n(e.codexCompat),ourFreeModel:e.ourFreeModel?.enabled===!0?{enabled:!0,version:typeof e.ourFreeModel.version=="string"?e.ourFreeModel.version:""}:void 0,history:Array.isArray(e.history)?e.history.map((o,n)=>Se(o,t+".history["+n+"]")):[],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,unresolved:Number(e.billionContext.unresolved)||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(o=>({source:String(o.source),today:Se(o.today,t+".external.today"),month:Se(o.month,t+".external.month"),total:Se(o.total,t+".external.total"),history:(o.history??[]).map(n=>Se(n,t+".external.history"))})),combined:Object.fromEntries(["today","month","total","history"].map(o=>[o,o==="history"?(e.externalUsage.combined.history??[]).map(n=>Se(n,t+".external.history")):Se(e.externalUsage.combined[o],t+".external."+o)]))}:null,config:Un(e.config,t+".config"),pricesRev:typeof e.pricesRev=="string"?e.pricesRev:void 0,modelLabels:Object.fromEntries(Object.entries(e.modelLabels??{}).filter(([,o])=>typeof o=="string")),modelDirectory:e.modelDirectory,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(o=>typeof o=="string"):[],meta:{...ze(e.meta?.locale)?{locale:ze(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:"",...typeof e.meta?.defaultProvider=="string"?{defaultProvider:e.meta.defaultProvider}:{},dayKey:typeof e.meta?.dayKey=="string"?e.meta.dayKey:"",monthKey:typeof e.meta?.monthKey=="string"?e.meta.monthKey:""}}}function Jn(e,t){ue(e,t);const o={ok:e.ok===!0,message:typeof e.message=="string"?e.message:""};return e.state!==void 0&&e.state!==null&&(o.state=Ea(e.state,t+".state")),o}function Z(e){return{parse:e}}const Je=Z(Ea),Zn=Z(e=>ue(e,"patch")),Xn=Z(Jn),Ft=Z(e=>te(e,"provider")),eo=Z(e=>{if(e!=null)return(typeof e!="number"||!Number.isInteger(e)||e<0||e>7)&&ee("index","0-7 integer"),e}),to=Z(e=>te(e,"date")),ao=Z(e=>ue(e,"day")),no=Z(e=>(Number.isFinite(Number(e))||ee("limit","number"),Number(e))),Ia=Z(e=>te(e,"sort")),oo=Z(e=>ue(e,"topSessions")),ja=Z(e=>te(e,"target")),so=Z(e=>te(e,"value")),he=(e,t)=>({mode:"strict",typeSymbol:"dsh-cost-meter#"+e,schema:t,create:()=>t}),se=(e,t,o,n=!1)=>({name:e,wire:e,source:"json",codec:he(t,o),...n?{acceptsUndefined:!0}:{}}),Ha=Z(e=>{ue(e,"billing storage options"),(Object.keys(e).some(o=>!["retentionDays","apply","streams","groups"].includes(o))||![0,7,30].includes(e.retentionDays))&&ee("billing storage options","retentionDays 0/7/30");const t={retentionDays:e.retentionDays};for(const o of["apply","streams","groups"])e[o]!==void 0&&typeof e[o]!="boolean"&&ee(o,"boolean"),t[o]=e[o]??o!=="apply";return t}),lo={package:"dsh-cost-meter",descriptors:[{method:"getStateSince",parameters:[se("pricesRev","PricesRev",Z(e=>(typeof e!="string"&&ee("pricesRev","price table revision"),e)))],result:he("CostState",Je)},...["getState","getLocalState"].map(e=>({method:e,result:he("CostState",Je)})),{method:"billingStorage",parameters:[se("options","BillingStorageOptions",Ha)],result:he("BillingStorage",Z(e=>{ue(e,"billing storage");const t={};for(const o of["retentionDays","scannedAt","sessions","reclaimableBytes","archivedStreams","removedFiles","releasedBytes","archiveBytes","skipped"])t[o]=V(e[o],o);for(const o of["applied","limited"])typeof e[o]!="boolean"&&ee(o,"boolean"),t[o]=e[o];for(const o of["streams","groups","archives"]){const n=ue(e[o],o),s={};for(const l of["files","bytes","eligibleFiles","eligibleBytes"])s[l]=V(n[l],o+"."+l);for(const l of["oldestAt","newestAt"])s[l]=n[l]===null?null:V(n[l],o+"."+l);t[o]=s}return t}))},{method:"updateConfig",parameters:[se("patch","ConfigPatch",Zn)],result:he("CostState",Je)},{method:"fetchPrices"},{method:"releasePriceLock",parameters:[se("id","PriceLockId",Z(e=>((typeof e!="string"||e.length===0)&&ee("id","OpenRouter model id"),e)))]},{method:"refreshBalance"},{method:"refreshGoQuota"},...["getPiAiCodexQuota","getChatgptSubQuota"].map(e=>({method:e,result:he("PiAiCodexQuota",Z(t=>{ue(t,"pi-ai quota"),["off","ok","error"].includes(t.status)||ee("pi-ai quota status","off/ok/error");const o={},n=ue(t.windows,"pi-ai windows");for(const s of["five","weekly"])if(n[s]!==void 0){const l=V(n[s].percent,s);(l<0||l>100)&&ee(s,"0-100 percent"),o[s]={percent:l,resetsAt:te(n[s].resetsAt,"resetsAt")}}return{status:t.status,windows:o,message:te(t.message,"message")}}))})),{method:"refreshCustomBalance",parameters:[se("index","CustomBalanceIndex",eo,!0)]},{method:"refreshCodingPlan",parameters:[se("provider","CodingPlanProvider",Ft)]},{method:"loginCodingPlan",parameters:[se("provider","CodingPlanProvider",Ft)]},{method:"refreshGatewayQuota",parameters:[se("sourceId","GatewayQuotaSourceId",Z(e=>{if(e!=null)return(typeof e!="string"||e.length>48||!/^[a-z0-9][a-z0-9_-]*$/.test(e))&&ee("sourceId","gateway source id"),e}),!0)]},{method:"resetHistory",result:he("CostState",Je)},{method:"importLegacyHistory"},{method:"getDaySessions",parameters:[se("date","DayKey",to)],result:he("DayRecord",ao)},{method:"getSessionCost",parameters:[se("sessionId","SessionId",Ft)],result:he("SessionCost",Z(e=>({own:It(e.own,"own"),subagents:It(e.subagents,"subagents"),found:Ne(e.found,"found"),subagentCount:V(e.subagentCount,"subagentCount")})))},{id:"dsh-cost-meter#costMeter/getTurnCost",service:"costMeter",namespace:"costMeter",method:"getTurnCost",invocation:{kind:"direct"},parameters:[se("sessionId","SessionId",Z(e=>te(e,"sessionId"))),...["startSeq","endSeq"].map(e=>se(e,"TurnSeq",Z(t=>((!Number.isSafeInteger(t)||t<0)&&ee(e,"nonnegative integer"),t)))),{...se("displayCurrency","DisplayCurrency",Z(e=>(e!==void 0&&!["USD","CNY","EUR"].includes(e)&&ee("displayCurrency","currency"),e))),acceptsUndefined:!0}],result:he("TurnCost",Z(e=>({...Et(e),found:Ne(e.found,"found"),...e.inherited===void 0?{}:{inherited:Ne(e.inherited,"inherited")},cost:V(e.cost,"cost"),apiCost:V(e.apiCost,"apiCost"),rows:Ba(e.rows),calls:(Array.isArray(e.calls)?e.calls:ee("calls","array")).map(t=>({kind:te(t.kind,"kind"),provider:te(t.provider,"provider"),model:te(t.model,"model"),atMs:V(t.atMs,"atMs"),cost:V(t.cost,"cost"),apiCost:V(t.apiCost,"apiCost"),plan:Ne(t.plan,"plan"),priced:Ne(t.priced,"priced"),longContext:Ne(t.longContext,"longContext"),rows:Ba(t.rows),...t.metering?{metering:qn(t.metering)}:{}}))})))},{method:"getTopSessions",parameters:[se("limit","SessionLimit",no),se("sort","SessionSort",Ia,!0),se("dir","SessionSortDir",Ia,!0)],result:he("TopSessions",oo)},{method:"setCredential",parameters:[se("target","CredentialTarget",ja),se("value","CredentialValue",so)]},{method:"clearCredential",parameters:[se("target","CredentialTarget",ja)]},...["applyCodexCompatHistory","dismissCodexCompat"].map(e=>({method:e,result:he("CostState",Je)}))].map(e=>({id:"dsh-cost-meter#costMeter/"+e.method,service:"costMeter",namespace:"costMeter",invocation:{kind:"direct"},parameters:[],result:he("FetchPricesResult",Xn),...e}))};function ro(e,t){const o=t?.models??{};return typeof e=="string"&&e.length>0&&o[e]!==void 0?o[e]:t?.default??{cacheHit:0,cacheMiss:0,output:0}}function gt(e){return Object.fromEntries(["multiplier","separateMultipliers","multipliers"].filter(t=>e?.[t]!==void 0).map(t=>[t,e[t]]))}function yt(e,t){return(e.separateMultipliers?e.multipliers?.[t]:void 0)??e.multiplier??1}function Qa(e,t,o="base"){const n={};for(const s of["cacheHit","cacheMiss","cacheWrite","output","reasoning"])e[s]!==void 0&&(n[s]=e[s]*yt(t,o+"."+s));return e.longContext&&(n.longContext={...Qa(e.longContext,t,"longContext"),aboveInputTokens:e.longContext.aboveInputTokens}),n}function io(e){const t=gt(e);return t.multipliers&&(t.multipliers=Object.fromEntries(Object.entries(t.multipliers).filter(([o])=>o.startsWith("cny.")).map(([o,n])=>[o.replace("cny.","base."),n]))),{...e.cny,...t}}function Qe(e){if(e===null||typeof e!="object")return;const t=r=>{const i=e[r];return typeof i=="number"&&Number.isFinite(i)&&i>=0?i:void 0},o=t("cacheMiss")??t("input")??0,s={cacheHit:t("cacheHit")??t("cachedInput")??t("cacheRead")??o,cacheMiss:o,output:t("output")??0},l=t("reasoning");return l!==void 0&&(s.reasoning=l),t("cacheWrite")!==void 0&&(s.cacheWrite=t("cacheWrite")),s}function co(e){const t=Qe(e);if(t===void 0)return null;Object.assign(t,gt(e)),e.billingMode==="utc-peak"&&(t.billingMode="utc-peak"),e.peakSchedule==="volcengine"&&(t.peakSchedule="volcengine");for(const o of["offPeak","peak","legacyBase"]){const n=Qe(e[o]);n!==void 0&&(t[o]=n)}return Number.isFinite(e.longContext?.aboveInputTokens)&&e.longContext.aboveInputTokens>0&&(t.longContext={...Qe(e.longContext),aboveInputTokens:e.longContext.aboveInputTokens}),Array.isArray(e.rateHistory)&&(t.rateHistory=e.rateHistory.slice(0,16).map(o=>{const n={...Qe(o),before:o.before};for(const s of["offPeak","peak"]){const l=Qe(o[s]);l!==void 0&&(n[s]=l)}return n})),t}function Ze(e,t=Date.now()){if(!e||!Number.isFinite(t)||!Array.isArray(e.rateHistory))return e;let o=null,n=1/0;for(const r of e.rateHistory){const i=Date.parse(r.before);t<i&&i<n&&(o=r,n=i)}if(!o)return e;const{before:s,...l}=o;return{...e,...l}}const _t=Date.parse("2026-08-22T16:00:00Z");function qa(e){if(!Number.isFinite(e)||e<_t)return null;const t=Math.floor((e+8*36e5)/864e5),o=(t+4)%7;if(o!==6&&o!==0)return null;const n=o===6?t:t-1;return{start:Math.max(n*864e5-8*36e5,_t),end:(n+2)*864e5-8*36e5}}function Ua(e,t){if(!Number.isFinite(e)||e<_t||!Array.isArray(t))return null;const o=Math.floor((e+8*36e5)/864e5);return t.includes(new Date(o*864e5).toISOString().slice(0,10))?{start:o*864e5-8*36e5,end:(o+1)*864e5-8*36e5}:null}const uo=(e,t)=>Ua(e,t)??qa(e);function ht(e,t,o,n){if(!Array.isArray(o)||o.length===0||uo(e,n)!==null||Number.isFinite(t)&&e<t)return!1;const s=new Date(e).getUTCHours();return o.some(l=>{const r=Number(l.start),i=Number(l.end);return!Number.isFinite(r)||!Number.isFinite(i)?!1:r<i?s>=r&&s<i:s>=r||s<i})}const po=Date.parse("2026-08-16T16:00:00Z"),mo=17881344e5;function Fa(e,t,o){const n=Ze(e,t)??{cacheHit:0,cacheMiss:0,output:0},s=(i,d="base")=>({reasoning:0,...Qa(i,n,d)}),l=n.peakSchedule==="ollama";if(l||n.billingMode==="utc-peak"){if(o?.enabled!==!0||!Number.isFinite(t)||l&&t<mo)return s(n);const i=new Date(t),d=i.getUTCDay(),c=i.getUTCHours(),u=d>0&&d<6&&(l?c>=12&&c<18:c>=1&&c<4||c>=6&&c<10);return s((u?n.peak:n.offPeak)??n,(u?n.peak:n.offPeak)?u?"peak":"offPeak":"base")}if(Number.isFinite(t)&&t<po){const i=n.legacyBase;return i===void 0?s(n):s(i,"legacyBase")}if(o?.enabled!==!0)return s(n);const r=typeof o.effectiveAtMs=="number"&&Number.isFinite(o.effectiveAtMs)?o.effectiveAtMs:void 0;if(ht(t,r,o.windows,n.peakSchedule==="volcengine"?[]:o.holidays)){const i=n.peak;return i===void 0?s(n):s(i,"peak")}if(r!==void 0&&t>=r){const i=n.offPeak;return i===void 0?s(n):s(i,"offPeak")}return s(n)}function _a(e,t){const o=Math.max(0,Number(e.input)||0),n=Math.max(0,Number(e.output)||0),s=Math.max(0,Number(e.cacheRead)||0),l=Math.max(0,Number(e.cacheWrite)||0),r=Math.max(0,Number(e.reasoning)||0);return t.longContext&&o+s+l>t.longContext.aboveInputTokens&&(t=t.longContext),(o*t.cacheMiss+n*t.output+s*t.cacheHit+l*(t.cacheWrite??t.cacheHit)+r*(t.reasoning??0))/1e6}function Wa(e,t,o){const n=Number(e);if(!Number.isFinite(n)||n<0||n===0)return 0;if(t!=="CNY")return n;const s=Number(o);return!Number.isFinite(s)||s<=0?n:n/s}function ie(e,t){const o=e?.barDirections,n=t==="balance"?"remaining":"used";if(o===null||typeof o!="object"||Array.isArray(o))return n;const s=o[t];return s==="remaining"||s==="used"?s:n}function we(e,t){if(e==null||!Number.isFinite(Number(e)))return{width:0,label:null};const o=Math.max(0,Math.min(100,Number(e))),n=t==="remaining"?Math.round((100-o)*10)/10:Math.round(o*10)/10;return{width:n,label:n}}const Ga=(e,t)=>e.toFixed(t).replace(/(\.\d*?[1-9])0+$|\.0+$/,"$1");function de(e,t){const o=typeof t?.symbol=="string"&&t.symbol.length>0?t.symbol:"$",n=Number(t?.decimals),s=Math.max(0,Math.min(10,Number.isFinite(n)?Math.floor(n):2));let l=s;return e>0&&e<Math.pow(10,-s)&&(l=s+2),o+Ga(e,l)}function W(e,t){const o=Number(t?.exchangeRate),n=e*(Number.isFinite(o)&&o>0?o:1);return de(n,t)}function L(e){const t=Math.max(0,Number(e)||0),o=n=>n>=100?String(Math.round(n)):String(Math.round(n*10)/10);return t<1e3?String(Math.round(t)):t>=999500?o(t/1e6)+"M":t<1e6?o(t/1e3)+"K":o(t/1e6)+"M"}function Wt(e){return String(e??"").normalize("NFKC").toLowerCase().replace(/[((]\s*(?:go|zen)\s*[))]/g," ").trim()}function Ce(e){return Wt(e).replace(/[^\p{L}\p{N}]+/gu,"")}function fo(e,t=!0,o=!0){const n=Wt(e);return t&&/[-_./:@](?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/.test(n)?n.slice(0,-5):t&&o&&/[-_./:@]\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/.test(n)?n.slice(0,-7):n.replace(/[-_./:@](?:\d{4}-?\d{2}-?\d{2}|v\d+(?:\.\d+)*|\d+k|latest)$/,"")}function kt(e,t,o=e,n=!0,s=!0){if(typeof e!="string"||e.length===0)return null;const l=Array.isArray(t)?t.filter(d=>typeof d=="string"&&d.length>0):[],r=l.find(d=>d===o);if(r!==void 0)return r;let i=e.normalize("NFKC").trim();if(/[:((]\s*(?:free|online)\b/i.test(i))return null;for(;;){const d=Ce(i);if(d.length===0)return null;const c=l.filter(b=>Ce(b)===d);if(c.length>0)return c.length===1?c[0]:null;const u=fo(i,n,s);if(u===i.toLowerCase())return null;i=u}}const Gt=["opendesign","open-design","open-design-api","amr-link.open-design.ai"],Kt=new Set(["openrouter","opencode-zen","opencode-go","opencode-go-plus","zen","opencode",...Gt]),xt={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 zt(e){return["deepseek-peak","utc-peak"].includes(e?.billingMode)?e.billingMode:"flat"}function qe(e,t,o,n,s){if(typeof e!="string")return null;if(Object.hasOwn(t,e))return e;if(n!=="auto")return null;let l=e.normalize("NFKC").trim().replace(/^models\/(?=gemini)/i,"google/");const r=l.search(/[/:]/);if(r>0){const i=l.slice(0,r).trim().toLowerCase(),d=l.slice(r+1).trim();if(Object.hasOwn(xt,i)&&(i===o||(o==="opencode-zen"||o==="opencode-go")&&(xt[i].test(d)||kt(d,Object.keys(i==="deepseek"?s?.models??{}:s?.providers?.[i]?.models??{}),d,s?.snapshotTags!==!1,s?.shortSnapshotTags!==!1)!==null)))l=d;else if(Object.hasOwn(xt,i))return null}return kt(l,Object.keys(t),e,s?.snapshotTags!==!1,s?.shortSnapshotTags!==!1)}const bo=new Set(["local","lmstudio","ollama","jan","gpt4all","koboldcpp","llamacpp","llama-cpp","localai","vllm","sglang","tabbyapi","lmdeploy","oobabooga","text-generation-webui","llama-server"]),go=["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 yo(e,t){if(typeof e=="string"&&bo.has(e))return!0;const o=typeof t=="string"?Wt(t):"";return go.some(n=>o.startsWith(n))}function ho(e,t,o,n){if(e!=="deepseek"&&!e.includes("deepseek")&&typeof t=="string"&&t.length>0&&t!=="__local__"&&!t.includes(":")){const s=o.models??{},l=Object.hasOwn(s,t)?t:n==="auto"?kt(t,Object.keys(s),t,o?.snapshotTags!==!1,o?.shortSnapshotTags!==!1):null;if(l!==null&&s[l]?.unpriced!==!0)return{entry:s[l],priced:!0,billingMode:"deepseek-peak",matched:!0}}return null}function ko(e,t,o){const n=o?.prices??{},s=o?.priceMatch==="exact"?"exact":"auto",l=o?.priceOverrides&&typeof o.priceOverrides=="object"?o.priceOverrides:{};let r=String(e??"").trim().toLowerCase();if(r.startsWith("llm-")&&(r=r.slice(4)),r===""&&(r="deepseek"),["our-free-model","our-free-model-region"].includes(r)&&l[r+":*"]==="__free__")return{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},priced:!0,currency:"USD",billingMode:"flat",matched:!0};let i=r,d=t;const c=l[r+":"+t];if(c==="__custom__"){const g=n.custom?.[r+":"+t];return{entry:g??null,priced:!!g,billingMode:"flat",matched:!0,currency:g?.currency??"USD"}}if(c==="__local__")return{entry:null,priced:!1,billingMode:"flat",matched:!0};if(typeof c=="string"&&c.length>0){const g=c.indexOf(":");if(g>0&&c.slice(g+1).length>0?(i=c.slice(0,g).trim().toLowerCase(),d=c.slice(g+1)):d=c,i==="deepseek"&&d==="__default__")return{entry:n.default??{cacheHit:0,cacheMiss:0,output:0},priced:n.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}if(["zen","opencode","opencode-go-plus"].includes(i)){const g=qe(d,n.providers?.[i]?.models??{},"opencode-go",s,n);g===null?i="opencode-go":d=g}if(Gt.includes(i)&&i!=="opendesign"&&qe(d,n.providers?.[i]?.models??{},i,s,n)===null&&(i="opendesign"),yo(i,d))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(i==="openrouter"){const g=n.providers?.openrouter?.models??{},f=Object.hasOwn(g,d)?g[d]:null;return{entry:f,priced:f!==null&&f.unpriced!==!0,billingMode:"flat",matched:f!==null}}if(i==="deepseek"||i.includes("deepseek")){const g=n.models??{},f=qe(d,g,"deepseek",s,n);if(f!==null)return g[f]?.unpriced===!0?{entry:null,priced:!1,billingMode:"flat",matched:!0}:{entry:g[f],priced:!0,billingMode:"deepseek-peak",matched:!0};if(s==="auto"){let m=null,x=-1,h=!1,C="flat";for(const[N,y]of Object.entries(n.providers??{})){if(Kt.has(N))continue;const p=y?.models??{},k=qe(d,p,N,s,n);if(k===null)continue;const w=+(k===d||Ce(k)===Ce(d));w>x?(m=p[k],x=w,h=!1,C=zt(p[k])):w===x&&(h=!0)}if(h)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(m!==null)return{entry:m,priced:m.unpriced!==!0,billingMode:C,matched:!0}}return{entry:n.default??{cacheHit:0,cacheMiss:0,output:0},priced:n.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}const u=n.providers?.[i]?.models??{},b=qe(d,u,i,s,n);if(b!==null)return{entry:u[b],priced:u[b]?.unpriced!==!0,billingMode:zt(u[b]),matched:!0};if(Kt.has(i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(Object.hasOwn(xt,i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(s==="auto"){let g=null,f=-1,m=!1,x="flat";for(const[h,C]of[["deepseek",{models:n.models??{}}],...Object.entries(n.providers??{})]){if(h===i||Kt.has(h))continue;const N=C?.models??{},y=qe(d,N,h,s,n);if(y===null)continue;const p=+(y===d||Ce(y)===Ce(d));p>f?(g=N[y],f=p,m=!1,x=h==="deepseek"?"deepseek-peak":zt(N[y])):p===f&&(m=!0)}if(m)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(g!==null)return{entry:g,priced:g.unpriced!==!0,billingMode:x,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}function Ka(e,t,o){let n=ko(e,t,o);const s=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";return!n.currency&&!n.priced&&(n=ho(s,o?.priceOverrides?.[s+":"+t],o?.prices??{},o?.priceMatch==="exact"?"exact":"auto")??n),n.currency||(n=n.priced&&o?.prices?.currency==="CNY"&&n.entry?.cny?{...n,entry:io(n.entry),currency:"CNY"}:{...n,currency:n.priced&&n.billingMode==="deepseek-peak"&&o?.prices?.currency==="CNY"?"CNY":"USD"}),["volcengine","ark"].includes(s)&&o?.prices?.volcenginePeak!==!1&&n.entry&&n.billingMode==="deepseek-peak"?{...n,entry:{...n.entry,peakSchedule:"volcengine"}}:n}function xo(e){const t=Number(e?.calls)||0,o=Number(e?.input)||0,n=Number(e?.cacheRead)||0;return t>=3&&o>=1e5&&n===0}function wt(e,t){return!e||!t?0:typeof e.cost=="number"&&Number.isFinite(e.cost)?e.cost:Ya(e,t).total}function Xe(e){if(e===null||typeof e!="object")return 0;const t=Number(e.cost)||0,o=e.apiCost===void 0||e.apiCost===null?t:Number(e.apiCost);return Number.isFinite(o)&&o>=0?Math.min(o,t):t}function Q(e,t){const o={CNY:"Cny",EUR:"Eur"}[t?.currency],n=t?.showTotalWithPlan===!0,s=o&&e?.[(n?"cost":"apiCost")+o],l=n?Number(e?.cost)||0:Xe(e);return!Number.isFinite(s)||s===0&&l>0?l:s/(t.exchangeRate||1)}const wo={opendesign:Gt,go:["go","zen","opencode","opencode-go","opencode-go-plus","dsh-opencode-go"],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"],clinepass:["clinepass","cline-pass"],workbuddy:["workbuddy","workbuddy-subscription","workbuddy-ai","workbuddy-global","xdpool","xdpool-global"],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"]},Ue=["opendesign","anthropic","zai","minimax","kimi","openrouter","siliconflow","commandcode","clinepass","scnet","volcengine","qwen","mimo","factory","go","codex","volcengine-agent","tencent-coding","tencent-token","baidu-coding","workbuddy","antigravity","stepfun"],No=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",clinepass:"cline[._-]?pass|clinepass",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,t])=>[e,new RegExp("(?:^|[^a-z0-9])(?:"+t+")(?=$|[^a-z0-9])")]);function So(e,t){for(const o of[e,t]){const n=String(o??"").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(n))continue;const s=No.filter(([,l])=>l.test(n));if(s.length){if(s.length!==1)return null;const l=s[0][0];if(l==="volcengine"&&/agent[-_\s]*plan|智能体.*套餐/.test(n))return"volcengine-agent";if(l==="tencent-coding"){const r=/token[-_\s]*plan|令牌.*套餐/.test(n),i=/coding[-_\s]*plan|编程.*套餐/.test(n);return r===i?null:r?"tencent-token":l}return l}}return null}function za(e,t,o){const n=String(e??"").trim().toLowerCase().replace(/^llm-/,""),s=t?.planBilling?.modelPlans?.[e+":"+o]??t?.planBilling?.modelPlans?.[n+":"+o];if(Ue.includes(s))return s;if(n.length===0)return null;for(const[l,r]of Object.entries(wo))if(r.includes(n))return l;return Ue.includes(n)?n:So(e,o)}function Co(e){if(Array.isArray(e?.planBilling?.autoProviders))return new Set(e.planBilling.autoProviders);const t=new Set,o=e?.codingPlans;if(o!==null&&typeof o=="object")for(const n of Ue)n!=="go"&&o[n]?.enabled===!0&&t.add(n);return e?.goQuota?.enabled===!0&&t.add("go"),e?.codexQuotaEnabled===!0&&t.add("codex"),t}const vo=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(Ce));function Ao(e,t,o){const n=String(e??"").trim().toLowerCase();if(n.length>0&&n!=="deepseek"&&!n.includes("deepseek"))return!1;const s=Ce(t);if(s.length===0||!vo.has(s))return!1;const l=o?.prices,r=l?.models??{};for(const i of Object.keys(r))if(Ce(i)===s)return!1;for(const i of Object.keys(l?.providers?.["opencode-go"]?.models??{}))if(Ce(i)===s)return!0;return!1}function et(e,t,o){if(e==="deepseek-official"&&/^deepseek-(web-(search|fetch)|(search|fetch)-api|search-server)$/.test(t))return"api";let n=za(e,o,t);n===null&&Ao(e,t,o)&&(n="go");const s=o?.planBilling?.models;if(s!==null&&typeof s=="object"){const l=s[e+":"+t];if(l==="plan"||l==="api")return l;if(n!==null){const r=s[n+":"+t];if(r==="plan"||r==="api")return r}}for(const l of[e,n]){if(l==null)continue;const r=o?.planBilling?.providers?.[l];if(r==="plan"||r==="api")return r}return n===null?"api":Co(o).has(n)?"plan":"api"}function Ya(e,t){if(!e||!t)return{total:0,api:0};const o=Po(t),n={enabled:t.peakEnabled===!0,effectiveAtMs:Date.parse(t.peakEffectiveAt||""),windows:t.peakWindows,holidays:t.peakHolidays},s=Date.now(),l=e.byProviderModel??e.byModel??{};let r=0,i=0;for(const g of Object.keys(l)){const f=g.indexOf(":"),m=f>0?g.slice(0,f):"deepseek",x=f>0?g.slice(f+1):g,h=Ka(m,x,t);if(h.priced){const C=co(h.entry);C&&h.billingMode==="deepseek-peak"&&t.prices?.ollamaPeak!==!1&&m.trim().toLowerCase().replace(/^llm-/,"")==="ollama-cloud"&&(t.prices?.ollamaTaggedPeak===!1?["deepseek-v4.1-flash","deepseek-v4-pro"].includes(x.trim().toLowerCase()):kt(x,["deepseek-v4.1-flash","deepseek-v4-pro"])!==null)&&(C.peakSchedule="ollama");const N=_a(l[g],Fa(C,s,{...n,enabled:["deepseek-peak","utc-peak"].includes(h.billingMode)&&n.enabled})),y=Wa(N,h.currency,o);r+=y,et(m,x,t)==="api"&&(i+=y)}}const d={input:0,output:0,cacheRead:0,cacheWrite:0,reasoning:0};for(const g of Object.keys(l))d.input+=l[g].input??0,d.output+=l[g].output??0,d.cacheRead+=l[g].cacheRead??0,d.cacheWrite+=l[g].cacheWrite??0,d.reasoning+=l[g].reasoning??0;const c={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)},u=_a(c,Fa(ro("default",t.prices),s,n)),b=Wa(u,t.prices?.currency==="CNY"?"CNY":"USD",o);return r+=b,i+=b,{total:r,api:i}}function Po(e){const t=o=>typeof o=="number"&&Number.isFinite(o)&&o>0&&o<1e6;return e.currency==="CNY"&&t(e.exchangeRate)?e.exchangeRate:t(e.fxRates?.CNY)?e.fxRates.CNY:7.2}function Va(e,t){if(!e||!t)return!1;const o=e.byProviderModel??{};for(const n of Object.keys(o)){const s=n.indexOf(":"),l=s>0?n.slice(0,s):"deepseek",r=s>0?n.slice(s+1):n;if(et(l,r,t)==="plan")return!0}return!1}function $a(e){return(e?.input??0)+(e?.cacheRead??0)+(e?.cacheWrite??0)}function Ja(e,t){if(e?.apiCost!==void 0)return Xe(e);if(!Va(e,t))return wt(e,t);let o=0;for(const[n,s]of Object.entries(e.byProviderModel??{})){if(!Number.isFinite(s.cost))return Ya(e,t).api;const l=n.indexOf(":");et(n.slice(0,l),n.slice(l+1),t)==="plan"&&(o+=s.cost)}return Math.max(0,wt(e,t)-o)}function Yt(e){const t=Math.abs(Math.round(Number(e)||0)),o=Math.floor(t/60),n=t%60;return"UTC"+(Number(e)<0?"-":"+")+o+(n>0?":"+String(n).padStart(2,"0"):"")}function Mo(e){const t=e?.meta,o=Number(t?.timezoneOffsetMinutes);if(!Number.isFinite(o))return null;const n=-new Date().getTimezoneOffset();if(n===o)return null;const s=typeof t?.timezone=="string"&&t.timezone.length>0?t.timezone:"";return{hostLabel:s?s+" ("+Yt(o)+")":Yt(o),browserLabel:Yt(n)}}function To(e,t=o=>o){let o=t(e);const n=new Set;return{getSnapshot:()=>o,subscribe:s=>(n.add(s),()=>{n.delete(s)}),set:s=>{if(s=t(s),s!==o){o=s;for(const l of[...n])l()}}}}const{createElement:a,Fragment:E,useState:O,useEffect:Y,useRef:fe}=Ae;function tt({target:e,configured:t,source:o,t:n,api:s,placeholder:l,disabled:r}){const[i,d]=O(""),[c,u]=O(!1),[b,g]=O(!1),[f,m]=O(null),x=fe(!1),h=r===!0||b,C=async()=>{const p=i.trim();if(!(p.length===0||h||x.current)){x.current=!0,g(!0),m(null);try{const k=await s.setCredential(e,p);d(""),u(!1),m({kind:"ok",text:k?.message??n("credentialSave")})}catch(k){m({kind:"err",text:String(k?.message??k)})}finally{x.current=!1,g(!1)}}},N=async()=>{if(!(h||x.current)){x.current=!0,g(!0),m(null);try{const p=await s.clearCredential(e);d(""),u(!1),m({kind:"ok",text:p?.message??n("credentialClear")})}catch(p){m({kind:"err",text:String(p?.message??p)})}finally{x.current=!1,g(!1)}}},y=()=>{d(""),u(!1)};return a("div",{className:"cm-field"},c?a("form",{className:"cm-field",autoComplete:"off",onSubmit:p=>{p.preventDefault(),C()}},a("input",{className:"cm-input",type:"password",name:"cm-credential-"+e,autoFocus:!0,value:i,placeholder:typeof l=="string"?l:"",disabled:h,autoComplete:"new-password","data-lpignore":"true","data-1p-ignore":"true","data-bwignore":"true","aria-label":n("credentialInputHint"),onChange:p=>d(p.target.value)}),a("div",{className:"cm-buttons"},a("button",{className:"cm-btn small",type:"submit",disabled:h||i.trim().length===0},n(b?"credentialSaving":"credentialSave")),a("button",{className:"cm-btn small",type:"button",onClick:y,disabled:b},n("cancel")))):a("button",{className:"cm-btn small",type:"button",onClick:()=>u(!0),disabled:h},n("credentialEdit")),t===!0?a("button",{className:"cm-btn small",type:"button",onClick:N,disabled:h},n("credentialClear")):null,a("span",{className:"cm-hint"},t===!0?n("credentialConfiguredOf",{source:typeof o=="string"&&o.length>0?o:"unknown"}):n("credentialNotConfigured")),a("span",{className:"cm-hint"},n("credentialInputHint")),ka(f))}function Ro({pending:e,t}){return!Array.isArray(e)||e.length===0?null:a("div",{className:"cm-msg err"},a("div",null,t("secretMigrationPending")),a("div",null,e.join("、")))}function Nt({size:e=16,className:t}){return a("svg",{width:e,height:e,className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("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"}),a("path",{d:"M3.3 5.3H12.7V7.1H3.3Z",fill:"currentColor"}),a("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 Za(e,t){const o=fe(!1),n=fe(""),s=t!==null&&typeof t=="object"?[t.input,t.cacheRead,t.cacheWrite,t.output,t.reasoning,t.cost].map(l=>String(l??0)).join("|"):"";Y(()=>{if(!o.current){o.current=!0,n.current=s;return}if(s===""||s===n.current)return;n.current=s;const l=setTimeout(()=>{e.api?.reload?.()},800);return()=>clearTimeout(l)},[s])}function Bo(e,t,o,n){const s=t?t.own:e;if(!o||!t?.subagentCount)return s;const l=t.subagents,r={...s};for(const i of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...bt])r[i]=(s?.[i]??0)+(l?.[i]??0);r.apiCost=Ja(s,n)+Xe(l);for(const i of["byModel","byProviderModel"]){r[i]={...s?.[i]};for(const[d,c]of Object.entries(l?.[i]??{})){const u={...r[i][d]};u.apiCost=Xe(u)+Xe(c);for(const b of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...bt])u[b]=(u[b]??0)+(c[b]??0);r[i][d]=u}}return r}function Xa(e){const t=e.useProjection?e.useProjection("costUsage"):void 0,o=e.useCost?.(c=>c)?.state,n=o?.config,[s,l]=O(null);Za(e,t);const r=["input","output","cacheRead","cacheWrite","reasoning","calls","cost","apiCost"].map(c=>t?.[c]??"").join(":");Y(()=>{if(!e.sessionId||!e.api?.getSessionCost)return;let c=!0,u=!1;const b=async()=>{if(!(u||typeof document<"u"&&document.hidden)){u=!0;try{const m=await e.api.getSessionCost(e.sessionId);c&&l({id:e.sessionId,include:n?.includeSubagentCost===!0,value:m})}catch{c&&l(m=>m?.id===e.sessionId&&m.include===(n?.includeSubagentCost===!0)?m:{id:e.sessionId,include:n?.includeSubagentCost===!0,value:null})}finally{u=!1}}};b();const g=n?.includeSubagentCost===!0?setInterval(b,1e4):null,f=()=>{document.hidden||b()};return typeof document<"u"&&document.addEventListener?.("visibilitychange",f),()=>{c=!1,g!==null&&clearInterval(g),typeof document<"u"&&document.removeEventListener?.("visibilitychange",f)}},[e.sessionId,o?.meta?.now,r,n?.includeSubagentCost]);const i=s&&s.id===e.sessionId&&s.include===(n?.includeSubagentCost===!0)?s:null,d=i?.value;return{usage:Bo(t,d,n?.includeSubagentCost||d&&d.subagentCount>0,n),config:n,pending:!!e.sessionId&&!!e.api?.getSessionCost&&!i,unrecorded:!!d&&!d.found&&!d.subagentCount}}function en(e){const t=H(e.config)==="en";return e.pending?t?"Loading session cost…":"正在读取本会话费用…":e.unrecorded?t?"Session cost: no ledger records":"本会话暂无账本记录":e.usage?"":t?"Session cost unavailable":"本会话费用暂不可用"}function tn(e,t){if(Number.isFinite(e?.costCny)||Number.isFinite(e?.costEur)){const s=Q(e,{...t,showTotalWithPlan:!0}),l=Q(e,{...t,showTotalWithPlan:!1});return{cost:t.showTotalWithPlan?s:l,planPart:t.showTotalWithPlan?0:Math.max(0,s-l)}}let o=0,n=wt(e,t);if(t.showTotalWithPlan!==!0&&(e.apiCost!==void 0||Va(e,t))){const s={total:wt(e,t),api:Ja(e,t)};o=Math.max(0,s.total-s.api),o>0&&(n=s.api)}return{cost:n,planPart:o}}function an(e,t){return Object.entries(e?.byProviderModel??{}).filter(([,o])=>o.input||o.output||o.cacheRead||o.cacheWrite||o.reasoning).map(([o,n])=>ut(o)+" "+W(Q(n,{...t,showTotalWithPlan:!0}),t)).join("; ")}function Oo(e){const t=e.useCost?.(h=>h)?.state?.config,[o,n]=O(null),[s,l]=O(""),r=e.turn?.start?.seq,i=e.turn?.end?.seq,d=e.sessionId,c=JSON.stringify([t?.prices,t?.priceOverrides,t?.priceMatch,t?.planBilling,t?.codingPlans,t?.goQuota?.enabled,t?.peakEnabled,t?.peakEffectiveAt,t?.peakWindows,t?.peakHolidays,t?.exchangeRate]);if(Y(()=>{let h=!0;if(n(null),l(""),!(t?.hideTurnCost||!d||r==null||i==null))return e.api.getTurnCost(d,r,i).then(C=>{h&&n(C)},C=>{h&&l(String(C.message??C))}),()=>{h=!1}},[d,r,i,c,t?.hideTurnCost]),!t||t.hideTurnCost||r==null||i==null)return null;const u=H(t)==="en",b=u?{input:"Input",output:"Output",cacheRead:"Cache read",cacheWrite:"Cache write",reasoning:"Reasoning"}:{input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",reasoning:"推理"},g=h=>{const C=Number(t.exchangeRate),N=h*(Number.isFinite(C)&&C>0?C:1),y=t.decimals??2;return W(h,N>0&&N<10**-(y+2)?{...t,decimals:Math.max(8,y)}:t)},f=h=>W(h,{...t,decimals:Math.max(8,t.decimals??2)}),m=u?{model:"Model call",compaction:"Context compaction",search:"Native search",fetch:"Web fetch"}:{model:"模型调用",compaction:"上下文压缩",search:"原生搜索",fetch:"网页抓取"},x=(h,C)=>a("div",{key:C,style:{marginBottom:4,overflowWrap:"anywhere"}},ut(h.provider+":"+h.model)+" · "+(b[h.bucket]||(h.bucket==="fetchRequests"?u?"Fetch requests":"抓取请求":u?"Search requests":"搜索请求"))+(h.plan?" (Plan)":"")+": "+(h.requests?h.requests+(u?" requests":" 次"):h.tokens.toLocaleString())+" × "+(h.priced?f(h.rate):"?")+(h.requests?" ≈ ":" / 1,000,000 ≈ ")+(h.priced?g(h.cost):"?"),h.priced?h.bucket==="reasoning"&&h.rate===0?u?" (no separate charge)":"(不单独收费)":"":u?" (price unavailable)":"(未配置价格)");return a("details",{className:"cm-note",style:{fontSize:12,marginTop:6}},a("summary",{style:{cursor:"pointer"},title:u?"Log estimate at configured prices; session cost uses recorded ledger amounts.":"本轮按日志和配置价格估算,本会话按账本已入账金额汇总。"},u?"Turn cost":"本轮费用",o?.found?" ≈ "+g(Q(o,t))+(o.rows.some(h=>!h.priced)?u?" + unpriced usage":" + 未定价用量":""):o?.inherited?u?" · inherited history":" · 继承历史":s?" ⚠":""),s?a("div",{role:"alert"},s):o?o.found?a(E,null,a("p",null,u?"Estimated from recorded usage and configured prices; rates per 1M tokens.":"按已记录用量和配置价格估算;单价单位为每百万 Token。"),a("p",null,"API ≈ "+g(Q(o,{...t,showTotalWithPlan:!1}))+" · Plan ≈ "+g(Q(o,{...t,showTotalWithPlan:!0})-Q(o,{...t,showTotalWithPlan:!1}))+(u?" (equivalent)":"(等值)")),o.rows.map(x),a("details",null,a("summary",{style:{cursor:"pointer"}},(u?"Individual calls":"逐次调用明细")+" ("+o.calls.length+")"),o.calls.map((h,C)=>a("details",{key:C,style:{margin:"6px 0"}},a("summary",{title:h.provider+":"+h.model,style:{cursor:"pointer",overflowWrap:"anywhere"}},"#"+(C+1)+" "+m[h.kind]+" · "+ut(h.provider+":"+h.model)+" · "+new Date(h.atMs).toLocaleTimeString()+" · "+(h.plan?"Plan ":"API ")+(h.priced?"≈ "+g(h.cost):u?"price unavailable":"未配置价格")+(h.longContext?u?" · long context":" · 长上下文价格":"")),h.metering?a("p",null,"billion-context · "+h.metering.upstream+(h.metering.attempt>1?(u?" · Retry ":" · 重试 ")+h.metering.attempt:"")+(h.metering.complete?"":u?" · partial usage":" · 用量回执不完整")):null,h.rows.map(x))))):o.inherited?u?"Inherited usage is not billed again in this conversation.":"继承的历史用量不在本会话重复计费。":u?"Complete usage records unavailable":"没有完整用量记录":u?"Loading…":"加载中…")}function Do(e){const t=Xa(e),{usage:o,config:n}=t;if(!n)return null;const s=en(t);if(s)return a("div",{className:"cm-chip"},s);const l=z(H(n)),{cost:r,planPart:i}=tn(o,n),d=[l("sessionCostTitle"),l("sessionDetailTokens",{input:L(o?.input??0),cache:L((o?.cacheRead??0)+(o?.cacheWrite??0)),output:L(o?.output??0)}),l("sessionDetailCache",{read:L(o?.cacheRead??0),write:L(o?.cacheWrite??0)}),l("cost",{amount:W(r,n)}),...i>0?[l("sessionDetailPlan",{amount:W(i,n)})]:[],an(o,n)].filter(Boolean).join("; ");return a(J,{portal:!0,label:d,side:"top",delayMs:500},a("div",{className:"cm-chip"},i>0?l("costChipPlan",{amount:W(r,n)}):l("cost",{amount:W(r,n)})))}function Lo(e){const t=Xa(e),{usage:o,config:n}=t;if(!n)return null;const s=en(t);if(s)return a("div",{className:"cm-root",role:"status",title:s},s);const l=o.input??0,r=(o.cacheRead??0)+(o.cacheWrite??0),i=o.output??0,d=z(H(n)),{cost:c,planPart:u}=tn(o,n),b=$a(o)>0?((o.cacheRead??0)/$a(o)*100).toFixed(1)+"%":"—",g={amount:W(c,n),planAmount:W(u,n),hitRate:b,input:L(l),cache:L(r),output:L(i)},f=d(u>0?"sessionLineSplit":"sessionLine",g),m=an(o,n),x=n.sessionCostCompact===!0,h=d("sessionLineCompact",g),C=x?d(u>0?"sessionLineSplitCompact":"sessionLineCompact",g):f;return a("div",{className:"cm-root cm-session-cost",title:[f,m].filter(Boolean).join("; ")},a("span",{className:"cm-session-amount"},h),a("span",{className:"cm-session-detail"},C.slice(h.length)))}const Eo={USD:"$",CNY:"¥",EUR:"€"};function je(e,t,o){const n=typeof o=="string"?o.toUpperCase():"",s=typeof t?.symbol=="string"&&t.symbol.length>0?t.symbol:"$";return de(e,{symbol:Eo[n]??s,decimals:Math.max(2,Math.min(10,Math.floor(Number(t?.decimals)||2)))})}function nn(e,t){const o=Number(e?.balance?.budgetCap);if(Number.isFinite(o)&&o>0)return o;const n=Number(t?.maxBudget);return Number.isFinite(n)&&n>0?n:null}function Io(e){const t=e.today,o=t?.byProviderModel;if(o===null||typeof o!="object"||Object.keys(o).length===0)return Number(t?.cost)||0;let n=0;for(const[s,l]of Object.entries(o)){const r=s.indexOf(":");let i=r>=0?s.slice(0,r):s;i.startsWith("llm-")&&(i=i.slice(4)),/^deepseek(?:-official|-account)?$/.test(i)&&(n+=Number(l?.cost)||0)}return n}function on(e,t,o,n,s=null){const l=o==="official"?Io(e):Number(e.today?.cost)||0,r=o==="custom"?at(t,n,s):e.balance?.currency;if(r==="USD")return l;if(r==="CREDITS")return 0;const i=Number(t?.exchangeRate);return l*(Number.isFinite(i)&&i>0?i:1)}function Vt({remaining:e,spend:t,todayUsed:o,cap:n}){if(n===null||n<=0)return{remainingPct:100,todayPct:0,spentPct:0,hasCap:!1,pastSpend:0,today:0};const s=Math.max(0,Number(e)||0),l=Math.max(0,Number(t)||0),r=Math.max(0,Math.min(l,Number(o)||0)),i=Math.max(0,l-r),d=Math.max(0,Math.min(100,s/n*100)),c=Math.max(0,Math.min(100-d,r/n*100)),u=Math.max(0,Math.min(100-d-c,i/n*100));return{remainingPct:d,todayPct:c,spentPct:u,hasCap:!0,pastSpend:i,today:r}}function $t(e,t,o=null,n=null){const s=o??e.customBalance;if((n??t?.customBalance)?.adapter==="tokenrhythm")return{cap:null,...Vt({remaining:s?.remaining,cap:null})};const l=nn(at(t,s,n)==="CREDITS"?null:t,s),r=Number(s?.remaining)||0,i=Number(s?.spend)||0,d=on(e,t,"custom",s,n);return{cap:l,...Vt({remaining:r,spend:i,todayUsed:d,cap:l})}}function jo(e,t){const o=e.balance,n=nn(t,null),s=Number(o?.totalBalance)||0,l=on(e,t,"official",null),r=n!==null?Math.max(0,n-s):0;return{cap:n,...Vt({remaining:s,spend:r,todayUsed:l,cap:n})}}function Jt(e){const{segments:t,direction:o="remaining"}=e,{remainingPct:n,todayPct:s,spentPct:l}=t,r=[];n>0&&r.push(a("div",{className:"cm-bbox-fill",style:{width:n+"%"}})),s>0&&r.push(a("div",{className:"cm-bbox-seg-today",style:{width:s+"%"}})),l>0&&r.push(a("div",{className:"cm-bbox-seg-spent",style:{width:l+"%"}})),r.length===0&&r.push(a("div",{className:"cm-bbox-fill",style:{width:"100%"}}));const i=o==="used"?[...r].reverse():r;return a("div",{className:"cm-bbox-bar segments"+(o==="used"?" rev":"")},...i)}function Ho(e,t,o,n,s){const l=[e("balanceBarRemaining",{amount:n})];return o.today>0&&l.push(e("balanceBarToday",{amount:t(o.today)})),o.pastSpend>0&&l.push(e("balanceBarSpent",{amount:t(o.pastSpend)})),s!==null&&s>0&&l.push(e("balanceBudgetCapLabel")+": "+t(s)),l.join(" · ")}function Be(e){const[t,o]=O(!1),[n,s]=O(null);return{busy:t,err:n,run:()=>{t||typeof e!="function"||(o(!0),s(null),Promise.resolve().then(e).catch(r=>{s(r?.message??String(r))}).finally(()=>{o(!1)}))}}}const ke=(e,t)=>({role:"button",tabIndex:0,"aria-busy":e?"true":"false",onClick:t,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())}});function Pe(e,t){const o=[e("clickToRefresh")];return t.busy&&o.push(e("refreshing")),t.err&&o.push("⚠ "+e("balanceRefreshFailed",{message:t.err})),o}const Qo="https://platform.deepseek.com/usage";function sn(e){return a("a",{className:"cm-bal-link",href:Qo,target:"_blank",rel:"noreferrer noopener",title:e("balanceRechargeLink"),"aria-label":e("balanceRechargeLink"),onClick:t=>t.stopPropagation(),onKeyDown:t=>t.stopPropagation()},a("svg",{width:14,height:14,viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},a("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 qo(e){const{state:t,wide:o,api:n}=e,s=t.balance,l=z(H(t.config)),r=Be(n?()=>n.refreshBalance():null);if(!s||s.status==="off")return null;if(s.status==="error")return a(J,{portal:!0,label:[l("balanceQueryFailed",{message:s.message||l("unknownError")}),...Pe(l,r)].join("; "),side:"right",delayMs:300},a("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+" cm-bal-err"+(r.busy?" busy":""),...ke(r.busy,r.run)},o?a(E,null,Zt(l,t.config)," ",a("span",{className:"cm-num"},l("queryFailed"))):"⚠"));const i=ln(l,s,t.config,t.reconcile,r);return a(J,{portal:!0,label:i,side:"right",delayMs:300},a("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+(r.busy?" busy":""),...ke(r.busy,r.run)},o?a(E,null,a("span",{className:"cm-balance-name"},Zt(l,t.config),sn(l)),a("span",{className:"cm-num cm-bal-amt"},je(s.totalBalance,t.config,s.currency)),t.reconcile?.ok===!1?" ⚠":""):a(Nt,{size:16})))}function Zt(e,t){return e(t?.balance?.showSource===!0?"officialBalance":"balance")}function ln(e,t,o,n,s){const l=[e("officialBalance")+" "+je(t.totalBalance,o,t.currency),e("grantedToppedUp",{granted:je(t.grantedBalance,o,t.currency),toppedUp:je(t.toppedUpBalance,o,t.currency)}),...n?.ok===!1?["⚠ "+n.message]:[],...Pe(e,s)];return a("div",{style:{maxWidth:"min(280px, 70vw)",whiteSpace:"normal"}},...l.map((r,i)=>a("div",{key:i},r)))}function Uo(e){const{state:t,wide:o,api:n}=e,s=t.config,l=t.balance,r=z(H(s)),i=Be(n?()=>n.refreshBalance():null);if(!l||l.status!=="ok")return null;const d=jo(t,s),c=je(l.totalBalance,s,l.currency),u=ln(r,l,s,t.reconcile,i),b=a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-balance-name"},a("span",{className:"cm-bbox-label"},Zt(r,s)),sn(r)),a("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},c)),a(Jt,{segments:d,direction:ie(s,"balance")}));return a(J,{portal:!0,label:u,side:"right",delayMs:300},a("div",{"data-cm-display":"balance",className:"cm-bbox clickable"+(o?"":" rail")+(i.busy?" busy":""),...ke(i.busy,i.run)},o?b:a("div",{className:"cm-bbox-rail cm-num"},Math.round(d.remainingPct)+"%")))}function Xt(e,t){const o=typeof e?.label=="string"?e.label:"",n=typeof e?.labelEn=="string"?e.labelEn:"";return t==="en"?n||o||"Custom balance":o||n||"自定义余额"}function at(e,t,o){if((o??e?.customBalance)?.adapter==="tokenrhythm")return"CNY";if((o??e?.customBalance)?.adapter==="aliyun"&&["CNY","USD","EUR"].includes(t?.unit))return t.unit;const n=o?.unit??e?.customBalance?.unit;return["CNY","EUR","USD","CREDITS"].includes(n)?n:["CNY","EUR","CREDITS"].includes(t?.unit)?t.unit:"USD"}function Fe(e,t,o,n){const s=at(t,o,n),l=Number(e);if(!Number.isFinite(l))return"—";const r=t?.currency==="USD"?1:Number(t?.exchangeRate);if((n??t?.customBalance)?.convertToDisplayCurrency===!0&&s==="USD"&&Number.isFinite(r)&&r>0){const u=l*r;return Number.isFinite(u)?de(u,t):"—"}const i=s==="CREDITS",d=Math.max(2,Math.min(6,Math.floor(Number(t?.decimals)||4)));return(i?"":s==="CNY"?"¥":s==="EUR"?"€":"$")+Ga(l,d)+(i?" Credits":"")}function ea(e,t,o,n,s=null){const l=Fe(e.remaining,t,e,s);if((s??t?.customBalance)?.adapter==="tokenrhythm")return o("customBalanceRemaining",{amount:l});const r=g=>Fe(g,t,e,s);if(n&&t.balance?.showProgressBar===!0){const g=$t(n,t,e,s);return[Ho(o,r,g,l,g.cap),o("updatedAt",{time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"})].join(" · ")}const i=e.spend!==null?r(e.spend):"—",d=e.maxBudget!==null?r(e.maxBudget):"—",c=at(t,e,s)==="CREDITS"?NaN:Number(t?.balance?.budgetCap),u=Number.isFinite(c)&&c>0?o("balanceBudgetCapLabel")+": "+r(c):"",b=e.maxBudget!==null&&e.spend!==null?o("customBalanceLine",{remaining:l,spend:i,maxBudget:d,time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"}):o("customBalanceRemaining",{amount:l});return u?b+" · "+u:b}function Fo(e,t,o,n,s){const l=Xt(s??t.customBalance??{},H(t)),r=Fe(n.remaining,t,n,s),i=$t(e,t,n,s);return{level:"ok",rail:Math.round(i.remainingPct)+"%",body:a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bbox-label"},l),a("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},r)),a(Jt,{segments:i,direction:ie(t,"balance")}))}}function St(e,t){const o=t?.customBalances??[],n=Array.isArray(e?.customBalances)?e.customBalances:[],s=[];return o.forEach((l,r)=>{if(l?.enabled!==!0||l.display!=="sidebar"&&l.display!=="both")return;const i=n.find(d=>d.index===r)??(n.length===1&&o.length===1?n[0]:null);s.push({index:r,entry:l,snapshot:i})}),s.length===0&&n.length===0&&t?.customBalance?.enabled===!0&&(t.customBalance.display==="sidebar"||t.customBalance.display==="both")&&e?.customBalance?.status&&e.customBalance.status!=="off"&&s.push({index:null,entry:t.customBalance,snapshot:e.customBalance}),s}function _o(e){const{state:t,wide:o,api:n}=e,s=t.config,l=z(H(s)),r=St(t,s);return r.length===0?null:a(E,null,r.map(({index:i,entry:d,snapshot:c})=>a(d.adapter==="tokenrhythm"?rn:Wo,{key:"cb-"+i,state:t,wide:o,api:n,t:l,index:i,entry:d,snapshot:c})))}function Wo(e){const{state:t,wide:o,api:n,t:s,index:l,entry:r,snapshot:i}=e,d=t.config;if(i==null||i.status!=="ok")return null;const c=Be(n?()=>n.refreshCustomBalance(l):null),u=Fo(t,d,s,i,r),b=[ea(i,d,s,t,r),...Pe(s,c)].join(" · ");return a(J,{portal:!0,label:b,side:"right",delayMs:300},a("div",{"data-cm-display":"customBalance",className:"cm-bbox clickable"+(u.level==="ok"?"":" "+u.level)+(o?"":" rail")+(c.busy?" busy":""),...ke(c.busy,c.run)},o?u.body:a("div",{className:"cm-bbox-rail cm-num"},u.rail)))}function Go(e){const{state:t,wide:o,api:n}=e,s=t.config,l=z(H(s)),r=St(t,s);return r.length===0?null:a(E,null,r.map(({index:i,entry:d,snapshot:c})=>a(rn,{key:"cbr-"+i,state:t,wide:o,api:n,t:l,index:i,entry:d,snapshot:c})))}function rn(e){const{state:t,wide:o,api:n,t:s,index:l,entry:r,snapshot:i}=e,d=t.config,c=i??Oa(l);if(c.status==="off")return null;const u=Be(n?()=>n.refreshCustomBalance(l):null),b=Xt(r??d.customBalance??{},H(d));if(c.status==="error")return a(J,{portal:!0,label:[c.message||s("unknownError"),...Pe(s,u)].join("; "),side:"right",delayMs:300},a("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+" cm-bal-err"+(u.busy?" busy":""),...ke(u.busy,u.run)},o?a(E,null,a("span",{className:"cm-bal-label",title:b},b),a("span",{className:"cm-num cm-bal-amt"},s("queryFailed"))):"⚠"));const g=Fe(c.remaining,d,c,r),f=[ea(c,d,s,t,r),...Pe(s,u)].join(" · ");return a(J,{portal:!0,label:f,side:"right",delayMs:300},a("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+(u.busy?" busy":""),...ke(u.busy,u.run)},o?a(E,null,a("span",{className:"cm-bal-label",title:b},b),a("span",{className:"cm-num cm-bal-amt"},g)):a(Nt,{size:16})))}function cn(e){const o=(e.useCost?e.useCost(m=>m):void 0)?.state;if(!o)return null;const n=o.config,s=z(H(n)),l=n.corner??{enabled:!1,goRolling:!0,goWeekly:!0,goMonthly:!0,budget:!0},r=o.goQuota,i=n?.goQuota?.enabled!==!1&&r?.status==="ok",d=m=>m!==null&&typeof m?.percent=="number"?Math.round(Math.max(0,Math.min(100,m.percent))):null,c=[];if(n.sidebarModels?.dock){const m=Sn(o,n.sidebarModels.period,s);m.length&&c.push({key:"model-top",text:a(E,null,a("span",{className:"cm-bal-label"},m[0].label),a("span",{className:"cm-bal-amt"},W(m[0].cost,n))),tip:m[0].label+" "+W(m[0].cost,n),level:"ok"})}const u=(m,x,h,C)=>{if(!l.enabled||!m||!i)return;const N=d(x);if(N===null)return;const y=typeof x.resetsAt=="string"&&x.resetsAt.length>0?s("goResetAt",{time:new Date(x.resetsAt).toLocaleString()}):"";c.push({key:h,text:s(h)+" "+N+"%",tip:s(C)+": "+N+"%"+(y?" · "+y:""),level:N>=100?"over":N>=80?"warn":"ok"})},b=n?.goQuota?.main==="weekly"||n?.goQuota?.main==="monthly"?n.goQuota.main:"rolling",g=[b,...["rolling","weekly","monthly"].filter(m=>m!==b)],f=m=>m==="rolling"?["goRolling",r?.rolling,"goShortRolling","cornerGoRolling"]:m==="weekly"?["goWeekly",r?.weekly,"goShortWeekly","cornerGoWeekly"]:["goMonthly",r?.monthly,"goShortMonthly","cornerGoMonthly"];for(const m of g){const[x,h,C,N]=f(m);u(l[x]===!0,h,C,N)}if(l.enabled&&l.budget===!0){const m=n.budget??{enabled:!1,amount:100,period:"month"};if(m.enabled===!0){const x=Number(n.exchangeRate),C=(o.budgetUsed??(m.period==="day"?Q(o.today,n):m.period==="all"?Q(o.total,n):Q(o.month,n)))*(Number.isFinite(x)&&x>0?x:1),N=Math.max(0,Number(m.amount)||0),y=N>0?Math.min(999,C/N*100):null;if(y!==null){const p=y>=100?"over":y>=80?"warn":"ok";c.push({key:"budget",text:s("budgetShort")+" "+y.toFixed(1)+"%",tip:s("budgetOf",{period:s(Ye[m.period]??"periodMonth")})+" · "+s("usedOf",{used:de(C,n),amount:de(N,n)}),level:p})}}}return c.length===0?null:a("div",{className:"cm-corner"},c.map(m=>a(J,{portal:!0,key:m.key,label:m.tip,side:"top",delayMs:500},a("span",{className:"cm-corner-chip"+(m.key==="model-top"?" cm-model-top":"")+(m.level==="ok"?"":" "+m.level)},m.text))))}function ta(e,t,o,n){if(n==="volcengine"&&(o=[]),!Array.isArray(t)||t.length===0||!Number.isFinite(e))return null;const s=(f,m)=>{const x=new Date(e);return x.setUTCDate(x.getUTCDate()+f),x.setUTCHours(m,0,0,0),x.getTime()},l=new Set,r=Math.max(12,Math.min(380,(Array.isArray(o)?o.length:0)+7));for(let f=-r;f<=r;f+=1){l.add(s(f,16));for(const m of t){const x=Number(m?.start),h=Number(m?.end);!Number.isFinite(x)||!Number.isFinite(h)||(l.add(s(f,x)),l.add(s(h<=x?f+1:f,h)))}}const i=[...l].sort((f,m)=>f-m).flatMap(f=>{const m=ht(f-1,void 0,t,o),x=ht(f,void 0,t,o);return m===x?[]:[{at:f,intoPeak:x}]});let d=null,c=null;for(const f of i)f.at<=e&&(d===null||f.at>d.at)&&(d=f),f.at>e&&(c===null||f.at<c.at)&&(c=f);const u=Ua(e,o),b=u??qa(e);return b!==null?c===null?null:{inPeak:!1,weekend:u===null,...u?{holiday:!0}:{},prevAtMs:b.start,nextAtMs:c.at,nextIntoPeak:c.intoPeak}:d===null||c===null?null:{inPeak:ht(e,void 0,t,o),weekend:!1,prevAtMs:d.at,nextAtMs:c.at,nextIntoPeak:c.intoPeak}}function _e(e,t){if(!e||e.peakNotice===!1||e.peakEnabled!==!0)return null;const o=Date.parse(e.peakEffectiveAt||"");return Number.isFinite(o)&&t<o?null:un(e,t)}function un(e,t){const o=String(e?.peakProvider??"").trim().toLowerCase().replace(/^llm-/,"");return ta(t,e?.peakWindows??[],e?.peakHolidays,["volcengine","ark"].includes(o)?"volcengine":void 0)}function aa(e,t){const o=e?.config,n=t??o?.peakProvider??e?.meta?.defaultProvider;return o&&n?{...o,peakProvider:n}:o}function nt(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 Me(e,t,o){const n=Math.max(0,e.nextAtMs-t),s=Math.max(1,Math.ceil(n/6e4)),l=Math.floor(s/60),r=s%60;return l>0?r>0?o("countdownHourMinute",{h:l,m:r}):o("countdownHoursOnly",{h:l}):o("countdownMinute",{m:s})}function dn(e){const t=fe(null),o=fe(e.actions);o.current=e.actions,Y(()=>{const d=t.current;if(!d)return;try{typeof d.showPopover=="function"?d.showPopover():d.removeAttribute("popover")}catch{d.removeAttribute("popover")}let c=!1;const u=m=>{d.contains(m.target)&&(c=!0,m.stopPropagation())},b=m=>{c&&(c=!1,m.stopPropagation())},f=[["pointerdown",u],["pointerup",b],["pointercancel",b],["touchstart",u],["click",m=>{if(!d.contains(m.target))return;m.stopPropagation();const x=m.target.closest?.("[data-cm-action]");x&&!x.disabled&&o.current[x.dataset.cmAction]?.()}]];for(const[m,x]of f)window.addEventListener?.(m,x,{capture:!0,passive:!0});return()=>{for(const[m,x]of f)window.removeEventListener?.(m,x,!0);try{d.hidePopover()}catch{}}},[]);const{actions:n,children:s,...l}=e,r=a("div",{...l,ref:t,popover:"manual"},s);let i;try{i=ve("react-dom")?.createPortal}catch{}return typeof i=="function"?i(r,document.body):r}const Ko="cm-peak-alert-preview";function zo(e){return e.useCost?.(o=>o)?.state?.config?.peakEnabled===!0?a(ot,{...e,view:"alert"}):null}function Yo(e){const{config:t,t:o}=e,[n,s]=O(Date.now());Y(()=>{const d=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)});return a(J,{portal:!0,label:o(r.notice),side:"right",delayMs:300},a("div",{"data-cm-display":"peak",className:"cm-peak-strip "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off")},a("div",{className:"cm-peak-track"},a("div",{className:"cm-peak-segment cm-peak-high"}),a("div",{className:"cm-peak-segment cm-peak-low"}),a("div",{className:"cm-peak-marker",style:{left:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}})),a("span",{className:"cm-peak-chip"},o(r.chip)+" · "+i)))}function Vo(e){const{config:t,t:o}=e,[n,s]=O(Date.now());Y(()=>{const d=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)});return a(J,{portal:!0,label:o(r.notice),side:"right",delayMs:300},a("div",{"data-cm-display":"peak",className:"cm-peak-classic "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off")},a("div",{className:"cm-peak-classic-marker",style:{left:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}}),a("div",{className:"cm-peak-track"},a("div",{className:"cm-peak-segment cm-peak-high"}),a("div",{className:"cm-peak-segment cm-peak-low"})),a("span",{className:"cm-peak-classic-chip"},o(r.chip)+" · "+i)))}let pn;function $o(){return pn??=ve.async("./client.peak.js").then(e=>e.mount({peakView:_e,peakPhaseAt:ta,peakPhaseForConfig:un,peakConfigForState:aa,phaseLabelKeys:nt,countdownText:Me,resolveLocale:H,makeT:z,Tooltip:J,FloatingCard:dn,renderSidebarFooter:Rt})).catch(e=>{throw pn=null,e})}function ot(e){return a(be,{...e,load:$o,quiet:!0})}function Jo(e){const t=e.useCost?.(o=>o)?.state;return t&&t.config.sidebar!==!1&&!t.config.sidebarSummaryPromptSeen?a(ot,{...e,state:t,config:t.config,view:"summary-guide"}):null}function Zo(e){const t=e.useCost?.(n=>n)?.state,o=t?.config;return o?.peakEnabled&&o.peakNotice!==!1&&!o.peakProgressPromptSeen?a(ot,{...e,state:t,config:o,view:"guide"}):null}function mn(e,t,o){return a(t?.peakStyle==="progress"?ot:t?.peakStyle==="classic"?Vo:Yo,{config:t,t:o})}function Xo(e){const{config:t,t:o}=e,[n,s]=O(Date.now());Y(()=>{const c=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(c)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)}),d=[o(r.notice),i];return a(J,{portal:!0,label:d,side:"right",delayMs:300},a("div",{className:"cm-peak-rail "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off"),"aria-label":d.join("; ")},a("div",{className:"cm-peak-rail-track"},a("div",{className:"cm-peak-rail-segment cm-peak-rail-high"}),a("div",{className:"cm-peak-rail-segment cm-peak-rail-low"}),a("div",{className:"cm-peak-rail-marker",style:{top:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}})),a("span",{className:"cm-peak-rail-label"},o(r.short))))}function es(e){const{config:t,t:o}=e,[n,s]=O(Date.now());Y(()=>{const c=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(c)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)}),d=[o(r.notice),i];return a(J,{portal:!0,label:d,side:"right",delayMs:300},a("div",{className:"cm-peak-rail-classic "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off"),"aria-label":d.join("; ")},a("div",{className:"cm-peak-rail-classic-track"},a("div",{className:"cm-peak-rail-classic-segment peak"}),a("div",{className:"cm-peak-rail-classic-segment off"}),a("div",{className:"cm-peak-rail-classic-marker",style:{top:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}})),a("span",{className:"cm-peak-rail-classic-label"},o(r.short))))}function ts(e,t,o){return a(t?.peakStyle==="progress"?ot:t?.peakStyle==="classic"?es:Xo,{config:t,t:o,rail:!0})}function as(e,t,o){const n=t.budget??{enabled:!1,amount:100,period:"month"},s=Number(t.exchangeRate),r=(e.budgetUsed??(n.period==="day"?Q(e.today,t):n.period==="all"?Q(e.total,t):Q(e.month,t)))*(Number.isFinite(s)&&s>0?s:1),i=Math.max(0,Number(n.amount)||0),d=i>0?Math.min(999,r/i*100):null,c=we(d===null?null:Math.min(100,d),ie(t,"budget")),u=n.detail!==!1;return{level:d===null?"ok":d>=100?"over":d>=80?"warn":"ok",rail:c.label===null?"—":Math.round(c.label)+"%",body:a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bbox-label"},o("budget")),a("span",{className:"cm-bbox-pct cm-num"},c.label===null?"—":c.label.toFixed(1)+"%")),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:c.width+"%"}})),u?a(E,null,a("div",{className:"cm-bbox-line cm-num"},o("usedOf",{used:de(r,t),amount:de(i,t)}))):null)}}function ns(e,t,o){const n=e.goQuota,s=t?.goQuota?.main==="weekly"||t?.goQuota?.main==="monthly"?t.goQuota.main:"rolling",l=n[s],r=l!==null&&typeof l?.percent=="number"?Math.max(0,Math.min(100,Number(l.percent)||0)):0,i=f=>f!==null&&typeof f?.percent=="number"?Math.round(Math.max(0,Math.min(100,f.percent)))+"%":"—",d=f=>o(f==="rolling"?"goShortRolling":f==="weekly"?"goShortWeekly":"goShortMonthly"),c=["rolling","weekly","monthly"].filter(f=>f!==s),u=l!==null&&typeof l?.resetsAt=="string"&&l.resetsAt.length>0?o("goResetAt",{time:new Date(l.resetsAt).toLocaleString()}):"",b=t?.goQuota?.detail!==!1,g=we(r,ie(t,"go"));return{level:r>=100?"over":r>=80?"warn":"ok",rail:g.label===null?"—":Math.round(g.label)+"%",body:a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bbox-label"},o("goQuotaRowLabel")+" "+d(s)),a("span",{className:"cm-bbox-pct cm-num"},g.label===null?"—":Math.round(g.label)+"%")),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:g.width+"%"}})),b?a(E,null,a("div",{className:"cm-bbox-line cm-num"},c.map(f=>d(f)+" "+i(n[f])).join(" · ")),u?a("div",{className:"cm-bbox-line"},u):null):null)}}function fn(e,t,o){const n=ie(t,"go");return["rolling","weekly","monthly"].map((s,l)=>{const r=e?.[s],i=typeof r?.percent=="number"&&Number.isFinite(r.percent)?Math.max(0,Math.min(100,r.percent)):null,d=r?.resetsAt&&Number.isFinite(Date.parse(r.resetsAt))?" · "+o("goResetAt",{time:new Date(r.resetsAt).toLocaleString()}):"";return o(["goWindowRolling","goWindowWeekly","goWindowMonthly"][l])+": "+(i===null?"—":Oe(we(i,n).label,n,o))+d}).concat(e?.fetchedAt>0?o("goQuotaFetchedAt",{time:new Date(e.fetchedAt).toLocaleTimeString()}):[]).join(`
3
- `)}function os(e){const{state:t,wide:o}=e,n=t.goQuota,s=z(H(t.config));if(!n||n.status!=="ok")return null;const l=t.config?.goQuota?.main==="weekly"||t.config?.goQuota?.main==="monthly"?t.config.goQuota.main:"rolling";if(n[l]===null||typeof n[l]?.percent!="number")return null;const r=ns(t,t.config,s),i=fn(n,t.config,s);return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},i),side:"right",delayMs:300},a("div",{"data-cm-display":"go",className:"cm-bbox"+(r.level==="ok"?"":" "+r.level)+(o?"":" rail")},o?r.body:a("div",{className:"cm-bbox-rail cm-num"},r.rail)))}function ss(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 na(e){const t=e!==null&&typeof e=="object"?e:{};return{five:t["5h"]??null,seven:t["7d"]??t.week??t.weekly??null}}function bn(e,t,o=Date.now()){if(typeof e!="string"||!e)return"";const n=Date.parse(e);if(!Number.isFinite(n))return"";const s=n-o;if(s<=0)return t("resetReached");const l=Math.ceil(s/6e4),r=Math.floor(l/1440),i=Math.floor(l%1440/60),d=l%60;return r>0?t("resetDays",{d:r,h:i}):i>0?t("resetHours",{h:i,m:d}):t("resetMinutes",{m:d})}function st(e,t,o=Date.now()){const n=bn(e?.resetsAt,t,o);return n?t("goResetAt",{time:new Date(e.resetsAt).toLocaleString()})+" ("+n+")":""}function Oe(e,t,o){return e===null?"—":o(t==="remaining"?"quotaRemaining":"quotaUsed",{pct:e})}function Ct(e){const[,t]=O(0),o=()=>t(Date.now());return Y(()=>{if(!e)return;const n=setInterval(o,6e4);return()=>clearInterval(n)},[e]),{onMouseEnter:o,onFocus:o}}function lt(e,t,o,n,s){const l=ss(t),r=l===null?"ok":l>=100?"over":l>=80?"warn":"ok",i=we(l,o),d=t?.unlimited?"∞":s?Oe(i.label,o,n):i.label===null?"—":i.label+"%";return{level:r,pct:l,text:d,label:i.label,row:a("div",{key:e,className:"cm-mm-row"+(r==="ok"?"":" "+r)},a("span",{className:"cm-bbox-label"},e),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:i.width+"%"}})),a("span",{className:"cm-bbox-pct cm-num"},d))}}function oa(e){const{five:t,seven:o,fetchedAt:n,t:s,wide:l,refresh:r,direction:i="used"}=e,d=Ct(t?.resetsAt),c=bn(t?.resetsAt,s),u=lt(s("codingPlanRemain5h"),t,i,s),b=lt(s("codingPlanRemain7d"),o,i,s),g=u.level==="over"||b.level==="over"?"over":u.level==="warn"||b.level==="warn"?"warn":"ok",f=(C,N,y)=>{const p=N?.unlimited?s("quotaUnlimited"):Oe(y.label,i,s),k=st(N,s);return C+" "+p+(k?" · "+k:"")},m=[s("codingPlanMinimaxTitle"),f(s("codingPlanRemain5h"),t,u),f(s("codingPlanRemain7d"),o,b),n>0?s("goQuotaFetchedAt",{time:new Date(n).toLocaleTimeString()}):null,...r?Pe(s,r):[]].filter(Boolean).join(`
4
- `),x=a(E,null,a("div",{className:"cm-mm-title"},s("codingPlanMinimaxTitle")),u.row,b.row,c?a("div",{className:"cm-mm-reset"},"5h · "+c):null),h=a(E,null,a("div",{className:"cm-bbox-rail cm-num"},u.text),a("div",{className:"cm-bbox-rail cm-num"},b.text));return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},m),side:"right",delayMs:300},a("div",{...d,"data-cm-display":"plan","data-cm-plan":"minimax",className:"cm-bbox cm-mm"+(g==="ok"?"":" "+g)+(l===!1?" rail":"")+(r?" clickable"+(r.busy?" busy":""):""),...r?ke(r.busy,r.run):{}},l===!1?h:x))}function ls(e){const{state:t,wide:o,api:n}=e,s=t.codingPlans?.minimax,l=z(H(t.config)),r=Be(n?()=>n.refreshCodingPlan("minimax"):null);if(!s||s.status!=="ok")return null;const{five:i,seven:d}=na(s.windows);return i==null&&d==null?null:a(oa,{five:i,seven:d,fetchedAt:s.fetchedAt,t:l,wide:o,refresh:r,direction:ie(t.config,"plan")})}const rs="/plugins/dsh-openai-codex/auth/status",is={18e3:"five",604800:"weekly"};function gn(e){if(!Array.isArray(e))return null;const t=e.find(n=>n!==null&&typeof n=="object"&&n.id==="codex");if(!t||!Array.isArray(t.windows))return null;const o={};for(const n of t.windows){const s=n!==null&&typeof n=="object"?is[Number(n.windowSeconds)]:null;if(!s||typeof n.remainingPercent!="number"||!Number.isFinite(Number(n.remainingPercent)))continue;const l=Number(n.resetAt??n.resetsAt);o[s]={percent:Math.max(0,Math.min(100,Math.round((100-Number(n.remainingPercent))*10)/10)),resetsAt:Number.isFinite(l)&&l>0?new Date(l*1e3).toISOString():""}}return o}function cs(e){return e===null||typeof e!="object"||e.status!=="signed-in"?null:gn(e.usage?.rateLimits)}async function sa(e){const t=AbortSignal.timeout(8e3);let o;const n=new Promise((s,l)=>{o=()=>l(t.reason),t.addEventListener("abort",o,{once:!0})});try{return await Promise.race([Promise.resolve().then(()=>e(t)),n])}finally{t.removeEventListener("abort",o)}}async function us(e){try{const t=await sa(o=>U.rpc?.call("/api","codex-subscription/usage",{force:e},o));return t?.ok?gn(t.value?.rateLimits):null}catch{return null}}const U={source:"auto",listeners:[]},la=(e,t=null,o=null)=>Object.assign(U,{rpc:e,readPiAi:t,readChatgptSub:o,request:null,inFlight:null,fetchedAt:0,status:"idle",windows:{},message:""});la(null);const ra=()=>{const{rpc:e,readPiAi:t,readChatgptSub:o,request:n,inFlight:s,listeners:l,...r}=U;return r},ds=e=>(U.listeners.push(e),()=>{U.listeners=U.listeners.filter(t=>t!==e)}),vt=()=>{for(const e of U.listeners)try{e()}catch{}};async function At(e=!1,t=!1,o="auto"){if(!t)return;if(U.inFlight!==null&&U.source===o)return U.inFlight;if(!e&&U.source===o&&U.fetchedAt>0&&Date.now()-U.fetchedAt<(U.status==="ok"?5:1)*6e4)return;const n={};U.request=n,U.source!==o&&Object.assign(U,{status:"idle",windows:{},fetchedAt:0,source:o}),vt();const s=Promise.resolve().then(async()=>{let l={},r="";try{if((o==="auto"||o==="subscription")&&(l=await us(e)??{}),Object.keys(l).length===0&&(o==="auto"||o==="pi-ai"))try{const i=await sa(()=>U.readPiAi?.());i?.ok===!0&&i.value?.status==="ok"?l=i.value.windows:i?.ok===!0&&i.value?.status==="error"&&(r=i.value.message)}catch{}if(Object.keys(l).length===0&&(o==="auto"||o==="chatgpt-sub"))try{const i=await sa(()=>ve.async("./client.codex.js").then(d=>d.readChatgptSubQuota(U.readChatgptSub)));i?.status==="ok"?l=i.windows:i?.status==="error"&&(r=i.message)}catch{}if(Object.keys(l).length===0&&(o==="auto"||o==="chatgpt"))try{l=await(await ve.async("./client.codex.js")).readChatgptQuota(e)??{}}catch{}if(Object.keys(l).length===0&&(o==="auto"||o==="connect")){const i=await fetch(rs,{credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});i.ok&&(l=cs(await i.json().catch(()=>null))??{})}}catch{}finally{if(U.request!==n)return;U.status=Object.keys(l).length>0?"ok":"unavailable",U.windows=l,U.message=Object.keys(l).length?"":r,U.fetchedAt=Date.now(),U.inFlight=null,vt()}});return U.inFlight=s,s}function Pt(e,t="auto"){const[o,n]=O(ra);return Y(()=>{if(!e)return;let s=!0;const l=()=>{s&&n(ra())},r=ds(l);l(),At(!1,!0,t);const i=setInterval(()=>{At(!1,!0,t)},6e4);return()=>{s=!1,clearInterval(i),r()}},[e,t,U.rpc]),o.source===t?o:{status:"idle",windows:{},fetchedAt:0}}function ps(e){const t=Ct(),{state:o,wide:n}=e,s=z(H(o.config)),l=o.config?.codexQuotaEnabled===!0&&o.config?.codexQuotaSidebar!==!1,r=o.config?.codexQuotaSource??"auto",i=Pt(l&&!e.preview,r),d=e.preview?o.displayPreviewCodex??(U.source===r?U:{status:"idle"}):i,c=Be(e.preview?null:l?()=>At(!0,l,r):()=>e.api.updateConfig({codexQuotaEnabled:!0,codexQuotaSidebar:!0}));if(!l&&(o.config?.codexQuotaSidebar===!1||o.codexCompat?.enabled!==!0))return null;if(!l)return a("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(n===!1?" rail":""),...ke(c.busy,c.run)},c.err||(n===!1?"Codex":s("codexQuotaEnable")));if(d.status!=="ok")return a("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(n===!1?" rail":""),title:d.message||s("codexQuotaUnavailable"),...ke(c.busy,c.run)},a("div",{className:"cm-mm-title"},n===!1?"Codex":s("codexQuotaTitle")),a("span",{className:"cm-hint"},n===!1?"—":d.status==="idle"||c.busy?s("refreshing"):d.message||s("codexQuotaUnavailable")));const u=[["five","codexQuotaFive","5h"],["weekly","codexQuotaWeek","7d"]].flatMap(([x,h,C])=>{const N=d.windows[x];if(!N)return[];const y=lt(C,N,"remaining",s,!0),p=new Date(typeof N.resetsAt=="string"?N.resetsAt:NaN),k=Number.isFinite(p.getTime())?s("codexQuotaReset",{time:p.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}):"";return[{...y,key:x,short:C,name:s(h),reset:k,win:N}]});if(!u.length)return null;const b=u.some(x=>x.pct>=100)?"over":u.some(x=>x.pct>=80)?"warn":"ok",g=[s("codexQuotaTitle"),...u.map(x=>x.name+" · "+x.text+(x.reset?" · "+st(x.win,s):"")),d.fetchedAt>0?s("goQuotaFetchedAt",{time:new Date(d.fetchedAt).toLocaleTimeString()}):null,...Pe(s,c)].filter(Boolean).join(`
5
- `),f=a(E,null,a("div",{className:"cm-bbox-head cm-codex-head"},a("div",{className:"cm-mm-title"},s("codexQuotaTitle")),a("div",{className:"cm-codex-resets"},...u.filter(x=>x.reset).map(x=>a("span",{key:x.key,className:"cm-mm-reset"},(u.length>1?x.short+" · ":"")+x.reset)))),...u.map(x=>x.row)),m=a(E,null,...u.map(x=>a("div",{className:"cm-bbox-rail cm-num"},x.text)));return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},g),side:"right",delayMs:300},a("div",{...t,"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(b==="ok"?"":" "+b)+(n===!1?" rail":"")+(c.busy?" busy":""),...ke(c.busy,c.run)},n===!1?m:f))}function We(e,t){return e.startsWith("core_")?"Core · "+We(e.slice(5),t):e==="fiveHour"||e==="5h"?"5h":e==="weekly"||e==="week"||e==="7d"?e==="7d"?"7d":t("goShortWeekly"):e==="monthly"||e==="month"?t("goShortMonthly"):e==="daily"||e==="day"?t("goShortDaily"):e==="plan"?t("mimoWindowPlan"):e==="compensation"?t("mimoWindowCompensation"):e==="balance"?t("codingPlanWindowBalance"):String(e).replace(/_/g," ")}function Mt(e,t){const o=n=>{const s=n.replace(/^core_/,"").toLowerCase().replace(/[^a-z0-9]/g,"");return/^(fivehour|five|5h|rolling|session)$/.test(s)?0:/^(daily|day|1d)$/.test(s)?1:/^(weekly|week|7d|sevenday)$/.test(s)?2:/^(monthly|month|30d)$/.test(s)?3:4};return Object.entries(e??{}).filter(([n])=>t!=="volcengine"||[0,2,3].includes(o(n))).sort((n,s)=>o(n[0])-o(s[0]))}function ms(e){const t=Ct(),{id:o,state:n,wide:s,api:l}=e,r=n.codingPlans?.[o],i=z(H(n.config)),d=Be(l?()=>l.refreshCodingPlan(o):null),c=De.find(k=>k.id===o);if(!c||!r||r.status!=="ok")return null;const u=r.windows!==null&&typeof r.windows=="object"?r.windows:{},b=Mt(u,o);if(b.length===0)return null;const g=k=>k!==null&&typeof k=="object"&&typeof k.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(k.percent)||0))):null,f=ie(n.config,"plan"),m=(o==="workbuddy"||o==="opendesign")&&u.balance?.text?i("codingPlanWindowBalance")+": "+u.balance.text:null,x=(m?b.filter(([k])=>k!=="balance"):b).map(([k,w])=>{const v=g(w);if(v===null)return a("div",{key:k,className:"cm-mm-row wide"},a("span",{className:"cm-mm-text"},typeof w?.text=="string"?w.text:"—"));const R=v>=100?"over":v>=80?"warn":"ok",j=we(v,f);return a("div",{key:k,className:"cm-mm-row wide"+(R==="ok"?"":" "+R)},a("span",{className:"cm-bbox-label"},We(k,i)),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:j.width+"%"}})),a("span",{className:"cm-bbox-pct cm-num"},j.label===null?"—":j.label+"%"))}),h=b.map(([k,w])=>{const v=g(w),R=st(w,i),j=v===null?typeof w?.text=="string"?w.text:"—":Oe(we(v,f).label,f,i);return We(k,i)+" "+j+(R?" · "+R:"")});r.fetchedAt>0&&h.push(i("goQuotaFetchedAt",{time:new Date(r.fetchedAt).toLocaleTimeString()})),r.message&&h.push(r.message),h.push(...Pe(i,d));const C=[i(c.labelKey),...h].join(`
6
- `),N=b.map(([,k])=>g(k)).filter(k=>k!==null),y=N.some(k=>k>=100)?"over":N.some(k=>k>=80)?"warn":"ok",p=N.length>0?N.slice(0,2).map(k=>we(k,f).label+"%").join(" "):typeof b[0][1]?.text=="string"?b[0][1].text:"—";return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},C),side:"right",delayMs:300},a("div",{...t,"data-cm-display":"plan","data-cm-plan":o,className:"cm-bbox cm-mm clickable"+(y==="ok"?"":" "+y)+(s===!1?" rail":"")+(d.busy?" busy":""),...ke(d.busy,d.run)},s===!1?a("div",{className:"cm-bbox-rail cm-num"},p):a(E,null,a("div",{className:m?"cm-mm-title cm-mm-row wide":"cm-mm-title"},i(c.labelKey),m&&a("span",{className:"cm-mm-text"},m)),...x)))}const yn=e=>{try{return window.localStorage?.getItem?.("cm.gw."+e)??""}catch{return""}},fs=(e,t)=>{try{window.localStorage?.setItem?.("cm.gw."+e,t)}catch{}};function bs(e){const t=Ct(),{source:o,snapshot:n,state:s,wide:l,api:r}=e,i=z(H(s.config)),[d,c]=O(()=>({source:o.id,id:yn(o.id)})),u=Be(r?()=>r.refreshGatewayQuota(o.id):null),b=ie(s.config,"plan"),g=n.accounts.length>1,f=d.source===o.id?d.id:yn(o.id),m=n.accounts.findIndex(T=>T.id===f),x=m>=0?m:Math.max(0,n.accounts.findIndex(T=>T.windows.length>0||T.credits!=null)),h=n.accounts[x]??n.accounts[0],C=h?.label||h?.id||"",N=T=>g?(La[T.provider]??T.provider)+" · ":"",y=g&&h?[h]:n.accounts,p=[];for(const T of y){if(p.length>=4)break;for(const le of T.windows){if(p.length>=4)break;const Le=N(T)+(le.label||le.id||i("gatewaySourceUnknown"));p.push({win:le,name:Le,view:lt(Le,le,b,i)})}T.windows.length===0&&T.credits!=null&&p.push({win:null,name:N(T)+(T.credits.unit||"credits"),text:(T.credits.used??"—")+" / "+(T.credits.limit??"—")})}p.length===0&&p.push({name:i("gatewayQuotaEmpty"),text:"—"});const k=p.some(T=>T.view?.level==="over")?"over":p.some(T=>T.view?.level==="warn")?"warn":"ok",w=p.map(T=>{if(T.text!=null)return T.name+" "+T.text;const le=st(T.win,i);return T.name+" "+Oe(T.view.label,b,i)+(le?" · "+le:"")});n.fetchedAt>0&&w.push(i("goQuotaFetchedAt",{time:new Date(n.fetchedAt).toLocaleTimeString()})),w.push(...Pe(i,u));const R=[g&&C?`${o.label||o.id} (${x+1}/${n.accounts.length} · ${C})`:o.label||o.id,...w].join(`
7
- `),j=p.map((T,le)=>T.text!=null?a("div",{key:le,className:"cm-mm-row wide"},a("span",{className:"cm-bbox-label"},T.name),a("span",{className:"cm-mm-text cm-num"},T.text)):a(E,{key:le},T.view.row)),A=T=>{if(!T.key||T.key==="Enter"||T.key===" "){T.stopPropagation(),T.preventDefault?.();const le=n.accounts[(x+1)%n.accounts.length];fs(o.id,le.id),c({source:o.id,id:le.id})}},B=g?a("span",{className:"cm-gw-switcher","aria-label":i("gatewaySwitchAccount",{account:C||x+1}),onClick:A,onKeyDown:A,role:"button",tabIndex:0},`${x+1}/${n.accounts.length} ⇄`):null,F=g?a("div",{className:"cm-bbox-head"},a("div",{className:"cm-mm-title"},o.label||o.id),B):a("div",{className:"cm-mm-title"},o.label||o.id),G=g&&C?a("div",{className:"cm-gw-sub"},C):null,ae=a(E,null,F,G,...j),K=p.filter(T=>T.view).map(T=>T.view.label).filter(T=>T!==null),$=K.length>0?K.slice(0,2).map(T=>T+"%").join(" "):p[0].text??"—",M=a("div",{className:"cm-bbox-rail cm-num"},$);return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},R),side:"right",delayMs:300},a("div",{...t,"data-cm-display":"gateway","data-cm-source":o.id,className:"cm-bbox cm-mm clickable"+(k==="ok"?"":" "+k)+(l===!1?" rail":"")+(u.busy?" busy":""),...ke(u.busy,u.run)},l===!1?a(E,null,M,B):ae))}function gs(e,t,o,n){const s=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:[],l=[];for(const r of t.gatewayQuotas?.sources??[]){if(r.enabled===!1||r.display!=="sidebar"&&r.display!=="both")continue;const i=s.find(d=>d.id===r.id);!i||i.status!=="ok"&&i.status!=="partial"&&i.status!=="stale"||i.accounts.length===0||l.push(a(bs,{key:"gateway:"+r.id,source:r,snapshot:i,state:e,wide:o,api:n}))}return l}const ys={anthropic:"Claude",zai:"Z.ai",minimax:"MM",kimi:"Kimi",openrouter:"OR",siliconflow:"SF",commandcode:"CC",clinepass:"CP",scnet:"SCNet",volcengine:"Ark",qwen:"Qwen",mimo:"MiMo",factory:"Factory",opendesign:"OpenDesign"};function hn(e,t,o){return e?.enabled!==!0?!1:typeof e.showInComposer=="boolean"?e.showInComposer:e.display!=="off"&&t?.enabled===!0&&t[o]!==!1}function ia(e,t,o){const n=e?.display??"settings";return(typeof e?.showInComposer=="boolean"?e.showInComposer:n!=="off"&&t?.enabled===!0&&t[o]!==!1)?{off:"composer",both:"all"}[n]??n+"-composer":n}function ca(e){const t={composer:"off","sidebar-composer":"sidebar","settings-composer":"settings",all:"both"}[e];return{display:t??e,showInComposer:t!==void 0}}function ua(e){return[["sidebar","balanceSidebar"],["settings","balanceSettings"],["both","quotaSidebarSettings"],["composer","quotaComposer"],["sidebar-composer","quotaSidebarComposer"],["settings-composer","quotaSettingsComposer"],["all","quotaAllPositions"],["off","off"]].map(([t,o])=>a("option",{key:t,value:t},e(o)))}function hs(e){const t=e.useCost?e.useCost(N=>N):void 0,o=t?.state?.config;Pt(o?.codexQuotaEnabled===!0&&o.codexQuotaStrip!==!1&&o.quotaStrip?.enabled===!0,o?.codexQuotaSource);const[n,s]=O(null),[l,r]=O({}),i=t?.state,d=e.api;if(!i)return null;const c=i.config,u=c.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};if(u.enabled!==!0&&c.goQuota?.showInComposer!==!0&&!Object.values(c.codingPlans??{}).some(N=>N.enabled===!0&&N.showInComposer===!0))return null;const b=z(H(c)),g=[];if(u.enabled===!0&&u.budget!==!1){const N=c.budget??{enabled:!1,amount:100,period:"month"};if(N.enabled===!0){const y=Number(c.exchangeRate),k=(i.budgetUsed??(N.period==="day"?Q(i.today,c):N.period==="all"?Q(i.total,c):Q(i.month,c)))*(Number.isFinite(y)&&y>0?y:1),w=Math.max(0,Number(N.amount)||0);if(w>0){const v=Math.min(999,k/w*100),R=v>=100?"over":v>=80?"warn":"ok";g.push({key:"budget",label:b("budgetShort"),level:R,tip:b("budgetOf",{period:b(Ye[N.period]??"periodMonth")})+" · "+b("usedOf",{used:de(k,c),amount:de(w,c)})+" · "+v.toFixed(1)+"%",segs:[{name:"main",pct:Math.round(we(Math.min(100,v),ie(c,"budget")).width)}]})}}}if(hn(c.goQuota,u,"go")){const N=i.goQuota;if(c?.goQuota?.enabled!==!1&&N?.status==="ok"){const y=c.goQuota.main==="weekly"||c.goQuota.main==="monthly"?c.goQuota.main:"rolling",p=y==="rolling"?N.rolling:y==="weekly"?N.weekly:N.monthly;if(p!==null&&typeof p=="object"&&typeof p.percent=="number"){const k=Math.max(0,Math.min(100,Math.round(Number(p.percent)||0))),w=k>=100?"over":k>=80?"warn":"ok",v=typeof p.resetsAt=="string"&&p.resetsAt.length>0?" · "+b("goResetAt",{time:new Date(p.resetsAt).toLocaleString()}):"";g.push({key:"go",label:"Go "+b(y==="rolling"?"goShortRolling":y==="weekly"?"goShortWeekly":"goShortMonthly"),level:w,tip:fn(N,c,b),segs:[{name:"main",pct:Math.round(we(k,ie(c,"go")).width)}]})}}}for(const N of De){const y=i.codingPlans?.[N.id];if(!hn(c.codingPlans?.[N.id],u,"plans")||!y||y.status!=="ok")continue;const p=y.windows!==null&&typeof y.windows=="object"?y.windows:{},k=Mt(p,N.id),w=N.id==="factory"?[k.filter(([v])=>!v.startsWith("core_")),k.filter(([v])=>v.startsWith("core_"))]:[k];for(const[v,R]of w.entries()){if(R.length===0)continue;const j=ys[N.id]??N.id,A=[],B=[];y.message&&B.push(y.message);let F=0,G=0;for(const[ae,K]of R){const $=We(ae,b),M=typeof K?.resetsAt=="string"&&K.resetsAt.length>0?" · "+b("goResetAt",{time:new Date(K.resetsAt).toLocaleString()}):"",T=K!==null&&typeof K=="object"&&typeof K.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(K.percent)||0))):null;if(B.push($+" "+(T===null?typeof K?.text=="string"?K.text:"—":T+"%")+M),T===null){A.push({name:ae,pct:null,text:typeof K?.text=="string"?K.text:"—"});continue}G>=(N.id==="factory"?3:2)||(G+=1,A.push({name:ae,pct:Math.round(we(T,ie(c,"plan")).width)}),F=Math.max(F,T>=100?2:T>=80?1:0))}y.fetchedAt>0&&B.push(b("goQuotaFetchedAt",{time:new Date(y.fetchedAt).toLocaleTimeString()})),A.length!==0&&g.push({key:N.id+(v?":core":""),label:j+(N.id==="factory"?v?" Core":" Standard":""),level:["ok","warn","over"][F],tip:B.join("; "),segs:A})}}const f=u.enabled===!0&&c.codexQuotaEnabled===!0&&c.codexQuotaStrip!==!1&&U.source===(c.codexQuotaSource??"auto")&&U.status==="ok"?U.windows:{},m=f.five??null,x=f.weekly??null,h=N=>Math.max(0,Math.min(100,Math.round(Number(N.percent)||0)));if(m!==null||x!==null){const N=m===null?null:h(m),y=x===null?null:h(x),p=Math.max(N??0,y??0);g.push({key:"codex",label:"Codex",level:p>=100?"over":p>=80?"warn":"ok",tip:b("codexQuotaTitle")+": "+[N===null?null:"5h "+Oe(100-N,"remaining",b),y===null?null:b("codingPlanRemain7d")+" "+Oe(100-y,"remaining",b)].filter(Boolean).join(" · "),segs:[N===null?null:{name:"5h",pct:100-N},y===null?null:{name:"weekly",pct:100-y}].filter(Boolean)})}if(g.length===0)return null;const C=N=>{n!==null||!d||(s(N),r(y=>({...y,[N]:null})),Promise.resolve().then(()=>N==="budget"?d.reload():N==="go"?d.refreshGoQuota():N==="codex"?At(!0,c.codexQuotaEnabled===!0,c.codexQuotaSource):N==="factory:core"?d.refreshCodingPlan("factory"):d.refreshCodingPlan(N)).catch(y=>{r(p=>({...p,[N]:y?.message??String(y)}))}).finally(()=>s(null)))};return a("div",{className:"cm-qstrip"},g.map(N=>{const y=n===N.key,p=l[N.key],k=[a("span",{className:"cm-qlabel",key:"l"},N.label)];y?k.push(a("span",{className:"cm-qtext",key:"busy"},b("refreshing"))):N.segs.forEach((v,R)=>{R>0&&k.push(a("span",{className:"cm-qsep",key:"sep"+R,"aria-hidden":"true"})),v.pct===null?k.push(a("span",{className:"cm-qtext",key:v.name},v.text)):k.push(a("span",{className:"cm-qseg",key:v.name},a("span",{className:"cm-qbar"},a("span",{className:"cm-qfill",style:{width:v.pct+"%"}})),a("span",null,N.key==="codex"?(N.segs.length>1?(v.name==="5h"?"5h":b("goShortWeekly"))+" ":"")+Oe(v.pct,"remaining",b):v.pct+"%")))});const w=[N.tip];return!y&&d&&w.push(b("clickToRefresh")),y&&w.push(b("refreshing")),p&&w.push("⚠ "+b("balanceRefreshFailed",{message:p})),a(J,{portal:!0,key:N.key,label:w.join("; "),side:"bottom",delayMs:400},a("span",{className:"cm-qchip"+(d?" action":"")+(N.level==="ok"?"":" "+N.level),...d?ke(y,()=>C(N.key)):{}},k))}))}const rt="dsh-cost-meter:simple-guide-dismissed";function da(e){if(e?.sidebarSimplePromptSeen===!0)return!0;try{return window.localStorage.getItem(rt)==="1"}catch{return!1}}function ks(e){const t=e.useCost?e.useCost(m=>m):void 0,o=fe(!1),[n,s]=O(!1),[l,r]=O(!1),[i,d]=O(!1),c=t?.state?.config,u=!!c&&!i&&!da(c);if(Y(()=>{const m=()=>d(!0);return window.addEventListener?.(rt,m),()=>window.removeEventListener?.(rt,m)},[]),!u)return null;const b=z(H(c)),g=()=>{d(!0);try{window.localStorage.setItem(rt,"1")}catch{}window.dispatchEvent?.(new Event(rt))},f=async m=>{if(!o.current){o.current=!0,s(!0),r(!1);try{if((await e.api.updateConfig({sidebarSimple:m,sidebarSimplePromptSeen:!0}))?.config?.sidebarSimple!==m)throw new Error;g()}catch{r(!0)}finally{o.current=!1,s(!1)}}};return a(dn,{actions:{close:g,keep:()=>f(!1),enable:()=>f(!0)},className:"cm-qguide",role:"dialog","aria-label":b("sidebarSimpleTitle"),"aria-busy":n,onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),g())}},a("div",{className:"cm-bbox-head"},a("h4",null,b("sidebarSimpleTitle")),a("button",{type:"button",className:"cm-btn small","aria-label":b("closeGuide"),"data-cm-action":"close",onClick:g},"×")),a("p",null,b("sidebarSimpleBody")),l?a("p",{role:"alert"},b("sidebarSimpleError")):null,a("div",{className:"cm-buttons"},a("button",{type:"button",className:"cm-btn small","data-cm-action":"keep",disabled:n,onClick:()=>f(!1)},b("sidebarSimpleOff")),a("button",{type:"button",className:"cm-btn small primary","data-cm-action":"enable",disabled:n,onClick:()=>f(!0)},b("sidebarSimpleOn"))))}function xs(e){const t=e.useCost?e.useCost(i=>i):void 0,o=fe(!1),n=t?.state;if(!n)return null;const s=n.config;if(!da(s)||s.quotaStrip?.promptSeen===!0)return null;const l=z(H(s)),r=i=>{if(o.current===!0)return;o.current=!0;const d=s.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};e.api.updateConfig({quotaStrip:{...d,enabled:i,promptSeen:!0}}).catch(()=>{o.current=!1})};return a("div",{className:"cm-qguide",role:"dialog","aria-label":l("quotaStripGuideTitle")},a("h4",null,l("quotaStripGuideTitle")),a("p",null,l("quotaStripGuideBody")),a("div",{className:"cm-buttons"},a("button",{type:"button",className:"cm-btn small",onClick:()=>r(!1)},l("quotaStripGuideOff")),a("button",{type:"button",className:"cm-btn small primary",onClick:()=>r(!0)},l("quotaStripGuideOn"))))}const kn="dsh-cost-meter:balance-click-hint-seen",ws=()=>{try{return window.localStorage.getItem(kn)==="1"}catch{return!1}},Ns=()=>{try{window.localStorage.setItem(kn,"1")}catch{}};function Ss(e){const t=e.useCost?e.useCost(f=>f):void 0,o=fe(!1),[n,s]=O(!1),[l]=O(ws),r=t?.state;if(!r)return null;const i=r.config,d=i.balance?.display==="sidebar"||i.balance?.display==="both",c=(i?.customBalances??[]).some(f=>f?.enabled===!0&&(f.display==="sidebar"||f.display==="both"))||i.customBalance?.enabled===!0&&(i.customBalance?.display==="sidebar"||i.customBalance?.display==="both"),u=De.some(f=>{const m=i.codingPlans?.[f.id];return m?.enabled===!0&&(m.display==="sidebar"||m.display==="both")});if(n||l||i.balance?.clickHintSeen===!0||!d&&!c&&!u||!da(i)||i.quotaStrip?.promptSeen!==!0)return null;const b=z(H(i)),g=()=>{o.current!==!0&&(s(!0),o.current=!0,Ns(),e.api.updateConfig({balance:{...i.balance??{},clickHintSeen:!0}}).catch(()=>{o.current=!1,s(!1)}))};return a("div",{className:"cm-qguide",role:"dialog","aria-label":b("balanceClickGuideTitle")},a("h4",null,b("balanceClickGuideTitle")),a("p",null,b("balanceClickGuideBody")),a("div",{className:"cm-buttons"},a("button",{type:"button",className:"cm-btn small primary",onClick:g},b("balanceClickGuideOk"))))}function xn(e,t,o){const n=t.sidebarTodayMetric??"cost";return a("span",{className:"cm-today-values","data-both":n==="both"},n!=="tokens"?a("span",{"data-cm-today":"cost"},W(Q(e,t),t)):null,n!=="cost"?a("span",{"data-cm-today":"tokens"},L(["input","output","cacheRead","cacheWrite"].reduce((s,l)=>s+(Number(e?.[l])||0),0))+" "+o("tokensUnit")):null)}function Tt(e){const{state:t,wide:o}=e,n=t.today,s=t.config,l=z(H(s)),r=xn(n,s,l),i=s.budget??{enabled:!1,amount:100,period:"month"},d=Number(s.exchangeRate),u=(t.budgetUsed??(i.period==="day"?Q(t.today,s):i.period==="all"?Q(t.total,s):Q(t.month,s)))*(Number.isFinite(d)&&d>0?d:1),b=Math.max(0,Number(i.amount)||0),g=b>0?Math.min(999,u/b*100):null,f=g===null?"ok":g>=100?"over":g>=80?"warn":"ok";if(i.enabled===!0&&s.hideBudget!==!0&&e.todayOnly!==!0){const x=[l("budgetOf",{period:l(Ye[i.period]??"periodMonth")}),l("usedOf",{used:de(u,s),amount:de(b,s)})+" · "+(g===null?"—":g.toFixed(1)+"%"),l("monthTotal",{month:W(Q(t.month,s),s),total:W(Q(t.total,s),s)})].join("; ");if(e.summary===!0)return a(J,{portal:!0,label:x,side:"right",delayMs:300},a("div",{"data-cm-display":"budget",className:"cm-simple-summary"+(f==="ok"?"":" "+f),tabIndex:0},a("span",null,l("budgetOf",{period:l(Ye[i.period]??"periodMonth")})),a("span",{className:"cm-num"},de(u,s)+" / "+de(b,s))));const h=as(t,s,l);return a(J,{portal:!0,label:x,side:"right",delayMs:300},a("div",{"data-cm-display":"budget",className:"cm-bbox"+(f==="ok"?"":" "+f)+(o?"":" rail")},o?h.body:a("div",{className:"cm-bbox-rail cm-num"},h.rail)))}const m=[s.sidebarTodayMetric==="tokens"?l("todayTokensTitle"):l("todayCostTitle"),l("callsTokens",{calls:n.calls,input:L(n.input),cache:L(n.cacheRead+n.cacheWrite),output:L(n.output)}),l("monthCost",{amount:W(Q(t.month,s),s)}),l("totalCost",{amount:W(Q(t.total,s),s)})].join("; ");return a(J,{portal:!0,label:m,side:"right",delayMs:300},a("div",{"data-cm-display":"today",className:"cm-foot"+(o?"":" cm-foot-rail")},o?a(E,null,a("span",null,l("today")),a("span",{className:"cm-num cm-bal-amt"},r)):a(Nt,{size:16})))}function Cs(e){const t=e.useCost?e.useCost(l=>l):void 0;Pt(t?.state?.config?.codexQuotaEnabled===!0&&t?.state?.config?.codexQuotaSidebar!==!1,t?.state?.config?.codexQuotaSource);let o;if(e.useProjection)try{o=e.useProjection("costUsage")}catch{o=void 0}Za(e,o);const n=t?.state,s=n?{...n,config:aa(n,o?.provider)}:null;return s?Rt(s,!!e.wide,e.api):null}function Rt(e,t,o,n=!1){const s=aa(e),l=z(H(s)),r=(s.balance?.display==="sidebar"||s.balance?.display==="both")&&s.hideOfficialBalance!==!0,d=St(e,s).length>0,c=r&&s.balance?.showProgressBar===!0&&e.balance?.status==="ok",u=d&&s.balance?.showProgressBar===!0,b=s.goQuota?.main==="weekly"||s.goQuota?.main==="monthly"?s.goQuota.main:"rolling",g=s.goQuota?.enabled!==!1&&(s.goQuota?.display==="sidebar"||s.goQuota?.display==="both")&&e.goQuota?.status==="ok"&&e.goQuota?.[b]!==null,f=De.map(A=>A.id).filter(A=>{const B=s.codingPlans?.[A];if(B?.enabled!==!0||B.display!=="sidebar"&&B.display!=="both")return!1;const F=e.codingPlans?.[A];if(F?.status!=="ok")return!1;const G=F.windows!==null&&typeof F.windows=="object"?F.windows:{};return Object.keys(G).length>0}),m=f.length>0,x=gs(e,s,t,o),h=s.codexQuotaSidebar!==!1&&(s.codexQuotaEnabled===!0||e.codexCompat?.enabled===!0),C=(s.budget??{}).enabled===!0&&s.hideBudget!==!0,N=s.sidebar!==!1&&s.hideTodayCost!==!0,y=_e(s,Date.now())!==null,p=s.sidebarModels?.enabled===!0;if(!p&&!r&&!d&&!g&&!m&&!h&&!C&&!N&&!y&&x.length===0)return null;const k=s.sidebarSimple===!0,w=!k&&t&&s.sidebarStyle==="compact",v=[];k&&t&&N&&!s.sidebarTodayBalanceInline&&v.push(a("div",{key:"today","data-cm-display":"today",className:"cm-simple-summary"},a("span",null,l("today")),a("span",{className:"cm-num"},xn(e.today,s,l)))),c?v.push(a(Uo,{key:"balance",state:e,wide:t,api:o})):r&&v.push(a(qo,{key:"balance",state:e,wide:t,api:o})),u?v.push(a(_o,{key:"customBalance",state:e,wide:t,api:o})):d&&v.push(a(Go,{key:"customBalance",state:e,wide:t,api:o}));const R=v.length;m&&v.push(...f.map(A=>A==="minimax"?a(ls,{key:"plan:"+A,state:e,wide:t,api:o}):a(ms,{key:"plan:"+A,id:A,state:e,wide:t,api:o}))),v.push(...x),h&&v.push(a(ps,{key:"codex",state:e,wide:t,api:o,preview:n})),g&&v.push(a(os,{key:"go",state:e,wide:t})),C&&v.push(a(Tt,{key:"budget",state:e,wide:t,summary:k&&t})),N&&(!(k&&t)||s.sidebarTodayBalanceInline)&&v.push(a(Tt,{key:"today",state:e,wide:t,todayOnly:!0})),y&&v.push(a(E,{key:"peak"},t?mn(e,s.sidebarStyle==="summary"&&!s.sidebarSimple?{...s,peakProgressVariant:"summary"}:s,l):ts(e,s,l))),p&&v.splice(s.sidebarModels.position==="first"?0:s.sidebarModels.position==="afterBalance"?R:v.length,0,a(vs,{key:"models",state:e,wide:t,preview:n}));const j=s.sidebarOrder?.length?s.sidebarOrder:s.sidebarStyle==="summary"&&!k?["today","balance","peak"]:[];if(j.length){const A=B=>{const F=j.indexOf(B.key);return F<0?999:F};v.sort((B,F)=>A(B)-A(F))}return a("div",{...k?{tabIndex:0,role:"region","aria-label":l("sidebarSimple")}:{},className:"cm-footer-stack"+(s.sidebarTodayBalanceInline?" same-line":"")+(t?"":" rail")+(w?" compact":"")+(k?" simple":s.sidebarStyle==="summary"&&t?" summary":"")},...v)}const wn={enabled:!1,period:"today",topN:5,summary:"total",position:"last",defaultOpen:!1,remember:!0,tokens:!1,shares:!0,refreshSeconds:60,dock:!1},Nn="dsh-cost-meter:models-open";function Sn(e,t,o){return An(e,e.config,o,t).map(n=>({...n,label:e.modelLabels?.[n.key]??(n.key==="deepseek:legacy"?n.label:ut(n.key)),cost:Q(n,e.config)})).sort((n,s)=>s.cost-n.cost||s.tokens-n.tokens||n.key.localeCompare(s.key))}function vs({state:e,wide:t,preview:o=!1}){const n={...wn,...e.config.sidebarModels},s=z(H(e.config)),l=()=>{try{const y=n.remember?window.localStorage.getItem(Nn):null;if(y!==null)return y==="1"}catch{}return n.defaultOpen},[r,i]=O(l),[d,c]=O(n.period);Y(()=>c(n.period),[n.period]);const u=fe(n.defaultOpen);Y(()=>{i(o&&u.current!==n.defaultOpen?n.defaultOpen:l()),u.current=n.defaultOpen},[n.defaultOpen,n.remember]);const b=Sn(e,d,s),g=b.reduce((y,p)=>y+p.cost,0),f=y=>W(y,e.config),m=s(d==="history"?"modelStatsHistory":"modelStatsToday")+" "+f(g)+" · "+s("modelsCount",{n:b.length}),x=n.summary==="top"&&b.length?b[0].label+" "+f(b[0].cost):m,h=a(E,null,a("span",{className:"cm-bal-label"},n.summary==="top"&&b.length?b[0].label:s(d==="history"?"modelStatsHistory":"modelStatsToday")),a("span",{className:"cm-bal-amt cm-num"},n.summary==="top"&&b.length?f(b[0].cost):f(g)+" · "+s("modelsCount",{n:b.length}))),C=()=>{i(!r);try{n.remember&&!o&&window.localStorage.setItem(Nn,r?"0":"1")}catch{}};if(!t||e.config.sidebarSimple)return a("div",{"data-cm-display":"models",className:"cm-foot cm-num"+(t?"":" cm-foot-rail"),title:x+" · "+m},t?h:a(Nt,{size:16}));const N=b.slice(0,n.topN);return b.length>n.topN&&N.push(b.slice(n.topN).reduce((y,p)=>{for(const k of["cost","input","output","cacheRead","cacheWrite"])y[k]+=p[k];return y},{key:"other",label:s("modelsOther"),cost:0,input:0,output:0,cacheRead:0,cacheWrite:0})),a("div",{"data-cm-display":"models",className:"cm-bbox cm-model-costs"},a("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(r),title:m,onClick:C},a("span",{className:"cm-caret"+(r?" open":"")}),h),r?a(E,null,a("div",{className:"cm-buttons"},["today","history"].map(y=>a("button",{key:y,type:"button",className:"cm-mstats-tab"+(d===y?" active":""),"aria-pressed":d===y,onClick:()=>c(y)},s(y==="today"?"modelStatsToday":"modelStatsHistory")))),N.length?N.map(y=>a("div",{key:y.key},a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bal-label",title:y.label},y.label),a("span",{className:"cm-num cm-bal-amt"},f(y.cost))),n.shares?a("div",{className:"cm-bbox-bar",title:(g>0?y.cost/g*100:0).toFixed(1)+"%"},a("div",{className:"cm-bbox-fill",style:{width:(g>0?y.cost/g*100:0)+"%"}})):null,n.tokens?a("div",{className:"cm-mstats-note"},s("modelStatsInput")+" "+L(y.input)+" · "+s("modelStatsCache")+" "+L(y.cacheRead+y.cacheWrite)+" · "+s("modelStatsOutput")+" "+L(y.output)):null)):a("span",{className:"cm-note"},s("modelStatsEmpty"))):null)}function it(e){return a("div",{className:"cm-card"},a("p",{className:"cm-card-title"},e.title),a("div",{className:"cm-card-value cm-num"},e.value),a("p",{className:"cm-card-sub"},e.sub))}const pa=new WeakMap,ma=(e,t)=>e?.().then(o=>(pa.set(e,o),o.prefetch?.(t))).catch(()=>{});function As(e){const t=e.useCost?.(r=>r)?.state,o=t?.billionContext,[n,s]=O(null),l=t?.config?.billionContextNoticeEnabled!==!1&&o?.noticeId&&!t?.config?.billionContextNoticesSeen?.includes(o.noticeId)&&(o.unresolved>0||["needs_update","changed","bridge_missing"].includes(o.compatibility));return Y(()=>{if(!l)return;let r=!0;return e.api.loadStatistics().then(i=>{r&&s(()=>i.BillionCompatibilityNotice)}).catch(()=>{}),()=>{r=!1}},[!!l,e.api]),l&&n?a(n,{meter:o,config:t.config,api:e.api,locale:H(t?.config??{})}):null}function be(e){const t=e.load??e.api.loadStatistics,[o,n]=O(()=>pa.get(t)??null),[s,l]=O(""),[r,i]=O(0);return Y(()=>{let d=!0;if(l(""),typeof t=="function")return t().then(c=>{pa.set(t,c),d&&n(()=>c)},c=>{d&&l(String(c.message??c))}),()=>{d=!1}},[e.api,e.load,r]),o?a(o,{...e,formatMoneyUsd:W,formatTokens:L,resolveLocale:H}):e.quiet?null:a("div",{className:s?"":"cm-loading",role:s?"alert":"status","aria-label":H(e.state?.config)==="en"?"Loading":"正在读取"},s||a(E,null,a("i"),a("i"),a("i")),s?a("button",{className:"cm-btn",onClick:()=>i(d=>d+1)},"↻"):null)}const Ps="cm-stat-dialog";function Ms(e){const t=e.useCost?.(u=>u),o=t?.state,[n,s]=O(null),l=Ae.useRef(null),r=o?.config[e.entryPosition==="header"?"hideSessionCostHeader":"hideSessionCostDock"]===!0,i=!r&&!!e.sessionId&&n===e.sessionId;if(Y(()=>{i&&l.current?.showModal()},[i]),Y(()=>{s(null)},[e.sessionId,r]),!e.sessionId||r)return null;const d=H(o?.config)==="en",c=d?"Conversation cost details":"本会话费用明细";return a(E,null,a("button",{type:"button",className:"cm-btn cm-stat-entry cm-stat-"+(e.entryPosition||"dock"),title:c,"aria-label":c,"aria-haspopup":"dialog",onMouseEnter:()=>ma(e.api.loadStatistics,{state:o,sessionId:e.sessionId}),onFocus:()=>ma(e.api.loadStatistics,{state:o,sessionId:e.sessionId}),onClick:()=>s(e.sessionId)},d?"Cost details":"费用明细"),i?a("dialog",{ref:l,role:"dialog",className:Ps,"aria-label":c,onCancel:()=>s(null)},a("header",{className:"cm-stat-dialog-head"},a("strong",null,c),a("button",{type:"button",className:"cm-btn",autoFocus:!0,"aria-label":d?"Close":"关闭",onClick:()=>s(null)},"×")),a("div",{className:"cm-stat-dialog-body"},o?a(be,{key:e.sessionId,state:o,api:e.api,sessionId:e.sessionId}):a("p",{role:t?.error?"alert":"status"},t?.error||(d?"Loading…":"加载中…"),a("button",{type:"button",className:"cm-btn",onClick:()=>e.api.reload()},d?"Retry":"重试")))):null)}function Ts({state:e,t}){const o=e.externalUsage;if(!o)return null;const n=e.config,s=c=>W(Q(c,n),n),l=c=>t("callsTokens",{calls:c.calls,input:L(c.input),cache:L(c.cacheRead+c.cacheWrite),output:L(c.output)}),r=(c,u)=>({calls:c.calls+u.calls,input:c.input+u.input,output:c.output+u.output,cacheRead:c.cacheRead+u.cacheRead,cacheWrite:c.cacheWrite+u.cacheWrite,cost:Q(c,n)+u.cost,apiCost:Q(c,n)+u.cost}),i=(c,u)=>a("tr",{key:c},a("td",null,c),a("td",{className:"num"},String(u.calls)),a("td",{className:"num"},L(u.input)),a("td",{className:"num"},L(u.cacheRead+u.cacheWrite)),a("td",{className:"num"},L(u.output)),a("td",{className:"num"},s(u))),d=c=>a("div",{className:"cm-scroll"},a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,t("colDate")),...["colCalls","colInTok","colCacheTok","colOutTok","colCost"].map(u=>a("th",{className:"num"},t(u))))),a("tbody",null,c)));return a("section",{className:"cm-budget"},a("h3",{className:"cm-h"},t("externalUsage")),o.stale?a("p",{className:"cm-note"},t("externalStale")):null,a("div",{className:"cm-cards"},["today","month","total"].map((c,u)=>{const b=r(e[c],o.combined[c]);return a(it,{key:c,title:t("combinedUsage")+" · "+t(["cardToday","cardMonth","cardTotal"][u]),value:s(b),sub:l(b)})})),...o.sources.map(c=>a("details",{key:c.source},a("summary",null,c.source+" · "+t("cardToday")+" "+s(c.today)+" · "+t("cardMonth")+" "+s(c.month)+" · "+l(c.today)),d(["today","month","total"].map((u,b)=>i(t(["cardToday","cardMonth","cardTotal"][b]),c[u]))),a("p",{className:"cm-note"},t("externalHistory")),d(c.history.map(u=>i(u.date,u))))))}const ct=(e,t,o)=>a("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(e),onClick:t},a("span",{className:"cm-caret"+(e?" open":"")}),a("h3",{className:"cm-h"},o));function Rs(e){const{state:t,api:o}=e,n=z(H(t.config)),[s,l]=O(!1);return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(s,()=>l(!s),n("history"))),s?a("div",{className:"cm-collapse-body"},a(Bs,{state:t,api:o})):null)}function Bs(e){const{state:t,api:o}=e,n=z(H(t.config)),[s,l]=O(null),[r,i]=O({}),[d,c]=O(()=>new Set),u=t.history??[];if(u.length===0)return a("p",{className:"cm-empty"},n("noHistory"));const b=f=>{if(s===f){l(null);return}l(f),!(r[f]!==void 0||d.has(f))&&(c(m=>{const x=new Set(m);return x.add(f),x}),o.getDaySessions(f).then(m=>i(x=>({...x,[f]:Array.isArray(m?.sessions)?m.sessions:[]}))).catch(()=>i(m=>({...m,[f]:"error"}))).finally(()=>c(m=>{const x=new Set(m);return x.delete(f),x})))},g=f=>f.map(m=>a("tr",{key:m.id},fa(m,t.config?.showSessionId===!0,n),a("td",{className:"num"},String(m.calls)),a("td",{className:"num"},L(m.input)),a("td",{className:"num"},L(m.cacheRead+m.cacheWrite)),a("td",{className:"num"},L(m.output)),a("td",{className:"num"},W(Q(m,t.config),t.config))));return a("div",{className:"cm-scroll"},a("p",{className:"cm-hint",style:{padding:"6px 10px 0"}},n("historyExpandHint")),a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("colDate")),a("th",{className:"num"},n("colCalls")),a("th",{className:"num"},n("colInTok")),a("th",{className:"num"},n("colCacheTok")),a("th",{className:"num"},n("colOutTok")),a("th",{className:"num"},n("colCost")))),a("tbody",null,u.flatMap(f=>{const m=a("tr",{key:f.date,className:"cm-row-click",onClick:()=>b(f.date)},a("td",null,(s===f.date?"▾ ":"▸ ")+f.date),a("td",{className:"num"},String(f.calls)),a("td",{className:"num"},L(f.input)),a("td",{className:"num"},L(f.cacheRead+f.cacheWrite)),a("td",{className:"num"},L(f.output)),a("td",{className:"num"},W(Q(f,t.config),t.config)));if(s!==f.date)return[m];const x=r[f.date],h=d.has(f.date)&&x===void 0?a("p",{className:"cm-empty"},n("historySessionsLoading")):x==="error"?a("p",{className:"cm-empty"},n("historySessionsError")):!Array.isArray(x)||x.length===0?a("p",{className:"cm-empty"},n("historyNoSessions")):a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("colSession")),a("th",{className:"num"},n("colCalls")),a("th",{className:"num"},n("colInTok")),a("th",{className:"num"},n("colCacheTok")),a("th",{className:"num"},n("colOutTok")),a("th",{className:"num"},n("colCost")))),a("tbody",null,g(x)));return[m,a("tr",{key:f.date+"-sessions"},a("td",{colSpan:6},h))]}))))}function Os(e){const{state:t,api:o}=e,n=z(H(t.config)),[s,l]=O(!1),[r,i]=O(100),[d,c]=O("cost-desc"),[u,b]=O(null),[g,f]=O(!1),[m,x]=O(!1),h=Ae.useRef(0),C=(k,w)=>{const[v,R]=w==="recent"?["recent","desc"]:w.split("-"),j=++h.current;f(!0),x(!1),o.getTopSessions(k,v,R).then(A=>{j===h.current&&b(Array.isArray(A?.sessions)?A.sessions:[])}).catch(()=>{j===h.current&&x(!0)}).finally(()=>{j===h.current&&f(!1)})},N=()=>{l(k=>{const w=!k;return w&&u===null&&!g&&C(r,d),w})},y=k=>{i(k),(s||u!==null)&&C(k,d)},p=k=>{c(k),(s||u!==null)&&C(r,k)};return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(s,N,n("sessionRankTitle"))),s?a("div",{className:"cm-collapse-body"},a("p",{className:"cm-hint"},n("sessionRankHint")),a("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",margin:"6px 0"}},a("div",{className:"cm-field"},a("label",null,n("sessionRankSort")),a("select",{className:"cm-input",value:d,onChange:k=>p(k.target.value)},a("option",{value:"cost-desc"},n("sessionSortCostDesc")),a("option",{value:"cost-asc"},n("sessionSortCostAsc")),a("option",{value:"time-desc"},n("sessionSortTimeDesc")),a("option",{value:"time-asc"},n("sessionSortTimeAsc")),a("option",{value:"recent"},n("sessionSortRecent")))),a("div",{className:"cm-field"},a("label",null,n("sessionRankLimit")),a("select",{className:"cm-input",value:String(r),onChange:k=>y(Number(k.target.value))},a("option",{value:"50"},"50"),a("option",{value:"100"},"100"),a("option",{value:"200"},"200")))),g?a("p",{className:"cm-empty"},n("sessionRankLoading")):m?a("p",{className:"cm-empty"},n("sessionRankError")):u===null||u.length===0?a("p",{className:"cm-empty"},n("sessionRankEmpty")):a("div",{className:"cm-scroll"},a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("colDate")),a("th",null,n("colSession")),a("th",{className:"num"},n("colCalls")),a("th",{className:"num"},n("colInTok")),a("th",{className:"num"},n("colCacheTok")),a("th",{className:"num"},n("colOutTok")),a("th",{className:"num"},n("colCost")))),a("tbody",null,u.map(k=>a("tr",{key:k.date+":"+k.id},a("td",null,k.date),fa(k,t.config?.showSessionId===!0,n),a("td",{className:"num"},String(k.calls)),a("td",{className:"num"},L(k.input)),a("td",{className:"num"},L((k.cacheRead??0)+(k.cacheWrite??0))),a("td",{className:"num"},L(k.output)),a("td",{className:"num"},W(Q(k,t.config),t.config)))))))):null)}function Cn(e){const{state:t}=e,o=z(H(t.config)),n=t.today.sessions??[];if(n.length===0)return a("p",{className:"cm-empty"},o("noSessionsToday"));const s=t.config?.showSessionId===!0;return a("div",{className:"cm-scroll"},a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,o("colSession")),a("th",{className:"num"},o("colCalls")),a("th",{className:"num"},o("colInTok")),a("th",{className:"num"},o("colCacheTok")),a("th",{className:"num"},o("colOutTok")),a("th",{className:"num"},o("colCost")))),a("tbody",null,n.map(l=>a("tr",{key:l.id},fa(l,s,o),a("td",{className:"num"},String(l.calls)),a("td",{className:"num"},L(l.input)),a("td",{className:"num"},L(l.cacheRead+l.cacheWrite)),a("td",{className:"num"},L(l.output)),a("td",{className:"num"},W(Q(l,t.config),t.config)))))))}function fa(e,t,o){const n=typeof e.title=="string"?e.title.trim():"",s=String(e.id).slice(0,14)+"…",l=n.length>0?n:s,r=n.length>0?n+" · "+e.id:e.id;return a("td",{title:r},a("div",{className:"cm-sess-title"+(n.length===0?" cm-sess-id":"")},l),t&&n.length>0?a("div",{className:"cm-sess-id"},s):null)}const Ds={CNY:{symbol:"¥",decimals:4,exchangeRate:7.2},USD:{symbol:"$",decimals:6,exchangeRate:1},EUR:{symbol:"€",decimals:6,exchangeRate:.92}};function Ls(e){const{state:t,draft:o,setDraft:n,t:s}=e,l=t.config,r=o?.budget??l.budget,i=Number(l.exchangeRate),c=(t.budgetUsed??(r.period==="day"?Q(t.today,l):r.period==="all"?Q(t.total,l):Q(t.month,l)))*(Number.isFinite(i)&&i>0?i:1),u=Math.max(0,Number(r.amount)||0),b=r.enabled&&u>0?Math.min(999,c/u*100):null,g=b===null?"ok":b>=100?"over":b>=80?"warn":"ok",f=(h,C)=>{o!==null&&n({...o,budget:{...o.budget??l.budget,[h]:C}})},m=r.period==="custom"?r.customStart+" → "+(r.customEnd??s("periodDay")):null,x=r.enabled&&b!==null?s("budgetStatus",{period:s(Ye[r.period]??"periodMonth"),amount:de(u,l),used:de(c,l),pct:b.toFixed(1)})+(g==="over"?s("overLimit"):g==="warn"?s("nearLimit"):""):null;return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},a("h3",{className:"cm-h"},s("budget")),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:r.enabled===!0,onChange:h=>f("enabled",h.target.checked)}),a("span",null,s("enableBudget")))),r.enabled?a(E,null,a("div",{className:"cm-budget-bar"},a("div",{className:"cm-budget-fill "+(g==="ok"?"":g),style:{width:(b===null?0:Math.min(100,b))+"%"}})),a("div",{className:"cm-budget-line"+(g==="over"?" over":"")+" cm-num"},x),a("div",{className:"cm-budget-controls"},a("div",{className:"cm-field"},a("label",null,s("budgetAmountLabel")),Ge({value:r.amount},h=>f("amount",h))),a("div",{className:"cm-field"},a("label",null,s("budgetPeriodLabel")),a("select",{className:"cm-input",value:r.period,onChange:h=>f("period",h.target.value)},a("option",{value:"day"},s("periodDay")),a("option",{value:"month"},s("periodMonth")),a("option",{value:"all"},s("periodAll")),a("option",{value:"custom"},s("periodCustomRange")))),r.period==="custom"?a(E,null,a("div",{className:"cm-field"},a("label",null,s("startDate")),a("input",{className:"cm-input",type:"date",value:r.customStart??"",onChange:h=>f("customStart",h.target.value===""?null:h.target.value)})),a("div",{className:"cm-field"},a("label",null,s("endDate")),a("input",{className:"cm-input",type:"date",value:r.customEnd??"",onChange:h=>f("customEnd",h.target.value===""?null:h.target.value)}))):null),m!==null?a("p",{className:"cm-hint"},s("rangeText",{range:m})):null):a("p",{className:"cm-note"},s("budgetDisabledNote")))}function Es(e){const{state:t,draft:o,setDraft:n,t:s}=e,l=t.config,r=(u,b)=>{o!==null&&n({...o,[u]:b})},i=o===null?l:{...l,...o},d=(()=>{if(i.peakEnabled!==!0)return s("peakOff");const u=Date.parse(i.peakEffectiveAt||""),b=Date.now();if(Number.isFinite(u)&&b<u)return s("peakNotEffective",{time:new Date(u).toLocaleString()});const g=i.peakWindows??[],f=ta(b,g,i.peakHolidays);return f===null?s("offPeakActive"):f.holiday===!0?s("holidayAllOffPeak"):f.weekend===!0?s("weekendAllOffPeak"):f.inPeak?s("peakActive"):s("offPeakActive")})(),c=(i.peakWindows?.length??0)>0?s("peakSummary",{windows:i.peakWindows.map(u=>u.start+":00-"+u.end+":00").join(H(i)==="zh"?"、":", "),time:i.peakEffectiveAt||s("unknown"),status:d}):s("noPeakWindows",{status:d});return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},a("h3",{className:"cm-h"},s("peakPanelTitle")),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakEnabled!==!1,onChange:u=>r("peakEnabled",u.target.checked)}),a("span",null,s("peakEnabledLabel")))),a("div",{className:"cm-grid"},a("div",{className:"cm-field"},a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakNotice!==!1,onChange:u=>r("peakNotice",u.target.checked)}),a("span",null,s("peakNoticeLabel")))),a("div",{className:"cm-field"},a("label",null,s("peakStyleLabel")),a("select",{className:"cm-input",value:o?.peakStyle??"compact",onChange:u=>r("peakStyle",u.target.value)},a("option",{value:"progress"},H(o)==="en"?"Time progress":"时间进度条"),a("option",{value:"compact"},s("peakStyleCompact")),a("option",{value:"classic"},s("peakStyleClassic"))))),a("div",{className:"cm-grid"},a("div",{className:"cm-field"},a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakAlertEnabled!==!1,onChange:u=>r("peakAlertEnabled",u.target.checked)}),a("span",null,s("peakAlertLabel")))),a("div",{className:"cm-field"},a("label",null,s("peakAlertAheadLabel")),a("input",{className:"cm-input narrow",type:"number",min:"1",max:"30",step:"1",value:String(typeof o?.peakAlertAhead=="number"&&Number.isFinite(o.peakAlertAhead)&&o.peakAlertAhead>=1&&o.peakAlertAhead<=30?o.peakAlertAhead:2),onChange:u=>{const b=Number(u.target.value);Number.isInteger(b)&&b>=1&&b<=30&&r("peakAlertAhead",b)}})),a("div",{className:"cm-field"},a("label",null,s("peakAlertTargetLabel")),a("select",{className:"cm-input",value:o?.peakAlertTarget==="peak"||o?.peakAlertTarget==="offpeak"?o.peakAlertTarget:"both",onChange:u=>r("peakAlertTarget",u.target.value)},a("option",{value:"both"},s("peakAlertTargetBoth")),a("option",{value:"peak"},s("peakAlertTargetPeak")),a("option",{value:"offpeak"},s("peakAlertTargetOffPeak"))))),a("div",{className:"cm-grid"},a("div",{className:"cm-field"},a("label",null,s("peakAlertPositionLabel")),a("select",{className:"cm-input",value:o?.peakAlertPosition==="center"?"center":"corner",onChange:u=>r("peakAlertPosition",u.target.value)},a("option",{value:"corner"},s("peakAlertPositionCorner")),a("option",{value:"center"},s("peakAlertPositionCenter")))),a("div",{className:"cm-field"},a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakAlertWebNotify===!0,onChange:u=>{r("peakAlertWebNotify",u.target.checked),u.target.checked&&window.Notification&&Notification.permission==="default"&&Promise.resolve(Notification.requestPermission()).catch(()=>{})}}),a("span",null,s("peakAlertWebNotifyLabel"))),a("p",{className:"cm-hint"},s("peakAlertWebNotifyHint")))),a("div",{className:"cm-field"},a("label",null,s("peakAlertPreviewLabel")),a("div",{className:"cm-row"},a("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("peak")},s("peakAlertPreviewPeak")),a("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("offpeak")},s("peakAlertPreviewOffPeak")))),a("div",{className:"cm-peak-preview"},o?.peakEnabled!==!1&&o?.peakNotice!==!1?mn(t,i,s):a("p",{className:"cm-hint"},s("peakNoticeHiddenHint"))),a("p",{className:"cm-hint"},c),a("div",{className:"cm-field"},a("label",null,s("peakHolidaysLabel")),a("input",{className:"cm-input",defaultValue:(i.peakHolidays??[]).join(", "),onBlur:u=>r("peakHolidays",u.target.value.split(/[,,\s]+/).filter(Boolean))})),a("p",{className:"cm-hint"},s("weekendRuleNote")))}function Ge(e,t){const o=e.value;return a("input",{className:"cm-input narrow",type:"number",step:"any",min:"0",placeholder:e.placeholder,title:e.title,"aria-label":e.label,value:typeof o=="number"?String(o):"",onChange:n=>{const s=n.target.value;if(s===""){if(e.emptyMode==="clear"){t(null);return}if(e.emptyMode==="ignore")return;t(0);return}const l=Number(s);Number.isFinite(l)&&l>=0&&t(l)}})}function vn({value:e,entry:t,path:o,emptyMode:n,placeholder:s,label:l,title:r,t:i,onCommit:d}){const c=yt(t,o),u=e==null?"":String(e)+(t.multiplier!==void 0||t.separateMultipliers?" × "+c:""),[b,g]=O(u),[f,m]=O(!1),x=fe(!1);Y(()=>{x.current||g(u)},[u]);const h=()=>{if(!x.current)return;const C=b.trim().split(/\s*[×*xX]\s*/),N=/^[+]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;if(b.trim()===""){x.current=!1,m(!1),n==="clear"?d(null):g(u);return}if(C.length>2||!C.every(y=>N.test(y)&&Number.isFinite(Number(y)))||!Number.isFinite(Number(C[0])*(C.length===2?Number(C[1]):c))){m(!0);return}x.current=!1,m(!1),g(String(Number(C[0]))+(t.multiplier!==void 0||t.separateMultipliers||C.length===2?" × "+(C.length===2?Number(C[1]):c):"")),d(Number(C[0]),C.length===2?Number(C[1]):void 0)};return a("input",{className:"cm-input narrow",type:"text",value:b,placeholder:s,"aria-label":l,"aria-invalid":f,title:f?i("priceMultiplyInvalid"):[r,i(t.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll"),e==null?"":"= "+Number((e*c).toPrecision(12))].filter(Boolean).join(" · "),onChange:C=>{x.current=!0,g(C.target.value),m(!1)},onBlur:h,onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),h()),C.key==="Escape"&&(C.stopPropagation(),x.current=!1,m(!1),g(u))}})}function Bt(e,t,o){o!==void 0&&(e.separateMultipliers?e.multipliers={...e.multipliers,[t]:o}:e.multiplier=o)}function ba(e,t,o,n,s,l,r,i=0){const d=n==="cacheWrite",c=t?.[n]??(n==="cacheMiss"?t?.input:n==="cacheHit"?t?.cachedInput:void 0)??null,u=l({cacheHit:"flatCached",cacheMiss:"flatInput",cacheWrite:"flatCacheWrite",output:"flatOutput"}[n]);return a("label",{className:"cm-price-cell"},a("span",{className:"cm-price-cell-label"},u),a(vn,{entry:e,value:c,path:o+"."+n,t:l,emptyMode:d||!["base","cny"].includes(o)?"clear":"ignore",placeholder:d?String(t?.cacheHit??t?.cachedInput??t?.cacheMiss??t?.input??i):void 0,label:s+" · "+u,title:d?l("cacheWriteFallback"):void 0,onCommit:r}))}function ga(e,t,o){return a("div",{className:"cm-price-multiplier"},a("label",null,a("input",{type:"checkbox",checked:e.separateMultipliers===!0,onChange:n=>o(n.target.checked)}),t("priceMultiplySeparate")),a("span",{title:t(e.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll")},t("priceMultiplyHint")))}function Is(e){const{modelId:t,entry:o,isDefault:n,draft:s,setDraft:l,t:r}=e,i=Ze(o),d=f=>{const m={...Ze(f)};if(Array.isArray(f.rateHistory)){const x=f.rateHistory.filter(h=>Date.parse(h.before)<=Date.now());x.length>0?m.rateHistory=x:delete m.rateHistory}return m},c=f=>{const m=n?{...s.prices,default:f}:{...s.prices,models:{...s.prices.models,[t]:f}};l({...s,prices:m})},u=(f,m,x,h)=>{const C=n?s.prices.default:s.prices.models[t],N=d(C??{cacheHit:0,cacheMiss:0,output:0}),y=f==="base"?N:{...N[f]??(x===null?{}:Qe(N))};x===null?delete y[m]:y[m]=Math.max(0,x),f!=="base"&&(Object.keys(y).length?N[f]=y:delete N[f]),Bt(N,f+"."+m,h),c(N)},b=()=>{const f={...s.prices.models};delete f[t],l({...s,prices:{...s.prices,models:f}})},g=(f,m)=>{const x=m==="base"?i:i[m]??null;return a("div",{className:"cm-price-row",key:m},a("span",null,f),...["cacheMiss","cacheHit","cacheWrite","output"].map(h=>a(E,{key:h},ba(i,x,m,h,f,r,(C,N)=>u(m,h,C,N),i.cacheHit))))};return a("div",{className:"cm-price-card"},a("div",{className:"cm-price-head"},a("span",{className:"cm-price-name"},t),a("span",{className:"cm-price-unit"},s.prices.currency??"USD"),a(E,null,i?.legacy===!0?a("span",{className:"cm-price-legacy"},r("legacyModel")):null,n?a("span",{className:"cm-price-legacy"},r("defaultFallback")):null,n?null:a("button",{className:"cm-btn small danger",onClick:b},r("remove")))),a("div",{className:"cm-price-row cm-price-columns"},a("span",null,""),a("span",null,r("flatInput")),a("span",null,r("flatCached")),a("span",null,r("flatCacheWrite")),a("span",null,r("flatOutput"))),g(r("tierBase"),"base"),g(r("tierOffPeak"),"offPeak"),g(r("tierPeak"),"peak"),ga(i,r,f=>c({...o,separateMultipliers:f,multipliers:{}})),Array.isArray(o?.rateHistory)&&o.rateHistory.length>0?a("p",{className:"cm-note"},r("datedPriceNote")):null)}const js={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"},Hs=e=>e==="zen"?"go":e,ut=e=>e.replace(/^zen:/i,"go:").replace(/^(deepseek(?:-official|-account)?):deepseek-(?:v4(?:\.1)?-)?flash(?:-vision-exp)?$/i,"$1:DeepSeek V4.1 Flash");function An(e,t,o,n){const s=["input","output","cacheRead","cacheWrite","reasoning","cost","calls"],l=c=>Number.isFinite(Number(c))&&Number(c)>0?Number(c):0,r=(c,u,b)=>{if(!b||typeof b!="object")return;const g=c[u]??(c[u]=Object.fromEntries([...s,"apiCost"].map(m=>[m,0])));for(const m of s)g[m]+=l(b[m]);for(const m of bt)Number.isFinite(b[m])&&(g[m]=(g[m]??0)+b[m]);const f=u.indexOf(":");g.apiCost+=l(b.apiCost??(et(f>0?u.slice(0,f):"deepseek",f>0?u.slice(f+1):u,t)==="plan"?0:b.cost))},i=c=>{if(!c||typeof c!="object")return{};if(c.byProviderModel&&Object.keys(c.byProviderModel).length)return c.byProviderModel;if(c.byModel&&Object.keys(c.byModel).length)return Object.fromEntries(Object.entries(c.byModel).map(([b,g])=>[b.includes(":")?b:"deepseek:"+b,g]));const u={};for(const b of Array.isArray(c.sessions)?c.sessions:[])if(!(!b||typeof b!="object"))if(b.byProviderModel&&Object.keys(b.byProviderModel).length)for(const[g,f]of Object.entries(b.byProviderModel))r(u,g,f);else r(u,(b.provider||"deepseek")+":"+(b.model||"unknown"),b);return Object.keys(u).length?u:s.some(b=>l(c[b])>0)?{"deepseek:legacy":c}:{}};return(c=>{const u={},b=g=>{for(const[f,m]of Object.entries(g??{}))r(u,f,m)};if(c==="today")b(i(e.today));else{const g=Date.parse((e.meta?.dayKey||new Date().toISOString().slice(0,10))+"T00:00:00Z");for(const f of e.history??[]){const m=Date.parse(f.date+"T00:00:00Z");m<=g&&m>=g-76896e5&&b(i(f))}}return Object.entries(u).map(([g,f])=>{const m=g.indexOf(":"),x=(m>0?g.slice(0,m):"deepseek").toLowerCase(),h=m>0?g.slice(m+1):g,C=f.input+f.output+f.cacheRead+f.cacheWrite+f.reasoning,N=f.cacheRead+f.input;return{label:e.modelLabels?.[g]??(g==="deepseek:legacy"?o("modelStatsLegacy"):x==="deepseek"||x===""?h:Hs(x)+":"+h),key:g,...f,tokens:C,cls:et(x,h,t),hitRate:N>0?f.cacheRead/N:null,cacheUnreported:xo(f),blended:C>0&&f.cost>0?f.cost/C*1e6:null,perUsd:f.cost>0?C/f.cost:null}}).filter(g=>(g.tokens>0||g.cost>0)&&t.modelStatistics?.[g.key]?.[c==="today"?"today":"summary"]!==!1)})(n).sort((c,u)=>u.cost-c.cost||u.tokens-c.tokens)}function Qs(e){const{state:t,config:o,t:n,initialTab:s,draft:l,setDraft:r}=e,[i,d]=O(s==="history"?"history":"today"),[c,u]=O(!1),b=An(t,o,n,i),g=p=>(Math.max(0,Math.min(1,p))*100).toFixed(1)+"%",f=b.reduce((p,k)=>Math.max(p,k.cost),0),m=b.reduce((p,k)=>Math.max(p,k.tokens),0),x=b.reduce((p,k)=>Math.max(p,k.perUsd??0),0),h=(p,k)=>a("button",{className:"cm-mstats-tab"+(i===p?" active":""),onClick:()=>d(p)},k),C=p=>p.cls==="plan"?a("span",{className:"cm-plan-tag",title:n("billingClassLabel")+" · "+(ya(za(p.provider,o,p.model),n)||n("billingClassPlan"))},n("billingClassPlan")):null,N=p=>a("select",{className:"cm-input",title:n("billingClassLabel"),value:o.planBilling?.models?.[p.key]==="plan"&&o.planBilling?.modelPlans?.[p.key]?"plan:"+o.planBilling.modelPlans[p.key]:o.planBilling?.models?.[p.key]??"auto",disabled:l===null,onChange:k=>{const w={...l.planBilling?.models??{}},v={...l.planBilling?.modelPlans??{}},R=k.target.value;delete v[p.key],R.startsWith("plan:")?(w[p.key]="plan",v[p.key]=R.slice(5)):R==="auto"?delete w[p.key]:w[p.key]=R,r({...l,planBilling:{...l.planBilling,models:w,modelPlans:v}})}},a("option",{value:"auto"},n("billingClassAuto")),a("option",{value:"plan"},n("billingClassPlan")),a("option",{value:"api"},n("billingClassApi")),Ue.map(k=>a("option",{key:k,value:"plan:"+k},n("billingClassPlan")+" · "+ya(k,n)))),y=(p,k,w,v,R)=>a("div",{className:"cm-mstats-row"},R?a("div",{className:"cm-mstats-label"},a("span",{className:"cm-mstats-name",title:p},p),R):a("span",{className:"cm-mstats-name",title:p},p),a("div",{className:"cm-mstats-barbg"},a("div",{className:"cm-mstats-bar "+w,style:{width:g(k)}})),a("span",{className:"cm-mstats-val"},v));return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(c,()=>u(!c),n("modelStatsTitle"))),c?a("div",{className:"cm-collapse-body"},a("div",{className:"cm-mstats-tabs"},h("today",n("modelStatsToday")),h("history",n("modelStatsHistory"))),b.length===0?a("p",{className:"cm-note"},n("modelStatsEmpty")):a(E,null,a("div",{className:"cm-mstats-h"},n("modelStatsCostH")),b.map(p=>a(E,{key:"c:"+p.label},y(p.label,f>0?p.cost/f:0,"cost",W(p.cost,o),a(E,null,C(p),N(p),p.cacheUnreported?a("span",{className:"cm-plan-tag",title:n("modelStatsHitUnreportedTip")},"⚠"):null)))),a("div",{className:"cm-mstats-h"},n("modelStatsTokensH")),a("div",{className:"cm-mstats-legend"},a("span",null,a("span",{className:"cm-mstats-dot",style:{background:"var(--dsw-alias-state-business-primary)"}}),n("modelStatsInput")),a("span",null,a("span",{className:"cm-mstats-dot",style:{background:"#ff9800"}}),n("modelStatsCache")),a("span",null,a("span",{className:"cm-mstats-dot",style:{background:"#34a853"}}),n("modelStatsOutput"))),[...b].sort((p,k)=>k.tokens-p.tokens).map(p=>a("div",{className:"cm-mstats-row",key:"t:"+p.label},a("span",{className:"cm-mstats-name",title:p.label},p.label),a("div",{className:"cm-mstats-barbg"},a("div",{className:"cm-mstats-seg in",style:{width:g(m>0?p.input/m:0)}}),a("div",{className:"cm-mstats-seg cache",style:{width:g(m>0?(p.cacheRead+p.cacheWrite)/m:0)}}),a("div",{className:"cm-mstats-seg out",style:{width:g(m>0?(p.output+p.reasoning)/m:0)}})),a("span",{className:"cm-mstats-val"},L(p.tokens)))),a("div",{className:"cm-mstats-h"},n("modelStatsHitH")),[...b].sort((p,k)=>(k.hitRate??-1)-(p.hitRate??-1)).map(p=>a(E,{key:"h:"+p.label},y(p.label,p.hitRate??0,"hit",p.cacheUnreported?n("modelStatsHitUnreported"):p.hitRate===null?"—":(p.hitRate*100).toFixed(1)+"%",p.cacheUnreported?a("span",{className:"cm-plan-tag",title:n("modelStatsHitUnreportedTip")},"⚠"):null))),a("div",{className:"cm-mstats-h"},n("modelStatsValueH")),[...b].sort((p,k)=>(k.perUsd??-1)-(p.perUsd??-1)).map(p=>a(E,{key:"v:"+p.label},y(p.label,x>0?(p.perUsd??0)/x:0,"value",p.perUsd===null?"—":L(p.perUsd)+" tok/$"+(p.blended!==null?" · "+n("modelStatsBlended",{price:"$"+p.blended.toFixed(2)}):"")))),a("p",{className:"cm-mstats-note"},n("modelStatsNote")))):null)}function qs(e,t){return e==="fiveHour"?t==="en"?"5-hour":"5 小时":e==="weekly"?t==="en"?"This week":"本周":e==="monthly"?t==="en"?"This month":"本月":e==="daily"?t==="en"?"Today":"当日":e}function ya(e,t){if(e==="go")return"OpenCode Go / Go Plus";const o={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(o[e])return o[e];const n=De.find(s=>s.id===e);return n!==void 0?t(n.labelKey):e}const Pn=["fiveHour","weekly","monthly","daily"];function Us(e,t){const o=new Map,n=s=>{const l=new Date(s),r=i=>String(i).padStart(2,"0");if(t==="monthly")return l.getFullYear()+"-"+r(l.getMonth()+1);if(t==="weekly"){const i=new Date(l.getFullYear(),l.getMonth(),l.getDate()-(l.getDay()+6)%7);return i.getFullYear()+"-"+r(i.getMonth()+1)+"-"+r(i.getDate())}return l.getFullYear()+"-"+r(l.getMonth()+1)+"-"+r(l.getDate())};for(const s of Object.values(e??{}))for(const l of s??[]){if(l===null||typeof l!="object"||!(l.tokens>0)&&!(l.cost>0))continue;const r=n(Number(l.t1)||Number(l.t0)),i=o.get(r)??{key:r,tokens:0,cost:0,pct:0,intervals:0};i.tokens+=Number(l.tokens)||0,i.cost+=Number(l.cost)||0,i.pct+=Number(l.pct)||0,i.intervals+=1,o.set(r,i)}return[...o.values()].map(s=>({...s,per1Tokens:s.pct>0?s.tokens/s.pct:null,fullTokens:s.pct>0?s.tokens/s.pct*100:null})).sort((s,l)=>s.key<l.key?-1:s.key>l.key?1:0)}function Fs(e){const{state:t,config:o,t:n}=e,[s,l]=O(!1),[r,i]=O("daily"),d=H(o),c=t?.planStats,u=c!=null&&typeof c.providers=="object"?c.providers:{},b=Object.keys(u).sort(),g=w=>W(Number(w)||0,o??t?.config),f=w=>w.method==="none"||w.per1Tokens===null?"—":L(w.per1Tokens)+" tok · "+g(w.per1Cost),m=w=>w.method==="none"||w.fullTokens===null?"—":L(w.fullTokens)+" tok · "+g(w.fullCost),x=w=>w.method==="sample"?n("planStatsMethodSample"):w.method==="live"?n("planStatsMethodLive"):n("planStatsMethodNone"),h=w=>{let v=x(w);return w.method==="sample"&&Number(w.sampleAt)>0&&(v=n("planStatsMethodSampleAt",{method:v,time:new Date(Number(w.sampleAt)).toLocaleString(d==="en"?"en-US":"zh-CN")})),(w.method==="sample"||w.method==="live")&&w.confidence==="low"&&(v+=" · "+n("planStatsConfidenceLow")),v},C=([w,v,R])=>a("tr",{key:v+":"+w},a("td",null,qs(w,d)),a("td",{className:"num"},Math.round(R.percent*10)/10+"%"),a("td",{className:"num"},L(R.localTokens)+" tok · "+g(R.localCost)),a("td",{className:"num"},f(R)),a("td",{className:"num"},m(R)),a("td",{className:"num cm-plan-reset"},R.resetsAt.length>0?n("planStatsResets",{time:new Date(R.resetsAt).toLocaleString(d==="en"?"en-US":"zh-CN")}):"—"),a("td",{className:"cm-plan-method"},h(R))),N=s?b.flatMap(w=>Object.entries(u[w]?.intervals??{})).map(([w,v])=>({winKey:w,list:v})):[],y=Us(Object.fromEntries(N.map(w=>[w.winKey,w.list])),r),p=y.reduce((w,v)=>Math.max(w,v.fullTokens??0),0),k=(w,v)=>a("button",{key:w,className:"cm-mstats-tab"+(r===w?" active":""),onClick:()=>i(w)},v);return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(s,()=>l(!s),n("planStatsTitle"))),s?a("div",{className:"cm-collapse-body"},b.length===0?a("p",{className:"cm-empty"},n("planStatsEmpty")):a(E,null,b.map(w=>{const v=u[w]?.windows??{},R=[...Pn.filter(j=>v[j]!==void 0).map(j=>[j,w,v[j]]),...Object.keys(v).filter(j=>!Pn.includes(j)).map(j=>[j,w,v[j]])];return a("div",{key:w,className:"cm-plan-provider"},a("div",{className:"cm-plan-provider-name"},ya(w,n),a("span",{className:"cm-plan-updated"},(()=>{const j=Number(u[w]?.generatedAt)||Number(c?.generatedAt)||0;return j>0?new Date(j).toLocaleTimeString(d==="en"?"en-US":"zh-CN"):""})())),a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("planStatsWindow")),a("th",{className:"num"},n("planStatsPercent")),a("th",null,n("planStatsLocal")),a("th",null,n("planStatsPer1")),a("th",null,n("planStatsFull")),a("th",null,""),a("th",null,""))),a("tbody",null,R.map(C))))}),a("div",{className:"cm-mstats-h",style:{marginTop:"10px"}},n("planStatsCurveTitle")),a("div",{className:"cm-mstats-tabs"},k("daily",n("planStatsDaily")),k("weekly",n("planStatsWeekly")),k("monthly",n("planStatsMonthly"))),y.length===0?a("p",{className:"cm-note"},n("planStatsCurveEmpty")):a(E,null,[...y].reverse().map(w=>a("div",{className:"cm-mstats-row",key:w.key},a("span",{className:"cm-mstats-name"},w.key),a("div",{className:"cm-mstats-barbg"},a("div",{className:"cm-mstats-bar value",style:{width:(p>0?(w.fullTokens??0)/p*100:0).toFixed(1)+"%"}})),a(J,{label:n("planStatsBarTip",{date:w.key,full:w.fullTokens===null?"—":L(w.fullTokens),per1:w.per1Tokens===null?"—":L(w.per1Tokens),tokens:L(w.tokens),cost:g(w.cost),intervals:w.intervals}),side:"top",delayMs:200},a("span",{className:"cm-mstats-val"},w.fullTokens===null?"—":L(w.fullTokens)))))),a("p",{className:"cm-note"},n("planStatsNote")))):null)}function _s(e){const{provider:t,modelId:o,entry:n,draft:s,setDraft:l,t:r,api:i,lockedIds:d,releaseDisabled:c}=e,u=Array.isArray(d)&&d.includes(o),[b,g]=O(!1),[f,m]=O(""),x=async()=>{if(!(b||c)){g(!0),m("");try{await i.releasePriceLock(o)}catch(p){m(String(p.message??p))}finally{g(!1)}}},h=p=>{const k={...s.prices.providers??{}},w=k[t]??{};k[t]={...w,models:p},l({...s,prices:{...s.prices,providers:k}})},C=(p,k,w)=>{if(s===null)return;const v={...(s.prices.providers??{})[t]?.models??{}};v[o]={...v[o]??{},[p]:Math.max(0,k)},k===null&&delete v[o][p],p==="input"&&delete v[o].cacheMiss,p==="cachedInput"&&(delete v[o].cacheHit,delete v[o].cacheRead),Bt(v[o],"base."+({input:"cacheMiss",cachedInput:"cacheHit"}[p]??p),w),h(v)},N=(p,k,w)=>{if(s===null)return;const v={...(s.prices.providers??{})[t]?.models??{}},R=v[o]??{};v[o]={...R,cny:{...R.cny,[p]:Math.max(0,k)}},k===null&&delete v[o].cny[p],Bt(v[o],"cny."+p,w),h(v)},y=()=>{if(s===null)return;const p={...(s.prices.providers??{})[t]?.models??{}};delete p[o],h(p)};return a("div",{className:"cm-price-card"},a("div",{className:"cm-price-head"},a("span",{className:"cm-price-name"},o),a("span",{className:"cm-price-unit"},n.cny?"USD / CNY":"USD"),a(E,null,n?.unpriced===!0?a("span",{className:"cm-price-legacy"},r("catalogUnpriced")):null,u?a("span",{className:"cm-price-locked",title:r("priceLockHint")},r("priceLockBadge")):null,u&&typeof i?.releasePriceLock=="function"?a("button",{className:"cm-btn small",disabled:b||c,onClick:x},r("priceLockRelease")):null,a("button",{className:"cm-btn small danger",onClick:y},r("unmountBtn")))),f?a("p",{className:"cm-err",role:"alert"},f):null,n?.unpriced===!0?null:a(E,null,a("div",{className:"cm-price-row cm-price-columns"},a("span",null,""),a("span",null,r("flatInput")),a("span",null,r("flatCached")),a("span",null,r("flatCacheWrite")),a("span",null,r("flatOutput"))),a("div",{className:"cm-price-row"},a("span",null,"USD"),...["cacheMiss","cacheHit","cacheWrite","output"].map(p=>a(E,{key:p},ba(n,n,"base",p,"USD",r,(k,w)=>C({cacheMiss:"input",cacheHit:"cachedInput"}[p]??p,k,w))))),n?.cny?a("div",{className:"cm-price-row"},a("span",null,"CNY"),...["cacheMiss","cacheHit","cacheWrite","output"].map(p=>a(E,{key:p},ba(n,n.cny,"cny",p,"CNY",r,(k,w)=>N(p,k,w))))):null,ga(n,r,p=>h({...s.prices.providers[t].models,[o]:{...n,separateMultipliers:p,multipliers:{}}}))))}const ha=e=>[a("option",{key:"sidebar",value:"sidebar"},e("balanceSidebar")),a("option",{key:"settings",value:"settings"},e("balanceSettings")),a("option",{key:"both",value:"both"},e("balanceBoth")),a("option",{key:"off",value:"off"},e("off"))],ka=e=>e!=null?a("div",{className:"cm-msg "+e.kind},e.text):null;function Ws(e){const{state:t,api:o,t:n,draft:s,setDraft:l}=e,[r,i,d]=dt(n,()=>o.refreshBalance()),c=t.balance,u=t.config,b=t.reconcile,g=(s?.balance??u.balance??{}).reconcile!==!1,f=h=>{s===null||typeof l!="function"||l({...s,balance:{...s.balance??u.balance??{},reconcile:h.target.checked}})},m=h=>je(h,u,c?.currency),x=c.status==="ok"?a("div",{className:"cm-bal-line"},a("span",null,n("balanceLine",{total:m(c.totalBalance),granted:m(c.grantedBalance),toppedUp:m(c.toppedUpBalance),time:c.fetchedAt>0?new Date(c.fetchedAt).toLocaleTimeString():"—"}))):c.status==="error"?a("div",{className:"cm-bal-line err"},n("balanceQueryFailedHint",{message:c.message||n("unknownError")})):a("div",{className:"cm-bal-line"},n("balanceNotQueried"));return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},a("h3",{className:"cm-h"},n("accountBalance")),a("button",{className:"cm-btn small",onClick:d,disabled:r},n(r?"refreshing":"refreshBalance"))),x,a("label",null,n("balanceApiKey")),a(tt,{target:"balance",configured:c.keyConfigured,source:c.keySource,t:n,api:o,placeholder:"sk-…"}),a("p",{className:"cm-hint"},n("balanceKeyHint")),b!==void 0&&b.ok===!1?a("div",{className:"cm-bal-line warn"},"⚠ "+b.message):null,a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:g,onChange:f}),n("reconcileLabel")),ka(i))}function Ot(e){const t=fe(null);Y(()=>{e.targeted&&(t.current?.scrollIntoView({block:"start"}),t.current?.focus({preventScroll:!0}))},[e.targeted]);const{name:o,enabled:n,saved:s,busy:l,open:r,statusNode:i,configNode:d,errorMsg:c,onToggle:u,onRefresh:b,onLogin:g,loginRequired:f,onRemove:m,onToggleOpen:x,t:h}=e,C=d!=null,N=f?g:b,y=h(l===!0?f?"loggingIn":"refreshing":f?"loginCodingPlan":"refresh");return a("div",{ref:t,"data-quota-plan":e.planId,tabIndex:e.targeted?-1:void 0,className:"cm-budget cm-quota-card"},a("div",{className:"cm-budget-head"},a("label",{className:"cm-check"},a("input",{type:"checkbox","aria-label":h("enable")+": "+o,checked:n===!0,onChange:p=>u(p.target.checked)})),a("div",{className:"cm-quota-name"},C?ct(r===!0,x,o):a("h3",{className:"cm-h"},o)),m?a("button",{className:"cm-btn small",onClick:m},h("quotaRemove")):null,a("button",{className:"cm-btn small",onClick:N,disabled:l===!0||n!==!0||s?.enabled!==!0||s.display==="off"&&s.showInComposer!==!0,title:n!==!0?h("quotaEnableFirst"):s?.enabled!==!0||s.display==="off"&&s.showInComposer!==!0?h("quotaRefreshReady"):h(f?"loginCodingPlan":"refresh")},y)),i,C&&r===!0?a("div",{className:"cm-collapse-body"},d):null,c!=null?a("div",{className:"cm-msg "+c.kind},c.text):null)}function dt(e,t){const[o,n]=O(!1),[s,l]=O(null),r=fe(!1);return[o,s,async()=>{if(!r.current){r.current=!0,n(!0),l(null);try{const d=await t();l({kind:d.ok?"ok":"err",text:d.message})}catch(d){l({kind:"err",text:e("syncFailed",{message:d?.message??String(d)})})}finally{r.current=!1,n(!1)}}}]}const Gs=e=>{const t=e.filter(n=>n.enabled===!0),o=e.filter(n=>n.enabled!==!0);return[...t,...o]},xa=(e,t,o,n,s,l=t)=>{if(typeof o?.percent!="number")return a("div",{key:l,className:"cm-go-row"+(s?" main":"")},a("span",{className:"cm-go-label"},t),a("span",{className:"cm-go-num"},typeof o?.text=="string"?o.text:"—"));const r=Math.max(0,Math.min(100,Number(o.percent)||0)),i=we(r,n),d=typeof o.resetsAt=="string"&&o.resetsAt.length>0?e("goResetAt",{time:new Date(o.resetsAt).toLocaleString()}):"";return a("div",{key:l,className:"cm-go-row"+(s?" main":"")},a("span",{className:"cm-go-label"},t),a("div",{className:"cm-go-bar"},a("div",{className:"cm-go-fill",style:{width:i.width+"%"}})),a("span",{className:"cm-go-num"},i.label===null?"—":e("goQuotaPercent",{percent:String(Math.round(i.label))})),d?a("span",{className:"cm-go-reset"},d):null)};function Ks(e){const{state:t,api:o,t:n,entry:s,index:l,canRemove:r,onPatch:i,onRemove:d}=e,c=s.adapter==="aliyun",u=s.adapter==="tokenrhythm",b=c||u,[g,f]=O(!1),m=()=>({headers:JSON.stringify(s.request?.headers??{},null,2),extract:JSON.stringify(s.extract??{},null,2),body:typeof s.request?.body=="string"?s.request.body:JSON.stringify(s.request?.body,null,2)??""}),[x,h]=O(m),[C,N]=O(()=>(s.allowedHosts??[]).join(", ")),[y,p]=O({}),k=fe(!1),w=t.config,R=(Array.isArray(t.customBalances)?t.customBalances:[]).find(D=>D.index===l)??null,j=s.enabled===!0,A=()=>{f(D=>!D)};Y(()=>{g&&!k.current&&(h(m()),N((s.allowedHosts??[]).join(", ")),p({})),k.current=g},[g]);const B=(D,ne)=>i({[D]:ne}),F=(D,ne)=>i({request:{...s.request??{},[D]:ne}}),G=c?["ALIBABA_CLOUD_ACCESS_KEY_ID","ALIBABA_CLOUD_ACCESS_KEY_SECRET","ALIBABA_CLOUD_SECURITY_TOKEN"]:u?["TOKENRHYTHM_COOKIE"]:[...new Set(Object.values(s.request?.headers??{}).flatMap(D=>typeof D=="string"?[...D.matchAll(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g)].map(ne=>ne[1]):[]))],ae=(D,ne)=>{h(oe=>({...oe,[D]:ne}));try{const oe=D==="body",ge=oe&&!ne.trim()?void 0:JSON.parse(ne);if(!oe&&(ge===null||typeof ge!="object"||Array.isArray(ge)))throw new Error("invalid");if(D==="headers"&&Object.values(ge).some(P=>typeof P!="string"))throw new Error("invalid");p(P=>({...P,[D]:""})),D==="extract"?B(D,ge):F(D,oe?ge===void 0?void 0:ne:ge)}catch{p(oe=>({...oe,[D]:n("customBalanceInvalidJson")}))}},K=(D,ne,oe,ge)=>!b&&a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,n(ne)),ge&&a("span",{className:"cm-hint"},n(ge)),a("textarea",{className:"cm-input",rows:oe,value:x[D],onChange:P=>ae(D,P.target.value)}),y[D]?a("span",{className:"cm-hint err"},y[D]):null),$=D=>{N(D);const ne=D.split(/[\s,;]+/).map(oe=>oe.trim()).filter(oe=>oe.length>0);B("allowedHosts",ne)},[M,T,le]=dt(n,()=>(w.customBalances??[])[l]?.enabled!==!0?Promise.resolve({ok:!1,message:n("quotaEnableFirst")}):o.refreshCustomBalance(l)),Le=R!==null&&R.status==="ok"?a(E,null,w.balance?.showProgressBar===!0&&!u?a("div",{className:"cm-budget",style:{marginTop:"8px"}},a(Jt,{segments:$t(t,w,R,s),direction:ie(w,"balance")}),a("div",{className:"cm-bal-line"},ea(R,w,n,t,s))):a("div",{className:"cm-bal-line"},n("customBalanceRemaining",{amount:Fe(R.remaining,w,R,s)}))):R!==null&&R.status==="error"?a("div",{className:"cm-bal-line err"},R.message||n("unknownError")):a("div",{className:"cm-bal-line"},R?.message||n("balanceNotQueried")),pt=a(E,null,a("p",{className:"cm-note"},n(u?"tokenRhythmBalanceNote":c?"aliyunBalanceNote":"customBalanceConfigNote")),!u&&a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:s.convertToDisplayCurrency===!0,disabled:at(w,R,s)!=="USD",onChange:D=>B("convertToDisplayCurrency",D.target.checked)}),n("customBalanceConvert")),!u&&a("p",{className:"cm-note"},n("customBalanceConvertNote")),a("div",{className:"cm-grid"},[["label","customBalanceLabelZh"],["labelEn","customBalanceLabelEn"]].map(([D,ne])=>a("div",{key:D,className:"cm-field"},a("label",null,n(ne)),a("input",{className:"cm-input",value:s[D]??"",onChange:oe=>B(D,oe.target.value)}))),!b&&a("div",{className:"cm-field"},a("label",null,n("customBalanceUnitLabel")),a("select",{className:"cm-input",value:["CNY","EUR","CREDITS"].includes(s.unit)?s.unit:"USD",onChange:D=>B("unit",D.target.value)},a("option",{value:"USD"},"USD ($)"),a("option",{value:"CNY"},"CNY (¥)"),a("option",{value:"EUR"},"EUR (€)"),a("option",{value:"CREDITS"},"CREDITS"))),a("div",{className:"cm-field"},a("label",null,n("customBalanceDisplayLabel")),a("select",{className:"cm-input",value:s.display??"both",onChange:D=>B("display",D.target.value)},...ha(n))),a("div",{className:"cm-field"},a("label",null,n("customBalanceRefreshInterval")),Ge({value:s.refreshMinutes??15},D=>B("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(D)))))),!b&&a("div",{className:"cm-field"},a("label",null,n("customBalanceMethod")),a("select",{className:"cm-input",value:s.request?.method??"GET",onChange:D=>F("method",D.target.value)},a("option",{value:"GET"},"GET"),a("option",{value:"POST"},"POST"))),!b&&a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,n("customBalanceUrl")),a("input",{className:"cm-input",value:s.request?.url??"",placeholder:"/plugins/dsh-workbuddy-connect/status",onChange:D=>F("url",D.target.value)}),a("span",{className:"cm-hint"},n("customBalanceUrlHint"))),K("headers","customBalanceHeaders",5,"customBalanceHeadersVarNote"),!["GET","HEAD"].includes((s.request?.method??"GET").toUpperCase())&&K("body","customBalanceBody",5,"customBalanceBodyNote"),a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,u?"Token Rhythm Cookie":n("customBalanceCredentialsTitle")),G.length>0?a(E,null,!b&&a("span",{className:"cm-hint"},n("customBalanceCredentialsHint")),G.map(D=>a(tt,{key:"cb-var-"+D,target:"customVar:"+D,configured:(t.customVarStatus?.[D]?.configured??!1)===!0,source:t.customVarStatus?.[D]?.source??"",t:n,api:o,placeholder:u?"tr_session=…":"{{"+D+"}}"}))):a("span",{className:"cm-hint"},n("customBalanceNoPlaceholders"))),!b&&a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,n("customBalanceAllowedHosts")),a("input",{className:"cm-input",value:C,placeholder:"api.example.com, relay.example.org",onChange:D=>$(D.target.value)}),a("span",{className:"cm-hint"},n("customBalanceAllowedHostsHint"))),!b&&a("label",{className:"cm-check",style:{gridColumn:"1 / -1"}},a("input",{type:"checkbox",checked:s.allowInsecureHttp===!0,onChange:D=>B("allowInsecureHttp",D.target.checked)}),n("customBalanceHttp")),K("extract","customBalanceExtract",8)));return a(Ot,{name:`#${l+1} · `+(Xt(s,H(w))||n("customBalanceTitle")),enabled:j,saved:JSON.stringify(s)===JSON.stringify(w.customBalances?.[l])?w.customBalances[l]:null,busy:M,open:g,statusNode:Le,configNode:pt,errorMsg:T,onToggle:D=>B("enabled",D),onRefresh:le,onRemove:r?d:null,onToggleOpen:A,t:n})}function zs({config:e,draft:t,setDraft:o,t:n,api:s}){const l=t?.goQuota??e.goQuota,r=(i,d)=>{t&&o({...t,goQuota:{...l,[i]:d}})};return a(E,null,[["display","goQuotaDisplayLabel"],["main","goMainLabel"]].map(([i,d])=>a("div",{key:i,className:"cm-field"},a("label",null,n(d)),a("select",{className:"cm-input",value:i==="display"?ia(l,(t??e).quotaStrip,"go"):l[i],onChange:c=>i==="display"?t&&o({...t,goQuota:{...l,...ca(c.target.value)}}):r(i,c.target.value)},i==="display"?ua(n):["rolling","weekly","monthly"].map((c,u)=>a("option",{key:c,value:c},n(["goWindowRolling","goWindowWeekly","goWindowMonthly"][u])))))),a("div",{className:"cm-field"},a("label",null,n("goQuotaRefreshIntervalLabel")),Ge({value:l.refreshMinutes},i=>r("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(i)))))),a("label",null,n("goQuotaKeyLabel")),a(tt,{target:"goQuota",configured:e.goQuota?.keyConfigured===!0,source:e.goQuota?.keySource,t:n,api:s,placeholder:"sk-…"}))}function Ys(e){const{state:t,api:o,t:n,draft:s,setDraft:l}=e,[r,i]=O(!1),d=t.goQuota,c=t.config,u=s?.goQuota?.enabled??c.goQuota?.enabled??!0,b=(p,k)=>{s!==null&&l({...s,goQuota:{...s.goQuota??c.goQuota,[p]:k}})},[g,f,m]=dt(n,()=>o.refreshGoQuota()),x=c.goQuota?.main==="weekly"||c.goQuota?.main==="monthly"?c.goQuota.main:"rolling",h=[x,...["rolling","weekly","monthly"].filter(p=>p!==x)],C=p=>p==="rolling"?"goWindowRolling":p==="weekly"?"goWindowWeekly":"goWindowMonthly",N=p=>p==="rolling"?d.rolling:p==="weekly"?d.weekly:d.monthly,y=u===!1?a("p",{className:"cm-note"},n("goQuotaDisabledNote")):d.status==="ok"?a("div",{className:"cm-go-list"},h.map(p=>xa(n,n(C(p)),N(p),ie(c,"go"),p===x)),a("div",{className:"cm-go-time"},n("goQuotaFetchedAt",{time:d.fetchedAt>0?new Date(d.fetchedAt).toLocaleTimeString():"—"}))):d.status==="error"?a("div",{className:"cm-bal-line err"},d.message||n("unknownError")):d.status==="off"&&d.message?a("p",{className:"cm-note"},d.message):a("div",{className:"cm-bal-line"},n("goQuotaNotQueried"));return a(Ot,{name:n("goQuotaTitle"),enabled:u,saved:c.goQuota,busy:g,open:r,statusNode:y,errorMsg:f,configNode:a(zs,{config:c,draft:s,setDraft:l,t:n,api:o}),onToggleOpen:()=>i(p=>!p),onToggle:p=>b("enabled",p),onRefresh:m,t:n})}const Vs=(e,t)=>{if(typeof e?.keyVar=="string"&&e.keyVar.length>0)return e.keyVar;const n="CLIPROXYAPI_MANAGEMENT_KEY_"+(String(e?.id??"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"GATEWAY");return Object.keys(t??{}).find(s=>s===n||s.startsWith(n+"_"))??n};function $s(e){const{state:t,api:o,t:n,draft:s,setDraft:l,index:r}=e,i=t.config,c=(s??i).gatewayQuotas?.sources??[],u=c[r]??{},g=(Array.isArray(t.gatewayQuotas)?t.gatewayQuotas:[]).find(A=>A.id===u.id)??{id:u.id,status:"off",accounts:[],unsupportedProviders:[]},f=Vs(u,t.customVarStatus),[m,x]=O(!1),[h,C,N]=dt(n,()=>o.refreshGatewayQuota(u.id)),y=A=>{s!==null&&l({...s,gatewayQuotas:{...s.gatewayQuotas??i.gatewayQuotas??{},sources:A}})},p=A=>y(c.map((B,F)=>F===r?{...B,...A}:B)),k=(A,B,F)=>a("div",{className:"cm-field"},a("label",null,A),a("input",{className:"cm-input","aria-label":A,value:B??"",onChange:F})),w=(A,B)=>{const F=lt(A?.label||A?.id||n("gatewaySourceUnknown"),A,ie(i,"plan"),n);return a(E,{key:A?.id||B},F.row,A?.resetsAt?a("div",{className:"cm-note"},st(A,n)):null)},v=(A,B)=>a("div",{key:A.id||B,className:"cm-mm-row wide"},a("span",{className:"cm-bbox-label"},A.label||"package"),a("span",{className:"cm-bbox-pct cm-num"},(A.used??"—")+" / "+(A.limit??"—")),a("span",{className:"cm-bbox-pct cm-num"},(A.remaining??"—")+" remaining")),R=A=>A==null?null:a(E,null,a("div",{className:"cm-mm-row wide"},a("span",{className:"cm-bbox-label"},A.unit||"credits"),a("span",{className:"cm-bbox-pct cm-num"},(A.used??"—")+" / "+(A.limit??"—")),a("span",{className:"cm-bbox-pct cm-num"},(A.remaining??"—")+" remaining")),(A.packages??[]).map(v)),j=(A,B)=>a("div",{key:A.id||B,className:"cm-budget",style:{marginTop:"8px",padding:"10px 12px"}},a("div",{className:"cm-budget-head"},a("strong",null,(La[A.provider]??A.provider??n("gatewaySourceUnknown"))+" · "+(A.label||n("gatewaySourceUnknown"))),a("span",{className:"cm-hint"},A.status)),A.plan?a("div",{className:"cm-note"},A.plan):null,A.windows.length>0?a("div",{className:"cm-go-list"},A.windows.map(w)):null,R(A.credits),A.message?a("div",{className:"cm-note"},A.message):null);return a(Ot,{name:u.label||u.id||n("gatewayQuotaTitle"),enabled:u.enabled===!0,saved:i.gatewayQuotas?.sources?.find(A=>A.id===u.id),busy:h,open:m,errorMsg:C,statusNode:a("div",{className:"cm-note"},n("gatewaySourceStatus")+": "+(g.status??n("gatewaySourceUnknown"))+(g.serverVersion?" · "+g.serverVersion:"")+(g.fetchedAt>0?" · "+n("gatewaySourceFetchedAt",{time:new Date(g.fetchedAt).toLocaleTimeString()}):"")+(g.message?" · "+g.message:"")),configNode:a(E,null,a("div",{className:"cm-grid"},k(n("gatewaySourceLabel"),u.label,A=>p({label:A.target.value})),k(n("gatewaySourceBaseURL"),u.baseURL,A=>p({baseURL:A.target.value})),a("div",{className:"cm-field"},a("label",null,n("gatewaySourceDisplay")),a("select",{className:"cm-input",value:u.display??"both",onChange:A=>p({display:A.target.value})},...ha(n))),a("div",{className:"cm-field"},a("label",null,n("gatewaySourceRefreshInterval")),Ge({value:u.refreshMinutes??15},A=>p({refreshMinutes:Math.min(1440,Math.max(1,Math.floor(A)))}))),k(n("gatewaySourceAllowlist"),(u.allowedHosts??[]).join(", "),A=>p({allowedHosts:A.target.value.split(/[\s,;]+/).filter(Boolean)})),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:u.allowInsecureHttp===!0,onChange:A=>p({allowInsecureHttp:A.target.checked})}),a("span",null,n("customBalanceHttp"))),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:u.antigravityOnlyGemini===!0,onChange:A=>p({antigravityOnlyGemini:A.target.checked})}),a("span",null,n("gatewayOnlyGemini")))),f?a("div",{className:"cm-field"},a("label",null,n("gatewaySourceCredential")),a(tt,{target:"customVar:"+f,configured:t.customVarStatus?.[f]?.configured===!0,source:t.customVarStatus?.[f]?.source??"",t:n,api:o,placeholder:f})):null,g.unsupportedProviders.length>0?a("div",{className:"cm-note"},n("gatewaySourceUnsupported")+": "+g.unsupportedProviders.join(", ")):null,g.accounts.length>0?g.accounts.map(j):a("div",{className:"cm-bal-line"},n("gatewaySourceNoAccounts"))),onToggle:A=>p({enabled:A}),onRefresh:N,onRemove:()=>y(c.filter((A,B)=>B!==r)),onToggleOpen:()=>x(A=>!A),t:n})}const De=[{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:"clinepass",labelKey:"codingPlanClinepass"},{id:"scnet",labelKey:"codingPlanScnet"},{id:"volcengine",labelKey:"codingPlanVolcengine"},{id:"qwen",labelKey:"codingPlanQwen"},{id:"mimo",labelKey:"codingPlanMimo"},{id:"workbuddy",labelKey:"wbT"},{id:"factory",labelKey:"codingPlanFactory"}];let Mn;function Js(){return Mn??=ve.async("./client.plan-settings.js").then(e=>e.mount({useQuotaRefresh:dt,miniMaxWindowsOf:na,MiniMaxPlanCard:oa,barDirectionOf:ie,quotaWindowRow:xa,codingPlanWindowLabel:We,codingPlanWindowEntries:Mt,numInput:Ge,CredentialField:tt,QuotaCard:Ot,resolveLocale:H,formatMoneyUsd:W,quotaPlacementValue:ia,quotaPlacementPatch:ca,quotaPlacementOptions:ua})).catch(e=>{throw Mn=null,e})}function Zs(e){return a(be,{...e,load:Js})}function Xs(e){const{state:t,api:o,t:n,draft:s,setDraft:l}=e,r=t.config,i=s??r,d=i.codingPlans??{},c=i.gatewayQuotas?.sources??[],u=s?.customBalances??r.customBalances??[],b=y=>{s!==null&&l({...s,customBalances:y,...y.length===0?{customBalance:{...r.customBalance??{},enabled:!1,request:{url:"",headers:{}}}}:{}})},g=fe({next:0,keys:[]}).current;for(;g.keys.length<u.length;)g.keys.push(g.next++);g.keys.length=u.length;const f=y=>{g.keys.splice(y,1),b(u.filter((p,k)=>k!==y))},m=(y,p)=>b(u.map((k,w)=>w===y?{...k,...p}:k)),x=(y="custom")=>{if(!(u.length>=8)){if(y==="workbuddy2api"){b([...u,{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}b([...u,{...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:[]}])}},h=()=>{c.length>=4||s===null||l({...s,gatewayQuotas:{...s.gatewayQuotas??r.gatewayQuotas??{},sources:[...c,{id:"gateway-"+Date.now().toString(36),type:"cliproxyapi",label:"CLIProxyAPI",baseURL:"http://127.0.0.1:8317",enabled:!1,display:"both",refreshMinutes:15,includeProviders:Ut,allowedHosts:[],allowInsecureHttp:!1}]}})},C=[...c.map((y,p)=>({kind:"gateway",key:"gw-"+(y.id??p),index:p,enabled:y.enabled===!0})),{kind:"go",key:"go",enabled:i.goQuota?.enabled!==!1},...De.map(y=>({kind:"plan",key:"plan-"+y.id,planId:y.id,labelKey:y.labelKey,enabled:d[y.id]?.enabled===!0})),...u.map((y,p)=>({kind:"custom",key:"cb-"+g.keys[p],index:p,enabled:y.enabled===!0}))],N=y=>y.kind==="plan"?a(Zs,{key:y.key,planId:y.planId,labelKey:y.labelKey,targeted:y.planId===e.targetPlan,state:t,api:o,t:n,draft:s,setDraft:l}):y.kind==="go"?a(Ys,{key:y.key,state:t,api:o,t:n,draft:s,setDraft:l}):y.kind==="gateway"?a($s,{key:y.key,index:y.index,state:t,api:o,t:n,draft:s,setDraft:l}):a(Ks,{key:y.key,state:t,api:o,t:n,entry:u[y.index],index:y.index,canRemove:!0,onPatch:p=>m(y.index,p),onRemove:()=>f(y.index)});return a("div",null,a("p",{className:"cm-note"},n("quotaSectionNote")),a("div",{className:"cm-quota-list"},Gs(C).map(N)),a("div",{className:"cm-buttons"},a("button",{className:"cm-btn small",onClick:h,disabled:c.length>=4},n("gatewaySourceAdd")),a("button",{className:"cm-btn small",onClick:()=>x(),disabled:u.length>=8},n("customBalanceAdd")),a("button",{className:"cm-btn small",onClick:()=>x("aliyun"),disabled:u.length>=8},n("aliyunBalanceAdd")),a("button",{className:"cm-btn small",onClick:()=>x("tokenrhythm"),disabled:u.length>=8},n("tokenRhythmBalanceAdd")),a("button",{className:"cm-btn small",onClick:()=>x("workbuddy2api"),disabled:u.length>=8},n("workBuddyBalanceAdd")),a("p",{className:"cm-note"},n("workBuddyBalanceNote"))))}const el=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Tn=e=>(e.input??0)+(e.output??0)+(e.cacheRead??0)+(e.cacheWrite??0);function Dt(e){const t=e.useCost?e.useCost(p=>p):void 0,o=e.state??t?.state;if(!o)return null;const n=o.config,s=H(n),l=e.t??z(s),r=Array.isArray(o.history)?o.history:[];if(r.length===0)return a("div",null,a("h3",{className:"cm-h"},l("usageTitle")),a("p",{className:"cm-empty"},l("usageEmpty")));const i=o.meta?.dayKey??"",d=new Map(r.map(p=>[p.date,p])),c=p=>{const k=w=>String(w).padStart(2,"0");return p.getFullYear()+"-"+k(p.getMonth()+1)+"-"+k(p.getDate())},u=new Date;u.setHours(0,0,0,0);const b=new Date(u);b.setDate(b.getDate()+(6-(u.getDay()+6)%7));const g=26,f=[],m=[];let x=-1;for(let p=g-1;p>=0;p-=1){for(let w=0;w<7;w+=1){const v=new Date(b);v.setDate(v.getDate()-(p*7+(6-w)));const R=d.get(c(v));f.push(R!==void 0?{day:R,tokens:Tn(R)}:{day:{date:c(v)},tokens:0})}const k=new Date(b);k.setDate(k.getDate()-(p*7+6)),m.push(k.getMonth()!==x?s==="en"?el[k.getMonth()]:String(k.getMonth()+1)+"月":""),x=k.getMonth()}const h=Math.max(...f.map(p=>p.tokens),1),C=p=>{const k=p/h;return k<.25?1:k<.5?2:k<.75?3:4},N=p=>{const{day:k,tokens:w}=p,v="cm-ug-cell"+(w>0?" l"+C(w):"")+(k.date===i?" today":""),R=l("usageDay",{date:k.date,tokens:L(w),input:L(k.input??0),cache:L((k.cacheRead??0)+(k.cacheWrite??0)),output:L(k.output??0),calls:k.calls??0,cost:W(Q(k,n),n)});return a(J,{key:k.date,label:R,side:"top",delayMs:200},a("div",{className:v}))},y=o.total;return a("div",{className:"cm-ug"},a("h3",{className:"cm-h"},l("usageTitle")),a("div",{className:"cm-ug-total"},l("usageTotal",{tokens:L(Tn(y)),input:L(y.input??0),cache:L((y.cacheRead??0)+(y.cacheWrite??0)),output:L(y.output??0),calls:y.calls??0})),a("div",{className:"cm-ug-grid",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},f.map(N)),a("div",{className:"cm-ug-months",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},m.map((p,k)=>a("span",{key:"m"+String(k),className:"cm-ug-monthc"},p))))}function Rn(e){return e.ready?a(be,{...e,load:e.api.loadCodex,quiet:e.view==="prompt"}):null}function tl(e){const t=e.useCost?.(n=>n),o=t?.state;return a(Rn,{...e,state:o,view:"prompt",ready:o?.codexCompat?.enabled===!0&&o?.codexCompat?.promptDue,locale:t?.locale})}const al=!1;function nl(e){const t=e.useCost?.(o=>o);return a(be,{state:t?.state,snapshot:t,api:e.api,load:e.api.loadSettingsOverview,helpers:{makeT:z,Card:it,displayCostOf:Q,quotaWindowRow:xa,codingPlanWindowLabel:We,formatBalanceMoney:je,formatCustomBalanceMoney:Fe,CODING_PLAN_ROWS:De,UsagePanel:Dt,TodaySessions:Cn,BudgetBoxContent:Tt,useCodexQuota:Pt,codingPlanWindowEntries:Mt}})}function Bn(e){const t=e.useCost?e.useCost(P=>P):void 0,o=e.api,n=t?.state??null,[s,l]=O(null),[r,i]=O(null),[d,c]=O(!1),[u,b]=O(!1),[g,f]=O(!1),[m,x]=O(!1),[h,C]=O("models"),[N,y]=O("overview"),p=n?.codexCompat?.installed===!0&&n?.codexCompat?.enabled===!0,k=N==="export"?"statistics":N==="codex"&&!p?"overview":N;Y(()=>{p||y(P=>P==="codex"?"overview":P)},[p]);const[w,v]=O(null),[R,j]=O({status:"idle",at:0,error:null}),A=Ae.useRef(null),B=Ae.useRef(null),F=Ae.useRef(null),G=Ae.useRef(Promise.resolve()),ae=Ae.useRef(0),K=Ae.useRef(null);Y(()=>()=>{K.current?.()},[]),Y(()=>{if(n!==null){const P=JSON.stringify(n.config);l(_=>{const ye=_!==null&&JSON.stringify(_)!==A.current;return ye||(B.current=n.config,F.current=n.config),ye?{..._,activeLocale:n.config.activeLocale}:JSON.parse(P)}),A.current=P}},[n]),Y(()=>{s!==null&&F.current===null&&B.current!==null&&(F.current=B.current)},[s]),Y(()=>{const P=++ae.current;if(s===null||o===void 0)return;const _=JSON.stringify(s);if(_===A.current){K.current=null;return}j(ce=>ce.status==="saving"?ce:{...ce,status:"saving"});const ye=()=>{G.current=G.current.catch(()=>{}).then(async()=>{if(P!==ae.current)return;const ce={},pe=F.current??B.current;if(pe!==null&&typeof pe=="object")for(const re of Object.keys(s))re==="activeLocale"||s[re]===pe[re]||JSON.stringify(s[re])!==JSON.stringify(pe[re])&&(ce[re]=s[re]);if(Object.keys(ce).length===0){A.current=_,j({status:"saved",at:Date.now(),error:null});return}try{await o.updateConfig(ce),A.current=_,pe!==null&&typeof pe=="object"&&(F.current={...pe,...ce}),P===ae.current&&j({status:"saved",at:Date.now(),error:null})}catch(re){P===ae.current&&j({status:"error",at:0,error:re?.message??String(re)})}})};K.current=ye;const xe=setTimeout(ye,120);return()=>{clearTimeout(xe)}},[s,o]),Y(()=>{n!==null&&t?.status==="error"&&t.error&&i({kind:"err",text:M("ledgerReadFailed",{message:t.error})})},[t?.status,t?.error]);const $=H({...s??n?.config,activeLocale:t?.locale}),M=z($);if(t===void 0||n===null)return a("div",{className:"cm-section"},a("p",{className:"cm-empty"},t?.status==="loading"?M("readingLedger"):M("ledgerUnavailable")),t?.error&&a("p",{className:"cm-err",role:"alert"},M("ledgerReadFailed",{message:t.error})),a("button",{className:"cm-btn",disabled:t?.status==="loading"||!o?.reload,onClick:o?.reload},M("refresh")));const T=n.config,le=async()=>{if(!m){x(!0),i(null);try{const P=await o.fetchPrices();if(i({kind:P.ok?"ok":"err",text:P.message}),P.ok&&P.state&&typeof P.state.config=="object"){const _=JSON.stringify(P.state.config);l(JSON.parse(_)),A.current=_}}catch(P){i({kind:"err",text:M("syncFailed",{message:P?.message??String(P)})})}finally{x(!1),c(!1)}}},Le=async()=>{if(!m){x(!0);try{await o.resetHistory(),i({kind:"ok",text:M("historyCleared")})}catch(P){i({kind:"err",text:M("clearFailed",{message:P?.message??String(P)})})}finally{x(!1),b(!1)}}},pt=async()=>{if(!m){x(!0),i(null);try{const P=await o.importLegacyHistory();i({kind:"ok",text:P.message})}catch(P){i({kind:"err",text:M("legacyImportFailed",{message:P?.message??String(P)})})}finally{x(!1),f(!1)}}},D=(P,_)=>{s!==null&&l({...s,[P]:_})},ne=[["overview",M("tabOverview")],["statistics",$==="en"?"Cost statistics":"计费统计"],["quotas",M("tabQuotas")],["usage",M("tabUsage")],["pricing",M("tabPricing")],...p?[["codex","Codex"]]:[],["display",M("tabDisplay")]],oe=P=>ma({statistics:o.loadStatistics,pricing:o.loadOpenRouter,codex:o.loadCodex}[P],{state:n}),ge=R.status==="saving"?a("span",{className:"cm-hint"},M("saving")):R.status==="error"?a("span",{className:"cm-msg err"},M("autoSaveFailed",{message:R.error??""})):a("span",{className:"cm-hint"},R.status==="saved"?M("autoSavedAt",{time:new Date(R.at).toLocaleTimeString()}):M("autoSaveHint"));return a("div",{className:"cm-section"},a("div",{className:"cm-tabs-row"},a("div",{className:"cm-tabs",role:"tablist"},ne.map(([P,_])=>a("button",{key:P,type:"button",role:"tab","aria-selected":String(k===P),className:"cm-tab"+(k===P?" active":""),onMouseEnter:()=>oe(P),onFocus:()=>oe(P),onClick:()=>y(P)},_))),ge),a(be,{state:n,api:o,load:o.loadCommunity,locale:$,quiet:!0}),ka(r),k==="statistics"?a(be,{state:n,api:o,autoExport:N==="export"}):null,k==="overview"?a(E,{key:"overview"},a("div",{className:"cm-overview-grid"},a("div",{className:"cm-cards",style:{"--cm-overview-count":T.hideTodayCost===!0?2:3}},T.hideTodayCost===!0?null:a(it,{title:M("cardToday"),value:W(Q(n.today,T),T),sub:M("callsTokens",{calls:n.today.calls,input:L(n.today.input),cache:L(n.today.cacheRead+n.today.cacheWrite),output:L(n.today.output)})}),a(it,{title:M("cardMonth"),value:W(Q(n.month,T),T),sub:M("callsTokens",{calls:n.month.calls,input:L(n.month.input),cache:L(n.month.cacheRead+n.month.cacheWrite),output:L(n.month.output)})}),a(it,{title:M("cardTotal"),value:W(Q(n.total,T),T),sub:M("cardTotalSub",{calls:n.total.calls})}))),a(Ts,{state:n,t:M}),a("p",{className:"cm-note",key:"cards-footnote"},M("cardsFootnote")),(()=>{const P=Mo(n);return P!==null?a("p",{className:"cm-note",key:"tz-hint"},M("timezoneHint",{host:P.hostLabel,browser:P.browserLabel})):null})(),a("label",{className:"cm-cards-toggle",title:M("cardsTogglePlanTotalHint")},a("input",{type:"checkbox",checked:(s??T).showTotalWithPlan===!0,onChange:P=>{const _=s??T;_!=null&&l({..._,showTotalWithPlan:P.target.checked})}}),a("span",null,M("cardsTogglePlanTotal"))),a("div",null,a("button",{className:"cm-btn",onClick:()=>y("export")},$==="en"?"Export cost records":"导出费用记录"),a("h3",{className:"cm-h"},M("todaySessions")),a(Cn,{state:n,t:M})),a(Ls,{state:n,draft:s,setDraft:l,t:M}),(T.balance?.display==="settings"||T.balance?.display==="both")&&T.hideOfficialBalance!==!0?a(Ws,{state:n,api:o,t:M,draft:s,setDraft:l}):null):null,k==="quotas"?a(Xs,{key:"quotas",state:n,api:o,t:M,draft:s,setDraft:l,targetPlan:w}):null,k==="usage"?a(E,{key:"usage"},!ft||(T.usage?.position??"cost")==="cost"?a(Dt,{state:n,t:M,locale:$}):null,a(Qs,{state:n,config:s??T,t:M,draft:s,setDraft:l}),a(Fs,{state:n,config:s??T,t:M}),a(Rs,{state:n,api:o}),a(Os,{state:n,api:o}),a(be,{state:n,api:o,load:o.loadBillingStorage,draft:s,setDraft:l,locale:$,disabled:R.status==="saving"||(s??T).billingStorageRetentionDays!==T.billingStorageRetentionDays}),a("div",null,a("h3",{className:"cm-h"},M("historyDataTitle")),a("div",{className:"cm-buttons"},g?a(E,null,a("span",{className:"cm-hint"},M("confirmImportLegacy")),a("button",{className:"cm-btn",onClick:pt,disabled:m},M("apply")),a("button",{className:"cm-btn",onClick:()=>f(!1)},M("cancel"))):a("button",{className:"cm-btn",onClick:()=>f(!0),disabled:m},M("importLegacy")),u?a(E,null,a("span",{className:"cm-hint"},M("confirmReset")),a("button",{className:"cm-btn danger",onClick:Le,disabled:m},M("confirmClear")),a("button",{className:"cm-btn",onClick:()=>b(!1)},M("cancel"))):a("button",{className:"cm-btn danger",onClick:()=>b(!0),disabled:m},M("clearAllHistory"))),a("p",{className:"cm-note"},M("legacyImportNote")))):null,k==="codex"?a(Rn,{key:"codex",state:n,api:o,t:M,locale:$,view:"panel",ready:p}):null,k==="display"?a(E,{key:"display"},n?.secretMigration?.pending?.length>0?a(Ro,{pending:n.secretMigration.pending,t:M}):null,a(be,{state:{...n,displayPreviewCodex:U.source===(n.config.codexQuotaSource??"auto")?ra():{status:"idle",windows:{}}},api:o,load:o.loadDisplay,draft:s,setDraft:l,t:M,locale:$,numInput:Ge,displayOptions:ha,quotaPlacementValue:ia,quotaPlacementPatch:ca,quotaPlacementOptions:ua,CURRENCY_PRESETS:Ds,USAGE_POSITION_SWITCHABLE:ft,formatMoneyUsd:W,planOptions:De.map(P=>[P.id,M(P.labelKey)]),onNavigate:(P,_)=>{v(_),y(P)},renderSidebar:(P,_=n)=>Rt({..._,config:P},!0,void 0,!0),renderCorner:P=>a(cn,{useCost:()=>({state:P})}),renderStyleSample:(P,_=n,ye=!0)=>{if(!ye)return Rt({..._,config:P},!0,void 0,!0);const xe=P.sidebarSimple===!0,ce={...P,peakNotice:!1,hideBudget:!1,hideTodayCost:!1,budget:{...P.budget,enabled:!0,amount:Number(P.budget?.amount)>0?P.budget.amount:100}},pe={..._,config:ce},re=na(_.codingPlans?.minimax?.windows??{});return a("div",{className:"cm-footer-stack"+(xe?" simple":P.sidebarStyle==="compact"?" compact":"")},a(Tt,{state:pe,wide:!0,summary:xe}),a(oa,{five:re.five??{percent:24},seven:re.seven??{percent:18},fetchedAt:0,t:M,wide:!0,direction:ie(P,"plan")}))}})):null,k==="pricing"?a("div",{key:"pricing",className:"cm-pricing-page"},a("div",{className:"cm-pricing-heading"},a("div",null,a("h3",{className:"cm-h"},$==="en"?"Pricing":"价格设置"),a("p",{className:"cm-note"},$==="en"?"New prices apply to future calls. Historical costs keep their original rates.":"价格修改用于后续调用,历史费用沿用原价格。")),a("span",{className:"cm-pricing-unit"},$==="en"?"Per 1M tokens":"每百万 Token")),a("div",{className:"cm-pricing-nav",role:"tablist","aria-label":$==="en"?"Pricing sections":"价格分区"},[["models","模型定价","Model pricing"],["catalog","参考价格表","Price tables"],["tools","同步与规则","Sync & rules"]].map(([P,_,ye])=>a("button",{key:P,id:"cm-pricing-"+P,type:"button",role:"tab","aria-selected":h===P,"aria-controls":"cm-pricing-panel",tabIndex:h===P?0:-1,className:"cm-pricing-nav-item"+(h===P?" active":""),onClick:()=>C(P),onKeyDown:xe=>{const ce=["models","catalog","tools"],pe=xe.key==="ArrowRight"?1:xe.key==="ArrowLeft"?-1:0;if(pe){xe.preventDefault();const re=ce[(ce.indexOf(P)+pe+3)%3];C(re),xe.currentTarget.parentElement.querySelector("#cm-pricing-"+re)?.focus()}}},$==="en"?ye:_))),a("div",{id:"cm-pricing-panel",className:"cm-pricing-content",role:"tabpanel","aria-labelledby":"cm-pricing-"+h},h==="models"?a(be,{state:n,api:o,load:o.loadPricing,mode:"matching",draft:s,setDraft:l,t:M,locale:$,resolveClientPrice:Ka,prettyProviderKey:ut,setField:D,priceEditor:{PriceInput:vn,priceFactor:yt,setPriceFactor:Bt,multiplierOptions:ga,priceMultiplierSettings:gt,priceAt:Ze}}):null,h==="catalog"?a("div",{className:"cm-pricing-catalog"},a("h3",{className:"cm-h"},M("priceTableTitle")),a(be,{state:n,api:o,load:o.loadPricing,mode:"catalog",draft:s,setDraft:l,t:M,locale:$,vendorLabels:js,priceEditor:{priceAt:Ze,priceFactor:yt},renderEditor:(P,_,ye)=>P==="deepseek"?a(Is,{modelId:_==="__default__"?M("defaultModelId"):_,entry:ye,isDefault:_==="__default__",draft:s,setDraft:l,t:M}):a(_s,{provider:P,modelId:_,entry:ye,draft:s,setDraft:l,t:M,api:o,lockedIds:P==="openrouter"?n.priceLockIds??[]:[],releaseDisabled:JSON.stringify(s)!==A.current})})):null,h==="tools"?a("div",{className:"cm-pricing-tools"},a("section",{className:"cm-pricing-tool"},a(Es,{state:n,draft:s,setDraft:l,t:M})),a("section",{className:"cm-pricing-tool"},a(be,{state:n,api:o,load:o.loadPricing,mode:"history",locale:$,disabled:m||JSON.stringify(s)!==A.current})),a("section",{className:"cm-pricing-tool"},a("h3",{className:"cm-h"},M("dataSync")),(s??T).currency==="CNY"&&(s??T).prices?.currency!=="CNY"?a("div",{className:"cm-note",role:"status"},M("pricingCnyHint",{rate:(s??T).exchangeRate}),(s??T).pricingCurrency!=="CNY"?a("button",{className:"cm-btn small",disabled:m,onClick:()=>D("pricingCurrency","CNY")},M("pricingCurrencyCny")):null):null,a("div",{className:"cm-field"},a("label",null,M("pricingCurrencyLabel")),a("select",{className:"cm-input",value:s?.pricingCurrency==="CNY"?"CNY":"USD",onChange:P=>D("pricingCurrency",P.target.value)},a("option",{value:"USD"},M("pricingCurrencyUsd")),a("option",{value:"CNY"},M("pricingCurrencyCny"))),a("p",{className:"cm-note"},M("pricingCurrencyNote"))),a("div",{className:"cm-buttons"},d?a(E,null,a("span",{className:"cm-hint"},M("confirmFetch")),a("button",{className:"cm-btn",onClick:le,disabled:m},M("apply")),a("button",{className:"cm-btn",onClick:()=>c(!1)},M("cancel"))):a("button",{className:"cm-btn",onClick:()=>c(!0),disabled:m},M("syncFromDocs"))),a("p",{className:"cm-note"},M("lastSync",{time:T.fetchedAt!==null?new Date(T.fetchedAt).toLocaleString():M("neverSynced")})+M("source",{source:T.priceSource==="official"?M("sourceOfficial"):M("sourceBundled")})),a("p",{className:"cm-note"},M("syncScopeNote"))),a("section",{className:"cm-pricing-tool"},a(be,{state:n,api:o,load:o.loadOpenRouter}))):null)):null,a(be,{state:n,api:o,load:o.loadCommunity,locale:$,quiet:!0,footer:!0}))}const ol=["remote"];async function sl(e){const t=e.remote;if(t===void 0||typeof t.$mount!="function")return;const o=await t.$mount(lo);e.effect(()=>()=>{o()},"cost-meter: remote contribution");const n=e.get("remote.costMeter");if(n===void 0)return;e.inject(["connection"],S=>S.effect(()=>{const I=S.get("connection")?.rpc;return la(I,()=>n.getPiAiCodexQuota(),()=>n.getChatgptSubQuota()),vt(),()=>{U.rpc===I&&(la(null),vt())}},"cost-meter: Codex quota transport"));const s=()=>{try{return ze(e.get("locale")?.getSnapshot?.().active)}catch{return null}},l=To({status:"loading",error:null,state:null},S=>{const I=s()||ze(S.state?.meta?.locale)||Pa();return{...S,locale:I,...S.state?{state:{...S.state,config:{...S.state.config,activeLocale:I}}}:{}}}),r=()=>z(H(l.getSnapshot().state?.config||{activeLocale:l.getSnapshot().locale})),i=async(S,I)=>{const q=await n[S](...I??[]);if(q===null||typeof q!="object"||q.ok!==!0)throw new Error(q?.error?.message??r()("rpcFailed",{method:S}));return q.value},d=S=>(l.set({status:"ready",error:null,state:S}),S);let c=Date.now(),u=!1,b=!0,g=1,f=0,m=0,x=Promise.resolve();const h=(S,I)=>{if(typeof S?.pricesRev!="string"||S.pricesRev!==I?.pricesRev)return S;const q=I?.config?.prices;return q===void 0?S:{...S,config:{...S.config,prices:q}}},C=async()=>{if(!b||u||m)return;const S=f,I=()=>b&&S===f&&m===0;u=!0,c=Date.now();const q=l.getSnapshot();q.state===null&&l.set({...q,status:"loading"});try{const X=q.state?.pricesRev,Te=await i(q.state===null?"getLocalState":typeof X=="string"?"getStateSince":"getState",typeof X=="string"?[X]:[]);if(!I())return;if(g=1,l.set({status:"ready",error:null,state:h(Te,q.state)}),q.state===null){const He=await i("getState");I()&&l.set({status:"ready",error:null,state:h(He,Te)})}}catch(X){if(!I())return;q.state===null&&(c=Date.now()),g=Math.min(g*2,60),l.set({status:"error",error:X?.message??String(X),state:l.getSnapshot().state??q.state})}finally{u=!1}};e.effect(()=>e.on("connection/reset",()=>{C()}),"cost-meter: reconnect reload");const N=setInterval(()=>{const S=l.getSnapshot().state,I=S?.config.sidebarModels,q=S?I?.enabled||I?.dock?I.refreshSeconds:60:g;!document.hidden&&Date.now()-c>=(q||60)*1e3&&C()},1e3);e.effect(()=>()=>{b=!1,clearInterval(N)},"cost-meter: poll timer");const y=()=>{b&&e.fiber?.uid!==null&&l.set(l.getSnapshot())},p=S=>S.effect(()=>{y();const I=S.get("locale")?.subscribe?.(y);return()=>{I?.(),y()}},"cost-meter: DSH locale");typeof e.inject=="function"?e.inject(["locale"],p):s()&&p(e),e.effect(()=>e.on("locale/change",y),"cost-meter: locale change"),window.addEventListener?.("languagechange",y),e.effect(()=>()=>window.removeEventListener?.("languagechange",y),"cost-meter: browser locale");const k=()=>{document.visibilityState==="visible"&&C()};document.addEventListener("visibilitychange",k),e.effect(()=>()=>{document.removeEventListener("visibilitychange",k)},"cost-meter: visibility reload");const w=async(S,I="rpcSyncFailed",q=!1)=>{const X=await S;if(X===null||typeof X!="object"||X.ok!==!0)throw new Error(X?.error?.message??(q?X?.value?.message:void 0)??r()(I));return X.value.state!==void 0&&l.set({status:"ready",error:null,state:X.value.state}),X.value},v={},R=S=>(v[S]||(v[S]=ve.async("./client."+S+".js").then(I=>I.mount(e,l,H,{formatMoneyUsd:W,displayCostOf:Q,formatTokens:L,updateConfig:q=>j.updateConfig(q)})).catch(I=>{throw delete v[S],I})),v[S]),j={loadBillingStorage:()=>R("billing-storage"),billingStorage:async S=>i("billingStorage",[Ha.parse(S)]),loadSettingsOverview:()=>R("settings-overview"),loadStatistics:()=>R("statistics"),loadOpenRouter:()=>R("openrouter"),loadCommunity:()=>R("community"),loadPricing:()=>R("pricing"),loadDisplay:()=>Promise.all([R("display"),R("sidebar-order")]).then(([S])=>S),loadCodex:()=>R("codex"),reload:C,updateConfig:async S=>{const{activeLocale:I,...q}=S;f++,m++;const X=x.catch(()=>{}).then(async()=>{const Te=await i("updateConfig",[q]);return l.set({status:"ready",error:null,state:Te}),S.planBilling&&setTimeout(()=>{C()},1500),Te});x=X;try{return await X}finally{m--,f++}},fetchPrices:async()=>w(n.fetchPrices()),releasePriceLock:async S=>{const I=await w(n.releasePriceLock(S),"rpcSyncFailed",!0);if(!I.ok)throw new Error(I.message);return I},resetHistory:async()=>{const S=await i("resetHistory");return l.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 n.importLegacyHistory();if(S===null||typeof S!="object"||S.ok!==!0)throw new Error(S?.error?.message??S?.value?.message??r()("legacyImportFailed",{message:"RPC failed"}));return S.value.state!==void 0&&l.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,I,q)=>i("getTurnCost",[S,I,q,l.getSnapshot().state?.config?.currency]),getTopSessions:async(S,I,q)=>i("getTopSessions",[S,I,q]),refreshBalance:async()=>w(n.refreshBalance(),"rpcBalanceFailed"),refreshGoQuota:async()=>w(n.refreshGoQuota()),refreshGatewayQuota:async(S=null)=>w(S==null?n.refreshGatewayQuota():n.refreshGatewayQuota(S)),refreshCustomBalance:async(S=null)=>w(S==null?n.refreshCustomBalance():n.refreshCustomBalance(S)),refreshCodingPlan:async S=>w(n.refreshCodingPlan(S)),loginCodingPlan:async S=>w(n.loginCodingPlan(S)),setCredential:async(S,I)=>w(n.setCredential(S,I),"rpcSyncFailed",!0),clearCredential:async S=>w(n.clearCredential(S),"rpcSyncFailed",!0)},A=S=>{S.target?.closest?.('[data-slot="conversation.input.model"]')&&j.loadOpenRouter().catch(()=>{})};for(const S of["pointerover","focusin"])e.effect(()=>(document.addEventListener(S,A),()=>document.removeEventListener(S,A)));C();const B=e.get("slots");if(B===void 0)return;const F=S=>{typeof B.entries=="function"&&B.entries(S).some(I=>I.locale==="dsh-context")&&j.loadStatistics().catch(()=>{})};e.on("slots/changed",F),["conversation.view","sidebar.right.pane.tab","conversation.input.overlay"].forEach(F);const G=()=>({hooks:{cost:l},api:j});B.inject("plugins.bundle.config",()=>B.register({name:"plugins.bundle.config",key:"dsh-cost-meter",inject:G},Bn));for(const[S,I]of[["header","conversation.session.header.actions"],["dock","conversation.composer.dock"]])B.inject(I,()=>B.register({name:I,id:"cost-meter-statistics",order:1,inject:()=>({...G(),entryPosition:S})},Ms));B.inject("conversation.chat.turnTail",()=>B.register({name:"conversation.chat.turnTail",id:"cost-meter-turn",order:10,inject:G},Oo));const ae=()=>({gen:0,dispose:null}),K=(S,I,q,X,Te=!0)=>{S.dispose!==null&&(S.dispose(),S.dispose=null),S.gen+=1;const He=S.gen;Te&&B.inject(I,()=>{if(S.gen!==He)return;const Re=typeof q=="function"?q():B.register(q,X);if(S.gen!==He){Re();return}return S.dispose=Re,()=>{S.dispose===Re&&(S.dispose=null),Re()}})},$=ae(),M=S=>{const I=S==="header"?"conversation.session.header.actions":"conversation.composer.dock";K($,I,S==="header"?{name:I,id:"cost-meter",order:-5,inject:G}:{name:I,id:"cost-meter",order:5,inject:G},S==="header"?Do:Lo,S!=="off")},T=ae(),le=S=>{K(T,"sidebar.footer.action",{name:"sidebar.footer.action",id:"cost-meter",order:0,inject:G},Cs,S)},Le=ae(),pt=S=>{K(Le,"conversation.composer.dock",{name:"conversation.composer.dock",id:"cost-meter-corner",order:9,inject:G},cn,S)};B.inject("conversation.input.dock",()=>B.register({name:"conversation.input.dock",id:"cost-meter-qstrip",order:5,inject:G},hs)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-simple-guide",order:1,inject:G},ks)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-billion-compatibility",order:2,inject:G},As)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-peak-progress-guide",order:1,inject:G},Zo)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-summary-guide",order:1,inject:G},Jo)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-qstrip-guide",order:1,inject:G},xs)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-balance-click-guide",order:2,inject:G},Ss)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-codex-compat",order:1,inject:G},tl));const D=ae(),ne=S=>{K(D,"sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-peak-alert",order:0,inject:G},zo),null,S)};window.cmPeakAlertPreview=S=>{if(window.__cmPeakAlertLive!==!0){console.warn("[dsh-cost-meter] 弹窗组件未挂载:需启用峰谷计价并重启 dsh web 后再预览。");return}window.dispatchEvent(new CustomEvent(Ko,{detail:{kind:S==="offpeak"?"offpeak":"peak"}}))};const oe=ae(),ge=S=>{K(oe,"settings.section",{name:"settings.section",id:"cost-meter",order:30,label:S==="en"?Ee.en.sectionLabel:Ee.zh.sectionLabel,inject:G},al?nl:Bn,!0)},P=ae(),_=S=>{K(P,"settings.general.item",{name:"settings.general.item",id:"cost-meter-usage",order:30,inject:G},Dt,S)},ye=ae(),xe=(S,I)=>{K(ye,"settings.section",{name:"settings.section",id:"cost-meter-usage",order:31,label:I==="en"?Ee.en.usageSectionLabel:Ee.zh.usageSectionLabel,inject:G},Dt,S)};let ce=null,pe=null,re=null,wa=null,On=null,Dn=null;const Ln=()=>{const S=l.getSnapshot().state;S?.config?.sessionListCosts&&R("session-list").catch(()=>{});const I=S?.config?.position??"dock",q=S?.config?.sidebar!==!1&&S?.config?.hideTodayCost!==!0,X=S?.config?.balance?.display??"both",Te=(X==="sidebar"||X==="both")&&S?.config?.hideOfficialBalance!==!0,He=In=>In?.enabled===!0&&["sidebar","both"].includes(In.display),Re=q||Te||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(He)||(S?.config?.gatewayQuotas?.sources??[]).some(He)||St(S,S?.config).length>0;S?.config?.followSkinTransparency&&R("display").catch(()=>{}),Re&&ve.async&&R("sidebar-order").catch(()=>{});const Na=S?.config?.corner?.enabled===!0||S?.config?.sidebarModels?.dock===!0,Ke=H(S?.config||{activeLocale:l.getSnapshot().locale}),mt=S?.config?.usage?.position??"cost";I!==ce&&(M(I),ce=I),Re!==pe&&(le(Re),pe=Re),Na!==re&&(pt(Na),re=Na);const Sa=S?.config?.peakEnabled===!0;Sa!==Dn&&(ne(Sa),Dn=Sa),Ke!==wa&&(ge(Ke),wa=Ke),mt!==On?(ft&&(_(mt==="general"),xe(mt==="section",Ke)),On=mt):ft&&mt==="section"&&Ke!==wa&&xe(!0,Ke)};Ln();const En=l.subscribe(Ln);return e.effect(()=>()=>{En()},"cost-meter: slot sync"),En}return Lt.apply=sl,Lt.inject=ol,Ca.exports}});
2
+ window.__ModuleLoader__.load({id:"dsh-cost-meter",factory:ve=>{var Ca={exports:{}},Lt=Ca.exports;Object.defineProperty(Lt,Symbol.toStringTag,{value:"Module"});const Ae=ve("react"),{Tooltip:J}=ve("@deepseek-ai/dsh-client-ui-primitives"),ft=!1,Hn='var(--dsw-alias-~.cm-~background:~align-items:center~font-size:~border-radius:~display:flex;~flex-direction:column;~white-space:nowrap~padding:~min-width:~font-weight:600~overflow:hidden~text-overflow:ellipsis~justify-content:~font-variant-numeric:tabular-nums~line-height:~max-width:~display:inline-flex;~box-sizing:border-box~cursor:pointer~gap:~border:~flex-wrap:wrap~flex:none~display:grid;~width:100%~margin:~position:relative;~var(--dsh-frame-top-clearance,0px)~height:100%;~text-align:right~overflow-wrap:anywhere~transform:translate(-50%);~grid-template-columns:1fr~grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));~position:absolute;~font:inherit;~font-weight:~overscroll-behavior:contain~flex-wrap:nowrap;~user-select:none~padding-bottom:env(safe-area-inset-bottom)~display:~flex:0 1 auto;~overflow:auto;~margin-top:4px~left:50%;~border-right:5px solid transparent;~flex-shrink:0~border-left:5px solid transparent;~width:auto~height:8px~transform:translate(-50%,-50%);~grid-column:1/-1~z-index:2~-webkit-app-region:no-drag;~var(--cm-opaque-base,#fff)~margin-top:6px~height:4px~transition:left .4s ease;~transition:top .4s ease;~grid-auto-flow:column;~outline:none~border-color:#34a853~height:6px;~pointer-events:auto;~var(--cm-dialog-top)~width:40px;~outline-offset:1px~text-align:center;~margin-top:10px;~overflow-x:auto~position:fixed;~flex:0 0 auto;~top:50%;~min-height:0;~z-index:9999;~align-items:~height:12px;~height:22px;~height:56px;~height:auto;~content:"";~inset:auto;~opacity:0;~opacity:1;~width:8px;'.split("~"),va='Ɓsection Ɓtabs>Ɓtab{ƒƃ;Ǝcenter;Ɠ;min-height:32px;Ɖ6px 10px;ƛ0;ƥƄ13px;Ɛ20px;vertical-align:middle}Ɓpeak-alert{Ʒ147483647;max-height:calc(100dvh - 32px);ƭƧ}Ɓpeak-alert,Ɓpeak-alert *{-webkit-app-region:no-drag}Ɓpeak-alert Ɓpeak-alert-actions{ƜƘ}Ɓpeak-alert Ɓpeak-alert-actions button{pointer-events:auto}@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;ƙƕ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{ƭnjƉ20px 24px;Ƨ}Ɓstat-dialog::backdrop{inset:var(--dsh-frame-chrome-top,Ɲ) 0 0;Ƃ#0005}Ɓroot{ƬƊ0;Ƒ100%;džƄ12px;Ɛ20px;color:ƀlabel-tertiary);ƈ;ƌ;ƍ}Ɓsession-cost{ƙgrid-template-columns:max-content minmax(0,1fr);Ɗmin-content}Ɓsession-amount{Ƒ40vw;ƌ;ƍ}Ɓsession-detail{Ɗ0;ƌ;ƍ}Ɓchip{ƒƃ;ƕ4px;Ƒ180px;Ɖ0 8px;ǐƅ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;Ƌ;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;Ɵ;Ƌ;Ə}Ɓgo-reset{Ƙ;Ƒ230px;Ƅ11px;color:ƀlabel-tertiary);ƈ;ƌ;ƍ}Ɓgo-time{Ƅ11px;color:ƀlabel-tertiary)}Ɓgo-row.main Ɓgo-label{Ƌ;color:ƀlabel-primary)}Ɓcorner{ƒƬƗ;Ǝcenter;ƃ;ƕ6px;Ɗ0;Ƒ100%}Ɓcorner-chip{ƒƃ;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{ƒƃ;ƕ6px;ǐƉ0 8px;ƅ6px;Ƃtransparent;Ƅ11px;Ɛ22px;color:ƀlabel-secondary);ƈ;Ə;cursor:default}Ɓqchip Ɓqlabel{color:ƀlabel-primary);Ƌ}Ɓqchip Ɓqbar{ƫblock;width:44px;ƻ;ƅ2px;Ƃƀborder-l1);ƌ;Ƙ}Ɓqchip Ɓqfill{ƫblock;ƞƅ2px;Ƃƀstate-ok-primary,#3ba272)}Ɓqchip Ɓqseg{ƒƃ;ƕ4px}Ɓqchip Ɓqsep{width:1px;ǏƂƀ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;Ƌ}Ɓ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));ljǔƛ0;top:max(var(--cm-guide-top),env(safe-area-inset-top,0px));ǂƸƯơǍƑ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;Ƌ}Ɓqguide p{ƛ0;Ƅ12px;Ɛ1.6;color:ƀlabel-secondary)}Ɓqguide Ɓbuttons{Ɔƕ8px;Ǝflex-end}Ɓsection{ƆƇƕ20px;Ɖ4px 2px 24px;Ƅ13px;color:ƀlabel-primary)}Ɓcards{ƙƣƕ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);Ɣ;Ʃ}Ɓ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;Ƌ}Ɓcard-sub{Ƅ12px;color:ƀlabel-tertiary);Ʈ}Ɓh{Ƅ13px;Ƌ;ƛ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);Ƌ}Ɓ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{ƙƣƕ12px}Ɓfield{ƆƇƕ6px;Ɗ0}Ɓfield label{Ƅ12px;color:ƀlabel-secondary)}Ɓinput,Ɓinput option,Ɓinput optgroup{color:ƀlabel-primary);Ƃƀbg-base)}Ɓinput{ƥƄ13px;Ɩ1px solid ƀborder-l1);ƅ8px;Ɖ6px 10px;ƿ}Ɓinput:is(select){color-scheme:light dark}Ɓinput:is(select) :is(option,optgroup){color:ƀlabel-primary)!important;Ƃƀbg-base)!important;Ƃrgb(from ƀbg-base) r g b / 1)!important}Ɓ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);Ɵ}Ɓcheck{Ɔƃ;ƕ8px;Ƅ13px;color:ƀlabel-primary);Ɣ}Ɓpricing-page,Ɓpricing-content{ƙƕ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;Ƌ}Ɓpricing-nav-item:focus-visible{outline:2px solid ƀstate-business-primary)}Ɓpricing-tools{ƙƕ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{Ƌ;Ƅ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-template-columns:52px repeat(4,minmax(0,1fr));ƕ8px;ƃ}Ɓ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{ƒƃ;ƕ5px;Ɣ}Ɓprice-multiplier input{ƛ0;accent-color:ƀbrand-primary,#4d6bfe)}Ɓprice-row input[aria-invalid=true]{border-color:#d64c4c}Ɓbuttons{ƆƗ;ƕ10px;ƃ}Ɓ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{ljǔƛ0;Ɠ;ǂƸcolor:ƀlabel-primary);Ǎ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{NjƯƵ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{ƒƃ;ƕ6px;Ƅ11px;Ƌ;letter-spacing:.4px;text-transform:uppercase}Ɓpeak-alert-badge:before{ǓǗƴ;ƅ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;Ƌ;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%{Ǖtransform:translateY(10px) scale(.98)}to{ǖtransform:translateY(0) scale(1)}}@keyframes cm-peak-alert-in-center{0%{Ǖtransform:translate(-50%,calc(-50% + 10px))}to{ǖ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-template-rows:repeat(7,auto);ƕ3px;ƚ}Ɓ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);Dž}Ɓug-months{ƙƾƕ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);ơƼƷ}Ɓpeak-chip{Ƅ11px;Ƌ;Ɛ1.2;ƈ;color:ƀlabel-secondary)}Ɓpeak-classic{ƜƆƇƕ5px;ƺ;Ɗ0}Ɓpeak-classic Ɓpeak-track{Ƙ;ƴ}Ɓpeak-classic-marker{Ƥtop:0;Ưwidth:4px;ǏƂƀbg-base);Ɩ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);ơƼƷ;ƅ2px}Ɓpeak-classic-marker:after{ǓƤ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;Ƌ;Ɛ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;DŽƓ}Ɓpeak-rail-track{ƜƆƇwidth:6px;Ǒƅ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;Njƚ;height:2px;Ƃƀbg-base);box-shadow:0 0 0 1px ƀlabel-tertiary);transform:translateY(-50%);ƽƷ}Ɓpeak-rail-label{Ƅ10px;Ƌ;Ɛ1.2;ƈ;color:ƀlabel-secondary)}Ɓpeak-rail-classic{ƆƇƃ;ƕ3px;DŽƓ}Ɓpeak-rail-classic-track{ƜƆƇwidth:14px;Ǒƅ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{ƤƯNjwidth:12px;ƻ;Ƃƀbg-base);Ɩ1.5px solid #ff9800;box-shadow:0 0 0 1px ƀbg-base),0 0 0 2px ƀlabel-tertiary);ƵƽƷ;ƅ2px}Ɓpeak-rail-classic.off Ɓpeak-rail-classic-marker{border-color:ƀstate-business-primary)}Ɓpeak-rail-classic-label{Ƅ10px;Ƌ;Ɛ1.2;ƈ}Ɓpeak-rail-classic.weekend Ɓpeak-rail-classic-marker{ǀ}Ɓgrid-group{grid-column:1 / -1;margin-top:8px;Ƅ12px;Ƌ;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;Ƌ;color:ƀstate-business-primary);Ɣ}Ɓtoggle-btn:hover{text-decoration:underline}Ɓcollapsed-note{Ʈ}Ɓcatalog-vendor{LJƄ12px;Ƌ;color:ƀlabel-tertiary);border-bottom:1px solid ƀborder-l1);padding-bottom:2px;Ɔƃ;Ǝspace-between;ƕ8px}Ɓvendor-toggle{Ɣ;Ʃ}Ɓvendor-toggle:hover{color:ƀlabel-secondary)}Ɓvendor-display{ƒƃ;ƕ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);Ɣ}Ɓmodel-costs Ɓmstats-tab.active{Ƃcolor-mix(in srgb,ƀstate-business-primary) 14%,ƀbg-base));border-color:ƀstate-business-primary);color:ƀlabel-primary);Ƌ}Ɓmstats-h{ƛ10px 0 4px;Ƅ12px;Ƌ;color:ƀlabel-secondary)}Ɓmstats-row{ƙgrid-template-columns:minmax(90px,170px) 1fr auto;ƕ8px;ƃ;Ƅ11px;Ɛ1.7}Ɓmstats-name{ƌ;ƍ;ƈ;color:ƀlabel-secondary)}Ɓmstats-label{ƶ;ƆƗ;ƃ;ƕ6px;ƺ}Ɓ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;Ǘƴ;ƅ2px;margin-right:3px}Ɓmstats-note{LJƄ10px;Ɛ1.6;color:ƀlabel-tertiary)}Ɓmatch-row{Ɔƃ;ƕ8px;Ɖ3px 0;Ƅ12px;Ɨ}Ɓmatch-row Ɓinput{flex:1;Ɗ160px}Ɓbudget-controls{ƙ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;DŽƃ;Ǝ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;Ƌ;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{Ɔƴ}Ɓ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;ƺ}Ɓ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{ƒƃ;ƕ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{Ƙ;ƒƃ;Ǝ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;Ƌ;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{ƻ}Ɓ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);Dž}@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;Ƌ;color:ƀlabel-primary)}Ɓmm-reset{Ƅ11px;color:ƀlabel-tertiary);ƶ}Ɓcodex-head>Ɓmm-title{Ɗ0;ƌ;ƍ;ƈ}Ɓcodex-resets{Ƙ;Ɵ}Ɓcodex-resets>span{ƫblock}Ɓfooter-stack.compact Ɓbbox[data-cm-display=codex]{grid:auto/1fr}Ɓbbox.rail[data-cm-display=codex] Ɓbbox-rail{Ƒ100%;Ơ;džƄ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){Ɨ;NJǒnjalign-content:flex-start}:has(>div>[data-slot="sidebar.footer.action"]>Ɓfooter-stack){NJǒmin-height:0}: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 Ɓfoot:not(Ɓfoot-rail){Ǝspace-between}Ɓmodel-costs Ɓcollapse-h{ƚ}Ɓmodel-costs Ɓcollapse-h>Ɓbal-amt{margin-left:auto}Ɓfooter-stack.compact Ɓbbox{ƙgrid-template-columns:repeat(2,minmax(0,1fr));column-ƕ12px;row-ƕ2px;ƃ}Ɓfooter-stack.compact Ɓbbox>*{ƶ}Ɓfooter-stack.compact Ɓbbox>Ɓmm-row:not(Ɓmm-title){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);ƭƧ;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{ƻ}Ɓ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;Ƌ;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{ƨLj}Ɓ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{ƨLj}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)}Ɓtoday-values{ƒƗ;Ǝflex-end;ƕ2px 8px;Ɗ0;Ƒ100%}Ɓtoday-values>span{ƈ}Ɓtoday-values[data-both=true]>[data-cm-today=tokens]{Ƅ11px;color:ƀlabel-secondary)}Ɓsimple-summary{Ƃƹ;Ƃrgb(from ƀbg-layer-1,ƀbg-base,#fff)) r g b / 1)}'.replace(/[ƀ-ǿ]/g,e=>Hn[e.charCodeAt(0)-384]),Aa="dsh-cost-meter/client.css";if(typeof document<"u"&&document.head!==void 0){const e=document.querySelector("style[data-plugin-css="+JSON.stringify(Aa)+"]");if(e?.textContent!==va){const t=e??document.createElement("style");t.dataset.plugin="dsh-cost-meter",t.dataset.pluginCss=Aa,t.textContent=va,e===null&&document.head.appendChild(t)}}const Qn="sessionCostTitle|sessionDetailTokens|sessionDetailCache|cost|sessionLine|sessionLineCompact|sessionCostCompact|quotaUnlimited|pricingCnyHint|balanceQueryFailed|unknownError|balance|officialBalance|balanceShowSource|quotaComposer|quotaSidebarSettings|quotaSidebarComposer|quotaSettingsComposer|quotaAllPositions|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|codexQuotaEnable|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|codingPlanClinepass|codingPlanScnet|codingPlanVolcengine|codingPlanQwen|codingPlanMimo|wbT|wbH|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("|"),qn="额度|显示|amount|余额|价格|费用|DeepSeek|会话|quota|模型|输入|session|off-peak|official|balance|缓存|计费|OpenCode Go|Plan|display|prices|刷新|官方|自动|设置|time|OpenDesign|tokens|input|the|自定义|weekends and Chinese public holidays are|预算|Token|调用|message|output|今日|credential|凭据|侧边栏|Balance|cache|settings|用量|金额|Enable|Refresh interval|中国公众假期全天谷价|同步|失败|峰时高价时段显著提示|开启|时段|details|refresh|Settings|and|calls|cost|位置|历史|峰时|已用|输出|price|usage|BillingCenterReadOnlyAccess|sidebar|以同一系统账号运行|框上方|budget|currency|interval|position|保存|图框详细信息|当前|Credits|Refresh|account|WorkBuddy2API|period|启用|数据|本地|留空|Codex|model|optional|右下角|Budget|DescribeBillingAccount|credits|failed|history|source|分钟|匹配|命中|币种|查询|记录|谷时|账本|配置|默认|Coding|Strip includes|rates|上方|剩余|小时|峰谷|提示|时间|更新|横条|统计|订阅|读取|Chinese|Sidebar|default|minutes|人民币|API|Cache|automatically|empty|month|YYYY-MM-DD|auth login|billed|configured|planAmount|使用|侧栏|全部|可选|本月|请求|谷价|进入|隐藏|ArkReadOnlyAccess|Display|Off-peak|Quota not queried|browser|current|is an upper bound|local ledger|never echoed back|subscription|法定假日|逗号分隔|AccessKey|Output|Preview entering|Remaining|WorkBuddy|including|ledger|overrides|remaining|this|主机|估算|关闭|密钥|恢复|日期|明细|暂无|来源|浏览器|清除|登录|积分|累计|账号|进度条|间隔|Today|Volcano Ark|coding plan|local|a catalog entry|comma-separated|deepseek-v4-pro|only|peak|导入安装前|开始对话后|汇总在这里|Monthly|Volcano|pricing|Cost|Entering|Failed to load|Input|Official|Provider|Show|a vendor group|built-in table|custom|enough samples|historical|stay unchanged|strip|takes priority|to restore|toppedUp|优先|取消|周末|图框|安装|展开|手动|挂载|提醒|方向|消耗|添加|确认|等值|美元|Alibaba Cloud|Authorization|volcengineapi|Quota|above|effective|estimates|qianwenai|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|percentages|pre-install|qianwen-cli|token|unavailable|DSH|Auto-match|Claude Pro|Cline Pass|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|placement|plan|precision|providers|reasoning|signed-in|stay|subagents|use|中复制|占位符|子代理|工作区|性价比|抵扣率|控制台|未上报|条起步|标题栏|知道了|表条目|起始日|过期后|这一项|阿里云|Base URL|Cookie|Currency|External|HTTPS|Moonshot|Public|Security|Source|Usage|actual|calendar|click|deepseek|enable|follow|full|notice|override|progress|provider|range|read|recorded|requires|sample|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|box|bundled|channel|earlier|gateway|here|holiday|include|key|name|not|percent|plugins|qianwen|replace|require|unknown|Click|Enter|Local|ROUTE|USD|alert|equiv|first|limit|match|query|saved|start|stats|value|CNY|Change|Choose|Gemini|Kimi|Ledger|NewApi|OPENAI|Recent|Rhythm|Saving|VOLC|active|card|corner|direct|divide|fields|import|logs|manual|openai|origin|pct|port|reason|remain|resets|select|studio|sync|上下|上界|上限|不再|不是|不足|为准|之后|也可|仍在|保持|允许|入口|分开|包含|单家|即将|原因|发生|同名|后的|后缀|回放|回显|回退|域名|填入|处于|字段|对应|导出|将按|屏幕|工具|平价|底部|开关|总额|打开|按量|放行|新增|早期|最近|月度|权限|条数|样式|样本|概览|版本|状态|现在|界面|百炼|目录|直接|符号|类型|紧凑|缺失|网关|花费|英文|表外|规则|语言|调整|账单|货币|赠送|超出|跟随|通知|重试|钱包|页面|Add|bar|CLI|KEY|Keep|Sync|VAR|When|clear|day|dock|docs|each|leave|left|now|show|that|tok|will|yet|your|All|Pro|com|Auto|Not|Save|auto|back|can|chip|its|keep|old|open|per|save|Top|low".split("|"),Ee=Object.fromEntries([["zh",'本Ƈƅ(按每次Ƣ˜͑͞Ɛ)|Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|Ə:读 {̭} · 写 {̶}(ʏ按ǣ价Ɛ)|ƅ {Ƃ}|本Ƈ {Ƃ} · ǣ {ʂ} · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|本Ƈ {Ƃ}|仅Ɓƭ|无限制|Ǎǽƭ来自ɦƄ × ͘ {ʅ}。对照Ɩǽϻ,请ʤ Θ,再ƱƄ;Ʊ仅˞ʔƢ。|ƃǥƲ:{ƣ}|ˡ错误|ƃ|Ɔ ƃ|Ɓƃȯ(Ɔ)|Ɗdž|ȉ和Ƙ页|ȉ和Ɗdž|Ƙ页和Ɗdž|ȊƼ|ǥƲ|Ɔ ʗʢƃ|Ɩƃ变动与ǕǨ交叉͉(偏差超阈时Dz)|总ƃ {Ƃ}|Ͻ {ʁ} · ̹ {ɗ}|Ǵdz {ƙ}|Ơ({ǒ})|ƿ {ʊ} / {Ƃ}|ƥ {Ƃ} · 占Ơ {ί}|Ȍ {Ȃ} · ȴ {ɰ}|Ơ|ƥƅ(按ƖƄ͞Ɛ)|ƥ ơ Ƭ|ƛ|Ƣ {ƺ} 次 · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|Ȍ {Ƃ}|ȴ {Ƃ}|ƥ|ƨƥƁ|ƅ|ơ Ƭ|ƥ|Ȍ|ȴ|ƞ˘|ȮƽǦ。ɂ,ƅϖ天Ƀ。|Ȭ|Ƣ|Ɗ Ж|Ə Ж|ǀ Ж|ƅ|ƥȮƇǦ。|Ƈ|ǓƠ|Ơƀ(按ƁǤ)|Ơʕ|开始Ȭ|结束Ȭ(ǖ = ƥ)|Ƕ˘:{̬}|ǓƠ后Ɓƀ、ƿƭ及比例(按ƁǤ换算);ȋƥ、Ȍ、ȴ或ƞʕ。|{ǒ}Ơ {Ƃ} · ƿ {ʊ} · {ί}%|(已Ͼ)|(接近ι)|旧Ɖ|ǪϏ|ʟ|˛|ǧ|ƾ|ƃ专用 Ǿ ͡|ɘȈ此ʗ ͡;未ǩ时Ǹ已ȲƖȵƃ,其次沿用ƉƧ。|总ƃ {ɰ} · Ͻ {ʁ} · ̹ {ɗ} · Ǵ于 {ƙ}|ƃǥƲ:{ƣ}|未ǥƃ|Ɩʢƃ|ƕ中…|ƕƃ|ƞ Ɍ ƃ|ɣǩ|ɣ ơ Ρ ƃ|Ɓ官网ʢ页的ǽ˚ƃ。Ȳ ʼrhythm.ε,在Ȱ开发者Ϙ → 网络̇ʢȍ的 ̘,或在存储 / ͊̇ tr_Ƌ 值,ϑːƧ并Ǔ。̘ 仅存 ʾ Ƨ库;̔重新͆。|ɣ̿ / ̖ƃ|ǥ̖中国站˚金。RAM ȝ 需 bss:ǜ Ϥ。前两项必填;STS 才需 ̞ ơ。Ȫ存Ƨ库。|extract ͐点͠、数值和 add/̳/Ψ 运算;Ξ ƈ 除以 500000 得到ɦ。|̸ʓ|϶ʓ|ȍ URL|͐ ̛、本机 ͭ,以及 /΄/… 相对͠(ƗϿ ʾ ˦)。|ς非回环 ͭ(Ƨ明文传输;须将准确的 ȧ:˦ 加入ɱ)|+ Ǒ ȳ|Ǒ 预设Ǹ活跃ȵ池ǯȳ,Ȉ管理后台 X-Admin-ơ(λƉ Ǿ ͡)。请͆˜ͅ与˦;令牌̔ǴƧ。|ȍ方法|ȍ头 (ɷ)|ȍ体 (ɷ)|ǖ不́;ɷ 原文Nj并́。Ǫ ɴ 为 ʬ/json,ʒȍ头ʠ。|解析ϸ (ɷ)|ƞƃƁƼ|ƕȷ (ǡ)|ƃ原Ǥ|按ƁǤ͎(΍ ƃ)|ȈƁ͘与͝;ƃǤρ端点原Ǥ。̺Ǥ及ȳ不͎。|ƃ {Ƃ}|˝ƿ {Ƃ}|ƿ {Ƃ}|ƃȶ (蓝=ƃ,橙=˝,灰=ƿ)|ȶɡ|各组ȶ可͚ʤ填充ɡ:「ǯɡ」满̏、随ɢ递减;「ƿɡ」空̏、随ɢ填满。|ƃ条(Ɩ/ƞ)|Ơ条|Go ƀ条|ƒ / Ǘ ƀ条|ǯɡ(满 → 空)|ƿɡ(空 → 满)|ƀι (ȋ)|ǖ则ɘȈ Ǿ 返回的 max_LJ;仍无则Ɓ整条浅蓝|ɷ ͖无效|{{Њ_NAME}} 从Ƨ库或ʞǸ。<Ό>_Ǿ_Ї 中 Ό 为大写 Ɍ ID,ϰ改下划线,如 έ→Ο_Ǿ_Ї。ϊ共用Ȫ。|Ƨɱ (Ȝ)|ȍ头带Ȫ时仅ϟ̼内ȧ,ǖ则ϟ并警告,防ʖ他人ǩ外带Ȫ。|ƧƊ|为Ǯ {{Њ}} ̈存入Ȫ(̶-ȿ,͂Ƨ库,不ώ):|ȍ头还没有 {{Њ}} ̈:ϑ如 "ɨ": "Beʮr {{MY_Ǿ_Ї}}" 后ʣ会出现ƧƊ框。|Ǔ|ǯ {ȥ} · ƿ {spend} / ƀ {maxǛ} · Ǵ于 {ƙ}|ǯ {Ƃ}|ƕƞƃ|Ƒ Ƿƀ|Go|ʚ 5 ǰ|͔|Ȍ|ʦ:{ƙ}|已到ʦdz|ǯ {d}天{h}ǰ|ǯ {h}ǰ{m}分|ǯ {m}ǡ|ƿ {ί}%|ǯ {ί}%|{΃}%|Ǵ于 {ƙ}|Go ƀƁƼ|Go ƀƕȷ(ǡ)|ǡ|Ƒ Ǿ ͡(ȋ,ǖƗ̀)|Go ƀ主ˢ|Go nj|已ǩ(ȯ:{Ǡ})|未ǩ|Nj|˧Ƨ|ȱ|Nj中…|Ȫ只ʏ ʾ Ƨ库,不Nj在Ǩ里,也̷ώ。|以下ȪπǕǨ,未迁入Ƨ库。请ϕϔʞ后重启:|Ơnj|ƕƀ|未ǥƀ|˵(ˀ/Max)|Z.ai / 智谱 GLM ǫ ƒ|ɸ ơ ƒ|ɸ ƒ|ǥϐ(̛)|ǖƗʤƖ站点。͆后 ͡ 仅发往该ϐ;Ȉ可信ͅ,不含͠。|5h|7d|ϝ Ɔ ̹页(plat˼m.̤.М/ǂ)|ͥ (Ǘ) ƀ|Ǘ ƀ未ƴ · 点此ƴ|5h ƀ|周ƀ|{ƙ} ʦ|未取得ƀ,请ɤ所选ǔ源已Ȳ;ʝЁ|Ɓ Ǘ ƀ(需Ȳ Ǘ 插件)|在ȉƁ Ǘ ƀ|在Ɗ区Ɓ Ǘ ƀ|本Ƈƅυ̉|Ȯƀǔ|ƁƼ|可单独ʤȉ、Ƙ页或Ɗdž,ο同时Ɓ。φƼɘ于ǵǪƘ。|Ǿ ͡(ȋ,ǖƗ̀)|ƕȷ(ǡ)|ƕ|Ȳ|Ȳ中…|未ǥƀ|ІЛxyǾ ϴƀ|ɣȯ|ȯʓ|̗|ƁƼ|ƕȷ(ǡ)|Ƨɱ(ȧ:˦,Ȝ)|˃ ͡(͂)|Ϫ|不͐的 Ɍ|ˡ|未̀ȵ|抓取于 {ƙ}|˕ȵ (Ǎ: {ǐ})|只Ɓ Λ ƀ|ƕ|先˗Ǔ̕|Ǔ并NjƁƼ̈́ƕ|̽|˗Ǔ后会排到最上面;点ʓ可ɝ该项自己的ǩ。ƞƃ͓ 8 条,ϴȯ͓ 4 条。|未Ǔ。ƴ后ϖƕȷǥ该˙的 Ⱥ ƀ并Ɓ在ʣ。|ƴ后Ǹ Ƒ 的ʚ 5 ǰ、周、月ƀ,Ɓ在ȉ、Ƙ页及ǚ;无Ƿ时Dzψ。|ǚƁ(Ў)|在ǚƁ Ƒ ƀ / Ơ|ʚ 5 ǰƀ|͔ƀ|Ȍƀ|Ơƿ%|5h|周|月|日|Ơ|ǨǸƲ:{ƣ}|正在ǸǨ…|Ǩ不˚|ƱƲ:{ƣ}|ƽǦ已ȱ。|ȱƲ:{ƣ}|DZʡ已ȩ,按˛ƄƐ|尚未ˤ(ˤdz:{ƙ}),Ǎ按˛ƄƐ|Ǎϒ峰Ƶ,按ƾ价Ɛ|Ǎ为 Ɔ ƾ高价Ƶ,按ƾ价Ɛ|Ǎϒ谷Ƶ,按ǧ价Ɛ|ɚƵ——全Ȏ(周六及周日˔按ǧ价Ɛ)|ɚƵ——全Ȏ|ɚ全谷|ț——˔Ȏ|ț——全Ȏ|假日|ț(̾Ȭ,Ȝ)|自 2026-08-23 ̾dz 00:00 起,ɚ和ư;调休上班的ɚ仍按Ȏ。|ƾ|ϙ|DZƵ条Ϧ|简洁(单行ϲ)|经典(分段与胶囊芯片)|峰/谷˕前͋ɠ|提前ɠ(ǡ,1-30)|ɠϱ|ȏƾ|ȏǧ|峰和谷|χȏƾ|χȏǧ|约 {ƙ} 后Ɛˢ˕为{phase}价,请注意本ƵƢ成本。|ƾ|ǧ|̑|峰价ɠ|Ȏɠ|͋Ƽ|ǚ|ϗ中心|Ʊ́系统Ѐ|ϛ后͟Ȱͅ栏ςЀϤ,才能在Ѓ最小化/切走时收到ɠ。|ʧ͋|ʧ ȏ峰|ʧ ȏ谷|(ʧ)|DZʡ与Dz|Dz已Ȑ:需ǓDZʡ并ƴ「Ƴ」。|常规|ƭ与Ǥ|ƨƁ|͜ȉƁ|精简ʑ,ʍƭ、ƀ和͍详情;高度͓占ϗ 38%,Ͼ可ʚ。ȩ后ȫ。|试试更轻巧的ȉ|͜Ɓ可以为Ƈ̼留出更多空间。要ϫƴ吗?ξʒ「Ƙ → ƅ → Ɓ」中˕。|ƴ͜Ɓ|ʍǍƁ|Ƙ未能Nj。可Ё,或ȩDz后在Ƙ中Ϻ。|ȩDz|ƥ / {ǒ}Ơ|ƨȶϦ|͕|ϲ(两列)|ȫ已ʟ的Ɖ ({˭})|ʟ会ȱɞ映射并Ȑ此行,可ȫ;̷̽ƬǦ,ʔ按ƗǢϸʡ。|ǚ角标|nj|əɟ|未核价|已ƞ|这个Ƅ是你ɞ改过的,ƗƱ̷ʠ它。|ȫƗƱ|按ƉǶ(ʼ 与ƅ)|ȉƉϵ|{n} Ɖ|其它|ƁƉϵʑ|Ǫɝ|记住ɝϪ|Ɓ ơ|Ɓƅ占比条|ǚƁ Ъ-1 Ɖ|Ǫʕ|收起摘要|ʑƼ|Ɖ行数(1–10)|ƕȷ(10–60 秒)|ʕϜ与Ɖ数|Ъ-1 Ɖ与ƭ|顶部|ƃξ|Ϛ|ƥ|近 90 天|ƅ排行|ơ ɢ|Əǣ率|̎?|长Ƣ无Əǣ:代理̓ʟƏϓ。ƭ按全未ǣ计,是θ;可直连核对。|̋ · 每ɦ ʼ 数|Ɗ|Ə|ǀ|该ƵȮƬǔ。|综合ʐ {ǁ}/M|ǣ率=Ə读÷(Ə读+普通Ɗ);「̎?」表示Əϓ̓ϳ,ƭ为θ。ʐ=ƅ÷ʼ×1M;̋=ʼ÷ƅ。|未分Ɖ(ϡǔ · 按当时ǦƐ)|本Ƈ {Ƃ}(Ǿ)· ƒ ɥ {ȇ} · ǣ {ʂ} · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ}|本Ƈ {Ƃ}(Ǿ)· ƒ ɥ {ȇ}|ƅ {Ƃ}(+ƒ)|ƒ Ƿƀɢ(ɥ){Ƃ}|ơ ƒ ƬǶ(每 1% 与͙Ȩ)|尚无 ǫ ƒ ƀǔ;͟「ƀ」页ƴ并ƕ˙。|͛|ƿ %|本ʕ˜(ǕǨ)|每 1% ƀ ≈|͙ 100% ≈|ʦ {ƙ}|˨差分|ǍƬ͎|ϧμ|{ʃ}(基准 {ƙ})|读数͝受限|ƒ Ƭ曲线(按ʥ聚合)|͗|每周|每月|˨μ:至少两次成功ƕ,且ƀɲω变化。|{ɿ}:͙估计 ≈ {̧}(每 1% ≈ {Ш1})· ˜ {ƛ} / {ƻ} · {ljs} 个ʥ|ƭ是Ϯ价ɥ;Ƿ耗ƀ,Ơ只计 Ǿ。Ȩ仅含 dsh Ƣ;服务端ɲ含全ȵ。短时ϧ͝有限;5h ʚ,周/月按Ǖ日历。|Ɛ方式|ƒ Ƿ|Ɨ|Ǿ Ϟ|在ƅƘϯƁ|仅控制是否在ƅƄ表ϯƁ;不˞ɟ和Ɛ。ə˗后πƄ表内,可随时改回。|ɝ˙可˧Ƅ;əɟ的ʎƉʒːȫ。|̻Ƙ˓|可Ɗ 2 × 0.8|˒˓会Ʊ到本ƉȊʐ|仅˒̕的˓;ə˗ȫ统一˓|请Ɗ非负ʐ或乘法,例如 2 × 0.8|ˡƉ名ƗǢ|Ɨ(去ό / 前缀 / 家族相似)|仅͞Ǣ|ɞ指定ɘ;ƗǢ只接受ϊ及Ȭ、ϩ、η文ό。未ǣ的 Ɔ 用Ǫ价,̺ˣ不ʡ。|待Ǣ与ɞƘ|按ˣ和Ɖ̻Ƙ:ʤƄ̒、ƞƄ,或标记为ǕƉ。ƞƄ只˥Ǎˣ。|Ɔ Ǫ价|ʟ|ǕƉ(零ɢ)|已ǢƄ的Ɖ|ǍȈƗǢ。可改选Ƅ̒、ƞƄ或零ƅ;Nj后移入ǮɞƘ区。ơ 仍会Ƕ。|ρƗǣ|ȮɞǢʠ。|已ɟ(参与Ɛ)|Ɗ|ƏǸ|Əʏ|ǖ时按ƏǸ价Ɛ|ǀ|Ɔ Ƅ表(已ɟ)|Μ / ̜|˄|ʫ 硅基流动|CommƹCode|ˁ|SCNet 超算互联网 ơ ƒ|ʜ ȹ ǫ ƒ|̿ Ͳ ơ ƒ|小米 MiMo ơ ƒ|ȡ ȳ|ƗǸ ȡ ȳ。|ͪ (Droid)|ƚ|ƚ ̊ ID|仅在 ʾ Ƣ ƚ Ǿ οƐ,无需ɜ ƚ ͊。远端ƀǥ另需 ƚ Cloud 的̊ ID 与 ʨ(λ͏ Ǿ ͡);未ǩ时可ȩƀʑ,ƇƐ照常。͈͛与ЂτƁ。公开ϮƄ˥ ƒ ɥȨ;Ђ扣费͟Ɛ分类中设为 Ǿ。|ƀϱ|Stƹard + Core|组织 ID(ȋ)|͈ȳ|补偿ȳ|ƃ|ƀȯ|ǕȨ|Ɩ І|ϭ І|І 模式需在 ʾ ȧɜ @ɮ/ʻ,并Dž ΅ Ȅ。|ϭ І:在 ʾ ȧɜ ʰ。Ȳ按钮会在该ȧϝ授权Ȱ;远程或无Ϭȧ请Dž bl Ȅ --ɽ。|ϣ ǎ ƀ(个人版 Lite 5 万 / ͕版 50 万,以Ƿ页ν)|Ƿ̓(ȋ,͖ ȃ;ǖʘ)|ǎ ̌ʠ(ȋ;每百万 ʼ 抵扣的 ǎ,ǖ用ʎ表)|Ɖ名,如 qwen3.8-ʸ|费率|Ɗ|Ə读|ǀ|待填齐三项正数后ƗNj;Ȋ清空ȫʎ表。|ɣ|ǎ ǕȨ,以̍ν。Ƕ归属͈̿的 ƒ Ƣ;ˑϞ Ǿ。ϷƉ需设̌。|ǕȨϣ ǎ ƀ(˛ 60,000 / ͕ 240,000 / 高级 600,000)|Ƿ̓(ȋ,͖ ȃ;ǖʘ)|ɘ用 24 ǰ内的̍͌,否则按ǕǨ和Ɩ ǎ 表Ȩ。̺Ϙ和ϷƉˑ入。|ʛ ȝ ID|ʛ Secretȝ|ʜ需 AK/SK、ȑ 和 ǃ;可填Ƨ或ϕ Σ_˴/Σ_˷。只连接 Ч.ɩ.М。|AK...|SK...|{h}ǰ|{h}ǰ{m}分|{m}ǡ|{ƙ}后ȏϙ|{ƙ}后ȏ高峰|峰Ƶ(UTC):{ʋ};ˤdz:{ƙ}。{ˎ}|未ǩDZƵ。{ˎ}|ˡ|ƥƅ|Ȍƅ|ȴƅ|自Ǩ建立以来 · Ƣ {ƺ} 次|͇Ƭ|ʾ + ͇合计|͇͌超过 24 ǰ未Ǵ|近期͗Ǧ|ƭ取Ϣ͌,̓比Ɩϻ晚几ǡ。ƛ 含Ɗ、ǀ、Ə和͏;͏并入ǀƐ。以ƭ͉。|ƥ/Ȍ按宿主͒ {ʶ},Ȱ为 {ȕ}。͒不同会˞日界和͉;可将 dsh 改为Ǖ͒。|ƥƇ|ʝȬ行可ɝ˝Ƈȭ|Ƈȭ˖中…|该日无Ƈȭ(ϡǔ或Ƈˠ已清理)|Ƈȭ˖Ʋ|按ƇǶ(Ȋƽ)|跨天合并,̉按ϛ归并。仅列选定ϥ,ȴƅυȊ对话。|ȮƇǔ|Ƈʙ中…|ƇʙƲ|Ɓϥ|Ƈ̼附显Ƈ ID|ƭ含 ƒ Ϝ|ƴ后所有ƭ按含 ƒ Ƿɥ的总ƅ展示;ȩ(Ǫ)仅计真金白银 Ǿ ˣ|ȐƖʢƃ(ƴ后ƨ与Ƙ页κƁƖƃ)|Ȑƥɢƭ(ƴ后ƨ/Ơȭ/ϨʑκƁƥƅ)|Ȑ̐ƅȭσ|ȐƊ框ːƅȭσ|Ȑ每轮回复ϋ本轮ƅ|排序|ƅ 高→低|ƅ 低→高|dz 新→旧|dz 旧→新|实时顺序|ƽǦ|ơ ƬǶ|ȴ {ƛ} ƛ · Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ} · {ƺ} 次Ƣ|{ɿ}:共 {ƛ} ƛ(Ɗ {Ɯ} · Ə {ƪ} · ǀ {Ƥ})· {ƺ} 次Ƣ · {ƻ}|Ȯƽǔ,ɂ͗Ƭ会Ƀ|Ƭ|ơ ƬǶƼ|ƅƘ|通用Ƙ|͚分节(Ƭ)|ƁƘ|Ϩ|ƀ|Ƭ|Ƅ|Ɓ|ƽǔ|ƇƅƁƼ|Ɗ区ː|Ƈ̐|ȩ|Ɗdžƀǵ|ǪǓƀǵ(φƁƼɘ)|ǵ含Ơƿ%|ǵ含 Go ƀ|ǵ含 ǫ ƒ ƀ|ǵ͍可见各͛ʦ͑与Ǵdz;无˚ƀǔ时ƗȐ。|Ϡ:Ɗdžƀǵ|在ƊdžƁƠ及 Ƒ/ǫ ƒ ƀɲ。ϫƴ吗?ʒ「Ƙ → ƁƘ」˒。|ƴǵ|暂不ƴ|ʝ立即ƕ|Ϡ:ƃɛʝƕ|ʝƨƃ或 ǫ ƒ ɛ即可ƕ;ƕ时ɛ闪烁,Ʋ时ʍ原值并在͍Dz中说明ψ。|̑|˝ƅƁ|ƨϚ|ϼ单位|ǽ Θ|ɦ ΍|欧元 EUR|ϼϰ|͘(1 ɦ = ? 目标Ǥ)|小数位数|ƃƁƼ|主Ѓƨ|Ƙ页|两者都Ɓ|ƃƕȷ(ǡ)|Ǔ Ɔ DZƵƄ|Ƴ(ƨƠ框/ƥƅ;Ƙ页DZ面板内ʧ)|Ƈ按Ƣ时ƄƐ(含DZ与ƽˢ)。Ɗ、ǀ、Ə读写τǶ;͚Əʏ价与长η˟位按ǩˤ。|已ɟ的Ƅ表|ƖƄǤ|ɦ(϶Ɩ页)|ǽ(̸Ɩ页)|决定ƱƄ所用的Ɩ页Ϲ;ƱϋƄ˥ʔƢ。|Л 与 ʩ ̻按ƖʐƐ,旧 ʩ ʓ按 ʩ 价结算。工作日̾dz 09–12、14–18 为峰Ƶ,ɚ及ư。改价˥ʔƢ,已Ǧƭʍ;修正旧ƅ请ɤ后Ȉƽ重算。Əʏ按ǣ价。|ʣƁǍ适用Ƅ。手工˧会ə此条ʔ预定调价,已ω的ƽƄ仍ʍ。|ǻ(未ǢƉ时Ϗ)|新Ɖ ID(如 Ⱦ)|ɣƉ|ǔ与Ʊ|Nj中…|ƗNjƲ:{ƣ}|已ƗNj {ƙ}|ǩ˒后ƗNj|ɤ用Ɩ˟ƄʠƄ表?|͊|ə|从Ɩ˟ƱƄ|ƖƱ只Ǵ Ɔ Ƅ(含DZ);z-ai/Μ/Ͳ/Ʌ 等第三方Ƅ随ϩǴ,ʒƄ表ɝϔ˙˧,或用Ɖ名ǢϺ。|ɤȱȊƽ?|Ɂƽ|ɤʖ?将ύȊƇˠ,只补Ǩϳ的Ȭ与Ƈ,不˞已有Ǧ。|ɁƽƲ:{ƣ}|首次启动Ɨʖ旧Ǧ;拷入ˠ̈́重跑。按ǍƄ回推;已̽ˠ无法ύ,跨ɜ͑的Ƈˑ此前Ƭ。|ɤȱ|ȱȊƽ|ϢƱ:{ƙ}|从未(ȈʎƄ)|;ȯ:{Ǡ}|Ɩ˟|ʎǪ|ϬϹ|Ͽ ʾ(Ɨ)|简体̸|ɶ|ƅ|{ʃ} ƢƲ|ƱƢƲ|ƃƕƢƲ'],["en",`ɇ of Ȧ Ƌ (ȅ ˊ А c˹ ƙ)|Ɋ {Ɯ} · ǿ {ƪ} · Ȟ {Ƥ}|ǿ: ̭ {̭} · ̶ {̶} (̶s ȅ at Ɲ hit ǁ)|ɇ {Ƃ}|ɺ Ƌ {Ƃ} · Hit {ʂ} · Ɋ {Ɯ} · ǿ {ƪ} · Ȟ {Ƥ}|ɺ Ƌ {Ƃ}|ɍ Ƃ ȿ|UnΑed|Θ ɰs ̆ ΍ Ɣ × {ʅ}. To Мpʮ ƍ Θ bills, δ Θ, Ɲn ζ Ɣ; ζing affects ȿ new ƺ.|Ʃ Γ Ǟ: {ƣ}|˪ error|Ʃ|Ɔ Ǝ|ɍ Ǝ Ǡ (Ɔ)|Above Ɲ Ɯ ͸|Ǻ ƹ ƫ|Ǻ ƹ Ɯ ͸|Ƹ ƹ Ɯ ͸|К locations|Query Ǟ|Ɔ Ч-plat˼m ǐ Ǝ|Cross-check ƍ Ǝ ˉs against Ɲ Ș (warn ̴ Ɲy diverge)|Total {Ƃ}|ͬ {ʁ} · ˸ {ɗ}|ɻ {ƙ}|Ǜ ({ǒ})|ʹ {ʊ} / {Ƃ}|ȸ {Ƃ} · {ί} of LJ|ɺ Ȃ {Ȃ} · К ƙ {ɰ}|Ǜ|ȸ's ƻ (ȅ ˊ ƍ Ɣ)|ȸ's ʼ ǂ|ƛ|C˹s {ƺ} · Ɋ {Ɯ} · ǿ {ƪ} · Ȟ {Ƥ}|ɺ Ȃ {Ƃ}|К ƙ {Ƃ}|ȸ|Ǻ ˳ Ɠ|ɇ|ơ ǂ|ȸ|ɺ Ȃ|К ƙ|ɵ ̬|No ǟ И. Once you Ε chatting, ƻs ʮ ˈ ͽ Ш Ѝ.|Date|C˹s|In Ж|ǿ Ж|Out Ж|ɇ|No Ƌs ̮ ˳.|ɹ|Ʈ LJ|Ǜ Ƃ (in Ɠ Lj)|Ǜ ǒ|Start ɿ|End ɿ (ȁ = ˳)|Range: {̬}|Ʈ a LJ to see Ф Α, ʊ Ƃ ƹ ˍ in Ɲ Ɠ Lj. Κ ˳, Ȃ, ˹ ƙ or a ɐ ̬.|{ǒ} LJ {Ƃ} · ʹ {ʊ} · {ί}%| (over Α)| (near Α)|Legacy|ͨ f˹С|˅|Base|ȓ|ʪ|Ʃ Ǿ ΀|ɺ Open Plat˼m ΀ ɕ; 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 ˼ ΍.|ǹ ΁|ɶ ΁|ͳ URL|Supΰs ̛, Ȼ ͭ ƹ /΄/… paths Е ̦ Ɲ Ȗ ʾ ΰ.|Кow non-loopС ͭ (plaintext Ʀs; ̯ Ɲ exact ʶ:ΰ in ˹owed ʶs)|+ Ǒ ǝ|The Ǒ preset ˲ ȥ ǝ 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 (ɷ)|ɵ Ǝ Ɠ|Ư (Ǽ)|̟ Lj|Convert ΍ Ǝ to Ɠ Lj|Uses Ɲ Ɠ ʅ ƹ ̀. Ј Ɲ Ǡ Lj; oƝr currencies ƹ ǝ ɓ.|Ʃ {Ƃ}|ȸ {Ƃ}|Spent {Ƃ}|Ʃ ̪ Ѕ (blue=Ǝ, o̬=˳, gray=spent)|Лgress Ѕ ˻|Each group of Ѕs Т independently choose Ф fill ˻: "Ƞ" Εs ̧ ƹ drains ˏ ǂ; "ʹ" Εs ȁ ƹ fills up.|Ʃ Ѕs (ƍ/ɐ)|Ǜ Ѕ|Go ƈ Ѕ|ƒ / Ǘ ƈ Ѕs|Ƞ (̧ → ȁ)|ʹ (ȁ → ̧)|Ǜ cap (Ǚ)|Leave ȁ to ̆ Ǿ max_LJ; 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 ƈ Ɠ NJ|Go ƈ Ʒ lj (Ǽ)|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.̤.М/ǂ)|ͥ (Ǘ) ƈ|Ǘ ƈ is disabled · ̣ to ̥|5h ƈ|ˇ ƈ|γ {ƙ}|ɪ ʽ. Ʈ ƹ sign in to Ɲ δed Ǡ; ̣ to retry.|ɍ Ǘ ƈ (̯ a ̃ Ǘ plugin)|ɍ Ǘ ƈ in DŽ|ɍ Ǘ ƈ ɫ ʱ|ͯ ̅ in Ƌ ƻ|No ƈ ʲ|Ȓ NJ|Κ Ɲ DŽ, ƫ, Ɲ ʮa ɫ Ɲ Ɯ ͸, or a Мbination. Individual ˾ Ȥ ɔ ǻs.|Ǿ ΀ (Ǚ; ȁ = ʯ)|Ư (Ǽ)|Ǐ|Login|Signing in…|Ȕ|ІЛxyǾ ͼ ƈs|Є Ǡ|̟ label|̗|Ȓ|Ư (Ǽ)|˂ ˹owlist (ʶ:ΰ, Ƚ)|˃ ΀ (̶-ȿ)|Status|Unsupΰed ́|˪|No ǐs|fetched {ƙ}|Switch ǐ (Ȗ: {ǐ})|Λ ƈ ȿ|Ǐ|Ʈ Ȧ item ΐ|Ʈ ƹ Щ a Ɠ NJ to Ʒ|˅|Ʈd items move to Ɲ top; ̣ a ΁ to expƹ Ф own ƫ. Up to 8 ɐ Ǝs ƹ 4 ͼ Ǡs.|Disabled. Ʈ it to Γ Ȧ vendor's Ⱥ ƈ on Ɲ Ʒ lj ƹ Д it ͽ.|Ʈ Ƒ rolling 5h, weekly ƹ Ȃly ƈs in Ɲ DŽ, Ƹ ƹ ɼ Φ. Missing Țs Д a α.|ɳ (Ў) Ɠ|ɍ Ƒ ƈ / LJ at Ɲ ɼ|Rolling-5h ƈ|ˇ ƈ|Ʉ ƈ|Ǜ ʊ %|5h|Wk|Mo|Daily|Ǜ|Ν ̭ Ǟ: {ƣ}|Reading ȣ…|Ν ʽ|Љ Ǟ: {ƣ}|˩ cleʮd.|Clear Ǟ: {ƣ}|ʪ/ƌ Ɇ is off; base Ɣ ʮ ʊ|О И ɬ (ɬ at {ƙ}); base Ɣ ʮ Ȗly ʊ|ʪ hour Г; ɀ Ɣ ʭ|Ɔ ɀ-hour Ɇ is Τ; Ȗ ƺ ʮ ȅ at ɀ Ɣ|ȓ Г; ƌ Ɣ ʭ|˫ — ˹ ƌ (Sat & Sun ȅ at ƌ Ɣ ˹ Ѝ)|˫ — ˹ ƌ|˫|ǹ 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|Ɉ ɀ|Ɉ ƌ|Both|Ɉ ɀ ˋ|Ɉ ƌ ˋ|ͤ switches to {phase} Ɇ in about {ƙ}; mind Й c˹ ƻs in Ȧ ̵.|ɀ|ƌ|Got it|ʪ Ύ|ȓ Ύ|Popup NJ|ɳ|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 & Lj|Ǻ Ɠ|Simplify Ɲ DŽ|Condense Υs but Х Ƃs, ƈs ƹ hover ƶ. Height is capped at 38% of Ɲ viewΰ ˏ scrolling. Turn off ɖ.|A lighter DŽ|Simple Ɠ Бs more room ˼ ɾs. Ʈ it Г? You Т ˉ it in Ƹ → ɇ → Ȓ anyƙ.|Ʈ simple Ɠ|Ј Ȗ Ɠ|Ƹ could ΂ be Δ. Retry or dismiss Ȧ guide ƹ ˉ Ɲm later in Ƹ.|Dismiss guide|ȸ / {ǒ} LJ|Ǻ ̪ style|Stƹard|ͦ (2 columns)|Re̲ ʇ ǘs ({˭})|˅ Ќs Ɲ ̩ ƹ hides Ɲ row 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 NJ|Model rows (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 (ˈ ʀ ̰ ljs)|Daily|ˇ|Ʉ|О ɑ: Ʒ succesşy twice ˏ a ƈ ˍ ˉ.|{ɿ}: ʵ est. ≈ {̧} (Ш 1% ≈ {Ш1}) · ̡ {ƛ} / {ƻ} · {ljs} ̰ lj(s)|͢ ʮ catalog-ǁ Ώalents. ƒs ̆ ƈ; LJs ˭ Ǿ ȿ. Estimates cover dsh ƺ, while server ʹ cover Ɲ ǐ. Short ̰s ʮ less precise. 5h rolls; week/Ȃ ̆ Ȼ ɿs.|ͤ class|ƒ Ț|Н|Ǿ ǂ|ɍ Χly in ɇ ƫ|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 priority. ʿ ͵ ȿ Ɲ 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 ơ ƒ|ȡ|Reads ȡ ǝ Ȁ.|ͪ (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 ͷ ƫ.|ɪ pool|Stƹard + Core|Organization ID (Ǚ)|ƒ ǝ|Compensation|Ʃ|ɪ Ǡ|΋ ʴ|ɋ І|Bailian І|Inst˹ @ɮ/ʻ on Ɲ ʾ ʶ ƹ run ΅ Ȅ as Ɲ ʉ.|Inst˹ ʰ on Ɲ ʾ ʶ. Login Чs Е ʶ’s ȕ; ˼ a remote or headless ʶ, run bl Ȅ --ɽ as Ɲ ʉ.|Ʉ ǝ ƈ (Шsonal Lite 50K / Stƹard 500K; see Й ˿ ˽)|ƒ Ε ɿ (Ǚ, ȃ; ȁ = ̢ Ȃ)|ǎ ʅ Ȥ (Ǚ; ǝ deducted Ш 1M ƛ; ȁ = ɏ)|Model ΁, e.g. qwen3.8-ʸ|ʅ|Ɋ|ǿd Ɯ|Ȟ|Ί ˹ three positive ǭ to Щ Ȁ; Ќ ˹ ɖ Ɲ ɏ.|Є|΋ ǎ ʴ; ɽ is authoritative. Counts ƒ ƺ assigned to Ͳ. Excludes pay-as-you-go Ǿ. Є ǭ ˼ oƝr ǘs.|Ʉ ǝ ƈ ˼ Ȼ ɭ (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 ɿ row to expƹ Ф Ƌ ƶ|Ͱ Ƌ ƶ…|No Ƌ ƶ ˼ Ȧ Ѝ (early ʲ or Ƌ Ϋ cleaned)|ɉ Ƌ ƶ|By Ƌ (˹ ǟ)|Days Мbined; ̅ ̦ ƫ. Selected rows Дn; cumulative ƻs Ϳ every ɾ.|No Ƌ ʲ И|Ͱ Ƌ ˱…|ɉ Ƌ ˱|Rows|ɍ Ƌ IDs in Ƌ lists|ͯ ˿ ɰs|Ћ on, every Ƃ Дs ɰ Ώalent ƻ Ȣ ˿ Țs; off (ǻ) ˭s real-money Ǿ ͺs ȿ|ͮ ƍ ǐ Ǝ (Ǝ UI ʇ ʀ DŽ ƹ ƫ)|ͮ ˳'s ƻ (˳'s Ƃ ʇ ʀ DŽ, LJ ƶ ƹ overview Υ)|ͮ header ƻ ƶ|ͮ ʱ ƻ ƶ|ͮ turn ƻ summaries|Sort|ɇ high→Ы|ɇ Ы→high|Time new→Ц|Time Ц→new|Π order|˩|ơ ǂ Ζ|К-ƙ {ƛ} ƛ · Ɯ {Ɯ} · ƪ {ƪ} · Ƥ {Ƥ} · {ƺ} ƺ|{ɿ}: {ƛ} ƛ (Ɯ {Ɯ} · ƪ {ƪ} · Ƥ {Ƥ}) · {ƺ} ƺ · {ƻ}|No ǟ И — daily ǂ З accumulate ͽ|̠|ơ ǂ Ζ NJ|ɇ ƫ|ͫ ƫ|Own section (̠)|Ȓ ƫ|Overview|ɪs|̠|Pricing|Ȓ|˩ ʲ|ɹ ƻ Ɠ NJ|BeЫ Ɲ ʱ|ɹ title Ѕ|Off|ɪ ɔ ɫ Ɲ Ɯ|Ʈ Ɲ ƈ ɔ by ǻ (individual ˾ ɕ)|Ǭ LJ ʊ %|Ǭ Ɲ Go ƈ|Ǭ Ⱥ ƈs|Hover a У ˼ reset ƙs ƹ Ɲ last Ʒ; Ɲ ɔ hides Фelf ̴ Ɲre is no ƈ ʲ.|New: ƈ ɔ ɫ Ɲ Ɯ|ɍ LJ ƹ Ƒ/coding-˿ ʹ ɫ Ɲ Ɯ ͸. Ʈ Г? Ι it anyƙ in Ƹ → Ȓ.|Ʈ Ɲ ɔ|О Г|Ή to Ʒ Г|New: ̣ Ɲ Ǝ ͸ to Ʒ|Ή a DŽ Ǝ or ˿ ͸ to Ʒ. It pulses while loading; on failure it Хs Ɲ Ц Η ƹ Дs Ɲ α on hover.|Got it|ȸ ƻ Ɠ|Ǻ footer|̙|ǹ Yuan (Θ)|US Dollar (΍)|Euro (EUR)|̙ symbol|Exˉ ʅ (1 ΍ = ? target Lj)|Decimal places|Ʃ Ɠ NJ|Main DŽ|Ƹ ˽|Both|Ʃ Ʒ lj (Ǽ)|Use Ɔ ɀ-hour Ɣ|Лminent ̨ during ɀ ˯ (DŽ LJ ͸, ˳'s ƻ; previewed in Ɲ Ƹ ɀ panel)|ɹ ƻ ̆s c˹-ƙ Ɣ, Ȣ ɀ ƹ ɒ ǭ. Ɋ, Ƥ, ƪ ˲ ƹ ̶s ʮ sepaʅ; Ȇ ƪ-̶ ƹ long-context ǭ ʭ.|ͱ ǁ ɯs|ɋ ǁ Lj|΍ (ɶ ƍ ˽)|Θ (ǹ ƍ ˽)|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 ǹ|ɶ|ɇ|{ʃ} c˹ Ǟ|Љ c˹ Ǟ|Ʃ Ʒ c˹ Ǟ`]].map(([e,t])=>{const o=t.replace(/[ƀ-߿]/g,n=>qn[n.charCodeAt(0)-384]).split("|");return[e,Object.fromEntries(Qn.map((n,s)=>[n,o[s]]).filter(([,n])=>n!=="\0"))]}));function Pa(){return(typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language:"").toLowerCase().startsWith("zh")?"zh":"en"}function ze(e){const t=typeof e=="string"?e.toLowerCase().split(/[-_]/)[0]:"";return t==="zh"||t==="en"?t:null}function H(e){const t=typeof e=="string"?e:e?.locale;return t==="zh"||t==="en"?t:ze(e?.activeLocale)||Pa()}function z(e){const t=e==="zh"?Ee.zh:Ee.en;return(o,n)=>{let s=t[o]??Ee.en[o]??o;if(n)for(const l of Object.keys(n))s=s.split("{"+l+"}").join(String(n[l]));return s}}const Ye={day:"periodDay",month:"periodMonth",all:"periodAll",custom:"periodCustomRange"};function ee(e,t){throw new Error("dsh-cost-meter: 服务端数据非法 ("+e+": "+t+")")}function ue(e,t){return(e===null||typeof e!="object"||Array.isArray(e))&&ee(t,"object"),e}function Y(e,t){return(typeof e!="number"||!Number.isFinite(e))&&ee(t,"number"),e}function te(e,t){return typeof e!="string"&&ee(t,"string"),e}const Ie=(e,t,o)=>typeof e=="string"&&t.includes(e)?e:o;function Ma(e,t=!1){return e===null||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([o,n])=>t?o.length>0&&["plan","api"].includes(n):["auto","plan","api"].includes(n)))}function Ne(e,t){return typeof e!="boolean"&&ee(t,"boolean"),e}const Ve=(e,t,o)=>Object.fromEntries(t.map(n=>[n,o(e[n])]));function Ta(e,t){const o={};if(e!==null&&typeof e=="object"&&!Array.isArray(e))for(const n of Object.keys(e)){const s=e[n];if(s===null||typeof s!="object"||Array.isArray(s))continue;const l=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0?r:0;o[n]={...Et(s),...Ve(s,["input","output","cacheRead","cacheWrite","reasoning","cost"],l),apiCost:s.apiCost===void 0?l(s.cost):l(s.apiCost)}}return o}const bt=["costCny","apiCostCny","costEur","apiCostEur"],Et=e=>Object.fromEntries(bt.filter(t=>Number.isFinite(e?.[t])).map(t=>[t,e[t]]));function Ra(e,t){ue(e,t);const o={...Et(e),reasoning:e.reasoning===void 0?0:Y(e.reasoning,t+".reasoning"),apiCost:e.apiCost===void 0?void 0:Y(e.apiCost,t+".apiCost"),byModel:Ta(e.byModel,t+".byModel"),byProviderModel:Ta(e.byProviderModel,t+".byProviderModel")};for(const n of["input","output","cacheRead","cacheWrite","calls","cost"])o[n]=Y(e[n],t+"."+n);return o}function Un(e){return e==null?void 0:{source:te(e.source,"source"),requestId:te(e.requestId,"requestId"),attempt:Y(e.attempt,"attempt"),complete:Ne(e.complete,"complete"),status:te(e.status,"status"),upstream:te(e.upstream,"upstream")}}function Ba(e){return(Array.isArray(e)?e:ee("rows","array")).map(t=>({provider:te(t.provider,"provider"),model:te(t.model,"model"),bucket:te(t.bucket,"bucket"),tokens:Y(t.tokens,"tokens"),...t.requests===void 0?{}:{requests:Y(t.requests,"requests")},rate:Y(t.rate,"rate"),cost:Y(t.cost,"cost"),priced:Ne(t.priced,"priced"),plan:Ne(t.plan,"plan")}))}function It(e,t){return{...Ra(e,t),id:te(e.id,t+".id"),provider:typeof e.provider=="string"?e.provider:"",model:typeof e.model=="string"?e.model:""}}function Se(e,t){const o={...Ra(e,t),date:te(e.date,t+".date"),sessions:[]};return e.sessions!==void 0&&(Array.isArray(e.sessions)||ee(t+".sessions","array"),o.sessions=e.sessions.map((n,s)=>It(n,t+".sessions["+s+"]"))),o}function jt(e,t,o=["cacheWrite","reasoning"]){const n={};for(const s of["cacheHit","cacheMiss","output"])n[s]=Y(e[s],t+"."+s);for(const s of o)e[s]!==void 0&&(n[s]=Y(e[s],t+"."+s));return n}function Ht(e,t){ue(e,t);const o={...jt(e,t),...gt(e)};for(const n of["offPeak","peak","legacyBase","longContext"])e[n]!==void 0&&(o[n]=jt(e[n],t+"."+n,["cacheWrite","reasoning","aboveInputTokens"]));e.cny!==void 0&&(o.cny=jt(e.cny,t+".cny")),e.legacy!==void 0&&(o.legacy=Ne(e.legacy,t+".legacy")),e.rateHistory!==void 0&&((!Array.isArray(e.rateHistory)||e.rateHistory.length>16)&&ee(t+".rateHistory","price history"),o.rateHistory=e.rateHistory.map((n,s)=>((!n||typeof n.before!="string"||!Number.isFinite(Date.parse(n.before)))&&ee(t+".rateHistory","dated price"),{...Ht({...n,rateHistory:void 0},t+".rateHistory."+s),before:n.before})));for(const n of["billingMode","sourceUrl","checkedAt","notes"])typeof e[n]=="string"&&(o[n]=e[n]);return o}function Fn(e,t){const o=s=>s==null?void 0:{...["aliyun","tokenrhythm"].includes(s.adapter)?{adapter:s.adapter}:{},enabled:s.enabled===!0,label:typeof s.label=="string"?s.label:"",labelEn:typeof s.labelEn=="string"?s.labelEn:"",display:Ie(s.display,["sidebar","settings","off"],"both"),unit:s.adapter==="tokenrhythm"?"CNY":["CNY","EUR","CREDITS"].includes(s.unit)?s.unit:"USD",convertToDisplayCurrency:s.convertToDisplayCurrency===!0,allowInsecureHttp:s.allowInsecureHttp===!0,refreshMinutes:typeof s.refreshMinutes=="number"&&Number.isFinite(s.refreshMinutes)?s.refreshMinutes:15,request:s.request&&typeof s.request=="object"?s.request:{url:""},extract:s.extract&&typeof s.extract=="object"?s.extract:{},allowedHosts:Array.isArray(s?.allowedHosts)?s.allowedHosts.filter(l=>typeof l=="string"):[]};ue(e,t);const n={};if(e.prices!==null&&typeof e.prices=="object"&&e.prices.models!==null&&typeof e.prices.models=="object")for(const s of Object.keys(e.prices.models))n[s]=Ht(e.prices.models[s],t+".prices.models."+s);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,hideTodayCost:e.hideTodayCost===!0,sessionListCostPeriod:e.sessionListCostPeriod==="today"?"today":"total",modelStatistics:e.modelStatistics??{},...Ve(e,["hideSessionCostHeader","hideSessionCostDock","hideTurnCost","followSkinTransparency","sidebarTodayBalanceInline","sessionListCosts","hideBudget","sessionCostCompact","contextCostsEnabled","contextCostsPromptSeen","showTotalWithPlan","sidebarSimple","sidebarSimplePromptSeen","codexQuotaEnabled","codexCompatPromptDismissed","includeSubagentCost","peakEnabled","peakAlertWebNotify","peakProgressPromptSeen"],s=>s===!0),sidebarTodayMetric:["tokens","both"].includes(e.sidebarTodayMetric)?e.sidebarTodayMetric:"cost",...Object.hasOwn(e,"sidebarOrder")?{sidebarOrder:Array.isArray(e.sidebarOrder)?e.sidebarOrder:[]}:{},statisticsBasis:e.statisticsBasis,sidebarModels:Object.fromEntries(Object.entries(wn).map(([s,l])=>[s,e.sidebarModels?.[s]??l])),codexQuotaSidebar:e.codexQuotaSidebar!==!1,codexQuotaStrip:e.codexQuotaStrip!==!1,codexQuotaSource:["connect","subscription","chatgpt","pi-ai","chatgpt-sub"].includes(e.codexQuotaSource)?e.codexQuotaSource:"auto",codexCompatHistoryAppliedAt:me(e.codexCompatHistoryAppliedAt),sidebarStyle:Ie(e.sidebarStyle,["standard","compact","summary"],"standard"),...Object.hasOwn(e,"sidebarSummaryPromptSeen")?{sidebarSummaryPromptSeen:e.sidebarSummaryPromptSeen===!0}:{},billionContextNoticeEnabled:e.billionContextNoticeEnabled!==!1,billionContextNoticesSeen:Array.isArray(e.billionContextNoticesSeen)?e.billionContextNoticesSeen.filter(s=>typeof s=="string").slice(-32):[],priceMatchDismissed:Array.isArray(e.priceMatchDismissed)?e.priceMatchDismissed.filter(s=>typeof s=="string"):[],pricingCurrency:e.pricingCurrency==="CNY"?"CNY":"USD",currency:typeof e.currency=="string"?e.currency:"CNY",symbol:typeof e.symbol=="string"?e.symbol:"¥",decimals:Y(e.decimals,t+".decimals"),exchangeRate:Y(e.exchangeRate,t+".exchangeRate"),exchangeRateAuto:e.exchangeRateAuto!==!1,fxRates:e.fxRates,exchangeRateDate:e.exchangeRateDate??"",exchangeRateCheckedAt:e.exchangeRateCheckedAt??0,peakEffectiveAt:typeof e.peakEffectiveAt=="string"?e.peakEffectiveAt:"",peakWindows:Array.isArray(e.peakWindows)?e.peakWindows.map((s,l)=>({start:Y(s.start,t+".peakWindows["+l+"].start"),end:Y(s.end,t+".peakWindows["+l+"].end")})):[],peakHolidays:Array.isArray(e.peakHolidays)?e.peakHolidays.filter(s=>typeof s=="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",peakStyle:["classic","progress"].includes(e.peakStyle)?e.peakStyle:"compact",peakTimeDisplay:["countdown","switch"].includes(e.peakTimeDisplay)?e.peakTimeDisplay:"both",priceMatch:e.priceMatch==="exact"?"exact":"auto",priceOverrides:(()=>{const s={};if(e.priceOverrides!==null&&typeof e.priceOverrides=="object"&&!Array.isArray(e.priceOverrides))for(const[l,r]of Object.entries(e.priceOverrides))typeof l=="string"&&typeof r=="string"&&(s[l]=r);return s})(),priceTableDisplay:(()=>{const s={};if(e.priceTableDisplay!==null&&typeof e.priceTableDisplay=="object"&&!Array.isArray(e.priceTableDisplay))for(const[l,r]of Object.entries(e.priceTableDisplay))typeof l=="string"&&(s[l]=r===!0);return s})(),codingPlans:(()=>{const s={};if(e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans))for(const l of Object.keys(e.codingPlans)){const r=e.codingPlans[l];r===null||typeof r!="object"||Array.isArray(r)||(s[l]={enabled:r.enabled===!0,display:r.display==="sidebar"||r.display==="both"||r.display==="off"?r.display:"settings",...typeof r.showInComposer=="boolean"?{showInComposer:r.showInComposer}:{},refreshMinutes:typeof r.refreshMinutes=="number"&&Number.isFinite(r.refreshMinutes)?r.refreshMinutes:15,apiKey:typeof r.apiKey=="string"?r.apiKey:"",...l==="minimax"?{baseUrl:typeof r.baseUrl=="string"?r.baseUrl:""}:{},...l==="factory"?{orgId:typeof r.orgId=="string"?r.orgId:"",factoryPool:["core","both"].includes(r.factoryPool)?r.factoryPool:"standard"}:{},...l==="workbuddy"?{accountScope:r.accountScope??"current",accountIds:Array.isArray(r.accountIds)?r.accountIds:[],...typeof r.accountSource=="string"?{accountSource:r.accountSource}:{}}:{},...l==="opendesign"?{workspaceId:typeof r.workspaceId=="string"?r.workspaceId:""}:{},...l==="qwen"?{quotaSource:["cli","bailian"].includes(r.quotaSource)?r.quotaSource:"local"}:{},...typeof r.planCredits=="number"&&Number.isFinite(r.planCredits)&&r.planCredits>0?{planCredits:r.planCredits}:{},...typeof r.planStart=="string"?{planStart:r.planStart}:{},...r.rates!==null&&typeof r.rates=="object"&&!Array.isArray(r.rates)?{rates:r.rates}:{},...typeof r.accessKeyId=="string"?{accessKeyId:r.accessKeyId}:{},...typeof r.secretAccessKey=="string"?{secretAccessKey:r.secretAccessKey}:{}})}return s})(),prices:{models:n,...e.prices?.custom?{custom:e.prices.custom}:{},default:Ht(e.prices?.default??{cacheHit:0,cacheMiss:0,output:0},t+".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:Y(e.historyDays,t+".historyDays"),billingStorageRetentionDays:[0,7,30].includes(e.billingStorageRetentionDays)?e.billingStorageRetentionDays:7,fetchedAt:e.fetchedAt===null||e.fetchedAt===void 0?null:te(e.fetchedAt,t+".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:Ie(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,showSource:e.balance?.showSource===!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,...typeof e.goQuota?.showInComposer=="boolean"?{showInComposer:e.goQuota.showInComposer}:{},display:Ie(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:o(e.customBalance),gatewayQuotas:(()=>{const s=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:e.gatewayQuotas?.sources;return{sources:Array.isArray(s)?s.slice(0,4).filter(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)).map(r=>({id:typeof r.id=="string"?r.id.slice(0,48):"",type:"cliproxyapi",label:typeof r.label=="string"?r.label.slice(0,80):"",baseURL:typeof r.baseURL=="string"?r.baseURL:"",enabled:r.enabled!==!1,display:Ie(r.display,["sidebar","settings","off"],"both"),refreshMinutes:typeof r.refreshMinutes=="number"&&Number.isFinite(r.refreshMinutes)?Math.min(1440,Math.max(1,Math.floor(r.refreshMinutes))):15,includeProviders:Array.isArray(r.includeProviders)?[...new Set(r.includeProviders.filter(i=>typeof i=="string").map(i=>i.toLowerCase()).filter(i=>Ut.includes(i)))]:Ut,allowedHosts:Array.isArray(r.allowedHosts)?r.allowedHosts.filter(i=>typeof i=="string").slice(0,16):[],allowInsecureHttp:r.allowInsecureHttp===!0,antigravityOnlyGemini:r.antigravityOnlyGemini===!0,keyVar:typeof r.keyVar=="string"?r.keyVar:""})):[]}})(),customBalances:(()=>{if(Array.isArray(e.customBalances))return e.customBalances.filter(l=>l!==null&&typeof l=="object").slice(0,8).map(o).filter(Boolean);const s=o(e.customBalance);return s?[s]:[]})(),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 s=e.barDirections!==null&&typeof e.barDirections=="object"&&!Array.isArray(e.barDirections)?e.barDirections:{},l=(r,i)=>s[r]==="remaining"||s[r]==="used"?s[r]:i;return{balance:l("balance","remaining"),budget:l("budget","used"),go:l("go","used"),plan:l("plan","used")}})(),planBilling:{...Array.isArray(e.planBilling?.autoProviders)?{autoProviders:e.planBilling.autoProviders.filter(s=>Ue.includes(s))}:{},providers:Ma(e.planBilling?.providers),models:Ma(e.planBilling?.models,!0),modelPlans:Object.fromEntries(Object.entries(e.planBilling?.modelPlans??{}).filter(([s,l])=>s.includes(":")&&Ue.includes(l)))}}}const $e=e=>typeof e=="number"&&Number.isFinite(e)?e:null,me=e=>$e(e)??0,_n={status:"off",message:"",fetchedAt:0,currency:"",totalBalance:0,grantedBalance:0,toppedUpBalance:0},Wn={status:"off",message:"",fetchedAt:0,rolling:null,weekly:null,monthly:null},Oa=(e=null)=>({status:"off",message:"",fetchedAt:0,label:"",unit:"USD",remaining:0,maxBudget:null,spend:null,index:e});function Qt(e,t){return ue(e,t),{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 Gn(e,t){return{...Qt(e,t),keyConfigured:e.keyConfigured===!0,keySource:typeof e.keySource=="string"?e.keySource:"",currency:typeof e.currency=="string"?e.currency:"",totalBalance:me(e.totalBalance),grantedBalance:me(e.grantedBalance),toppedUpBalance:me(e.toppedUpBalance)}}function qt(e,t){return e==null?null:((typeof e!="object"||Array.isArray(e))&&ee(t,"object"),{percent:me(e.percent),resetsAt:typeof e.resetsAt=="string"?e.resetsAt:""})}function Kn(e,t){return{...Qt(e,t),rolling:qt(e.rolling,t+".rolling"),weekly:qt(e.weekly,t+".weekly"),monthly:qt(e.monthly,t+".monthly")}}function Da(e,t){return{...Qt(e,t),label:typeof e.label=="string"?e.label:"",unit:typeof e.unit=="string"?e.unit:"USD",remaining:me(e.remaining),maxBudget:$e(e.maxBudget),spend:$e(e.spend),index:typeof e.index=="number"&&Number.isFinite(e.index)&&e.index>=0?Math.floor(e.index):null}}const zn=new Set(["ok","partial","unknown","error","stale","unsupported","capability_missing"]),Yn=new Set(["off","loading","ok","partial","stale","error"]),Ut=["antigravity","claude","codex","kimi","xai","workbuddy"],La={antigravity:"Antigravity",claude:"Claude",codex:"Codex",kimi:"Kimi",xai:"xAI",workbuddy:"WorkBuddy"};function Vn(e,t){ue(e,t);const o=(r,i="")=>typeof r=="string"?r:i,n=r=>$e(r),s=r=>r!==null&&typeof r=="object"&&!Array.isArray(r)?{id:o(r.id),label:o(r.label),...n(r.percent)===null?{}:{percent:n(r.percent)},resetsAt:o(r.resetsAt),periodHours:n(r.periodHours),scope:o(r.scope)}:null,l=r=>r!==null&&typeof r=="object"&&!Array.isArray(r)?{unit:o(r.unit,"credits"),used:n(r.used),remaining:n(r.remaining),limit:n(r.limit),fetchedAt:o(r.fetchedAt),packages:Array.isArray(r.packages)?r.packages.filter(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)).map(i=>({id:o(i.id),label:o(i.label),used:n(i.used),remaining:n(i.remaining),limit:n(i.limit),startsAt:o(i.startsAt),resetsAt:o(i.resetsAt)})):[]}:void 0;return{id:o(e.id),type:"cliproxyapi",label:o(e.label),status:Yn.has(e.status)?e.status:"error",message:o(e.message),fetchedAt:n(e.fetchedAt)??0,attemptedAt:n(e.attemptedAt)??0,serverVersion:o(e.serverVersion),keyConfigured:e.keyConfigured===!0,keySource:o(e.keySource,"none"),accounts:Array.isArray(e.accounts)?e.accounts.filter(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)).slice(0,16).map(r=>({id:o(r.id),provider:o(r.provider,"unknown"),label:o(r.label,"unknown"),status:zn.has(r.status)?r.status:"unknown",message:o(r.message),plan:o(r.plan),windows:Array.isArray(r.windows)?r.windows.map(s).filter(Boolean):[],credits:l(r.credits)})):[],unsupportedProviders:Array.isArray(e.unsupportedProviders)?e.unsupportedProviders.filter(r=>typeof r=="string").slice(0,32):[]}}function $n(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;const t={};if(e.providers!==null&&typeof e.providers=="object"&&!Array.isArray(e.providers))for(const[o,n]of Object.entries(e.providers)){if(n===null||typeof n!="object"||Array.isArray(n))continue;const s={},l={};if(n.windows!==null&&typeof n.windows=="object"&&!Array.isArray(n.windows))for(const[r,i]of Object.entries(n.windows))i===null||typeof i!="object"||Array.isArray(i)||(s[r]={...Ve(i,["percent","localTokens","localCost","sampleCount"],me),...Ve(i,["sampleAt","per1Tokens","per1Cost","fullTokens","fullCost"],$e),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(n.intervals!==null&&typeof n.intervals=="object"&&!Array.isArray(n.intervals))for(const[r,i]of Object.entries(n.intervals))Array.isArray(i)&&(l[r]=i.filter(d=>d!==null&&typeof d=="object"&&!Array.isArray(d)).map(d=>Ve(d,["t0","t1","tokens","cost","pct","per1Tokens","per1Cost"],me)));t[o]={windows:s,intervals:l}}return{generatedAt:me(e.generatedAt),providers:t}}function Jn(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=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:Ie(e.detection,["package","profile","none"],"none"),planClass:Ie(e.planClass,["auto","plan","api"],"auto"),usage:{calls:me(t.calls),cost:me(t.cost),tokens:me(t.tokens),days:me(t.days),providers:(Array.isArray(t.providers)?t.providers:[]).filter(o=>typeof o=="string")},historyAppliedAt:me(e.historyAppliedAt),promptDismissed:e.promptDismissed===!0,promptDue:e.promptDue===!0}}function Ea(e,t){return ue(e,t),{today:Se(e.today,t+".today"),month:Se(e.month,t+".month"),total:Se(e.total,t+".total"),budgetUsed:typeof e.budgetUsed=="number"&&Number.isFinite(e.budgetUsed)?e.budgetUsed:void 0,balance:e.balance==null?_n:Gn(e.balance,t+".balance"),goQuota:e.goQuota==null?Wn:Kn(e.goQuota,t+".goQuota"),customBalance:e.customBalance==null?Oa():Da(e.customBalance,t+".customBalance"),customBalances:Array.isArray(e.customBalances)?e.customBalances.filter(o=>o!==null&&typeof o=="object").map((o,n)=>Da(o,t+".customBalances["+n+"]")):[],gatewayQuotas:Array.isArray(e.gatewayQuotas)?e.gatewayQuotas.filter(o=>o!==null&&typeof o=="object"&&!Array.isArray(o)).map((o,n)=>Vn(o,t+".gatewayQuotas["+n+"]")):[],customVarStatus:e.customVarStatus!==null&&typeof e.customVarStatus=="object"&&!Array.isArray(e.customVarStatus)?Object.fromEntries(Object.entries(e.customVarStatus).filter(([,o])=>o!==null&&typeof o=="object").map(([o,n])=>[o,{configured:n.configured===!0,source:typeof n.source=="string"?n.source:""}])):{},codingPlans:e.codingPlans!==null&&typeof e.codingPlans=="object"&&!Array.isArray(e.codingPlans)?e.codingPlans:{},planStats:$n(e.planStats),codexCompat:Jn(e.codexCompat),ourFreeModel:e.ourFreeModel?.enabled===!0?{enabled:!0,version:typeof e.ourFreeModel.version=="string"?e.ourFreeModel.version:""}:void 0,history:Array.isArray(e.history)?e.history.map((o,n)=>Se(o,t+".history["+n+"]")):[],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,unresolved:Number(e.billionContext.unresolved)||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(o=>({source:String(o.source),today:Se(o.today,t+".external.today"),month:Se(o.month,t+".external.month"),total:Se(o.total,t+".external.total"),history:(o.history??[]).map(n=>Se(n,t+".external.history"))})),combined:Object.fromEntries(["today","month","total","history"].map(o=>[o,o==="history"?(e.externalUsage.combined.history??[]).map(n=>Se(n,t+".external.history")):Se(e.externalUsage.combined[o],t+".external."+o)]))}:null,config:Fn(e.config,t+".config"),pricesRev:typeof e.pricesRev=="string"?e.pricesRev:void 0,modelLabels:Object.fromEntries(Object.entries(e.modelLabels??{}).filter(([,o])=>typeof o=="string")),modelDirectory:e.modelDirectory,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(o=>typeof o=="string"):[],meta:{...ze(e.meta?.locale)?{locale:ze(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:"",...typeof e.meta?.defaultProvider=="string"?{defaultProvider:e.meta.defaultProvider}:{},dayKey:typeof e.meta?.dayKey=="string"?e.meta.dayKey:"",monthKey:typeof e.meta?.monthKey=="string"?e.meta.monthKey:""}}}function Zn(e,t){ue(e,t);const o={ok:e.ok===!0,message:typeof e.message=="string"?e.message:""};return e.state!==void 0&&e.state!==null&&(o.state=Ea(e.state,t+".state")),o}function Z(e){return{parse:e}}const Je=Z(Ea),Xn=Z(e=>ue(e,"patch")),eo=Z(Zn),Ft=Z(e=>te(e,"provider")),to=Z(e=>{if(e!=null)return(typeof e!="number"||!Number.isInteger(e)||e<0||e>7)&&ee("index","0-7 integer"),e}),ao=Z(e=>te(e,"date")),no=Z(e=>ue(e,"day")),oo=Z(e=>(Number.isFinite(Number(e))||ee("limit","number"),Number(e))),Ia=Z(e=>te(e,"sort")),so=Z(e=>ue(e,"topSessions")),ja=Z(e=>te(e,"target")),lo=Z(e=>te(e,"value")),he=(e,t)=>({mode:"strict",typeSymbol:"dsh-cost-meter#"+e,schema:t,create:()=>t}),se=(e,t,o,n=!1)=>({name:e,wire:e,source:"json",codec:he(t,o),...n?{acceptsUndefined:!0}:{}}),Ha=Z(e=>{ue(e,"billing storage options"),(Object.keys(e).some(o=>!["retentionDays","apply","streams","groups"].includes(o))||![0,7,30].includes(e.retentionDays))&&ee("billing storage options","retentionDays 0/7/30");const t={retentionDays:e.retentionDays};for(const o of["apply","streams","groups"])e[o]!==void 0&&typeof e[o]!="boolean"&&ee(o,"boolean"),t[o]=e[o]??o!=="apply";return t}),ro={package:"dsh-cost-meter",descriptors:[{method:"getStateSince",parameters:[se("pricesRev","PricesRev",Z(e=>(typeof e!="string"&&ee("pricesRev","price table revision"),e)))],result:he("CostState",Je)},...["getState","getLocalState"].map(e=>({method:e,result:he("CostState",Je)})),{method:"billingStorage",parameters:[se("options","BillingStorageOptions",Ha)],result:he("BillingStorage",Z(e=>{ue(e,"billing storage");const t={};for(const o of["retentionDays","scannedAt","sessions","reclaimableBytes","archivedStreams","removedFiles","releasedBytes","archiveBytes","skipped"])t[o]=Y(e[o],o);for(const o of["applied","limited"])typeof e[o]!="boolean"&&ee(o,"boolean"),t[o]=e[o];for(const o of["streams","groups","archives"]){const n=ue(e[o],o),s={};for(const l of["files","bytes","eligibleFiles","eligibleBytes"])s[l]=Y(n[l],o+"."+l);for(const l of["oldestAt","newestAt"])s[l]=n[l]===null?null:Y(n[l],o+"."+l);t[o]=s}return t}))},{method:"updateConfig",parameters:[se("patch","ConfigPatch",Xn)],result:he("CostState",Je)},{method:"fetchPrices"},{method:"releasePriceLock",parameters:[se("id","PriceLockId",Z(e=>((typeof e!="string"||e.length===0)&&ee("id","OpenRouter model id"),e)))]},{method:"refreshBalance"},{method:"refreshGoQuota"},...["getPiAiCodexQuota","getChatgptSubQuota"].map(e=>({method:e,result:he("PiAiCodexQuota",Z(t=>{ue(t,"pi-ai quota"),["off","ok","error"].includes(t.status)||ee("pi-ai quota status","off/ok/error");const o={},n=ue(t.windows,"pi-ai windows");for(const s of["five","weekly"])if(n[s]!==void 0){const l=Y(n[s].percent,s);(l<0||l>100)&&ee(s,"0-100 percent"),o[s]={percent:l,resetsAt:te(n[s].resetsAt,"resetsAt")}}return{status:t.status,windows:o,message:te(t.message,"message")}}))})),{method:"refreshCustomBalance",parameters:[se("index","CustomBalanceIndex",to,!0)]},{method:"refreshCodingPlan",parameters:[se("provider","CodingPlanProvider",Ft)]},{method:"loginCodingPlan",parameters:[se("provider","CodingPlanProvider",Ft)]},{method:"refreshGatewayQuota",parameters:[se("sourceId","GatewayQuotaSourceId",Z(e=>{if(e!=null)return(typeof e!="string"||e.length>48||!/^[a-z0-9][a-z0-9_-]*$/.test(e))&&ee("sourceId","gateway source id"),e}),!0)]},{method:"resetHistory",result:he("CostState",Je)},{method:"importLegacyHistory"},{method:"getDaySessions",parameters:[se("date","DayKey",ao)],result:he("DayRecord",no)},{method:"getSessionCost",parameters:[se("sessionId","SessionId",Ft)],result:he("SessionCost",Z(e=>({own:It(e.own,"own"),subagents:It(e.subagents,"subagents"),found:Ne(e.found,"found"),subagentCount:Y(e.subagentCount,"subagentCount")})))},{id:"dsh-cost-meter#costMeter/getTurnCost",service:"costMeter",namespace:"costMeter",method:"getTurnCost",invocation:{kind:"direct"},parameters:[se("sessionId","SessionId",Z(e=>te(e,"sessionId"))),...["startSeq","endSeq"].map(e=>se(e,"TurnSeq",Z(t=>((!Number.isSafeInteger(t)||t<0)&&ee(e,"nonnegative integer"),t)))),{...se("displayCurrency","DisplayCurrency",Z(e=>(e!==void 0&&!["USD","CNY","EUR"].includes(e)&&ee("displayCurrency","currency"),e))),acceptsUndefined:!0}],result:he("TurnCost",Z(e=>({...Et(e),found:Ne(e.found,"found"),...e.inherited===void 0?{}:{inherited:Ne(e.inherited,"inherited")},cost:Y(e.cost,"cost"),apiCost:Y(e.apiCost,"apiCost"),rows:Ba(e.rows),calls:(Array.isArray(e.calls)?e.calls:ee("calls","array")).map(t=>({kind:te(t.kind,"kind"),provider:te(t.provider,"provider"),model:te(t.model,"model"),atMs:Y(t.atMs,"atMs"),cost:Y(t.cost,"cost"),apiCost:Y(t.apiCost,"apiCost"),plan:Ne(t.plan,"plan"),priced:Ne(t.priced,"priced"),longContext:Ne(t.longContext,"longContext"),rows:Ba(t.rows),...t.metering?{metering:Un(t.metering)}:{}}))})))},{method:"getTopSessions",parameters:[se("limit","SessionLimit",oo),se("sort","SessionSort",Ia,!0),se("dir","SessionSortDir",Ia,!0)],result:he("TopSessions",so)},{method:"setCredential",parameters:[se("target","CredentialTarget",ja),se("value","CredentialValue",lo)]},{method:"clearCredential",parameters:[se("target","CredentialTarget",ja)]},...["applyCodexCompatHistory","dismissCodexCompat"].map(e=>({method:e,result:he("CostState",Je)}))].map(e=>({id:"dsh-cost-meter#costMeter/"+e.method,service:"costMeter",namespace:"costMeter",invocation:{kind:"direct"},parameters:[],result:he("FetchPricesResult",eo),...e}))};function io(e,t){const o=t?.models??{};return typeof e=="string"&&e.length>0&&o[e]!==void 0?o[e]:t?.default??{cacheHit:0,cacheMiss:0,output:0}}function gt(e){return Object.fromEntries(["multiplier","separateMultipliers","multipliers"].filter(t=>e?.[t]!==void 0).map(t=>[t,e[t]]))}function yt(e,t){return(e.separateMultipliers?e.multipliers?.[t]:void 0)??e.multiplier??1}function Qa(e,t,o="base"){const n={};for(const s of["cacheHit","cacheMiss","cacheWrite","output","reasoning"])e[s]!==void 0&&(n[s]=e[s]*yt(t,o+"."+s));return e.longContext&&(n.longContext={...Qa(e.longContext,t,"longContext"),aboveInputTokens:e.longContext.aboveInputTokens}),n}function co(e){const t=gt(e);return t.multipliers&&(t.multipliers=Object.fromEntries(Object.entries(t.multipliers).filter(([o])=>o.startsWith("cny.")).map(([o,n])=>[o.replace("cny.","base."),n]))),{...e.cny,...t}}function Qe(e){if(e===null||typeof e!="object")return;const t=r=>{const i=e[r];return typeof i=="number"&&Number.isFinite(i)&&i>=0?i:void 0},o=t("cacheMiss")??t("input")??0,s={cacheHit:t("cacheHit")??t("cachedInput")??t("cacheRead")??o,cacheMiss:o,output:t("output")??0},l=t("reasoning");return l!==void 0&&(s.reasoning=l),t("cacheWrite")!==void 0&&(s.cacheWrite=t("cacheWrite")),s}function uo(e){const t=Qe(e);if(t===void 0)return null;Object.assign(t,gt(e)),e.billingMode==="utc-peak"&&(t.billingMode="utc-peak"),e.peakSchedule==="volcengine"&&(t.peakSchedule="volcengine");for(const o of["offPeak","peak","legacyBase"]){const n=Qe(e[o]);n!==void 0&&(t[o]=n)}return Number.isFinite(e.longContext?.aboveInputTokens)&&e.longContext.aboveInputTokens>0&&(t.longContext={...Qe(e.longContext),aboveInputTokens:e.longContext.aboveInputTokens}),Array.isArray(e.rateHistory)&&(t.rateHistory=e.rateHistory.slice(0,16).map(o=>{const n={...Qe(o),before:o.before};for(const s of["offPeak","peak"]){const l=Qe(o[s]);l!==void 0&&(n[s]=l)}return n})),t}function Ze(e,t=Date.now()){if(!e||!Number.isFinite(t)||!Array.isArray(e.rateHistory))return e;let o=null,n=1/0;for(const r of e.rateHistory){const i=Date.parse(r.before);t<i&&i<n&&(o=r,n=i)}if(!o)return e;const{before:s,...l}=o;return{...e,...l}}const _t=Date.parse("2026-08-22T16:00:00Z");function qa(e){if(!Number.isFinite(e)||e<_t)return null;const t=Math.floor((e+8*36e5)/864e5),o=(t+4)%7;if(o!==6&&o!==0)return null;const n=o===6?t:t-1;return{start:Math.max(n*864e5-8*36e5,_t),end:(n+2)*864e5-8*36e5}}function Ua(e,t){if(!Number.isFinite(e)||e<_t||!Array.isArray(t))return null;const o=Math.floor((e+8*36e5)/864e5);return t.includes(new Date(o*864e5).toISOString().slice(0,10))?{start:o*864e5-8*36e5,end:(o+1)*864e5-8*36e5}:null}const po=(e,t)=>Ua(e,t)??qa(e);function ht(e,t,o,n){if(!Array.isArray(o)||o.length===0||po(e,n)!==null||Number.isFinite(t)&&e<t)return!1;const s=new Date(e).getUTCHours();return o.some(l=>{const r=Number(l.start),i=Number(l.end);return!Number.isFinite(r)||!Number.isFinite(i)?!1:r<i?s>=r&&s<i:s>=r||s<i})}const mo=Date.parse("2026-08-16T16:00:00Z"),fo=17881344e5;function Fa(e,t,o){const n=Ze(e,t)??{cacheHit:0,cacheMiss:0,output:0},s=(i,d="base")=>({reasoning:0,...Qa(i,n,d)}),l=n.peakSchedule==="ollama";if(l||n.billingMode==="utc-peak"){if(o?.enabled!==!0||!Number.isFinite(t)||l&&t<fo)return s(n);const i=new Date(t),d=i.getUTCDay(),c=i.getUTCHours(),u=d>0&&d<6&&(l?c>=12&&c<18:c>=1&&c<4||c>=6&&c<10);return s((u?n.peak:n.offPeak)??n,(u?n.peak:n.offPeak)?u?"peak":"offPeak":"base")}if(Number.isFinite(t)&&t<mo){const i=n.legacyBase;return i===void 0?s(n):s(i,"legacyBase")}if(o?.enabled!==!0)return s(n);const r=typeof o.effectiveAtMs=="number"&&Number.isFinite(o.effectiveAtMs)?o.effectiveAtMs:void 0;if(ht(t,r,o.windows,n.peakSchedule==="volcengine"?[]:o.holidays)){const i=n.peak;return i===void 0?s(n):s(i,"peak")}if(r!==void 0&&t>=r){const i=n.offPeak;return i===void 0?s(n):s(i,"offPeak")}return s(n)}function _a(e,t){const o=Math.max(0,Number(e.input)||0),n=Math.max(0,Number(e.output)||0),s=Math.max(0,Number(e.cacheRead)||0),l=Math.max(0,Number(e.cacheWrite)||0),r=Math.max(0,Number(e.reasoning)||0);return t.longContext&&o+s+l>t.longContext.aboveInputTokens&&(t=t.longContext),(o*t.cacheMiss+n*t.output+s*t.cacheHit+l*(t.cacheWrite??t.cacheHit)+r*(t.reasoning??0))/1e6}function Wa(e,t,o){const n=Number(e);if(!Number.isFinite(n)||n<0||n===0)return 0;if(t!=="CNY")return n;const s=Number(o);return!Number.isFinite(s)||s<=0?n:n/s}function ie(e,t){const o=e?.barDirections,n=t==="balance"?"remaining":"used";if(o===null||typeof o!="object"||Array.isArray(o))return n;const s=o[t];return s==="remaining"||s==="used"?s:n}function we(e,t){if(e==null||!Number.isFinite(Number(e)))return{width:0,label:null};const o=Math.max(0,Math.min(100,Number(e))),n=t==="remaining"?Math.round((100-o)*10)/10:Math.round(o*10)/10;return{width:n,label:n}}const Ga=(e,t)=>e.toFixed(t).replace(/(\.\d*?[1-9])0+$|\.0+$/,"$1");function de(e,t){const o=typeof t?.symbol=="string"&&t.symbol.length>0?t.symbol:"$",n=Number(t?.decimals),s=Math.max(0,Math.min(10,Number.isFinite(n)?Math.floor(n):2));let l=s;return e>0&&e<Math.pow(10,-s)&&(l=s+2),o+Ga(e,l)}function W(e,t){const o=Number(t?.exchangeRate),n=e*(Number.isFinite(o)&&o>0?o:1);return de(n,t)}function L(e){const t=Math.max(0,Number(e)||0),o=n=>n>=100?String(Math.round(n)):String(Math.round(n*10)/10);return t<1e3?String(Math.round(t)):t>=999500?o(t/1e6)+"M":t<1e6?o(t/1e3)+"K":o(t/1e6)+"M"}function Wt(e){return String(e??"").normalize("NFKC").toLowerCase().replace(/[((]\s*(?:go|zen)\s*[))]/g," ").trim()}function Ce(e){return Wt(e).replace(/[^\p{L}\p{N}]+/gu,"")}function bo(e,t=!0,o=!0){const n=Wt(e);return t&&/[-_./:@](?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/.test(n)?n.slice(0,-5):t&&o&&/[-_./:@]\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])$/.test(n)?n.slice(0,-7):n.replace(/[-_./:@](?:\d{4}-?\d{2}-?\d{2}|v\d+(?:\.\d+)*|\d+k|latest)$/,"")}function kt(e,t,o=e,n=!0,s=!0){if(typeof e!="string"||e.length===0)return null;const l=Array.isArray(t)?t.filter(d=>typeof d=="string"&&d.length>0):[],r=l.find(d=>d===o);if(r!==void 0)return r;let i=e.normalize("NFKC").trim();if(/[:((]\s*(?:free|online)\b/i.test(i))return null;for(;;){const d=Ce(i);if(d.length===0)return null;const c=l.filter(b=>Ce(b)===d);if(c.length>0)return c.length===1?c[0]:null;const u=bo(i,n,s);if(u===i.toLowerCase())return null;i=u}}const Gt=["opendesign","open-design","open-design-api","amr-link.open-design.ai"],Kt=new Set(["openrouter","opencode-zen","opencode-go","opencode-go-plus","zen","opencode",...Gt]),xt={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 zt(e){return["deepseek-peak","utc-peak"].includes(e?.billingMode)?e.billingMode:"flat"}function qe(e,t,o,n,s){if(typeof e!="string")return null;if(Object.hasOwn(t,e))return e;if(n!=="auto")return null;let l=e.normalize("NFKC").trim().replace(/^models\/(?=gemini)/i,"google/");const r=l.search(/[/:]/);if(r>0){const i=l.slice(0,r).trim().toLowerCase(),d=l.slice(r+1).trim();if(Object.hasOwn(xt,i)&&(i===o||(o==="opencode-zen"||o==="opencode-go")&&(xt[i].test(d)||kt(d,Object.keys(i==="deepseek"?s?.models??{}:s?.providers?.[i]?.models??{}),d,s?.snapshotTags!==!1,s?.shortSnapshotTags!==!1)!==null)))l=d;else if(Object.hasOwn(xt,i))return null}return kt(l,Object.keys(t),e,s?.snapshotTags!==!1,s?.shortSnapshotTags!==!1)}const go=new Set(["local","lmstudio","ollama","jan","gpt4all","koboldcpp","llamacpp","llama-cpp","localai","vllm","sglang","tabbyapi","lmdeploy","oobabooga","text-generation-webui","llama-server"]),yo=["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 ho(e,t){if(typeof e=="string"&&go.has(e))return!0;const o=typeof t=="string"?Wt(t):"";return yo.some(n=>o.startsWith(n))}function ko(e,t,o,n){if(e!=="deepseek"&&!e.includes("deepseek")&&typeof t=="string"&&t.length>0&&t!=="__local__"&&!t.includes(":")){const s=o.models??{},l=Object.hasOwn(s,t)?t:n==="auto"?kt(t,Object.keys(s),t,o?.snapshotTags!==!1,o?.shortSnapshotTags!==!1):null;if(l!==null&&s[l]?.unpriced!==!0)return{entry:s[l],priced:!0,billingMode:"deepseek-peak",matched:!0}}return null}function xo(e,t,o){const n=o?.prices??{},s=o?.priceMatch==="exact"?"exact":"auto",l=o?.priceOverrides&&typeof o.priceOverrides=="object"?o.priceOverrides:{};let r=String(e??"").trim().toLowerCase();if(r.startsWith("llm-")&&(r=r.slice(4)),r===""&&(r="deepseek"),["our-free-model","our-free-model-region"].includes(r)&&l[r+":*"]==="__free__")return{entry:{cacheHit:0,cacheMiss:0,cacheWrite:0,output:0,reasoning:0},priced:!0,currency:"USD",billingMode:"flat",matched:!0};let i=r,d=t;const c=l[r+":"+t];if(c==="__custom__"){const g=n.custom?.[r+":"+t];return{entry:g??null,priced:!!g,billingMode:"flat",matched:!0,currency:g?.currency??"USD"}}if(c==="__local__")return{entry:null,priced:!1,billingMode:"flat",matched:!0};if(typeof c=="string"&&c.length>0){const g=c.indexOf(":");if(g>0&&c.slice(g+1).length>0?(i=c.slice(0,g).trim().toLowerCase(),d=c.slice(g+1)):d=c,i==="deepseek"&&d==="__default__")return{entry:n.default??{cacheHit:0,cacheMiss:0,output:0},priced:n.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}if(["zen","opencode","opencode-go-plus"].includes(i)){const g=qe(d,n.providers?.[i]?.models??{},"opencode-go",s,n);g===null?i="opencode-go":d=g}if(Gt.includes(i)&&i!=="opendesign"&&qe(d,n.providers?.[i]?.models??{},i,s,n)===null&&(i="opendesign"),ho(i,d))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(i==="openrouter"){const g=n.providers?.openrouter?.models??{},f=Object.hasOwn(g,d)?g[d]:null;return{entry:f,priced:f!==null&&f.unpriced!==!0,billingMode:"flat",matched:f!==null}}if(i==="deepseek"||i.includes("deepseek")){const g=n.models??{},f=qe(d,g,"deepseek",s,n);if(f!==null)return g[f]?.unpriced===!0?{entry:null,priced:!1,billingMode:"flat",matched:!0}:{entry:g[f],priced:!0,billingMode:"deepseek-peak",matched:!0};if(s==="auto"){let m=null,x=-1,h=!1,C="flat";for(const[N,y]of Object.entries(n.providers??{})){if(Kt.has(N))continue;const p=y?.models??{},k=qe(d,p,N,s,n);if(k===null)continue;const w=+(k===d||Ce(k)===Ce(d));w>x?(m=p[k],x=w,h=!1,C=zt(p[k])):w===x&&(h=!0)}if(h)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(m!==null)return{entry:m,priced:m.unpriced!==!0,billingMode:C,matched:!0}}return{entry:n.default??{cacheHit:0,cacheMiss:0,output:0},priced:n.default?.unpriced!==!0,billingMode:"deepseek-peak",matched:!1}}const u=n.providers?.[i]?.models??{},b=qe(d,u,i,s,n);if(b!==null)return{entry:u[b],priced:u[b]?.unpriced!==!0,billingMode:zt(u[b]),matched:!0};if(Kt.has(i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(Object.hasOwn(xt,i))return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(s==="auto"){let g=null,f=-1,m=!1,x="flat";for(const[h,C]of[["deepseek",{models:n.models??{}}],...Object.entries(n.providers??{})]){if(h===i||Kt.has(h))continue;const N=C?.models??{},y=qe(d,N,h,s,n);if(y===null)continue;const p=+(y===d||Ce(y)===Ce(d));p>f?(g=N[y],f=p,m=!1,x=h==="deepseek"?"deepseek-peak":zt(N[y])):p===f&&(m=!0)}if(m)return{entry:null,priced:!1,billingMode:"flat",matched:!1};if(g!==null)return{entry:g,priced:g.unpriced!==!0,billingMode:x,matched:!0}}return{entry:null,priced:!1,billingMode:"flat",matched:!1}}function Ka(e,t,o){let n=xo(e,t,o);const s=String(e??"").trim().toLowerCase().replace(/^llm-/,"")||"deepseek";return!n.currency&&!n.priced&&(n=ko(s,o?.priceOverrides?.[s+":"+t],o?.prices??{},o?.priceMatch==="exact"?"exact":"auto")??n),n.currency||(n=n.priced&&o?.prices?.currency==="CNY"&&n.entry?.cny?{...n,entry:co(n.entry),currency:"CNY"}:{...n,currency:n.priced&&n.billingMode==="deepseek-peak"&&o?.prices?.currency==="CNY"?"CNY":"USD"}),["volcengine","ark"].includes(s)&&o?.prices?.volcenginePeak!==!1&&n.entry&&n.billingMode==="deepseek-peak"?{...n,entry:{...n.entry,peakSchedule:"volcengine"}}:n}function wo(e){const t=Number(e?.calls)||0,o=Number(e?.input)||0,n=Number(e?.cacheRead)||0;return t>=3&&o>=1e5&&n===0}function wt(e,t){return!e||!t?0:typeof e.cost=="number"&&Number.isFinite(e.cost)?e.cost:Ya(e,t).total}function Xe(e){if(e===null||typeof e!="object")return 0;const t=Number(e.cost)||0,o=e.apiCost===void 0||e.apiCost===null?t:Number(e.apiCost);return Number.isFinite(o)&&o>=0?Math.min(o,t):t}function Q(e,t){const o={CNY:"Cny",EUR:"Eur"}[t?.currency],n=t?.showTotalWithPlan===!0,s=o&&e?.[(n?"cost":"apiCost")+o],l=n?Number(e?.cost)||0:Xe(e);return!Number.isFinite(s)||s===0&&l>0?l:s/(t.exchangeRate||1)}const No={opendesign:Gt,go:["go","zen","opencode","opencode-go","opencode-go-plus","dsh-opencode-go"],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"],clinepass:["clinepass","cline-pass"],workbuddy:["workbuddy","workbuddy-subscription","workbuddy-ai","workbuddy-global","xdpool","xdpool-global"],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"]},Ue=["opendesign","anthropic","zai","minimax","kimi","openrouter","siliconflow","commandcode","clinepass","scnet","volcengine","qwen","mimo","factory","go","codex","volcengine-agent","tencent-coding","tencent-token","baidu-coding","workbuddy","antigravity","stepfun"],So=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",clinepass:"cline[._-]?pass|clinepass",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,t])=>[e,new RegExp("(?:^|[^a-z0-9])(?:"+t+")(?=$|[^a-z0-9])")]);function Co(e,t){for(const o of[e,t]){const n=String(o??"").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(n))continue;const s=So.filter(([,l])=>l.test(n));if(s.length){if(s.length!==1)return null;const l=s[0][0];if(l==="volcengine"&&/agent[-_\s]*plan|智能体.*套餐/.test(n))return"volcengine-agent";if(l==="tencent-coding"){const r=/token[-_\s]*plan|令牌.*套餐/.test(n),i=/coding[-_\s]*plan|编程.*套餐/.test(n);return r===i?null:r?"tencent-token":l}return l}}return null}function za(e,t,o){const n=String(e??"").trim().toLowerCase().replace(/^llm-/,""),s=t?.planBilling?.modelPlans?.[e+":"+o]??t?.planBilling?.modelPlans?.[n+":"+o];if(Ue.includes(s))return s;if(n.length===0)return null;for(const[l,r]of Object.entries(No))if(r.includes(n))return l;return Ue.includes(n)?n:Co(e,o)}function vo(e){if(Array.isArray(e?.planBilling?.autoProviders))return new Set(e.planBilling.autoProviders);const t=new Set,o=e?.codingPlans;if(o!==null&&typeof o=="object")for(const n of Ue)n!=="go"&&o[n]?.enabled===!0&&t.add(n);return e?.goQuota?.enabled===!0&&t.add("go"),e?.codexQuotaEnabled===!0&&t.add("codex"),t}const Ao=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(Ce));function Po(e,t,o){const n=String(e??"").trim().toLowerCase();if(n.length>0&&n!=="deepseek"&&!n.includes("deepseek"))return!1;const s=Ce(t);if(s.length===0||!Ao.has(s))return!1;const l=o?.prices,r=l?.models??{};for(const i of Object.keys(r))if(Ce(i)===s)return!1;for(const i of Object.keys(l?.providers?.["opencode-go"]?.models??{}))if(Ce(i)===s)return!0;return!1}function et(e,t,o){if(e==="deepseek-official"&&/^deepseek-(web-(search|fetch)|(search|fetch)-api|search-server)$/.test(t))return"api";let n=za(e,o,t);n===null&&Po(e,t,o)&&(n="go");const s=o?.planBilling?.models;if(s!==null&&typeof s=="object"){const l=s[e+":"+t];if(l==="plan"||l==="api")return l;if(n!==null){const r=s[n+":"+t];if(r==="plan"||r==="api")return r}}for(const l of[e,n]){if(l==null)continue;const r=o?.planBilling?.providers?.[l];if(r==="plan"||r==="api")return r}return n===null?"api":vo(o).has(n)?"plan":"api"}function Ya(e,t){if(!e||!t)return{total:0,api:0};const o=Mo(t),n={enabled:t.peakEnabled===!0,effectiveAtMs:Date.parse(t.peakEffectiveAt||""),windows:t.peakWindows,holidays:t.peakHolidays},s=Date.now(),l=e.byProviderModel??e.byModel??{};let r=0,i=0;for(const g of Object.keys(l)){const f=g.indexOf(":"),m=f>0?g.slice(0,f):"deepseek",x=f>0?g.slice(f+1):g,h=Ka(m,x,t);if(h.priced){const C=uo(h.entry);C&&h.billingMode==="deepseek-peak"&&t.prices?.ollamaPeak!==!1&&m.trim().toLowerCase().replace(/^llm-/,"")==="ollama-cloud"&&(t.prices?.ollamaTaggedPeak===!1?["deepseek-v4.1-flash","deepseek-v4-pro"].includes(x.trim().toLowerCase()):kt(x,["deepseek-v4.1-flash","deepseek-v4-pro"])!==null)&&(C.peakSchedule="ollama");const N=_a(l[g],Fa(C,s,{...n,enabled:["deepseek-peak","utc-peak"].includes(h.billingMode)&&n.enabled})),y=Wa(N,h.currency,o);r+=y,et(m,x,t)==="api"&&(i+=y)}}const d={input:0,output:0,cacheRead:0,cacheWrite:0,reasoning:0};for(const g of Object.keys(l))d.input+=l[g].input??0,d.output+=l[g].output??0,d.cacheRead+=l[g].cacheRead??0,d.cacheWrite+=l[g].cacheWrite??0,d.reasoning+=l[g].reasoning??0;const c={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)},u=_a(c,Fa(io("default",t.prices),s,n)),b=Wa(u,t.prices?.currency==="CNY"?"CNY":"USD",o);return r+=b,i+=b,{total:r,api:i}}function Mo(e){const t=o=>typeof o=="number"&&Number.isFinite(o)&&o>0&&o<1e6;return e.currency==="CNY"&&t(e.exchangeRate)?e.exchangeRate:t(e.fxRates?.CNY)?e.fxRates.CNY:7.2}function Va(e,t){if(!e||!t)return!1;const o=e.byProviderModel??{};for(const n of Object.keys(o)){const s=n.indexOf(":"),l=s>0?n.slice(0,s):"deepseek",r=s>0?n.slice(s+1):n;if(et(l,r,t)==="plan")return!0}return!1}function $a(e){return(e?.input??0)+(e?.cacheRead??0)+(e?.cacheWrite??0)}function Ja(e,t){if(e?.apiCost!==void 0)return Xe(e);if(!Va(e,t))return wt(e,t);let o=0;for(const[n,s]of Object.entries(e.byProviderModel??{})){if(!Number.isFinite(s.cost))return Ya(e,t).api;const l=n.indexOf(":");et(n.slice(0,l),n.slice(l+1),t)==="plan"&&(o+=s.cost)}return Math.max(0,wt(e,t)-o)}function Yt(e){const t=Math.abs(Math.round(Number(e)||0)),o=Math.floor(t/60),n=t%60;return"UTC"+(Number(e)<0?"-":"+")+o+(n>0?":"+String(n).padStart(2,"0"):"")}function To(e){const t=e?.meta,o=Number(t?.timezoneOffsetMinutes);if(!Number.isFinite(o))return null;const n=-new Date().getTimezoneOffset();if(n===o)return null;const s=typeof t?.timezone=="string"&&t.timezone.length>0?t.timezone:"";return{hostLabel:s?s+" ("+Yt(o)+")":Yt(o),browserLabel:Yt(n)}}function Ro(e,t=o=>o){let o=t(e);const n=new Set;return{getSnapshot:()=>o,subscribe:s=>(n.add(s),()=>{n.delete(s)}),set:s=>{if(s=t(s),s!==o){o=s;for(const l of[...n])l()}}}}const{createElement:a,Fragment:E,useState:O,useEffect:V,useRef:fe}=Ae;function tt({target:e,configured:t,source:o,t:n,api:s,placeholder:l,disabled:r}){const[i,d]=O(""),[c,u]=O(!1),[b,g]=O(!1),[f,m]=O(null),x=fe(!1),h=r===!0||b,C=async()=>{const p=i.trim();if(!(p.length===0||h||x.current)){x.current=!0,g(!0),m(null);try{const k=await s.setCredential(e,p);d(""),u(!1),m({kind:"ok",text:k?.message??n("credentialSave")})}catch(k){m({kind:"err",text:String(k?.message??k)})}finally{x.current=!1,g(!1)}}},N=async()=>{if(!(h||x.current)){x.current=!0,g(!0),m(null);try{const p=await s.clearCredential(e);d(""),u(!1),m({kind:"ok",text:p?.message??n("credentialClear")})}catch(p){m({kind:"err",text:String(p?.message??p)})}finally{x.current=!1,g(!1)}}},y=()=>{d(""),u(!1)};return a("div",{className:"cm-field"},c?a("form",{className:"cm-field",autoComplete:"off",onSubmit:p=>{p.preventDefault(),C()}},a("input",{className:"cm-input",type:"password",name:"cm-credential-"+e,autoFocus:!0,value:i,placeholder:typeof l=="string"?l:"",disabled:h,autoComplete:"new-password","data-lpignore":"true","data-1p-ignore":"true","data-bwignore":"true","aria-label":n("credentialInputHint"),onChange:p=>d(p.target.value)}),a("div",{className:"cm-buttons"},a("button",{className:"cm-btn small",type:"submit",disabled:h||i.trim().length===0},n(b?"credentialSaving":"credentialSave")),a("button",{className:"cm-btn small",type:"button",onClick:y,disabled:b},n("cancel")))):a("button",{className:"cm-btn small",type:"button",onClick:()=>u(!0),disabled:h},n("credentialEdit")),t===!0?a("button",{className:"cm-btn small",type:"button",onClick:N,disabled:h},n("credentialClear")):null,a("span",{className:"cm-hint"},t===!0?n("credentialConfiguredOf",{source:typeof o=="string"&&o.length>0?o:"unknown"}):n("credentialNotConfigured")),a("span",{className:"cm-hint"},n("credentialInputHint")),ka(f))}function Bo({pending:e,t}){return!Array.isArray(e)||e.length===0?null:a("div",{className:"cm-msg err"},a("div",null,t("secretMigrationPending")),a("div",null,e.join("、")))}function Nt({size:e=16,className:t}){return a("svg",{width:e,height:e,className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},a("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"}),a("path",{d:"M3.3 5.3H12.7V7.1H3.3Z",fill:"currentColor"}),a("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 Za(e,t){const o=fe(!1),n=fe(""),s=t!==null&&typeof t=="object"?[t.input,t.cacheRead,t.cacheWrite,t.output,t.reasoning,t.cost].map(l=>String(l??0)).join("|"):"";V(()=>{if(!o.current){o.current=!0,n.current=s;return}if(s===""||s===n.current)return;n.current=s;const l=setTimeout(()=>{e.api?.reload?.()},800);return()=>clearTimeout(l)},[s])}function Oo(e,t,o,n){const s=t?t.own:e;if(!o||!t?.subagentCount)return s;const l=t.subagents,r={...s};for(const i of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...bt])r[i]=(s?.[i]??0)+(l?.[i]??0);r.apiCost=Ja(s,n)+Xe(l);for(const i of["byModel","byProviderModel"]){r[i]={...s?.[i]};for(const[d,c]of Object.entries(l?.[i]??{})){const u={...r[i][d]};u.apiCost=Xe(u)+Xe(c);for(const b of["input","output","cacheRead","cacheWrite","reasoning","calls","cost",...bt])u[b]=(u[b]??0)+(c[b]??0);r[i][d]=u}}return r}function Xa(e){const t=e.useProjection?e.useProjection("costUsage"):void 0,o=e.useCost?.(c=>c)?.state,n=o?.config,[s,l]=O(null);Za(e,t);const r=["input","output","cacheRead","cacheWrite","reasoning","calls","cost","apiCost"].map(c=>t?.[c]??"").join(":");V(()=>{if(!e.sessionId||!e.api?.getSessionCost)return;let c=!0,u=!1;const b=async()=>{if(!(u||typeof document<"u"&&document.hidden)){u=!0;try{const m=await e.api.getSessionCost(e.sessionId);c&&l({id:e.sessionId,include:n?.includeSubagentCost===!0,value:m})}catch{c&&l(m=>m?.id===e.sessionId&&m.include===(n?.includeSubagentCost===!0)?m:{id:e.sessionId,include:n?.includeSubagentCost===!0,value:null})}finally{u=!1}}};b();const g=n?.includeSubagentCost===!0?setInterval(b,1e4):null,f=()=>{document.hidden||b()};return typeof document<"u"&&document.addEventListener?.("visibilitychange",f),()=>{c=!1,g!==null&&clearInterval(g),typeof document<"u"&&document.removeEventListener?.("visibilitychange",f)}},[e.sessionId,o?.meta?.now,r,n?.includeSubagentCost]);const i=s&&s.id===e.sessionId&&s.include===(n?.includeSubagentCost===!0)?s:null,d=i?.value;return{usage:Oo(t,d,n?.includeSubagentCost||d&&d.subagentCount>0,n),config:n,pending:!!e.sessionId&&!!e.api?.getSessionCost&&!i,unrecorded:!!d&&!d.found&&!d.subagentCount}}function en(e){const t=H(e.config)==="en";return e.pending?t?"Loading session cost…":"正在读取本会话费用…":e.unrecorded?t?"Session cost: no ledger records":"本会话暂无账本记录":e.usage?"":t?"Session cost unavailable":"本会话费用暂不可用"}function tn(e,t){if(Number.isFinite(e?.costCny)||Number.isFinite(e?.costEur)){const s=Q(e,{...t,showTotalWithPlan:!0}),l=Q(e,{...t,showTotalWithPlan:!1});return{cost:t.showTotalWithPlan?s:l,planPart:t.showTotalWithPlan?0:Math.max(0,s-l)}}let o=0,n=wt(e,t);if(t.showTotalWithPlan!==!0&&(e.apiCost!==void 0||Va(e,t))){const s={total:wt(e,t),api:Ja(e,t)};o=Math.max(0,s.total-s.api),o>0&&(n=s.api)}return{cost:n,planPart:o}}function an(e,t){return Object.entries(e?.byProviderModel??{}).filter(([,o])=>o.input||o.output||o.cacheRead||o.cacheWrite||o.reasoning).map(([o,n])=>ut(o)+" "+W(Q(n,{...t,showTotalWithPlan:!0}),t)).join("; ")}function Do(e){const t=e.useCost?.(h=>h)?.state?.config,[o,n]=O(null),[s,l]=O(""),r=e.turn?.start?.seq,i=e.turn?.end?.seq,d=e.sessionId,c=JSON.stringify([t?.prices,t?.priceOverrides,t?.priceMatch,t?.planBilling,t?.codingPlans,t?.goQuota?.enabled,t?.peakEnabled,t?.peakEffectiveAt,t?.peakWindows,t?.peakHolidays,t?.exchangeRate]);if(V(()=>{let h=!0;if(n(null),l(""),!(t?.hideTurnCost||!d||r==null||i==null))return e.api.getTurnCost(d,r,i).then(C=>{h&&n(C)},C=>{h&&l(String(C.message??C))}),()=>{h=!1}},[d,r,i,c,t?.hideTurnCost]),!t||t.hideTurnCost||r==null||i==null)return null;const u=H(t)==="en",b=u?{input:"Input",output:"Output",cacheRead:"Cache read",cacheWrite:"Cache write",reasoning:"Reasoning"}:{input:"输入",output:"输出",cacheRead:"缓存读取",cacheWrite:"缓存写入",reasoning:"推理"},g=h=>{const C=Number(t.exchangeRate),N=h*(Number.isFinite(C)&&C>0?C:1),y=t.decimals??2;return W(h,N>0&&N<10**-(y+2)?{...t,decimals:Math.max(8,y)}:t)},f=h=>W(h,{...t,decimals:Math.max(8,t.decimals??2)}),m=u?{model:"Model call",compaction:"Context compaction",search:"Native search",fetch:"Web fetch"}:{model:"模型调用",compaction:"上下文压缩",search:"原生搜索",fetch:"网页抓取"},x=(h,C)=>a("div",{key:C,style:{marginBottom:4,overflowWrap:"anywhere"}},ut(h.provider+":"+h.model)+" · "+(b[h.bucket]||(h.bucket==="fetchRequests"?u?"Fetch requests":"抓取请求":u?"Search requests":"搜索请求"))+(h.plan?" (Plan)":"")+": "+(h.requests?h.requests+(u?" requests":" 次"):h.tokens.toLocaleString())+" × "+(h.priced?f(h.rate):"?")+(h.requests?" ≈ ":" / 1,000,000 ≈ ")+(h.priced?g(h.cost):"?"),h.priced?h.bucket==="reasoning"&&h.rate===0?u?" (no separate charge)":"(不单独收费)":"":u?" (price unavailable)":"(未配置价格)");return a("details",{className:"cm-note",style:{fontSize:12,marginTop:6}},a("summary",{style:{cursor:"pointer"},title:u?"Log estimate at configured prices; session cost uses recorded ledger amounts.":"本轮按日志和配置价格估算,本会话按账本已入账金额汇总。"},u?"Turn cost":"本轮费用",o?.found?" ≈ "+g(Q(o,t))+(o.rows.some(h=>!h.priced)?u?" + unpriced usage":" + 未定价用量":""):o?.inherited?u?" · inherited history":" · 继承历史":s?" ⚠":""),s?a("div",{role:"alert"},s):o?o.found?a(E,null,a("p",null,u?"Estimated from recorded usage and configured prices; rates per 1M tokens.":"按已记录用量和配置价格估算;单价单位为每百万 Token。"),a("p",null,"API ≈ "+g(Q(o,{...t,showTotalWithPlan:!1}))+" · Plan ≈ "+g(Q(o,{...t,showTotalWithPlan:!0})-Q(o,{...t,showTotalWithPlan:!1}))+(u?" (equivalent)":"(等值)")),o.rows.map(x),a("details",null,a("summary",{style:{cursor:"pointer"}},(u?"Individual calls":"逐次调用明细")+" ("+o.calls.length+")"),o.calls.map((h,C)=>a("details",{key:C,style:{margin:"6px 0"}},a("summary",{title:h.provider+":"+h.model,style:{cursor:"pointer",overflowWrap:"anywhere"}},"#"+(C+1)+" "+m[h.kind]+" · "+ut(h.provider+":"+h.model)+" · "+new Date(h.atMs).toLocaleTimeString()+" · "+(h.plan?"Plan ":"API ")+(h.priced?"≈ "+g(h.cost):u?"price unavailable":"未配置价格")+(h.longContext?u?" · long context":" · 长上下文价格":"")),h.metering?a("p",null,"billion-context · "+h.metering.upstream+(h.metering.attempt>1?(u?" · Retry ":" · 重试 ")+h.metering.attempt:"")+(h.metering.complete?"":u?" · partial usage":" · 用量回执不完整")):null,h.rows.map(x))))):o.inherited?u?"Inherited usage is not billed again in this conversation.":"继承的历史用量不在本会话重复计费。":u?"Complete usage records unavailable":"没有完整用量记录":u?"Loading…":"加载中…")}function Lo(e){const t=Xa(e),{usage:o,config:n}=t;if(!n)return null;const s=en(t);if(s)return a("div",{className:"cm-chip"},s);const l=z(H(n)),{cost:r,planPart:i}=tn(o,n),d=[l("sessionCostTitle"),l("sessionDetailTokens",{input:L(o?.input??0),cache:L((o?.cacheRead??0)+(o?.cacheWrite??0)),output:L(o?.output??0)}),l("sessionDetailCache",{read:L(o?.cacheRead??0),write:L(o?.cacheWrite??0)}),l("cost",{amount:W(r,n)}),...i>0?[l("sessionDetailPlan",{amount:W(i,n)})]:[],an(o,n)].filter(Boolean).join("; ");return a(J,{portal:!0,label:d,side:"top",delayMs:500},a("div",{className:"cm-chip"},i>0?l("costChipPlan",{amount:W(r,n)}):l("cost",{amount:W(r,n)})))}function Eo(e){const t=Xa(e),{usage:o,config:n}=t;if(!n)return null;const s=en(t);if(s)return a("div",{className:"cm-root",role:"status",title:s},s);const l=o.input??0,r=(o.cacheRead??0)+(o.cacheWrite??0),i=o.output??0,d=z(H(n)),{cost:c,planPart:u}=tn(o,n),b=$a(o)>0?((o.cacheRead??0)/$a(o)*100).toFixed(1)+"%":"—",g={amount:W(c,n),planAmount:W(u,n),hitRate:b,input:L(l),cache:L(r),output:L(i)},f=d(u>0?"sessionLineSplit":"sessionLine",g),m=an(o,n),x=n.sessionCostCompact===!0,h=d("sessionLineCompact",g),C=x?d(u>0?"sessionLineSplitCompact":"sessionLineCompact",g):f;return a("div",{className:"cm-root cm-session-cost",title:[f,m].filter(Boolean).join("; ")},a("span",{className:"cm-session-amount"},h),a("span",{className:"cm-session-detail"},C.slice(h.length)))}const Io={USD:"$",CNY:"¥",EUR:"€"};function je(e,t,o){const n=typeof o=="string"?o.toUpperCase():"",s=typeof t?.symbol=="string"&&t.symbol.length>0?t.symbol:"$";return de(e,{symbol:Io[n]??s,decimals:Math.max(2,Math.min(10,Math.floor(Number(t?.decimals)||2)))})}function nn(e,t){const o=Number(e?.balance?.budgetCap);if(Number.isFinite(o)&&o>0)return o;const n=Number(t?.maxBudget);return Number.isFinite(n)&&n>0?n:null}function jo(e){const t=e.today,o=t?.byProviderModel;if(o===null||typeof o!="object"||Object.keys(o).length===0)return Number(t?.cost)||0;let n=0;for(const[s,l]of Object.entries(o)){const r=s.indexOf(":");let i=r>=0?s.slice(0,r):s;i.startsWith("llm-")&&(i=i.slice(4)),/^deepseek(?:-official|-account)?$/.test(i)&&(n+=Number(l?.cost)||0)}return n}function on(e,t,o,n,s=null){const l=o==="official"?jo(e):Number(e.today?.cost)||0,r=o==="custom"?at(t,n,s):e.balance?.currency;if(r==="USD")return l;if(r==="CREDITS")return 0;const i=Number(t?.exchangeRate);return l*(Number.isFinite(i)&&i>0?i:1)}function Vt({remaining:e,spend:t,todayUsed:o,cap:n}){if(n===null||n<=0)return{remainingPct:100,todayPct:0,spentPct:0,hasCap:!1,pastSpend:0,today:0};const s=Math.max(0,Number(e)||0),l=Math.max(0,Number(t)||0),r=Math.max(0,Math.min(l,Number(o)||0)),i=Math.max(0,l-r),d=Math.max(0,Math.min(100,s/n*100)),c=Math.max(0,Math.min(100-d,r/n*100)),u=Math.max(0,Math.min(100-d-c,i/n*100));return{remainingPct:d,todayPct:c,spentPct:u,hasCap:!0,pastSpend:i,today:r}}function $t(e,t,o=null,n=null){const s=o??e.customBalance;if((n??t?.customBalance)?.adapter==="tokenrhythm")return{cap:null,...Vt({remaining:s?.remaining,cap:null})};const l=nn(at(t,s,n)==="CREDITS"?null:t,s),r=Number(s?.remaining)||0,i=Number(s?.spend)||0,d=on(e,t,"custom",s,n);return{cap:l,...Vt({remaining:r,spend:i,todayUsed:d,cap:l})}}function Ho(e,t){const o=e.balance,n=nn(t,null),s=Number(o?.totalBalance)||0,l=on(e,t,"official",null),r=n!==null?Math.max(0,n-s):0;return{cap:n,...Vt({remaining:s,spend:r,todayUsed:l,cap:n})}}function Jt(e){const{segments:t,direction:o="remaining"}=e,{remainingPct:n,todayPct:s,spentPct:l}=t,r=[];n>0&&r.push(a("div",{className:"cm-bbox-fill",style:{width:n+"%"}})),s>0&&r.push(a("div",{className:"cm-bbox-seg-today",style:{width:s+"%"}})),l>0&&r.push(a("div",{className:"cm-bbox-seg-spent",style:{width:l+"%"}})),r.length===0&&r.push(a("div",{className:"cm-bbox-fill",style:{width:"100%"}}));const i=o==="used"?[...r].reverse():r;return a("div",{className:"cm-bbox-bar segments"+(o==="used"?" rev":"")},...i)}function Qo(e,t,o,n,s){const l=[e("balanceBarRemaining",{amount:n})];return o.today>0&&l.push(e("balanceBarToday",{amount:t(o.today)})),o.pastSpend>0&&l.push(e("balanceBarSpent",{amount:t(o.pastSpend)})),s!==null&&s>0&&l.push(e("balanceBudgetCapLabel")+": "+t(s)),l.join(" · ")}function Be(e){const[t,o]=O(!1),[n,s]=O(null);return{busy:t,err:n,run:()=>{t||typeof e!="function"||(o(!0),s(null),Promise.resolve().then(e).catch(r=>{s(r?.message??String(r))}).finally(()=>{o(!1)}))}}}const ke=(e,t)=>({role:"button",tabIndex:0,"aria-busy":e?"true":"false",onClick:t,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),t())}});function Pe(e,t){const o=[e("clickToRefresh")];return t.busy&&o.push(e("refreshing")),t.err&&o.push("⚠ "+e("balanceRefreshFailed",{message:t.err})),o}const qo="https://platform.deepseek.com/usage";function sn(e){return a("a",{className:"cm-bal-link",href:qo,target:"_blank",rel:"noreferrer noopener",title:e("balanceRechargeLink"),"aria-label":e("balanceRechargeLink"),onClick:t=>t.stopPropagation(),onKeyDown:t=>t.stopPropagation()},a("svg",{width:14,height:14,viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},a("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 Uo(e){const{state:t,wide:o,api:n}=e,s=t.balance,l=z(H(t.config)),r=Be(n?()=>n.refreshBalance():null);if(!s||s.status==="off")return null;if(s.status==="error")return a(J,{portal:!0,label:[l("balanceQueryFailed",{message:s.message||l("unknownError")}),...Pe(l,r)].join("; "),side:"right",delayMs:300},a("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+" cm-bal-err"+(r.busy?" busy":""),...ke(r.busy,r.run)},o?a(E,null,Zt(l,t.config)," ",a("span",{className:"cm-num"},l("queryFailed"))):"⚠"));const i=ln(l,s,t.config,t.reconcile,r);return a(J,{portal:!0,label:i,side:"right",delayMs:300},a("div",{"data-cm-display":"balance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+(r.busy?" busy":""),...ke(r.busy,r.run)},o?a(E,null,a("span",{className:"cm-balance-name"},Zt(l,t.config),sn(l)),a("span",{className:"cm-num cm-bal-amt"},je(s.totalBalance,t.config,s.currency)),t.reconcile?.ok===!1?" ⚠":""):a(Nt,{size:16})))}function Zt(e,t){return e(t?.balance?.showSource===!0?"officialBalance":"balance")}function ln(e,t,o,n,s){const l=[e("officialBalance")+" "+je(t.totalBalance,o,t.currency),e("grantedToppedUp",{granted:je(t.grantedBalance,o,t.currency),toppedUp:je(t.toppedUpBalance,o,t.currency)}),...n?.ok===!1?["⚠ "+n.message]:[],...Pe(e,s)];return a("div",{style:{maxWidth:"min(280px, 70vw)",whiteSpace:"normal"}},...l.map((r,i)=>a("div",{key:i},r)))}function Fo(e){const{state:t,wide:o,api:n}=e,s=t.config,l=t.balance,r=z(H(s)),i=Be(n?()=>n.refreshBalance():null);if(!l||l.status!=="ok")return null;const d=Ho(t,s),c=je(l.totalBalance,s,l.currency),u=ln(r,l,s,t.reconcile,i),b=a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-balance-name"},a("span",{className:"cm-bbox-label"},Zt(r,s)),sn(r)),a("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},c)),a(Jt,{segments:d,direction:ie(s,"balance")}));return a(J,{portal:!0,label:u,side:"right",delayMs:300},a("div",{"data-cm-display":"balance",className:"cm-bbox clickable"+(o?"":" rail")+(i.busy?" busy":""),...ke(i.busy,i.run)},o?b:a("div",{className:"cm-bbox-rail cm-num"},Math.round(d.remainingPct)+"%")))}function Xt(e,t){const o=typeof e?.label=="string"?e.label:"",n=typeof e?.labelEn=="string"?e.labelEn:"";return t==="en"?n||o||"Custom balance":o||n||"自定义余额"}function at(e,t,o){if((o??e?.customBalance)?.adapter==="tokenrhythm")return"CNY";if((o??e?.customBalance)?.adapter==="aliyun"&&["CNY","USD","EUR"].includes(t?.unit))return t.unit;const n=o?.unit??e?.customBalance?.unit;return["CNY","EUR","USD","CREDITS"].includes(n)?n:["CNY","EUR","CREDITS"].includes(t?.unit)?t.unit:"USD"}function Fe(e,t,o,n){const s=at(t,o,n),l=Number(e);if(!Number.isFinite(l))return"—";const r=t?.currency==="USD"?1:Number(t?.exchangeRate);if((n??t?.customBalance)?.convertToDisplayCurrency===!0&&s==="USD"&&Number.isFinite(r)&&r>0){const u=l*r;return Number.isFinite(u)?de(u,t):"—"}const i=s==="CREDITS",d=Math.max(2,Math.min(6,Math.floor(Number(t?.decimals)||4)));return(i?"":s==="CNY"?"¥":s==="EUR"?"€":"$")+Ga(l,d)+(i?" Credits":"")}function ea(e,t,o,n,s=null){const l=Fe(e.remaining,t,e,s);if((s??t?.customBalance)?.adapter==="tokenrhythm")return o("customBalanceRemaining",{amount:l});const r=g=>Fe(g,t,e,s);if(n&&t.balance?.showProgressBar===!0){const g=$t(n,t,e,s);return[Qo(o,r,g,l,g.cap),o("updatedAt",{time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"})].join(" · ")}const i=e.spend!==null?r(e.spend):"—",d=e.maxBudget!==null?r(e.maxBudget):"—",c=at(t,e,s)==="CREDITS"?NaN:Number(t?.balance?.budgetCap),u=Number.isFinite(c)&&c>0?o("balanceBudgetCapLabel")+": "+r(c):"",b=e.maxBudget!==null&&e.spend!==null?o("customBalanceLine",{remaining:l,spend:i,maxBudget:d,time:e.fetchedAt>0?new Date(e.fetchedAt).toLocaleTimeString():"—"}):o("customBalanceRemaining",{amount:l});return u?b+" · "+u:b}function _o(e,t,o,n,s){const l=Xt(s??t.customBalance??{},H(t)),r=Fe(n.remaining,t,n,s),i=$t(e,t,n,s);return{level:"ok",rail:Math.round(i.remainingPct)+"%",body:a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bbox-label"},l),a("span",{className:"cm-bbox-pct cm-num cm-bal-amt"},r)),a(Jt,{segments:i,direction:ie(t,"balance")}))}}function St(e,t){const o=t?.customBalances??[],n=Array.isArray(e?.customBalances)?e.customBalances:[],s=[];return o.forEach((l,r)=>{if(l?.enabled!==!0||l.display!=="sidebar"&&l.display!=="both")return;const i=n.find(d=>d.index===r)??(n.length===1&&o.length===1?n[0]:null);s.push({index:r,entry:l,snapshot:i})}),s.length===0&&n.length===0&&t?.customBalance?.enabled===!0&&(t.customBalance.display==="sidebar"||t.customBalance.display==="both")&&e?.customBalance?.status&&e.customBalance.status!=="off"&&s.push({index:null,entry:t.customBalance,snapshot:e.customBalance}),s}function Wo(e){const{state:t,wide:o,api:n}=e,s=t.config,l=z(H(s)),r=St(t,s);return r.length===0?null:a(E,null,r.map(({index:i,entry:d,snapshot:c})=>a(d.adapter==="tokenrhythm"?rn:Go,{key:"cb-"+i,state:t,wide:o,api:n,t:l,index:i,entry:d,snapshot:c})))}function Go(e){const{state:t,wide:o,api:n,t:s,index:l,entry:r,snapshot:i}=e,d=t.config;if(i==null||i.status!=="ok")return null;const c=Be(n?()=>n.refreshCustomBalance(l):null),u=_o(t,d,s,i,r),b=[ea(i,d,s,t,r),...Pe(s,c)].join(" · ");return a(J,{portal:!0,label:b,side:"right",delayMs:300},a("div",{"data-cm-display":"customBalance",className:"cm-bbox clickable"+(u.level==="ok"?"":" "+u.level)+(o?"":" rail")+(c.busy?" busy":""),...ke(c.busy,c.run)},o?u.body:a("div",{className:"cm-bbox-rail cm-num"},u.rail)))}function Ko(e){const{state:t,wide:o,api:n}=e,s=t.config,l=z(H(s)),r=St(t,s);return r.length===0?null:a(E,null,r.map(({index:i,entry:d,snapshot:c})=>a(rn,{key:"cbr-"+i,state:t,wide:o,api:n,t:l,index:i,entry:d,snapshot:c})))}function rn(e){const{state:t,wide:o,api:n,t:s,index:l,entry:r,snapshot:i}=e,d=t.config,c=i??Oa(l);if(c.status==="off")return null;const u=Be(n?()=>n.refreshCustomBalance(l):null),b=Xt(r??d.customBalance??{},H(d));if(c.status==="error")return a(J,{portal:!0,label:[c.message||s("unknownError"),...Pe(s,u)].join("; "),side:"right",delayMs:300},a("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+" cm-bal-err"+(u.busy?" busy":""),...ke(u.busy,u.run)},o?a(E,null,a("span",{className:"cm-bal-label",title:b},b),a("span",{className:"cm-num cm-bal-amt"},s("queryFailed"))):"⚠"));const g=Fe(c.remaining,d,c,r),f=[ea(c,d,s,t,r),...Pe(s,u)].join(" · ");return a(J,{portal:!0,label:f,side:"right",delayMs:300},a("div",{"data-cm-display":"customBalance",className:"cm-foot clickable"+(o?"":" cm-foot-rail")+(u.busy?" busy":""),...ke(u.busy,u.run)},o?a(E,null,a("span",{className:"cm-bal-label",title:b},b),a("span",{className:"cm-num cm-bal-amt"},g)):a(Nt,{size:16})))}function cn(e){const o=(e.useCost?e.useCost(m=>m):void 0)?.state;if(!o)return null;const n=o.config,s=z(H(n)),l=n.corner??{enabled:!1,goRolling:!0,goWeekly:!0,goMonthly:!0,budget:!0},r=o.goQuota,i=n?.goQuota?.enabled!==!1&&r?.status==="ok",d=m=>m!==null&&typeof m?.percent=="number"?Math.round(Math.max(0,Math.min(100,m.percent))):null,c=[];if(n.sidebarModels?.dock){const m=Sn(o,n.sidebarModels.period,s);m.length&&c.push({key:"model-top",text:a(E,null,a("span",{className:"cm-bal-label"},m[0].label),a("span",{className:"cm-bal-amt"},W(m[0].cost,n))),tip:m[0].label+" "+W(m[0].cost,n),level:"ok"})}const u=(m,x,h,C)=>{if(!l.enabled||!m||!i)return;const N=d(x);if(N===null)return;const y=typeof x.resetsAt=="string"&&x.resetsAt.length>0?s("goResetAt",{time:new Date(x.resetsAt).toLocaleString()}):"";c.push({key:h,text:s(h)+" "+N+"%",tip:s(C)+": "+N+"%"+(y?" · "+y:""),level:N>=100?"over":N>=80?"warn":"ok"})},b=n?.goQuota?.main==="weekly"||n?.goQuota?.main==="monthly"?n.goQuota.main:"rolling",g=[b,...["rolling","weekly","monthly"].filter(m=>m!==b)],f=m=>m==="rolling"?["goRolling",r?.rolling,"goShortRolling","cornerGoRolling"]:m==="weekly"?["goWeekly",r?.weekly,"goShortWeekly","cornerGoWeekly"]:["goMonthly",r?.monthly,"goShortMonthly","cornerGoMonthly"];for(const m of g){const[x,h,C,N]=f(m);u(l[x]===!0,h,C,N)}if(l.enabled&&l.budget===!0){const m=n.budget??{enabled:!1,amount:100,period:"month"};if(m.enabled===!0){const x=Number(n.exchangeRate),C=(o.budgetUsed??(m.period==="day"?Q(o.today,n):m.period==="all"?Q(o.total,n):Q(o.month,n)))*(Number.isFinite(x)&&x>0?x:1),N=Math.max(0,Number(m.amount)||0),y=N>0?Math.min(999,C/N*100):null;if(y!==null){const p=y>=100?"over":y>=80?"warn":"ok";c.push({key:"budget",text:s("budgetShort")+" "+y.toFixed(1)+"%",tip:s("budgetOf",{period:s(Ye[m.period]??"periodMonth")})+" · "+s("usedOf",{used:de(C,n),amount:de(N,n)}),level:p})}}}return c.length===0?null:a("div",{className:"cm-corner"},c.map(m=>a(J,{portal:!0,key:m.key,label:m.tip,side:"top",delayMs:500},a("span",{className:"cm-corner-chip"+(m.key==="model-top"?" cm-model-top":"")+(m.level==="ok"?"":" "+m.level)},m.text))))}function ta(e,t,o,n){if(n==="volcengine"&&(o=[]),!Array.isArray(t)||t.length===0||!Number.isFinite(e))return null;const s=(f,m)=>{const x=new Date(e);return x.setUTCDate(x.getUTCDate()+f),x.setUTCHours(m,0,0,0),x.getTime()},l=new Set,r=Math.max(12,Math.min(380,(Array.isArray(o)?o.length:0)+7));for(let f=-r;f<=r;f+=1){l.add(s(f,16));for(const m of t){const x=Number(m?.start),h=Number(m?.end);!Number.isFinite(x)||!Number.isFinite(h)||(l.add(s(f,x)),l.add(s(h<=x?f+1:f,h)))}}const i=[...l].sort((f,m)=>f-m).flatMap(f=>{const m=ht(f-1,void 0,t,o),x=ht(f,void 0,t,o);return m===x?[]:[{at:f,intoPeak:x}]});let d=null,c=null;for(const f of i)f.at<=e&&(d===null||f.at>d.at)&&(d=f),f.at>e&&(c===null||f.at<c.at)&&(c=f);const u=Ua(e,o),b=u??qa(e);return b!==null?c===null?null:{inPeak:!1,weekend:u===null,...u?{holiday:!0}:{},prevAtMs:b.start,nextAtMs:c.at,nextIntoPeak:c.intoPeak}:d===null||c===null?null:{inPeak:ht(e,void 0,t,o),weekend:!1,prevAtMs:d.at,nextAtMs:c.at,nextIntoPeak:c.intoPeak}}function _e(e,t){if(!e||e.peakNotice===!1||e.peakEnabled!==!0)return null;const o=Date.parse(e.peakEffectiveAt||"");return Number.isFinite(o)&&t<o?null:un(e,t)}function un(e,t){const o=String(e?.peakProvider??"").trim().toLowerCase().replace(/^llm-/,"");return ta(t,e?.peakWindows??[],e?.peakHolidays,["volcengine","ark"].includes(o)?"volcengine":void 0)}function aa(e,t){const o=e?.config,n=t??o?.peakProvider??e?.meta?.defaultProvider;return o&&n?{...o,peakProvider:n}:o}function nt(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 Me(e,t,o){const n=Math.max(0,e.nextAtMs-t),s=Math.max(1,Math.ceil(n/6e4)),l=Math.floor(s/60),r=s%60;return l>0?r>0?o("countdownHourMinute",{h:l,m:r}):o("countdownHoursOnly",{h:l}):o("countdownMinute",{m:s})}function dn(e){const t=fe(null),o=fe(e.actions);o.current=e.actions,V(()=>{const d=t.current;if(!d)return;try{typeof d.showPopover=="function"?d.showPopover():d.removeAttribute("popover")}catch{d.removeAttribute("popover")}let c=!1;const u=m=>{d.contains(m.target)&&(c=!0,m.stopPropagation())},b=m=>{c&&(c=!1,m.stopPropagation())},f=[["pointerdown",u],["pointerup",b],["pointercancel",b],["touchstart",u],["click",m=>{if(!d.contains(m.target))return;m.stopPropagation();const x=m.target.closest?.("[data-cm-action]");x&&!x.disabled&&o.current[x.dataset.cmAction]?.()}]];for(const[m,x]of f)window.addEventListener?.(m,x,{capture:!0,passive:!0});return()=>{for(const[m,x]of f)window.removeEventListener?.(m,x,!0);try{d.hidePopover()}catch{}}},[]);const{actions:n,children:s,...l}=e,r=a("div",{...l,ref:t,popover:"manual"},s);let i;try{i=ve("react-dom")?.createPortal}catch{}return typeof i=="function"?i(r,document.body):r}const zo="cm-peak-alert-preview";function Yo(e){return e.useCost?.(o=>o)?.state?.config?.peakEnabled===!0?a(ot,{...e,view:"alert"}):null}function Vo(e){const{config:t,t:o}=e,[n,s]=O(Date.now());V(()=>{const d=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)});return a(J,{portal:!0,label:o(r.notice),side:"right",delayMs:300},a("div",{"data-cm-display":"peak",className:"cm-peak-strip "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off")},a("div",{className:"cm-peak-track"},a("div",{className:"cm-peak-segment cm-peak-high"}),a("div",{className:"cm-peak-segment cm-peak-low"}),a("div",{className:"cm-peak-marker",style:{left:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}})),a("span",{className:"cm-peak-chip"},o(r.chip)+" · "+i)))}function $o(e){const{config:t,t:o}=e,[n,s]=O(Date.now());V(()=>{const d=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(d)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)});return a(J,{portal:!0,label:o(r.notice),side:"right",delayMs:300},a("div",{"data-cm-display":"peak",className:"cm-peak-classic "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off")},a("div",{className:"cm-peak-classic-marker",style:{left:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}}),a("div",{className:"cm-peak-track"},a("div",{className:"cm-peak-segment cm-peak-high"}),a("div",{className:"cm-peak-segment cm-peak-low"})),a("span",{className:"cm-peak-classic-chip"},o(r.chip)+" · "+i)))}let pn;function Jo(){return pn??=ve.async("./client.peak.js").then(e=>e.mount({peakView:_e,peakPhaseAt:ta,peakPhaseForConfig:un,peakConfigForState:aa,phaseLabelKeys:nt,countdownText:Me,resolveLocale:H,makeT:z,Tooltip:J,FloatingCard:dn,renderSidebarFooter:Rt})).catch(e=>{throw pn=null,e})}function ot(e){return a(be,{...e,load:Jo,quiet:!0})}function Zo(e){const t=e.useCost?.(o=>o)?.state;return t&&t.config.sidebar!==!1&&!t.config.sidebarSummaryPromptSeen?a(ot,{...e,state:t,config:t.config,view:"summary-guide"}):null}function Xo(e){const t=e.useCost?.(n=>n)?.state,o=t?.config;return o?.peakEnabled&&o.peakNotice!==!1&&!o.peakProgressPromptSeen?a(ot,{...e,state:t,config:o,view:"guide"}):null}function mn(e,t,o){return a(t?.peakStyle==="progress"?ot:t?.peakStyle==="classic"?$o:Vo,{config:t,t:o})}function es(e){const{config:t,t:o}=e,[n,s]=O(Date.now());V(()=>{const c=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(c)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)}),d=[o(r.notice),i];return a(J,{portal:!0,label:d,side:"right",delayMs:300},a("div",{className:"cm-peak-rail "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off"),"aria-label":d.join("; ")},a("div",{className:"cm-peak-rail-track"},a("div",{className:"cm-peak-rail-segment cm-peak-rail-high"}),a("div",{className:"cm-peak-rail-segment cm-peak-rail-low"}),a("div",{className:"cm-peak-rail-marker",style:{top:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}})),a("span",{className:"cm-peak-rail-label"},o(r.short))))}function ts(e){const{config:t,t:o}=e,[n,s]=O(Date.now());V(()=>{const c=window.setInterval(()=>s(Date.now()),3e4);return()=>window.clearInterval(c)},[]);const l=_e(t,n);if(l===null)return null;const r=nt(l),i=l.nextIntoPeak?o("nextPeakIn",{time:Me(l,n,o)}):o("nextOffPeakIn",{time:Me(l,n,o)}),d=[o(r.notice),i];return a(J,{portal:!0,label:d,side:"right",delayMs:300},a("div",{className:"cm-peak-rail-classic "+(l.weekend||l.holiday?"weekend":l.inPeak?"peak":"off"),"aria-label":d.join("; ")},a("div",{className:"cm-peak-rail-classic-track"},a("div",{className:"cm-peak-rail-classic-segment peak"}),a("div",{className:"cm-peak-rail-classic-segment off"}),a("div",{className:"cm-peak-rail-classic-marker",style:{top:l.weekend||l.holiday?"50%":l.inPeak?"25%":"75%"}})),a("span",{className:"cm-peak-rail-classic-label"},o(r.short))))}function as(e,t,o){return a(t?.peakStyle==="progress"?ot:t?.peakStyle==="classic"?ts:es,{config:t,t:o,rail:!0})}function ns(e,t,o){const n=t.budget??{enabled:!1,amount:100,period:"month"},s=Number(t.exchangeRate),r=(e.budgetUsed??(n.period==="day"?Q(e.today,t):n.period==="all"?Q(e.total,t):Q(e.month,t)))*(Number.isFinite(s)&&s>0?s:1),i=Math.max(0,Number(n.amount)||0),d=i>0?Math.min(999,r/i*100):null,c=we(d===null?null:Math.min(100,d),ie(t,"budget")),u=n.detail!==!1;return{level:d===null?"ok":d>=100?"over":d>=80?"warn":"ok",rail:c.label===null?"—":Math.round(c.label)+"%",body:a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bbox-label"},o("budget")),a("span",{className:"cm-bbox-pct cm-num"},c.label===null?"—":c.label.toFixed(1)+"%")),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:c.width+"%"}})),u?a(E,null,a("div",{className:"cm-bbox-line cm-num"},o("usedOf",{used:de(r,t),amount:de(i,t)}))):null)}}function os(e,t,o){const n=e.goQuota,s=t?.goQuota?.main==="weekly"||t?.goQuota?.main==="monthly"?t.goQuota.main:"rolling",l=n[s],r=l!==null&&typeof l?.percent=="number"?Math.max(0,Math.min(100,Number(l.percent)||0)):0,i=f=>f!==null&&typeof f?.percent=="number"?Math.round(Math.max(0,Math.min(100,f.percent)))+"%":"—",d=f=>o(f==="rolling"?"goShortRolling":f==="weekly"?"goShortWeekly":"goShortMonthly"),c=["rolling","weekly","monthly"].filter(f=>f!==s),u=l!==null&&typeof l?.resetsAt=="string"&&l.resetsAt.length>0?o("goResetAt",{time:new Date(l.resetsAt).toLocaleString()}):"",b=t?.goQuota?.detail!==!1,g=we(r,ie(t,"go"));return{level:r>=100?"over":r>=80?"warn":"ok",rail:g.label===null?"—":Math.round(g.label)+"%",body:a(E,null,a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bbox-label"},o("goQuotaRowLabel")+" "+d(s)),a("span",{className:"cm-bbox-pct cm-num"},g.label===null?"—":Math.round(g.label)+"%")),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:g.width+"%"}})),b?a(E,null,a("div",{className:"cm-bbox-line cm-num"},c.map(f=>d(f)+" "+i(n[f])).join(" · ")),u?a("div",{className:"cm-bbox-line"},u):null):null)}}function fn(e,t,o){const n=ie(t,"go");return["rolling","weekly","monthly"].map((s,l)=>{const r=e?.[s],i=typeof r?.percent=="number"&&Number.isFinite(r.percent)?Math.max(0,Math.min(100,r.percent)):null,d=r?.resetsAt&&Number.isFinite(Date.parse(r.resetsAt))?" · "+o("goResetAt",{time:new Date(r.resetsAt).toLocaleString()}):"";return o(["goWindowRolling","goWindowWeekly","goWindowMonthly"][l])+": "+(i===null?"—":Oe(we(i,n).label,n,o))+d}).concat(e?.fetchedAt>0?o("goQuotaFetchedAt",{time:new Date(e.fetchedAt).toLocaleTimeString()}):[]).join(`
3
+ `)}function ss(e){const{state:t,wide:o}=e,n=t.goQuota,s=z(H(t.config));if(!n||n.status!=="ok")return null;const l=t.config?.goQuota?.main==="weekly"||t.config?.goQuota?.main==="monthly"?t.config.goQuota.main:"rolling";if(n[l]===null||typeof n[l]?.percent!="number")return null;const r=os(t,t.config,s),i=fn(n,t.config,s);return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},i),side:"right",delayMs:300},a("div",{"data-cm-display":"go",className:"cm-bbox"+(r.level==="ok"?"":" "+r.level)+(o?"":" rail")},o?r.body:a("div",{className:"cm-bbox-rail cm-num"},r.rail)))}function ls(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 na(e){const t=e!==null&&typeof e=="object"?e:{};return{five:t["5h"]??null,seven:t["7d"]??t.week??t.weekly??null}}function bn(e,t,o=Date.now()){if(typeof e!="string"||!e)return"";const n=Date.parse(e);if(!Number.isFinite(n))return"";const s=n-o;if(s<=0)return t("resetReached");const l=Math.ceil(s/6e4),r=Math.floor(l/1440),i=Math.floor(l%1440/60),d=l%60;return r>0?t("resetDays",{d:r,h:i}):i>0?t("resetHours",{h:i,m:d}):t("resetMinutes",{m:d})}function st(e,t,o=Date.now()){const n=bn(e?.resetsAt,t,o);return n?t("goResetAt",{time:new Date(e.resetsAt).toLocaleString()})+" ("+n+")":""}function Oe(e,t,o){return e===null?"—":o(t==="remaining"?"quotaRemaining":"quotaUsed",{pct:e})}function Ct(e){const[,t]=O(0),o=()=>t(Date.now());return V(()=>{if(!e)return;const n=setInterval(o,6e4);return()=>clearInterval(n)},[e]),{onMouseEnter:o,onFocus:o}}function lt(e,t,o,n,s){const l=ls(t),r=l===null?"ok":l>=100?"over":l>=80?"warn":"ok",i=we(l,o),d=t?.unlimited?"∞":s?Oe(i.label,o,n):i.label===null?"—":i.label+"%";return{level:r,pct:l,text:d,label:i.label,row:a("div",{key:e,className:"cm-mm-row"+(r==="ok"?"":" "+r)},a("span",{className:"cm-bbox-label"},e),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:i.width+"%"}})),a("span",{className:"cm-bbox-pct cm-num"},d))}}function oa(e){const{five:t,seven:o,fetchedAt:n,t:s,wide:l,refresh:r,direction:i="used"}=e,d=Ct(t?.resetsAt),c=bn(t?.resetsAt,s),u=lt(s("codingPlanRemain5h"),t,i,s),b=lt(s("codingPlanRemain7d"),o,i,s),g=u.level==="over"||b.level==="over"?"over":u.level==="warn"||b.level==="warn"?"warn":"ok",f=(C,N,y)=>{const p=N?.unlimited?s("quotaUnlimited"):Oe(y.label,i,s),k=st(N,s);return C+" "+p+(k?" · "+k:"")},m=[s("codingPlanMinimaxTitle"),f(s("codingPlanRemain5h"),t,u),f(s("codingPlanRemain7d"),o,b),n>0?s("goQuotaFetchedAt",{time:new Date(n).toLocaleTimeString()}):null,...r?Pe(s,r):[]].filter(Boolean).join(`
4
+ `),x=a(E,null,a("div",{className:"cm-mm-title"},s("codingPlanMinimaxTitle")),u.row,b.row,c?a("div",{className:"cm-mm-reset"},"5h · "+c):null),h=a(E,null,a("div",{className:"cm-bbox-rail cm-num"},u.text),a("div",{className:"cm-bbox-rail cm-num"},b.text));return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},m),side:"right",delayMs:300},a("div",{...d,"data-cm-display":"plan","data-cm-plan":"minimax",className:"cm-bbox cm-mm"+(g==="ok"?"":" "+g)+(l===!1?" rail":"")+(r?" clickable"+(r.busy?" busy":""):""),...r?ke(r.busy,r.run):{}},l===!1?h:x))}function rs(e){const{state:t,wide:o,api:n}=e,s=t.codingPlans?.minimax,l=z(H(t.config)),r=Be(n?()=>n.refreshCodingPlan("minimax"):null);if(!s||s.status!=="ok")return null;const{five:i,seven:d}=na(s.windows);return i==null&&d==null?null:a(oa,{five:i,seven:d,fetchedAt:s.fetchedAt,t:l,wide:o,refresh:r,direction:ie(t.config,"plan")})}const is="/plugins/dsh-openai-codex/auth/status",cs={18e3:"five",604800:"weekly"};function gn(e){if(!Array.isArray(e))return null;const t=e.find(n=>n!==null&&typeof n=="object"&&n.id==="codex");if(!t||!Array.isArray(t.windows))return null;const o={};for(const n of t.windows){const s=n!==null&&typeof n=="object"?cs[Number(n.windowSeconds)]:null;if(!s||typeof n.remainingPercent!="number"||!Number.isFinite(Number(n.remainingPercent)))continue;const l=Number(n.resetAt??n.resetsAt);o[s]={percent:Math.max(0,Math.min(100,Math.round((100-Number(n.remainingPercent))*10)/10)),resetsAt:Number.isFinite(l)&&l>0?new Date(l*1e3).toISOString():""}}return o}function us(e){return e===null||typeof e!="object"||e.status!=="signed-in"?null:gn(e.usage?.rateLimits)}async function sa(e){const t=AbortSignal.timeout(8e3);let o;const n=new Promise((s,l)=>{o=()=>l(t.reason),t.addEventListener("abort",o,{once:!0})});try{return await Promise.race([Promise.resolve().then(()=>e(t)),n])}finally{t.removeEventListener("abort",o)}}async function ds(e){try{const t=await sa(o=>U.rpc?.call("/api","codex-subscription/usage",{force:e},o));return t?.ok?gn(t.value?.rateLimits):null}catch{return null}}const U={source:"auto",listeners:[]},la=(e,t=null,o=null)=>Object.assign(U,{rpc:e,readPiAi:t,readChatgptSub:o,request:null,inFlight:null,fetchedAt:0,status:"idle",windows:{},message:""});la(null);const ra=()=>{const{rpc:e,readPiAi:t,readChatgptSub:o,request:n,inFlight:s,listeners:l,...r}=U;return r},ps=e=>(U.listeners.push(e),()=>{U.listeners=U.listeners.filter(t=>t!==e)}),vt=()=>{for(const e of U.listeners)try{e()}catch{}};async function At(e=!1,t=!1,o="auto"){if(!t)return;if(U.inFlight!==null&&U.source===o)return U.inFlight;if(!e&&U.source===o&&U.fetchedAt>0&&Date.now()-U.fetchedAt<(U.status==="ok"?5:1)*6e4)return;const n={};U.request=n,U.source!==o&&Object.assign(U,{status:"idle",windows:{},fetchedAt:0,source:o}),vt();const s=Promise.resolve().then(async()=>{let l={},r="";try{if((o==="auto"||o==="subscription")&&(l=await ds(e)??{}),Object.keys(l).length===0&&(o==="auto"||o==="pi-ai"))try{const i=await sa(()=>U.readPiAi?.());i?.ok===!0&&i.value?.status==="ok"?l=i.value.windows:i?.ok===!0&&i.value?.status==="error"&&(r=i.value.message)}catch{}if(Object.keys(l).length===0&&(o==="auto"||o==="chatgpt-sub"))try{const i=await sa(()=>ve.async("./client.codex.js").then(d=>d.readChatgptSubQuota(U.readChatgptSub)));i?.status==="ok"?l=i.windows:i?.status==="error"&&(r=i.message)}catch{}if(Object.keys(l).length===0&&(o==="auto"||o==="chatgpt"))try{l=await(await ve.async("./client.codex.js")).readChatgptQuota(e)??{}}catch{}if(Object.keys(l).length===0&&(o==="auto"||o==="connect")){const i=await fetch(is,{credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(8e3)});i.ok&&(l=us(await i.json().catch(()=>null))??{})}}catch{}finally{if(U.request!==n)return;U.status=Object.keys(l).length>0?"ok":"unavailable",U.windows=l,U.message=Object.keys(l).length?"":r,U.fetchedAt=Date.now(),U.inFlight=null,vt()}});return U.inFlight=s,s}function Pt(e,t="auto"){const[o,n]=O(ra);return V(()=>{if(!e)return;let s=!0;const l=()=>{s&&n(ra())},r=ps(l);l(),At(!1,!0,t);const i=setInterval(()=>{At(!1,!0,t)},6e4);return()=>{s=!1,clearInterval(i),r()}},[e,t,U.rpc]),o.source===t?o:{status:"idle",windows:{},fetchedAt:0}}function ms(e){const t=Ct(),{state:o,wide:n}=e,s=z(H(o.config)),l=o.config?.codexQuotaEnabled===!0&&o.config?.codexQuotaSidebar!==!1,r=o.config?.codexQuotaSource??"auto",i=Pt(l&&!e.preview,r),d=e.preview?o.displayPreviewCodex??(U.source===r?U:{status:"idle"}):i,c=Be(e.preview?null:l?()=>At(!0,l,r):()=>e.api.updateConfig({codexQuotaEnabled:!0,codexQuotaSidebar:!0}));if(!l&&(o.config?.codexQuotaSidebar===!1||o.codexCompat?.enabled!==!0))return null;if(!l)return a("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(n===!1?" rail":""),...ke(c.busy,c.run)},c.err||(n===!1?"Codex":s("codexQuotaEnable")));if(d.status!=="ok")return a("div",{"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(n===!1?" rail":""),title:d.message||s("codexQuotaUnavailable"),...ke(c.busy,c.run)},a("div",{className:"cm-mm-title"},n===!1?"Codex":s("codexQuotaTitle")),a("span",{className:"cm-hint"},n===!1?"—":d.status==="idle"||c.busy?s("refreshing"):d.message||s("codexQuotaUnavailable")));const u=[["five","codexQuotaFive","5h"],["weekly","codexQuotaWeek","7d"]].flatMap(([x,h,C])=>{const N=d.windows[x];if(!N)return[];const y=lt(C,N,"remaining",s,!0),p=new Date(typeof N.resetsAt=="string"?N.resetsAt:NaN),k=Number.isFinite(p.getTime())?s("codexQuotaReset",{time:p.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1})}):"";return[{...y,key:x,short:C,name:s(h),reset:k,win:N}]});if(!u.length)return null;const b=u.some(x=>x.pct>=100)?"over":u.some(x=>x.pct>=80)?"warn":"ok",g=[s("codexQuotaTitle"),...u.map(x=>x.name+" · "+x.text+(x.reset?" · "+st(x.win,s):"")),d.fetchedAt>0?s("goQuotaFetchedAt",{time:new Date(d.fetchedAt).toLocaleTimeString()}):null,...Pe(s,c)].filter(Boolean).join(`
5
+ `),f=a(E,null,a("div",{className:"cm-bbox-head cm-codex-head"},a("div",{className:"cm-mm-title"},s("codexQuotaTitle")),a("div",{className:"cm-codex-resets"},...u.filter(x=>x.reset).map(x=>a("span",{key:x.key,className:"cm-mm-reset"},(u.length>1?x.short+" · ":"")+x.reset)))),...u.map(x=>x.row)),m=a(E,null,...u.map(x=>a("div",{className:"cm-bbox-rail cm-num"},x.text)));return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},g),side:"right",delayMs:300},a("div",{...t,"data-cm-display":"codex",className:"cm-bbox cm-mm clickable"+(b==="ok"?"":" "+b)+(n===!1?" rail":"")+(c.busy?" busy":""),...ke(c.busy,c.run)},n===!1?m:f))}function We(e,t){return e.startsWith("core_")?"Core · "+We(e.slice(5),t):e==="fiveHour"||e==="5h"?"5h":e==="weekly"||e==="week"||e==="7d"?e==="7d"?"7d":t("goShortWeekly"):e==="monthly"||e==="month"?t("goShortMonthly"):e==="daily"||e==="day"?t("goShortDaily"):e==="plan"?t("mimoWindowPlan"):e==="compensation"?t("mimoWindowCompensation"):e==="balance"?t("codingPlanWindowBalance"):String(e).replace(/_/g," ")}function Mt(e,t){const o=n=>{const s=n.replace(/^core_/,"").toLowerCase().replace(/[^a-z0-9]/g,"");return/^(fivehour|five|5h|rolling|session)$/.test(s)?0:/^(daily|day|1d)$/.test(s)?1:/^(weekly|week|7d|sevenday)$/.test(s)?2:/^(monthly|month|30d)$/.test(s)?3:4};return Object.entries(e??{}).filter(([n])=>t!=="volcengine"||[0,2,3].includes(o(n))).sort((n,s)=>o(n[0])-o(s[0]))}function fs(e){const t=Ct(),{id:o,state:n,wide:s,api:l}=e,r=n.codingPlans?.[o],i=z(H(n.config)),d=Be(l?()=>l.refreshCodingPlan(o):null),c=De.find(k=>k.id===o);if(!c||!r||r.status!=="ok")return null;const u=r.windows!==null&&typeof r.windows=="object"?r.windows:{},b=Mt(u,o);if(b.length===0)return null;const g=k=>k!==null&&typeof k=="object"&&typeof k.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(k.percent)||0))):null,f=ie(n.config,"plan"),m=(o==="workbuddy"||o==="opendesign")&&u.balance?.text?i("codingPlanWindowBalance")+": "+u.balance.text:null,x=(m?b.filter(([k])=>k!=="balance"):b).map(([k,w])=>{const v=g(w);if(v===null)return a("div",{key:k,className:"cm-mm-row wide"},a("span",{className:"cm-mm-text"},typeof w?.text=="string"?w.text:"—"));const R=v>=100?"over":v>=80?"warn":"ok",j=we(v,f);return a("div",{key:k,className:"cm-mm-row wide"+(R==="ok"?"":" "+R)},a("span",{className:"cm-bbox-label"},We(k,i)),a("div",{className:"cm-bbox-bar"},a("div",{className:"cm-bbox-fill",style:{width:j.width+"%"}})),a("span",{className:"cm-bbox-pct cm-num"},j.label===null?"—":j.label+"%"))}),h=b.map(([k,w])=>{const v=g(w),R=st(w,i),j=v===null?typeof w?.text=="string"?w.text:"—":Oe(we(v,f).label,f,i);return We(k,i)+" "+j+(R?" · "+R:"")});r.fetchedAt>0&&h.push(i("goQuotaFetchedAt",{time:new Date(r.fetchedAt).toLocaleTimeString()})),r.message&&h.push(r.message),h.push(...Pe(i,d));const C=[i(c.labelKey),...h].join(`
6
+ `),N=b.map(([,k])=>g(k)).filter(k=>k!==null),y=N.some(k=>k>=100)?"over":N.some(k=>k>=80)?"warn":"ok",p=N.length>0?N.slice(0,2).map(k=>we(k,f).label+"%").join(" "):typeof b[0][1]?.text=="string"?b[0][1].text:"—";return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},C),side:"right",delayMs:300},a("div",{...t,"data-cm-display":"plan","data-cm-plan":o,className:"cm-bbox cm-mm clickable"+(y==="ok"?"":" "+y)+(s===!1?" rail":"")+(d.busy?" busy":""),...ke(d.busy,d.run)},s===!1?a("div",{className:"cm-bbox-rail cm-num"},p):a(E,null,a("div",{className:m?"cm-mm-title cm-mm-row wide":"cm-mm-title"},i(c.labelKey),m&&a("span",{className:"cm-mm-text"},m)),...x)))}const yn=e=>{try{return window.localStorage?.getItem?.("cm.gw."+e)??""}catch{return""}},bs=(e,t)=>{try{window.localStorage?.setItem?.("cm.gw."+e,t)}catch{}};function gs(e){const t=Ct(),{source:o,snapshot:n,state:s,wide:l,api:r}=e,i=z(H(s.config)),[d,c]=O(()=>({source:o.id,id:yn(o.id)})),u=Be(r?()=>r.refreshGatewayQuota(o.id):null),b=ie(s.config,"plan"),g=n.accounts.length>1,f=d.source===o.id?d.id:yn(o.id),m=n.accounts.findIndex(T=>T.id===f),x=m>=0?m:Math.max(0,n.accounts.findIndex(T=>T.windows.length>0||T.credits!=null)),h=n.accounts[x]??n.accounts[0],C=h?.label||h?.id||"",N=T=>g?(La[T.provider]??T.provider)+" · ":"",y=g&&h?[h]:n.accounts,p=[];for(const T of y){if(p.length>=4)break;for(const le of T.windows){if(p.length>=4)break;const Le=N(T)+(le.label||le.id||i("gatewaySourceUnknown"));p.push({win:le,name:Le,view:lt(Le,le,b,i)})}T.windows.length===0&&T.credits!=null&&p.push({win:null,name:N(T)+(T.credits.unit||"credits"),text:(T.credits.used??"—")+" / "+(T.credits.limit??"—")})}p.length===0&&p.push({name:i("gatewayQuotaEmpty"),text:"—"});const k=p.some(T=>T.view?.level==="over")?"over":p.some(T=>T.view?.level==="warn")?"warn":"ok",w=p.map(T=>{if(T.text!=null)return T.name+" "+T.text;const le=st(T.win,i);return T.name+" "+Oe(T.view.label,b,i)+(le?" · "+le:"")});n.fetchedAt>0&&w.push(i("goQuotaFetchedAt",{time:new Date(n.fetchedAt).toLocaleTimeString()})),w.push(...Pe(i,u));const R=[g&&C?`${o.label||o.id} (${x+1}/${n.accounts.length} · ${C})`:o.label||o.id,...w].join(`
7
+ `),j=p.map((T,le)=>T.text!=null?a("div",{key:le,className:"cm-mm-row wide"},a("span",{className:"cm-bbox-label"},T.name),a("span",{className:"cm-mm-text cm-num"},T.text)):a(E,{key:le},T.view.row)),A=T=>{if(!T.key||T.key==="Enter"||T.key===" "){T.stopPropagation(),T.preventDefault?.();const le=n.accounts[(x+1)%n.accounts.length];bs(o.id,le.id),c({source:o.id,id:le.id})}},B=g?a("span",{className:"cm-gw-switcher","aria-label":i("gatewaySwitchAccount",{account:C||x+1}),onClick:A,onKeyDown:A,role:"button",tabIndex:0},`${x+1}/${n.accounts.length} ⇄`):null,F=g?a("div",{className:"cm-bbox-head"},a("div",{className:"cm-mm-title"},o.label||o.id),B):a("div",{className:"cm-mm-title"},o.label||o.id),G=g&&C?a("div",{className:"cm-gw-sub"},C):null,ae=a(E,null,F,G,...j),K=p.filter(T=>T.view).map(T=>T.view.label).filter(T=>T!==null),$=K.length>0?K.slice(0,2).map(T=>T+"%").join(" "):p[0].text??"—",M=a("div",{className:"cm-bbox-rail cm-num"},$);return a(J,{portal:!0,label:a("span",{style:{whiteSpace:"pre-line"}},R),side:"right",delayMs:300},a("div",{...t,"data-cm-display":"gateway","data-cm-source":o.id,className:"cm-bbox cm-mm clickable"+(k==="ok"?"":" "+k)+(l===!1?" rail":"")+(u.busy?" busy":""),...ke(u.busy,u.run)},l===!1?a(E,null,M,B):ae))}function ys(e,t,o,n){const s=Array.isArray(e.gatewayQuotas)?e.gatewayQuotas:[],l=[];for(const r of t.gatewayQuotas?.sources??[]){if(r.enabled===!1||r.display!=="sidebar"&&r.display!=="both")continue;const i=s.find(d=>d.id===r.id);!i||i.status!=="ok"&&i.status!=="partial"&&i.status!=="stale"||i.accounts.length===0||l.push(a(gs,{key:"gateway:"+r.id,source:r,snapshot:i,state:e,wide:o,api:n}))}return l}const hs={anthropic:"Claude",zai:"Z.ai",minimax:"MM",kimi:"Kimi",openrouter:"OR",siliconflow:"SF",commandcode:"CC",clinepass:"CP",scnet:"SCNet",volcengine:"Ark",qwen:"Qwen",mimo:"MiMo",factory:"Factory",opendesign:"OpenDesign"};function hn(e,t,o){return e?.enabled!==!0?!1:typeof e.showInComposer=="boolean"?e.showInComposer:e.display!=="off"&&t?.enabled===!0&&t[o]!==!1}function ia(e,t,o){const n=e?.display??"settings";return(typeof e?.showInComposer=="boolean"?e.showInComposer:n!=="off"&&t?.enabled===!0&&t[o]!==!1)?{off:"composer",both:"all"}[n]??n+"-composer":n}function ca(e){const t={composer:"off","sidebar-composer":"sidebar","settings-composer":"settings",all:"both"}[e];return{display:t??e,showInComposer:t!==void 0}}function ua(e){return[["sidebar","balanceSidebar"],["settings","balanceSettings"],["both","quotaSidebarSettings"],["composer","quotaComposer"],["sidebar-composer","quotaSidebarComposer"],["settings-composer","quotaSettingsComposer"],["all","quotaAllPositions"],["off","off"]].map(([t,o])=>a("option",{key:t,value:t},e(o)))}function ks(e){const t=e.useCost?e.useCost(N=>N):void 0,o=t?.state?.config;Pt(o?.codexQuotaEnabled===!0&&o.codexQuotaStrip!==!1&&o.quotaStrip?.enabled===!0,o?.codexQuotaSource);const[n,s]=O(null),[l,r]=O({}),i=t?.state,d=e.api;if(!i)return null;const c=i.config,u=c.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};if(u.enabled!==!0&&c.goQuota?.showInComposer!==!0&&!Object.values(c.codingPlans??{}).some(N=>N.enabled===!0&&N.showInComposer===!0))return null;const b=z(H(c)),g=[];if(u.enabled===!0&&u.budget!==!1){const N=c.budget??{enabled:!1,amount:100,period:"month"};if(N.enabled===!0){const y=Number(c.exchangeRate),k=(i.budgetUsed??(N.period==="day"?Q(i.today,c):N.period==="all"?Q(i.total,c):Q(i.month,c)))*(Number.isFinite(y)&&y>0?y:1),w=Math.max(0,Number(N.amount)||0);if(w>0){const v=Math.min(999,k/w*100),R=v>=100?"over":v>=80?"warn":"ok";g.push({key:"budget",label:b("budgetShort"),level:R,tip:b("budgetOf",{period:b(Ye[N.period]??"periodMonth")})+" · "+b("usedOf",{used:de(k,c),amount:de(w,c)})+" · "+v.toFixed(1)+"%",segs:[{name:"main",pct:Math.round(we(Math.min(100,v),ie(c,"budget")).width)}]})}}}if(hn(c.goQuota,u,"go")){const N=i.goQuota;if(c?.goQuota?.enabled!==!1&&N?.status==="ok"){const y=c.goQuota.main==="weekly"||c.goQuota.main==="monthly"?c.goQuota.main:"rolling",p=y==="rolling"?N.rolling:y==="weekly"?N.weekly:N.monthly;if(p!==null&&typeof p=="object"&&typeof p.percent=="number"){const k=Math.max(0,Math.min(100,Math.round(Number(p.percent)||0))),w=k>=100?"over":k>=80?"warn":"ok",v=typeof p.resetsAt=="string"&&p.resetsAt.length>0?" · "+b("goResetAt",{time:new Date(p.resetsAt).toLocaleString()}):"";g.push({key:"go",label:"Go "+b(y==="rolling"?"goShortRolling":y==="weekly"?"goShortWeekly":"goShortMonthly"),level:w,tip:fn(N,c,b),segs:[{name:"main",pct:Math.round(we(k,ie(c,"go")).width)}]})}}}for(const N of De){const y=i.codingPlans?.[N.id];if(!hn(c.codingPlans?.[N.id],u,"plans")||!y||y.status!=="ok")continue;const p=y.windows!==null&&typeof y.windows=="object"?y.windows:{},k=Mt(p,N.id),w=N.id==="factory"?[k.filter(([v])=>!v.startsWith("core_")),k.filter(([v])=>v.startsWith("core_"))]:[k];for(const[v,R]of w.entries()){if(R.length===0)continue;const j=hs[N.id]??N.id,A=[],B=[];y.message&&B.push(y.message);let F=0,G=0;for(const[ae,K]of R){const $=We(ae,b),M=typeof K?.resetsAt=="string"&&K.resetsAt.length>0?" · "+b("goResetAt",{time:new Date(K.resetsAt).toLocaleString()}):"",T=K!==null&&typeof K=="object"&&typeof K.percent=="number"?Math.max(0,Math.min(100,Math.round(Number(K.percent)||0))):null;if(B.push($+" "+(T===null?typeof K?.text=="string"?K.text:"—":T+"%")+M),T===null){A.push({name:ae,pct:null,text:typeof K?.text=="string"?K.text:"—"});continue}G>=(N.id==="factory"?3:2)||(G+=1,A.push({name:ae,pct:Math.round(we(T,ie(c,"plan")).width)}),F=Math.max(F,T>=100?2:T>=80?1:0))}y.fetchedAt>0&&B.push(b("goQuotaFetchedAt",{time:new Date(y.fetchedAt).toLocaleTimeString()})),A.length!==0&&g.push({key:N.id+(v?":core":""),label:j+(N.id==="factory"?v?" Core":" Standard":""),level:["ok","warn","over"][F],tip:B.join("; "),segs:A})}}const f=u.enabled===!0&&c.codexQuotaEnabled===!0&&c.codexQuotaStrip!==!1&&U.source===(c.codexQuotaSource??"auto")&&U.status==="ok"?U.windows:{},m=f.five??null,x=f.weekly??null,h=N=>Math.max(0,Math.min(100,Math.round(Number(N.percent)||0)));if(m!==null||x!==null){const N=m===null?null:h(m),y=x===null?null:h(x),p=Math.max(N??0,y??0);g.push({key:"codex",label:"Codex",level:p>=100?"over":p>=80?"warn":"ok",tip:b("codexQuotaTitle")+": "+[N===null?null:"5h "+Oe(100-N,"remaining",b),y===null?null:b("codingPlanRemain7d")+" "+Oe(100-y,"remaining",b)].filter(Boolean).join(" · "),segs:[N===null?null:{name:"5h",pct:100-N},y===null?null:{name:"weekly",pct:100-y}].filter(Boolean)})}if(g.length===0)return null;const C=N=>{n!==null||!d||(s(N),r(y=>({...y,[N]:null})),Promise.resolve().then(()=>N==="budget"?d.reload():N==="go"?d.refreshGoQuota():N==="codex"?At(!0,c.codexQuotaEnabled===!0,c.codexQuotaSource):N==="factory:core"?d.refreshCodingPlan("factory"):d.refreshCodingPlan(N)).catch(y=>{r(p=>({...p,[N]:y?.message??String(y)}))}).finally(()=>s(null)))};return a("div",{className:"cm-qstrip"},g.map(N=>{const y=n===N.key,p=l[N.key],k=[a("span",{className:"cm-qlabel",key:"l"},N.label)];y?k.push(a("span",{className:"cm-qtext",key:"busy"},b("refreshing"))):N.segs.forEach((v,R)=>{R>0&&k.push(a("span",{className:"cm-qsep",key:"sep"+R,"aria-hidden":"true"})),v.pct===null?k.push(a("span",{className:"cm-qtext",key:v.name},v.text)):k.push(a("span",{className:"cm-qseg",key:v.name},a("span",{className:"cm-qbar"},a("span",{className:"cm-qfill",style:{width:v.pct+"%"}})),a("span",null,N.key==="codex"?(N.segs.length>1?(v.name==="5h"?"5h":b("goShortWeekly"))+" ":"")+Oe(v.pct,"remaining",b):v.pct+"%")))});const w=[N.tip];return!y&&d&&w.push(b("clickToRefresh")),y&&w.push(b("refreshing")),p&&w.push("⚠ "+b("balanceRefreshFailed",{message:p})),a(J,{portal:!0,key:N.key,label:w.join("; "),side:"bottom",delayMs:400},a("span",{className:"cm-qchip"+(d?" action":"")+(N.level==="ok"?"":" "+N.level),...d?ke(y,()=>C(N.key)):{}},k))}))}const rt="dsh-cost-meter:simple-guide-dismissed";function da(e){if(e?.sidebarSimplePromptSeen===!0)return!0;try{return window.localStorage.getItem(rt)==="1"}catch{return!1}}function xs(e){const t=e.useCost?e.useCost(m=>m):void 0,o=fe(!1),[n,s]=O(!1),[l,r]=O(!1),[i,d]=O(!1),c=t?.state?.config,u=!!c&&!i&&!da(c);if(V(()=>{const m=()=>d(!0);return window.addEventListener?.(rt,m),()=>window.removeEventListener?.(rt,m)},[]),!u)return null;const b=z(H(c)),g=()=>{d(!0);try{window.localStorage.setItem(rt,"1")}catch{}window.dispatchEvent?.(new Event(rt))},f=async m=>{if(!o.current){o.current=!0,s(!0),r(!1);try{if((await e.api.updateConfig({sidebarSimple:m,sidebarSimplePromptSeen:!0}))?.config?.sidebarSimple!==m)throw new Error;g()}catch{r(!0)}finally{o.current=!1,s(!1)}}};return a(dn,{actions:{close:g,keep:()=>f(!1),enable:()=>f(!0)},className:"cm-qguide",role:"dialog","aria-label":b("sidebarSimpleTitle"),"aria-busy":n,onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),g())}},a("div",{className:"cm-bbox-head"},a("h4",null,b("sidebarSimpleTitle")),a("button",{type:"button",className:"cm-btn small","aria-label":b("closeGuide"),"data-cm-action":"close",onClick:g},"×")),a("p",null,b("sidebarSimpleBody")),l?a("p",{role:"alert"},b("sidebarSimpleError")):null,a("div",{className:"cm-buttons"},a("button",{type:"button",className:"cm-btn small","data-cm-action":"keep",disabled:n,onClick:()=>f(!1)},b("sidebarSimpleOff")),a("button",{type:"button",className:"cm-btn small primary","data-cm-action":"enable",disabled:n,onClick:()=>f(!0)},b("sidebarSimpleOn"))))}function ws(e){const t=e.useCost?e.useCost(i=>i):void 0,o=fe(!1),n=t?.state;if(!n)return null;const s=n.config;if(!da(s)||s.quotaStrip?.promptSeen===!0)return null;const l=z(H(s)),r=i=>{if(o.current===!0)return;o.current=!0;const d=s.quotaStrip??{enabled:!1,budget:!0,go:!0,plans:!0};e.api.updateConfig({quotaStrip:{...d,enabled:i,promptSeen:!0}}).catch(()=>{o.current=!1})};return a("div",{className:"cm-qguide",role:"dialog","aria-label":l("quotaStripGuideTitle")},a("h4",null,l("quotaStripGuideTitle")),a("p",null,l("quotaStripGuideBody")),a("div",{className:"cm-buttons"},a("button",{type:"button",className:"cm-btn small",onClick:()=>r(!1)},l("quotaStripGuideOff")),a("button",{type:"button",className:"cm-btn small primary",onClick:()=>r(!0)},l("quotaStripGuideOn"))))}const kn="dsh-cost-meter:balance-click-hint-seen",Ns=()=>{try{return window.localStorage.getItem(kn)==="1"}catch{return!1}},Ss=()=>{try{window.localStorage.setItem(kn,"1")}catch{}};function Cs(e){const t=e.useCost?e.useCost(f=>f):void 0,o=fe(!1),[n,s]=O(!1),[l]=O(Ns),r=t?.state;if(!r)return null;const i=r.config,d=i.balance?.display==="sidebar"||i.balance?.display==="both",c=(i?.customBalances??[]).some(f=>f?.enabled===!0&&(f.display==="sidebar"||f.display==="both"))||i.customBalance?.enabled===!0&&(i.customBalance?.display==="sidebar"||i.customBalance?.display==="both"),u=De.some(f=>{const m=i.codingPlans?.[f.id];return m?.enabled===!0&&(m.display==="sidebar"||m.display==="both")});if(n||l||i.balance?.clickHintSeen===!0||!d&&!c&&!u||!da(i)||i.quotaStrip?.promptSeen!==!0)return null;const b=z(H(i)),g=()=>{o.current!==!0&&(s(!0),o.current=!0,Ss(),e.api.updateConfig({balance:{...i.balance??{},clickHintSeen:!0}}).catch(()=>{o.current=!1,s(!1)}))};return a("div",{className:"cm-qguide",role:"dialog","aria-label":b("balanceClickGuideTitle")},a("h4",null,b("balanceClickGuideTitle")),a("p",null,b("balanceClickGuideBody")),a("div",{className:"cm-buttons"},a("button",{type:"button",className:"cm-btn small primary",onClick:g},b("balanceClickGuideOk"))))}function xn(e,t,o){const n=t.sidebarTodayMetric??"cost";return a("span",{className:"cm-today-values","data-both":n==="both"},n!=="tokens"?a("span",{"data-cm-today":"cost"},W(Q(e,t),t)):null,n!=="cost"?a("span",{"data-cm-today":"tokens"},L(["input","output","cacheRead","cacheWrite"].reduce((s,l)=>s+(Number(e?.[l])||0),0))+" "+o("tokensUnit")):null)}function Tt(e){const{state:t,wide:o}=e,n=t.today,s=t.config,l=z(H(s)),r=xn(n,s,l),i=s.budget??{enabled:!1,amount:100,period:"month"},d=Number(s.exchangeRate),u=(t.budgetUsed??(i.period==="day"?Q(t.today,s):i.period==="all"?Q(t.total,s):Q(t.month,s)))*(Number.isFinite(d)&&d>0?d:1),b=Math.max(0,Number(i.amount)||0),g=b>0?Math.min(999,u/b*100):null,f=g===null?"ok":g>=100?"over":g>=80?"warn":"ok";if(i.enabled===!0&&s.hideBudget!==!0&&e.todayOnly!==!0){const x=[l("budgetOf",{period:l(Ye[i.period]??"periodMonth")}),l("usedOf",{used:de(u,s),amount:de(b,s)})+" · "+(g===null?"—":g.toFixed(1)+"%"),l("monthTotal",{month:W(Q(t.month,s),s),total:W(Q(t.total,s),s)})].join("; ");if(e.summary===!0)return a(J,{portal:!0,label:x,side:"right",delayMs:300},a("div",{"data-cm-display":"budget",className:"cm-simple-summary"+(f==="ok"?"":" "+f),tabIndex:0},a("span",null,l("budgetOf",{period:l(Ye[i.period]??"periodMonth")})),a("span",{className:"cm-num"},de(u,s)+" / "+de(b,s))));const h=ns(t,s,l);return a(J,{portal:!0,label:x,side:"right",delayMs:300},a("div",{"data-cm-display":"budget",className:"cm-bbox"+(f==="ok"?"":" "+f)+(o?"":" rail")},o?h.body:a("div",{className:"cm-bbox-rail cm-num"},h.rail)))}const m=[s.sidebarTodayMetric==="tokens"?l("todayTokensTitle"):l("todayCostTitle"),l("callsTokens",{calls:n.calls,input:L(n.input),cache:L(n.cacheRead+n.cacheWrite),output:L(n.output)}),l("monthCost",{amount:W(Q(t.month,s),s)}),l("totalCost",{amount:W(Q(t.total,s),s)})].join("; ");return a(J,{portal:!0,label:m,side:"right",delayMs:300},a("div",{"data-cm-display":"today",className:"cm-foot"+(o?"":" cm-foot-rail")},o?a(E,null,a("span",null,l("today")),a("span",{className:"cm-num cm-bal-amt"},r)):a(Nt,{size:16})))}function vs(e){const t=e.useCost?e.useCost(l=>l):void 0;Pt(t?.state?.config?.codexQuotaEnabled===!0&&t?.state?.config?.codexQuotaSidebar!==!1,t?.state?.config?.codexQuotaSource);let o;if(e.useProjection)try{o=e.useProjection("costUsage")}catch{o=void 0}Za(e,o);const n=t?.state,s=n?{...n,config:aa(n,o?.provider)}:null;return s?Rt(s,!!e.wide,e.api):null}function Rt(e,t,o,n=!1){const s=aa(e),l=z(H(s)),r=(s.balance?.display==="sidebar"||s.balance?.display==="both")&&s.hideOfficialBalance!==!0,d=St(e,s).length>0,c=r&&s.balance?.showProgressBar===!0&&e.balance?.status==="ok",u=d&&s.balance?.showProgressBar===!0,b=s.goQuota?.main==="weekly"||s.goQuota?.main==="monthly"?s.goQuota.main:"rolling",g=s.goQuota?.enabled!==!1&&(s.goQuota?.display==="sidebar"||s.goQuota?.display==="both")&&e.goQuota?.status==="ok"&&e.goQuota?.[b]!==null,f=De.map(A=>A.id).filter(A=>{const B=s.codingPlans?.[A];if(B?.enabled!==!0||B.display!=="sidebar"&&B.display!=="both")return!1;const F=e.codingPlans?.[A];if(F?.status!=="ok")return!1;const G=F.windows!==null&&typeof F.windows=="object"?F.windows:{};return Object.keys(G).length>0}),m=f.length>0,x=ys(e,s,t,o),h=s.codexQuotaSidebar!==!1&&(s.codexQuotaEnabled===!0||e.codexCompat?.enabled===!0),C=(s.budget??{}).enabled===!0&&s.hideBudget!==!0,N=s.sidebar!==!1&&s.hideTodayCost!==!0,y=_e(s,Date.now())!==null,p=s.sidebarModels?.enabled===!0;if(!p&&!r&&!d&&!g&&!m&&!h&&!C&&!N&&!y&&x.length===0)return null;const k=s.sidebarSimple===!0,w=!k&&t&&s.sidebarStyle==="compact",v=[];k&&t&&N&&!s.sidebarTodayBalanceInline&&v.push(a("div",{key:"today","data-cm-display":"today",className:"cm-simple-summary"},a("span",null,l("today")),a("span",{className:"cm-num"},xn(e.today,s,l)))),c?v.push(a(Fo,{key:"balance",state:e,wide:t,api:o})):r&&v.push(a(Uo,{key:"balance",state:e,wide:t,api:o})),u?v.push(a(Wo,{key:"customBalance",state:e,wide:t,api:o})):d&&v.push(a(Ko,{key:"customBalance",state:e,wide:t,api:o}));const R=v.length;m&&v.push(...f.map(A=>A==="minimax"?a(rs,{key:"plan:"+A,state:e,wide:t,api:o}):a(fs,{key:"plan:"+A,id:A,state:e,wide:t,api:o}))),v.push(...x),h&&v.push(a(ms,{key:"codex",state:e,wide:t,api:o,preview:n})),g&&v.push(a(ss,{key:"go",state:e,wide:t})),C&&v.push(a(Tt,{key:"budget",state:e,wide:t,summary:k&&t})),N&&(!(k&&t)||s.sidebarTodayBalanceInline)&&v.push(a(Tt,{key:"today",state:e,wide:t,todayOnly:!0})),y&&v.push(a(E,{key:"peak"},t?mn(e,s.sidebarStyle==="summary"&&!s.sidebarSimple?{...s,peakProgressVariant:"summary"}:s,l):as(e,s,l))),p&&v.splice(s.sidebarModels.position==="first"?0:s.sidebarModels.position==="afterBalance"?R:v.length,0,a(As,{key:"models",state:e,wide:t,preview:n}));const j=s.sidebarOrder?.length?s.sidebarOrder:s.sidebarStyle==="summary"&&!k?["today","balance","peak"]:[];if(j.length){const A=B=>{const F=j.indexOf(B.key);return F<0?999:F};v.sort((B,F)=>A(B)-A(F))}return a("div",{...k?{tabIndex:0,role:"region","aria-label":l("sidebarSimple")}:{},className:"cm-footer-stack"+(s.sidebarTodayBalanceInline?" same-line":"")+(t?"":" rail")+(w?" compact":"")+(k?" simple":s.sidebarStyle==="summary"&&t?" summary":"")},...v)}const wn={enabled:!1,period:"today",topN:5,summary:"total",position:"last",defaultOpen:!1,remember:!0,tokens:!1,shares:!0,refreshSeconds:60,dock:!1},Nn="dsh-cost-meter:models-open";function Sn(e,t,o){return Pn(e,e.config,o,t).map(n=>({...n,label:e.modelLabels?.[n.key]??(n.key==="deepseek:legacy"?n.label:ut(n.key)),cost:Q(n,e.config)})).sort((n,s)=>s.cost-n.cost||s.tokens-n.tokens||n.key.localeCompare(s.key))}function As({state:e,wide:t,preview:o=!1}){const n={...wn,...e.config.sidebarModels},s=z(H(e.config)),l=()=>{try{const y=n.remember?window.localStorage.getItem(Nn):null;if(y!==null)return y==="1"}catch{}return n.defaultOpen},[r,i]=O(l),[d,c]=O(n.period);V(()=>c(n.period),[n.period]);const u=fe(n.defaultOpen);V(()=>{i(o&&u.current!==n.defaultOpen?n.defaultOpen:l()),u.current=n.defaultOpen},[n.defaultOpen,n.remember]);const b=Sn(e,d,s),g=b.reduce((y,p)=>y+p.cost,0),f=y=>W(y,e.config),m=s(d==="history"?"modelStatsHistory":"modelStatsToday")+" "+f(g)+" · "+s("modelsCount",{n:b.length}),x=n.summary==="top"&&b.length?b[0].label+" "+f(b[0].cost):m,h=a(E,null,a("span",{className:"cm-bal-label"},n.summary==="top"&&b.length?b[0].label:s(d==="history"?"modelStatsHistory":"modelStatsToday")),a("span",{className:"cm-bal-amt cm-num"},n.summary==="top"&&b.length?f(b[0].cost):f(g)+" · "+s("modelsCount",{n:b.length}))),C=()=>{i(!r);try{n.remember&&!o&&window.localStorage.setItem(Nn,r?"0":"1")}catch{}};if(!t||e.config.sidebarSimple)return a("div",{"data-cm-display":"models",className:"cm-foot cm-num"+(t?"":" cm-foot-rail"),title:x+" · "+m},t?h:a(Nt,{size:16}));const N=b.slice(0,n.topN);return b.length>n.topN&&N.push(b.slice(n.topN).reduce((y,p)=>{for(const k of["cost","input","output","cacheRead","cacheWrite"])y[k]+=p[k];return y},{key:"other",label:s("modelsOther"),cost:0,input:0,output:0,cacheRead:0,cacheWrite:0})),a("div",{"data-cm-display":"models",className:"cm-bbox cm-model-costs"},a("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(r),title:m,onClick:C},a("span",{className:"cm-caret"+(r?" open":"")}),h),r?a(E,null,a("div",{className:"cm-buttons"},["today","history"].map(y=>a("button",{key:y,type:"button",className:"cm-mstats-tab"+(d===y?" active":""),"aria-pressed":d===y,onClick:()=>c(y)},s(y==="today"?"modelStatsToday":"modelStatsHistory")))),N.length?N.map(y=>a("div",{key:y.key},a("div",{className:"cm-bbox-head"},a("span",{className:"cm-bal-label",title:y.label},y.label),a("span",{className:"cm-num cm-bal-amt"},f(y.cost))),n.shares?a("div",{className:"cm-bbox-bar",title:(g>0?y.cost/g*100:0).toFixed(1)+"%"},a("div",{className:"cm-bbox-fill",style:{width:(g>0?y.cost/g*100:0)+"%"}})):null,n.tokens?a("div",{className:"cm-mstats-note"},s("modelStatsInput")+" "+L(y.input)+" · "+s("modelStatsCache")+" "+L(y.cacheRead+y.cacheWrite)+" · "+s("modelStatsOutput")+" "+L(y.output)):null)):a("span",{className:"cm-note"},s("modelStatsEmpty"))):null)}function it(e){return a("div",{className:"cm-card"},a("p",{className:"cm-card-title"},e.title),a("div",{className:"cm-card-value cm-num"},e.value),a("p",{className:"cm-card-sub"},e.sub))}const pa=new WeakMap,ma=(e,t)=>e?.().then(o=>(pa.set(e,o),o.prefetch?.(t))).catch(()=>{});function Cn({state:e}){const t=e?.billionContext;return!t||!(t.unresolved>0||["needs_update","changed","bridge_missing"].includes(t.compatibility))?null:a("p",{className:"cm-note","data-billing-accuracy":"billion-context"},H(e.config)==="en"?"Some billion-context usage records are incomplete; cost totals may differ from the provider bill.":"billion-context 部分用量记录不完整,费用统计可能存在偏差。")}function be(e){const t=e.load??e.api.loadStatistics,[o,n]=O(()=>pa.get(t)??null),[s,l]=O(""),[r,i]=O(0);return V(()=>{let d=!0;if(l(""),typeof t=="function")return t().then(c=>{pa.set(t,c),d&&n(()=>c)},c=>{d&&l(String(c.message??c))}),()=>{d=!1}},[e.api,e.load,r]),o?a(o,{...e,formatMoneyUsd:W,formatTokens:L,resolveLocale:H}):e.quiet?null:a("div",{className:s?"":"cm-loading",role:s?"alert":"status","aria-label":H(e.state?.config)==="en"?"Loading":"正在读取"},s||a(E,null,a("i"),a("i"),a("i")),s?a("button",{className:"cm-btn",onClick:()=>i(d=>d+1)},"↻"):null)}const Ps="cm-stat-dialog";function Ms(e){const t=e.useCost?.(u=>u),o=t?.state,[n,s]=O(null),l=Ae.useRef(null),r=o?.config[e.entryPosition==="header"?"hideSessionCostHeader":"hideSessionCostDock"]===!0,i=!r&&!!e.sessionId&&n===e.sessionId;if(V(()=>{i&&l.current?.showModal()},[i]),V(()=>{s(null)},[e.sessionId,r]),!e.sessionId||r)return null;const d=H(o?.config)==="en",c=d?"Conversation cost details":"本会话费用明细";return a(E,null,a("button",{type:"button",className:"cm-btn cm-stat-entry cm-stat-"+(e.entryPosition||"dock"),title:c,"aria-label":c,"aria-haspopup":"dialog",onMouseEnter:()=>ma(e.api.loadStatistics,{state:o,sessionId:e.sessionId}),onFocus:()=>ma(e.api.loadStatistics,{state:o,sessionId:e.sessionId}),onClick:()=>s(e.sessionId)},d?"Cost details":"费用明细"),i?a("dialog",{ref:l,role:"dialog",className:Ps,"aria-label":c,onCancel:()=>s(null)},a("header",{className:"cm-stat-dialog-head"},a("strong",null,c),a("button",{type:"button",className:"cm-btn",autoFocus:!0,"aria-label":d?"Close":"关闭",onClick:()=>s(null)},"×")),a("div",{className:"cm-stat-dialog-body"},o?a(be,{key:e.sessionId,state:o,api:e.api,sessionId:e.sessionId}):a("p",{role:t?.error?"alert":"status"},t?.error||(d?"Loading…":"加载中…"),a("button",{type:"button",className:"cm-btn",onClick:()=>e.api.reload()},d?"Retry":"重试")))):null)}function Ts({state:e,t}){const o=e.externalUsage;if(!o)return null;const n=e.config,s=c=>W(Q(c,n),n),l=c=>t("callsTokens",{calls:c.calls,input:L(c.input),cache:L(c.cacheRead+c.cacheWrite),output:L(c.output)}),r=(c,u)=>({calls:c.calls+u.calls,input:c.input+u.input,output:c.output+u.output,cacheRead:c.cacheRead+u.cacheRead,cacheWrite:c.cacheWrite+u.cacheWrite,cost:Q(c,n)+u.cost,apiCost:Q(c,n)+u.cost}),i=(c,u)=>a("tr",{key:c},a("td",null,c),a("td",{className:"num"},String(u.calls)),a("td",{className:"num"},L(u.input)),a("td",{className:"num"},L(u.cacheRead+u.cacheWrite)),a("td",{className:"num"},L(u.output)),a("td",{className:"num"},s(u))),d=c=>a("div",{className:"cm-scroll"},a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,t("colDate")),...["colCalls","colInTok","colCacheTok","colOutTok","colCost"].map(u=>a("th",{className:"num"},t(u))))),a("tbody",null,c)));return a("section",{className:"cm-budget"},a("h3",{className:"cm-h"},t("externalUsage")),o.stale?a("p",{className:"cm-note"},t("externalStale")):null,a("div",{className:"cm-cards"},["today","month","total"].map((c,u)=>{const b=r(e[c],o.combined[c]);return a(it,{key:c,title:t("combinedUsage")+" · "+t(["cardToday","cardMonth","cardTotal"][u]),value:s(b),sub:l(b)})})),...o.sources.map(c=>a("details",{key:c.source},a("summary",null,c.source+" · "+t("cardToday")+" "+s(c.today)+" · "+t("cardMonth")+" "+s(c.month)+" · "+l(c.today)),d(["today","month","total"].map((u,b)=>i(t(["cardToday","cardMonth","cardTotal"][b]),c[u]))),a("p",{className:"cm-note"},t("externalHistory")),d(c.history.map(u=>i(u.date,u))))))}const ct=(e,t,o)=>a("button",{type:"button",className:"cm-collapse-h","aria-expanded":String(e),onClick:t},a("span",{className:"cm-caret"+(e?" open":"")}),a("h3",{className:"cm-h"},o));function Rs(e){const{state:t,api:o}=e,n=z(H(t.config)),[s,l]=O(!1);return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(s,()=>l(!s),n("history"))),s?a("div",{className:"cm-collapse-body"},a(Bs,{state:t,api:o})):null)}function Bs(e){const{state:t,api:o}=e,n=z(H(t.config)),[s,l]=O(null),[r,i]=O({}),[d,c]=O(()=>new Set),u=t.history??[];if(u.length===0)return a("p",{className:"cm-empty"},n("noHistory"));const b=f=>{if(s===f){l(null);return}l(f),!(r[f]!==void 0||d.has(f))&&(c(m=>{const x=new Set(m);return x.add(f),x}),o.getDaySessions(f).then(m=>i(x=>({...x,[f]:Array.isArray(m?.sessions)?m.sessions:[]}))).catch(()=>i(m=>({...m,[f]:"error"}))).finally(()=>c(m=>{const x=new Set(m);return x.delete(f),x})))},g=f=>f.map(m=>a("tr",{key:m.id},fa(m,t.config?.showSessionId===!0,n),a("td",{className:"num"},String(m.calls)),a("td",{className:"num"},L(m.input)),a("td",{className:"num"},L(m.cacheRead+m.cacheWrite)),a("td",{className:"num"},L(m.output)),a("td",{className:"num"},W(Q(m,t.config),t.config))));return a("div",{className:"cm-scroll"},a("p",{className:"cm-hint",style:{padding:"6px 10px 0"}},n("historyExpandHint")),a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("colDate")),a("th",{className:"num"},n("colCalls")),a("th",{className:"num"},n("colInTok")),a("th",{className:"num"},n("colCacheTok")),a("th",{className:"num"},n("colOutTok")),a("th",{className:"num"},n("colCost")))),a("tbody",null,u.flatMap(f=>{const m=a("tr",{key:f.date,className:"cm-row-click",onClick:()=>b(f.date)},a("td",null,(s===f.date?"▾ ":"▸ ")+f.date),a("td",{className:"num"},String(f.calls)),a("td",{className:"num"},L(f.input)),a("td",{className:"num"},L(f.cacheRead+f.cacheWrite)),a("td",{className:"num"},L(f.output)),a("td",{className:"num"},W(Q(f,t.config),t.config)));if(s!==f.date)return[m];const x=r[f.date],h=d.has(f.date)&&x===void 0?a("p",{className:"cm-empty"},n("historySessionsLoading")):x==="error"?a("p",{className:"cm-empty"},n("historySessionsError")):!Array.isArray(x)||x.length===0?a("p",{className:"cm-empty"},n("historyNoSessions")):a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("colSession")),a("th",{className:"num"},n("colCalls")),a("th",{className:"num"},n("colInTok")),a("th",{className:"num"},n("colCacheTok")),a("th",{className:"num"},n("colOutTok")),a("th",{className:"num"},n("colCost")))),a("tbody",null,g(x)));return[m,a("tr",{key:f.date+"-sessions"},a("td",{colSpan:6},h))]}))))}function Os(e){const{state:t,api:o}=e,n=z(H(t.config)),[s,l]=O(!1),[r,i]=O(100),[d,c]=O("cost-desc"),[u,b]=O(null),[g,f]=O(!1),[m,x]=O(!1),h=Ae.useRef(0),C=(k,w)=>{const[v,R]=w==="recent"?["recent","desc"]:w.split("-"),j=++h.current;f(!0),x(!1),o.getTopSessions(k,v,R).then(A=>{j===h.current&&b(Array.isArray(A?.sessions)?A.sessions:[])}).catch(()=>{j===h.current&&x(!0)}).finally(()=>{j===h.current&&f(!1)})},N=()=>{l(k=>{const w=!k;return w&&u===null&&!g&&C(r,d),w})},y=k=>{i(k),(s||u!==null)&&C(k,d)},p=k=>{c(k),(s||u!==null)&&C(r,k)};return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(s,N,n("sessionRankTitle"))),s?a("div",{className:"cm-collapse-body"},a("p",{className:"cm-hint"},n("sessionRankHint")),a("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",margin:"6px 0"}},a("div",{className:"cm-field"},a("label",null,n("sessionRankSort")),a("select",{className:"cm-input",value:d,onChange:k=>p(k.target.value)},a("option",{value:"cost-desc"},n("sessionSortCostDesc")),a("option",{value:"cost-asc"},n("sessionSortCostAsc")),a("option",{value:"time-desc"},n("sessionSortTimeDesc")),a("option",{value:"time-asc"},n("sessionSortTimeAsc")),a("option",{value:"recent"},n("sessionSortRecent")))),a("div",{className:"cm-field"},a("label",null,n("sessionRankLimit")),a("select",{className:"cm-input",value:String(r),onChange:k=>y(Number(k.target.value))},a("option",{value:"50"},"50"),a("option",{value:"100"},"100"),a("option",{value:"200"},"200")))),g?a("p",{className:"cm-empty"},n("sessionRankLoading")):m?a("p",{className:"cm-empty"},n("sessionRankError")):u===null||u.length===0?a("p",{className:"cm-empty"},n("sessionRankEmpty")):a("div",{className:"cm-scroll"},a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("colDate")),a("th",null,n("colSession")),a("th",{className:"num"},n("colCalls")),a("th",{className:"num"},n("colInTok")),a("th",{className:"num"},n("colCacheTok")),a("th",{className:"num"},n("colOutTok")),a("th",{className:"num"},n("colCost")))),a("tbody",null,u.map(k=>a("tr",{key:k.date+":"+k.id},a("td",null,k.date),fa(k,t.config?.showSessionId===!0,n),a("td",{className:"num"},String(k.calls)),a("td",{className:"num"},L(k.input)),a("td",{className:"num"},L((k.cacheRead??0)+(k.cacheWrite??0))),a("td",{className:"num"},L(k.output)),a("td",{className:"num"},W(Q(k,t.config),t.config)))))))):null)}function vn(e){const{state:t}=e,o=z(H(t.config)),n=t.today.sessions??[];if(n.length===0)return a("p",{className:"cm-empty"},o("noSessionsToday"));const s=t.config?.showSessionId===!0;return a("div",{className:"cm-scroll"},a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,o("colSession")),a("th",{className:"num"},o("colCalls")),a("th",{className:"num"},o("colInTok")),a("th",{className:"num"},o("colCacheTok")),a("th",{className:"num"},o("colOutTok")),a("th",{className:"num"},o("colCost")))),a("tbody",null,n.map(l=>a("tr",{key:l.id},fa(l,s,o),a("td",{className:"num"},String(l.calls)),a("td",{className:"num"},L(l.input)),a("td",{className:"num"},L(l.cacheRead+l.cacheWrite)),a("td",{className:"num"},L(l.output)),a("td",{className:"num"},W(Q(l,t.config),t.config)))))))}function fa(e,t,o){const n=typeof e.title=="string"?e.title.trim():"",s=String(e.id).slice(0,14)+"…",l=n.length>0?n:s,r=n.length>0?n+" · "+e.id:e.id;return a("td",{title:r},a("div",{className:"cm-sess-title"+(n.length===0?" cm-sess-id":"")},l),t&&n.length>0?a("div",{className:"cm-sess-id"},s):null)}const Ds={CNY:{symbol:"¥",decimals:4,exchangeRate:7.2},USD:{symbol:"$",decimals:6,exchangeRate:1},EUR:{symbol:"€",decimals:6,exchangeRate:.92}};function Ls(e){const{state:t,draft:o,setDraft:n,t:s}=e,l=t.config,r=o?.budget??l.budget,i=Number(l.exchangeRate),c=(t.budgetUsed??(r.period==="day"?Q(t.today,l):r.period==="all"?Q(t.total,l):Q(t.month,l)))*(Number.isFinite(i)&&i>0?i:1),u=Math.max(0,Number(r.amount)||0),b=r.enabled&&u>0?Math.min(999,c/u*100):null,g=b===null?"ok":b>=100?"over":b>=80?"warn":"ok",f=(h,C)=>{o!==null&&n({...o,budget:{...o.budget??l.budget,[h]:C}})},m=r.period==="custom"?r.customStart+" → "+(r.customEnd??s("periodDay")):null,x=r.enabled&&b!==null?s("budgetStatus",{period:s(Ye[r.period]??"periodMonth"),amount:de(u,l),used:de(c,l),pct:b.toFixed(1)})+(g==="over"?s("overLimit"):g==="warn"?s("nearLimit"):""):null;return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},a("h3",{className:"cm-h"},s("budget")),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:r.enabled===!0,onChange:h=>f("enabled",h.target.checked)}),a("span",null,s("enableBudget")))),r.enabled?a(E,null,a("div",{className:"cm-budget-bar"},a("div",{className:"cm-budget-fill "+(g==="ok"?"":g),style:{width:(b===null?0:Math.min(100,b))+"%"}})),a("div",{className:"cm-budget-line"+(g==="over"?" over":"")+" cm-num"},x),a("div",{className:"cm-budget-controls"},a("div",{className:"cm-field"},a("label",null,s("budgetAmountLabel")),Ge({value:r.amount},h=>f("amount",h))),a("div",{className:"cm-field"},a("label",null,s("budgetPeriodLabel")),a("select",{className:"cm-input",value:r.period,onChange:h=>f("period",h.target.value)},a("option",{value:"day"},s("periodDay")),a("option",{value:"month"},s("periodMonth")),a("option",{value:"all"},s("periodAll")),a("option",{value:"custom"},s("periodCustomRange")))),r.period==="custom"?a(E,null,a("div",{className:"cm-field"},a("label",null,s("startDate")),a("input",{className:"cm-input",type:"date",value:r.customStart??"",onChange:h=>f("customStart",h.target.value===""?null:h.target.value)})),a("div",{className:"cm-field"},a("label",null,s("endDate")),a("input",{className:"cm-input",type:"date",value:r.customEnd??"",onChange:h=>f("customEnd",h.target.value===""?null:h.target.value)}))):null),m!==null?a("p",{className:"cm-hint"},s("rangeText",{range:m})):null):a("p",{className:"cm-note"},s("budgetDisabledNote")))}function Es(e){const{state:t,draft:o,setDraft:n,t:s}=e,l=t.config,r=(u,b)=>{o!==null&&n({...o,[u]:b})},i=o===null?l:{...l,...o},d=(()=>{if(i.peakEnabled!==!0)return s("peakOff");const u=Date.parse(i.peakEffectiveAt||""),b=Date.now();if(Number.isFinite(u)&&b<u)return s("peakNotEffective",{time:new Date(u).toLocaleString()});const g=i.peakWindows??[],f=ta(b,g,i.peakHolidays);return f===null?s("offPeakActive"):f.holiday===!0?s("holidayAllOffPeak"):f.weekend===!0?s("weekendAllOffPeak"):f.inPeak?s("peakActive"):s("offPeakActive")})(),c=(i.peakWindows?.length??0)>0?s("peakSummary",{windows:i.peakWindows.map(u=>u.start+":00-"+u.end+":00").join(H(i)==="zh"?"、":", "),time:i.peakEffectiveAt||s("unknown"),status:d}):s("noPeakWindows",{status:d});return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},a("h3",{className:"cm-h"},s("peakPanelTitle")),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakEnabled!==!1,onChange:u=>r("peakEnabled",u.target.checked)}),a("span",null,s("peakEnabledLabel")))),a("div",{className:"cm-grid"},a("div",{className:"cm-field"},a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakNotice!==!1,onChange:u=>r("peakNotice",u.target.checked)}),a("span",null,s("peakNoticeLabel")))),a("div",{className:"cm-field"},a("label",null,s("peakStyleLabel")),a("select",{className:"cm-input",value:o?.peakStyle??"compact",onChange:u=>r("peakStyle",u.target.value)},a("option",{value:"progress"},H(o)==="en"?"Time progress":"时间进度条"),a("option",{value:"compact"},s("peakStyleCompact")),a("option",{value:"classic"},s("peakStyleClassic"))))),a("div",{className:"cm-grid"},a("div",{className:"cm-field"},a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakAlertEnabled!==!1,onChange:u=>r("peakAlertEnabled",u.target.checked)}),a("span",null,s("peakAlertLabel")))),a("div",{className:"cm-field"},a("label",null,s("peakAlertAheadLabel")),a("input",{className:"cm-input narrow",type:"number",min:"1",max:"30",step:"1",value:String(typeof o?.peakAlertAhead=="number"&&Number.isFinite(o.peakAlertAhead)&&o.peakAlertAhead>=1&&o.peakAlertAhead<=30?o.peakAlertAhead:2),onChange:u=>{const b=Number(u.target.value);Number.isInteger(b)&&b>=1&&b<=30&&r("peakAlertAhead",b)}})),a("div",{className:"cm-field"},a("label",null,s("peakAlertTargetLabel")),a("select",{className:"cm-input",value:o?.peakAlertTarget==="peak"||o?.peakAlertTarget==="offpeak"?o.peakAlertTarget:"both",onChange:u=>r("peakAlertTarget",u.target.value)},a("option",{value:"both"},s("peakAlertTargetBoth")),a("option",{value:"peak"},s("peakAlertTargetPeak")),a("option",{value:"offpeak"},s("peakAlertTargetOffPeak"))))),a("div",{className:"cm-grid"},a("div",{className:"cm-field"},a("label",null,s("peakAlertPositionLabel")),a("select",{className:"cm-input",value:o?.peakAlertPosition==="center"?"center":"corner",onChange:u=>r("peakAlertPosition",u.target.value)},a("option",{value:"corner"},s("peakAlertPositionCorner")),a("option",{value:"center"},s("peakAlertPositionCenter")))),a("div",{className:"cm-field"},a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:o?.peakAlertWebNotify===!0,onChange:u=>{r("peakAlertWebNotify",u.target.checked),u.target.checked&&window.Notification&&Notification.permission==="default"&&Promise.resolve(Notification.requestPermission()).catch(()=>{})}}),a("span",null,s("peakAlertWebNotifyLabel"))),a("p",{className:"cm-hint"},s("peakAlertWebNotifyHint")))),a("div",{className:"cm-field"},a("label",null,s("peakAlertPreviewLabel")),a("div",{className:"cm-row"},a("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("peak")},s("peakAlertPreviewPeak")),a("button",{className:"cm-btn",onClick:()=>window.cmPeakAlertPreview?.("offpeak")},s("peakAlertPreviewOffPeak")))),a("div",{className:"cm-peak-preview"},o?.peakEnabled!==!1&&o?.peakNotice!==!1?mn(t,i,s):a("p",{className:"cm-hint"},s("peakNoticeHiddenHint"))),a("p",{className:"cm-hint"},c),a("div",{className:"cm-field"},a("label",null,s("peakHolidaysLabel")),a("input",{className:"cm-input",defaultValue:(i.peakHolidays??[]).join(", "),onBlur:u=>r("peakHolidays",u.target.value.split(/[,,\s]+/).filter(Boolean))})),a("p",{className:"cm-hint"},s("weekendRuleNote")))}function Ge(e,t){const o=e.value;return a("input",{className:"cm-input narrow",type:"number",step:"any",min:"0",placeholder:e.placeholder,title:e.title,"aria-label":e.label,value:typeof o=="number"?String(o):"",onChange:n=>{const s=n.target.value;if(s===""){if(e.emptyMode==="clear"){t(null);return}if(e.emptyMode==="ignore")return;t(0);return}const l=Number(s);Number.isFinite(l)&&l>=0&&t(l)}})}function An({value:e,entry:t,path:o,emptyMode:n,placeholder:s,label:l,title:r,t:i,onCommit:d}){const c=yt(t,o),u=e==null?"":String(e)+(t.multiplier!==void 0||t.separateMultipliers?" × "+c:""),[b,g]=O(u),[f,m]=O(!1),x=fe(!1);V(()=>{x.current||g(u)},[u]);const h=()=>{if(!x.current)return;const C=b.trim().split(/\s*[×*xX]\s*/),N=/^[+]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;if(b.trim()===""){x.current=!1,m(!1),n==="clear"?d(null):g(u);return}if(C.length>2||!C.every(y=>N.test(y)&&Number.isFinite(Number(y)))||!Number.isFinite(Number(C[0])*(C.length===2?Number(C[1]):c))){m(!0);return}x.current=!1,m(!1),g(String(Number(C[0]))+(t.multiplier!==void 0||t.separateMultipliers||C.length===2?" × "+(C.length===2?Number(C[1]):c):"")),d(Number(C[0]),C.length===2?Number(C[1]):void 0)};return a("input",{className:"cm-input narrow",type:"text",value:b,placeholder:s,"aria-label":l,"aria-invalid":f,title:f?i("priceMultiplyInvalid"):[r,i(t.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll"),e==null?"":"= "+Number((e*c).toPrecision(12))].filter(Boolean).join(" · "),onChange:C=>{x.current=!0,g(C.target.value),m(!1)},onBlur:h,onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),h()),C.key==="Escape"&&(C.stopPropagation(),x.current=!1,m(!1),g(u))}})}function Bt(e,t,o){o!==void 0&&(e.separateMultipliers?e.multipliers={...e.multipliers,[t]:o}:e.multiplier=o)}function ba(e,t,o,n,s,l,r,i=0){const d=n==="cacheWrite",c=t?.[n]??(n==="cacheMiss"?t?.input:n==="cacheHit"?t?.cachedInput:void 0)??null,u=l({cacheHit:"flatCached",cacheMiss:"flatInput",cacheWrite:"flatCacheWrite",output:"flatOutput"}[n]);return a("label",{className:"cm-price-cell"},a("span",{className:"cm-price-cell-label"},u),a(An,{entry:e,value:c,path:o+"."+n,t:l,emptyMode:d||!["base","cny"].includes(o)?"clear":"ignore",placeholder:d?String(t?.cacheHit??t?.cachedInput??t?.cacheMiss??t?.input??i):void 0,label:s+" · "+u,title:d?l("cacheWriteFallback"):void 0,onCommit:r}))}function ga(e,t,o){return a("div",{className:"cm-price-multiplier"},a("label",null,a("input",{type:"checkbox",checked:e.separateMultipliers===!0,onChange:n=>o(n.target.checked)}),t("priceMultiplySeparate")),a("span",{title:t(e.separateMultipliers?"priceMultiplySingle":"priceMultiplyAll")},t("priceMultiplyHint")))}function Is(e){const{modelId:t,entry:o,isDefault:n,draft:s,setDraft:l,t:r}=e,i=Ze(o),d=f=>{const m={...Ze(f)};if(Array.isArray(f.rateHistory)){const x=f.rateHistory.filter(h=>Date.parse(h.before)<=Date.now());x.length>0?m.rateHistory=x:delete m.rateHistory}return m},c=f=>{const m=n?{...s.prices,default:f}:{...s.prices,models:{...s.prices.models,[t]:f}};l({...s,prices:m})},u=(f,m,x,h)=>{const C=n?s.prices.default:s.prices.models[t],N=d(C??{cacheHit:0,cacheMiss:0,output:0}),y=f==="base"?N:{...N[f]??(x===null?{}:Qe(N))};x===null?delete y[m]:y[m]=Math.max(0,x),f!=="base"&&(Object.keys(y).length?N[f]=y:delete N[f]),Bt(N,f+"."+m,h),c(N)},b=()=>{const f={...s.prices.models};delete f[t],l({...s,prices:{...s.prices,models:f}})},g=(f,m)=>{const x=m==="base"?i:i[m]??null;return a("div",{className:"cm-price-row",key:m},a("span",null,f),...["cacheMiss","cacheHit","cacheWrite","output"].map(h=>a(E,{key:h},ba(i,x,m,h,f,r,(C,N)=>u(m,h,C,N),i.cacheHit))))};return a("div",{className:"cm-price-card"},a("div",{className:"cm-price-head"},a("span",{className:"cm-price-name"},t),a("span",{className:"cm-price-unit"},s.prices.currency??"USD"),a(E,null,i?.legacy===!0?a("span",{className:"cm-price-legacy"},r("legacyModel")):null,n?a("span",{className:"cm-price-legacy"},r("defaultFallback")):null,n?null:a("button",{className:"cm-btn small danger",onClick:b},r("remove")))),a("div",{className:"cm-price-row cm-price-columns"},a("span",null,""),a("span",null,r("flatInput")),a("span",null,r("flatCached")),a("span",null,r("flatCacheWrite")),a("span",null,r("flatOutput"))),g(r("tierBase"),"base"),g(r("tierOffPeak"),"offPeak"),g(r("tierPeak"),"peak"),ga(i,r,f=>c({...o,separateMultipliers:f,multipliers:{}})),Array.isArray(o?.rateHistory)&&o.rateHistory.length>0?a("p",{className:"cm-note"},r("datedPriceNote")):null)}const js={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"},Hs=e=>e==="zen"?"go":e,ut=e=>e.replace(/^zen:/i,"go:").replace(/^(deepseek(?:-official|-account)?):deepseek-(?:v4(?:\.1)?-)?flash(?:-vision-exp)?$/i,"$1:DeepSeek V4.1 Flash");function Pn(e,t,o,n){const s=["input","output","cacheRead","cacheWrite","reasoning","cost","calls"],l=c=>Number.isFinite(Number(c))&&Number(c)>0?Number(c):0,r=(c,u,b)=>{if(!b||typeof b!="object")return;const g=c[u]??(c[u]=Object.fromEntries([...s,"apiCost"].map(m=>[m,0])));for(const m of s)g[m]+=l(b[m]);for(const m of bt)Number.isFinite(b[m])&&(g[m]=(g[m]??0)+b[m]);const f=u.indexOf(":");g.apiCost+=l(b.apiCost??(et(f>0?u.slice(0,f):"deepseek",f>0?u.slice(f+1):u,t)==="plan"?0:b.cost))},i=c=>{if(!c||typeof c!="object")return{};if(c.byProviderModel&&Object.keys(c.byProviderModel).length)return c.byProviderModel;if(c.byModel&&Object.keys(c.byModel).length)return Object.fromEntries(Object.entries(c.byModel).map(([b,g])=>[b.includes(":")?b:"deepseek:"+b,g]));const u={};for(const b of Array.isArray(c.sessions)?c.sessions:[])if(!(!b||typeof b!="object"))if(b.byProviderModel&&Object.keys(b.byProviderModel).length)for(const[g,f]of Object.entries(b.byProviderModel))r(u,g,f);else r(u,(b.provider||"deepseek")+":"+(b.model||"unknown"),b);return Object.keys(u).length?u:s.some(b=>l(c[b])>0)?{"deepseek:legacy":c}:{}};return(c=>{const u={},b=g=>{for(const[f,m]of Object.entries(g??{}))r(u,f,m)};if(c==="today")b(i(e.today));else{const g=Date.parse((e.meta?.dayKey||new Date().toISOString().slice(0,10))+"T00:00:00Z");for(const f of e.history??[]){const m=Date.parse(f.date+"T00:00:00Z");m<=g&&m>=g-76896e5&&b(i(f))}}return Object.entries(u).map(([g,f])=>{const m=g.indexOf(":"),x=(m>0?g.slice(0,m):"deepseek").toLowerCase(),h=m>0?g.slice(m+1):g,C=f.input+f.output+f.cacheRead+f.cacheWrite+f.reasoning,N=f.cacheRead+f.input;return{label:e.modelLabels?.[g]??(g==="deepseek:legacy"?o("modelStatsLegacy"):x==="deepseek"||x===""?h:Hs(x)+":"+h),key:g,...f,tokens:C,cls:et(x,h,t),hitRate:N>0?f.cacheRead/N:null,cacheUnreported:wo(f),blended:C>0&&f.cost>0?f.cost/C*1e6:null,perUsd:f.cost>0?C/f.cost:null}}).filter(g=>(g.tokens>0||g.cost>0)&&t.modelStatistics?.[g.key]?.[c==="today"?"today":"summary"]!==!1)})(n).sort((c,u)=>u.cost-c.cost||u.tokens-c.tokens)}function Qs(e){const{state:t,config:o,t:n,initialTab:s,draft:l,setDraft:r}=e,[i,d]=O(s==="history"?"history":"today"),[c,u]=O(!1),b=Pn(t,o,n,i),g=p=>(Math.max(0,Math.min(1,p))*100).toFixed(1)+"%",f=b.reduce((p,k)=>Math.max(p,k.cost),0),m=b.reduce((p,k)=>Math.max(p,k.tokens),0),x=b.reduce((p,k)=>Math.max(p,k.perUsd??0),0),h=(p,k)=>a("button",{className:"cm-mstats-tab"+(i===p?" active":""),onClick:()=>d(p)},k),C=p=>p.cls==="plan"?a("span",{className:"cm-plan-tag",title:n("billingClassLabel")+" · "+(ya(za(p.provider,o,p.model),n)||n("billingClassPlan"))},n("billingClassPlan")):null,N=p=>a("select",{className:"cm-input",title:n("billingClassLabel"),value:o.planBilling?.models?.[p.key]==="plan"&&o.planBilling?.modelPlans?.[p.key]?"plan:"+o.planBilling.modelPlans[p.key]:o.planBilling?.models?.[p.key]??"auto",disabled:l===null,onChange:k=>{const w={...l.planBilling?.models??{}},v={...l.planBilling?.modelPlans??{}},R=k.target.value;delete v[p.key],R.startsWith("plan:")?(w[p.key]="plan",v[p.key]=R.slice(5)):R==="auto"?delete w[p.key]:w[p.key]=R,r({...l,planBilling:{...l.planBilling,models:w,modelPlans:v}})}},a("option",{value:"auto"},n("billingClassAuto")),a("option",{value:"plan"},n("billingClassPlan")),a("option",{value:"api"},n("billingClassApi")),Ue.map(k=>a("option",{key:k,value:"plan:"+k},n("billingClassPlan")+" · "+ya(k,n)))),y=(p,k,w,v,R)=>a("div",{className:"cm-mstats-row"},R?a("div",{className:"cm-mstats-label"},a("span",{className:"cm-mstats-name",title:p},p),R):a("span",{className:"cm-mstats-name",title:p},p),a("div",{className:"cm-mstats-barbg"},a("div",{className:"cm-mstats-bar "+w,style:{width:g(k)}})),a("span",{className:"cm-mstats-val"},v));return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(c,()=>u(!c),n("modelStatsTitle"))),c?a("div",{className:"cm-collapse-body"},a("div",{className:"cm-mstats-tabs"},h("today",n("modelStatsToday")),h("history",n("modelStatsHistory"))),b.length===0?a("p",{className:"cm-note"},n("modelStatsEmpty")):a(E,null,a("div",{className:"cm-mstats-h"},n("modelStatsCostH")),b.map(p=>a(E,{key:"c:"+p.label},y(p.label,f>0?p.cost/f:0,"cost",W(p.cost,o),a(E,null,C(p),N(p),p.cacheUnreported?a("span",{className:"cm-plan-tag",title:n("modelStatsHitUnreportedTip")},"⚠"):null)))),a("div",{className:"cm-mstats-h"},n("modelStatsTokensH")),a("div",{className:"cm-mstats-legend"},a("span",null,a("span",{className:"cm-mstats-dot",style:{background:"var(--dsw-alias-state-business-primary)"}}),n("modelStatsInput")),a("span",null,a("span",{className:"cm-mstats-dot",style:{background:"#ff9800"}}),n("modelStatsCache")),a("span",null,a("span",{className:"cm-mstats-dot",style:{background:"#34a853"}}),n("modelStatsOutput"))),[...b].sort((p,k)=>k.tokens-p.tokens).map(p=>a("div",{className:"cm-mstats-row",key:"t:"+p.label},a("span",{className:"cm-mstats-name",title:p.label},p.label),a("div",{className:"cm-mstats-barbg"},a("div",{className:"cm-mstats-seg in",style:{width:g(m>0?p.input/m:0)}}),a("div",{className:"cm-mstats-seg cache",style:{width:g(m>0?(p.cacheRead+p.cacheWrite)/m:0)}}),a("div",{className:"cm-mstats-seg out",style:{width:g(m>0?(p.output+p.reasoning)/m:0)}})),a("span",{className:"cm-mstats-val"},L(p.tokens)))),a("div",{className:"cm-mstats-h"},n("modelStatsHitH")),[...b].sort((p,k)=>(k.hitRate??-1)-(p.hitRate??-1)).map(p=>a(E,{key:"h:"+p.label},y(p.label,p.hitRate??0,"hit",p.cacheUnreported?n("modelStatsHitUnreported"):p.hitRate===null?"—":(p.hitRate*100).toFixed(1)+"%",p.cacheUnreported?a("span",{className:"cm-plan-tag",title:n("modelStatsHitUnreportedTip")},"⚠"):null))),a("div",{className:"cm-mstats-h"},n("modelStatsValueH")),[...b].sort((p,k)=>(k.perUsd??-1)-(p.perUsd??-1)).map(p=>a(E,{key:"v:"+p.label},y(p.label,x>0?(p.perUsd??0)/x:0,"value",p.perUsd===null?"—":L(p.perUsd)+" tok/$"+(p.blended!==null?" · "+n("modelStatsBlended",{price:"$"+p.blended.toFixed(2)}):"")))),a("p",{className:"cm-mstats-note"},n("modelStatsNote")))):null)}function qs(e,t){return e==="fiveHour"?t==="en"?"5-hour":"5 小时":e==="weekly"?t==="en"?"This week":"本周":e==="monthly"?t==="en"?"This month":"本月":e==="daily"?t==="en"?"Today":"当日":e}function ya(e,t){if(e==="go")return"OpenCode Go / Go Plus";const o={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(o[e])return o[e];const n=De.find(s=>s.id===e);return n!==void 0?t(n.labelKey):e}const Mn=["fiveHour","weekly","monthly","daily"];function Us(e,t){const o=new Map,n=s=>{const l=new Date(s),r=i=>String(i).padStart(2,"0");if(t==="monthly")return l.getFullYear()+"-"+r(l.getMonth()+1);if(t==="weekly"){const i=new Date(l.getFullYear(),l.getMonth(),l.getDate()-(l.getDay()+6)%7);return i.getFullYear()+"-"+r(i.getMonth()+1)+"-"+r(i.getDate())}return l.getFullYear()+"-"+r(l.getMonth()+1)+"-"+r(l.getDate())};for(const s of Object.values(e??{}))for(const l of s??[]){if(l===null||typeof l!="object"||!(l.tokens>0)&&!(l.cost>0))continue;const r=n(Number(l.t1)||Number(l.t0)),i=o.get(r)??{key:r,tokens:0,cost:0,pct:0,intervals:0};i.tokens+=Number(l.tokens)||0,i.cost+=Number(l.cost)||0,i.pct+=Number(l.pct)||0,i.intervals+=1,o.set(r,i)}return[...o.values()].map(s=>({...s,per1Tokens:s.pct>0?s.tokens/s.pct:null,fullTokens:s.pct>0?s.tokens/s.pct*100:null})).sort((s,l)=>s.key<l.key?-1:s.key>l.key?1:0)}function Fs(e){const{state:t,config:o,t:n}=e,[s,l]=O(!1),[r,i]=O("daily"),d=H(o),c=t?.planStats,u=c!=null&&typeof c.providers=="object"?c.providers:{},b=Object.keys(u).sort(),g=w=>W(Number(w)||0,o??t?.config),f=w=>w.method==="none"||w.per1Tokens===null?"—":L(w.per1Tokens)+" tok · "+g(w.per1Cost),m=w=>w.method==="none"||w.fullTokens===null?"—":L(w.fullTokens)+" tok · "+g(w.fullCost),x=w=>w.method==="sample"?n("planStatsMethodSample"):w.method==="live"?n("planStatsMethodLive"):n("planStatsMethodNone"),h=w=>{let v=x(w);return w.method==="sample"&&Number(w.sampleAt)>0&&(v=n("planStatsMethodSampleAt",{method:v,time:new Date(Number(w.sampleAt)).toLocaleString(d==="en"?"en-US":"zh-CN")})),(w.method==="sample"||w.method==="live")&&w.confidence==="low"&&(v+=" · "+n("planStatsConfidenceLow")),v},C=([w,v,R])=>a("tr",{key:v+":"+w},a("td",null,qs(w,d)),a("td",{className:"num"},Math.round(R.percent*10)/10+"%"),a("td",{className:"num"},L(R.localTokens)+" tok · "+g(R.localCost)),a("td",{className:"num"},f(R)),a("td",{className:"num"},m(R)),a("td",{className:"num cm-plan-reset"},R.resetsAt.length>0?n("planStatsResets",{time:new Date(R.resetsAt).toLocaleString(d==="en"?"en-US":"zh-CN")}):"—"),a("td",{className:"cm-plan-method"},h(R))),N=s?b.flatMap(w=>Object.entries(u[w]?.intervals??{})).map(([w,v])=>({winKey:w,list:v})):[],y=Us(Object.fromEntries(N.map(w=>[w.winKey,w.list])),r),p=y.reduce((w,v)=>Math.max(w,v.fullTokens??0),0),k=(w,v)=>a("button",{key:w,className:"cm-mstats-tab"+(r===w?" active":""),onClick:()=>i(w)},v);return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},ct(s,()=>l(!s),n("planStatsTitle"))),s?a("div",{className:"cm-collapse-body"},b.length===0?a("p",{className:"cm-empty"},n("planStatsEmpty")):a(E,null,b.map(w=>{const v=u[w]?.windows??{},R=[...Mn.filter(j=>v[j]!==void 0).map(j=>[j,w,v[j]]),...Object.keys(v).filter(j=>!Mn.includes(j)).map(j=>[j,w,v[j]])];return a("div",{key:w,className:"cm-plan-provider"},a("div",{className:"cm-plan-provider-name"},ya(w,n),a("span",{className:"cm-plan-updated"},(()=>{const j=Number(u[w]?.generatedAt)||Number(c?.generatedAt)||0;return j>0?new Date(j).toLocaleTimeString(d==="en"?"en-US":"zh-CN"):""})())),a("table",{className:"cm-table"},a("thead",null,a("tr",null,a("th",null,n("planStatsWindow")),a("th",{className:"num"},n("planStatsPercent")),a("th",null,n("planStatsLocal")),a("th",null,n("planStatsPer1")),a("th",null,n("planStatsFull")),a("th",null,""),a("th",null,""))),a("tbody",null,R.map(C))))}),a("div",{className:"cm-mstats-h",style:{marginTop:"10px"}},n("planStatsCurveTitle")),a("div",{className:"cm-mstats-tabs"},k("daily",n("planStatsDaily")),k("weekly",n("planStatsWeekly")),k("monthly",n("planStatsMonthly"))),y.length===0?a("p",{className:"cm-note"},n("planStatsCurveEmpty")):a(E,null,[...y].reverse().map(w=>a("div",{className:"cm-mstats-row",key:w.key},a("span",{className:"cm-mstats-name"},w.key),a("div",{className:"cm-mstats-barbg"},a("div",{className:"cm-mstats-bar value",style:{width:(p>0?(w.fullTokens??0)/p*100:0).toFixed(1)+"%"}})),a(J,{label:n("planStatsBarTip",{date:w.key,full:w.fullTokens===null?"—":L(w.fullTokens),per1:w.per1Tokens===null?"—":L(w.per1Tokens),tokens:L(w.tokens),cost:g(w.cost),intervals:w.intervals}),side:"top",delayMs:200},a("span",{className:"cm-mstats-val"},w.fullTokens===null?"—":L(w.fullTokens)))))),a("p",{className:"cm-note"},n("planStatsNote")))):null)}function _s(e){const{provider:t,modelId:o,entry:n,draft:s,setDraft:l,t:r,api:i,lockedIds:d,releaseDisabled:c}=e,u=Array.isArray(d)&&d.includes(o),[b,g]=O(!1),[f,m]=O(""),x=async()=>{if(!(b||c)){g(!0),m("");try{await i.releasePriceLock(o)}catch(p){m(String(p.message??p))}finally{g(!1)}}},h=p=>{const k={...s.prices.providers??{}},w=k[t]??{};k[t]={...w,models:p},l({...s,prices:{...s.prices,providers:k}})},C=(p,k,w)=>{if(s===null)return;const v={...(s.prices.providers??{})[t]?.models??{}};v[o]={...v[o]??{},[p]:Math.max(0,k)},k===null&&delete v[o][p],p==="input"&&delete v[o].cacheMiss,p==="cachedInput"&&(delete v[o].cacheHit,delete v[o].cacheRead),Bt(v[o],"base."+({input:"cacheMiss",cachedInput:"cacheHit"}[p]??p),w),h(v)},N=(p,k,w)=>{if(s===null)return;const v={...(s.prices.providers??{})[t]?.models??{}},R=v[o]??{};v[o]={...R,cny:{...R.cny,[p]:Math.max(0,k)}},k===null&&delete v[o].cny[p],Bt(v[o],"cny."+p,w),h(v)},y=()=>{if(s===null)return;const p={...(s.prices.providers??{})[t]?.models??{}};delete p[o],h(p)};return a("div",{className:"cm-price-card"},a("div",{className:"cm-price-head"},a("span",{className:"cm-price-name"},o),a("span",{className:"cm-price-unit"},n.cny?"USD / CNY":"USD"),a(E,null,n?.unpriced===!0?a("span",{className:"cm-price-legacy"},r("catalogUnpriced")):null,u?a("span",{className:"cm-price-locked",title:r("priceLockHint")},r("priceLockBadge")):null,u&&typeof i?.releasePriceLock=="function"?a("button",{className:"cm-btn small",disabled:b||c,onClick:x},r("priceLockRelease")):null,a("button",{className:"cm-btn small danger",onClick:y},r("unmountBtn")))),f?a("p",{className:"cm-err",role:"alert"},f):null,n?.unpriced===!0?null:a(E,null,a("div",{className:"cm-price-row cm-price-columns"},a("span",null,""),a("span",null,r("flatInput")),a("span",null,r("flatCached")),a("span",null,r("flatCacheWrite")),a("span",null,r("flatOutput"))),a("div",{className:"cm-price-row"},a("span",null,"USD"),...["cacheMiss","cacheHit","cacheWrite","output"].map(p=>a(E,{key:p},ba(n,n,"base",p,"USD",r,(k,w)=>C({cacheMiss:"input",cacheHit:"cachedInput"}[p]??p,k,w))))),n?.cny?a("div",{className:"cm-price-row"},a("span",null,"CNY"),...["cacheMiss","cacheHit","cacheWrite","output"].map(p=>a(E,{key:p},ba(n,n.cny,"cny",p,"CNY",r,(k,w)=>N(p,k,w))))):null,ga(n,r,p=>h({...s.prices.providers[t].models,[o]:{...n,separateMultipliers:p,multipliers:{}}}))))}const ha=e=>[a("option",{key:"sidebar",value:"sidebar"},e("balanceSidebar")),a("option",{key:"settings",value:"settings"},e("balanceSettings")),a("option",{key:"both",value:"both"},e("balanceBoth")),a("option",{key:"off",value:"off"},e("off"))],ka=e=>e!=null?a("div",{className:"cm-msg "+e.kind},e.text):null;function Ws(e){const{state:t,api:o,t:n,draft:s,setDraft:l}=e,[r,i,d]=dt(n,()=>o.refreshBalance()),c=t.balance,u=t.config,b=t.reconcile,g=(s?.balance??u.balance??{}).reconcile!==!1,f=h=>{s===null||typeof l!="function"||l({...s,balance:{...s.balance??u.balance??{},reconcile:h.target.checked}})},m=h=>je(h,u,c?.currency),x=c.status==="ok"?a("div",{className:"cm-bal-line"},a("span",null,n("balanceLine",{total:m(c.totalBalance),granted:m(c.grantedBalance),toppedUp:m(c.toppedUpBalance),time:c.fetchedAt>0?new Date(c.fetchedAt).toLocaleTimeString():"—"}))):c.status==="error"?a("div",{className:"cm-bal-line err"},n("balanceQueryFailedHint",{message:c.message||n("unknownError")})):a("div",{className:"cm-bal-line"},n("balanceNotQueried"));return a("div",{className:"cm-budget"},a("div",{className:"cm-budget-head"},a("h3",{className:"cm-h"},n("accountBalance")),a("button",{className:"cm-btn small",onClick:d,disabled:r},n(r?"refreshing":"refreshBalance"))),x,a("label",null,n("balanceApiKey")),a(tt,{target:"balance",configured:c.keyConfigured,source:c.keySource,t:n,api:o,placeholder:"sk-…"}),a("p",{className:"cm-hint"},n("balanceKeyHint")),b!==void 0&&b.ok===!1?a("div",{className:"cm-bal-line warn"},"⚠ "+b.message):null,a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:g,onChange:f}),n("reconcileLabel")),ka(i))}function Ot(e){const t=fe(null);V(()=>{e.targeted&&(t.current?.scrollIntoView({block:"start"}),t.current?.focus({preventScroll:!0}))},[e.targeted]);const{name:o,enabled:n,saved:s,busy:l,open:r,statusNode:i,configNode:d,errorMsg:c,onToggle:u,onRefresh:b,onLogin:g,loginRequired:f,onRemove:m,onToggleOpen:x,t:h}=e,C=d!=null,N=f?g:b,y=h(l===!0?f?"loggingIn":"refreshing":f?"loginCodingPlan":"refresh");return a("div",{ref:t,"data-quota-plan":e.planId,tabIndex:e.targeted?-1:void 0,className:"cm-budget cm-quota-card"},a("div",{className:"cm-budget-head"},a("label",{className:"cm-check"},a("input",{type:"checkbox","aria-label":h("enable")+": "+o,checked:n===!0,onChange:p=>u(p.target.checked)})),a("div",{className:"cm-quota-name"},C?ct(r===!0,x,o):a("h3",{className:"cm-h"},o)),m?a("button",{className:"cm-btn small",onClick:m},h("quotaRemove")):null,a("button",{className:"cm-btn small",onClick:N,disabled:l===!0||n!==!0||s?.enabled!==!0||s.display==="off"&&s.showInComposer!==!0,title:n!==!0?h("quotaEnableFirst"):s?.enabled!==!0||s.display==="off"&&s.showInComposer!==!0?h("quotaRefreshReady"):h(f?"loginCodingPlan":"refresh")},y)),i,C&&r===!0?a("div",{className:"cm-collapse-body"},d):null,c!=null?a("div",{className:"cm-msg "+c.kind},c.text):null)}function dt(e,t){const[o,n]=O(!1),[s,l]=O(null),r=fe(!1);return[o,s,async()=>{if(!r.current){r.current=!0,n(!0),l(null);try{const d=await t();l({kind:d.ok?"ok":"err",text:d.message})}catch(d){l({kind:"err",text:e("syncFailed",{message:d?.message??String(d)})})}finally{r.current=!1,n(!1)}}}]}const Gs=e=>{const t=e.filter(n=>n.enabled===!0),o=e.filter(n=>n.enabled!==!0);return[...t,...o]},xa=(e,t,o,n,s,l=t)=>{if(typeof o?.percent!="number")return a("div",{key:l,className:"cm-go-row"+(s?" main":"")},a("span",{className:"cm-go-label"},t),a("span",{className:"cm-go-num"},typeof o?.text=="string"?o.text:"—"));const r=Math.max(0,Math.min(100,Number(o.percent)||0)),i=we(r,n),d=typeof o.resetsAt=="string"&&o.resetsAt.length>0?e("goResetAt",{time:new Date(o.resetsAt).toLocaleString()}):"";return a("div",{key:l,className:"cm-go-row"+(s?" main":"")},a("span",{className:"cm-go-label"},t),a("div",{className:"cm-go-bar"},a("div",{className:"cm-go-fill",style:{width:i.width+"%"}})),a("span",{className:"cm-go-num"},i.label===null?"—":e("goQuotaPercent",{percent:String(Math.round(i.label))})),d?a("span",{className:"cm-go-reset"},d):null)};function Ks(e){const{state:t,api:o,t:n,entry:s,index:l,canRemove:r,onPatch:i,onRemove:d}=e,c=s.adapter==="aliyun",u=s.adapter==="tokenrhythm",b=c||u,[g,f]=O(!1),m=()=>({headers:JSON.stringify(s.request?.headers??{},null,2),extract:JSON.stringify(s.extract??{},null,2),body:typeof s.request?.body=="string"?s.request.body:JSON.stringify(s.request?.body,null,2)??""}),[x,h]=O(m),[C,N]=O(()=>(s.allowedHosts??[]).join(", ")),[y,p]=O({}),k=fe(!1),w=t.config,R=(Array.isArray(t.customBalances)?t.customBalances:[]).find(D=>D.index===l)??null,j=s.enabled===!0,A=()=>{f(D=>!D)};V(()=>{g&&!k.current&&(h(m()),N((s.allowedHosts??[]).join(", ")),p({})),k.current=g},[g]);const B=(D,ne)=>i({[D]:ne}),F=(D,ne)=>i({request:{...s.request??{},[D]:ne}}),G=c?["ALIBABA_CLOUD_ACCESS_KEY_ID","ALIBABA_CLOUD_ACCESS_KEY_SECRET","ALIBABA_CLOUD_SECURITY_TOKEN"]:u?["TOKENRHYTHM_COOKIE"]:[...new Set(Object.values(s.request?.headers??{}).flatMap(D=>typeof D=="string"?[...D.matchAll(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g)].map(ne=>ne[1]):[]))],ae=(D,ne)=>{h(oe=>({...oe,[D]:ne}));try{const oe=D==="body",ge=oe&&!ne.trim()?void 0:JSON.parse(ne);if(!oe&&(ge===null||typeof ge!="object"||Array.isArray(ge)))throw new Error("invalid");if(D==="headers"&&Object.values(ge).some(P=>typeof P!="string"))throw new Error("invalid");p(P=>({...P,[D]:""})),D==="extract"?B(D,ge):F(D,oe?ge===void 0?void 0:ne:ge)}catch{p(oe=>({...oe,[D]:n("customBalanceInvalidJson")}))}},K=(D,ne,oe,ge)=>!b&&a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,n(ne)),ge&&a("span",{className:"cm-hint"},n(ge)),a("textarea",{className:"cm-input",rows:oe,value:x[D],onChange:P=>ae(D,P.target.value)}),y[D]?a("span",{className:"cm-hint err"},y[D]):null),$=D=>{N(D);const ne=D.split(/[\s,;]+/).map(oe=>oe.trim()).filter(oe=>oe.length>0);B("allowedHosts",ne)},[M,T,le]=dt(n,()=>(w.customBalances??[])[l]?.enabled!==!0?Promise.resolve({ok:!1,message:n("quotaEnableFirst")}):o.refreshCustomBalance(l)),Le=R!==null&&R.status==="ok"?a(E,null,w.balance?.showProgressBar===!0&&!u?a("div",{className:"cm-budget",style:{marginTop:"8px"}},a(Jt,{segments:$t(t,w,R,s),direction:ie(w,"balance")}),a("div",{className:"cm-bal-line"},ea(R,w,n,t,s))):a("div",{className:"cm-bal-line"},n("customBalanceRemaining",{amount:Fe(R.remaining,w,R,s)}))):R!==null&&R.status==="error"?a("div",{className:"cm-bal-line err"},R.message||n("unknownError")):a("div",{className:"cm-bal-line"},R?.message||n("balanceNotQueried")),pt=a(E,null,a("p",{className:"cm-note"},n(u?"tokenRhythmBalanceNote":c?"aliyunBalanceNote":"customBalanceConfigNote")),!u&&a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:s.convertToDisplayCurrency===!0,disabled:at(w,R,s)!=="USD",onChange:D=>B("convertToDisplayCurrency",D.target.checked)}),n("customBalanceConvert")),!u&&a("p",{className:"cm-note"},n("customBalanceConvertNote")),a("div",{className:"cm-grid"},[["label","customBalanceLabelZh"],["labelEn","customBalanceLabelEn"]].map(([D,ne])=>a("div",{key:D,className:"cm-field"},a("label",null,n(ne)),a("input",{className:"cm-input",value:s[D]??"",onChange:oe=>B(D,oe.target.value)}))),!b&&a("div",{className:"cm-field"},a("label",null,n("customBalanceUnitLabel")),a("select",{className:"cm-input",value:["CNY","EUR","CREDITS"].includes(s.unit)?s.unit:"USD",onChange:D=>B("unit",D.target.value)},a("option",{value:"USD"},"USD ($)"),a("option",{value:"CNY"},"CNY (¥)"),a("option",{value:"EUR"},"EUR (€)"),a("option",{value:"CREDITS"},"CREDITS"))),a("div",{className:"cm-field"},a("label",null,n("customBalanceDisplayLabel")),a("select",{className:"cm-input",value:s.display??"both",onChange:D=>B("display",D.target.value)},...ha(n))),a("div",{className:"cm-field"},a("label",null,n("customBalanceRefreshInterval")),Ge({value:s.refreshMinutes??15},D=>B("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(D)))))),!b&&a("div",{className:"cm-field"},a("label",null,n("customBalanceMethod")),a("select",{className:"cm-input",value:s.request?.method??"GET",onChange:D=>F("method",D.target.value)},a("option",{value:"GET"},"GET"),a("option",{value:"POST"},"POST"))),!b&&a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,n("customBalanceUrl")),a("input",{className:"cm-input",value:s.request?.url??"",placeholder:"/plugins/dsh-workbuddy-connect/status",onChange:D=>F("url",D.target.value)}),a("span",{className:"cm-hint"},n("customBalanceUrlHint"))),K("headers","customBalanceHeaders",5,"customBalanceHeadersVarNote"),!["GET","HEAD"].includes((s.request?.method??"GET").toUpperCase())&&K("body","customBalanceBody",5,"customBalanceBodyNote"),a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,u?"Token Rhythm Cookie":n("customBalanceCredentialsTitle")),G.length>0?a(E,null,!b&&a("span",{className:"cm-hint"},n("customBalanceCredentialsHint")),G.map(D=>a(tt,{key:"cb-var-"+D,target:"customVar:"+D,configured:(t.customVarStatus?.[D]?.configured??!1)===!0,source:t.customVarStatus?.[D]?.source??"",t:n,api:o,placeholder:u?"tr_session=…":"{{"+D+"}}"}))):a("span",{className:"cm-hint"},n("customBalanceNoPlaceholders"))),!b&&a("div",{className:"cm-field",style:{gridColumn:"1 / -1"}},a("label",null,n("customBalanceAllowedHosts")),a("input",{className:"cm-input",value:C,placeholder:"api.example.com, relay.example.org",onChange:D=>$(D.target.value)}),a("span",{className:"cm-hint"},n("customBalanceAllowedHostsHint"))),!b&&a("label",{className:"cm-check",style:{gridColumn:"1 / -1"}},a("input",{type:"checkbox",checked:s.allowInsecureHttp===!0,onChange:D=>B("allowInsecureHttp",D.target.checked)}),n("customBalanceHttp")),K("extract","customBalanceExtract",8)));return a(Ot,{name:`#${l+1} · `+(Xt(s,H(w))||n("customBalanceTitle")),enabled:j,saved:JSON.stringify(s)===JSON.stringify(w.customBalances?.[l])?w.customBalances[l]:null,busy:M,open:g,statusNode:Le,configNode:pt,errorMsg:T,onToggle:D=>B("enabled",D),onRefresh:le,onRemove:r?d:null,onToggleOpen:A,t:n})}function zs({config:e,draft:t,setDraft:o,t:n,api:s}){const l=t?.goQuota??e.goQuota,r=(i,d)=>{t&&o({...t,goQuota:{...l,[i]:d}})};return a(E,null,[["display","goQuotaDisplayLabel"],["main","goMainLabel"]].map(([i,d])=>a("div",{key:i,className:"cm-field"},a("label",null,n(d)),a("select",{className:"cm-input",value:i==="display"?ia(l,(t??e).quotaStrip,"go"):l[i],onChange:c=>i==="display"?t&&o({...t,goQuota:{...l,...ca(c.target.value)}}):r(i,c.target.value)},i==="display"?ua(n):["rolling","weekly","monthly"].map((c,u)=>a("option",{key:c,value:c},n(["goWindowRolling","goWindowWeekly","goWindowMonthly"][u])))))),a("div",{className:"cm-field"},a("label",null,n("goQuotaRefreshIntervalLabel")),Ge({value:l.refreshMinutes},i=>r("refreshMinutes",Math.min(1440,Math.max(1,Math.floor(i)))))),a("label",null,n("goQuotaKeyLabel")),a(tt,{target:"goQuota",configured:e.goQuota?.keyConfigured===!0,source:e.goQuota?.keySource,t:n,api:s,placeholder:"sk-…"}))}function Ys(e){const{state:t,api:o,t:n,draft:s,setDraft:l}=e,[r,i]=O(!1),d=t.goQuota,c=t.config,u=s?.goQuota?.enabled??c.goQuota?.enabled??!0,b=(p,k)=>{s!==null&&l({...s,goQuota:{...s.goQuota??c.goQuota,[p]:k}})},[g,f,m]=dt(n,()=>o.refreshGoQuota()),x=c.goQuota?.main==="weekly"||c.goQuota?.main==="monthly"?c.goQuota.main:"rolling",h=[x,...["rolling","weekly","monthly"].filter(p=>p!==x)],C=p=>p==="rolling"?"goWindowRolling":p==="weekly"?"goWindowWeekly":"goWindowMonthly",N=p=>p==="rolling"?d.rolling:p==="weekly"?d.weekly:d.monthly,y=u===!1?a("p",{className:"cm-note"},n("goQuotaDisabledNote")):d.status==="ok"?a("div",{className:"cm-go-list"},h.map(p=>xa(n,n(C(p)),N(p),ie(c,"go"),p===x)),a("div",{className:"cm-go-time"},n("goQuotaFetchedAt",{time:d.fetchedAt>0?new Date(d.fetchedAt).toLocaleTimeString():"—"}))):d.status==="error"?a("div",{className:"cm-bal-line err"},d.message||n("unknownError")):d.status==="off"&&d.message?a("p",{className:"cm-note"},d.message):a("div",{className:"cm-bal-line"},n("goQuotaNotQueried"));return a(Ot,{name:n("goQuotaTitle"),enabled:u,saved:c.goQuota,busy:g,open:r,statusNode:y,errorMsg:f,configNode:a(zs,{config:c,draft:s,setDraft:l,t:n,api:o}),onToggleOpen:()=>i(p=>!p),onToggle:p=>b("enabled",p),onRefresh:m,t:n})}const Vs=(e,t)=>{if(typeof e?.keyVar=="string"&&e.keyVar.length>0)return e.keyVar;const n="CLIPROXYAPI_MANAGEMENT_KEY_"+(String(e?.id??"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"GATEWAY");return Object.keys(t??{}).find(s=>s===n||s.startsWith(n+"_"))??n};function $s(e){const{state:t,api:o,t:n,draft:s,setDraft:l,index:r}=e,i=t.config,c=(s??i).gatewayQuotas?.sources??[],u=c[r]??{},g=(Array.isArray(t.gatewayQuotas)?t.gatewayQuotas:[]).find(A=>A.id===u.id)??{id:u.id,status:"off",accounts:[],unsupportedProviders:[]},f=Vs(u,t.customVarStatus),[m,x]=O(!1),[h,C,N]=dt(n,()=>o.refreshGatewayQuota(u.id)),y=A=>{s!==null&&l({...s,gatewayQuotas:{...s.gatewayQuotas??i.gatewayQuotas??{},sources:A}})},p=A=>y(c.map((B,F)=>F===r?{...B,...A}:B)),k=(A,B,F)=>a("div",{className:"cm-field"},a("label",null,A),a("input",{className:"cm-input","aria-label":A,value:B??"",onChange:F})),w=(A,B)=>{const F=lt(A?.label||A?.id||n("gatewaySourceUnknown"),A,ie(i,"plan"),n);return a(E,{key:A?.id||B},F.row,A?.resetsAt?a("div",{className:"cm-note"},st(A,n)):null)},v=(A,B)=>a("div",{key:A.id||B,className:"cm-mm-row wide"},a("span",{className:"cm-bbox-label"},A.label||"package"),a("span",{className:"cm-bbox-pct cm-num"},(A.used??"—")+" / "+(A.limit??"—")),a("span",{className:"cm-bbox-pct cm-num"},(A.remaining??"—")+" remaining")),R=A=>A==null?null:a(E,null,a("div",{className:"cm-mm-row wide"},a("span",{className:"cm-bbox-label"},A.unit||"credits"),a("span",{className:"cm-bbox-pct cm-num"},(A.used??"—")+" / "+(A.limit??"—")),a("span",{className:"cm-bbox-pct cm-num"},(A.remaining??"—")+" remaining")),(A.packages??[]).map(v)),j=(A,B)=>a("div",{key:A.id||B,className:"cm-budget",style:{marginTop:"8px",padding:"10px 12px"}},a("div",{className:"cm-budget-head"},a("strong",null,(La[A.provider]??A.provider??n("gatewaySourceUnknown"))+" · "+(A.label||n("gatewaySourceUnknown"))),a("span",{className:"cm-hint"},A.status)),A.plan?a("div",{className:"cm-note"},A.plan):null,A.windows.length>0?a("div",{className:"cm-go-list"},A.windows.map(w)):null,R(A.credits),A.message?a("div",{className:"cm-note"},A.message):null);return a(Ot,{name:u.label||u.id||n("gatewayQuotaTitle"),enabled:u.enabled===!0,saved:i.gatewayQuotas?.sources?.find(A=>A.id===u.id),busy:h,open:m,errorMsg:C,statusNode:a("div",{className:"cm-note"},n("gatewaySourceStatus")+": "+(g.status??n("gatewaySourceUnknown"))+(g.serverVersion?" · "+g.serverVersion:"")+(g.fetchedAt>0?" · "+n("gatewaySourceFetchedAt",{time:new Date(g.fetchedAt).toLocaleTimeString()}):"")+(g.message?" · "+g.message:"")),configNode:a(E,null,a("div",{className:"cm-grid"},k(n("gatewaySourceLabel"),u.label,A=>p({label:A.target.value})),k(n("gatewaySourceBaseURL"),u.baseURL,A=>p({baseURL:A.target.value})),a("div",{className:"cm-field"},a("label",null,n("gatewaySourceDisplay")),a("select",{className:"cm-input",value:u.display??"both",onChange:A=>p({display:A.target.value})},...ha(n))),a("div",{className:"cm-field"},a("label",null,n("gatewaySourceRefreshInterval")),Ge({value:u.refreshMinutes??15},A=>p({refreshMinutes:Math.min(1440,Math.max(1,Math.floor(A)))}))),k(n("gatewaySourceAllowlist"),(u.allowedHosts??[]).join(", "),A=>p({allowedHosts:A.target.value.split(/[\s,;]+/).filter(Boolean)})),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:u.allowInsecureHttp===!0,onChange:A=>p({allowInsecureHttp:A.target.checked})}),a("span",null,n("customBalanceHttp"))),a("label",{className:"cm-check"},a("input",{type:"checkbox",checked:u.antigravityOnlyGemini===!0,onChange:A=>p({antigravityOnlyGemini:A.target.checked})}),a("span",null,n("gatewayOnlyGemini")))),f?a("div",{className:"cm-field"},a("label",null,n("gatewaySourceCredential")),a(tt,{target:"customVar:"+f,configured:t.customVarStatus?.[f]?.configured===!0,source:t.customVarStatus?.[f]?.source??"",t:n,api:o,placeholder:f})):null,g.unsupportedProviders.length>0?a("div",{className:"cm-note"},n("gatewaySourceUnsupported")+": "+g.unsupportedProviders.join(", ")):null,g.accounts.length>0?g.accounts.map(j):a("div",{className:"cm-bal-line"},n("gatewaySourceNoAccounts"))),onToggle:A=>p({enabled:A}),onRefresh:N,onRemove:()=>y(c.filter((A,B)=>B!==r)),onToggleOpen:()=>x(A=>!A),t:n})}const De=[{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:"clinepass",labelKey:"codingPlanClinepass"},{id:"scnet",labelKey:"codingPlanScnet"},{id:"volcengine",labelKey:"codingPlanVolcengine"},{id:"qwen",labelKey:"codingPlanQwen"},{id:"mimo",labelKey:"codingPlanMimo"},{id:"workbuddy",labelKey:"wbT"},{id:"factory",labelKey:"codingPlanFactory"}];let Tn;function Js(){return Tn??=ve.async("./client.plan-settings.js").then(e=>e.mount({useQuotaRefresh:dt,miniMaxWindowsOf:na,MiniMaxPlanCard:oa,barDirectionOf:ie,quotaWindowRow:xa,codingPlanWindowLabel:We,codingPlanWindowEntries:Mt,numInput:Ge,CredentialField:tt,QuotaCard:Ot,resolveLocale:H,formatMoneyUsd:W,quotaPlacementValue:ia,quotaPlacementPatch:ca,quotaPlacementOptions:ua})).catch(e=>{throw Tn=null,e})}function Zs(e){return a(be,{...e,load:Js})}function Xs(e){const{state:t,api:o,t:n,draft:s,setDraft:l}=e,r=t.config,i=s??r,d=i.codingPlans??{},c=i.gatewayQuotas?.sources??[],u=s?.customBalances??r.customBalances??[],b=y=>{s!==null&&l({...s,customBalances:y,...y.length===0?{customBalance:{...r.customBalance??{},enabled:!1,request:{url:"",headers:{}}}}:{}})},g=fe({next:0,keys:[]}).current;for(;g.keys.length<u.length;)g.keys.push(g.next++);g.keys.length=u.length;const f=y=>{g.keys.splice(y,1),b(u.filter((p,k)=>k!==y))},m=(y,p)=>b(u.map((k,w)=>w===y?{...k,...p}:k)),x=(y="custom")=>{if(!(u.length>=8)){if(y==="workbuddy2api"){b([...u,{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}b([...u,{...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:[]}])}},h=()=>{c.length>=4||s===null||l({...s,gatewayQuotas:{...s.gatewayQuotas??r.gatewayQuotas??{},sources:[...c,{id:"gateway-"+Date.now().toString(36),type:"cliproxyapi",label:"CLIProxyAPI",baseURL:"http://127.0.0.1:8317",enabled:!1,display:"both",refreshMinutes:15,includeProviders:Ut,allowedHosts:[],allowInsecureHttp:!1}]}})},C=[...c.map((y,p)=>({kind:"gateway",key:"gw-"+(y.id??p),index:p,enabled:y.enabled===!0})),{kind:"go",key:"go",enabled:i.goQuota?.enabled!==!1},...De.map(y=>({kind:"plan",key:"plan-"+y.id,planId:y.id,labelKey:y.labelKey,enabled:d[y.id]?.enabled===!0})),...u.map((y,p)=>({kind:"custom",key:"cb-"+g.keys[p],index:p,enabled:y.enabled===!0}))],N=y=>y.kind==="plan"?a(Zs,{key:y.key,planId:y.planId,labelKey:y.labelKey,targeted:y.planId===e.targetPlan,state:t,api:o,t:n,draft:s,setDraft:l}):y.kind==="go"?a(Ys,{key:y.key,state:t,api:o,t:n,draft:s,setDraft:l}):y.kind==="gateway"?a($s,{key:y.key,index:y.index,state:t,api:o,t:n,draft:s,setDraft:l}):a(Ks,{key:y.key,state:t,api:o,t:n,entry:u[y.index],index:y.index,canRemove:!0,onPatch:p=>m(y.index,p),onRemove:()=>f(y.index)});return a("div",null,a("p",{className:"cm-note"},n("quotaSectionNote")),a("div",{className:"cm-quota-list"},Gs(C).map(N)),a("div",{className:"cm-buttons"},a("button",{className:"cm-btn small",onClick:h,disabled:c.length>=4},n("gatewaySourceAdd")),a("button",{className:"cm-btn small",onClick:()=>x(),disabled:u.length>=8},n("customBalanceAdd")),a("button",{className:"cm-btn small",onClick:()=>x("aliyun"),disabled:u.length>=8},n("aliyunBalanceAdd")),a("button",{className:"cm-btn small",onClick:()=>x("tokenrhythm"),disabled:u.length>=8},n("tokenRhythmBalanceAdd")),a("button",{className:"cm-btn small",onClick:()=>x("workbuddy2api"),disabled:u.length>=8},n("workBuddyBalanceAdd")),a("p",{className:"cm-note"},n("workBuddyBalanceNote"))))}const el=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Rn=e=>(e.input??0)+(e.output??0)+(e.cacheRead??0)+(e.cacheWrite??0);function Dt(e){const t=e.useCost?e.useCost(p=>p):void 0,o=e.state??t?.state;if(!o)return null;const n=o.config,s=H(n),l=e.t??z(s),r=Array.isArray(o.history)?o.history:[];if(r.length===0)return a("div",null,a("h3",{className:"cm-h"},l("usageTitle")),a("p",{className:"cm-empty"},l("usageEmpty")));const i=o.meta?.dayKey??"",d=new Map(r.map(p=>[p.date,p])),c=p=>{const k=w=>String(w).padStart(2,"0");return p.getFullYear()+"-"+k(p.getMonth()+1)+"-"+k(p.getDate())},u=new Date;u.setHours(0,0,0,0);const b=new Date(u);b.setDate(b.getDate()+(6-(u.getDay()+6)%7));const g=26,f=[],m=[];let x=-1;for(let p=g-1;p>=0;p-=1){for(let w=0;w<7;w+=1){const v=new Date(b);v.setDate(v.getDate()-(p*7+(6-w)));const R=d.get(c(v));f.push(R!==void 0?{day:R,tokens:Rn(R)}:{day:{date:c(v)},tokens:0})}const k=new Date(b);k.setDate(k.getDate()-(p*7+6)),m.push(k.getMonth()!==x?s==="en"?el[k.getMonth()]:String(k.getMonth()+1)+"月":""),x=k.getMonth()}const h=Math.max(...f.map(p=>p.tokens),1),C=p=>{const k=p/h;return k<.25?1:k<.5?2:k<.75?3:4},N=p=>{const{day:k,tokens:w}=p,v="cm-ug-cell"+(w>0?" l"+C(w):"")+(k.date===i?" today":""),R=l("usageDay",{date:k.date,tokens:L(w),input:L(k.input??0),cache:L((k.cacheRead??0)+(k.cacheWrite??0)),output:L(k.output??0),calls:k.calls??0,cost:W(Q(k,n),n)});return a(J,{key:k.date,label:R,side:"top",delayMs:200},a("div",{className:v}))},y=o.total;return a("div",{className:"cm-ug"},a("h3",{className:"cm-h"},l("usageTitle")),a("div",{className:"cm-ug-total"},l("usageTotal",{tokens:L(Rn(y)),input:L(y.input??0),cache:L((y.cacheRead??0)+(y.cacheWrite??0)),output:L(y.output??0),calls:y.calls??0})),a("div",{className:"cm-ug-grid",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},f.map(N)),a("div",{className:"cm-ug-months",style:{gridTemplateColumns:"repeat("+g+",1fr)"}},m.map((p,k)=>a("span",{key:"m"+String(k),className:"cm-ug-monthc"},p))))}function Bn(e){return e.ready?a(be,{...e,load:e.api.loadCodex,quiet:e.view==="prompt"}):null}function tl(e){const t=e.useCost?.(n=>n),o=t?.state;return a(Bn,{...e,state:o,view:"prompt",ready:o?.codexCompat?.enabled===!0&&o?.codexCompat?.promptDue,locale:t?.locale})}const al=!1;function nl(e){const t=e.useCost?.(o=>o);return a(be,{state:t?.state,snapshot:t,api:e.api,load:e.api.loadSettingsOverview,helpers:{makeT:z,Card:it,BillingAccuracyNote:Cn,displayCostOf:Q,quotaWindowRow:xa,codingPlanWindowLabel:We,formatBalanceMoney:je,formatCustomBalanceMoney:Fe,CODING_PLAN_ROWS:De,UsagePanel:Dt,TodaySessions:vn,BudgetBoxContent:Tt,useCodexQuota:Pt,codingPlanWindowEntries:Mt}})}function On(e){const t=e.useCost?e.useCost(P=>P):void 0,o=e.api,n=t?.state??null,[s,l]=O(null),[r,i]=O(null),[d,c]=O(!1),[u,b]=O(!1),[g,f]=O(!1),[m,x]=O(!1),[h,C]=O("models"),[N,y]=O("overview"),p=n?.codexCompat?.installed===!0&&n?.codexCompat?.enabled===!0,k=N==="export"?"statistics":N==="codex"&&!p?"overview":N;V(()=>{p||y(P=>P==="codex"?"overview":P)},[p]);const[w,v]=O(null),[R,j]=O({status:"idle",at:0,error:null}),A=Ae.useRef(null),B=Ae.useRef(null),F=Ae.useRef(null),G=Ae.useRef(Promise.resolve()),ae=Ae.useRef(0),K=Ae.useRef(null);V(()=>()=>{K.current?.()},[]),V(()=>{if(n!==null){const P=JSON.stringify(n.config);l(_=>{const ye=_!==null&&JSON.stringify(_)!==A.current;return ye||(B.current=n.config,F.current=n.config),ye?{..._,activeLocale:n.config.activeLocale}:JSON.parse(P)}),A.current=P}},[n]),V(()=>{s!==null&&F.current===null&&B.current!==null&&(F.current=B.current)},[s]),V(()=>{const P=++ae.current;if(s===null||o===void 0)return;const _=JSON.stringify(s);if(_===A.current){K.current=null;return}j(ce=>ce.status==="saving"?ce:{...ce,status:"saving"});const ye=()=>{G.current=G.current.catch(()=>{}).then(async()=>{if(P!==ae.current)return;const ce={},pe=F.current??B.current;if(pe!==null&&typeof pe=="object")for(const re of Object.keys(s))re==="activeLocale"||s[re]===pe[re]||JSON.stringify(s[re])!==JSON.stringify(pe[re])&&(ce[re]=s[re]);if(Object.keys(ce).length===0){A.current=_,j({status:"saved",at:Date.now(),error:null});return}try{await o.updateConfig(ce),A.current=_,pe!==null&&typeof pe=="object"&&(F.current={...pe,...ce}),P===ae.current&&j({status:"saved",at:Date.now(),error:null})}catch(re){P===ae.current&&j({status:"error",at:0,error:re?.message??String(re)})}})};K.current=ye;const xe=setTimeout(ye,120);return()=>{clearTimeout(xe)}},[s,o]),V(()=>{n!==null&&t?.status==="error"&&t.error&&i({kind:"err",text:M("ledgerReadFailed",{message:t.error})})},[t?.status,t?.error]);const $=H({...s??n?.config,activeLocale:t?.locale}),M=z($);if(t===void 0||n===null)return a("div",{className:"cm-section"},a("p",{className:"cm-empty"},t?.status==="loading"?M("readingLedger"):M("ledgerUnavailable")),t?.error&&a("p",{className:"cm-err",role:"alert"},M("ledgerReadFailed",{message:t.error})),a("button",{className:"cm-btn",disabled:t?.status==="loading"||!o?.reload,onClick:o?.reload},M("refresh")));const T=n.config,le=async()=>{if(!m){x(!0),i(null);try{const P=await o.fetchPrices();if(i({kind:P.ok?"ok":"err",text:P.message}),P.ok&&P.state&&typeof P.state.config=="object"){const _=JSON.stringify(P.state.config);l(JSON.parse(_)),A.current=_}}catch(P){i({kind:"err",text:M("syncFailed",{message:P?.message??String(P)})})}finally{x(!1),c(!1)}}},Le=async()=>{if(!m){x(!0);try{await o.resetHistory(),i({kind:"ok",text:M("historyCleared")})}catch(P){i({kind:"err",text:M("clearFailed",{message:P?.message??String(P)})})}finally{x(!1),b(!1)}}},pt=async()=>{if(!m){x(!0),i(null);try{const P=await o.importLegacyHistory();i({kind:"ok",text:P.message})}catch(P){i({kind:"err",text:M("legacyImportFailed",{message:P?.message??String(P)})})}finally{x(!1),f(!1)}}},D=(P,_)=>{s!==null&&l({...s,[P]:_})},ne=[["overview",M("tabOverview")],["statistics",$==="en"?"Cost statistics":"计费统计"],["quotas",M("tabQuotas")],["usage",M("tabUsage")],["pricing",M("tabPricing")],...p?[["codex","Codex"]]:[],["display",M("tabDisplay")]],oe=P=>ma({statistics:o.loadStatistics,pricing:o.loadOpenRouter,codex:o.loadCodex}[P],{state:n}),ge=R.status==="saving"?a("span",{className:"cm-hint"},M("saving")):R.status==="error"?a("span",{className:"cm-msg err"},M("autoSaveFailed",{message:R.error??""})):a("span",{className:"cm-hint"},R.status==="saved"?M("autoSavedAt",{time:new Date(R.at).toLocaleTimeString()}):M("autoSaveHint"));return a("div",{className:"cm-section"},a("div",{className:"cm-tabs-row"},a("div",{className:"cm-tabs",role:"tablist"},ne.map(([P,_])=>a("button",{key:P,type:"button",role:"tab","aria-selected":String(k===P),className:"cm-tab"+(k===P?" active":""),onMouseEnter:()=>oe(P),onFocus:()=>oe(P),onClick:()=>y(P)},_))),ge),a(be,{state:n,api:o,load:o.loadCommunity,locale:$,quiet:!0}),ka(r),k==="statistics"?a(be,{state:n,api:o,autoExport:N==="export"}):null,k==="overview"?a(E,{key:"overview"},a("div",{className:"cm-overview-grid"},a("div",{className:"cm-cards",style:{"--cm-overview-count":T.hideTodayCost===!0?2:3}},T.hideTodayCost===!0?null:a(it,{title:M("cardToday"),value:W(Q(n.today,T),T),sub:M("callsTokens",{calls:n.today.calls,input:L(n.today.input),cache:L(n.today.cacheRead+n.today.cacheWrite),output:L(n.today.output)})}),a(it,{title:M("cardMonth"),value:W(Q(n.month,T),T),sub:M("callsTokens",{calls:n.month.calls,input:L(n.month.input),cache:L(n.month.cacheRead+n.month.cacheWrite),output:L(n.month.output)})}),a(it,{title:M("cardTotal"),value:W(Q(n.total,T),T),sub:M("cardTotalSub",{calls:n.total.calls})}))),a(Ts,{state:n,t:M}),a("p",{className:"cm-note",key:"cards-footnote"},M("cardsFootnote")),a(Cn,{state:n}),(()=>{const P=To(n);return P!==null?a("p",{className:"cm-note",key:"tz-hint"},M("timezoneHint",{host:P.hostLabel,browser:P.browserLabel})):null})(),a("label",{className:"cm-cards-toggle",title:M("cardsTogglePlanTotalHint")},a("input",{type:"checkbox",checked:(s??T).showTotalWithPlan===!0,onChange:P=>{const _=s??T;_!=null&&l({..._,showTotalWithPlan:P.target.checked})}}),a("span",null,M("cardsTogglePlanTotal"))),a("div",null,a("button",{className:"cm-btn",onClick:()=>y("export")},$==="en"?"Export cost records":"导出费用记录"),a("h3",{className:"cm-h"},M("todaySessions")),a(vn,{state:n,t:M})),a(Ls,{state:n,draft:s,setDraft:l,t:M}),(T.balance?.display==="settings"||T.balance?.display==="both")&&T.hideOfficialBalance!==!0?a(Ws,{state:n,api:o,t:M,draft:s,setDraft:l}):null):null,k==="quotas"?a(Xs,{key:"quotas",state:n,api:o,t:M,draft:s,setDraft:l,targetPlan:w}):null,k==="usage"?a(E,{key:"usage"},!ft||(T.usage?.position??"cost")==="cost"?a(Dt,{state:n,t:M,locale:$}):null,a(Qs,{state:n,config:s??T,t:M,draft:s,setDraft:l}),a(Fs,{state:n,config:s??T,t:M}),a(Rs,{state:n,api:o}),a(Os,{state:n,api:o}),a(be,{state:n,api:o,load:o.loadBillingStorage,draft:s,setDraft:l,locale:$,disabled:R.status==="saving"||(s??T).billingStorageRetentionDays!==T.billingStorageRetentionDays}),a("div",null,a("h3",{className:"cm-h"},M("historyDataTitle")),a("div",{className:"cm-buttons"},g?a(E,null,a("span",{className:"cm-hint"},M("confirmImportLegacy")),a("button",{className:"cm-btn",onClick:pt,disabled:m},M("apply")),a("button",{className:"cm-btn",onClick:()=>f(!1)},M("cancel"))):a("button",{className:"cm-btn",onClick:()=>f(!0),disabled:m},M("importLegacy")),u?a(E,null,a("span",{className:"cm-hint"},M("confirmReset")),a("button",{className:"cm-btn danger",onClick:Le,disabled:m},M("confirmClear")),a("button",{className:"cm-btn",onClick:()=>b(!1)},M("cancel"))):a("button",{className:"cm-btn danger",onClick:()=>b(!0),disabled:m},M("clearAllHistory"))),a("p",{className:"cm-note"},M("legacyImportNote")))):null,k==="codex"?a(Bn,{key:"codex",state:n,api:o,t:M,locale:$,view:"panel",ready:p}):null,k==="display"?a(E,{key:"display"},n?.secretMigration?.pending?.length>0?a(Bo,{pending:n.secretMigration.pending,t:M}):null,a(be,{state:{...n,displayPreviewCodex:U.source===(n.config.codexQuotaSource??"auto")?ra():{status:"idle",windows:{}}},api:o,load:o.loadDisplay,draft:s,setDraft:l,t:M,locale:$,numInput:Ge,displayOptions:ha,quotaPlacementValue:ia,quotaPlacementPatch:ca,quotaPlacementOptions:ua,CURRENCY_PRESETS:Ds,USAGE_POSITION_SWITCHABLE:ft,formatMoneyUsd:W,planOptions:De.map(P=>[P.id,M(P.labelKey)]),onNavigate:(P,_)=>{v(_),y(P)},renderSidebar:(P,_=n)=>Rt({..._,config:P},!0,void 0,!0),renderCorner:P=>a(cn,{useCost:()=>({state:P})}),renderStyleSample:(P,_=n,ye=!0)=>{if(!ye)return Rt({..._,config:P},!0,void 0,!0);const xe=P.sidebarSimple===!0,ce={...P,peakNotice:!1,hideBudget:!1,hideTodayCost:!1,budget:{...P.budget,enabled:!0,amount:Number(P.budget?.amount)>0?P.budget.amount:100}},pe={..._,config:ce},re=na(_.codingPlans?.minimax?.windows??{});return a("div",{className:"cm-footer-stack"+(xe?" simple":P.sidebarStyle==="compact"?" compact":"")},a(Tt,{state:pe,wide:!0,summary:xe}),a(oa,{five:re.five??{percent:24},seven:re.seven??{percent:18},fetchedAt:0,t:M,wide:!0,direction:ie(P,"plan")}))}})):null,k==="pricing"?a("div",{key:"pricing",className:"cm-pricing-page"},a("div",{className:"cm-pricing-heading"},a("div",null,a("h3",{className:"cm-h"},$==="en"?"Pricing":"价格设置"),a("p",{className:"cm-note"},$==="en"?"New prices apply to future calls. Historical costs keep their original rates.":"价格修改用于后续调用,历史费用沿用原价格。")),a("span",{className:"cm-pricing-unit"},$==="en"?"Per 1M tokens":"每百万 Token")),a("div",{className:"cm-pricing-nav",role:"tablist","aria-label":$==="en"?"Pricing sections":"价格分区"},[["models","模型定价","Model pricing"],["catalog","参考价格表","Price tables"],["tools","同步与规则","Sync & rules"]].map(([P,_,ye])=>a("button",{key:P,id:"cm-pricing-"+P,type:"button",role:"tab","aria-selected":h===P,"aria-controls":"cm-pricing-panel",tabIndex:h===P?0:-1,className:"cm-pricing-nav-item"+(h===P?" active":""),onClick:()=>C(P),onKeyDown:xe=>{const ce=["models","catalog","tools"],pe=xe.key==="ArrowRight"?1:xe.key==="ArrowLeft"?-1:0;if(pe){xe.preventDefault();const re=ce[(ce.indexOf(P)+pe+3)%3];C(re),xe.currentTarget.parentElement.querySelector("#cm-pricing-"+re)?.focus()}}},$==="en"?ye:_))),a("div",{id:"cm-pricing-panel",className:"cm-pricing-content",role:"tabpanel","aria-labelledby":"cm-pricing-"+h},h==="models"?a(be,{state:n,api:o,load:o.loadPricing,mode:"matching",draft:s,setDraft:l,t:M,locale:$,resolveClientPrice:Ka,prettyProviderKey:ut,setField:D,priceEditor:{PriceInput:An,priceFactor:yt,setPriceFactor:Bt,multiplierOptions:ga,priceMultiplierSettings:gt,priceAt:Ze}}):null,h==="catalog"?a("div",{className:"cm-pricing-catalog"},a("h3",{className:"cm-h"},M("priceTableTitle")),a(be,{state:n,api:o,load:o.loadPricing,mode:"catalog",draft:s,setDraft:l,t:M,locale:$,vendorLabels:js,priceEditor:{priceAt:Ze,priceFactor:yt},renderEditor:(P,_,ye)=>P==="deepseek"?a(Is,{modelId:_==="__default__"?M("defaultModelId"):_,entry:ye,isDefault:_==="__default__",draft:s,setDraft:l,t:M}):a(_s,{provider:P,modelId:_,entry:ye,draft:s,setDraft:l,t:M,api:o,lockedIds:P==="openrouter"?n.priceLockIds??[]:[],releaseDisabled:JSON.stringify(s)!==A.current})})):null,h==="tools"?a("div",{className:"cm-pricing-tools"},a("section",{className:"cm-pricing-tool"},a(Es,{state:n,draft:s,setDraft:l,t:M})),a("section",{className:"cm-pricing-tool"},a(be,{state:n,api:o,load:o.loadPricing,mode:"history",locale:$,disabled:m||JSON.stringify(s)!==A.current})),a("section",{className:"cm-pricing-tool"},a("h3",{className:"cm-h"},M("dataSync")),(s??T).currency==="CNY"&&(s??T).prices?.currency!=="CNY"?a("div",{className:"cm-note",role:"status"},M("pricingCnyHint",{rate:(s??T).exchangeRate}),(s??T).pricingCurrency!=="CNY"?a("button",{className:"cm-btn small",disabled:m,onClick:()=>D("pricingCurrency","CNY")},M("pricingCurrencyCny")):null):null,a("div",{className:"cm-field"},a("label",null,M("pricingCurrencyLabel")),a("select",{className:"cm-input",value:s?.pricingCurrency==="CNY"?"CNY":"USD",onChange:P=>D("pricingCurrency",P.target.value)},a("option",{value:"USD"},M("pricingCurrencyUsd")),a("option",{value:"CNY"},M("pricingCurrencyCny"))),a("p",{className:"cm-note"},M("pricingCurrencyNote"))),a("div",{className:"cm-buttons"},d?a(E,null,a("span",{className:"cm-hint"},M("confirmFetch")),a("button",{className:"cm-btn",onClick:le,disabled:m},M("apply")),a("button",{className:"cm-btn",onClick:()=>c(!1)},M("cancel"))):a("button",{className:"cm-btn",onClick:()=>c(!0),disabled:m},M("syncFromDocs"))),a("p",{className:"cm-note"},M("lastSync",{time:T.fetchedAt!==null?new Date(T.fetchedAt).toLocaleString():M("neverSynced")})+M("source",{source:T.priceSource==="official"?M("sourceOfficial"):M("sourceBundled")})),a("p",{className:"cm-note"},M("syncScopeNote"))),a("section",{className:"cm-pricing-tool"},a(be,{state:n,api:o,load:o.loadOpenRouter}))):null)):null,a(be,{state:n,api:o,load:o.loadCommunity,locale:$,quiet:!0,footer:!0}))}const ol=["remote"];async function sl(e){const t=e.remote;if(t===void 0||typeof t.$mount!="function")return;const o=await t.$mount(ro);e.effect(()=>()=>{o()},"cost-meter: remote contribution");const n=e.get("remote.costMeter");if(n===void 0)return;e.inject(["connection"],S=>S.effect(()=>{const I=S.get("connection")?.rpc;return la(I,()=>n.getPiAiCodexQuota(),()=>n.getChatgptSubQuota()),vt(),()=>{U.rpc===I&&(la(null),vt())}},"cost-meter: Codex quota transport"));const s=()=>{try{return ze(e.get("locale")?.getSnapshot?.().active)}catch{return null}},l=Ro({status:"loading",error:null,state:null},S=>{const I=s()||ze(S.state?.meta?.locale)||Pa();return{...S,locale:I,...S.state?{state:{...S.state,config:{...S.state.config,activeLocale:I}}}:{}}}),r=()=>z(H(l.getSnapshot().state?.config||{activeLocale:l.getSnapshot().locale})),i=async(S,I)=>{const q=await n[S](...I??[]);if(q===null||typeof q!="object"||q.ok!==!0)throw new Error(q?.error?.message??r()("rpcFailed",{method:S}));return q.value},d=S=>(l.set({status:"ready",error:null,state:S}),S);let c=Date.now(),u=!1,b=!0,g=1,f=0,m=0,x=Promise.resolve();const h=(S,I)=>{if(typeof S?.pricesRev!="string"||S.pricesRev!==I?.pricesRev)return S;const q=I?.config?.prices;return q===void 0?S:{...S,config:{...S.config,prices:q}}},C=async()=>{if(!b||u||m)return;const S=f,I=()=>b&&S===f&&m===0;u=!0,c=Date.now();const q=l.getSnapshot();q.state===null&&l.set({...q,status:"loading"});try{const X=q.state?.pricesRev,Te=await i(q.state===null?"getLocalState":typeof X=="string"?"getStateSince":"getState",typeof X=="string"?[X]:[]);if(!I())return;if(g=1,l.set({status:"ready",error:null,state:h(Te,q.state)}),q.state===null){const He=await i("getState");I()&&l.set({status:"ready",error:null,state:h(He,Te)})}}catch(X){if(!I())return;q.state===null&&(c=Date.now()),g=Math.min(g*2,60),l.set({status:"error",error:X?.message??String(X),state:l.getSnapshot().state??q.state})}finally{u=!1}};e.effect(()=>e.on("connection/reset",()=>{C()}),"cost-meter: reconnect reload");const N=setInterval(()=>{const S=l.getSnapshot().state,I=S?.config.sidebarModels,q=S?I?.enabled||I?.dock?I.refreshSeconds:60:g;!document.hidden&&Date.now()-c>=(q||60)*1e3&&C()},1e3);e.effect(()=>()=>{b=!1,clearInterval(N)},"cost-meter: poll timer");const y=()=>{b&&e.fiber?.uid!==null&&l.set(l.getSnapshot())},p=S=>S.effect(()=>{y();const I=S.get("locale")?.subscribe?.(y);return()=>{I?.(),y()}},"cost-meter: DSH locale");typeof e.inject=="function"?e.inject(["locale"],p):s()&&p(e),e.effect(()=>e.on("locale/change",y),"cost-meter: locale change"),window.addEventListener?.("languagechange",y),e.effect(()=>()=>window.removeEventListener?.("languagechange",y),"cost-meter: browser locale");const k=()=>{document.visibilityState==="visible"&&C()};document.addEventListener("visibilitychange",k),e.effect(()=>()=>{document.removeEventListener("visibilitychange",k)},"cost-meter: visibility reload");const w=async(S,I="rpcSyncFailed",q=!1)=>{const X=await S;if(X===null||typeof X!="object"||X.ok!==!0)throw new Error(X?.error?.message??(q?X?.value?.message:void 0)??r()(I));return X.value.state!==void 0&&l.set({status:"ready",error:null,state:X.value.state}),X.value},v={},R=S=>(v[S]||(v[S]=ve.async("./client."+S+".js").then(I=>I.mount(e,l,H,{formatMoneyUsd:W,displayCostOf:Q,formatTokens:L,updateConfig:q=>j.updateConfig(q)})).catch(I=>{throw delete v[S],I})),v[S]),j={loadBillingStorage:()=>R("billing-storage"),billingStorage:async S=>i("billingStorage",[Ha.parse(S)]),loadSettingsOverview:()=>R("settings-overview"),loadStatistics:()=>R("statistics"),loadOpenRouter:()=>R("openrouter"),loadCommunity:()=>R("community"),loadPricing:()=>R("pricing"),loadDisplay:()=>Promise.all([R("display"),R("sidebar-order")]).then(([S])=>S),loadCodex:()=>R("codex"),reload:C,updateConfig:async S=>{const{activeLocale:I,...q}=S;f++,m++;const X=x.catch(()=>{}).then(async()=>{const Te=await i("updateConfig",[q]);return l.set({status:"ready",error:null,state:Te}),S.planBilling&&setTimeout(()=>{C()},1500),Te});x=X;try{return await X}finally{m--,f++}},fetchPrices:async()=>w(n.fetchPrices()),releasePriceLock:async S=>{const I=await w(n.releasePriceLock(S),"rpcSyncFailed",!0);if(!I.ok)throw new Error(I.message);return I},resetHistory:async()=>{const S=await i("resetHistory");return l.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 n.importLegacyHistory();if(S===null||typeof S!="object"||S.ok!==!0)throw new Error(S?.error?.message??S?.value?.message??r()("legacyImportFailed",{message:"RPC failed"}));return S.value.state!==void 0&&l.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,I,q)=>i("getTurnCost",[S,I,q,l.getSnapshot().state?.config?.currency]),getTopSessions:async(S,I,q)=>i("getTopSessions",[S,I,q]),refreshBalance:async()=>w(n.refreshBalance(),"rpcBalanceFailed"),refreshGoQuota:async()=>w(n.refreshGoQuota()),refreshGatewayQuota:async(S=null)=>w(S==null?n.refreshGatewayQuota():n.refreshGatewayQuota(S)),refreshCustomBalance:async(S=null)=>w(S==null?n.refreshCustomBalance():n.refreshCustomBalance(S)),refreshCodingPlan:async S=>w(n.refreshCodingPlan(S)),loginCodingPlan:async S=>w(n.loginCodingPlan(S)),setCredential:async(S,I)=>w(n.setCredential(S,I),"rpcSyncFailed",!0),clearCredential:async S=>w(n.clearCredential(S),"rpcSyncFailed",!0)},A=S=>{S.target?.closest?.('[data-slot="conversation.input.model"]')&&j.loadOpenRouter().catch(()=>{})};for(const S of["pointerover","focusin"])e.effect(()=>(document.addEventListener(S,A),()=>document.removeEventListener(S,A)));C();const B=e.get("slots");if(B===void 0)return;const F=S=>{typeof B.entries=="function"&&B.entries(S).some(I=>I.locale==="dsh-context")&&j.loadStatistics().catch(()=>{})};e.on("slots/changed",F),["conversation.view","sidebar.right.pane.tab","conversation.input.overlay"].forEach(F);const G=()=>({hooks:{cost:l},api:j});B.inject("plugins.bundle.config",()=>B.register({name:"plugins.bundle.config",key:"dsh-cost-meter",inject:G},On));for(const[S,I]of[["header","conversation.session.header.actions"],["dock","conversation.composer.dock"]])B.inject(I,()=>B.register({name:I,id:"cost-meter-statistics",order:1,inject:()=>({...G(),entryPosition:S})},Ms));B.inject("conversation.chat.turnTail",()=>B.register({name:"conversation.chat.turnTail",id:"cost-meter-turn",order:10,select:S=>S,inject:G},Do));const ae=()=>({gen:0,dispose:null}),K=(S,I,q,X,Te=!0)=>{S.dispose!==null&&(S.dispose(),S.dispose=null),S.gen+=1;const He=S.gen;Te&&B.inject(I,()=>{if(S.gen!==He)return;const Re=typeof q=="function"?q():B.register(q,X);if(S.gen!==He){Re();return}return S.dispose=Re,()=>{S.dispose===Re&&(S.dispose=null),Re()}})},$=ae(),M=S=>{const I=S==="header"?"conversation.session.header.actions":"conversation.composer.dock";K($,I,S==="header"?{name:I,id:"cost-meter",order:-5,inject:G}:{name:I,id:"cost-meter",order:5,inject:G},S==="header"?Lo:Eo,S!=="off")},T=ae(),le=S=>{K(T,"sidebar.footer.action",{name:"sidebar.footer.action",id:"cost-meter",order:0,inject:G},vs,S)},Le=ae(),pt=S=>{K(Le,"conversation.composer.dock",{name:"conversation.composer.dock",id:"cost-meter-corner",order:9,inject:G},cn,S)};B.inject("conversation.input.dock",()=>B.register({name:"conversation.input.dock",id:"cost-meter-qstrip",order:5,inject:G},ks)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-simple-guide",order:1,inject:G},xs)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-peak-progress-guide",order:1,inject:G},Xo)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-summary-guide",order:1,inject:G},Zo)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-qstrip-guide",order:1,inject:G},ws)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-balance-click-guide",order:2,inject:G},Cs)),B.inject("sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-codex-compat",order:1,inject:G},tl));const D=ae(),ne=S=>{K(D,"sidebar.footer.action",()=>B.register({name:"sidebar.footer.action",id:"cost-meter-peak-alert",order:0,inject:G},Yo),null,S)};window.cmPeakAlertPreview=S=>{if(window.__cmPeakAlertLive!==!0){console.warn("[dsh-cost-meter] 弹窗组件未挂载:需启用峰谷计价并重启 dsh web 后再预览。");return}window.dispatchEvent(new CustomEvent(zo,{detail:{kind:S==="offpeak"?"offpeak":"peak"}}))};const oe=ae(),ge=S=>{K(oe,"settings.section",{name:"settings.section",id:"cost-meter",order:30,label:S==="en"?Ee.en.sectionLabel:Ee.zh.sectionLabel,inject:G},al?nl:On,!0)},P=ae(),_=S=>{K(P,"settings.general.item",{name:"settings.general.item",id:"cost-meter-usage",order:30,inject:G},Dt,S)},ye=ae(),xe=(S,I)=>{K(ye,"settings.section",{name:"settings.section",id:"cost-meter-usage",order:31,label:I==="en"?Ee.en.usageSectionLabel:Ee.zh.usageSectionLabel,inject:G},Dt,S)};let ce=null,pe=null,re=null,wa=null,Dn=null,Ln=null;const En=()=>{const S=l.getSnapshot().state;S?.config?.sessionListCosts&&R("session-list").catch(()=>{});const I=S?.config?.position??"dock",q=S?.config?.sidebar!==!1&&S?.config?.hideTodayCost!==!0,X=S?.config?.balance?.display??"both",Te=(X==="sidebar"||X==="both")&&S?.config?.hideOfficialBalance!==!0,He=jn=>jn?.enabled===!0&&["sidebar","both"].includes(jn.display),Re=q||Te||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(He)||(S?.config?.gatewayQuotas?.sources??[]).some(He)||St(S,S?.config).length>0;S?.config?.followSkinTransparency&&R("display").catch(()=>{}),Re&&ve.async&&R("sidebar-order").catch(()=>{});const Na=S?.config?.corner?.enabled===!0||S?.config?.sidebarModels?.dock===!0,Ke=H(S?.config||{activeLocale:l.getSnapshot().locale}),mt=S?.config?.usage?.position??"cost";I!==ce&&(M(I),ce=I),Re!==pe&&(le(Re),pe=Re),Na!==re&&(pt(Na),re=Na);const Sa=S?.config?.peakEnabled===!0;Sa!==Ln&&(ne(Sa),Ln=Sa),Ke!==wa&&(ge(Ke),wa=Ke),mt!==Dn?(ft&&(_(mt==="general"),xe(mt==="section",Ke)),Dn=mt):ft&&mt==="section"&&Ke!==wa&&xe(!0,Ke)};En();const In=l.subscribe(En);return e.effect(()=>()=>{In()},"cost-meter: slot sync"),In}return Lt.apply=sl,Lt.inject=ol,Ca.exports}});