@kenz1117/dsh-ui-usage-billing 1.2.9 → 1.3.0
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,6 +1,6 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:`@kenz1117/dsh-ui-usage-billing`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("react"),i=e("react-dom"),a=e("@deepseek-ai/dsh-client-ui-primitives"),o=e("react/jsx-runtime"),s=e("@deepseek-ai/dsh-client-store");function c(e){return e}function l(e){return c(e)}function u(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}let f={mode:`combined`,targets:[]},p=`dsh.ui-usage-billing.float`;function m(){let e=()=>({...f,targets:[...f.targets]});try{let t=localStorage.getItem(p);if(t===null)return e();let n=JSON.parse(t);return{mode:n.mode===`subscription`?`subscription`:`combined`,targets:Array.isArray(n.targets)?n.targets.filter(e=>typeof e==`string`):[]}}catch{return e()}}function h(e){try{localStorage.setItem(p,JSON.stringify(e))}catch{}}let g={metric:`money`,span:`day`},_=`dsh.ui-usage-billing.card`;function v(){try{let e=localStorage.getItem(_);if(e===null)return{...g};let t=JSON.parse(e);return{metric:t.metric===`tokens`?`tokens`:`money`,span:t.span===`week`||t.span===`month`?t.span:`day`}}catch{return{...g}}}function y(e){try{localStorage.setItem(_,JSON.stringify(e))}catch{}}let b=`dsh.ui-usage-billing.kpi-range`;function x(){try{let e=localStorage.getItem(b);return e===`today`||e===`7d`||e===`week`||e===`month`||e===`all`?e:`all`}catch{return`all`}}function S(e){try{localStorage.setItem(b,e)}catch{}}let C={hideUnidentified:!0},w=`dsh.ui-usage-billing.sites`;function T(){try{let e=localStorage.getItem(w);return e===null?{...C}:{hideUnidentified:JSON.parse(e).hideUnidentified!==!1}}catch{return{...C}}}function ee(e){try{localStorage.setItem(w,JSON.stringify(e))}catch{}}let E={show:!0,position:`toolbar`},D=`dsh.ui-usage-billing.livecost`,O=`dsh.ui-usage-billing.livecost-pref`;function te(){try{let e=localStorage.getItem(D);if(e===null)return{...E};let t=JSON.parse(e);return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`||t.position===`below`?t.position:E.position}}catch{return{...E}}}function k(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}let A=`dsh.ui-usage-billing.prices`;function j(){try{let e=localStorage.getItem(A);if(e===null)return[];let t=JSON.parse(e);if(t===null)return[];let n=[],r=(e,t)=>{if(typeof t!=`object`||!t)return;let r=t,i=Number(r.input),a=Number(r.cacheHit),o=Number(r.output);if(![i,a,o].every(e=>Number.isFinite(e)&&e>=0))return;let s=r.offPeak,c;if(typeof s==`object`&&s){let e=s,t=Number(e.input),n=Number(e.cacheHit),r=Number(e.output);[t,n,r].every(e=>Number.isFinite(e)&&e>=0)&&(c={input:t,cacheHit:n,output:r})}n.push({key:e,...typeof r.origin==`string`&&r.origin!==``?{origin:r.origin}:{},input:i,cacheHit:a,output:o,...c===void 0?{}:{offPeak:c},...r.currency===`USD`?{currency:`USD`}:{}})};if(Array.isArray(t))for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.key!=`string`||t.key===``||r(t.key,e)}else if(typeof t==`object`)for(let[e,n]of Object.entries(t))r(e,n);return n}catch{return[]}}function ne(e){try{localStorage.setItem(A,JSON.stringify(e))}catch{}}let re={metric:`ttft`},ie=`dsh.ui-usage-billing.perf`;function ae(){try{let e=localStorage.getItem(ie);if(e===null)return{...re};let t=JSON.parse(e);return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}catch{return{...re}}}function M(e){try{localStorage.setItem(ie,JSON.stringify(e))}catch{}}let N=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(N)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=N,e.textContent=`:root{--ds-blue:#4f8cff;--ds-cyan:#2dd4bf;--ds-green:#34d399;--ds-amber:#f59e0b;--ds-red:#ef4444;--ds-violet:#a78bfa}body{--dsb:var(--dsw-alias-bg-layer-1);--dsb-2:var(--dsw-alias-bg-layer-2);--dsb-3:var(--dsw-alias-bg-layer-3);--dsb-glass:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 78%,transparent);--dsb-glass-strong:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 88%,transparent);--ds-border:var(--dsw-alias-border-l1);--ds-border-strong:var(--dsw-alias-border-l2);--ds-hi-top:#ffffff0b;--ds-shadow-1:0 1px 0 #ffffff0a inset,0 8px 24px #00000059;--ds-shadow-2:0 1px 0 #ffffff0d inset,0 18px 48px #00000080;--ds-t-1:var(--dsw-alias-label-primary);--ds-t-2:var(--dsw-alias-label-secondary);--ds-t-3:var(--dsw-alias-label-tertiary);--ds-t-4:var(--dsw-alias-label-dimmed);--ds-c-1:#4f8cff;--ds-c-2:#2dd4bf;--ds-c-3:#a78bfa;--ds-c-4:#f59e0b;--ds-c-5:#f472b6;--ds-c-6:#fbbf24;--ds-c-7:#38bdf8;--ds-r-1:8px;--ds-r-2:12px;--ds-r-3:16px;--ds-t-fast:.16s cubic-bezier(.2,.8,.2,1)}.VWh0dG_railButton{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);width:36px;height:36px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast);flex:none;justify-content:center;align-items:center;padding:0;display:flex}.VWh0dG_railButton:hover,.VWh0dG_railButton:focus-visible{border-color:var(--ds-blue);color:var(--ds-blue);outline:none}.VWh0dG_railButton svg{width:26px;height:26px}.VWh0dG_triggerBudgetPulse{border-color:color-mix(in srgb, var(--ds-red) 55%, transparent);animation:2s ease-in-out infinite VWh0dG_budgetPulse}.VWh0dG_triggerBudgetOver{animation-duration:1.2s}@keyframes VWh0dG_budgetPulse{0%,to{box-shadow:0 1px 2px #0000000a,0 0 #ef444400}50%{box-shadow:0 1px 2px #0000000a,0 0 0 3px #ef444429}}.VWh0dG_trigger{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:100%;min-width:0;color:var(--ds-t-1);cursor:pointer;text-align:left;transition:border-color var(--ds-t-fast), transform var(--ds-t-fast), box-shadow var(--ds-t-fast);align-items:center;gap:12px;padding:10px 14px;display:flex;position:relative;overflow:hidden;box-shadow:0 1px 2px #0000000a}.VWh0dG_trigger:hover,.VWh0dG_trigger:focus-visible{border-color:var(--ds-border-strong);box-shadow:0 6px 18px -8px color-mix(in srgb, var(--ds-blue) 45%, transparent);outline:none;transform:translateY(-1px)}.VWh0dG_trigger:before{content:"";background:linear-gradient(180deg, var(--ds-hi-top), transparent);pointer-events:none;height:1px;position:absolute;top:0;left:0;right:0}.VWh0dG_trigger:after{content:"";background:linear-gradient(105deg, transparent 42%, color-mix(in srgb, var(--ds-blue) 9%, transparent) 50%, transparent 58%);opacity:0;pointer-events:none;position:absolute;inset:0;transform:translate(-110%)}.VWh0dG_trigger:hover:after,.VWh0dG_trigger:focus-visible:after{animation:.9s ease-out VWh0dG_triggerScan}@keyframes VWh0dG_triggerScan{0%{opacity:0;transform:translate(-110%)}25%{opacity:1}to{opacity:0;transform:translate(110%)}}@media (prefers-reduced-motion:reduce){.VWh0dG_triggerSparkBar,.VWh0dG_trigger:hover:after,.VWh0dG_trigger:focus-visible:after{animation:none}.VWh0dG_triggerGaugeNeedle,.VWh0dG_triggerGaugeArc{transition:none}.VWh0dG_triggerBudgetPulse{animation:none}}.VWh0dG_triggerIcon{width:32px;height:32px;color:var(--ds-blue);flex:none;justify-content:center;align-items:center;display:inline-flex}.VWh0dG_triggerIcon svg{width:30px;height:30px}.VWh0dG_triggerGaugeNeedle{transition:transform 1.1s cubic-bezier(.22,1,.36,1)}.VWh0dG_triggerGaugeArc{transition:stroke-dasharray 1.1s cubic-bezier(.22,1,.36,1)}.VWh0dG_triggerBudgetHot{color:var(--ds-red)}.VWh0dG_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.VWh0dG_triggerPrimary{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.VWh0dG_triggerLabel{color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.VWh0dG_triggerYen{color:var(--ds-t-3);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.VWh0dG_triggerMetric{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;min-width:0;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:22px;font-weight:600;line-height:26px;overflow:hidden}.VWh0dG_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.VWh0dG_triggerSparkBar,.VWh0dG_triggerSparkHot{background:var(--ds-blue);opacity:.6;border-radius:1px 1px 0 0;width:3px}.VWh0dG_triggerSparkHot{opacity:1}.VWh0dG_triggerSparkBar{animation:3.6s ease-in-out infinite VWh0dG_triggerSparkBreath}.VWh0dG_triggerSparkBar:nth-child(2n){animation-delay:-1.2s}.VWh0dG_triggerSparkBar:nth-child(3n){animation-delay:-2.4s}@keyframes VWh0dG_triggerSparkBreath{0%,to{opacity:.6}50%{opacity:.34}}.VWh0dG_triggerWrap{flex:auto;width:100%;min-width:96px;max-width:100%;display:block;position:relative;container:VWh0dG_billing-trigger/inline-size}@container VWh0dG_billing-trigger (width<=200px){.VWh0dG_trigger{gap:6px;padding:8px 10px}.VWh0dG_triggerSpark{display:none}}@container VWh0dG_billing-trigger (width<=170px){.VWh0dG_triggerLabel{display:none}}@container VWh0dG_billing-trigger (width<=110px){.VWh0dG_triggerIcon,.VWh0dG_triggerSpark,.VWh0dG_triggerLabel{display:none}.VWh0dG_trigger{justify-content:center;padding:8px 6px}}.VWh0dG_triggerPop{box-sizing:border-box;border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:256px;box-shadow:var(--ds-shadow-2);opacity:0;visibility:hidden;pointer-events:none;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear .16s;z-index:2000;flex-direction:column;gap:5px;padding:10px 12px;display:flex;position:fixed;top:0;left:0;overflow:hidden;transform:translateY(calc(4px - 100%))}.VWh0dG_triggerPop,.VWh0dG_triggerPop *{box-sizing:border-box}.VWh0dG_triggerPop:before{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.VWh0dG_triggerPopShown{opacity:1;visibility:visible;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear 0s;transform:translateY(-100%)}.VWh0dG_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.VWh0dG_popTitle{letter-spacing:.06em;text-transform:uppercase;color:var(--ds-t-3);font-size:12px;font-weight:700;line-height:18px}.VWh0dG_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 12px;display:grid}.VWh0dG_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.VWh0dG_metricLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.VWh0dG_metricValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:13px;font-weight:700;line-height:16px}.VWh0dG_metricValueSuccess{color:var(--ds-green)}.VWh0dG_popModel{border-top:1px dashed var(--ds-border);flex-direction:column;gap:6px;margin-top:9px;padding-top:10px;display:flex}.VWh0dG_popModelLabel{color:var(--ds-t-3);font-size:10px;line-height:14px}.VWh0dG_popModelRow{align-items:center;gap:8px;min-width:0;display:flex}.VWh0dG_popDot{border-radius:999px;flex:none;width:6px;height:6px}.VWh0dG_popDotDirect{background:var(--ds-green)}.VWh0dG_popDotSub{background:var(--ds-amber)}.VWh0dG_popDotNeutral{background:var(--ds-t-3)}.VWh0dG_popTagPrimary,.VWh0dG_popTagSub{white-space:nowrap;border-radius:5px;flex:none;align-items:center;height:18px;padding:0 6px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_popTagPrimary{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-blue)}.VWh0dG_popTagSub{background:color-mix(in srgb, var(--ds-amber) 18%, transparent);color:var(--ds-amber)}.VWh0dG_popModelName{color:var(--ds-t-2);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.VWh0dG_popModelStatus{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;margin-left:auto;font-size:11px;font-weight:600;line-height:16px}.VWh0dG_popModelStatusLow{color:var(--ds-red)}.VWh0dG_dashboardModal{border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-2);width:min(760px,100vw - 48px);max-height:min(760px,88vh);box-shadow:var(--ds-shadow-2);animation:.16s ease-out VWh0dG_dashboardIn}@keyframes VWh0dG_dashboardIn{0%{opacity:0;transform:translateY(4px)scale(.98)}to{opacity:1;transform:none}}div[role=presentation]:has(>.dsh-billing-modal)>div[aria-hidden=true]:first-child{backdrop-filter:blur(8px)saturate(1.25)}.VWh0dG_dashboard{flex-direction:column;width:100%;max-height:min(760px,88vh);display:flex}.VWh0dG_dashboardHead{border-bottom:1px solid var(--ds-border);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.VWh0dG_dashboardTitle{color:var(--ds-t-1);margin:0;font-size:14px;font-weight:600;line-height:20px}.VWh0dG_dashboardSubtitle{color:var(--ds-t-3);margin:2px 0 0;font-size:11px;line-height:16px}.VWh0dG_closeButton{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);width:32px;height:32px;color:var(--ds-t-2);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;flex:none;justify-content:center;align-items:center;display:inline-flex}.VWh0dG_closeButton:hover{background:var(--dsb-3);color:var(--ds-t-1)}.VWh0dG_closeButton svg{stroke-width:2px;width:16px;height:16px}.VWh0dG_dashboardBody{flex-direction:column;gap:14px;padding:16px 24px 24px;display:flex;overflow-y:auto}.VWh0dG_modalFooter{border-top:1px solid var(--ds-border);color:var(--ds-t-3);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:8px 18px;font-size:11px;line-height:16px;display:flex}.VWh0dG_tabNav{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);align-items:center;gap:4px;margin:14px 24px 0;padding:4px;display:flex}.VWh0dG_tabButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast), box-shadow var(--ds-t-fast);background:0 0;border:none;border-radius:6px;padding:6px 12px;font-size:12px;font-weight:500;line-height:16px}.VWh0dG_tabButton:hover{color:var(--ds-t-2)}.VWh0dG_tabButton:focus-visible{color:var(--ds-t-2);box-shadow:0 0 0 1px var(--ds-border-strong);outline:none}.VWh0dG_tabButtonActive,.VWh0dG_tabButtonActive:hover,.VWh0dG_tabButtonActive:focus-visible{background:var(--dsb-3);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong) inset;font-weight:600}.VWh0dG_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out VWh0dG_tabPanelIn;display:flex}@keyframes VWh0dG_tabPanelIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.VWh0dG_reconcileNotice{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 78%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 62%, transparent);color:var(--dsw-alias-label-secondary);border-radius:10px;align-items:flex-start;gap:10px;padding:10px 12px;font-size:12px;line-height:1.55;display:flex}.VWh0dG_reconcileIcon{color:var(--dsw-alias-label-tertiary);flex:none;margin-top:1px;display:inline-flex}.VWh0dG_reconcileText{flex:1}.VWh0dG_reconcileDismiss{color:var(--dsw-alias-label-tertiary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 8px;font-size:12px;line-height:1.4;transition:color .15s,background-color .15s}.VWh0dG_reconcileDismiss:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.VWh0dG_hero{border:1px solid var(--ds-border);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);flex-direction:column;gap:12px;padding:18px 20px;display:flex;position:relative;overflow:hidden}.VWh0dG_hero:after{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.VWh0dG_heroTop{justify-content:space-between;align-items:center;gap:24px;display:flex}.VWh0dG_heroMain{flex-direction:column;gap:2px;min-width:0;display:flex}.VWh0dG_heroLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:11px;font-weight:500;line-height:15px}.VWh0dG_heroReadout{align-items:baseline;gap:4px;display:flex}.VWh0dG_heroCurrency{letter-spacing:-.01em;color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:22px;font-weight:600;line-height:26px}.VWh0dG_heroValue{letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--ds-t-1);font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:52px;font-weight:600;line-height:56px}.VWh0dG_heroMeta{color:var(--ds-t-2);white-space:nowrap;margin-top:2px;font-size:12px;line-height:16px}.VWh0dG_heroGauge{flex-direction:column;flex:none;align-items:center;gap:4px;width:96px;display:flex}.VWh0dG_heroGaugeDial{flex:none;width:96px;height:96px;position:relative}.VWh0dG_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.VWh0dG_heroGaugeTrack{fill:none;stroke:var(--dsb-3);stroke-width:7px}.VWh0dG_heroGaugeArc{fill:none;stroke:var(--ds-blue);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray var(--ds-t-fast)}.VWh0dG_heroGaugeArcOver{stroke:var(--ds-red)}.VWh0dG_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.VWh0dG_heroGaugeRemain{letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--ds-t-1);font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:16px;font-weight:600;line-height:18px}.VWh0dG_heroGaugeRemainOver{color:var(--ds-red)}.VWh0dG_heroGaugeLabel{color:var(--ds-t-3);font-size:11px;line-height:13px}.VWh0dG_heroGaugeSub{font-variant-numeric:tabular-nums;color:var(--ds-t-2);white-space:nowrap;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:10px;line-height:12px}.VWh0dG_heroSide{border-top:1px solid var(--ds-border);align-items:stretch;padding-top:12px;display:flex}.VWh0dG_heroSideItem{border-left:1px solid var(--ds-border);flex-direction:column;flex:1;gap:2px;min-width:0;padding-left:14px;display:flex}.VWh0dG_heroSideItem:first-child{border-left:none;padding-left:0}.VWh0dG_heroSideLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:13px}.VWh0dG_heroSideValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;white-space:nowrap;align-items:baseline;gap:6px;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:15px;font-weight:600;line-height:20px;display:inline-flex}.VWh0dG_heroSideSpacer{flex:1;display:block}.VWh0dG_delta{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:2px;margin-left:6px;padding:1px 7px;font-size:10.5px;font-weight:600;line-height:16px;display:inline-flex}.VWh0dG_deltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.VWh0dG_deltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_unpricedHint{border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);background:color-mix(in srgb, var(--ds-amber) 8%, transparent);color:var(--ds-amber);border-radius:8px;align-items:center;padding:8px 12px;font-size:11.5px;font-weight:500;line-height:17px;display:flex}.VWh0dG_kpiZone{flex-direction:column;gap:8px;display:flex}.VWh0dG_kpiZoneHead{justify-content:flex-end;align-items:center;gap:8px;display:flex}.VWh0dG_kpiZoneLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.VWh0dG_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;display:grid}.VWh0dG_kpiTile{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:2px;padding:14px 16px;display:flex;position:relative;overflow:hidden}.VWh0dG_kpiTile:hover{border-color:var(--ds-border-strong)}.VWh0dG_kpiLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:500;line-height:14px}.VWh0dG_kpiValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;margin-top:6px;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:22px;font-weight:600;line-height:26px}.VWh0dG_kpiGreen{color:var(--ds-green)}.VWh0dG_kpiDetail{color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:11px;line-height:15px;overflow:hidden}.VWh0dG_panel{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:8px;padding:12px 14px;display:flex}.VWh0dG_panelHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.VWh0dG_panelHeadControls{align-items:center;gap:8px;display:inline-flex}.VWh0dG_panelTitle{letter-spacing:-.005em;color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:20px}.VWh0dG_panelHint{color:var(--ds-t-3);white-space:nowrap;font-size:11px;line-height:16px}.VWh0dG_rangeToggle{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:8px;gap:2px;padding:2px;display:inline-flex}.VWh0dG_rangeButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:11px;line-height:16px}.VWh0dG_rangeButtonActive{background:var(--dsb-2);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.VWh0dG_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.VWh0dG_exportLabel{color:var(--ds-t-3);font-size:11px;line-height:16px}.VWh0dG_exportButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;padding:4px 12px;font-size:11.5px;line-height:16px}.VWh0dG_exportButton:hover,.VWh0dG_exportButton:focus-visible{border-color:var(--ds-border-strong);color:var(--ds-t-1);outline:none}.VWh0dG_shareTrack{background:var(--dsb-3);border-radius:4px;height:8px;display:flex;overflow:hidden}.VWh0dG_shareSeg{height:100%;transition:width var(--ds-t-fast)}.VWh0dG_shareSegPeak{background:var(--ds-blue)}.VWh0dG_shareSegOff{background:color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))}.VWh0dG_shareSegUser{background:var(--ds-blue)}.VWh0dG_shareSegAssistant{background:var(--ds-green)}.VWh0dG_shareSegTool{background:var(--ds-amber)}.VWh0dG_shareLegend{align-items:center;gap:16px;display:flex}.VWh0dG_shareItem{color:var(--ds-t-2);align-items:baseline;gap:6px;font-size:11px;line-height:17px;display:inline-flex}.VWh0dG_bucketCost{font-variant-numeric:tabular-nums;align-items:baseline;gap:3px;display:inline-flex}.VWh0dG_bucketOfficial{color:var(--ds-blue);font-weight:600}.VWh0dG_bucketSep{color:var(--ds-t-4)}.VWh0dG_bucketThird{color:var(--ds-t-2)}.VWh0dG_shareDot{border-radius:2px;flex:none;align-self:center;width:8px;height:8px}.VWh0dG_shareValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.VWh0dG_budgetInput{width:64px;color:var(--ds-t-1);font-variant-numeric:tabular-nums;text-align:right;background:0 0;border:none;padding:0;font-size:12px;line-height:16px}.VWh0dG_budgetInput:focus-visible{outline:none}.VWh0dG_switch{border:1px solid var(--ds-border);background:var(--dsb-3);cursor:pointer;width:32px;height:18px;transition:background-color var(--ds-t-fast), border-color var(--ds-t-fast);border-radius:999px;flex:none;padding:0;position:relative}.VWh0dG_switchOn{background:color-mix(in srgb, var(--ds-blue) 60%, transparent);border-color:#0000}.VWh0dG_switchKnob{width:12px;height:12px;transition:transform var(--ds-t-fast);background:#fff;border-radius:50%;position:absolute;top:2px;left:2px}.VWh0dG_switchOn .VWh0dG_switchKnob{transform:translate(14px)}.VWh0dG_budgetFillWarn{background:var(--ds-amber)}.VWh0dG_budgetFillOver{background:var(--ds-red)}.VWh0dG_chartWrap{width:100%;position:relative}.VWh0dG_chartSvg{width:100%;height:auto;display:block}.VWh0dG_chartEmpty{height:140px;color:var(--ds-t-3);justify-content:center;align-items:center;font-size:13px;display:flex}.VWh0dG_emptyRow{text-align:center;color:var(--ds-t-3);padding:28px 0;font-size:13px}.VWh0dG_chartGrid{stroke:var(--ds-border);stroke-width:1px}.VWh0dG_chartAxisLabel{fill:var(--ds-t-3);font-size:10px}.VWh0dG_chartBar{fill:var(--ds-blue);opacity:.7}.VWh0dG_chartBar:hover{opacity:1}.VWh0dG_chartStack{stroke:var(--dsb);stroke-width:.75px}.VWh0dG_chartStack:hover{opacity:.9}.VWh0dG_chartLine{stroke:var(--ds-blue);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.VWh0dG_chartCrosshair{stroke:var(--ds-t-4);stroke-width:1px;stroke-dasharray:3 3}.VWh0dG_chartTooltip{pointer-events:none;z-index:2;border:1px solid var(--ds-border-strong);background:var(--dsb-2);box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;padding:8px 10px;position:absolute;transform:translate(-50%,calc(-100% - 10px))}.VWh0dG_chartTooltipAlignRight{transform:translate(calc(-100% - 8px),calc(-100% - 10px))}.VWh0dG_chartTooltipAlignLeft{transform:translate(8px,calc(-100% - 10px))}.VWh0dG_chartTooltipDate{color:var(--ds-t-1);margin-bottom:3px;font-size:11px;font-weight:600}.VWh0dG_chartTooltipRow{color:var(--ds-t-2);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.VWh0dG_chartTooltipRow strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.VWh0dG_chartTooltipHead{justify-content:space-between;align-items:baseline;gap:14px;margin-bottom:3px;display:flex}.VWh0dG_chartTooltipHead .VWh0dG_chartTooltipDate{margin-bottom:0}.VWh0dG_chartTooltipHead strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:11px;font-weight:600}.VWh0dG_chartTooltipSplit{justify-content:space-between;gap:14px}.VWh0dG_chartTooltipLabel{align-items:center;gap:5px;display:flex}.VWh0dG_chartTooltipModelDetail{color:var(--ds-t-3);font-variant-numeric:tabular-nums;margin:-2px 0 4px 13px;font-size:10.5px;line-height:14px}.VWh0dG_chartBarPlaceholder{fill:color-mix(in srgb, var(--ds-t-2) 30%, transparent)}.VWh0dG_chartLegendLine{background:var(--ds-blue);border-radius:2px;width:10px;height:3px;display:inline-block}.VWh0dG_chartLegendBar{background:var(--ds-blue);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.VWh0dG_chartTooltipSwatch{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.VWh0dG_chartLegend{color:var(--ds-t-2);justify-content:flex-end;gap:14px;margin-top:2px;font-size:11px;display:flex}.VWh0dG_chartLegend span{align-items:center;gap:5px;display:inline-flex}.VWh0dG_chartLegendItem{font:inherit;color:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:5px;padding:0;transition:color .12s;display:inline-flex}.VWh0dG_chartLegendItem:hover{color:var(--ds-t-1)}.VWh0dG_chartLegendItemActive{color:var(--ds-t-1);font-weight:600}.VWh0dG_perfBar{align-items:center;margin:10px 0 2px;display:flex}.VWh0dG_perfChips{flex-wrap:wrap;gap:6px;margin:6px 0 2px;display:flex}.VWh0dG_perfChip{border:1px solid var(--ds-border);background:var(--dsb-3);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), opacity var(--ds-t-fast);border-radius:999px;align-items:center;gap:5px;padding:2px 9px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_perfChip:hover{color:var(--ds-t-1)}.VWh0dG_perfChipOff{opacity:.45}.VWh0dG_perfChipDot{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.VWh0dG_chartHoverDot{stroke:var(--dsb-2);stroke-width:1.5px}.VWh0dG_tableScroll{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);overflow:auto}.VWh0dG_ubAlert{border:1px solid color-mix(in srgb, var(--ds-blue) 30%, transparent);border-radius:var(--ds-r-1);background:color-mix(in srgb, var(--ds-blue) 8%, transparent);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;font-size:12px;line-height:17px;display:flex}.VWh0dG_ubAlertLeft{align-items:center;gap:8px;display:inline-flex}.VWh0dG_ubRate{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.VWh0dG_ubAlertNote{color:var(--ds-t-2);margin:0}.VWh0dG_ubTag,.VWh0dG_ubTagSuccess,.VWh0dG_ubTagNeutral,.VWh0dG_ubTagAlert,.VWh0dG_ubTagPromo{border:1px solid var(--ds-border-strong);white-space:nowrap;border-radius:999px;align-items:center;gap:4px;padding:1px 5px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_ubTag{color:var(--ds-t-2);background:var(--dsb-2)}.VWh0dG_ubTagSuccess{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.VWh0dG_ubTagNeutral{color:var(--ds-t-2);background:var(--dsb-2)}.VWh0dG_ubTagAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 36%, transparent);background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.VWh0dG_ubTagPromo{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent);cursor:help}.VWh0dG_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.VWh0dG_ubExtraName{color:var(--ds-t-2);margin-left:26px}.VWh0dG_ubExtraNote{color:var(--ds-t-3);margin-left:8px;font-size:10px}.VWh0dG_ubCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.VWh0dG_ubCardHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.VWh0dG_ubCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.VWh0dG_ubCardSub{color:var(--ds-t-3);font-size:11px;line-height:16px}.VWh0dG_ubTablewrap{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);overflow:auto}.VWh0dG_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12px}.VWh0dG_ubTable th,.VWh0dG_ubTable td{border-bottom:1px solid var(--ds-border);text-align:left;color:var(--ds-t-1);padding:7px 9px}.VWh0dG_ubTable tbody tr:last-child td{border-bottom:0}.VWh0dG_ubTable thead th,.VWh0dG_ubTable thead th.VWh0dG_numCol{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;text-align:center;padding:6px 9px;font-size:11px;font-weight:500}.VWh0dG_ubModel{align-items:center;gap:6px;display:inline-flex}.VWh0dG_vendorLetter{color:#fff;border-radius:4px;flex:none;justify-content:center;align-items:center;width:16px;height:16px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.VWh0dG_ubModelName{color:var(--ds-t-1);align-items:center;gap:4px;font-weight:500;display:inline-flex}.VWh0dG_ubChipPeak,.VWh0dG_ubChipOff{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:4px;height:18px;padding:0 6px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_ubChipLabel{font-size:10px;font-weight:600}.VWh0dG_ubChipPeak{background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue)}.VWh0dG_ubChipOff{background:color-mix(in srgb, var(--ds-green) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green)}.VWh0dG_ubNotes{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.VWh0dG_ubNotesItem{align-items:baseline;gap:10px;display:flex}.VWh0dG_ubNotesTerm{color:var(--ds-t-1);flex:0 0 72px;font-size:12px;font-weight:500}.VWh0dG_ubNotesDesc{min-width:0;color:var(--ds-t-2);flex:1;font-size:12px;line-height:17px}.VWh0dG_ubCardControlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.VWh0dG_ubTagError{white-space:nowrap;background:color-mix(in srgb, var(--ds-red) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-red) 36%, transparent);height:18px;color:var(--ds-red);border-radius:999px;align-items:center;padding:0 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_modelTable{border-collapse:collapse;table-layout:fixed;width:100%;min-width:640px;font-size:12px}.VWh0dG_modelTable th:first-child{width:26%}.VWh0dG_modelTable th,.VWh0dG_modelTable td{border-bottom:1px solid var(--ds-border);text-align:left;white-space:nowrap;color:var(--ds-t-1);padding:10px 12px}.VWh0dG_modelTable tbody tr:last-child td{border-bottom:0}.VWh0dG_sessionGroupRow{cursor:pointer}.VWh0dG_sessionGroupRow .VWh0dG_modelName:before{content:"›";color:var(--ds-t-3);margin-right:6px;display:inline-block}.VWh0dG_sessionGroupRow[aria-expanded=true] .VWh0dG_modelName:before{transform:rotate(90deg)}.VWh0dG_sessionChildRow td:first-child{padding-left:30px}.VWh0dG_modelTable thead th{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;background:0 0;padding:8px 12px;font-size:11px;font-weight:500}.VWh0dG_modelTable tbody tr{transition:background-color .12s}.VWh0dG_modelTable tbody tr:hover{background:0 0}.VWh0dG_modelTable tbody tr.VWh0dG_modelRowFocusable{cursor:pointer}.VWh0dG_modelTable tbody tr.VWh0dG_modelRowActive,.VWh0dG_modelTable tbody tr.VWh0dG_modelRowActive:hover{background:color-mix(in srgb, var(--ds-blue) 10%, transparent)}.VWh0dG_numCol{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums}.VWh0dG_modelTable .VWh0dG_numCol,.VWh0dG_ubTable .VWh0dG_numCol{text-align:right}.VWh0dG_na{color:var(--ds-t-4)}.VWh0dG_modelCell{align-items:center;gap:8px;display:inline-flex}.VWh0dG_modelDot{border-radius:2px;flex:none;width:8px;height:8px}.VWh0dG_modelName{color:var(--ds-t-1);font-weight:500;line-height:16px;display:block}.VWh0dG_modelProvider{color:var(--ds-t-3);font-size:10.5px;line-height:14px;display:block}.VWh0dG_siteRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);justify-content:space-between;align-items:center;gap:12px;padding:8px 10px;display:flex}.VWh0dG_siteRowName{align-items:center;gap:8px;min-width:0;display:inline-flex}.VWh0dG_siteKindTag{white-space:nowrap;border:1px solid #0000;border-radius:999px;flex:none;align-items:center;padding:2px 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_siteKindSite{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 36%, transparent);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.VWh0dG_siteKindDirect{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.VWh0dG_siteKindUnknown{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_siteRowTitle{color:var(--ds-t-1);text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.VWh0dG_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.VWh0dG_siteRowCost{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:600;line-height:18px}.VWh0dG_siteRowCalls{color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.VWh0dG_siteRowCallsLow{color:var(--ds-red)}.VWh0dG_flatTag{color:var(--ds-t-3);font-size:10.5px;line-height:14px}.VWh0dG_healthDot{border-radius:50%;flex:none;width:6px;height:6px;display:inline-block}.VWh0dG_healthOk{background:var(--ds-green);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-green) 18%, transparent)}.VWh0dG_healthBad{background:var(--ds-red);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-red) 18%, transparent)}.VWh0dG_healthIdle{background:var(--ds-t-4)}.VWh0dG_dashboardRight{align-items:center;gap:8px;min-width:0;display:flex}.VWh0dG_healthBadge{white-space:nowrap;border-radius:999px;align-items:center;gap:6px;padding:3px 9px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_healthBadgeOk{color:var(--ds-green);background:var(--dsb-2)}.VWh0dG_healthBadgeBad{color:var(--ds-red);background:var(--dsb-2)}.VWh0dG_planTag{color:var(--ds-green);white-space:nowrap;align-items:center;gap:4px;font-size:10px;font-weight:500;line-height:14px;display:inline-flex}.VWh0dG_planTagBadge{background:color-mix(in srgb, var(--ds-green) 20%, transparent);border-radius:4px;padding:0 4px;font-size:9px;line-height:12px}.VWh0dG_uncataloguedTag{border:1px solid color-mix(in srgb, var(--ds-amber) 36%, transparent);vertical-align:1px;color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.VWh0dG_estimatedTag{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);vertical-align:1px;color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.VWh0dG_feeBar{border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);backdrop-filter:blur(14px)saturate(1.3);color:var(--ds-t-2);font-variant-numeric:tabular-nums;border-radius:999px;flex-wrap:wrap;align-items:center;gap:8px;padding:6px 12px;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_feeBarAbove{order:-1;align-self:center;margin-bottom:8px}.VWh0dG_feeInline{font-variant-numeric:tabular-nums;white-space:nowrap;cursor:default;border-radius:999px;align-self:center;align-items:center;gap:5px;height:22px;padding:0 4px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_feeInline .VWh0dG_feeChipPrimary,.VWh0dG_feeInline .VWh0dG_feeChipOff{height:18px;padding:0 7px}.VWh0dG_feeInlineNum{color:var(--ds-t-1);padding-right:6px;font-weight:600}.VWh0dG_feeInlineAlert{background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.VWh0dG_feeInlineAlert .VWh0dG_feeInlineNum{color:var(--ds-amber)}.VWh0dG_feeInlineError{background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_feeInlineError .VWh0dG_feeInlineNum{color:var(--ds-red)}.VWh0dG_feeBar .VWh0dG_feeSep{color:var(--ds-t-4)}.VWh0dG_feeCount{color:var(--ds-t-1);font-weight:600}.VWh0dG_feeSuffix{color:var(--ds-t-3)}.VWh0dG_feeItem{color:var(--ds-t-2);white-space:nowrap}.VWh0dG_feeNum{color:var(--ds-t-1);font-weight:600}.VWh0dG_feeSep{color:var(--ds-t-4)}.VWh0dG_feeChipPrimary,.VWh0dG_feeChipOff,.VWh0dG_feeChipAlert,.VWh0dG_feeChipError{border:1px solid var(--ds-border);background:var(--dsb-3);font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;align-items:center;height:20px;padding:0 8px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_feeChipPrimary{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 30%, transparent)}.VWh0dG_feeChipOff{color:var(--ds-cyan);border-color:color-mix(in srgb, var(--ds-cyan) 30%, transparent)}.VWh0dG_feeChipAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 30%, transparent)}.VWh0dG_feeChipError{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 30%, transparent)}.VWh0dG_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.VWh0dG_providerGroupRecharge{border:1px solid color-mix(in srgb, var(--ds-c-1) 38%, transparent);background:color-mix(in srgb, var(--ds-c-1) 8%, transparent);color:var(--ds-c-1);white-space:nowrap;border-radius:999px;justify-content:center;align-items:center;min-width:48px;padding:1px 8px;font-size:10.5px;font-weight:600;line-height:16px;text-decoration:none;display:inline-flex}.VWh0dG_providerGroupRecharge:empty{background:0 0;border-color:#0000}.VWh0dG_providerGroupRecharge:hover{background:color-mix(in srgb, var(--ds-c-1) 15%, transparent);border-color:color-mix(in srgb, var(--ds-c-1) 60%, transparent)}.VWh0dG_balanceDaysBadge{border:1px solid var(--ds-border-strong);background:var(--dsb-2);min-width:16px;height:16px;color:var(--ds-t-2);cursor:pointer;border-radius:8px;justify-content:center;align-items:center;padding:0 4px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.VWh0dG_balanceDaysBadge:hover{border-color:var(--ds-t-3);color:var(--ds-t-1)}.VWh0dG_balanceDaysBadgeLow{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_balanceDetailPop{z-index:20;background:var(--dsb-2);border:1px solid var(--ds-border-strong);min-width:180px;box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;flex-direction:column;gap:6px;padding:8px 10px;display:inline-flex;position:absolute;top:calc(100% + 6px);right:0}.VWh0dG_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.VWh0dG_balanceDetailTitle{color:var(--ds-t-1);font-size:12px;font-weight:600}.VWh0dG_balanceDetailClose{cursor:pointer;color:var(--ds-t-3);background:0 0;border:none;font-size:14px;line-height:1}.VWh0dG_balanceDetailClose:hover{color:var(--ds-t-1)}.VWh0dG_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.VWh0dG_balanceDetailRow{color:var(--ds-t-2);font-variant-numeric:tabular-nums;justify-content:space-between;gap:16px;font-size:11px;line-height:15px;display:flex}.VWh0dG_balanceDetailLabel{color:var(--ds-t-3)}.VWh0dG_balanceDetailValue{color:var(--ds-t-1);font-weight:500}.VWh0dG_currencyToggle{background:var(--dsw-alias-bg-layer-3);border:none;border-radius:8px;align-items:center;gap:2px;margin-right:8px;padding:2px;display:inline-flex}.VWh0dG_currencyButton{color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:4px 8px;font-size:11px;font-weight:700;line-height:1}.VWh0dG_currencyButtonActive{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.VWh0dG_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.VWh0dG_subscriptionCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(12px)saturate(1.3);transition:border-color var(--ds-t-fast);padding:14px 16px;position:relative;overflow:hidden}.VWh0dG_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.VWh0dG_subscriptionName{color:var(--ds-t-1);font-size:13px;font-weight:600}.VWh0dG_subscriptionPlan{color:var(--ds-t-2);font-size:11px}.VWh0dG_subscriptionPlan[data-kind=code],.VWh0dG_subscriptionPlan[data-kind=token]{color:var(--ds-t-2);background:var(--dsb-3);border-radius:999px;padding:1px 8px;font-weight:500}.VWh0dG_subscriptionTier{color:var(--ds-t-3);margin-left:6px}.VWh0dG_subscriptionAuto{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:1px 6px;font-size:10px}.VWh0dG_subscriptionStatus{color:var(--ds-t-2);margin-bottom:6px;font-size:11px}.VWh0dG_subscriptionWindow{align-items:center;gap:10px;margin-top:8px;font-size:11px;display:flex}.VWh0dG_subscriptionWindowLabel{color:var(--ds-t-3);flex:0 0 44px}.VWh0dG_subscriptionTrack{background:var(--dsb-3);height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.VWh0dG_subscriptionFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px;display:block}.VWh0dG_subscriptionFillWarn{background:var(--ds-amber)}.VWh0dG_subscriptionFillOver{background:var(--ds-red)}.VWh0dG_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.VWh0dG_subscriptionPct{text-align:right;min-width:52px;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1);flex:none}.VWh0dG_subscriptionExhausted{color:var(--ds-red);min-width:52px;font-weight:600}.VWh0dG_subscriptionReset{color:var(--ds-t-3);white-space:nowrap;flex:none;font-size:10px}.VWh0dG_providerGroupList{flex-direction:column;gap:10px;display:flex}.VWh0dG_providerGroup{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);padding:12px 14px}.VWh0dG_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:10px;display:flex}.VWh0dG_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.VWh0dG_kindBadge{border:1px solid color-mix(in srgb, var(--ds-c-1) 32%, transparent);background:color-mix(in srgb, var(--ds-c-1) 10%, transparent);color:var(--ds-c-1);border-radius:4px;flex:none;padding:1px 6px;font-size:10px;font-weight:600;line-height:15px}.VWh0dG_kindBadgeRelay{border-color:color-mix(in srgb, var(--ds-c-2) 32%, transparent);background:color-mix(in srgb, var(--ds-c-2) 10%, transparent);color:var(--ds-c-2)}.VWh0dG_kindBadgeUnknown{border-color:var(--ds-border);background:color-mix(in srgb, var(--ds-t-3) 12%, transparent);color:var(--ds-t-3)}.VWh0dG_providerGroupName{color:var(--ds-t-1);font-size:13px;font-weight:600;line-height:18px}.VWh0dG_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.VWh0dG_providerGroupBadge{border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent);border-radius:999px;justify-content:center;align-items:center;padding:1px 8px;font-size:10px;font-weight:500;line-height:16px;display:inline-flex}.VWh0dG_providerGroupBalance,.VWh0dG_providerGroupCost{color:var(--ds-t-2);font-variant-numeric:tabular-nums;white-space:nowrap;justify-content:flex-end;align-items:baseline;gap:6px;min-width:118px;font-size:12px;line-height:17px;display:inline-flex}.VWh0dG_providerGroupCostLabel{font-size:11px}.VWh0dG_providerGroupCostValue{color:var(--ds-t-1);text-align:right;min-width:56px;font-weight:600}.VWh0dG_providerGroupBalanceLabel{color:var(--ds-t-3);font-size:11px;line-height:17px}.VWh0dG_rounds{margin-top:10px}.VWh0dG_roundsBars{align-items:flex-end;gap:3px;height:124px;padding:16px 2px 0;display:flex;overflow-x:auto}.VWh0dG_roundsBarCol{border-radius:5px 5px 0 0;flex-direction:column;flex:1 0 28px;justify-content:flex-end;align-items:stretch;height:100%;display:flex;position:relative}.VWh0dG_roundsBarColPeak{background:color-mix(in srgb, var(--ds-amber) 16%, transparent)}.VWh0dG_roundsBarColOff{background:var(--dsb-3)}.VWh0dG_roundsBarLabel{text-align:center;color:var(--ds-t-2);white-space:nowrap;text-overflow:ellipsis;max-width:100%;font-size:9px;line-height:1.2;position:absolute;bottom:0;left:0;right:0;overflow:hidden;transform:translateY(-100%)}.VWh0dG_roundsBarWrap{flex:1;align-items:flex-end;min-height:0;display:flex}.VWh0dG_roundsBar{background:var(--ds-blue);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.VWh0dG_roundsBarFlagged{background:var(--ds-red);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.VWh0dG_roundsFlagMark{background:var(--ds-red);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.VWh0dG_roundsAxis{color:var(--ds-t-3);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.VWh0dG_roundsEmpty{color:var(--ds-t-2);margin-top:10px;font-size:12px}.VWh0dG_heatmap{margin-top:10px}.VWh0dG_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;display:grid}.VWh0dG_heatmapCellEmpty{box-sizing:border-box;border:1px dashed var(--ds-border);height:30px;color:var(--ds-t-4);font-variant-numeric:tabular-nums;background:0 0;border-radius:2px;justify-content:center;align-items:center;font-size:11px;display:flex}.VWh0dG_heatmapCell{font-variant-numeric:tabular-nums;cursor:pointer;border:0;border-radius:2px;justify-content:center;align-items:center;height:30px;padding:0;font-size:11px;display:flex}.VWh0dG_heatmapCell[data-level="0"],.VWh0dG_heatmapCell[data-level="1"],.VWh0dG_heatmapCell[data-level="2"]{color:var(--dsw-alias-label-primary)}.VWh0dG_heatmapCell[data-level="3"],.VWh0dG_heatmapCell[data-level="4"]{color:var(--dsw-static-neutral-bluish-00)}.VWh0dG_heatmapFooter{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin-top:10px;font-size:10px;display:flex}.VWh0dG_heatmapLegend{gap:3px;display:inline-flex}.VWh0dG_heatmapLegend i{border-radius:2px;width:14px;height:14px;display:block}.VWh0dG_heatmapHover{font-variant-numeric:tabular-nums;margin-left:auto;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace}.VWh0dG_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.VWh0dG_heatmapRangeButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;background:0 0;border-radius:6px;padding:2px 8px;font-size:11px;line-height:1.4}.VWh0dG_heatmapRangeButtonActive{border-color:var(--ds-border-strong);color:var(--ds-t-1);font-weight:600}.VWh0dG_heatmapYear{flex-direction:column;gap:6px;display:flex}.VWh0dG_heatmapYearBody{align-items:flex-start;gap:6px;display:flex}.VWh0dG_heatmapYearWeekdays{color:var(--ds-t-3);flex:none;grid-template-rows:repeat(7,11px);gap:3px;padding-top:12px;font-size:9px;line-height:11px;display:grid}.VWh0dG_heatmapYearWeekday{white-space:nowrap;text-align:right;height:11px}.VWh0dG_heatmapYearMonths{min-width:max-content;color:var(--ds-t-3);grid-template-columns:repeat(52,11px);gap:3px;font-size:9px;line-height:12px;display:grid;overflow:visible}.VWh0dG_heatmapYearMonth{white-space:nowrap;overflow:visible}.VWh0dG_heatmapYearScroll{padding-bottom:2px;overflow-x:auto}.VWh0dG_heatmapYearGrid{grid-template-rows:repeat(7,11px);grid-auto-flow:column;gap:3px;min-width:max-content;display:grid}.VWh0dG_heatmapYearCell{cursor:pointer;border:0;border-radius:2px;width:11px;height:11px;padding:0}.VWh0dG_floatSub{flex-direction:column;gap:6px;min-width:0;display:flex}.VWh0dG_floatSubHead{flex-wrap:wrap;align-items:baseline;gap:6px;min-width:0;display:flex}.VWh0dG_floatSubName{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:700}.VWh0dG_floatSubPlan{color:var(--dsw-alias-label-secondary);font-size:10px}.VWh0dG_floatSub .VWh0dG_subscriptionWindow{flex-wrap:wrap;gap:4px 10px}.VWh0dG_floatSub .VWh0dG_subscriptionWindowLabel{flex:none}.VWh0dG_floatSub .VWh0dG_subscriptionMeta{min-width:0;max-width:100%}.VWh0dG_floatSub .VWh0dG_subscriptionPct{min-width:0}.VWh0dG_floatSub .VWh0dG_subscriptionReset{white-space:normal;overflow-wrap:anywhere}.VWh0dG_triggerPopEmpty{color:var(--dsw-alias-label-tertiary);padding:2px 0;font-size:11px;line-height:1.5}.VWh0dG_triggerPopSwitcher{justify-content:flex-end;align-items:center;gap:8px;margin-top:2px;display:flex}.VWh0dG_triggerPopSwitchCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:10px}.VWh0dG_floatModeBtn{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;border-radius:10px;flex:1;padding:7px 10px;font-size:12px}.VWh0dG_floatModeBtnOn{border-color:var(--ds-blue);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--ds-blue) 16%, transparent)}.VWh0dG_rdoRow{justify-content:space-between;align-items:center;gap:8px;margin-top:10px;display:flex}.VWh0dG_rdoLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.VWh0dG_rdoSelect{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-primary);white-space:nowrap;cursor:pointer;border-radius:10px;align-items:center;gap:5px;padding:5px 8px 5px 10px;font-size:12px;display:inline-flex}.VWh0dG_rdoSelect:hover{background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 85%, transparent)}.VWh0dG_rdoSelect:focus-visible{border-color:var(--ds-blue);outline:none}.VWh0dG_rdoChevron{color:var(--dsw-alias-label-tertiary);transition:transform .15s;display:inline-flex}.VWh0dG_rdoChevronOpen{transform:rotate(180deg)}.VWh0dG_floatTarget{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:5px;font-size:12px;display:inline-flex}.VWh0dG_floatTargetLabel{color:var(--dsw-alias-label-secondary)}.VWh0dG_staleNotice{color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);border-radius:10px;align-items:center;gap:6px;margin:0 0 10px;padding:8px 10px;font-size:11px;display:flex}.VWh0dG_plgHead{align-items:flex-start;gap:12px;display:flex}.VWh0dG_plgIcon{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);width:40px;height:40px;color:var(--dsw-alias-label-secondary);border-radius:10px;flex:none;justify-content:center;align-items:center;display:inline-flex}.VWh0dG_plgTitle{flex-direction:column;gap:4px;min-width:0;display:flex}.VWh0dG_plgNameRow{align-items:center;gap:8px;display:flex}.VWh0dG_plgName{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.VWh0dG_plgTag{height:18px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3);white-space:nowrap;border-radius:5px;align-items:center;padding:0 6px;font-size:10px;font-weight:600;display:inline-flex}.VWh0dG_plgDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.VWh0dG_plgGrid{border-top:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding-top:12px;display:grid}.VWh0dG_plgItem{flex-direction:column;gap:2px;min-width:0;display:flex}.VWh0dG_plgLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.VWh0dG_plgVal{color:var(--dsw-alias-label-primary);word-break:break-all;font-size:12px;line-height:17px}.VWh0dG_plgLink{color:var(--ds-blue);word-break:break-all;font-size:12px;line-height:17px;text-decoration:none}.VWh0dG_plgLink:hover{text-decoration:underline}.VWh0dG_tokenPanel{flex-direction:column;gap:14px;display:flex}.VWh0dG_tokenModelBar{background:var(--dsw-alias-bg-layer-2);border-radius:999px;height:8px;overflow:hidden}.VWh0dG_tokenModelParts{height:100%;display:flex}.VWh0dG_tokenModelPartIn{background:var(--ds-blue)}.VWh0dG_tokenModelPartOut{background:var(--ds-amber)}.VWh0dG_tokenModelShareRow{align-items:center;gap:6px;display:inline-flex}@media (width<=640px){.VWh0dG_kpiGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.VWh0dG_hero{gap:14px}.VWh0dG_heroTop{flex-direction:column;align-items:flex-start;gap:12px}.VWh0dG_heroGauge{width:72px;height:72px}.VWh0dG_heroSide{gap:12px}.VWh0dG_heroSideSpacer{display:none}}.VWh0dG_peakCard{z-index:2000;border-radius:var(--ds-r-2);border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);min-width:280px;max-width:380px;box-shadow:var(--ds-shadow-2);animation:VWh0dG_peakAlertIn var(--ds-t-fast);flex-direction:column;gap:12px;padding:14px 16px;display:flex;position:fixed}.VWh0dG_peakCardCorner{bottom:18px;right:18px}.VWh0dG_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.VWh0dG_peakCardPeak{color:var(--ds-blue)}.VWh0dG_peakCardOff{color:var(--ds-cyan)}.VWh0dG_peakHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.VWh0dG_peakTag{white-space:nowrap;border-radius:6px;align-items:center;gap:6px;height:20px;padding:0 8px;font-size:11px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_peakTagPrimary{background:var(--dsw-alias-bg-layer-3);color:var(--ds-blue)}.VWh0dG_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--ds-cyan)}.VWh0dG_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.VWh0dG_peakDotPrimary{background:var(--ds-blue)}.VWh0dG_peakDotSuccess{background:var(--ds-cyan)}.VWh0dG_peakClose{width:24px;height:24px;color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;font-size:15px;line-height:1;display:inline-flex}.VWh0dG_peakClose:hover{color:var(--ds-t-1);background:var(--dsw-alias-bg-layer-2)}.VWh0dG_peakCount{font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:28px;font-weight:600;line-height:1}.VWh0dG_peakCountPrimary{color:var(--ds-blue)}.VWh0dG_peakCountSuccess{color:var(--ds-cyan)}.VWh0dG_peakDesc{color:var(--ds-t-1);margin:4px 0 0;font-size:12px;line-height:18px}@keyframes VWh0dG_peakAlertIn{0%{opacity:0}to{opacity:1}}.VWh0dG_setCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.VWh0dG_setGrid3,.VWh0dG_setGrid2{gap:10px;display:grid}.VWh0dG_setGrid3{grid-template-columns:repeat(3,minmax(0,1fr))}.VWh0dG_setGrid2{grid-template-columns:repeat(2,minmax(0,1fr))}@media (width<=720px){.VWh0dG_setGrid3,.VWh0dG_setGrid2{grid-template-columns:1fr}}.VWh0dG_setCell{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);flex-direction:column;gap:8px;min-width:0;padding:12px 14px;display:flex}.VWh0dG_setCardHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.VWh0dG_setCardMeta{flex-direction:column;gap:4px;min-width:0;display:flex}.VWh0dG_setCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.VWh0dG_setCardDesc{color:var(--ds-t-3);margin:0;font-size:11px;line-height:16px}.VWh0dG_ctlCol{flex-direction:column;gap:10px;padding-top:2px;display:flex}.VWh0dG_ctlRow{align-items:center;gap:12px;min-height:28px;display:flex}.VWh0dG_ctlRowStretch{display:flex}.VWh0dG_ctlLabel{color:var(--ds-t-3);flex:0 0 96px;font-size:11px;line-height:16px}.VWh0dG_ctlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.VWh0dG_userPriceRow{border-bottom:1px solid var(--ds-border);align-items:center;gap:10px;padding:8px 0;display:flex}.VWh0dG_userPriceCheck{width:14px;height:14px;accent-color:var(--ds-blue);flex:none;margin:0}.VWh0dG_userPriceBody{flex-direction:column;flex:1;gap:8px;min-width:0;display:flex}.VWh0dG_userPriceLineMeta{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) auto;align-items:end;gap:8px 10px;display:grid}@media (width<=720px){.VWh0dG_userPriceLineMeta{grid-template-columns:repeat(2,minmax(0,1fr))}}.VWh0dG_userPriceLineMeta .VWh0dG_userPriceInput{box-sizing:border-box;width:100%;min-width:0;max-width:none}.VWh0dG_userPriceBody .VWh0dG_ctlGroup{flex-wrap:nowrap}.VWh0dG_userPriceLineMeta .VWh0dG_userPriceField .VWh0dG_ctlLabel{align-items:flex-end;min-height:30px;display:flex}.VWh0dG_userPricePriceLine{border-left:2px solid var(--ds-amber);flex-wrap:wrap;align-items:center;gap:10px;width:calc(100% - 22px);margin-left:10px;padding:2px 0 6px 12px;display:flex}.VWh0dG_userPricePriceLine>.VWh0dG_ctlLabel{color:var(--ds-t-3);flex:0 0 44px;font-size:11px}.VWh0dG_userPricePriceLine .VWh0dG_userPriceInputNum{box-sizing:border-box;flex:1 1 0;width:auto;min-width:120px;max-width:240px}.VWh0dG_userPriceField{flex-direction:column;gap:4px;min-width:0;display:flex}.VWh0dG_userPriceField .VWh0dG_ctlLabel{flex:none;font-size:11px}.VWh0dG_userPriceInput,.VWh0dG_userPriceInputNum{border:1px solid var(--ds-border);background:var(--dsb-3);min-width:96px;max-width:160px;color:var(--ds-t-1);border-radius:6px;padding:4px 8px;font-size:12px;line-height:16px}.VWh0dG_userPriceInputNum{min-width:72px;max-width:88px}.VWh0dG_rdo{color:var(--ds-t-2);cursor:pointer;white-space:nowrap;align-items:center;gap:6px;font-size:12px;line-height:16px;display:inline-flex}.VWh0dG_rdo input{opacity:0;pointer-events:none;position:absolute}.VWh0dG_rdoDot{border:1px solid var(--ds-border-strong);background:var(--dsb-3);border-radius:50%;flex:none;width:14px;height:14px;position:relative}.VWh0dG_rdo input:checked+.VWh0dG_rdoDot{border-color:var(--ds-blue)}.VWh0dG_rdo input:checked+.VWh0dG_rdoDot:after{content:"";background:var(--ds-blue);border-radius:50%;position:absolute;inset:3px}.VWh0dG_inp{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:6px;align-items:center;gap:4px;padding:2px 6px;display:inline-flex}.VWh0dG_affix{color:var(--ds-t-3);font-size:11px;line-height:16px}.VWh0dG_prog{background:var(--dsb-3);min-width:0;height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.VWh0dG_progFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px}.VWh0dG_btn{border:1px solid var(--ds-border);height:28px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;line-height:16px;display:inline-flex}.VWh0dG_btn:hover{border-color:var(--ds-blue);color:var(--ds-t-1);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.VWh0dG_modelTable tbody td:not(:first-child) tbody td:not(:first-child){text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1)}`,document.head.appendChild(e)}var P={affix:`VWh0dG_affix`,balanceCell:`VWh0dG_balanceCell`,balanceDaysBadge:`VWh0dG_balanceDaysBadge`,balanceDaysBadgeLow:`VWh0dG_balanceDaysBadgeLow`,balanceDetailClose:`VWh0dG_balanceDetailClose`,balanceDetailGrid:`VWh0dG_balanceDetailGrid`,balanceDetailHead:`VWh0dG_balanceDetailHead`,balanceDetailLabel:`VWh0dG_balanceDetailLabel`,balanceDetailPop:`VWh0dG_balanceDetailPop`,balanceDetailRow:`VWh0dG_balanceDetailRow`,balanceDetailTitle:`VWh0dG_balanceDetailTitle`,balanceDetailValue:`VWh0dG_balanceDetailValue`,"billing-trigger":`VWh0dG_billing-trigger`,btn:`VWh0dG_btn`,bucketCost:`VWh0dG_bucketCost`,bucketOfficial:`VWh0dG_bucketOfficial`,bucketSep:`VWh0dG_bucketSep`,bucketThird:`VWh0dG_bucketThird`,budgetFillOver:`VWh0dG_budgetFillOver`,budgetFillWarn:`VWh0dG_budgetFillWarn`,budgetInput:`VWh0dG_budgetInput`,budgetPulse:`VWh0dG_budgetPulse`,chartAxisLabel:`VWh0dG_chartAxisLabel`,chartBar:`VWh0dG_chartBar`,chartBarPlaceholder:`VWh0dG_chartBarPlaceholder`,chartCrosshair:`VWh0dG_chartCrosshair`,chartEmpty:`VWh0dG_chartEmpty`,chartGrid:`VWh0dG_chartGrid`,chartHoverDot:`VWh0dG_chartHoverDot`,chartLegend:`VWh0dG_chartLegend`,chartLegendBar:`VWh0dG_chartLegendBar`,chartLegendItem:`VWh0dG_chartLegendItem`,chartLegendItemActive:`VWh0dG_chartLegendItemActive`,chartLegendLine:`VWh0dG_chartLegendLine`,chartLine:`VWh0dG_chartLine`,chartStack:`VWh0dG_chartStack`,chartSvg:`VWh0dG_chartSvg`,chartTooltip:`VWh0dG_chartTooltip`,chartTooltipAlignLeft:`VWh0dG_chartTooltipAlignLeft`,chartTooltipAlignRight:`VWh0dG_chartTooltipAlignRight`,chartTooltipDate:`VWh0dG_chartTooltipDate`,chartTooltipHead:`VWh0dG_chartTooltipHead`,chartTooltipLabel:`VWh0dG_chartTooltipLabel`,chartTooltipModelDetail:`VWh0dG_chartTooltipModelDetail`,chartTooltipRow:`VWh0dG_chartTooltipRow`,chartTooltipSplit:`VWh0dG_chartTooltipSplit`,chartTooltipSwatch:`VWh0dG_chartTooltipSwatch`,chartWrap:`VWh0dG_chartWrap`,closeButton:`VWh0dG_closeButton`,ctlCol:`VWh0dG_ctlCol`,ctlGroup:`VWh0dG_ctlGroup`,ctlLabel:`VWh0dG_ctlLabel`,ctlRow:`VWh0dG_ctlRow`,ctlRowStretch:`VWh0dG_ctlRowStretch`,currencyButton:`VWh0dG_currencyButton`,currencyButtonActive:`VWh0dG_currencyButtonActive`,currencyToggle:`VWh0dG_currencyToggle`,dashboard:`VWh0dG_dashboard`,dashboardBody:`VWh0dG_dashboardBody`,dashboardHead:`VWh0dG_dashboardHead`,dashboardIn:`VWh0dG_dashboardIn`,dashboardModal:`VWh0dG_dashboardModal`,dashboardRight:`VWh0dG_dashboardRight`,dashboardSubtitle:`VWh0dG_dashboardSubtitle`,dashboardTitle:`VWh0dG_dashboardTitle`,delta:`VWh0dG_delta`,deltaDown:`VWh0dG_deltaDown`,deltaUp:`VWh0dG_deltaUp`,emptyRow:`VWh0dG_emptyRow`,estimatedTag:`VWh0dG_estimatedTag`,exportBar:`VWh0dG_exportBar`,exportButton:`VWh0dG_exportButton`,exportLabel:`VWh0dG_exportLabel`,feeBar:`VWh0dG_feeBar`,feeBarAbove:`VWh0dG_feeBarAbove`,feeChipAlert:`VWh0dG_feeChipAlert`,feeChipError:`VWh0dG_feeChipError`,feeChipOff:`VWh0dG_feeChipOff`,feeChipPrimary:`VWh0dG_feeChipPrimary`,feeCount:`VWh0dG_feeCount`,feeInline:`VWh0dG_feeInline`,feeInlineAlert:`VWh0dG_feeInlineAlert`,feeInlineError:`VWh0dG_feeInlineError`,feeInlineNum:`VWh0dG_feeInlineNum`,feeItem:`VWh0dG_feeItem`,feeNum:`VWh0dG_feeNum`,feeSep:`VWh0dG_feeSep`,feeSuffix:`VWh0dG_feeSuffix`,flatTag:`VWh0dG_flatTag`,floatModeBtn:`VWh0dG_floatModeBtn`,floatModeBtnOn:`VWh0dG_floatModeBtnOn`,floatSub:`VWh0dG_floatSub`,floatSubHead:`VWh0dG_floatSubHead`,floatSubName:`VWh0dG_floatSubName`,floatSubPlan:`VWh0dG_floatSubPlan`,floatTarget:`VWh0dG_floatTarget`,floatTargetLabel:`VWh0dG_floatTargetLabel`,healthBad:`VWh0dG_healthBad`,healthBadge:`VWh0dG_healthBadge`,healthBadgeBad:`VWh0dG_healthBadgeBad`,healthBadgeOk:`VWh0dG_healthBadgeOk`,healthDot:`VWh0dG_healthDot`,healthIdle:`VWh0dG_healthIdle`,healthOk:`VWh0dG_healthOk`,heatmap:`VWh0dG_heatmap`,heatmapCell:`VWh0dG_heatmapCell`,heatmapCellEmpty:`VWh0dG_heatmapCellEmpty`,heatmapFooter:`VWh0dG_heatmapFooter`,heatmapGrid:`VWh0dG_heatmapGrid`,heatmapHover:`VWh0dG_heatmapHover`,heatmapLegend:`VWh0dG_heatmapLegend`,heatmapRangeButton:`VWh0dG_heatmapRangeButton`,heatmapRangeButtonActive:`VWh0dG_heatmapRangeButtonActive`,heatmapRangeSwitch:`VWh0dG_heatmapRangeSwitch`,heatmapYear:`VWh0dG_heatmapYear`,heatmapYearBody:`VWh0dG_heatmapYearBody`,heatmapYearCell:`VWh0dG_heatmapYearCell`,heatmapYearGrid:`VWh0dG_heatmapYearGrid`,heatmapYearMonth:`VWh0dG_heatmapYearMonth`,heatmapYearMonths:`VWh0dG_heatmapYearMonths`,heatmapYearScroll:`VWh0dG_heatmapYearScroll`,heatmapYearWeekday:`VWh0dG_heatmapYearWeekday`,heatmapYearWeekdays:`VWh0dG_heatmapYearWeekdays`,hero:`VWh0dG_hero`,heroCurrency:`VWh0dG_heroCurrency`,heroGauge:`VWh0dG_heroGauge`,heroGaugeArc:`VWh0dG_heroGaugeArc`,heroGaugeArcOver:`VWh0dG_heroGaugeArcOver`,heroGaugeCenter:`VWh0dG_heroGaugeCenter`,heroGaugeDial:`VWh0dG_heroGaugeDial`,heroGaugeLabel:`VWh0dG_heroGaugeLabel`,heroGaugeRemain:`VWh0dG_heroGaugeRemain`,heroGaugeRemainOver:`VWh0dG_heroGaugeRemainOver`,heroGaugeSub:`VWh0dG_heroGaugeSub`,heroGaugeSvg:`VWh0dG_heroGaugeSvg`,heroGaugeTrack:`VWh0dG_heroGaugeTrack`,heroLabel:`VWh0dG_heroLabel`,heroMain:`VWh0dG_heroMain`,heroMeta:`VWh0dG_heroMeta`,heroReadout:`VWh0dG_heroReadout`,heroSide:`VWh0dG_heroSide`,heroSideItem:`VWh0dG_heroSideItem`,heroSideLabel:`VWh0dG_heroSideLabel`,heroSideSpacer:`VWh0dG_heroSideSpacer`,heroSideValue:`VWh0dG_heroSideValue`,heroTop:`VWh0dG_heroTop`,heroValue:`VWh0dG_heroValue`,inp:`VWh0dG_inp`,kindBadge:`VWh0dG_kindBadge`,kindBadgeRelay:`VWh0dG_kindBadgeRelay`,kindBadgeUnknown:`VWh0dG_kindBadgeUnknown`,kpiDetail:`VWh0dG_kpiDetail`,kpiGreen:`VWh0dG_kpiGreen`,kpiGrid:`VWh0dG_kpiGrid`,kpiLabel:`VWh0dG_kpiLabel`,kpiTile:`VWh0dG_kpiTile`,kpiValue:`VWh0dG_kpiValue`,kpiZone:`VWh0dG_kpiZone`,kpiZoneHead:`VWh0dG_kpiZoneHead`,kpiZoneLabel:`VWh0dG_kpiZoneLabel`,metricCell:`VWh0dG_metricCell`,metricGrid:`VWh0dG_metricGrid`,metricLabel:`VWh0dG_metricLabel`,metricValue:`VWh0dG_metricValue`,metricValueSuccess:`VWh0dG_metricValueSuccess`,modalFooter:`VWh0dG_modalFooter`,modelCell:`VWh0dG_modelCell`,modelDot:`VWh0dG_modelDot`,modelName:`VWh0dG_modelName`,modelProvider:`VWh0dG_modelProvider`,modelRowActive:`VWh0dG_modelRowActive`,modelRowFocusable:`VWh0dG_modelRowFocusable`,modelTable:`VWh0dG_modelTable`,na:`VWh0dG_na`,numCol:`VWh0dG_numCol`,panel:`VWh0dG_panel`,panelHead:`VWh0dG_panelHead`,panelHeadControls:`VWh0dG_panelHeadControls`,panelHint:`VWh0dG_panelHint`,panelTitle:`VWh0dG_panelTitle`,peakAlertIn:`VWh0dG_peakAlertIn`,peakCard:`VWh0dG_peakCard`,peakCardCenter:`VWh0dG_peakCardCenter`,peakCardCorner:`VWh0dG_peakCardCorner`,peakCardOff:`VWh0dG_peakCardOff`,peakCardPeak:`VWh0dG_peakCardPeak`,peakClose:`VWh0dG_peakClose`,peakCount:`VWh0dG_peakCount`,peakCountPrimary:`VWh0dG_peakCountPrimary`,peakCountSuccess:`VWh0dG_peakCountSuccess`,peakDesc:`VWh0dG_peakDesc`,peakDot:`VWh0dG_peakDot`,peakDotPrimary:`VWh0dG_peakDotPrimary`,peakDotSuccess:`VWh0dG_peakDotSuccess`,peakHead:`VWh0dG_peakHead`,peakTag:`VWh0dG_peakTag`,peakTagPrimary:`VWh0dG_peakTagPrimary`,peakTagSuccess:`VWh0dG_peakTagSuccess`,perfBar:`VWh0dG_perfBar`,perfChip:`VWh0dG_perfChip`,perfChipDot:`VWh0dG_perfChipDot`,perfChipOff:`VWh0dG_perfChipOff`,perfChips:`VWh0dG_perfChips`,planTag:`VWh0dG_planTag`,planTagBadge:`VWh0dG_planTagBadge`,plgDesc:`VWh0dG_plgDesc`,plgGrid:`VWh0dG_plgGrid`,plgHead:`VWh0dG_plgHead`,plgIcon:`VWh0dG_plgIcon`,plgItem:`VWh0dG_plgItem`,plgLabel:`VWh0dG_plgLabel`,plgLink:`VWh0dG_plgLink`,plgName:`VWh0dG_plgName`,plgNameRow:`VWh0dG_plgNameRow`,plgTag:`VWh0dG_plgTag`,plgTitle:`VWh0dG_plgTitle`,plgVal:`VWh0dG_plgVal`,popDot:`VWh0dG_popDot`,popDotDirect:`VWh0dG_popDotDirect`,popDotNeutral:`VWh0dG_popDotNeutral`,popDotSub:`VWh0dG_popDotSub`,popHead:`VWh0dG_popHead`,popModel:`VWh0dG_popModel`,popModelLabel:`VWh0dG_popModelLabel`,popModelName:`VWh0dG_popModelName`,popModelRow:`VWh0dG_popModelRow`,popModelStatus:`VWh0dG_popModelStatus`,popModelStatusLow:`VWh0dG_popModelStatusLow`,popTagPrimary:`VWh0dG_popTagPrimary`,popTagSub:`VWh0dG_popTagSub`,popTitle:`VWh0dG_popTitle`,prog:`VWh0dG_prog`,progFill:`VWh0dG_progFill`,providerGroup:`VWh0dG_providerGroup`,providerGroupBadge:`VWh0dG_providerGroupBadge`,providerGroupBalance:`VWh0dG_providerGroupBalance`,providerGroupBalanceLabel:`VWh0dG_providerGroupBalanceLabel`,providerGroupCost:`VWh0dG_providerGroupCost`,providerGroupCostLabel:`VWh0dG_providerGroupCostLabel`,providerGroupCostValue:`VWh0dG_providerGroupCostValue`,providerGroupHead:`VWh0dG_providerGroupHead`,providerGroupList:`VWh0dG_providerGroupList`,providerGroupMeta:`VWh0dG_providerGroupMeta`,providerGroupName:`VWh0dG_providerGroupName`,providerGroupRecharge:`VWh0dG_providerGroupRecharge`,providerGroupTitle:`VWh0dG_providerGroupTitle`,railButton:`VWh0dG_railButton`,rangeButton:`VWh0dG_rangeButton`,rangeButtonActive:`VWh0dG_rangeButtonActive`,rangeToggle:`VWh0dG_rangeToggle`,rdo:`VWh0dG_rdo`,rdoChevron:`VWh0dG_rdoChevron`,rdoChevronOpen:`VWh0dG_rdoChevronOpen`,rdoDot:`VWh0dG_rdoDot`,rdoLabel:`VWh0dG_rdoLabel`,rdoRow:`VWh0dG_rdoRow`,rdoSelect:`VWh0dG_rdoSelect`,reconcileDismiss:`VWh0dG_reconcileDismiss`,reconcileIcon:`VWh0dG_reconcileIcon`,reconcileNotice:`VWh0dG_reconcileNotice`,reconcileText:`VWh0dG_reconcileText`,rounds:`VWh0dG_rounds`,roundsAxis:`VWh0dG_roundsAxis`,roundsBar:`VWh0dG_roundsBar`,roundsBarCol:`VWh0dG_roundsBarCol`,roundsBarColOff:`VWh0dG_roundsBarColOff`,roundsBarColPeak:`VWh0dG_roundsBarColPeak`,roundsBarFlagged:`VWh0dG_roundsBarFlagged`,roundsBarLabel:`VWh0dG_roundsBarLabel`,roundsBarWrap:`VWh0dG_roundsBarWrap`,roundsBars:`VWh0dG_roundsBars`,roundsEmpty:`VWh0dG_roundsEmpty`,roundsFlagMark:`VWh0dG_roundsFlagMark`,sessionChildRow:`VWh0dG_sessionChildRow`,sessionGroupRow:`VWh0dG_sessionGroupRow`,setCard:`VWh0dG_setCard`,setCardDesc:`VWh0dG_setCardDesc`,setCardHead:`VWh0dG_setCardHead`,setCardMeta:`VWh0dG_setCardMeta`,setCardTitle:`VWh0dG_setCardTitle`,setCell:`VWh0dG_setCell`,setGrid2:`VWh0dG_setGrid2`,setGrid3:`VWh0dG_setGrid3`,shareDot:`VWh0dG_shareDot`,shareItem:`VWh0dG_shareItem`,shareLegend:`VWh0dG_shareLegend`,shareSeg:`VWh0dG_shareSeg`,shareSegAssistant:`VWh0dG_shareSegAssistant`,shareSegOff:`VWh0dG_shareSegOff`,shareSegPeak:`VWh0dG_shareSegPeak`,shareSegTool:`VWh0dG_shareSegTool`,shareSegUser:`VWh0dG_shareSegUser`,shareTrack:`VWh0dG_shareTrack`,shareValue:`VWh0dG_shareValue`,siteKindDirect:`VWh0dG_siteKindDirect`,siteKindSite:`VWh0dG_siteKindSite`,siteKindTag:`VWh0dG_siteKindTag`,siteKindUnknown:`VWh0dG_siteKindUnknown`,siteRow:`VWh0dG_siteRow`,siteRowCalls:`VWh0dG_siteRowCalls`,siteRowCallsLow:`VWh0dG_siteRowCallsLow`,siteRowCost:`VWh0dG_siteRowCost`,siteRowMeta:`VWh0dG_siteRowMeta`,siteRowName:`VWh0dG_siteRowName`,siteRowTitle:`VWh0dG_siteRowTitle`,staleNotice:`VWh0dG_staleNotice`,subscriptionAuto:`VWh0dG_subscriptionAuto`,subscriptionCard:`VWh0dG_subscriptionCard`,subscriptionExhausted:`VWh0dG_subscriptionExhausted`,subscriptionFill:`VWh0dG_subscriptionFill`,subscriptionFillOver:`VWh0dG_subscriptionFillOver`,subscriptionFillWarn:`VWh0dG_subscriptionFillWarn`,subscriptionGrid:`VWh0dG_subscriptionGrid`,subscriptionHead:`VWh0dG_subscriptionHead`,subscriptionMeta:`VWh0dG_subscriptionMeta`,subscriptionName:`VWh0dG_subscriptionName`,subscriptionPct:`VWh0dG_subscriptionPct`,subscriptionPlan:`VWh0dG_subscriptionPlan`,subscriptionReset:`VWh0dG_subscriptionReset`,subscriptionStatus:`VWh0dG_subscriptionStatus`,subscriptionTier:`VWh0dG_subscriptionTier`,subscriptionTrack:`VWh0dG_subscriptionTrack`,subscriptionWindow:`VWh0dG_subscriptionWindow`,subscriptionWindowLabel:`VWh0dG_subscriptionWindowLabel`,switch:`VWh0dG_switch`,switchKnob:`VWh0dG_switchKnob`,switchOn:`VWh0dG_switchOn`,tabButton:`VWh0dG_tabButton`,tabButtonActive:`VWh0dG_tabButtonActive`,tabNav:`VWh0dG_tabNav`,tabPanel:`VWh0dG_tabPanel`,tabPanelIn:`VWh0dG_tabPanelIn`,tableScroll:`VWh0dG_tableScroll`,tokenModelBar:`VWh0dG_tokenModelBar`,tokenModelPartIn:`VWh0dG_tokenModelPartIn`,tokenModelPartOut:`VWh0dG_tokenModelPartOut`,tokenModelParts:`VWh0dG_tokenModelParts`,tokenModelShareRow:`VWh0dG_tokenModelShareRow`,tokenPanel:`VWh0dG_tokenPanel`,trigger:`VWh0dG_trigger`,triggerBudgetHot:`VWh0dG_triggerBudgetHot`,triggerBudgetOver:`VWh0dG_triggerBudgetOver`,triggerBudgetPulse:`VWh0dG_triggerBudgetPulse`,triggerGaugeArc:`VWh0dG_triggerGaugeArc`,triggerGaugeNeedle:`VWh0dG_triggerGaugeNeedle`,triggerIcon:`VWh0dG_triggerIcon`,triggerLabel:`VWh0dG_triggerLabel`,triggerMain:`VWh0dG_triggerMain`,triggerMetric:`VWh0dG_triggerMetric`,triggerPop:`VWh0dG_triggerPop`,triggerPopEmpty:`VWh0dG_triggerPopEmpty`,triggerPopShown:`VWh0dG_triggerPopShown`,triggerPopSwitchCount:`VWh0dG_triggerPopSwitchCount`,triggerPopSwitcher:`VWh0dG_triggerPopSwitcher`,triggerPrimary:`VWh0dG_triggerPrimary`,triggerScan:`VWh0dG_triggerScan`,triggerSpark:`VWh0dG_triggerSpark`,triggerSparkBar:`VWh0dG_triggerSparkBar`,triggerSparkBreath:`VWh0dG_triggerSparkBreath`,triggerSparkHot:`VWh0dG_triggerSparkHot`,triggerWrap:`VWh0dG_triggerWrap`,triggerYen:`VWh0dG_triggerYen`,ubAlert:`VWh0dG_ubAlert`,ubAlertLeft:`VWh0dG_ubAlertLeft`,ubAlertNote:`VWh0dG_ubAlertNote`,ubCard:`VWh0dG_ubCard`,ubCardControlGroup:`VWh0dG_ubCardControlGroup`,ubCardHead:`VWh0dG_ubCardHead`,ubCardSub:`VWh0dG_ubCardSub`,ubCardTitle:`VWh0dG_ubCardTitle`,ubChipLabel:`VWh0dG_ubChipLabel`,ubChipOff:`VWh0dG_ubChipOff`,ubChipPeak:`VWh0dG_ubChipPeak`,ubExtraName:`VWh0dG_ubExtraName`,ubExtraNote:`VWh0dG_ubExtraNote`,ubExtraRow:`VWh0dG_ubExtraRow`,ubModel:`VWh0dG_ubModel`,ubModelName:`VWh0dG_ubModelName`,ubNotes:`VWh0dG_ubNotes`,ubNotesDesc:`VWh0dG_ubNotesDesc`,ubNotesItem:`VWh0dG_ubNotesItem`,ubNotesTerm:`VWh0dG_ubNotesTerm`,ubRate:`VWh0dG_ubRate`,ubTable:`VWh0dG_ubTable`,ubTablewrap:`VWh0dG_ubTablewrap`,ubTag:`VWh0dG_ubTag`,ubTagAlert:`VWh0dG_ubTagAlert`,ubTagError:`VWh0dG_ubTagError`,ubTagNeutral:`VWh0dG_ubTagNeutral`,ubTagPromo:`VWh0dG_ubTagPromo`,ubTagSuccess:`VWh0dG_ubTagSuccess`,uncataloguedTag:`VWh0dG_uncataloguedTag`,unpricedHint:`VWh0dG_unpricedHint`,userPriceBody:`VWh0dG_userPriceBody`,userPriceCheck:`VWh0dG_userPriceCheck`,userPriceField:`VWh0dG_userPriceField`,userPriceInput:`VWh0dG_userPriceInput`,userPriceInputNum:`VWh0dG_userPriceInputNum`,userPriceLineMeta:`VWh0dG_userPriceLineMeta`,userPricePriceLine:`VWh0dG_userPricePriceLine`,userPriceRow:`VWh0dG_userPriceRow`,vendorLetter:`VWh0dG_vendorLetter`};let F={"opencode-go":{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},opencode:{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},"kimi-coding":{type:`code`},"zai-coding-cn":{type:`code`},"zai-coding":{type:`code`},"qwen-token-plan":{type:`code`},"qwen-token-plan-cn":{type:`code`},"xiaomi-token-plan-ams":{type:`code`},"xiaomi-token-plan-cn":{type:`code`},"xiaomi-token-plan-sgp":{type:`code`},"volcengine-token-plan":{type:`code`},"ark-token-plan":{type:`code`},"doubao-token-plan":{type:`code`},minimax:{type:`code`},"minimax-cn":{type:`code`},"minimax-token-plan":{type:`code`},"minimax-token-plan-cn":{type:`code`},"hunyuan-token-plan":{type:`code`},"tencent-token-plan":{type:`code`},"hy-token-plan":{type:`code`},"xinghuo-token-plan":{type:`code`},"xfyun-coding":{type:`code`},"spark-coding":{type:`code`},"huawei-token-plan":{type:`code`},"pangu-token-plan":{type:`code`},"huawei-maas-token-plan":{type:`code`},"volcengine-agent-plan":{type:`code`},"ark-agent-plan":{type:`code`},"baidu-token-plan":{type:`code`},"ernie-token-plan":{type:`code`},"wenxin-token-plan":{type:`code`}},I={glm:`zai-coding-cn`,bigmodel:`zai-coding-cn`,zhipu:`zai-coding-cn`,zhipuai:`zai-coding-cn`,zai:`zai-coding`,ark:`volcengine-token-plan`,volcengine:`volcengine-token-plan`,doubao:`doubao-token-plan`,moonshot:`kimi-coding`,kimi:`kimi-coding`,xiaomi:`xiaomi-token-plan-cn`,opencode:`opencode-go`};function oe(e){return e===``?e:I[e]??e}function se(e){let t=F[oe(e)];return t?.type===`code`?t.tier:void 0}let ce=[{key:`deepseek-v4-flash`,input:.14,cacheHit:.0028,output:.28},{key:`deepseek-v4-pro`,input:.435,cacheHit:.003625,output:.87},{key:`gpt-5.6-sol`,input:5,cacheHit:.5,output:30},{key:`gpt-5.6-terra`,input:2,cacheHit:.2,output:12},{key:`gpt-5.6-luna`,input:.2,cacheHit:.02,output:1.2},{key:`glm-5.2`,input:1.4,cacheHit:.26,output:4.4},{key:`qwen3.8-max`,input:2,cacheHit:.21,output:6},{key:`kimi-k3`,input:2.82,cacheHit:.28,output:14.08},{key:`grok-4.6`,input:2,cacheHit:.5,output:6},{key:`gemini-2.5-pro`,input:1.25,cacheHit:.125,output:10}],le,ue,de,fe,pe;function me(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function he(e,t){return me(e)===me(t)}function ge(e){pe=e.length>0?e:void 0}function _e(){return pe}function L(e){return Ne(e)}function R(e,t){let n=ve(e,t);if(n!==void 0)return{input:n.input,cacheHit:n.cacheHit,output:n.output,...n.currency===void 0?{}:{currency:n.currency},...n.offPeak===void 0?{}:{offPeak:n.offPeak}}}function ve(e,t){if(pe===void 0)return;let n=L(e),r=G(n),i=e=>L(e.key)===n||G(e.key)===r;if(t!==void 0){for(let e of pe)if(!(e.origin===void 0||e.origin===``)&&i(e)&&he(e.origin,t))return e}for(let e of pe)if(!(e.origin!==void 0&&e.origin!==``)&&i(e))return e}function ye(e){if(pe===void 0)return;let t=L(e),n=G(t);return pe.find(e=>e.origin!==void 0&&e.origin!==``&&(L(e.key)===t||G(e.key)===n))}function z(e){le=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,ue=e.prices,de=e.extraModels}function be(e){fe=e}function B(){return le??6.79}function xe(){return{rate:B(),live:le!==void 0}}let Se=.5;function Ce(e){return e>=9&&e<12||e>=14&&e<18}function we(e){return e==null||!Number.isFinite(e)?`peak`:V(e)?`offPeak`:Ce((new Date(e).getUTCHours()+8)%24)?`peak`:`offPeak`}function V(e){let t=new Date(e+8*36e5).getUTCDay();return t===0||t===6}let H=[540,720,840,1080];function Te(e){return((e+8*36e5)%864e5+864e5)%864e5}function U(e){let t=we(e),n=Te(e);for(let r=0;r<7;r++){let i=r*864e5-n;for(let n of H){let r=i+n*6e4;if(!(r<=0)&&we(e+r)!==t)return{tier:t,nextSwitchInMs:r}}}let r=H[0]??0;return{tier:t,nextSwitchInMs:864e5-n+r*6e4}}function Ee(e,t){let{nextSwitchInMs:n}=U(e);if(n>t)return null;let r=e+n;return{entering:we(r),atMs:r}}function De(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/60),r=t%60;return n>0?`${n}h${String(r).padStart(2,`0`)}m`:`${r}m`}let Oe=`09:00-12:00 / 14:00-18:00`,ke=`Standard / Flex`,W=[{key:`flash`,name:`DeepSeek V4.1 Flash`,provider:`DeepSeek`,colorVar:`ds-blue`,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:Oe},{key:`flash-vision-exp`,name:`DeepSeek V4 Flash Vision (Exp)`,provider:`DeepSeek`,colorVar:`ds-blue`,retired:!0,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:Oe},{key:`pro`,name:`DeepSeek V4 Pro`,provider:`DeepSeek`,colorVar:`dsw-static-deepseek-500`,price:{currency:`CNY`,input:9,cacheHit:.3,output:27,offPeak:{input:4.5,cacheHit:.15,output:13.5}},peakHours:Oe},{key:`glm`,name:`GLM-5.2`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3`,name:`GLM-5.3`,provider:`智谱 AI`,colorVar:`ds-blue`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3-flash`,name:`GLM-5.3-Flash`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.23,output:2.8},promo:{factor:.5,endsAtMs:Date.UTC(2026,8,8,16,0,0),note:`限时 5 折`}},{key:`glm-4.6`,name:`GLM-4.6`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16}},{key:`glm-4.5-air`,name:`GLM-4.5-Air`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.16,output:2}},{key:`glm-4.7`,name:`GLM-4.7`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5-turbo`,name:`GLM-5-Turbo`,provider:`智谱 AI`,colorVar:`ds-blue`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`glm-5.1`,name:`GLM-5.1`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24}},{key:`glm-5v-turbo`,name:`GLM-5V-Turbo`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`qwen-3.8-max`,name:`Qwen3.8 Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:12,cacheHit:1.5,output:36},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-3.8-flash`,name:`Qwen3.8 Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:1,cacheHit:.1,output:3},extraRows:[{label:`显式缓存创建`,input:1.25},{label:`显式缓存命中`,input:.1},{label:`Batch File`,input:.5,output:1.5,note:`长期半价`},{label:`Batch Chat`,input:1,output:3,note:`与标准价一致`}]},{key:`qwen-max`,name:`Qwen3.7-Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:12,cacheHit:1.2,output:36},promo:{factor:.5,note:`限时 5 折`},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1.2},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-plus`,name:`Qwen3.5-Plus`,provider:`阿里通义`,colorVar:`ds-blue`,price:{currency:`CNY`,input:.8,cacheHit:.08,output:4.8},extraRows:[{label:`显式缓存创建`,input:1},{label:`显式缓存命中`,input:.08},{label:`Batch File`,input:.4,output:2.4,note:`长期半价`},{label:`Batch Chat`,input:.8,output:4.8,note:`与标准价一致`}]},{key:`qwen-flash`,name:`Qwen3.5-Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2},extraRows:[{label:`显式缓存创建`,input:.25},{label:`显式缓存命中`,input:.02}]},{key:`doubao`,name:`Doubao Seed-2.0 Pro`,provider:`字节豆包`,colorVar:`ds-red`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-mini`,name:`Doubao Seed-2.0 Mini`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2}},{key:`doubao-1.6`,name:`Doubao Seed-1.6`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:.8,cacheHit:0,output:8}},{key:`doubao-seed-evolving`,name:`Doubao-Seed-Evolving`,provider:`字节豆包`,colorVar:`ds-red`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-pro`,name:`Doubao Seed-2.1 Pro`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-turbo`,name:`Doubao Seed-2.1 Turbo`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:3,cacheHit:.6,output:15}},{key:`kimi`,name:`Kimi K2.7 Code`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27}},{key:`kimi-k2.7-hs`,name:`Kimi K2.7 Code HighSpeed`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-600`,price:{currency:`CNY`,input:13,cacheHit:2.6,output:54}},{key:`kimi-k2.6`,name:`Kimi K2.6`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27}},{key:`kimi-k3`,name:`Kimi K3`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:20,cacheHit:2,output:100}},{key:`mimo-v2.5`,name:`MiMo V2.5`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:1,cacheHit:.02,output:2}},{key:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:3,cacheHit:.025,output:6}},{key:`minimax`,name:`MiniMax-M3`,provider:`MiniMax`,colorVar:`ds-amber`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7`,name:`MiniMax-M2.7`,provider:`MiniMax`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7-highspeed`,name:`MiniMax-M2.7-highspeed`,provider:`MiniMax`,colorVar:`ds-amber`,price:{currency:`CNY`,input:4.2,cacheHit:.42,output:16.8}},{key:`ernie`,name:`ERNIE-5.1`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:4,cacheHit:.4,output:18}},{key:`hunyuan`,name:`混元 Hy3`,provider:`腾讯混元`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:1,cacheHit:.25,output:4}},{key:`hunyuan-t1`,name:`混元 T1`,provider:`腾讯混元`,colorVar:`dsw-static-amber-300`,price:{currency:`CNY`,input:1,cacheHit:.1,output:4}},{key:`yi`,name:`Yi-Lightning`,provider:`零一万物`,colorVar:`ds-green`,price:{currency:`CNY`,input:.99,cacheHit:.1,output:.99}},{key:`step`,name:`Step 3.7 Flash`,provider:`阶跃星辰`,colorVar:`dsw-static-neutral-bluish-400`,price:{currency:`CNY`,input:1.35,cacheHit:.27,output:8.1}},{key:`spark`,name:`Spark 4.0 Ultra`,provider:`科大讯飞`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:5,cacheHit:.5,output:10},estimated:!0},{key:`sensenova`,name:`SenseNova 6.5`,provider:`商汤`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:4.5,cacheHit:.45,output:9},estimated:!0},{key:`baichuan`,name:`Baichuan M3-Plus`,provider:`百川智能`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:5,cacheHit:.5,output:9}},{key:`gpt-6-astra`,name:`GPT-6 Astra`,provider:`OpenAI`,colorVar:`ds-green`,price:{currency:`USD`,input:10,cacheHit:1,output:50}},{key:`gpt-5.6-sol`,name:`GPT-5.6 Sol`,provider:`OpenAI`,colorVar:`ds-green`,price:{currency:`USD`,input:5,cacheHit:.5,output:30},promo:{factor:.8,factors:{output:2/3},endsAtMs:Date.UTC(2026,10,21,16,0,0),note:`限时促销至 2026-11-21`}},{key:`gpt-5.6-terra`,name:`GPT-5.6 Terra`,provider:`OpenAI`,colorVar:`dsw-static-green-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:12}},{key:`gpt-5.6-luna`,name:`GPT-5.6 Luna`,provider:`OpenAI`,colorVar:`ds-green`,price:{currency:`USD`,input:.2,cacheHit:.02,output:1.2}},{key:`gemini-pro`,name:`Gemini 3.1 Pro`,provider:`Google`,colorVar:`dsw-static-blue-600`,price:{currency:`USD`,input:2,cacheHit:.2,output:12,offPeak:{input:1,cacheHit:.1,output:6}},peakHours:ke,tierSemantics:`latency`},{key:`gemini-flash`,name:`Gemini 3.6 Flash`,provider:`Google`,colorVar:`dsw-static-blue-400`,price:{currency:`USD`,input:1.5,cacheHit:.15,output:7.5,offPeak:{input:.75,cacheHit:.075,output:3.75}},peakHours:ke,tierSemantics:`latency`},{key:`grok`,name:`Grok 4.6`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`USD`,input:2,cacheHit:.5,output:6}},{key:`grok-4.3`,name:`Grok 4.3`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`USD`,input:1.25,cacheHit:.2,output:2.5}},{key:`llama`,name:`Llama 4 Maverick`,provider:`Meta`,colorVar:`ds-red`,price:{currency:`USD`,input:.2,cacheHit:.05,output:.6}},{key:`llama-scout`,name:`Llama 4 Scout`,provider:`Meta`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:.1,cacheHit:.025,output:.3}},{key:`claude-opus-4-6`,name:`Claude Opus 4.6`,provider:`Anthropic`,colorVar:`ds-red`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:3,cacheHit:.3,output:15}},{key:`claude-haiku-4-5`,name:`Claude Haiku 4.5`,provider:`Anthropic`,colorVar:`dsw-static-red-300`,price:{currency:`USD`,input:1,cacheHit:.1,output:5}},{key:`claude-opus-5`,name:`Claude Opus 5`,provider:`Anthropic`,colorVar:`ds-red`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-5`,name:`Claude Sonnet 5`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:10}},{key:`mistral-large-2512`,name:`Mistral Large 3`,provider:`Mistral AI`,colorVar:`ds-violet`,price:{currency:`USD`,input:.5,cacheHit:.05,output:1.5}},{key:`mistral-small-2603`,name:`Mistral Small 4`,provider:`Mistral AI`,colorVar:`dsw-static-violet-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`ministral-8b-latest`,name:`Ministral 8B`,provider:`Mistral AI`,colorVar:`dsw-static-violet-300`,price:{currency:`USD`,input:.1,cacheHit:.01,output:.1}},{key:`command-a-03-2025`,name:`Command A`,provider:`Cohere`,colorVar:`ds-cyan`,price:{currency:`USD`,input:2.5,cacheHit:.25,output:10}},{key:`command-r-08-2024`,name:`Command R`,provider:`Cohere`,colorVar:`dsw-static-cyan-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`longcat-2.0`,name:`LongCat 2.0`,provider:`美团`,colorVar:`ds-amber`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`minicpm-v-4.5`,name:`MiniCPM-V 4.5`,provider:`面壁智能`,colorVar:`ds-green`,price:{currency:`CNY`,input:1,cacheHit:.2,output:4},estimated:!0},{key:`ernie-4.5`,name:`ERNIE-4.5 300B`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`dots-3-note-preview`,name:`Dots3-Note Preview`,provider:`小红书`,colorVar:`ds-red`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`qwen3.6-max`,name:`Qwen3.6 Max`,provider:`阿里通义`,colorVar:`dsw-static-orange-500`,price:{currency:`CNY`,input:9,cacheHit:.9,output:54},extraRows:[{label:`显式缓存创建`,input:11.25},{label:`显式缓存命中`,input:.9}]},{key:`qwen3-coder-plus`,name:`Qwen3-Coder Plus`,provider:`阿里通义`,colorVar:`dsw-static-orange-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},extraRows:[{label:`显式缓存创建`,input:5},{label:`显式缓存命中`,input:.4}]},{key:`qwen3-coder`,name:`Qwen3-Coder 480B`,provider:`阿里通义`,colorVar:`dsw-static-orange-300`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`glm-4.5-x`,name:`GLM-4.5-X`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5.2-fast`,name:`GLM-5.2 Fast`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24},estimated:!0},{key:`kimi-k3-fast`,name:`Kimi K3 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:20,cacheHit:2,output:100},estimated:!0},{key:`kimi-k2.7-code-fast`,name:`Kimi K2.7 Code Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27},estimated:!0},{key:`kimi-k2.8-preview`,name:`Kimi K2.8 Preview`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27},estimated:!0},{key:`kimi-k2.6-fast`,name:`Kimi K2.6 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2.6-turbo`,name:`Kimi K2.6 Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2-thinking-turbo`,name:`Kimi K2 Thinking Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:8,cacheHit:1,output:58}},{key:`doubao-seed-2.0-code`,name:`Doubao Seed-2.0 Code`,provider:`字节豆包`,colorVar:`ds-red`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-seed-2.0-lite`,name:`Doubao Seed-2.0 Lite`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.6,cacheHit:.12,output:3.6}},{key:`other`,name:`其他模型`,provider:`Custom`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:0,cacheHit:0,cacheMiss:0,output:0}}],Ae={"deepseek-v4-flash":`flash`,"deepseek-v4-flash-vision-exp":`flash-vision-exp`,"deepseek-v4.1-flash":`flash`,"deepseek-v4.1-flash-expires-on-0910":`flash`,"deepseek-flash":`flash`,"deepseek-v4-pro":`pro`,"glm-5.2":`glm`,"glm-4.5-air":`glm-4.5-air`,"glm-4.5air":`glm-4.5-air`,"glm-4.7":`glm-4.7`,"glm-5-turbo":`glm-5-turbo`,"glm-5.1":`glm-5.1`,"glm-5.3-flash":`glm-5.3-flash`,"glm-5v-turbo":`glm-5v-turbo`,"glm-5v.1":`glm-5v-turbo`,"claude-opus-4-6":`claude-opus-4-6`,"claude-opus-4.6":`claude-opus-4-6`,"claude-sonnet-4-6":`claude-sonnet-4-6`,"claude-sonnet-4.6":`claude-sonnet-4-6`,"claude-haiku-4-5":`claude-haiku-4-5`,"claude-haiku-4.5":`claude-haiku-4-5`,"claude-opus-5":`claude-opus-5`,"claude-sonnet-5":`claude-sonnet-5`,"mistral-large-2512":`mistral-large-2512`,"mistral-large-3":`mistral-large-2512`,"mistral-small-2603":`mistral-small-2603`,"mistral-small-4":`mistral-small-2603`,"ministral-8b-latest":`ministral-8b-latest`,"ministral-8b":`ministral-8b-latest`,"command-a-03-2025":`command-a-03-2025`,"command-a":`command-a-03-2025`,"command-r-08-2024":`command-r-08-2024`,"command-r":`command-r-08-2024`,hy3:`hunyuan`,"longcat-2.0":`longcat-2.0`,"longcat-2":`longcat-2.0`,"minicpm-v-4.5":`minicpm-v-4.5`,"minicpm-v-4.5-thinking":`minicpm-v-4.5`,"ernie-4.5":`ernie-4.5`,"ernie-4.5-300b":`ernie-4.5`,"dots-3-note-preview":`dots-3-note-preview`,"dots-3-note":`dots-3-note-preview`,"dots3-note-preview":`dots-3-note-preview`,"rednote-dots3":`dots-3-note-preview`,"doubao-seed-evolving":`doubao-seed-evolving`,"doubao-seed-evolve":`doubao-seed-evolving`,"doubao-seed-2.1-pro":`doubao-seed-2.1-pro`,"doubao-seed-2.1-pro-290000":`doubao-seed-2.1-pro`,"doubao-seed-2.1-turbo":`doubao-seed-2.1-turbo`,"doubao-seed-2-1-turbo":`doubao-seed-2.1-turbo`,"qwen3.8-max":`qwen-3.8-max`,"qwen3.8-flash":`qwen-3.8-flash`,"qwen3.7-max":`qwen-max`,"qwen3.6-max":`qwen3.6-max`,"qwen3.6-max-preview":`qwen3.6-max`,"qwen3-coder-plus":`qwen3-coder-plus`,"qwen3-coder":`qwen3-coder`,"qwen3-coder-480b":`qwen3-coder`,"glm-4.5-x":`glm-4.5-x`,"glm-4.5x":`glm-4.5-x`,"glm-5.2-fast":`glm-5.2-fast`,"glm-5.2f":`glm-5.2-fast`,"kimi-k3-fast":`kimi-k3-fast`,"kimi-k3f":`kimi-k3-fast`,"kimi-k2.7-code-fast":`kimi-k2.7-code-fast`,"kimi-k2.7-code-f":`kimi-k2.7-code-fast`,"kimi-k2.6-fast":`kimi-k2.6-fast`,"kimi-k2.6-turbo":`kimi-k2.6-turbo`,"kimi-k2-thinking-turbo":`kimi-k2-thinking-turbo`,"doubao-seed-2.0-code":`doubao-seed-2.0-code`,"doubao-seed-2-0-code":`doubao-seed-2.0-code`,"doubao-seed-2.0-lite":`doubao-seed-2.0-lite`,"doubao-seed-2-0-lite":`doubao-seed-2.0-lite`,"qwen-max":`qwen-max`,"hunyuan-t1":`hunyuan-t1`,"step-3.7-flash":`step`,"seed-2.0-mini":`doubao-mini`,k3:`kimi-k3`,"kimi-k3":`kimi-k3`,"kimi-k2.8-preview":`kimi-k2.8-preview`,"kimi-k2.8":`kimi-k2.8-preview`,"kimi-k2-8-preview":`kimi-k2.8-preview`,"kimi-k2-8":`kimi-k2.8-preview`,"k2.8-preview":`kimi-k2.8-preview`,"k2.8":`kimi-k2.8-preview`,"minimax-m1":`minimax`,"minimax-m2":`minimax`,"minimax-m3":`minimax`,"minimax-m2.7":`minimax-m2.7`,"minimax-m2.7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2.7-high-speed":`minimax-m2.7-highspeed`,"minimax-m2-7":`minimax-m2.7`,"minimax-m2-7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2-7-high-speed":`minimax-m2.7-highspeed`,"gpt-6":`gpt-6-astra`,"gpt-6-astra":`gpt-6-astra`};function G(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let je=(()=>{let e=new Map,t=(t,n)=>{let r=G(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of W)t(e.key,e.key);for(let[e,n]of Object.entries(Ae))t(e,n);for(let e of ce)t(e.key,e.key);return e})();function K(e){let t=[],n=e=>{e!==``&&!t.includes(e)&&t.push(e)},r=e=>{let t=e;for(;;){let e=t.replace(/[-_]\d{3,}$/u,``);if(e===t||e===``)return;t=e,n(t)}},i=e.lastIndexOf(`/`);if(i>0&&i<e.length-1){let t=e.slice(i+1);n(t),r(t)}return r(e),t}function Me(e){let t=Ae[e];if(t!==void 0)return t;let n=G(e);if(n===``)return;let r=je.get(n);return r===void 0?(de??[]).find(e=>G(e.key)===n)?.key:r}function Ne(e){let t=Ae[e]??e;if(t===e){let t=G(e);if(t!==``){let e=je.get(t);if(e!==void 0)return e;let n=(de??[]).find(e=>G(e.key)===t);if(n!==void 0)return n.key}for(let t of K(e)){let e=Me(t);if(e!==void 0)return e}}return t}function Pe(e){let t=Ne(e),n=ue?.[t];if(n!==void 0)return n;let r=ce.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function Fe(e){let t=Ne(e),n=W.find(e=>e.key===t),r=de?.find(e=>e.key===t),i=n??(r===void 0?(()=>{let e=W.at(-1);if(e!==void 0)return e;throw Error(`MODEL_CATALOG must not be empty`)})():Ie(r)),a=R(t);if(a!==void 0)return{...i,userPriced:!0,price:{currency:a.currency??`CNY`,input:a.input,cacheHit:a.cacheHit,output:a.output,...a.offPeak===void 0?{}:{offPeak:a.offPeak}}};let o=Pe(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function Ie(e){return{key:e.key,name:e.name,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:e.price.input,cacheHit:e.price.cacheHit,output:e.price.output}}}function Le(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>0&&e.factor<1}function Re(e,t){let{promo:n}=e;if(n===void 0||!Le(n,t))return e;let r=e=>n.factors?.[e]??n.factor,i=e=>({input:e.input*r(`input`),cacheHit:e.cacheHit*r(`cacheHit`),...e.cacheMiss===void 0?{}:{cacheMiss:e.cacheMiss*r(`cacheMiss`)},output:e.output*r(`output`)});return{...e,price:{...i(e.price),currency:e.price.currency,...e.price.offPeak===void 0?{}:{offPeak:i(e.price.offPeak)}}}}function ze(e=Date.now()){let t=[...W.filter(e=>e.retired!==!0).map(t=>Re(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>G(e.key)));for(let e of fe??[]){let i=e.id.toLowerCase();if((()=>{let t=Ne(e.id);return W.find(e=>e.key===t)})()!==void 0)continue;let a=G(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(de??[]).find(e=>G(e.key)===a),s;if(o!==void 0)s=Ie(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=Pe(i);s=t===void 0?{key:Ne(e.id),name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:0,cacheHit:0,output:0},uncatalogued:!0}:{key:i,name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:t.input,cacheHit:t.cacheHit,output:t.output}}}n.add(s.key.toLowerCase()),a!==``&&r.add(a),t.push(s)}return t.map(e=>{let t=R(e.key);return t===void 0?e:{...e,userPriced:!0,price:{currency:t.currency??`CNY`,input:t.input,cacheHit:t.cacheHit,output:t.output}}})}function Be(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function Ve(e,t,n){let r=t.cacheMiss>0?t.cacheMiss:Math.max(0,t.input-t.cacheHit),i=Math.min(t.cacheHit,t.input),a=(r*(e.cacheMiss??e.input)+i*e.cacheHit+t.output*e.output)/1e6;return n===`USD`?a*B():a}function He(e,t,n=Se,r=Date.now()){let i=Re(e,r),a=Ve(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:Ve(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function Ue(e){let t=B();return t>0?e/t:e}function q(e,t=`cny`){let n=Number(e);if(!Number.isFinite(n))return t===`cny`?`¥0`:`$0`;let r=t===`cny`?`¥`:`$`;return n<=0?`${r}0`:n>=1e3?`${r}${n.toFixed(0)}`:n>=10?`${r}${n.toFixed(1)}`:n>=.1?`${r}${n.toFixed(2)}`:`${r}${n.toFixed(3)}`}function We(e,t=`CNY`){return e===0?`免费`:t===`USD`?e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`:e>=10?`¥${e.toFixed(1)}`:`¥${e.toFixed(2)}`}function Ge(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}function J(e){return e>=1e9?`${(e/1e9).toFixed(2)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function Ke(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}let Y={top:18,right:40,bottom:26,left:46};function qe(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function Je(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function Ye(e,t){let n=[];for(let r=0;r<e;r+=t)n.push(r);return e>0&&n[n.length-1]!==e-1&&n.push(e-1),n}let Xe={key:`__total__`,name:`总计`,color:``};function Ze({data:e,models:t=[],currency:n=`cny`,metric:i=`cost`}){let[a,s]=(0,r.useState)(null),c=e=>q(n===`usd`?Ue(e):e,n),l=e=>i===`tokens`?Je(e):c(e),u=e=>i===`tokens`?e.tokens??0:e.cost,d=(0,r.useMemo)(()=>{let n=e.length;if(n===0)return null;let r=680-Y.left-Y.right,a=220-Y.top-Y.bottom,o=e=>n===1?Y.left+r/2:Y.left+r*e/(n-1),s=Math.max(...i===`tokens`?e.map(e=>e.tokens??0):e.map(e=>Math.max(e.cost,Object.values(e.byModel??{}).reduce((e,t)=>e+t,0))),1e-4),c=e=>Y.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>Y.top+a-e/l*a,f=r/n,p=Math.min(18,f*.6);return{n,plotW:r,plotH:a,inner:o,yCost:c,yCalls:d,barW:p,bars:e.flatMap((e,n)=>{let r=o(n)-p/2;if(t.length===0||i===`tokens`)return[{date:e.date,model:Xe,x:r,base:0,value:u(e),topRounded:!0}];let a=null;for(let n of t)(e.byModel?.[n.key]??0)>0&&(a=n.key);let s=0;return t.map(t=>{let n=e.byModel?.[t.key]??0,i={date:e.date,model:t,x:r,base:s,value:n,topRounded:t.key===a};return s+=n,i})}),costTicks:[0,.25,.5,.75,1].map(e=>s*e).reverse(),callsTicks:[0,.25,.5,.75,1].map(e=>l*e).reverse(),linePath:e.map((e,t)=>{let n=d(e.calls);return`${t===0?`M`:`L`}${o(t)} ${n}`}).join(` `)}},[e,t,i]);if(d===null)return(0,o.jsx)(`div`,{className:P.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:x,linePath:S}=d,C=a===null?void 0:e[a],w=Ye(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:P.chartSvg,role:`img`,"aria-label":`Daily cost by model and total calls`,onMouseLeave:()=>{s(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Y.left)/p,r=Math.round(n*(f-1));s(Math.min(Math.max(r,0),f-1))},children:[b.map((e,t)=>{let n=g(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Y.left,x2:680-Y.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:Y.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:l(e)})]},`cost-${t}`)}),y.map(t=>{if(t.value>0)return(0,o.jsx)(`rect`,{x:t.x,y:g(t.base+t.value),width:v,height:g(t.base)-g(t.base+t.value),rx:t.topRounded?2:0,className:t.model.color===``?P.chartBar:P.chartStack,style:t.model.color===``?void 0:{fill:t.model.color}},`${t.date}-${t.model.key}`);let n=e.find(e=>e.date===t.date);return n!==void 0&&n.calls>0&&t.base===0?(0,o.jsx)(`rect`,{x:t.x,y:g(0)-1,width:v,height:1,rx:0,className:P.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:S,fill:`none`,className:P.chartLine}),x.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-Y.right+8,y:n+3,textAnchor:`start`,className:P.chartAxisLabel,children:Je(e)},`calls-${t}`)}),w.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:P.chartAxisLabel,children:qe(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:Y.top,y2:Y.top+m,className:P.chartCrosshair})]}),C!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:P.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(C.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:P.chartTooltipDate,children:C.date}),i!==`tokens`&&t.filter(e=>(C.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(C.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?Je(C.tokens??0):c(C.cost)})]}),(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:C.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:P.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartLegendLine}),`调用`]})]})]})}let X={top:14,right:42,bottom:22,left:46};function Qe(e){return e.slice(5,13).replace(`T`,` `)}function $e(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function et(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function tt(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function nt(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function rt({perf:e,models:t,t:n}){let[i,a]=(0,r.useState)(()=>ae()),[s,c]=(0,r.useState)(null),l=e=>{a(e),M(e)},u=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,f=(0,r.useMemo)(()=>e===void 0?[]:Object.entries(e.byModel).map(([e,n])=>({key:e,name:t.find(t=>t.key===e)?.name??e,color:u(e),samples:n.samples,ttftAvg:n.ttftAvg,ttftP50:n.ttftP50,ttftP90:n.ttftP90,...n.ttftMax===void 0?{}:{ttftMax:n.ttftMax},...n.ttftSpikes===void 0?{}:{ttftSpikes:n.ttftSpikes},...n.tpsAvg===void 0?{}:{tpsAvg:n.tpsAvg},latencyAvg:n.latencyAvg,estimatedSamples:n.estimatedSamples})).sort((e,t)=>t.samples-e.samples||t.ttftP90-e.ttftP90),[e,t]),p=(0,r.useMemo)(()=>{if(e===void 0)return[];if(i.models!==void 0){let t=new Set(Object.keys(e.byModel));return i.models.filter(e=>t.has(e))}return f.slice(0,5).map(e=>e.key)},[e,f,i.models]),m=(0,r.useMemo)(()=>{if(e===void 0)return null;let t=Object.keys(e.byHourModel).sort().slice(-48);if(t.length===0)return null;let n=t.length,r=680-X.left-X.right,a=180-X.top-X.bottom,o=e=>n===1?X.left+r/2:X.left+r*e/(n-1),s=new Set(p),c=e=>i.metric===`ttft`?e?.ttftAvg:e?.tpsAvg,l=[],u=0;for(let r of f){if(!s.has(r.key))continue;let i=[];for(let a=0;a<n;a++){let n=t[a];if(n===void 0)continue;let s=c(e.byHourModel[n]?.[r.key]);s===void 0||!Number.isFinite(s)||(i.push({i:a,x:o(a),y:0,v:s}),s>u&&(u=s))}l.push({key:r.key,name:r.name,color:r.color,segments:[],points:i})}let d=l.reduce((e,t)=>e+t.points.length,0);u=Math.max(u,1);let m=e=>X.top+a-e/u*a;for(let e of l){let t=``,n=-2;for(let r of e.points)r.y=m(r.v),t!==``&&r.i!==n+1&&(e.segments.push(t),t=``),t+=`${t===``?`M`:`L`}${r.x} ${r.y} `,n=r.i;t!==``&&e.segments.push(t)}let h=Math.max(1,Math.ceil(n/8)),g=[];for(let e=0;e<n;e+=h)g.push(e);return g[g.length-1]!==n-1&&g.push(n-1),{hourKeys:t,n,plotW:r,plotH:a,inner:o,yOf:m,series:l,ticks:[0,.5,1].map(e=>u*e).reverse(),xTicks:g,totalPoints:d}},[e,f,p,i.metric]);if(e===void 0||f.length===0)return(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)});let h=e=>{let t=p.includes(e)?p.filter(t=>t!==e):[...p,e];l({metric:i.metric,models:t})},g=e=>{l({metric:e,...i.models===void 0?{}:{models:i.models}})},_=s===null||m===null?[]:m.series.flatMap(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?[]:[{key:e.key,name:e.name,color:e.color,v:t.v}]});return(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:P.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:P.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfEstimated`)})]})}),(0,o.jsx)(`tbody`,{children:f.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:P.modelCell,children:[(0,o.jsx)(`span`,{className:P.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:P.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.ttftAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.ttftP50)}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.ttftP90)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):(0,o.jsxs)(`span`,{children:[et(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):tt(e.tpsAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:et(e.latencyAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:P.na,children:`—`})})]},e.key))})]})}),m!==null&&(0,o.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,o.jsx)(`div`,{className:P.perfBar,children:(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,i.metric===e&&P.rangeButtonActive),"aria-pressed":i.metric===e,"data-testid":`billing-perf-tab-${e}`,onClick:()=>{g(e)},children:e===`ttft`?`${n(`perfTtft`)} (ms)`:`${n(`perfTps`)} (${n(`perfTpsUnit`)})`},e))})}),(0,o.jsxs)(`div`,{className:P.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,o.jsx)(`button`,{type:`button`,className:P.perfChip,"data-testid":`billing-perf-chip-all`,onClick:()=>{l({metric:i.metric,models:f.map(e=>e.key)})},children:n(`perfAll`)}),f.map(e=>{let t=p.includes(e.key);return(0,o.jsxs)(`button`,{type:`button`,className:d(P.perfChip,!t&&P.perfChipOff),style:t?{color:e.color,borderColor:`color-mix(in srgb, ${e.color} 45%, transparent)`}:void 0,"aria-pressed":t,"data-testid":`billing-perf-chip-${e.key}`,onClick:()=>{h(e.key)},children:[(0,o.jsx)(`span`,{className:P.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),m.totalPoints>0?(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:P.chartSvg,role:`img`,"aria-label":`Hourly perf comparison by model`,onMouseLeave:()=>{c(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-X.left)/m.plotW,r=Math.round(n*(m.n-1));c(Math.min(Math.max(r,0),m.n-1))},children:[m.ticks.map((e,t)=>{let n=m.yOf(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:X.left,x2:680-X.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:X.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:$e(e)})]},`tick-${t}`)}),m.series.map(e=>e.segments.map((t,n)=>(0,o.jsx)(`path`,{d:t,fill:`none`,className:P.chartLine,style:{stroke:e.color}},`${e.key}-${n}`))),m.xTicks.map(e=>{let t=m.hourKeys[e];return t===void 0?null:(0,o.jsx)(`text`,{x:m.inner(e),y:174,textAnchor:`middle`,className:P.chartAxisLabel,children:Qe(t)},t)}),s!==null&&(0,o.jsx)(`line`,{x1:m.inner(s),x2:m.inner(s),y1:X.top,y2:X.top+m.plotH,className:P.chartCrosshair}),s!==null&&m.series.map(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?null:(0,o.jsx)(`circle`,{cx:t.x,cy:t.y,r:3.5,fill:e.color,className:P.chartHoverDot},`${e.key}-dot`)})]}),s!==null&&_.length>0&&(0,o.jsxs)(`div`,{className:P.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${m.inner(s)/680*100}%`,top:`${(X.top+m.plotH/2)/180*100}%`},children:[(0,o.jsx)(`div`,{className:P.chartTooltipDate,children:Qe(m.hourKeys[s]??``)}),_.map(e=>(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:nt(e.v,i.metric,n)})]},e.key))]})]}):(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),m===null&&(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let it=`@kenz1117/dsh-ui-usage-billing`,at=`kenz1117`;function ot({t:e,version:t}){return(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:P.plgHead,children:[(0,o.jsx)(`span`,{className:P.plgIcon,"aria-hidden":`true`,children:(0,o.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,o.jsx)(`path`,{d:`M10 3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a2 2 0 0 0 4 0V4a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v1a2 2 0 0 0 4 0 1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0 0 4h1a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1a2 2 0 0 0-4 0 1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 0-4H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 4 0z`})})}),(0,o.jsxs)(`div`,{className:P.plgTitle,children:[(0,o.jsxs)(`div`,{className:P.plgNameRow,children:[(0,o.jsx)(`h3`,{className:P.plgName,children:it}),(0,o.jsx)(`span`,{className:P.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:P.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:P.plgGrid,children:[(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:P.plgLink,href:`https://github.com/${at}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,at,`)`]})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:P.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:P.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:it})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:P.plgVal,children:`MIT`})]})]})]})}function st(e=Date.now()){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function ct(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let Z={top:14,right:18,bottom:22,left:46},lt=`var(--ds-blue)`,ut=`var(--ds-cyan)`,dt=`var(--ds-amber)`;function ft(e,t,n,r){return JSON.stringify({days:e,models:t,dayModels:n,total:r},null,2)}function pt(e){let{stats:t,trendDays:n,onTrendDays:i,t:a}=e,s=e.money,c=e.models??[],{byDay:l,byModel:u,total:f}=t,[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(`structure`),[_,v]=(0,r.useState)(null),y=t.byDayModels!==void 0,b=e=>{g(e),v(null)},x=(0,r.useMemo)(()=>{let e=t.byRole;if(e===void 0)return[];let n=e.user+e.assistant+e.tool;return n<=0?[]:[{label:a(`roleUser`),value:e.user,seg:P.shareSegUser},{label:a(`roleAssistant`),value:e.assistant,seg:P.shareSegAssistant},{label:a(`roleTool`),value:e.tool,seg:P.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,a]),S=(0,r.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=st(n.getTime()),i=l[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[l,n]),C=(0,r.useMemo)(()=>{let e=[];for(let r=n-1;r>=0;--r){let n=new Date;n.setDate(n.getDate()-r);let i=st(n.getTime()),a=t.byDayModels?.[i],o={},s=0;if(a!==void 0)for(let[e,t]of Object.entries(a)){let n=t.cacheHit??0,r=t.cacheMiss??0,i=t.output??0,a=n+r+i;a<=0||(o[e]={hit:n,miss:r,output:i,total:a},s+=a)}e.push({date:i,models:o,total:s})}return e},[t.byDayModels,n]),w=(0,r.useMemo)(()=>{let e=new Map;for(let t of C)for(let[n,r]of Object.entries(t.models))e.set(n,(e.get(n)??0)+r.total);return[...e.entries()].sort((e,t)=>t[1]-e[1]).map(([e])=>({key:e,name:c.find(t=>t.key===e)?.name??Fe(e).name,color:c.find(t=>t.key===e)?.color??`#8b95a3`}))},[C,c]),T=_!==null&&w.some(e=>e.key===_)?_:null,ee=e=>{if(y){if(h!==`model`){g(`model`),v(e);return}v(t=>t===e?null:e)}},E=(0,r.useMemo)(()=>{let e=0;return Object.entries(u).filter(([,e])=>e.calls>0).map(([t,n])=>{let r=n.input+n.output;e+=r;let i=n.cacheHit+n.cacheMiss;return{key:t,name:Fe(t).name,input:n.input,output:n.output,reasoning:n.reasoning??0,calls:n.calls,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,cacheHitRate:i>0?n.cacheHit/i*100:0,total:r,share:0}}).sort((e,t)=>t.total-e.total).map(t=>({...t,share:e>0?t.total/e:0}))},[u]),D=(0,r.useMemo)(()=>{let e=Object.entries(t.byTool??{}),n=e.slice(0,8),r=e.slice(8).reduce((e,[,t])=>e+t,0),i=e.reduce((e,[,t])=>e+t,0);return{top:n,rest:r>0?[[`…`,r]]:[],totalCalls:i}},[t.byTool]),O=(0,r.useMemo)(()=>{let e=S.length;if(e===0)return null;let t=680-Z.left-Z.right,n=200-Z.top-Z.bottom,r=Math.max(...h===`model`?C.map(e=>e.total):S.map(e=>e.miss+e.hit+e.output),1),i=e=>Z.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?Z.left+t/2:Z.left+t*n/(e-1),c=Math.max(1,Math.ceil(e/8)),l=[];for(let t=0;t<e;t+=c)l.push(t);return e>0&&l[l.length-1]!==e-1&&l.push(e-1),{n:e,plotW:t,plotH:n,max:r,y:i,barW:o,inner:s,indices:l,groupW:a}},[S,C,h]),te=()=>{let e=new Blob([mt(S)],{type:`text/csv`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-daily-${st()}.csv`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},k=()=>{let e=new Blob([ft(S,E,C,f)],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-${st()}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},A=p===null?void 0:S[p],j=p===null?void 0:C[p],ne=O===null?0:Math.ceil(80/Math.max(O.groupW,1)),re=p===null||O===null?void 0:p>=O.n-ne?P.chartTooltipAlignRight:p<ne?P.chartTooltipAlignLeft:void 0;return(0,o.jsxs)(`div`,{className:P.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:P.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:P.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-token-export-csv`,onClick:te,children:a(`tokenExportCsv`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-token-export-json`,onClick:k,children:a(`exportJson`)})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`tokenDaily`)}),(0,o.jsxs)(`span`,{className:P.panelHeadControls,children:[y&&(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[`structure`,`model`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,h===e&&P.rangeButtonActive),"aria-pressed":h===e,onClick:()=>{b(e)},"data-testid":`billing-token-view-${e}`,children:a(e===`structure`?`tokenViewStructure`:`tokenViewModel`)},e))}),(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,n===e&&P.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]})]}),O===null||h===`model`&&w.length===0?(0,o.jsx)(`div`,{className:P.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:P.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),onMouseLeave:()=>{m(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Z.left)/O.plotW,r=Math.round(n*(O.n-1));m(Math.min(Math.max(r,0),O.n-1))},children:[[0,.5,1].map(e=>{let t=O.max*e,n=O.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Z.left,x2:680-Z.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:Z.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:ct(t)})]},e)}),h===`structure`?S.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=O.y(0),i=O.y(e.miss),a=O.y(e.miss+e.hit),s=O.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:O.barW,height:r-i,fill:lt}),(0,o.jsx)(`rect`,{x:n,y:a,width:O.barW,height:i-a,fill:ut}),(0,o.jsx)(`rect`,{x:n,y:s,width:O.barW,height:a-s,fill:dt})]},e.date)}):C.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=0;return(0,o.jsx)(`g`,{children:w.map(t=>{let i=e.models[t.key];if(i===void 0)return null;let a=O.y(r);r+=i.total;let s=O.y(r),c=T!==null&&t.key!==T;return(0,o.jsx)(`rect`,{x:n,y:s,width:O.barW,height:a-s,fill:t.color,opacity:c?.15:1},t.key)})},e.date)}),O.indices.map(e=>{let t=S[e];return t===void 0?null:(0,o.jsx)(`text`,{x:O.inner(e),y:194,textAnchor:`middle`,className:P.chartAxisLabel,children:t.date.slice(5)},t.date)}),p!==null&&(0,o.jsx)(`line`,{x1:O.inner(p),x2:O.inner(p),y1:Z.top,y2:Z.top+O.plotH,className:P.chartCrosshair})]}),p!==null&&h===`structure`&&A!==void 0&&(0,o.jsxs)(`div`,{className:d(P.chartTooltip,re),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(p)/680*100}%`,top:`${O.y(A.miss+A.hit+A.output)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:P.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:P.chartTooltipDate,children:A.date}),(0,o.jsx)(`strong`,{children:(A.miss+A.hit+A.output).toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:ut}}),a(`tokenHit`)]}),(0,o.jsx)(`strong`,{children:A.hit.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:lt}}),a(`tokenMiss`)]}),(0,o.jsx)(`strong`,{children:A.miss.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:dt}}),a(`tokenOutput`)]}),(0,o.jsx)(`strong`,{children:A.output.toLocaleString()})]})]}),p!==null&&h===`model`&&j!==void 0&&(0,o.jsxs)(`div`,{className:d(P.chartTooltip,re),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(p)/680*100}%`,top:`${O.y(j.total)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:P.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:P.chartTooltipDate,children:j.date}),(0,o.jsx)(`strong`,{children:j.total.toLocaleString()})]}),w.map(e=>{let t=j.models[e.key];return t===void 0?null:(0,o.jsxs)(`div`,{className:P.chartTooltipModel,children:[(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]}),(0,o.jsx)(`strong`,{children:t.total.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:P.chartTooltipModelDetail,children:[a(`tokenHitShort`),` `,t.hit.toLocaleString(),` · `,a(`tokenMissShort`),` `,t.miss.toLocaleString(),` · `,a(`tokenOutput`),` `,t.output.toLocaleString()]})]},e.key)})]}),(0,o.jsx)(`div`,{className:P.chartLegend,children:h===`structure`?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:lt}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:ut}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:dt}}),a(`tokenOutput`)]})]}):w.map(e=>(0,o.jsxs)(`button`,{type:`button`,className:d(P.chartLegendItem,T===e.key&&P.chartLegendItemActive),"aria-pressed":T===e.key,"data-testid":`billing-token-legend-${e.key}`,onClick:()=>{ee(e.key)},children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key))})]})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`tokenByModel`)})}),E.length===0?(0,o.jsx)(`div`,{className:P.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:P.tableScroll,children:(0,o.jsxs)(`table`,{className:P.modelTable,"data-testid":`billing-token-model-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:E.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,className:d(y&&P.modelRowFocusable,T===e.key&&P.modelRowActive),"aria-selected":y?T===e.key:void 0,onClick:y?()=>{ee(e.key)}:void 0,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:P.numCol,children:J(e.input)}),(0,o.jsx)(`td`,{className:P.numCol,children:J(e.output)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.reasoning>0?J(e.reasoning):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsxs)(`td`,{className:P.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:P.numCol,children:J(e.total)}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsxs)(`span`,{className:P.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:P.tokenModelBar,children:(0,o.jsxs)(`span`,{className:P.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:P.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:P.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),D.totalCalls>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:P.tableScroll,children:(0,o.jsxs)(`table`,{className:P.modelTable,"data-testid":`billing-tool-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`toolName`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...D.top,...D.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelName,children:e})}),(0,o.jsx)(`td`,{className:P.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:P.numCol,children:[(t/D.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),x.length>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`roleCost`)}),(0,o.jsx)(`span`,{className:P.panelHint,children:a(`roleHint`)})]}),(0,o.jsx)(`div`,{className:P.shareTrack,"data-testid":`billing-role-track`,children:x.map(e=>(0,o.jsx)(`div`,{className:d(P.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:P.shareLegend,children:x.map(e=>(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:d(P.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:P.shareValue,children:[s(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function mt(e){return[`date,missInput,cacheHit,output,reasoning,total`,...e.map(e=>`${e.date},${e.miss},${e.hit},${e.output},${e.reasoning},${e.miss+e.hit+e.output}`)].join(`
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function It(e,t,n){let r=[...n].sort(),i=r[0],a=r.at(-1);return`${e}${i!==void 0&&a!==void 0?`-${i}_${a}`:``}.${t}`}function Lt(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),setTimeout(()=>URL.revokeObjectURL(r),0)}let Rt=`usageBilling`,zt={title:`使用统计`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,liveTurn:`本轮`,liveSession:`会话`,calls:`调用`,cacheHitRate:`缓存命中率`,tokens:`Token`,inputTokens:`输入`,outputTokens:`输出`,avgCost:`平均成本`,kpiRange:`统计范围`,avgRangeToday:`今日`,avgRange7d:`近7天`,avgRangeWeek:`本周`,avgRangeMonth:`本月`,avgRangeAll:`累计`,trend:`每日费用与调用趋势`,trend7d:`7 天`,trend30d:`30 天`,trendMetric:`趋势指标`,trendMetricCost:`费用`,trendMetricTokens:`Token`,trendEmpty:`暂无趋势数据`,budget:`本月预算`,budgetRemain:`剩余预算`,budgetAmount:`预算金额`,budgetSummary:`本月已用 {used} / {total};达到 80% 时提醒,达到 100% 时红色脉冲警示`,sessions:`会话明细`,sessionTitle:`标题`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`提供商计费与订阅`,channelUnknown:`未知路由`,directTag:`直连`,relayTag:`中转`,unknownTag:`未知`,planCountUnit:`套餐`,actual:`实际`,pricing:`模型单价表`,input:`输入`,output:`输出`,cacheHit:`缓存命中`,peak:`高峰`,offPeak:`低谷`,flat:`全天统一`,band:`时段`,close:`关闭`,footer:`每 30s 自动轮询 · 仅统计本机 dsh 会话`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`数据更新于`,noData:`暂无计费数据`,todayRate:`今日汇率`,rateLive:`实时`,rateBuiltin:`内置`,promoBadge:`促`,promoUntil:`促销价至 {date},之后自动恢复刊例价`,promoOpenEnded:`厂商未公布截止时间,当前按折扣计价;公告截止后自动恢复刊例价`,pricingTip:`DeepSeek 现行刊例:V4.1 Flash 谷档 未命中 ¥1 / 缓存命中 ¥0.02 / 输出 ¥4;V4 Pro 谷档 未命中 ¥4.5 / 缓存命中 ¥0.15 / 输出 ¥13.5;峰价均为谷价 × 2。工作日 9-12 / 14-18 为高峰价,其余时段(含周末全天)为低谷价;费用按调用时刻计。`,pricingUnit:`单位:人民币 / 每百万 Token`,pricingNotes:`计价说明`,ubPeak:`峰`,ubOff:`谷`,ubStd:`标准`,peakBand:`峰谷分带`,pricingSource:`数据来源`,noteCache:`命中部分按缓存价计费,显著降低成本。`,noteBand:`高峰与空闲时段单价不同,空闲约半价。`,noteSource:`价格来自实时汇率 + 模型定价目录,未收录模型按 0 计并提示。`,balance:`余额`,recharge:`充值`,rechargeHint:`打开该厂商官方平台的充值页`,balanceUnconfigured:`未配置`,balanceUnauthorized:`密钥无效`,balanceUnreachable:`查询失败`,uncatalogued:`未收录`,estimatedPricing:`估算价`,balanceDays:`约可撑 {days} 天`,balanceLowBody:`{name} 余额 {balance},约可撑 {days} 天,请及时充值`,reconcileDrift:`系统监控到{provider}官方余额变动 {spent},本面板记录 {today},差额通常由其它工具或 API 的消耗所致`,reconcileDismiss:`知道了`,subscriptionNotConfigured:`未配置密钥`,subscriptionUnauthorized:`密钥无效`,subscriptionUnavailable:`查询失败`,subscriptionInvalid:`响应异常`,subscriptionRateLimited:`触发限流`,subscriptionSession:`本次`,subscriptionWeekly:`本周`,subscriptionMonthly:`本月`,subscriptionBilling:`计费周期`,subscriptionRemaining:`剩余 {pct}%`,subscriptionExhausted:`已用尽`,subscriptionReset:`{date} 重置`,subscriptionNoApi:`该厂商暂未提供用量查询接口`,floatWindow:`模型用量悬浮窗`,floatModeCombined:`综合`,floatModeSubscription:`订阅卡`,floatMode:`展示模式`,floatTargets:`订阅目标`,floatWindowHint:`悬浮在左下角计费卡上的用量速览;综合=当前样式,订阅卡=每次展示一张订阅额度卡(可切换)。`,floatPrimaryToday:`今日`,floatPrimaryWeek:`本周`,floatPrimaryMonth:`本月`,cardDisplay:`计费卡显示`,cardDisplayHint:`切换左下角计费卡的主指标与主数字统计范围(迷你柱跟随视角,悬浮窗不受影响)。`,cardMetric:`主指标`,cardMetricMoney:`花费金额`,cardMetricTokens:`Token 消耗`,cardSpan:`统计范围`,cardSpanDay:`日`,cardSpanWeek:`周`,cardSpanMonth:`月`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;模型可用下拉候选(目录键或模型 id);来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价(协议可省);低谷价三栏填后按峰/谷混合估算,留空=平档`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceOffPeak:`低谷价`,userPriceNormal:`标准价`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemoveSelected:`删除所选`,userPriceSelect:`选择此行`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabPricing:`费率`,tabSettings:`设置`,budgetHint:`设置月度上限,用于本月预计与超支分段提醒`,peakAlertHint:`在切档前弹窗提醒,可选同步系统通知`,peakAlertDescPeak:`即将进入高峰时段,价格将上调,请提前安排长任务`,peakAlertDescOff:`即将进入平价时段,价格减半,适合运行大批量任务`,export:`导出`,exportCsvDay:`按日 CSV`,exportCsvSession:`按会话 CSV`,exportJson:`全量 JSON`,peakShare:`峰谷时段占比`,peakSharePerCall:`按调用时刻精确判档`,offPeakSavings:`挪谷可省约 {amount}`,perfMax:`最大 TTFT`,weekCost:`本周`,roleCost:`费用构成`,roleUser:`用户输入`,roleAssistant:`助手输出`,roleTool:`工具结果`,roleHint:`估算:输出按实测计价,输入按消息长度摊分`,tierPeak:`峰时`,tierOff:`平价`,tierToPeak:`后转峰时`,tierToOff:`后转平价`,tierAlertEnterPeak:`{minutes} 分钟后进入峰时(DeepSeek 高峰价 ×2),不急的调用可稍等`,tierAlertEnterOff:`{minutes} 分钟后进入平价(价格减半)`,peakAlertTitlePeak:`即将进入高峰价`,peakAlertTitleOff:`即将进入平价`,peakAlert:`峰谷切换提醒`,peakAlertLeadMin:`提前量(分钟)`,peakAlertPos:`位置`,peakAlertMode:`提醒模式`,peakAlertPosCorner:`右下角`,peakAlertPosCenter:`屏幕居中`,peakAlertModePeak:`仅进入峰时`,peakAlertModeOff:`仅进入平价`,peakAlertModeBoth:`峰与谷都提醒`,peakAlertWebNotify:`同时发系统通知`,peakAlertPreview:`预览提醒`,planTypeCode:`订阅制`,planTypeToken:`按量`,subscriptionFeePerMonth:`{amount}/月`,triggerToday:`今日`,triggerMonth:`当月`,triggerMonthTokens:`当月 Token`,triggerTodayTokens:`今日 Token`,triggerWeekTokens:`本周 Token`,subscriptionTag:`订阅`,free:`免费`,perfSamples:`样本`,perfTtft:`首字延时`,perfP50:`P50`,perfP90:`P90`,perfTps:`生成速度`,perfLatency:`总延迟`,perfEstimated:`估算样本`,perfEmpty:`暂无性能数据`,perfTpsUnit:`tok/s`,perfTitle:`性能`,perfHint:`按模型与按小时聚合;估算样本为工具续写步骤`,perfAll:`全选`,perfChartEmpty:`未选择模型或该指标暂无数据`,heatmapYear:`年`,heatmapMonth:`月`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,tokenViewStructure:`按结构`,tokenViewModel:`按模型`,tokenHitShort:`命中`,tokenMissShort:`未命中`,tokenTotal:`总 Token`,tokenShare:`占比`,usageStatsTool:`注入用量查询工具`,usageStatsToolHint:`让模型可在对话中查询用量/费用;会占用模型每次请求的上下文,coding 场景建议关闭(改后需重载应用生效)`,balanceGranted:`赠金余额`,balanceTopped:`充值余额`,balanceDaily:`日均消耗`,balanceDaysLong:`约可撑`,balanceDaysUnit:`天`,popTodayModel:`主力消耗模型余额`,popTitle:`用量速览`,popNoConsumption:`暂无消耗`,popDirectLead:`直联`,popSubLead:`订阅`,unpricedHint:`{count} 个模型未收录计价,费用已按 0 计`,searchEstimateHint:`含 {count} 次联网搜索请求的估算费用(每次约 {each};日志无用量事件,按次估算,可在配置 searchCallEstimateCny 调整或关闭)`,siteListDisplay:`中转站列表`,siteListDisplayHint:`隐藏「未识别」占位条目,净化中转站额度列表`,liveCostBar:`平价消耗胶囊`,liveCostBarHint:`输入框旁的即时代费条,悬浮可看详情`,liveCostBarPosition:`位置`,liveCostBarPosBelow:`输入框下方`,liveCostBarPosAbove:`输入框上方`,liveCostBarPosToolbar:`输入框内部`,exportCsvSite:`按站点 CSV`,panelRelayQuota:`中转站额度`,relayBalance:`余额`,relayNoQuota:`未读出额度`,relayWindowUsed:`已用`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`未识别`},Bt={title:`Usage`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,liveTurn:`Turn`,liveSession:`Session`,calls:`Calls`,cacheHitRate:`Cache Hit`,tokens:`Tokens`,inputTokens:`Input`,outputTokens:`Output`,avgCost:`Avg cost`,kpiRange:`Range`,avgRangeToday:`Today`,avgRange7d:`7d`,avgRangeWeek:`Week`,avgRangeMonth:`Month`,avgRangeAll:`All`,trend:`Daily cost & calls`,trend7d:`7D`,trend30d:`30D`,trendMetric:`Trend metric`,trendMetricCost:`Cost`,trendMetricTokens:`Tokens`,trendEmpty:`No trend data yet`,budget:`Monthly budget`,budgetRemain:`Remaining`,budgetAmount:`Budget amount`,budgetSummary:`Used {used} / {total} this month; warn at 80%, pulse red at 100%`,sessions:`Sessions`,sessionTitle:`Title`,lastActive:`Last active`,sessionOverflow:`Top {limit} of {total} sessions by cost`,budgetTierBody:`This month {cost} reached {pct}% of the budget {budget}`,models:`Model billing`,providerBilling:`Provider billing & subscriptions`,channelUnknown:`Unknown routes`,directTag:`Direct`,relayTag:`Relay`,unknownTag:`Unknown`,planCountUnit:`plan(s)`,actual:`Actual`,pricing:`Model pricing`,input:`Input`,output:`Output`,cacheHit:`Cache hit`,peak:`Peak`,offPeak:`Off-peak`,flat:`Flat`,band:`Band`,close:`Close`,footer:`Polls every 30s · local dsh sessions only`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`Updated`,noData:`No billing data yet`,todayRate:`Today rate`,rateLive:`Live`,rateBuiltin:`Built-in`,promoBadge:`Promo`,promoUntil:`Promo price until {date}, then list price resumes automatically`,promoOpenEnded:`End date not announced; billed at the discounted rate until further notice, then list price resumes`,pricingTip:`DeepSeek list rates: V4.1 Flash off-peak ¥1 miss / ¥0.02 cache-hit / ¥4 output; V4 Pro off-peak ¥4.5 miss / ¥0.15 cache-hit / ¥13.5 output; peak = 2× off-peak. Weekday 9-12 / 14-18 bills at peak, all other times (weekends included) at off-peak; billed at call time.`,pricingUnit:`Unit: CNY / per 1M tokens`,pricingNotes:`Pricing notes`,ubPeak:`Peak`,ubOff:`Off`,ubStd:`Std`,peakBand:`Peak/off-peak band`,pricingSource:`Data source`,noteCache:`Cache hits are billed at the cache rate, cutting cost.`,noteBand:`Peak and off-peak prices differ; off-peak is roughly half price.`,noteSource:`Prices come from the live rate + model catalog; unlisted models count as 0 and are flagged.`,balance:`Balance`,recharge:`Top up`,rechargeHint:`Open the vendor's official top-up page`,balanceUnconfigured:`Not set`,balanceUnauthorized:`Bad key`,balanceUnreachable:`Unavailable`,uncatalogued:`Not catalogued`,estimatedPricing:`Estimated`,balanceDays:`~{days} days left`,balanceLowBody:`{name} balance {balance}, ~{days} days left, please top up`,reconcileDrift:`Detected {provider} official balance moved {spent}, this panel recorded {today}; the gap usually comes from other tools or APIs consuming too`,reconcileDismiss:`Got it`,subscriptionNotConfigured:`Key not set`,subscriptionUnauthorized:`Bad key`,subscriptionUnavailable:`Unavailable`,subscriptionInvalid:`Bad response`,subscriptionRateLimited:`Rate limited`,subscriptionSession:`Current`,subscriptionWeekly:`Weekly`,subscriptionMonthly:`Monthly`,subscriptionBilling:`Billing`,subscriptionRemaining:`{pct}% left`,subscriptionExhausted:`Exhausted`,subscriptionReset:`Resets {date}`,subscriptionNoApi:`Provider does not offer a usage API`,floatWindow:`Model usage popover`,floatModeCombined:`Combined`,floatModeSubscription:`Subscription card`,floatMode:`Display mode`,floatTargets:`Targets`,floatWindowHint:`Usage summary floating on the footer card; Combined=current style, Subscription cards=one quota card at a time (switchable).`,floatPrimaryToday:`Today`,floatPrimaryWeek:`Week`,floatPrimaryMonth:`Month`,cardDisplay:`Billing card`,cardDisplayHint:`Switch the bottom-left billing card between cost and token usage, and pick the figure range (sparkline follows; the popover is unaffected).`,cardMetric:`Main metric`,cardMetricMoney:`Cost`,cardMetricTokens:`Token usage`,cardSpan:`Range`,cardSpanDay:`Day`,cardSpanWeek:`Week`,cardSpanMonth:`Month`,floatNoTargets:`No subscription selected — pick some in Settings.`,floatNoTargetsHint:`No subscription channel available.`,subscriptionsStale:`Subscription refresh failed — showing cached data`,staleLedgerNotice:`{count} sessions use legacy-algorithm archives (logs deleted); attribution may be off`,tokenCacheWrite:`written`,toolRank:`Tool calls`,toolName:`Tool`,userPrices:`Custom prices`,userPricesHint:`Enter actual per-1M-token prices; main views are re-costed. Pick a model key from the dropdown candidates. Leave source empty for the model default, or enter a relay origin (protocol optional) to price only that source. Fill all three off-peak fields for peak/off-peak estimation; leave them empty for flat pricing.`,userPriceSave:`Save`,userPriceModel:`Model`,userPriceSource:`Source (relay origin)`,userPriceSourceHint:`Empty = default; e.g. https://api.relay.com`,userPriceOffPeak:`Off-peak price`,userPriceNormal:`Standard price`,userPriceCurrency:`Currency`,userPriceAdd:`Add`,userPriceRemoveSelected:`Remove selected`,userPriceSelect:`Select this row`,sessionStaleBadge:`legacy`,sessionUntitled:`Untitled session`,heatmapLess:`Less`,heatmapMore:`More`,currency:`Currency`,currencyCny:`CNY`,currencyUsd:`USD`,heatmap:`Usage heatmap`,rounds:`Cost per turn`,roundsHint:`Last {count} rounds · bar tops show amount · fill = peak/off-peak`,anomaly:`Cost spike`,model:`Model`,thModel:`Model name`,thInputMiss:`Input (cache miss)`,thInputHit:`Input (cache hit)`,costAbbr:`cost`,tabOverview:`Overview`,tabTrends:`Trends`,tabProviders:`Bills`,tabPricing:`Rates`,tabSettings:`Settings`,budgetHint:`Set a monthly cap for projections and tier alerts`,peakAlertHint:`Alert before a tier switch, optionally via system notification`,peakAlertDescPeak:`About to enter peak hours — prices rise, plan long tasks ahead`,peakAlertDescOff:`About to enter off-peak hours — price halves, ideal for large batches`,export:`Export`,exportCsvDay:`Daily CSV`,exportCsvSession:`Sessions CSV`,exportJson:`Full JSON`,peakShare:`Peak vs off-peak`,peakSharePerCall:`per-call attribution, full history`,offPeakSavings:`Shift peak to off-peak: save ~{amount}`,perfMax:`Max TTFT`,weekCost:`This week`,roleCost:`Cost breakdown`,roleUser:`User input`,roleAssistant:`Assistant output`,roleTool:`Tool results`,roleHint:`Estimated: output priced exactly, input split by message size`,tierPeak:`Peak`,tierOff:`Off-peak`,tierToPeak:`until peak`,tierToOff:`until off-peak`,tierAlertEnterPeak:`Peak pricing (2x) starts in {minutes} min — non-urgent calls can wait`,tierAlertEnterOff:`Off-peak pricing (50% off) starts in {minutes} min`,peakAlertTitlePeak:`Peak pricing incoming`,peakAlertTitleOff:`Off-peak incoming`,peakAlert:`Peak/off-peak alert`,peakAlertLeadMin:`Lead time (min)`,peakAlertPos:`Position`,peakAlertMode:`Remind mode`,peakAlertPosCorner:`Bottom-right`,peakAlertPosCenter:`Center`,peakAlertModePeak:`Entering peak only`,peakAlertModeOff:`Entering off-peak only`,peakAlertModeBoth:`Both`,peakAlertWebNotify:`Also send system notification`,peakAlertPreview:`Preview alert`,planTypeCode:`Subscription`,planTypeToken:`Usage`,subscriptionFeePerMonth:`{amount}/mo`,triggerToday:`Today`,triggerMonth:`This month`,triggerMonthTokens:`Monthly tokens`,triggerTodayTokens:`Today's tokens`,triggerWeekTokens:`This week's tokens`,subscriptionTag:`Plan`,free:`Free`,perfSamples:`Samples`,perfTtft:`TTFT`,perfP50:`P50`,perfP90:`P90`,perfTps:`Speed`,perfLatency:`Total latency`,perfEstimated:`Estimated`,perfEmpty:`No performance data yet`,perfTpsUnit:`tok/s`,perfTitle:`Performance`,perfHint:`Per model & per hour; estimated samples are tool-continuation steps`,perfAll:`All`,perfChartEmpty:`No model selected or no data for this metric`,heatmapYear:`Year`,heatmapMonth:`Month`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginAuthor:`Author`,pluginRepository:`Repository`,pluginNpm:`npm`,pluginLicense:`License`,tabToken:`Usage`,tokenExport:`Export tokens`,tokenExportCsv:`Daily token CSV`,tokenReasoningShare:`Reasoning share`,tokenReasoningShort:`reasoning`,tokenIo:`In/out ratio`,tokenPeak:`Peak day`,tokenDaily:`Daily tokens`,tokenByModel:`Tokens by model`,tokenMiss:`Input (cache miss)`,tokenHit:`Input (cache hit)`,tokenOutput:`Output`,tokenViewStructure:`Structure`,tokenViewModel:`By model`,tokenHitShort:`Hit`,tokenMissShort:`Miss`,tokenTotal:`Total tokens`,tokenShare:`Share`,usageStatsTool:`Inject usage-stats tool`,usageStatsToolHint:`Lets the model query usage/cost inside a conversation; it consumes context per request, so keep it off for coding (takes effect after a reload)`,balanceGranted:`Granted`,balanceTopped:`Topped up`,balanceDaily:`Daily burn`,balanceDaysLong:`~days left`,balanceDaysUnit:`days`,popTodayModel:`Main model balance`,popTitle:`Usage overview`,popNoConsumption:`No usage yet`,popDirectLead:`Direct`,popSubLead:`Subscription`,unpricedHint:`{count} models not priced; their cost counts as 0`,searchEstimateHint:`Includes estimated cost of {count} web-search requests (~{each} each; no usage events logged, per-call estimate; tune via searchCallEstimateCny)`,siteListDisplay:`Relay lists`,siteListDisplayHint:`Hide "unidentified" placeholder rows in the relay quota list`,liveCostBar:`Live cost capsule`,liveCostBarHint:`Live cost bar beside the composer; hover for details`,liveCostBarPosition:`Position`,liveCostBarPosBelow:`Below composer`,liveCostBarPosAbove:`Above composer`,liveCostBarPosToolbar:`Inside composer`,exportCsvSite:`By site CSV`,panelRelayQuota:`Relay quotas`,relayBalance:`Balance`,relayNoQuota:`No quota`,relayWindowUsed:`used`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`Unknown`},Vt={"智谱 AI":`Zhipu AI`,阿里通义:`Alibaba Qwen`,字节豆包:`ByteDance Doubao`,月之暗面:`Moonshot AI`,小米:`Xiaomi`,百度文心:`Baidu ERNIE`,腾讯混元:`Tencent Hunyuan`,零一万物:`01.AI`,阶跃星辰:`StepFun`,科大讯飞:`iFlytek Spark`,商汤:`SenseNova`,百川智能:`Baichuan`,"小米 Token Plan(海外)":`Xiaomi Token Plan (Global)`,"小米 Token Plan(国内)":`Xiaomi Token Plan (CN)`,"小米 Token Plan(新加坡)":`Xiaomi Token Plan (SG)`,"火山引擎 Token Plan":`Volcengine Token Plan`,"火山方舟 Token Plan":`Volcengine Ark Token Plan`,"豆包 Token Plan":`Doubao Token Plan`,"百度文心 Plan":`Baidu ERNIE Plan`,"MiniMax Token Plan(国内)":`MiniMax Token Plan (CN)`};function Ht(e,t){return t===`en`?Vt[e]??e:e}let Ut={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},Wt={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function Gt(e){try{return new URL(e).host}catch{return e}}function Kt(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=Ut[n];return r===void 0?Gt(n):t===`en`?Wt[r]??r:r}if(e.startsWith(`direct:`)){let n=e.slice(7);return/^deepseek(?:-[a-z0-9-]+)?$/i.test(n)?t===`en`?`DeepSeek Official`:`DeepSeek 官方`:`${t===`en`?`Direct`:`直连`} · ${n}`}}let qt=[`直连 · `,`Direct · `];function Jt(e){for(let t of qt)if(e.startsWith(t))return e.slice(t.length)}let Yt=`dsh-billing-peak-alert-v1`,Xt={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function Zt(){try{let e=localStorage.getItem(Yt);if(e===null)return{...Xt};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:Xt.mode,r=t.position===`center`?`center`:`bottom-right`;return{enabled:t.enabled===!0,leadMin:typeof t.leadMin==`number`&&Number.isFinite(t.leadMin)?Math.min(30,Math.max(1,Math.round(t.leadMin))):Xt.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...Xt}}}function Qt(e){try{localStorage.setItem(Yt,JSON.stringify(e))}catch{}}function $t(e,t,n){if(!t.enabled)return null;let r=Ee(e,t.leadMin*6e4);return r===null||t.mode===`peak`&&r.entering!==`peak`||t.mode===`offPeak`&&r.entering!==`offPeak`||r.atMs===n?null:r}function en({hit:e,config:t,t:n,onDismiss:i}){let[a,s]=(0,r.useState)(()=>Date.now());if((0,r.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,r.useEffect)(()=>{a>=e.atMs&&i()},[a,e.atMs,i]),a>=e.atMs)return null;let c=Math.max(1,Math.round((e.atMs-a)/6e4)),l=e.entering,u=n(l===`peak`?`tierPeak`:`tierOff`),f=n(l===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),p=l===`peak`;return(0,o.jsxs)(`div`,{className:d(P.peakCard,p?P.peakCardPeak:P.peakCardOff,t.position===`center`?P.peakCardCenter:P.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:P.peakHead,children:[(0,o.jsxs)(`span`,{className:d(P.peakTag,p?P.peakTagPrimary:P.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:d(P.peakDot,p?P.peakDotPrimary:P.peakDotSuccess),"aria-hidden":`true`}),u]}),(0,o.jsx)(`button`,{type:`button`,className:P.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:d(P.peakCount,p?P.peakCountPrimary:P.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:P.peakDesc,children:f})]})}let tn=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],nn=[50,80,100],rn={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},an={DeepSeek:[`deepseek`],"智谱 AI":[`zhipu`,`glm`,`z.ai`],阿里通义:[`qwen`,`tongyi`,`dashscope`,`aliyun`],字节豆包:[`doubao`,`volcengine`,`ark`],月之暗面:[`moonshot`,`kimi`],小米:[`xiaomi`,`mi`,`mimo`],MiniMax:[`minimax`],百度文心:[`ernie`,`wenxin`,`qianfan`,`baidu`],腾讯混元:[`hunyuan`,`tencent`],零一万物:[`01.ai`,`lingyi`,`yi`],阶跃星辰:[`step`,`stepfun`,`step-3.7`],科大讯飞:[`spark`,`xfyun`,`iflytek`],商汤:[`sensenova`,`sensetime`],百川智能:[`baichuan`],OpenAI:[`openai`],Google:[`google`,`gemini`],xAI:[`xai`,`grok`],Meta:[`meta`,`llama`],Anthropic:[`claude`,`anthropic`],"Mistral AI":[`mistral`,`ministral`,`devstral`],Cohere:[`cohere`,`command`],美团:[`longcat`,`meituan`],面壁智能:[`minicpm`,`modelbest`],小红书:[`dots`,`rednote`,`xiaohongshu`]};function Q(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function on(e,t){if(e.length===0||t.length===0)return!1;if(e===t)return!0;let[n,r]=e.length<=t.length?[e,t]:[t,e];return n.length>=3&&r.includes(n)}function sn(e,t){let n=Q(e),r=Q(t);if(on(n,r))return!0;let i=an[e];return i!==void 0&&i.some(e=>on(Q(e),r))}function cn(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(an))for(let r of n){let n=Q(r);if(n.length!==0&&(t===n||t.startsWith(`${n}-`)||t.startsWith(`${n}/`)||t.startsWith(`${n}_`)||t.includes(`${n}-`)||t.includes(`${n}/`)||t.includes(`${n}_`)))return e}for(let[e,t]of Object.entries(an))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let ln={"kimi-coding":`月之暗面`,"zai-coding-cn":`智谱 AI`,"zai-coding":`智谱 AI`,"qwen-token-plan":`阿里通义`,"qwen-token-plan-cn":`阿里通义`,"xiaomi-token-plan-ams":`小米`,"xiaomi-token-plan-cn":`小米`,"xiaomi-token-plan-sgp":`小米`,"volcengine-token-plan":`字节豆包`,"ark-token-plan":`字节豆包`,"doubao-token-plan":`字节豆包`,ernie:`百度文心`,baidu:`百度文心`,wenxin:`百度文心`,minimax:`MiniMax`,"minimax-cn":`MiniMax`,"minimax-token-plan":`MiniMax`,"minimax-token-plan-cn":`MiniMax`,"hunyuan-token-plan":`腾讯混元`,"tencent-token-plan":`腾讯混元`,"hy-token-plan":`腾讯混元`,"xinghuo-token-plan":`讯飞星火`,"xfyun-coding":`讯飞星火`,"spark-coding":`讯飞星火`,"huawei-token-plan":`华为云`,"pangu-token-plan":`华为云`,"huawei-maas-token-plan":`华为云`,"volcengine-agent-plan":`字节豆包`,"ark-agent-plan":`字节豆包`,"baidu-token-plan":`百度文心`,"ernie-token-plan":`百度文心`,"wenxin-token-plan":`百度文心`,opencode:`OpenCode`,"opencode-go":`OpenCode`};function un(e){let t=ln[e];return t===void 0?cn(e)??e:t}let dn=`https://platform.kimi.com/console/pay`,fn=`https://open.bigmodel.cn/finance-center/finance/pay`,pn=`https://bailian.console.aliyun.com/`,mn=`https://console.volcengine.com/ark`,hn=`https://console.anthropic.com/settings/billing`,gn=`https://console.cloud.google.com/billing`,_n=`https://console.x.ai/`,vn=`https://platform.xiaomimimo.com/console/balance`,yn=`https://console.cloud.tencent.com/expense/recharge`,bn={deepseek:`https://platform.deepseek.com/top_up`,minimax:`https://platform.minimax.cn/console/recharge-records`,moonshot:dn,kimi:dn,zhipu:fn,bigmodel:fn,qwen:pn,dashscope:pn,doubao:mn,volcengine:mn,ark:mn,openai:`https://platform.openai.com/settings/organization/billing`,anthropic:hn,claude:hn,google:gn,gemini:gn,xai:_n,grok:_n,siliconflow:`https://cloud.siliconflow.cn/account/charge`,hunyuan:yn,tencent:yn,腾讯云:yn,xiaomi:vn,mimo:vn,mi:vn,qianfan:`https://console.bce.baidu.com/qianfan/overview`};function xn(e){let t=bn[e];if(t!==void 0)return t;let n=Object.keys(bn).find(t=>e.startsWith(t));return n===void 0?void 0:bn[n]}function Sn(e){let t=Q(e),n=xn(t);if(n!==void 0)return n;for(let[e,n]of Object.entries(an))if(on(Q(e),t))for(let e of n){let t=xn(Q(e));if(t!==void 0)return t}}function Cn(e,t){let n=Object.keys(e).filter(e=>e<=t).sort().slice(-7);return n.length===0?0:n.reduce((t,n)=>t+(e[n]?.cost??0),0)/n.length}function wn(e,t,n){let r=Object.keys(e).filter(e=>e.startsWith(t)),i=t.split(`-`),a=new Date(Number(i[0]),Number(i[1]),0).getDate(),o=r.length>0?r.reduce((t,n)=>t+(e[n]?.cost??0),0)/r.length:Cn(e,n);return o<=0?0:o*a}function Tn(e){let t=_e();if(t===void 0||e.byDayModels===void 0)return e;let n=xe().rate,r=e.byDayModelsSite!==void 0,i={},a={},o=new Map,s=0,c=e=>t.some(t=>t.origin!==void 0&&t.origin!==``&&(t.key===e||G(t.key)===G(e))),l=(e,t,r)=>{if(e===void 0)return r;let i=Math.min(t.cacheHit,t.cacheMiss+t.cacheHit),a=r=>{let a=(t.cacheMiss*r.input+i*r.cacheHit+t.output*r.output)/1e6;return e.currency===`USD`?a*n:a};return e.offPeak===void 0?a(e):a(e)*Se+a(e.offPeak)*(1-Se)};for(let[t,n]of Object.entries(e.byDayModels)){let u=0,d={};for(let[i,a]of Object.entries(n)){let n=R(i)??ye(i),s=r&&c(i),f;if((n!==void 0||s)&&s&&e.byDayModelsSite?.[t]?.[i]!==void 0){let r=0;for(let[a,o]of Object.entries(e.byDayModelsSite[t][i])){let e=a.startsWith(`site:`)?a.slice(5):void 0,t=e===void 0?void 0:R(i,e);r+=l(t??n,o,o.cost)}f=r}else f=l(n,a,a.cost);u+=f,d[i]={...a,cost:f},o.set(i,(o.get(i)??0)+f)}let f=e.byDay[t];f!==void 0&&(i[t]={...f,cost:u}),a[t]=d,s+=u}return{...e,total:{...e.total,cost:s},byDay:i,byDayModels:a,byModel:Object.fromEntries(Object.entries(e.byModel).map(([e,t])=>{let n=o.get(e);return[e,n===void 0?t:{...t,cost:n}]})),unpricedModels:(e.unpricedModels??[]).filter(e=>!R(e)&&!ye(e))}}function En(){return typeof Notification<`u`&&Notification.permission===`granted`}let Dn=new Set;function On(e,t){Dn.has(e)||(Dn.add(e),fetch(`/api/billing/notify-claim`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e})}).then(e=>e.json()).then(e=>{e.claimed!==!1&&t()}).catch(()=>t()))}function kn(e){return Object.keys(e).length}function An(e,t=Date.now()){let n=0,r=new Date(t);for(;$(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function jn(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=$(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function Mn(e,t,n=e=>e.cost){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=0;for(let t=0;t<=i;t+=1){let i=new Date(r);i.setDate(i.getDate()-t);let o=e[$(i.getTime())];o!==void 0&&(a+=n(o))}return a}function Nn(e,t,n){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=new Date(r);a.setDate(a.getDate()-i);let o=$(a.getTime()),s=new Date(r);s.setDate(s.getDate()-6);let c=$(s.getTime()),l=0,u=0,d=0,f=0,p=0,m=0,h=0,g,_=0;for(let[r,i]of Object.entries(e)){if(!(n===`today`?r===t:n===`7d`?r>=c&&r<=t:n===`week`?r>=o&&r<=t:r.startsWith(t.slice(0,7))))continue;l+=i.cost,u+=i.calls,d+=i.input,f+=i.output,p+=i.cacheHit,m+=i.cacheMiss,h+=i.reasoning??0;let e=i.cacheMiss+i.cacheHit+i.output;e>_&&(_=e,g=r)}return{cost:l,calls:u,input:d,output:f,cacheHit:p,cacheMiss:m,reasoning:h,peakDay:g,peakTokens:_}}function Pn(e,t){return e.checked?e.okProviders.some(e=>sn(t,e))?P.healthOk:e.badProviders.some(e=>sn(t,e))?P.healthBad:P.healthIdle:P.healthIdle}function Fn(e){let t=new Map,n=[];for(let r of e){if(r.title===void 0||r.title===``){n.push(r);continue}let e=t.get(r.title);if(e===void 0){let e={...r,mergedCount:1};t.set(r.title,e),n.push(e);continue}e.children===void 0&&(e.children=[{...e}]),e.children.push({...r}),e.calls+=r.calls,e.cost+=r.cost,e.lastActive=Math.max(e.lastActive,r.lastActive),r.stale===!0&&(e.stale=!0),e.mergedCount=(e.mergedCount??1)+1}return n.sort((e,t)=>t.cost-e.cost||t.lastActive-e.lastActive)}function In(e,t){switch(e){case`ok`:return``;case`not-configured`:return t(`subscriptionNotConfigured`);case`unauthorized`:return t(`subscriptionUnauthorized`);case`rate-limited`:return t(`subscriptionRateLimited`);case`invalid-response`:return t(`subscriptionInvalid`);default:return t(`subscriptionUnavailable`)}}function Ln(e,t){switch(e){case`session`:return t(`subscriptionSession`);case`weekly`:return t(`subscriptionWeekly`);case`monthly`:return t(`subscriptionMonthly`);case`billing`:return t(`subscriptionBilling`)}}function Rn(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let zn={"new-api":P.siteKindSite,sub2api:P.siteKindDirect,unknown:P.siteKindUnknown},Bn=3e4;function $(e=Date.now()){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Vn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let Hn=[`#4f8cff`,`#2dd4bf`,`#a78bfa`,`#f59e0b`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#6366f1`,`#f97316`,`#14b8a6`],Un={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}};async function Wn(){try{let e=await fetch(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n||!(`total`in n))return null;let r=n,i=e=>typeof e==`object`&&!!e;return{total:r.total??Un.total,byModel:r.byModel??{},byDay:r.byDay??{},...r.byDayModels===void 0?{}:{byDayModels:r.byDayModels},...i(r.byDayModelsSite)?{byDayModelsSite:r.byDayModelsSite}:{},...r.updatedAt===void 0?{}:{updatedAt:r.updatedAt},...typeof r.budget==`number`?{budget:r.budget}:{},...typeof r.lowBalanceThreshold==`number`?{lowBalanceThreshold:r.lowBalanceThreshold}:{},...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{},...Array.isArray(r.byWorkspace)?{byWorkspace:r.byWorkspace}:{},...i(r.bySite)?{bySite:r.bySite}:{},...i(r.byTier)?{byTier:r.byTier}:{},...i(r.byTool)?{byTool:r.byTool}:{},...Array.isArray(r.unpricedModels)?{unpricedModels:r.unpricedModels}:{},...typeof r.staleLedgerSessions==`number`?{staleLedgerSessions:r.staleLedgerSessions}:{},...typeof r.searchCallEstimateCny==`number`?{searchCallEstimateCny:r.searchCallEstimateCny}:{},...r.byRole!==null&&typeof r.byRole==`object`?{byRole:r.byRole}:{},...r.perf!==null&&typeof r.perf==`object`&&r.perf.byModel!==null&&typeof r.perf.byModel==`object`&&r.perf.byHourModel!==null&&typeof r.perf.byHourModel==`object`?{perf:r.perf}:{},...typeof r.pluginVersion==`string`?{pluginVersion:r.pluginVersion}:{}}}catch{return null}}let Gn=!1;async function Kn(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){Gn=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){Gn=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(Gn)return;Gn=!0}setTimeout(()=>{Kn(e+1)},2e3);return}Gn=!1,z(i)}catch{Gn=!1}}async function qn(){try{let e=await fetch(`/api/billing/balance`);if(!e.ok)return{balances:[]};let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return{balances:[]};let r=n;return{balances:Array.isArray(r.balances)?r.balances:[],...r.reconcile===void 0?{}:{reconcile:r.reconcile}}}catch{return{balances:[]}}}async function Jn(){let e=await fetch(`/api/billing/subscriptions`);if(!e.ok)throw Error(`subscriptions HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n)return n.quotas;throw Error(`subscriptions: invalid response`)}async function Yn(){let e=await fetch(`/api/billing/relay-quotas`);if(!e.ok)throw Error(`relay-quotas HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n)return n.quotas;throw Error(`relay-quotas: invalid response`)}async function Xn(){try{let e=await fetch(`/api/billing/usage-tool`);if(!e.ok)return;let t=JSON.parse(await e.text());return typeof t.enabled==`boolean`?t.enabled:void 0}catch{return}}async function Zn(e){try{let t=await fetch(`/api/billing/usage-tool`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:e})});return t.ok?JSON.parse(await t.text()).ok===!0:!1}catch{return!1}}let Qn=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function $n(e){let{wide:t,t:n,onOpen:a,monthCost:s,todayCost:c,weekCost:l,days:u,vendorStatus:f,dash:p,floatPrefs:m,subscriptions:h,cardPrefs:g,monthTokens:_,todayTokens:v,weekTokens:y,budgetPressure:b}=e,x=(0,r.useMemo)(()=>m.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[m.targets,h]),[S,C]=(0,r.useState)(0),w=x.length===0?0:Math.min(S,x.length-1),T=x[w];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||x.length<2)return;let e=setInterval(()=>C(e=>(e+1)%x.length),1500);return()=>clearInterval(e)},[m.mode,x.length]);let ee=(0,r.useRef)(null),[E,D]=(0,r.useState)(!1),[O,te]=(0,r.useState)({left:0,top:0}),k=(0,r.useRef)(void 0),A=(0,r.useCallback)(()=>{window.clearTimeout(k.current),D(!0)},[]),j=(0,r.useCallback)(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>D(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(k.current),[]);let ne=(0,r.useCallback)(()=>{let e=ee.current?.getBoundingClientRect();e!==void 0&&te({left:e.left,top:e.top-8})},[]);(0,r.useEffect)(()=>{if(!E)return;let e=()=>ne();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[E,ne]);let re=u.length>0?u.reduce((e,t)=>e+t.cost,0)/u.length:0,ie=re>0?Math.max(0,Math.min(1,c/re)):0,ae=-80+ie*160,M=(0,o.jsxs)(`svg`,{viewBox:`0 0 40 40`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,opacity:.16}),(0,o.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,strokeDasharray:`${(41.9*ie).toFixed(2)} 41.9`,className:P.triggerGaugeArc}),(0,o.jsx)(`path`,{d:`M5.23 26.4 8.18 26.92M10.36 17.51 12.29 19.81M20 14v3M27.71 19.81 29.64 17.51M31.82 26.92 34.77 26.4`,strokeWidth:1.6,opacity:.7}),(0,o.jsx)(`path`,{d:`M7.01 21.5 8.31 22.25M14.87 14.91 15.38 16.31M24.62 16.31 25.13 14.91M31.69 22.25 32.99 21.5`,strokeWidth:1.2,opacity:.38}),(0,o.jsx)(`line`,{x1:`20`,y1:`29`,x2:`20`,y2:`19.5`,strokeWidth:2,className:P.triggerGaugeNeedle,style:{transform:`rotate(${ae}deg)`,transformOrigin:`20px 29px`}}),(0,o.jsx)(`circle`,{cx:`20`,cy:`29`,r:`1.5`,fill:`currentColor`,stroke:`none`})]});if(!t)return(0,o.jsx)(`button`,{type:`button`,className:d(P.railButton,b!==`none`&&P.triggerBudgetPulse,b===`over`&&P.triggerBudgetOver),"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${q(g.span===`day`?c:g.span===`week`?l:s)}`,children:M});let N=g.metric===`tokens`,F=u.map(e=>N?e.tokens:e.cost),I=Math.max(...F,0),oe=F.map(e=>I>0?4+e/I*12:4);return(0,o.jsxs)(`span`,{ref:ee,className:P.triggerWrap,onMouseEnter:()=>{ne(),A()},onMouseLeave:j,onFocusCapture:()=>{ne(),A()},onBlurCapture:()=>D(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:d(P.trigger,b!==`none`&&P.triggerBudgetPulse,b===`over`&&P.triggerBudgetOver),"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${q(g.span===`day`?c:g.span===`week`?l:s)}`,children:[(0,o.jsx)(`span`,{className:d(P.triggerIcon,b!==`none`&&P.triggerBudgetHot),"data-testid":`billing-trigger-icon`,children:M}),(0,o.jsx)(`span`,{className:P.triggerMain,children:(0,o.jsxs)(`span`,{className:P.triggerPrimary,children:[(0,o.jsx)(`span`,{className:P.triggerLabel,children:N?g.span===`day`?n(`triggerTodayTokens`):g.span===`week`?n(`triggerWeekTokens`):n(`triggerMonthTokens`):g.span===`day`?n(`triggerToday`):g.span===`week`?n(`weekCost`):n(`triggerMonth`)}),(()=>{let e=g.span===`day`?N?v:c:g.span===`week`?N?y:l:N?_:s;return N?(0,o.jsx)(`span`,{className:P.triggerMetric,"data-testid":`billing-trigger-span-tokens`,children:J(e)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.triggerYen,"aria-hidden":`true`,children:q(e).charAt(0)}),(0,o.jsx)(`span`,{className:P.triggerMetric,"data-testid":`billing-trigger-span-money`,children:q(e).slice(1)})]})})()]})}),(0,o.jsx)(`span`,{className:P.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:oe.map((e,t)=>(0,o.jsx)(`span`,{className:t===oe.length-1?P.triggerSparkHot:P.triggerSparkBar,style:{height:`${e}px`}},u[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:d(P.triggerPop,E&&P.triggerPopShown),style:{left:`${O.left}px`,top:`${O.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!E,onMouseEnter:A,onMouseLeave:j,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:x.length===0?(0,o.jsx)(`span`,{className:P.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[T!==void 0&&(0,o.jsxs)(`div`,{className:P.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:P.floatSubHead,children:[(0,o.jsx)(`span`,{className:P.floatSubName,children:T.displayName}),T.plan!==void 0&&(0,o.jsx)(`span`,{className:P.floatSubPlan,children:T.plan})]}),T.windows.map(e=>(()=>{let t=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:P.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:P.subscriptionWindowLabel,children:Ln(e.kind,n)}),(0,o.jsx)(`span`,{className:P.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(P.subscriptionFill,t>=100&&P.subscriptionFillOver,t>=80&&t<100&&P.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:P.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(P.subscriptionPct,r&&P.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${Vn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),x.length>1&&(0,o.jsx)(`span`,{className:P.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:P.triggerPopSwitchCount,children:[w+1,`/`,x.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.popHead,children:(0,o.jsx)(`span`,{className:P.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:P.metricGrid,children:[(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`floatPrimaryToday`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:q(c)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`floatPrimaryWeek`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:q(l)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`floatPrimaryMonth`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:q(s)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:J(p.input)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:J(p.output)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:d(P.metricValue,P.metricValueSuccess),children:Ke(p.cacheRead+p.cacheMiss>0?p.cacheRead/(p.cacheRead+p.cacheMiss)*100:0)})]})]}),(0,o.jsxs)(`span`,{className:P.popModel,children:[(0,o.jsx)(`span`,{className:P.popModelLabel,children:n(`popTodayModel`)}),f.direct!==void 0||f.sub!==void 0?(0,o.jsxs)(o.Fragment,{children:[f.direct!==void 0&&(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:P.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:d(P.popModelStatus,f.direct.low&&P.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:P.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:d(P.popModelStatus,f.sub.low&&P.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function er({balance:e,days:t,dailyBurn:n,money:r,t:i,onClose:a}){let s=t=>t===void 0?void 0:e.currency===`USD`?`$${t.toFixed(2)}`:r(t),c=s(e.totalBalance),l=s(e.grantedBalance),u=s(e.toppedUpBalance);return(0,o.jsxs)(`span`,{className:P.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:P.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:P.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:P.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:P.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(tr,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(tr,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(tr,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(tr,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(tr,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function tr({label:e,value:t}){return(0,o.jsxs)(`span`,{className:P.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:P.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:P.balanceDetailValue,children:t})]})}function nr({userPrices:e,onUserPrices:t,t:n}){let[i,a]=(0,r.useState)(()=>[...e]),[s,c]=(0,r.useState)(new Set),l=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),u=()=>{a(e=>e.filter((e,t)=>!s.has(t))),c(new Set)},f=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),p=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),m=e=>{let t=i[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},h=(e,t,n)=>a(r=>r.map((r,i)=>{if(i!==e)return r;let a={...m(e),[t]:n},o=[a.input,a.cacheHit,a.output].some(e=>e.trim()!==``),s=[a.input,a.cacheHit,a.output].map(e=>Number(e)),c=o&&s.every(e=>Number.isFinite(e)&&e>=0)&&s.some(e=>e>0),{offPeak:l,...u}=r;return c?{...u,offPeak:{input:s[0]??0,cacheHit:s[1]??0,output:s[2]??0}}:u})),g=()=>t(i.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:me(e.origin.trim())}}))),_=ze().map(e=>e.key),v=(e,t)=>a(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),y=e=>Number.isFinite(e)&&e!==0?String(e):``,b=(e,t,n)=>{let r=Number(n);f(e,{[t]:Number.isFinite(r)&&r>=0?r:0})};return(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsx)(`datalist`,{id:`billing-price-model-keys`,children:_.map(e=>(0,o.jsx)(`option`,{value:e},e))}),i.map((e,t)=>(0,o.jsxs)(`div`,{className:P.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsx)(`input`,{type:`checkbox`,className:P.userPriceCheck,"data-testid":`billing-user-price-select`,checked:s.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>l(t)}),(0,o.jsxs)(`div`,{className:P.userPriceBody,children:[(0,o.jsxs)(`div`,{className:P.userPriceLineMeta,children:[(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:P.userPriceInput,"data-testid":`billing-user-price-model`,type:`text`,list:`billing-price-model-keys`,value:e.key,placeholder:`flash`,"aria-label":n(`userPriceModel`),onChange:e=>f(t,{key:e.target.value})})]}),(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:P.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>f(t,{origin:e.target.value.trim()})})]}),(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,e.currency!==`USD`&&P.floatModeBtnOn),onClick:()=>v(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,e.currency===`USD`&&P.floatModeBtnOn),onClick:()=>v(t,`USD`),children:`USD`})]})]})]}),(0,o.jsxs)(`div`,{className:P.userPricePriceLine,"data-testid":`billing-user-price-normal`,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceNormal`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:P.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceNormal`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:y(e[r]),onChange:e=>b(t,r,e.target.value)},r))]}),(()=>{let e=m(t);return(0,o.jsxs)(`div`,{className:P.userPricePriceLine,"data-testid":`billing-user-price-offpeak`,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceOffPeak`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:P.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceOffPeak`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:e[r],onChange:e=>h(t,r,e.target.value)},r))]})})()]})]},t)),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-add`,onClick:p,children:n(`userPriceAdd`)}),(0,o.jsxs)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:s.size===0,onClick:u,children:[n(`userPriceRemoveSelected`),s.size>0?` (${s.size})`:``]}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-save`,onClick:g,children:n(`userPriceSave`)})]})]})]})}function rr({stats:e,t,onClose:n,userPrices:i,onUserPrices:s,health:c,balances:l,reconcile:u,quotas:f,relayQuotas:p,currency:m,onCurrency:h,turns:g,renderSlot:_,budgetEnabled:v,budgetAmount:y,onToggleBudget:b,onBudgetAmount:C,peakConfig:w,onPeakConfig:T,onPreviewPeak:ee,floatPrefs:E,onFloatPrefs:D,cardPrefs:O,onCardPrefs:te,sitePrefs:k,onSitePrefs:A,liveCostPrefs:j,onLiveCostPrefs:ne,quotasStale:re}){let[ie,ae]=(0,r.useState)(`cost`),{total:M,byModel:N,byDay:F}=e,[I,oe]=(0,r.useState)(`overview`),[ce,le]=(0,r.useState)(7),[ue,de]=(0,r.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),fe=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},pe=(0,r.useCallback)(()=>{let e=fe();de(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[me,he]=(0,r.useState)(`month`),[ge,_e]=(0,r.useState)(x),L=(0,r.useMemo)(()=>f.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[f]),[R,ve]=(0,r.useState)(),[ye,z]=(0,r.useState)(new Set),be=(0,r.useCallback)(e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[B,Se]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return Xn().then(t=>{e&&t!==void 0&&Se(t)}),()=>{e=!1}},[]);let Ce=(0,r.useCallback)(()=>{let e=!B;Se(e),Zn(e).then(t=>{t||Se(!e)})},[B]),we=xe(),V=e=>q(m===`usd`?Ue(e):e,m),H=m===`usd`?`en`:`zh`,Te=e=>Ht(e,H),U=(e,n)=>e===0?t(`free`):We(Ge(e,n,m,we.rate),m===`usd`?`USD`:`CNY`),Ee=(0,r.useMemo)(()=>Ot([...g].reverse()),[g]),De={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},Oe=De.peak/2,ke=Cn(F,$()),W=e=>l.find(t=>Q(t.provider)===Q(e)),Ae=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),G=e=>{if(e===void 0)return(0,o.jsx)(`span`,{className:P.na,children:`—`});if(e.error===`unconfigured`)return t(`balanceUnconfigured`);if(e.error===`unauthorized`)return t(`balanceUnauthorized`);if(e.error===`unreachable`)return t(`balanceUnreachable`);if(e.totalBalance===void 0)return(0,o.jsx)(`span`,{className:P.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:V(e.totalBalance),r=e.currency===`USD`?e.totalBalance*we.rate:e.totalBalance,i=ke>0?Math.floor(r/ke):void 0;return(0,o.jsxs)(`span`,{className:P.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:d(P.balanceDaysBadge,i<=3&&P.balanceDaysBadgeLow),"data-testid":`billing-balance-days-badge`,title:t(`balanceDays`).replace(`{days}`,String(i)),"aria-label":`${e.displayName} ${t(`balanceDays`).replace(`{days}`,String(i))}`,onClick:()=>{ve(R===e.provider?void 0:e.provider)},children:`?`}),R===e.provider&&(0,o.jsx)(er,{balance:e,days:i??0,dailyBurn:ke,money:V,t,onClose:()=>{ve(void 0)}})]})},je=Object.keys(F).sort(),K=$(),Me=F[K]?.cost??0,Ne=K.slice(0,7),Pe=K.slice(0,4),Ie=je.reduce((e,t)=>e+(t.startsWith(Ne)?F[t]?.cost??0:0),0),Re=je.reduce((e,t)=>e+(t.startsWith(Pe)?F[t]?.cost??0:0),0),Ve=(0,r.useMemo)(()=>wn(F,Ne,K)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[F,Ne,K,f]),Y=(0,r.useMemo)(()=>{if(!(v&&y>0))return null;let e=y-Ie;return{over:e<=0,remainRatio:Math.max(0,Math.min(1,e/y)),remainCny:Math.max(0,e)}},[v,y,Ie]),qe=(0,r.useMemo)(()=>{let e=[];for(let t=ce-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push($(n.getTime()))}return e},[ce]),Je=qe.at(-1)??K,Ye=(0,r.useMemo)(()=>Object.entries(F).map(([e,t])=>({date:e,value:t.cost})),[F]),Xe=kn(F),X=An(F),Qe=(0,r.useMemo)(()=>qe.map(t=>{let n={},r=e.byDayModels?.[t];if(r!==void 0)for(let[e,t]of Object.entries(r))t.cost>0&&(n[e]=t.cost);let i=F[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:i.input+i.output+i.cacheHit+i.cacheMiss}}),[qe,F,e.byDayModels]),$e=(0,r.useMemo)(()=>Object.entries(N).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=Fe(e),r=n.key===`other`,i=r?cn(e):void 0,a={input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,output:t.output};return{key:e,name:r?e:n.name,provider:i??n.provider,calls:t.calls,input:t.input,output:t.output,cacheHitRate:t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0,estimated:He(n,a),plan:t.plan===!0,...t.cost>0?{actual:t.cost}:{},uncatalogued:r,estimatedPricing:n.estimated===!0,officialCalls:t.officialCalls??0,officialCost:t.officialCost??0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)).map((e,t)=>({...e,color:Hn[t%Hn.length]??`#8b95a3`})),[N]),et=(0,r.useMemo)(()=>k.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,k.hideUnidentified]),tt=(0,r.useMemo)(()=>{let n=new Map;for(let t of Object.values(e.byDayModelsSite??{}))for(let[e,r]of Object.entries(t))for(let[t,i]of Object.entries(r)){let r=n.get(t);r===void 0&&(r=new Map,n.set(t,r));let a=r.get(e)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0};a.calls+=i.calls,a.input+=i.input,a.output+=i.output,a.cacheHit+=i.cacheHit,a.cacheMiss+=i.cacheMiss,a.cost+=i.cost,r.set(e,a)}let r=new Map;for(let[t,i]of n){let n=[...i.entries()].filter(([,e])=>e.calls>0).map(([t,n],r)=>{let i=Fe(t),a=i.key===`other`,o=a?cn(t)??i.provider:i.provider;return{key:t,name:a?t:i.name,provider:o,color:Hn[r%Hn.length]??`#8b95a3`,calls:n.calls,input:n.input,output:n.output,cacheHitRate:n.cacheHit+n.cacheMiss>0?n.cacheHit/(n.cacheHit+n.cacheMiss)*100:0,estimated:He(i,{input:n.input,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,output:n.output}),plan:e.byModel?.[t]?.plan===!0,...n.cost>0?{actual:n.cost}:{},uncatalogued:a,estimatedPricing:i.estimated===!0,officialCalls:0,officialCost:0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));n.length>0&&r.set(t,n)}let i=e=>Kt(e,H)??t(`channelUnknown`),a=new Map,o=new Map,s=e=>e.startsWith(`direct:`)?`direct`:e.startsWith(`site:`)?`site`:`unknown`,u={direct:2,site:1,unknown:0,vendor:0};for(let[e,t]of r){let n=i(e),r=a.get(n);if(r===void 0)a.set(n,[...t]),o.set(n,s(e));else{r.push(...t),r.sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));let i=o.get(n)??`unknown`,a=s(e);u[a]>u[i]&&o.set(n,a)}}let d=new Map,p=new Map;for(let e of f){if(e.status===`not-configured`)continue;let t=e.displayName??un(e.provider),n=i(`direct:${e.provider}`),r=a.has(t)?t:a.has(n)?n:void 0,o=r??`sub:${un(e.provider)}`;p.set(o,r??un(e.provider));let s=d.get(o);s===void 0?d.set(o,[e]):s.push(e)}let m=e=>e===i(`direct:deepseek`)||e===i(`site:https://api.deepseek.com`)?W(`deepseek`)??W(e):W(e),h=[];for(let[e,t]of a)h.push({name:e,models:t,subscriptions:d.get(e)??[],balance:m(e),dot:Pn(c,t[0]?.provider??``),channelKind:o.get(e)??`unknown`});for(let[e,t]of p)a.has(e)||h.push({name:t,models:[],subscriptions:d.get(e)??[],balance:W(t),dot:Pn(c,t),channelKind:`vendor`});let g=new Set(h.flatMap(e=>[Q(e.name),...e.balance===void 0?[]:[Q(e.balance.provider)]]));for(let e of l)g.has(Q(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&h.push({name:e.displayName,models:[],subscriptions:[],balance:e,dot:Pn(c,e.displayName),channelKind:`vendor`});return h.sort((e,t)=>{let n=Qn(t)-Qn(e);return n===0?e.models.length===0&&t.models.length===0?0:t.models.length===0?-1:e.models.length===0?1:e.name.localeCompare(t.name,`zh`):n})},[e.byDayModelsSite,e.byModel,f,l,c,H,t]),nt=(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`actual`)})]})}),it=e=>{let n=e.color??(e.colorVar===void 0?void 0:Be(e.colorVar));return(0,o.jsxs)(`span`,{className:P.modelCell,children:[(0,o.jsx)(ir,{provider:e.provider,...n===void 0?{}:{colorVar:n}}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:P.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:P.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:P.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:P.modelProvider,children:Te(e.provider)})]})]})},at=$e.reduce((e,t)=>e+t.estimated,0),st=M.cost>0?M.cost:at,Z=(0,r.useMemo)(()=>{if(ge===`all`){let e,t=0;for(let[n,r]of Object.entries(F)){let i=r.cacheMiss+r.cacheHit+r.output;i>t&&(t=i,e=n)}return{cost:st,calls:M.calls,input:M.input,output:M.output,cacheHit:M.cacheHit,cacheMiss:M.cacheMiss,reasoning:M.reasoning??0,peakDay:e,peakTokens:t}}return Nn(F,$(),ge)},[ge,st,M,F]),lt=(0,r.useMemo)(()=>$e.map(e=>({key:e.key,name:e.name,color:e.color})),[$e]),ut=Qe.length>=2?Qe.at(-2)?.cost??0:0,dt=ut>0?(Me-ut)/ut*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:d(P.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:P.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:P.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:P.headTitleRow,children:[(0,o.jsx)(`h2`,{className:P.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:P.dashboardSubtitle,children:[t(`lastUpdated`),` `,Je,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:P.dashboardRight,children:[(0,o.jsx)(`span`,{className:P.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.currencyButton,m===e&&P.currencyButtonActive),"aria-pressed":m===e,"data-testid":`billing-currency-${e}`,title:t(e===`cny`?`currencyCny`:`currencyUsd`),onClick:()=>{h(e)},children:e===`cny`?`¥ CNY`:`$ USD`},e))}),c.checked&&(0,o.jsxs)(`span`,{className:d(P.healthBadge,c.available?P.healthBadgeOk:P.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:d(P.healthDot,c.available?P.healthOk:P.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:P.closeButton,"aria-label":t(`close`),"data-testid":`billing-close`,onClick:n,children:(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M18 6 6 18`}),(0,o.jsx)(`path`,{d:`m6 6 12 12`})]})})]})]}),(0,o.jsx)(`nav`,{className:P.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:tn.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":I===e.id,className:d(P.tabButton,I===e.id&&P.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{oe(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:P.dashboardBody,children:[I===`overview`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[u?.kind===`drift`&&u.spent!==void 0&&ue!==fe()&&(0,o.jsxs)(`div`,{className:P.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:P.reconcileIcon,"aria-hidden":`true`,children:(0,o.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,o.jsx)(`line`,{x1:`12`,y1:`10`,x2:`12`,y2:`16`}),(0,o.jsx)(`line`,{x1:`12`,y1:`7.5`,x2:`12.01`,y2:`7.5`})]})}),(0,o.jsx)(`span`,{className:P.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,u.provider??``).replace(`{spent}`,V(u.spent)).replace(`{today}`,V(u.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:P.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:pe,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:P.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:P.heroTop,children:[(0,o.jsxs)(`div`,{className:P.heroMain,children:[(0,o.jsx)(`span`,{className:P.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:P.heroReadout,children:[(0,o.jsx)(`span`,{className:P.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:P.heroValue,children:V(Ie).slice(1)})]}),(0,o.jsxs)(`span`,{className:P.heroMeta,children:[M.calls.toLocaleString(),` `,t(`calls`)]})]}),Y!==null&&(0,o.jsxs)(`div`,{className:P.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`div`,{className:P.heroGaugeDial,children:[(0,o.jsxs)(`svg`,{className:P.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:P.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:d(P.heroGaugeArc,Y.over&&P.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${Y.remainRatio*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:P.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:d(P.heroGaugeRemain,Y.over&&P.heroGaugeRemainOver),children:[m===`usd`?`$`:`¥`,(m===`usd`?Ue(Y.remainCny):Y.remainCny).toFixed(2)]}),(0,o.jsx)(`span`,{className:P.heroGaugeLabel,children:t(`budgetRemain`)})]})]}),(0,o.jsxs)(`span`,{className:P.heroGaugeSub,children:[V(Ie),` / `,V(y)]})]})]}),(0,o.jsxs)(`div`,{className:P.heroSide,children:[(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:P.heroSideValue,children:V(Re)})]}),(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:P.heroSideValue,children:[V(Me),(0,o.jsxs)(`span`,{className:d(P.delta,dt>=0?P.deltaUp:P.deltaDown),children:[dt>=0?`▲`:`▼`,` `,Math.abs(dt).toFixed(1),`%`]})]})]}),Ve>0&&(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:P.heroSideValue,children:V(Ve)})]}),Ve<=0&&(0,o.jsx)(`span`,{className:P.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:P.unpricedHint,"data-testid":`billing-unpriced-hint`,children:t(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0))}),(e.total.searchCalls??0)>0&&(0,o.jsx)(`div`,{className:P.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,V(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`div`,{className:P.kpiZone,children:[(0,o.jsxs)(`div`,{className:P.kpiZoneHead,children:[(0,o.jsx)(`span`,{className:P.kpiZoneLabel,children:t(`kpiRange`)}),(0,o.jsx)(`div`,{className:P.heatmapRangeSwitch,"data-testid":`billing-kpi-range`,role:`group`,"aria-label":t(`kpiRange`),children:[[`today`,`avgRangeToday`],[`7d`,`avgRange7d`],[`week`,`avgRangeWeek`],[`month`,`avgRangeMonth`],[`all`,`avgRangeAll`]].map(([e,n])=>(0,o.jsx)(`button`,{type:`button`,className:d(P.heatmapRangeButton,ge===e&&P.heatmapRangeButtonActive),"data-testid":`billing-kpi-range-${e}`,"aria-pressed":ge===e,onClick:()=>{_e(e),S(e)},children:t(n)},e))})]}),(0,o.jsxs)(`section`,{className:P.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:d(P.kpiValue,P.kpiGreen),children:Ke(Z.cacheHit+Z.cacheMiss>0?Z.cacheHit/(Z.cacheHit+Z.cacheMiss)*100:0)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[J(Z.cacheHit),` / `,J(Z.cacheHit+Z.cacheMiss),(M.cacheWrite??0)>0?` · ${t(`tokenCacheWrite`)} ${J(M.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:J(Z.input+Z.output)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[t(`inputTokens`),` `,J(Z.input),` · `,t(`outputTokens`),` `,J(Z.output)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-avg`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:V(Z.calls>0?Z.cost/Z.calls:0)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[t(`calls`),` `,Z.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:Z.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[$e.length,` `,t(`models`)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-think`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokenReasoningShare`)}),(0,o.jsx)(`span`,{className:d(P.kpiValue,P.kpiGreen),children:Ke(Z.output>0?Z.reasoning/Z.output*100:0)}),(0,o.jsx)(`span`,{className:P.kpiDetail,children:J(Z.reasoning)})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-io`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokenIo`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:(Z.output>0?Z.input/Z.output:0).toFixed(2)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[J(Z.input),` / `,J(Z.output)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-peak`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokenPeak`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:Z.peakTokens>0?ct(Z.peakTokens):`—`}),(0,o.jsx)(`span`,{className:P.kpiDetail,children:Z.peakDay??`—`})]})]})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:P.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`year`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.heatmapRangeButton,me===e&&P.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":me===e,onClick:()=>{he(e)},children:t(e===`month`?`heatmapMonth`:`heatmapYear`)},e))}),(0,o.jsxs)(`span`,{className:P.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,Xe,` · `,t(`streakDays`),` `,X]})]}),(0,o.jsx)(wt,{days:Ye,currency:m,t,range:me})]})]}),I===`settings`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`budgetHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":v,"aria-label":t(`budget`),"data-testid":`billing-budget-toggle`,className:d(P.switch,v&&P.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:P.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:P.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:P.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:y===0?``:y,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,title:`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,onChange:e=>{C(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=Ie/y*100;return(0,o.jsx)(`div`,{className:P.ctlRowStretch,children:(0,o.jsx)(`div`,{className:P.prog,role:`progressbar`,"aria-valuenow":Math.min(e,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),"data-testid":`billing-budget-track`,children:(0,o.jsx)(`div`,{className:d(P.progFill,e>=100&&P.budgetFillOver,e>=80&&e<100&&P.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:P.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,V(Ie)).replace(`{total}`,V(y))})]})]}),(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":w.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:d(P.switch,w.enabled&&P.switchOn),onClick:()=>{T({...w,enabled:!w.enabled})},children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),w.enabled&&(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`label`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:P.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:w.leadMin,className:P.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);T({...w,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):w.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:P.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:w.position===e,onChange:()=>T({...w,position:e})}),(0,o.jsx)(`span`,{className:P.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:P.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:w.mode===e,onChange:()=>T({...w,mode:e})}),(0,o.jsx)(`span`,{className:P.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:w.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{T({...w,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:P.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:P.btn,onClick:ee,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:P.setCard,"data-testid":`billing-toggle-setting`,children:(0,o.jsxs)(`div`,{className:P.setGrid3,children:[(0,o.jsx)(`div`,{className:P.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":B,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:d(P.switch,B&&P.switchOn),onClick:Ce,children:(0,o.jsx)(`span`,{className:P.switchKnob})})]})}),(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-livecost-setting`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`liveCostBar`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`liveCostBarHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":j.show,"aria-label":t(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:d(P.switch,j.show&&P.switchOn),onClick:()=>ne({...j,show:!j.show}),children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),j.show&&(0,o.jsxs)(`div`,{className:P.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,o.jsx)(`span`,{className:P.rdoLabel,children:t(`liveCostBarPosition`)}),(0,o.jsx)(or,{liveCostPrefs:j,onLiveCostPrefs:ne,t})]})]}),(0,o.jsx)(`div`,{className:P.setCell,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`siteListDisplayHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":k.hideUnidentified,"aria-label":t(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:d(P.switch,k.hideUnidentified&&P.switchOn),onClick:()=>A({hideUnidentified:!k.hideUnidentified}),children:(0,o.jsx)(`span`,{className:P.switchKnob})})]})})]})}),(0,o.jsx)(`section`,{className:P.setCard,"data-testid":`billing-display-setting`,children:(0,o.jsxs)(`div`,{className:P.setGrid2,children:[(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,E.mode===`combined`&&P.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>D({mode:`combined`,targets:E.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,E.mode===`subscription`&&P.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>D({mode:`subscription`,targets:E.targets}),children:t(`floatModeSubscription`)})]})]}),E.mode===`subscription`&&(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:P.ctlGroup,"data-testid":`billing-float-targets`,children:[L.map(e=>{let t=E.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:P.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>D({mode:`subscription`,targets:t?E.targets.filter(t=>t!==e.id):[...E.targets,e.id]})}),(0,o.jsx)(`span`,{className:P.floatTargetLabel,children:e.label})]},e.id)}),L.length===0&&(0,o.jsx)(`span`,{className:P.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,O.metric===`money`&&P.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>te({...O,metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,O.metric===`tokens`&&P.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>te({...O,metric:`tokens`}),children:t(`cardMetricTokens`)})]})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`cardSpan`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,"data-testid":`billing-card-span`,children:[[`day`,`cardSpanDay`],[`week`,`cardSpanWeek`],[`month`,`cardSpanMonth`]].map(([e,n])=>(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,O.span===e&&P.floatModeBtnOn),"data-testid":`billing-card-span-${e}`,"aria-pressed":O.span===e,onClick:()=>te({...O,span:e}),children:t(n)},e))})]})]})]})]})}),(0,o.jsx)(nr,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(ot,{t,version:e.pluginVersion})]}),I===`trends`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:d(P.ubCard,P.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:P.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,ce===e&&P.rangeButtonActive),"aria-pressed":ce===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{le(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,ie===e&&P.rangeButtonActive),"aria-pressed":ie===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{ae(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:Je})]}),(0,o.jsx)(Ze,{data:Qe,models:lt,currency:m,metric:ie})]}),g.length>0&&(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`rounds`)}),Ee.length>0&&(0,o.jsxs)(`span`,{className:P.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[Ee.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:P.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(vt,{rounds:g,flags:Ee,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=De.peak+De.offPeak;if(e<=0)return null;let n=De.peak/e*100;return(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:P.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:d(P.shareSeg,P.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:d(P.shareSeg,P.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:P.shareLegend,children:[(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:P.shareDot,style:{background:`var(--ds-blue)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:P.shareValue,"data-testid":`billing-share-peak`,children:[V(De.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:P.shareDot,style:{background:`color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))`}}),t(`offPeak`),(0,o.jsxs)(`span`,{className:P.shareValue,"data-testid":`billing-share-offpeak`,children:[V(De.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),Oe>0&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,V(Oe))})]})})()]}),I===`providers`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[et.length>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:P.providerGroupList,"data-testid":`billing-relay-quotas`,children:et.map(e=>(0,o.jsxs)(`div`,{className:P.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:P.siteRowName,children:[(0,o.jsx)(`span`,{className:d(P.siteKindTag,zn[e.kind]),children:Rn(e.kind,t)}),(0,o.jsx)(`span`,{className:P.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:P.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:P.siteRowCost,children:[t(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let n=e.remainingPercent<20;return(0,o.jsxs)(`span`,{className:d(P.siteRowCalls,n&&P.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:P.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:P.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${Vn(e.updatedAt)}`})]}),re&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),tt.length===0?(0,o.jsx)(`div`,{className:P.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:P.providerGroupList,"data-testid":`billing-provider-groups`,children:tt.map(e=>(0,o.jsxs)(`div`,{className:P.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:P.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:P.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:d(P.healthDot,e.dot),"aria-hidden":`true`}),(()=>{let n=Te(e.name),r=e.channelKind===`direct`?Jt(n):void 0,i=e.channelKind===`direct`?t(`directTag`):e.channelKind===`site`?t(`relayTag`):e.channelKind===`unknown`?t(`unknownTag`):void 0;return(0,o.jsxs)(o.Fragment,{children:[i!==void 0&&(0,o.jsx)(`span`,{className:d(P.kindBadge,e.channelKind===`direct`&&P.kindBadgeDirect,e.channelKind===`site`&&P.kindBadgeRelay,e.channelKind===`unknown`&&P.kindBadgeUnknown),"data-testid":`billing-kind-badge`,children:i}),e.channelKind!==`unknown`&&(0,o.jsx)(`span`,{className:P.providerGroupName,children:r??n})]})})(),e.subscriptions.length>0&&(0,o.jsxs)(`span`,{className:P.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` `,t(`planCountUnit`)]})]}),(0,o.jsxs)(`span`,{className:P.providerGroupMeta,children:[(0,o.jsxs)(`span`,{className:P.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,o.jsx)(`span`,{className:P.providerGroupCostLabel,children:t(`cost`)}),(0,o.jsx)(`span`,{className:P.providerGroupCostValue,children:V(Qn(e))})]}),!Ae(e)&&e.balance!==void 0?(0,o.jsxs)(`span`,{className:P.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:P.providerGroupBalanceLabel,children:t(`balance`)}),G(e.balance)]}):(0,o.jsx)(`span`,{className:P.providerGroupBalance,"aria-hidden":`true`}),Sn(e.name)===void 0?(0,o.jsx)(`span`,{className:P.providerGroupRecharge,"aria-hidden":`true`}):(0,o.jsx)(`a`,{className:P.providerGroupRecharge,"data-testid":`billing-group-recharge`,href:Sn(e.name),target:`_blank`,rel:`noreferrer`,title:t(`rechargeHint`),"aria-label":`${Te(e.name)} ${t(`recharge`)}`,children:t(`recharge`)})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:d(P.tableScroll,P.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:P.modelTable,children:[nt,(0,o.jsx)(`tbody`,{children:e.models.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:it(e)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:J(e.input)}),(0,o.jsx)(`td`,{className:P.numCol,children:J(e.output)}),(0,o.jsx)(`td`,{className:P.numCol,children:Ke(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.plan?(0,o.jsxs)(`span`,{className:P.planTag,children:[e.estimated>0?(0,o.jsxs)(`span`,{children:[`≈`,V(e.estimated)]}):null,(0,o.jsx)(`span`,{className:P.planTagBadge,"data-testid":`billing-plan-badge`,children:t(`subscriptionTag`)})]}):e.actual===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:P.bucketCost,children:[(0,o.jsx)(`span`,{className:P.bucketOfficial,children:V(t)}),(0,o.jsx)(`span`,{className:P.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:P.bucketThird,children:V(n)})]}):V(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:P.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=In(e.status,t);return(0,o.jsxs)(`div`,{className:P.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:P.subscriptionHead,children:[(0,o.jsx)(`span`,{className:P.subscriptionName,children:Te(e.displayName)}),e.planType===`code`&&(()=>{let n=se(e.provider),r=n===void 0?void 0:t(`subscriptionFeePerMonth`).replace(`{amount}`,n.currency===`USD`?`$${n.amount}`:`¥${n.amount}`);return(0,o.jsxs)(`span`,{className:P.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,V(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:P.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:P.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:P.subscriptionStatus,children:t(`subscriptionNoApi`)}),e.windows.map(e=>(()=>{let n=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:P.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:P.subscriptionWindowLabel,children:Ln(e.kind,t)}),(0,o.jsx)(`span`,{className:P.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(P.subscriptionFill,n>=100&&P.subscriptionFillOver,n>=80&&n<100&&P.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:P.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(P.subscriptionPct,r&&P.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${Vn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:P.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:P.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-day`,onClick:()=>{Lt(It(`usage-daily`,`csv`,Object.keys(F)),Mt(F),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{Lt(It(`usage-sessions`,`csv`,Object.keys(F)),Ft(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{Lt(It(`usage-sites`,`csv`,Object.keys(F)),Nt(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-json`,onClick:()=>{Lt(It(`usage-stats`,`json`,Object.keys(F)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:e.bySession.length>20?t(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(e.bySession.length)):`${e.bySession.length}`})]}),(e.staleLedgerSessions??0)>0&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:P.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:P.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`sessionTitle`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`lastActive`)})]})}),(0,o.jsxs)(`tbody`,{children:[Fn(e.bySession??[]).length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:4,className:P.emptyRow,children:t(`noData`)})}),Fn(e.bySession??[]).slice(0,20).map(e=>{let n=e.children!==void 0,i=n&&ye.has(e.id),a=e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:V(e.cost)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.lastActive>0?`${$(e.lastActive)} ${Vn(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?P.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{be(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:P.modelName,children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.stale===!0&&(0,o.jsx)(`span`,{className:d(P.ubTag,P.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:P.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),I===`token`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(pt,{stats:e,trendDays:ce,onTrendDays:le,models:lt,money:V,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:P.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(rt,{perf:e.perf,models:lt,t})]})]}),I===`pricing`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:P.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:P.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:P.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,q(we.rate)]}),(0,o.jsx)(`span`,{className:d(P.ubTag,we.live?P.ubTagSuccess:P.ubTagNeutral),children:we.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:P.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:P.ubTablewrap,children:(0,o.jsxs)(`table`,{className:P.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:P.numCol,colSpan:2,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:ze().map(e=>{let n=e.price.input>0||e.price.output>0;return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:P.ubModel,children:[(0,o.jsx)(ir,{provider:e.provider,colorVar:Be(e.colorVar)}),(0,o.jsxs)(`span`,{className:P.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:P.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Le(e.promo,Date.now())&&(0,o.jsx)(a.Tooltip,{label:[e.promo.note,e.promo.endsAtMs===void 0?t(`promoOpenEnded`):t(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()})].filter(Boolean).join(` · `),side:`top`,maxWidth:280,children:(0,o.jsx)(`span`,{className:P.ubTagPromo,"data-testid":`billing-price-promo`,children:t(`promoBadge`)})})]})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?U(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?U(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?U(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsxs)(`span`,{className:P.ubChipPeak,children:[(0,o.jsx)(`span`,{className:P.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:P.num,children:[U(e.price.input,e.price.currency),`/`,U(e.price.output,e.price.currency)]})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsxs)(`span`,{className:P.ubChipOff,children:[(0,o.jsx)(`span`,{className:P.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:P.num,children:[U(e.price.offPeak.input,e.price.currency),` / `,U(e.price.offPeak.output,e.price.currency)]})]})})]}):(0,o.jsx)(`td`,{className:P.numCol,colSpan:2,children:n?(0,o.jsx)(`span`,{className:P.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:P.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:P.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:P.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:P.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:P.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):U(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):U(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:P.numCol,colSpan:2,children:(0,o.jsx)(`span`,{className:P.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:P.ubCard,children:[(0,o.jsx)(`div`,{className:P.ubCardHead,children:(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:P.ubNotes,children:[(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:P.modalFooter,"data-testid":`billing-footer`,children:[(0,o.jsx)(`span`,{children:t(`footer`)}),(0,o.jsx)(`span`,{children:t(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]})})}function ir({provider:e,colorVar:t}){return(0,o.jsx)(`span`,{className:P.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()})}let ar=[`below`,`above`,`toolbar`];function or({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[i,s]=(0,r.useState)(!1),c={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)};return(0,o.jsx)(a.Menu,{open:i,align:`end`,portal:!0,compact:!0,items:ar.map(e=>({id:e,label:c[e]})),selectedId:e.position,onSelect:n=>{s(!1);let r=ar.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{s(!1)},anchor:(0,o.jsxs)(`button`,{type:`button`,className:P.rdoSelect,"data-testid":`billing-livecost-position-select`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{s(!i)},children:[(0,o.jsx)(`span`,{children:c[e.position]}),(0,o.jsx)(`span`,{className:d(P.rdoChevron,i&&P.rdoChevronOpen),"aria-hidden":!0,children:(0,o.jsx)(a.IconChevronDownOutline14,{})})]})})}function sr(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(Un),[f,p]=(0,r.useState)(rn),[g,_]=(0,r.useState)([]),[b,x]=(0,r.useState)(void 0),[S,C]=(0,r.useState)([]),[w,E]=(0,r.useState)(!1),[D,A]=(0,r.useState)([]),[re,ie]=(0,r.useState)(`cny`),[ae,M]=(0,r.useState)(()=>m()),N=(0,r.useCallback)(e=>{M(e),h(e)},[]),[P,F]=(0,r.useState)(()=>T()),I=(0,r.useCallback)(e=>{F(e),ee(e)},[]),[oe,se]=(0,r.useState)(()=>te()),ce=(0,r.useCallback)(e=>{se(e),k(e),window.dispatchEvent(new CustomEvent(O))},[]),[le,ue]=(0,r.useState)(()=>v()),de=(0,r.useCallback)(e=>{ue(e),y(e)},[]),[fe,pe]=(0,r.useState)(()=>{let e=j();return ge(e),e}),me=(0,r.useCallback)(e=>{pe(e),ge(e),ne(e)},[]),he=(0,r.useMemo)(()=>Tn(u),[u,fe]),_e=re===`usd`?`en`:`zh`,L=(0,r.useCallback)((e,n)=>{let r=(_e===`en`?Bt:zt)[e]??t(e);if(n===void 0)return r;let i=r;for(let[e,t]of Object.entries(n))i=i.replaceAll(`{${e}}`,String(t));return i},[_e,t]),[R,ve]=(0,r.useState)(!1),ye=(0,r.useCallback)(()=>{ve(!1)},[]),z=(0,r.useCallback)(()=>{Wn().then(e=>{e!==null&&d(Tn(e))}),qn().then(({balances:e,reconcile:t})=>{e.length>0&&_(e),x(t)}),Jn().then(e=>{e.length>0&&C(e),E(!1)}).catch(()=>{E(!0)}),Yn().then(e=>{A(e)}).catch(()=>{})},[]),B=(0,r.useCallback)(()=>{z(),Kn(),ve(!0)},[z]);(0,r.useEffect)(()=>{z(),Kn()},[z]);let[Se,Ce]=(0,r.useState)(()=>typeof document>`u`||!document.hidden);(0,r.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{Ce(!document.hidden),document.hidden||(z(),Kn())};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[z]),(0,r.useEffect)(()=>{if(!Se)return;let e=setInterval(()=>{z(),Kn()},R?Bn:3e5);return()=>{clearInterval(e)}},[z,R,Se]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(p(t),be(t.catalog??[]))}),()=>{e=!1}},[n]);let V=$(),H=Object.entries(u.byDay).filter(([e])=>e.startsWith(V.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),Te=u.byDay[V]?.cost??0,U=Mn(u.byDay,V),Ee=(0,r.useMemo)(()=>jn(u.byDay).map(e=>{let t=u.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:t.input+t.output}}),[u.byDay]),De=Object.entries(u.byDay).filter(([e])=>e.startsWith(V.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Oe=(()=>{let e=u.byDay[V];return e===void 0?0:e.input+e.output})(),ke=Mn(u.byDay,V,e=>e.input+e.output),W=c(e=>e.enabled),Ae=c(e=>e.amount),G=c(e=>e.tierAlertDays),je=c(e=>e.lastTierSwitchAt),[K,Me]=(0,r.useState)(()=>Zt()),[Ne,Pe]=(0,r.useState)(null),[Ie,Le]=(0,r.useState)(null),[Re,ze]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>ze(Date.now()),Bn);return()=>{clearInterval(e)}},[]);let Be=(0,r.useCallback)(e=>{Me(e),Qt(e)},[]),Ve=(0,r.useCallback)(()=>{Le({entering:we(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+3*6e4})},[]),He=Ae>0?Ae:u.budget??0,Ue=W&&He>0?H/He>=1?`over`:H/He>=.8?`warn`:`none`:`none`,We=(0,r.useCallback)(()=>{let e=!W;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,W]);(0,r.useEffect)(()=>{if(!W||He<=0)return;let e=H/He*100,t=nn.filter(t=>e>=t&&G?.[String(t)]!==V);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,V),!En())return;let r=L(`budgetTierBody`).replace(`{cost}`,q(H)).replace(`{budget}`,q(He)).replace(`{pct}`,String(n));On(`budget:${n}:${V}`,()=>{new Notification(L(`budget`),{body:r})})},[W,He,H,G,V,l,L]),(0,r.useEffect)(()=>{let e=$t(Re,K,je);if(e===null||(l.markTierSwitchAlerted(e.atMs),Pe(e),!K.webNotify||!En()))return;let t=Math.max(1,Math.round((e.atMs-Re)/6e4)),n=L(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=L(e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));On(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[Re,je,K,l,L]);let Ge=c(e=>e.lastBalanceAlertDay),J=u.lowBalanceThreshold??50,Ke=(0,r.useMemo)(()=>{if(g.length===0)return;let e=Cn(u.byDay,V),t=xe().rate;for(let n of g){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=J)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[g,u.lowBalanceThreshold,u.byDay,V]);(0,r.useEffect)(()=>{if(Ke===void 0||Ge===V||(l.markBalanceAlerted(V),!En()))return;let e=L(`balanceLowBody`).replace(`{name}`,Ke.name).replace(`{balance}`,q(Ke.cny)).replace(`{days}`,Ke.days===void 0?`—`:String(Ke.days));On(`balance:${V}`,()=>{new Notification(L(`balance`),{body:e})})},[Ke,Ge,V,l,L]);let Y=(0,r.useMemo)(()=>{let e=V.slice(0,7),t=new Map;for(let[n,r]of Object.entries(u.byDayModels??{}))if(n.startsWith(e))for(let[e,n]of Object.entries(r)){if(n.cost<=0)continue;let r=Fe(e).provider,i=u.byModel?.[e]?.plan===!0,a=t.get(r)??{cost:0,plan:i};a.cost+=n.cost,i||(a.plan=!1),t.set(r,a)}let n,r;for(let e of t){let t=e[1].plan?r:n;(t===void 0||e[1].cost>t[1].cost)&&(e[1].plan?r=e:n=e)}let i=e=>{let t=g.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=g.filter(e=>e.totalBalance!==void 0&&e.error===void 0),t=e[0];return t!==void 0&&e.length===1?i(t.provider):void 0}return{text:t?.error===`unauthorized`?L(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?L(`balanceUnreachable`):L(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:q(t.totalBalance),r=xe().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<J}},a=e=>{let t=S.find(t=>t.displayName===e||un(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:L(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?L(`subscriptionExhausted`):L(`subscriptionRemaining`).replace(`{pct}`,String(n)),low:n<20}},o=n===void 0?void 0:i(n[0]);return{direct:n===void 0||o===void 0?void 0:{name:n[0],...o},sub:r===void 0?void 0:{name:r[0],...a(r[0])}}},[u.byDayModels,u.byModel,u.lowBalanceThreshold,g,S,V]),qe=(0,r.useMemo)(()=>{let e=u.total;return{input:e.input,output:e.output,cacheRead:e.cacheHit,cacheMiss:e.cacheMiss,calls:e.calls}},[u]);(0,r.useEffect)(()=>{i({todayCost:Te,monthCost:H})},[Te,H,i]),(0,r.useEffect)(()=>a(B),[a,B]);let Je=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)($n,{...e,t:L,onOpen:B,monthCost:H,todayCost:Te,weekCost:U,days:Ee,vendorStatus:Y,dash:qe,cardPrefs:le,monthTokens:De,todayTokens:Oe,weekTokens:ke,floatPrefs:ae,subscriptions:S,budgetPressure:Ue}),R&&(0,o.jsx)(rr,{stats:he,t:L,onClose:ye,userPrices:fe,onUserPrices:me,health:f,balances:g,...b===void 0?{}:{reconcile:b},quotas:S,relayQuotas:D,currency:re,onCurrency:ie,turns:Je,renderSlot:s,budgetEnabled:W,budgetAmount:He,onToggleBudget:We,onBudgetAmount:l.setAmount,peakConfig:K,onPeakConfig:Be,onPreviewPeak:Ve,floatPrefs:ae,onFloatPrefs:N,cardPrefs:le,onCardPrefs:de,sitePrefs:P,onSitePrefs:I,liveCostPrefs:oe,onLiveCostPrefs:ce,quotasStale:w}),(Ne!==null||Ie!==null)&&(0,o.jsx)(en,{hit:Ne??Ie,config:K,t:L,onDismiss:()=>{Pe(null),Le(null)}})]})}function cr(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function lr(e,t){if(t===void 0||e?.byTurn===void 0)return 0;let n=0,r=-1;for(let i of e.byTurn)i.sessionId===t&&(r===-1||i.turn>r)&&(r=i.turn,n=i.cost);return n}function ur(e,t=20){let n=[];for(let r of e)if(r.status===`ok`)for(let e of r.windows)e.remainingPercent>t||n.push({name:r.displayName,kind:e.kind,pct:e.remainingPercent});return n.sort((e,t)=>e.pct-t.pct).slice(0,3)}async function dr(){try{let e=await fetch(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return null;let r=n;return{...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{}}}catch{return null}}async function fr(){try{let e=await fetch(`/api/billing/subscriptions`);if(!e.ok)return[];let t=JSON.parse(await e.text());if(typeof t!=`object`||!t||!(`quotas`in t))return[];let n=t.quotas;return Array.isArray(n)?n:[]}catch{return[]}}function pr(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function mr(){let[e,t]=(0,r.useState)(()=>te().show),[n,i]=(0,r.useState)(()=>te().position);return(0,r.useEffect)(()=>{let e=()=>{t(te().show),i(te().position)};return window.addEventListener(O,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(O,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function hr(e){let[t,n]=(0,r.useState)(null),[i,a]=(0,r.useState)([]),[o,s]=(0,r.useState)(()=>Date.now());return(0,r.useEffect)(()=>{let e=!1,t=()=>{dr().then(t=>{!e&&t!==null&&n(t)}),fr().then(t=>{e||a(t)}),e||s(Date.now())};t();let r=setInterval(t,3e4);return()=>{e=!0,clearInterval(r)}},[e]),{sessionCost:(0,r.useMemo)(()=>cr(t,e),[t,e]),turnCost:(0,r.useMemo)(()=>lr(t,e),[t,e]),tier:U(o),chips:(0,r.useMemo)(()=>ur(i),[i])}}function gr({sessionId:e,t}){let{visible:n,position:r}=mr(),{sessionCost:i,turnCost:a,tier:s,chips:c}=hr(e),l=e=>q(e,`cny`),u=i>0||a>0,f=s.tier===`peak`;return!n||r===`toolbar`?null:(0,o.jsxs)(`span`,{className:r===`above`?d(P.feeBar,P.feeBarAbove):P.feeBar,"data-testid":`billing-live-cost-bar`,children:[(0,o.jsx)(`span`,{className:f?P.feeChipPrimary:P.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:P.feeCount,children:De(s.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:P.feeSuffix,children:t(f?`tierToOff`:`tierToPeak`)}),u&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:P.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:P.feeNum,children:l(a)})]}),(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:P.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:P.feeNum,children:l(i)})]})]}),c.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?P.feeChipError:P.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(pr(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function _r({sessionId:e,t}){let{visible:n,position:r}=mr(),{sessionCost:i,turnCost:s,tier:c,chips:l}=hr(e);if(!n||r!==`toolbar`)return null;let u=c.tier===`peak`,d=l.reduce((e,t)=>Math.min(e,t.pct),100),f=d<=10?P.feeInlineError:d<=20?P.feeInlineAlert:P.feeInline,p=[`${De(c.nextSwitchInMs)} ${t(u?`tierToOff`:`tierToPeak`)}`,`${t(`liveTurn`)} ${q(s,`cny`)}`,`${t(`liveSession`)} ${q(i,`cny`)}`,...l.map(e=>`${e.name} ${t(pr(e.kind))} ${e.pct}%`)].join(` · `);return(0,o.jsx)(a.Tooltip,{label:p,side:`top`,delayMs:500,children:(0,o.jsxs)(`span`,{className:f,"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":p,children:[(0,o.jsx)(`span`,{className:u?P.feeChipPrimary:P.feeChipOff,"data-testid":`billing-live-tier`,children:t(u?`tierPeak`:`tierOff`)}),i>0&&(0,o.jsx)(`span`,{className:P.feeInlineNum,children:q(i,`cny`)})]})})}function vr(){let e,t,n=new Set;return{readCosts:()=>e,subscribeCosts:t=>(t(e),n.add(t),()=>{n.delete(t)}),openDashboard:()=>{t?.()},publishCosts:t=>{e=t;for(let e of n)try{e(t)}catch{}},registerOpen:e=>(t=e,()=>{t===e&&(t=void 0)})}}function yr(){return(0,s.defineStore)({init:()=>({enabled:!1,amount:0,tierAlertDays:{},lastBalanceAlertDay:``,lastTierSwitchAt:0}),persist:`dsh.ui-usage-billing.budget`,actions:{setEnabled:(e,t)=>{e.enabled=t},setAmount:(e,t)=>{e.amount=Number.isFinite(t)&&t>0?t:0},markTierAlerted:(e,t,n)=>{e.tierAlertDays??={};for(let r of t)e.tierAlertDays[String(r)]=n},markBalanceAlerted:(e,t)=>{e.lastBalanceAlertDay=t},markTierSwitchAlerted:(e,t)=>{e.lastTierSwitchAt=t}}})}let br={enabled:!1,timeout:0};function xr(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...br};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...br}}}function Sr(e){return e.completed===!0?!0:e.running===!1}function Cr(e,t){let n=new Set,r=new Set,i,a=e.getSnapshot();for(let e of a.ids){let t=a.byId[e];t!==void 0&&(r.add(String(e)),Sr(t)&&n.add(String(e)))}let o=e=>{let{enabled:n,timeout:r}=t();if(n&&!(typeof Notification>`u`)&&Notification.permission===`granted`)try{let t=new Notification(e,{body:e,tag:`dsh-billing-completion`,requireInteraction:r===0});r>0&&(i!==void 0&&clearTimeout(i),i=setTimeout(()=>t.close(),r*1e3))}catch{}},s=e.subscribe(()=>{let t=e.getSnapshot(),i=[];for(let e of t.ids){let a=t.byId[e];if(a===void 0)continue;let o=String(e),s=Sr(a),c=!r.has(o);c&&r.add(o),s&&!c&&!n.has(o)&&i.push(a.title??a.id??o),s?n.add(o):n.delete(o)}if(i.length>0){let e=i.length===1?i[0]:`${i.length} 个会话已完成`;e!==void 0&&o(e)}});return()=>{s(),i!==void 0&&clearTimeout(i)}}let wr=[`slots`,`locale`,`remote`,`sessions`];function Tr(e){let t=vr();e.provide(`billingMetrics`,t);let n=yr();e.effect(()=>e.locale.register(Rt,{zh:zt,en:Bt}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:Rt,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}},store:n,inject:()=>({checkModels:async()=>{try{let[t,n]=await Promise.all([e.remote.llm.listProviders(),e.remote.llm.listConfigurableProviders()]);if(!t.ok||!n.ok)return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]};let r=new Map(n.value.map(e=>[e.provider,e])),i=await Promise.all(t.value.map(async t=>{let n=r.get(t.id);if(n===void 0)return{provider:t,models:[]};let i=await e.remote.llm.discoverModels(n.settingsNs,{provider:t.id});return i.ok?{provider:t,models:i.value}:{provider:t,failed:!0}})),a=[],o=[],s=[],c=0;for(let e of i){if(`failed`in e){s.push(e.provider.name);continue}o.push(e.provider.name),c+=e.models.length;for(let t of e.models)a.push({id:t.id,...typeof t.name==`string`&&t.name!==``?{name:t.name}:{},provider:e.provider.name})}return{checked:!0,available:o.length>0,models:c,failures:s.length,okProviders:o,badProviders:s,catalog:a}}catch{return{checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]}}},publishCosts:e=>{t.publishCosts(e)},registerOpen:e=>t.registerOpen(e)})},sr)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:Rt,inject:e=>({sessionId:l(e)})},gr)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:Rt,inject:e=>({sessionId:l(e)})},_r)),e.effect(()=>Cr(e.sessions.list,xr),`ui-usage-billing: completion notifier`)}return n.UsageBilling=sr,n.apply=Tr,n.inject=wr,t.exports}});
|
|
1
|
+
window.__ModuleLoader__.load({id:`@kenz1117/dsh-ui-usage-billing`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("react"),i=e("react-dom"),a=e("@deepseek-ai/dsh-client-ui-primitives"),o=e("react/jsx-runtime"),s=e("@deepseek-ai/dsh-client-store");function c(e){return e}function l(e){return c(e)}function u(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function d(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=` `),r+=t);return r}let f={mode:`combined`,targets:[]},p=`dsh.ui-usage-billing.float`;function m(){let e=()=>({...f,targets:[...f.targets]});try{let t=localStorage.getItem(p);if(t===null)return e();let n=JSON.parse(t);return{mode:n.mode===`subscription`?`subscription`:`combined`,targets:Array.isArray(n.targets)?n.targets.filter(e=>typeof e==`string`):[]}}catch{return e()}}function h(e){try{localStorage.setItem(p,JSON.stringify(e))}catch{}}let g={metric:`money`,span:`day`},_=`dsh.ui-usage-billing.card`;function v(){try{let e=localStorage.getItem(_);if(e===null)return{...g};let t=JSON.parse(e);return{metric:t.metric===`tokens`?`tokens`:`money`,span:t.span===`week`||t.span===`month`?t.span:`day`}}catch{return{...g}}}function y(e){try{localStorage.setItem(_,JSON.stringify(e))}catch{}}let b=`dsh.ui-usage-billing.kpi-range`;function x(){try{let e=localStorage.getItem(b);return e===`today`||e===`7d`||e===`week`||e===`month`||e===`all`?e:`all`}catch{return`all`}}function S(e){try{localStorage.setItem(b,e)}catch{}}let C={hideUnidentified:!0},w=`dsh.ui-usage-billing.sites`;function T(){try{let e=localStorage.getItem(w);return e===null?{...C}:{hideUnidentified:JSON.parse(e).hideUnidentified!==!1}}catch{return{...C}}}function ee(e){try{localStorage.setItem(w,JSON.stringify(e))}catch{}}let E={show:!0,position:`toolbar`},D=`dsh.ui-usage-billing.livecost`,O=`dsh.ui-usage-billing.livecost-pref`;function te(){try{let e=localStorage.getItem(D);if(e===null)return{...E};let t=JSON.parse(e);return{show:t.show!==!1,position:t.position===`above`||t.position===`toolbar`||t.position===`below`?t.position:E.position}}catch{return{...E}}}function k(e){try{localStorage.setItem(D,JSON.stringify(e))}catch{}}let A=`dsh.ui-usage-billing.prices`;function j(){try{let e=localStorage.getItem(A);if(e===null)return[];let t=JSON.parse(e);if(t===null)return[];let n=[],r=(e,t)=>{if(typeof t!=`object`||!t)return;let r=t,i=Number(r.input),a=Number(r.cacheHit),o=Number(r.output);if(![i,a,o].every(e=>Number.isFinite(e)&&e>=0))return;let s=r.offPeak,c;if(typeof s==`object`&&s){let e=s,t=Number(e.input),n=Number(e.cacheHit),r=Number(e.output);[t,n,r].every(e=>Number.isFinite(e)&&e>=0)&&(c={input:t,cacheHit:n,output:r})}n.push({key:e,...typeof r.origin==`string`&&r.origin!==``?{origin:r.origin}:{},input:i,cacheHit:a,output:o,...c===void 0?{}:{offPeak:c},...r.currency===`USD`?{currency:`USD`}:{}})};if(Array.isArray(t))for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.key!=`string`||t.key===``||r(t.key,e)}else if(typeof t==`object`)for(let[e,n]of Object.entries(t))r(e,n);return n}catch{return[]}}function ne(e){try{localStorage.setItem(A,JSON.stringify(e))}catch{}}let re={metric:`ttft`},ie=`dsh.ui-usage-billing.perf`;function ae(){try{let e=localStorage.getItem(ie);if(e===null)return{...re};let t=JSON.parse(e);return{metric:t.metric===`tps`?`tps`:`ttft`,...Array.isArray(t.models)?{models:t.models.filter(e=>typeof e==`string`)}:{}}}catch{return{...re}}}function M(e){try{localStorage.setItem(ie,JSON.stringify(e))}catch{}}let N=`@kenz1117/dsh-ui-usage-billing/UsageBilling.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(N)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@kenz1117/dsh-ui-usage-billing`,e.dataset.pluginCss=N,e.textContent=`:root{--ds-blue:#4f8cff;--ds-cyan:#2dd4bf;--ds-green:#34d399;--ds-amber:#f59e0b;--ds-red:#ef4444;--ds-violet:#a78bfa}body{--dsb:var(--dsw-alias-bg-layer-1);--dsb-2:var(--dsw-alias-bg-layer-2);--dsb-3:var(--dsw-alias-bg-layer-3);--dsb-glass:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 78%,transparent);--dsb-glass-strong:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 88%,transparent);--ds-border:var(--dsw-alias-border-l1);--ds-border-strong:var(--dsw-alias-border-l2);--ds-hi-top:#ffffff0b;--ds-shadow-1:0 1px 0 #ffffff0a inset,0 8px 24px #00000059;--ds-shadow-2:0 1px 0 #ffffff0d inset,0 18px 48px #00000080;--ds-t-1:var(--dsw-alias-label-primary);--ds-t-2:var(--dsw-alias-label-secondary);--ds-t-3:var(--dsw-alias-label-tertiary);--ds-t-4:var(--dsw-alias-label-dimmed);--ds-c-1:#4f8cff;--ds-c-2:#2dd4bf;--ds-c-3:#a78bfa;--ds-c-4:#f59e0b;--ds-c-5:#f472b6;--ds-c-6:#fbbf24;--ds-c-7:#38bdf8;--ds-r-1:8px;--ds-r-2:12px;--ds-r-3:16px;--ds-t-fast:.16s cubic-bezier(.2,.8,.2,1)}.VWh0dG_railButton{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);width:36px;height:36px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast);flex:none;justify-content:center;align-items:center;padding:0;display:flex}.VWh0dG_railButton:hover,.VWh0dG_railButton:focus-visible{border-color:var(--ds-blue);color:var(--ds-blue);outline:none}.VWh0dG_railButton svg{width:26px;height:26px}.VWh0dG_triggerBudgetPulse{border-color:color-mix(in srgb, var(--ds-red) 55%, transparent);animation:2s ease-in-out infinite VWh0dG_budgetPulse}.VWh0dG_triggerBudgetOver{animation-duration:1.2s}@keyframes VWh0dG_budgetPulse{0%,to{box-shadow:0 1px 2px #0000000a,0 0 #ef444400}50%{box-shadow:0 1px 2px #0000000a,0 0 0 3px #ef444429}}.VWh0dG_trigger{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:100%;min-width:0;color:var(--ds-t-1);cursor:pointer;text-align:left;transition:border-color var(--ds-t-fast), transform var(--ds-t-fast), box-shadow var(--ds-t-fast);align-items:center;gap:12px;padding:10px 14px;display:flex;position:relative;overflow:hidden;box-shadow:0 1px 2px #0000000a}.VWh0dG_trigger:hover,.VWh0dG_trigger:focus-visible{border-color:var(--ds-border-strong);box-shadow:0 6px 18px -8px color-mix(in srgb, var(--ds-blue) 45%, transparent);outline:none;transform:translateY(-1px)}.VWh0dG_trigger:before{content:"";background:linear-gradient(180deg, var(--ds-hi-top), transparent);pointer-events:none;height:1px;position:absolute;top:0;left:0;right:0}.VWh0dG_trigger:after{content:"";background:linear-gradient(105deg, transparent 42%, color-mix(in srgb, var(--ds-blue) 9%, transparent) 50%, transparent 58%);opacity:0;pointer-events:none;position:absolute;inset:0;transform:translate(-110%)}.VWh0dG_trigger:hover:after,.VWh0dG_trigger:focus-visible:after{animation:.9s ease-out VWh0dG_triggerScan}@keyframes VWh0dG_triggerScan{0%{opacity:0;transform:translate(-110%)}25%{opacity:1}to{opacity:0;transform:translate(110%)}}@media (prefers-reduced-motion:reduce){.VWh0dG_triggerSparkBar,.VWh0dG_trigger:hover:after,.VWh0dG_trigger:focus-visible:after{animation:none}.VWh0dG_triggerGaugeNeedle,.VWh0dG_triggerGaugeArc{transition:none}.VWh0dG_triggerBudgetPulse{animation:none}}.VWh0dG_triggerIcon{width:32px;height:32px;color:var(--ds-blue);flex:none;justify-content:center;align-items:center;display:inline-flex}.VWh0dG_triggerIcon svg{width:30px;height:30px}.VWh0dG_triggerGaugeNeedle{transition:transform 1.1s cubic-bezier(.22,1,.36,1)}.VWh0dG_triggerGaugeArc{transition:stroke-dasharray 1.1s cubic-bezier(.22,1,.36,1)}.VWh0dG_triggerBudgetHot{color:var(--ds-red)}.VWh0dG_triggerMain{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.VWh0dG_triggerPrimary{align-items:baseline;gap:5px;min-width:0;display:inline-flex}.VWh0dG_triggerLabel{color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;min-width:0;font-size:11px;line-height:15px;overflow:hidden}.VWh0dG_triggerYen{color:var(--ds-t-3);font-variant-numeric:tabular-nums;font-size:12px;font-weight:600;line-height:16px}.VWh0dG_triggerMetric{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;min-width:0;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:22px;font-weight:600;line-height:26px;overflow:hidden}.VWh0dG_triggerSpark{flex:none;align-items:flex-end;gap:2px;height:20px;display:flex}.VWh0dG_triggerSparkBar,.VWh0dG_triggerSparkHot{background:var(--ds-blue);opacity:.6;border-radius:1px 1px 0 0;width:3px}.VWh0dG_triggerSparkHot{opacity:1}.VWh0dG_triggerSparkBar{animation:3.6s ease-in-out infinite VWh0dG_triggerSparkBreath}.VWh0dG_triggerSparkBar:nth-child(2n){animation-delay:-1.2s}.VWh0dG_triggerSparkBar:nth-child(3n){animation-delay:-2.4s}@keyframes VWh0dG_triggerSparkBreath{0%,to{opacity:.6}50%{opacity:.34}}.VWh0dG_triggerWrap{flex:auto;width:100%;min-width:96px;max-width:100%;display:block;position:relative;container:VWh0dG_billing-trigger/inline-size}@container VWh0dG_billing-trigger (width<=200px){.VWh0dG_trigger{gap:6px;padding:8px 10px}.VWh0dG_triggerSpark{display:none}}@container VWh0dG_billing-trigger (width<=170px){.VWh0dG_triggerLabel{display:none}}@container VWh0dG_billing-trigger (width<=110px){.VWh0dG_triggerIcon,.VWh0dG_triggerSpark,.VWh0dG_triggerLabel{display:none}.VWh0dG_trigger{justify-content:center;padding:8px 6px}}.VWh0dG_triggerPop{box-sizing:border-box;border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);width:256px;box-shadow:var(--ds-shadow-2);opacity:0;visibility:hidden;pointer-events:none;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear .16s;z-index:2000;flex-direction:column;gap:5px;padding:10px 12px;display:flex;position:fixed;top:0;left:0;overflow:hidden;transform:translateY(calc(4px - 100%))}.VWh0dG_triggerPop,.VWh0dG_triggerPop *{box-sizing:border-box}.VWh0dG_triggerPop:before{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.VWh0dG_triggerPopShown{opacity:1;visibility:visible;transition:opacity var(--ds-t-fast), transform var(--ds-t-fast), visibility 0s linear 0s;transform:translateY(-100%)}.VWh0dG_popHead{justify-content:space-between;align-items:baseline;gap:8px;display:flex}.VWh0dG_popTitle{letter-spacing:.06em;text-transform:uppercase;color:var(--ds-t-3);font-size:12px;font-weight:700;line-height:18px}.VWh0dG_metricGrid{grid-template-columns:repeat(3,1fr);gap:10px 12px;display:grid}.VWh0dG_metricCell{flex-direction:column;gap:2px;min-width:0;display:flex}.VWh0dG_metricLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.VWh0dG_metricValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:13px;font-weight:700;line-height:16px}.VWh0dG_metricValueSuccess{color:var(--ds-green)}.VWh0dG_popModel{border-top:1px dashed var(--ds-border);flex-direction:column;gap:6px;margin-top:9px;padding-top:10px;display:flex}.VWh0dG_popModelLabel{color:var(--ds-t-3);font-size:10px;line-height:14px}.VWh0dG_popModelRow{align-items:center;gap:8px;min-width:0;display:flex}.VWh0dG_popDot{border-radius:999px;flex:none;width:6px;height:6px}.VWh0dG_popDotDirect{background:var(--ds-green)}.VWh0dG_popDotSub{background:var(--ds-amber)}.VWh0dG_popDotNeutral{background:var(--ds-t-3)}.VWh0dG_popTagPrimary,.VWh0dG_popTagSub{white-space:nowrap;border-radius:5px;flex:none;align-items:center;height:18px;padding:0 6px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_popTagPrimary{background:color-mix(in srgb, var(--ds-blue) 14%, transparent);color:var(--ds-blue)}.VWh0dG_popTagSub{background:color-mix(in srgb, var(--ds-amber) 18%, transparent);color:var(--ds-amber)}.VWh0dG_popModelName{color:var(--ds-t-2);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:16px;overflow:hidden}.VWh0dG_popModelStatus{color:var(--ds-t-1);font-variant-numeric:tabular-nums;white-space:nowrap;margin-left:auto;font-size:11px;font-weight:600;line-height:16px}.VWh0dG_popModelStatusLow{color:var(--ds-red)}.VWh0dG_dashboardModal{border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-3);background:var(--dsb-2);width:min(760px,100vw - 48px);max-height:min(760px,88vh);box-shadow:var(--ds-shadow-2);animation:.16s ease-out VWh0dG_dashboardIn}@keyframes VWh0dG_dashboardIn{0%{opacity:0;transform:translateY(4px)scale(.98)}to{opacity:1;transform:none}}div[role=presentation]:has(>.dsh-billing-modal)>div[aria-hidden=true]:first-child{backdrop-filter:blur(8px)saturate(1.25)}.VWh0dG_dashboard{flex-direction:column;width:100%;max-height:min(760px,88vh);display:flex}.VWh0dG_dashboardHead{border-bottom:1px solid var(--ds-border);justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;display:flex}.VWh0dG_dashboardTitle{color:var(--ds-t-1);margin:0;font-size:14px;font-weight:600;line-height:20px}.VWh0dG_dashboardSubtitle{color:var(--ds-t-3);margin:2px 0 0;font-size:11px;line-height:16px}.VWh0dG_closeButton{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);width:32px;height:32px;color:var(--ds-t-2);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;flex:none;justify-content:center;align-items:center;display:inline-flex}.VWh0dG_closeButton:hover{background:var(--dsb-3);color:var(--ds-t-1)}.VWh0dG_closeButton svg{stroke-width:2px;width:16px;height:16px}.VWh0dG_dashboardBody{flex-direction:column;gap:14px;padding:16px 24px 24px;display:flex;overflow-y:auto}.VWh0dG_modalFooter{border-top:1px solid var(--ds-border);color:var(--ds-t-3);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:8px 18px;font-size:11px;line-height:16px;display:flex}.VWh0dG_tabNav{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb);align-items:center;gap:4px;margin:14px 24px 0;padding:4px;display:flex}.VWh0dG_tabButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast), box-shadow var(--ds-t-fast);background:0 0;border:none;border-radius:6px;padding:6px 12px;font-size:12px;font-weight:500;line-height:16px}.VWh0dG_tabButton:hover{color:var(--ds-t-2)}.VWh0dG_tabButton:focus-visible{color:var(--ds-t-2);box-shadow:0 0 0 1px var(--ds-border-strong);outline:none}.VWh0dG_tabButtonActive,.VWh0dG_tabButtonActive:hover,.VWh0dG_tabButtonActive:focus-visible{background:var(--dsb-3);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong) inset;font-weight:600}.VWh0dG_tabPanel{flex-direction:column;gap:14px;animation:.14s ease-out VWh0dG_tabPanelIn;display:flex}@keyframes VWh0dG_tabPanelIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}.VWh0dG_reconcileNotice{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 78%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 62%, transparent);color:var(--dsw-alias-label-secondary);border-radius:10px;align-items:flex-start;gap:10px;padding:10px 12px;font-size:12px;line-height:1.55;display:flex}.VWh0dG_reconcileIcon{color:var(--dsw-alias-label-tertiary);flex:none;margin-top:1px;display:inline-flex}.VWh0dG_reconcileText{flex:1}.VWh0dG_reconcileDismiss{color:var(--dsw-alias-label-tertiary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;padding:2px 8px;font-size:12px;line-height:1.4;transition:color .15s,background-color .15s}.VWh0dG_reconcileDismiss:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.VWh0dG_hero{border:1px solid var(--ds-border);border-radius:var(--ds-r-3);background:var(--dsb-glass-strong);flex-direction:column;gap:12px;padding:18px 20px;display:flex;position:relative;overflow:hidden}.VWh0dG_hero:after{content:"";background:linear-gradient(90deg, transparent 10%, var(--ds-amber) 50%, transparent 90%);opacity:.65;pointer-events:none;height:1.5px;position:absolute;top:0;left:0;right:0}.VWh0dG_heroTop{justify-content:space-between;align-items:center;gap:24px;display:flex}.VWh0dG_heroMain{flex-direction:column;gap:2px;min-width:0;display:flex}.VWh0dG_heroLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:11px;font-weight:500;line-height:15px}.VWh0dG_heroReadout{align-items:baseline;gap:4px;display:flex}.VWh0dG_heroCurrency{letter-spacing:-.01em;color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:22px;font-weight:600;line-height:26px}.VWh0dG_heroValue{letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--ds-t-1);font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:52px;font-weight:600;line-height:56px}.VWh0dG_heroMeta{color:var(--ds-t-2);white-space:nowrap;margin-top:2px;font-size:12px;line-height:16px}.VWh0dG_heroGauge{flex-direction:column;flex:none;align-items:center;gap:4px;width:96px;display:flex}.VWh0dG_heroGaugeDial{flex:none;width:96px;height:96px;position:relative}.VWh0dG_heroGaugeSvg{width:100%;height:100%;display:block;transform:rotate(-90deg)}.VWh0dG_heroGaugeTrack{fill:none;stroke:var(--dsb-3);stroke-width:7px}.VWh0dG_heroGaugeArc{fill:none;stroke:var(--ds-blue);stroke-width:7px;stroke-linecap:round;transition:stroke-dasharray var(--ds-t-fast)}.VWh0dG_heroGaugeArcOver{stroke:var(--ds-red)}.VWh0dG_heroGaugeCenter{flex-direction:column;justify-content:center;align-items:center;gap:1px;display:flex;position:absolute;inset:0}.VWh0dG_heroGaugeRemain{letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--ds-t-1);font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:16px;font-weight:600;line-height:18px}.VWh0dG_heroGaugeRemainOver{color:var(--ds-red)}.VWh0dG_heroGaugeLabel{color:var(--ds-t-3);font-size:11px;line-height:13px}.VWh0dG_heroGaugeSub{font-variant-numeric:tabular-nums;color:var(--ds-t-2);white-space:nowrap;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:10px;line-height:12px}.VWh0dG_heroSide{border-top:1px solid var(--ds-border);align-items:stretch;padding-top:12px;display:flex}.VWh0dG_heroSideItem{border-left:1px solid var(--ds-border);flex-direction:column;flex:1;gap:2px;min-width:0;padding-left:14px;display:flex}.VWh0dG_heroSideItem:first-child{border-left:none;padding-left:0}.VWh0dG_heroSideLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.06em;white-space:nowrap;font-size:10px;font-weight:500;line-height:13px}.VWh0dG_heroSideValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;white-space:nowrap;align-items:baseline;gap:6px;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:15px;font-weight:600;line-height:20px;display:inline-flex}.VWh0dG_heroSideSpacer{flex:1;display:block}.VWh0dG_delta{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:2px;margin-left:6px;padding:1px 7px;font-size:10.5px;font-weight:600;line-height:16px;display:inline-flex}.VWh0dG_deltaUp{color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.VWh0dG_deltaDown{color:var(--ds-red);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_unpricedHint{border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);background:color-mix(in srgb, var(--ds-amber) 8%, transparent);color:var(--ds-amber);border-radius:8px;align-items:center;padding:8px 12px;font-size:11.5px;font-weight:500;line-height:17px;display:flex}.VWh0dG_kpiZone{flex-direction:column;gap:8px;display:flex}.VWh0dG_kpiZoneHead{justify-content:flex-end;align-items:center;gap:8px;display:flex}.VWh0dG_kpiZoneLabel{color:var(--ds-t-3);font-size:11px;line-height:14px}.VWh0dG_kpiGrid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;display:grid}.VWh0dG_kpiTile{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:2px;padding:14px 16px;display:flex;position:relative;overflow:hidden}.VWh0dG_kpiTile:hover{border-color:var(--ds-border-strong)}.VWh0dG_kpiLabel{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;font-size:11px;font-weight:500;line-height:14px}.VWh0dG_kpiValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;letter-spacing:-.01em;margin-top:6px;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:22px;font-weight:600;line-height:26px}.VWh0dG_kpiGreen{color:var(--ds-green)}.VWh0dG_kpiDetail{color:var(--ds-t-3);white-space:nowrap;text-overflow:ellipsis;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:11px;line-height:15px;overflow:hidden}.VWh0dG_panel{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);transition:border-color var(--ds-t-fast);flex-direction:column;gap:8px;padding:12px 14px;display:flex}.VWh0dG_panelHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.VWh0dG_panelHeadControls{align-items:center;gap:8px;display:inline-flex}.VWh0dG_panelTitle{letter-spacing:-.005em;color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:20px}.VWh0dG_panelHint{color:var(--ds-t-3);white-space:nowrap;font-size:11px;line-height:16px}.VWh0dG_rangeToggle{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:8px;gap:2px;padding:2px;display:inline-flex}.VWh0dG_rangeButton{color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:none;border-radius:6px;padding:2px 8px;font-size:11px;line-height:16px}.VWh0dG_rangeButtonActive{background:var(--dsb-2);color:var(--ds-t-1);box-shadow:0 0 0 1px var(--ds-border-strong);font-weight:600}.VWh0dG_exportBar{justify-content:flex-end;align-items:center;gap:8px;display:flex}.VWh0dG_exportLabel{color:var(--ds-t-3);font-size:11px;line-height:16px}.VWh0dG_exportButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;padding:4px 12px;font-size:11.5px;line-height:16px}.VWh0dG_exportButton:hover,.VWh0dG_exportButton:focus-visible{border-color:var(--ds-border-strong);color:var(--ds-t-1);outline:none}.VWh0dG_shareTrack{background:var(--dsb-3);border-radius:4px;height:8px;display:flex;overflow:hidden}.VWh0dG_shareSeg{height:100%;transition:width var(--ds-t-fast)}.VWh0dG_shareSegPeak{background:var(--ds-blue)}.VWh0dG_shareSegOff{background:color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))}.VWh0dG_shareSegUser{background:var(--ds-blue)}.VWh0dG_shareSegAssistant{background:var(--ds-green)}.VWh0dG_shareSegTool{background:var(--ds-amber)}.VWh0dG_shareLegend{align-items:center;gap:16px;display:flex}.VWh0dG_shareItem{color:var(--ds-t-2);align-items:baseline;gap:6px;font-size:11px;line-height:17px;display:inline-flex}.VWh0dG_bucketCost{font-variant-numeric:tabular-nums;align-items:baseline;gap:3px;display:inline-flex}.VWh0dG_bucketOfficial{color:var(--ds-blue);font-weight:600}.VWh0dG_bucketSep{color:var(--ds-t-4)}.VWh0dG_bucketThird{color:var(--ds-t-2)}.VWh0dG_shareDot{border-radius:2px;flex:none;align-self:center;width:8px;height:8px}.VWh0dG_shareValue{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.VWh0dG_budgetInput{width:64px;color:var(--ds-t-1);font-variant-numeric:tabular-nums;text-align:right;background:0 0;border:none;padding:0;font-size:12px;line-height:16px}.VWh0dG_budgetInput:focus-visible{outline:none}.VWh0dG_switch{border:1px solid var(--ds-border);background:var(--dsb-3);cursor:pointer;width:32px;height:18px;transition:background-color var(--ds-t-fast), border-color var(--ds-t-fast);border-radius:999px;flex:none;padding:0;position:relative}.VWh0dG_switchOn{background:color-mix(in srgb, var(--ds-blue) 60%, transparent);border-color:#0000}.VWh0dG_switchKnob{width:12px;height:12px;transition:transform var(--ds-t-fast);background:#fff;border-radius:50%;position:absolute;top:2px;left:2px}.VWh0dG_switchOn .VWh0dG_switchKnob{transform:translate(14px)}.VWh0dG_budgetFillWarn{background:var(--ds-amber)}.VWh0dG_budgetFillOver{background:var(--ds-red)}.VWh0dG_chartWrap{width:100%;position:relative}.VWh0dG_chartSvg{width:100%;height:auto;display:block}.VWh0dG_chartEmpty{height:140px;color:var(--ds-t-3);justify-content:center;align-items:center;font-size:13px;display:flex}.VWh0dG_emptyRow{text-align:center;color:var(--ds-t-3);padding:28px 0;font-size:13px}.VWh0dG_chartGrid{stroke:var(--ds-border);stroke-width:1px}.VWh0dG_chartAxisLabel{fill:var(--ds-t-3);font-size:10px}.VWh0dG_chartBar{fill:var(--ds-blue);opacity:.7}.VWh0dG_chartBar:hover{opacity:1}.VWh0dG_chartStack{stroke:var(--dsb);stroke-width:.75px}.VWh0dG_chartStack:hover{opacity:.9}.VWh0dG_chartLine{stroke:var(--ds-blue);stroke-width:2px;stroke-linecap:round;stroke-linejoin:round}.VWh0dG_chartCrosshair{stroke:var(--ds-t-4);stroke-width:1px;stroke-dasharray:3 3}.VWh0dG_chartTooltip{pointer-events:none;z-index:2;border:1px solid var(--ds-border-strong);background:var(--dsb-2);box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;padding:8px 10px;position:absolute;transform:translate(-50%,calc(-100% - 10px))}.VWh0dG_chartTooltipAlignRight{transform:translate(calc(-100% - 8px),calc(-100% - 10px))}.VWh0dG_chartTooltipAlignLeft{transform:translate(8px,calc(-100% - 10px))}.VWh0dG_chartTooltipDate{color:var(--ds-t-1);margin-bottom:3px;font-size:11px;font-weight:600}.VWh0dG_chartTooltipRow{color:var(--ds-t-2);align-items:center;gap:5px;font-size:11px;line-height:17px;display:flex}.VWh0dG_chartTooltipRow strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.VWh0dG_chartTooltipHead{justify-content:space-between;align-items:baseline;gap:14px;margin-bottom:3px;display:flex}.VWh0dG_chartTooltipHead .VWh0dG_chartTooltipDate{margin-bottom:0}.VWh0dG_chartTooltipHead strong{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:11px;font-weight:600}.VWh0dG_chartTooltipSplit{justify-content:space-between;gap:14px}.VWh0dG_chartTooltipLabel{align-items:center;gap:5px;display:flex}.VWh0dG_chartTooltipModelDetail{color:var(--ds-t-3);font-variant-numeric:tabular-nums;margin:-2px 0 4px 13px;font-size:10.5px;line-height:14px}.VWh0dG_chartBarPlaceholder{fill:color-mix(in srgb, var(--ds-t-2) 30%, transparent)}.VWh0dG_chartLegendLine{background:var(--ds-blue);border-radius:2px;width:10px;height:3px;display:inline-block}.VWh0dG_chartLegendBar{background:var(--ds-blue);opacity:.5;border-radius:2px;width:7px;height:7px;display:inline-block}.VWh0dG_chartTooltipSwatch{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.VWh0dG_chartLegend{color:var(--ds-t-2);justify-content:flex-end;gap:14px;margin-top:2px;font-size:11px;display:flex}.VWh0dG_chartLegend span{align-items:center;gap:5px;display:inline-flex}.VWh0dG_chartLegendItem{font:inherit;color:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:5px;padding:0;transition:color .12s;display:inline-flex}.VWh0dG_chartLegendItem:hover{color:var(--ds-t-1)}.VWh0dG_chartLegendItemActive{color:var(--ds-t-1);font-weight:600}.VWh0dG_perfBar{align-items:center;margin:10px 0 2px;display:flex}.VWh0dG_perfChips{flex-wrap:wrap;gap:6px;margin:6px 0 2px;display:flex}.VWh0dG_perfChip{border:1px solid var(--ds-border);background:var(--dsb-3);color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), opacity var(--ds-t-fast);border-radius:999px;align-items:center;gap:5px;padding:2px 9px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_perfChip:hover{color:var(--ds-t-1)}.VWh0dG_perfChipOff{opacity:.45}.VWh0dG_perfChipDot{border-radius:2px;flex:none;width:8px;height:8px;display:inline-block}.VWh0dG_chartHoverDot{stroke:var(--dsb-2);stroke-width:1.5px}.VWh0dG_tableScroll{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);overflow:auto}.VWh0dG_ubAlert{border:1px solid color-mix(in srgb, var(--ds-blue) 30%, transparent);border-radius:var(--ds-r-1);background:color-mix(in srgb, var(--ds-blue) 8%, transparent);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;font-size:12px;line-height:17px;display:flex}.VWh0dG_ubAlertLeft{align-items:center;gap:8px;display:inline-flex}.VWh0dG_ubRate{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-weight:600}.VWh0dG_ubAlertNote{color:var(--ds-t-2);margin:0}.VWh0dG_ubTag,.VWh0dG_ubTagSuccess,.VWh0dG_ubTagNeutral,.VWh0dG_ubTagAlert,.VWh0dG_ubTagPromo{border:1px solid var(--ds-border-strong);white-space:nowrap;border-radius:999px;align-items:center;gap:4px;padding:1px 5px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_ubTag{color:var(--ds-t-2);background:var(--dsb-2)}.VWh0dG_ubTagSuccess{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.VWh0dG_ubTagNeutral{color:var(--ds-t-2);background:var(--dsb-2)}.VWh0dG_ubTagAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 36%, transparent);background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.VWh0dG_ubTagPromo{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent);cursor:help}.VWh0dG_ubExtraRow td{opacity:.72;padding-top:2px;padding-bottom:2px;font-size:12px}.VWh0dG_ubExtraName{color:var(--ds-t-2);margin-left:26px}.VWh0dG_ubExtraNote{color:var(--ds-t-3);margin-left:8px;font-size:10px}.VWh0dG_ubCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.VWh0dG_ubCardHead{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.VWh0dG_ubCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.VWh0dG_ubCardSub{color:var(--ds-t-3);font-size:11px;line-height:16px}.VWh0dG_ubTablewrap{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);overflow:auto}.VWh0dG_ubTable{border-collapse:collapse;white-space:nowrap;width:100%;font-size:12px}.VWh0dG_ubTable th,.VWh0dG_ubTable td{border-bottom:1px solid var(--ds-border);text-align:left;color:var(--ds-t-1);padding:7px 9px}.VWh0dG_ubTable tbody tr:last-child td{border-bottom:0}.VWh0dG_ubTable thead th,.VWh0dG_ubTable thead th.VWh0dG_numCol{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;text-align:center;padding:6px 9px;font-size:11px;font-weight:500}.VWh0dG_ubModel{align-items:center;gap:6px;display:inline-flex}.VWh0dG_vendorLetter{color:#fff;border-radius:4px;flex:none;justify-content:center;align-items:center;width:16px;height:16px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.VWh0dG_ubModelName{color:var(--ds-t-1);align-items:center;gap:4px;font-weight:500;display:inline-flex}.VWh0dG_ubChipPeak,.VWh0dG_ubChipOff{font-variant-numeric:tabular-nums;border-radius:999px;align-items:center;gap:4px;height:18px;padding:0 6px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_ubChipLabel{font-size:10px;font-weight:600}.VWh0dG_ubChipPeak{background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue)}.VWh0dG_ubChipOff{background:color-mix(in srgb, var(--ds-green) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green)}.VWh0dG_ubNotes{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}.VWh0dG_ubNotesItem{align-items:baseline;gap:10px;display:flex}.VWh0dG_ubNotesTerm{color:var(--ds-t-1);flex:0 0 72px;font-size:12px;font-weight:500}.VWh0dG_ubNotesDesc{min-width:0;color:var(--ds-t-2);flex:1;font-size:12px;line-height:17px}.VWh0dG_ubCardControlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.VWh0dG_ubTagError{white-space:nowrap;background:color-mix(in srgb, var(--ds-red) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-red) 36%, transparent);height:18px;color:var(--ds-red);border-radius:999px;align-items:center;padding:0 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_modelTable{border-collapse:collapse;table-layout:fixed;width:100%;min-width:640px;font-size:12px}.VWh0dG_modelTable th:first-child{width:26%}.VWh0dG_modelTable th,.VWh0dG_modelTable td{border-bottom:1px solid var(--ds-border);text-align:left;white-space:nowrap;color:var(--ds-t-1);padding:10px 12px}.VWh0dG_modelTable tbody tr:last-child td{border-bottom:0}.VWh0dG_sessionGroupRow{cursor:pointer}.VWh0dG_sessionGroupRow .VWh0dG_modelName:before{content:"›";color:var(--ds-t-3);margin-right:6px;display:inline-block}.VWh0dG_sessionGroupRow[aria-expanded=true] .VWh0dG_modelName:before{transform:rotate(90deg)}.VWh0dG_sessionChildRow td:first-child{padding-left:30px}.VWh0dG_modelTable thead th{color:var(--ds-t-3);text-transform:uppercase;letter-spacing:.04em;background:0 0;padding:8px 12px;font-size:11px;font-weight:500}.VWh0dG_modelTable tbody tr{transition:background-color .12s}.VWh0dG_modelTable tbody tr:hover{background:0 0}.VWh0dG_modelTable tbody tr.VWh0dG_modelRowFocusable{cursor:pointer}.VWh0dG_modelTable tbody tr.VWh0dG_modelRowActive,.VWh0dG_modelTable tbody tr.VWh0dG_modelRowActive:hover{background:color-mix(in srgb, var(--ds-blue) 10%, transparent)}.VWh0dG_numCol{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums}.VWh0dG_modelTable .VWh0dG_numCol,.VWh0dG_ubTable .VWh0dG_numCol{text-align:right}.VWh0dG_na{color:var(--ds-t-4)}.VWh0dG_modelCell{align-items:center;gap:8px;display:inline-flex}.VWh0dG_modelDot{border-radius:2px;flex:none;width:8px;height:8px}.VWh0dG_modelName{color:var(--ds-t-1);font-weight:500;line-height:16px;display:block}.VWh0dG_modelProvider{color:var(--ds-t-3);font-size:10.5px;line-height:14px;display:block}.VWh0dG_siteRow{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);background:var(--dsb-2);justify-content:space-between;align-items:center;gap:12px;padding:8px 10px;display:flex}.VWh0dG_siteRowName{align-items:center;gap:8px;min-width:0;display:inline-flex}.VWh0dG_siteKindTag{white-space:nowrap;border:1px solid #0000;border-radius:999px;flex:none;align-items:center;padding:2px 7px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_siteKindSite{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 36%, transparent);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.VWh0dG_siteKindDirect{color:var(--ds-green);border-color:color-mix(in srgb, var(--ds-green) 36%, transparent);background:color-mix(in srgb, var(--ds-green) 12%, transparent)}.VWh0dG_siteKindUnknown{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_siteRowTitle{color:var(--ds-t-1);text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600;line-height:18px;overflow:hidden}.VWh0dG_siteRowMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.VWh0dG_siteRowCost{color:var(--ds-t-1);font-variant-numeric:tabular-nums;font-size:12.5px;font-weight:600;line-height:18px}.VWh0dG_siteRowCalls{color:var(--ds-t-2);font-variant-numeric:tabular-nums;font-size:11.5px;line-height:17px}.VWh0dG_siteRowCallsLow{color:var(--ds-red)}.VWh0dG_flatTag{color:var(--ds-t-3);font-size:10.5px;line-height:14px}.VWh0dG_healthDot{border-radius:50%;flex:none;width:6px;height:6px;display:inline-block}.VWh0dG_healthOk{background:var(--ds-green);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-green) 18%, transparent)}.VWh0dG_healthBad{background:var(--ds-red);box-shadow:0 0 0 3px color-mix(in srgb, var(--ds-red) 18%, transparent)}.VWh0dG_healthIdle{background:var(--ds-t-4)}.VWh0dG_dashboardRight{align-items:center;gap:8px;min-width:0;display:flex}.VWh0dG_healthBadge{white-space:nowrap;border-radius:999px;align-items:center;gap:6px;padding:3px 9px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_healthBadgeOk{color:var(--ds-green);background:var(--dsb-2)}.VWh0dG_healthBadgeBad{color:var(--ds-red);background:var(--dsb-2)}.VWh0dG_planTag{color:var(--ds-green);white-space:nowrap;align-items:center;gap:4px;font-size:10px;font-weight:500;line-height:14px;display:inline-flex}.VWh0dG_planTagBadge{background:color-mix(in srgb, var(--ds-green) 20%, transparent);border-radius:4px;padding:0 4px;font-size:9px;line-height:12px}.VWh0dG_uncataloguedTag{border:1px solid color-mix(in srgb, var(--ds-amber) 36%, transparent);vertical-align:1px;color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.VWh0dG_estimatedTag{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);vertical-align:1px;color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:0 6px;font-size:10px;font-weight:600;line-height:16px;display:inline-block}.VWh0dG_feeBar{border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);backdrop-filter:blur(14px)saturate(1.3);color:var(--ds-t-2);font-variant-numeric:tabular-nums;border-radius:999px;flex-wrap:wrap;align-items:center;gap:8px;padding:6px 12px;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_feeBarAbove{order:-1;align-self:center;margin-bottom:8px}.VWh0dG_feeInline{font-variant-numeric:tabular-nums;white-space:nowrap;cursor:default;border-radius:999px;align-self:center;align-items:center;gap:5px;height:22px;padding:0 4px;font-size:11px;line-height:16px;display:inline-flex}.VWh0dG_feeInline .VWh0dG_feeChipPrimary,.VWh0dG_feeInline .VWh0dG_feeChipOff{height:18px;padding:0 7px}.VWh0dG_feeInlineNum{color:var(--ds-t-1);padding-right:6px;font-weight:600}.VWh0dG_feeInlineAlert{background:color-mix(in srgb, var(--ds-amber) 12%, transparent)}.VWh0dG_feeInlineAlert .VWh0dG_feeInlineNum{color:var(--ds-amber)}.VWh0dG_feeInlineError{background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_feeInlineError .VWh0dG_feeInlineNum{color:var(--ds-red)}.VWh0dG_feeBar .VWh0dG_feeSep{color:var(--ds-t-4)}.VWh0dG_feeCount{color:var(--ds-t-1);font-weight:600}.VWh0dG_feeSuffix{color:var(--ds-t-3)}.VWh0dG_feeItem{color:var(--ds-t-2);white-space:nowrap}.VWh0dG_feeNum{color:var(--ds-t-1);font-weight:600}.VWh0dG_feeSep{color:var(--ds-t-4)}.VWh0dG_feeChipPrimary,.VWh0dG_feeChipOff,.VWh0dG_feeChipAlert,.VWh0dG_feeChipError{border:1px solid var(--ds-border);background:var(--dsb-3);font-variant-numeric:tabular-nums;white-space:nowrap;border-radius:999px;align-items:center;height:20px;padding:0 8px;font-size:10px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_feeChipPrimary{color:var(--ds-blue);border-color:color-mix(in srgb, var(--ds-blue) 30%, transparent)}.VWh0dG_feeChipOff{color:var(--ds-cyan);border-color:color-mix(in srgb, var(--ds-cyan) 30%, transparent)}.VWh0dG_feeChipAlert{color:var(--ds-amber);border-color:color-mix(in srgb, var(--ds-amber) 30%, transparent)}.VWh0dG_feeChipError{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 30%, transparent)}.VWh0dG_balanceCell{align-items:center;gap:6px;display:inline-flex;position:relative}.VWh0dG_providerGroupRecharge{border:1px solid color-mix(in srgb, var(--ds-c-1) 38%, transparent);background:color-mix(in srgb, var(--ds-c-1) 8%, transparent);color:var(--ds-c-1);white-space:nowrap;border-radius:999px;justify-content:center;align-items:center;min-width:48px;padding:1px 8px;font-size:10.5px;font-weight:600;line-height:16px;text-decoration:none;display:inline-flex}.VWh0dG_providerGroupRecharge:empty{background:0 0;border-color:#0000}.VWh0dG_providerGroupRecharge:hover{background:color-mix(in srgb, var(--ds-c-1) 15%, transparent);border-color:color-mix(in srgb, var(--ds-c-1) 60%, transparent)}.VWh0dG_balanceDaysBadge{border:1px solid var(--ds-border-strong);background:var(--dsb-2);min-width:16px;height:16px;color:var(--ds-t-2);cursor:pointer;border-radius:8px;justify-content:center;align-items:center;padding:0 4px;font-size:10px;font-weight:600;line-height:1;display:inline-flex}.VWh0dG_balanceDaysBadge:hover{border-color:var(--ds-t-3);color:var(--ds-t-1)}.VWh0dG_balanceDaysBadgeLow{color:var(--ds-red);border-color:color-mix(in srgb, var(--ds-red) 36%, transparent);background:color-mix(in srgb, var(--ds-red) 12%, transparent)}.VWh0dG_balanceDetailPop{z-index:20;background:var(--dsb-2);border:1px solid var(--ds-border-strong);min-width:180px;box-shadow:var(--ds-shadow-1);white-space:nowrap;border-radius:8px;flex-direction:column;gap:6px;padding:8px 10px;display:inline-flex;position:absolute;top:calc(100% + 6px);right:0}.VWh0dG_balanceDetailHead{justify-content:space-between;align-items:center;gap:12px;display:flex}.VWh0dG_balanceDetailTitle{color:var(--ds-t-1);font-size:12px;font-weight:600}.VWh0dG_balanceDetailClose{cursor:pointer;color:var(--ds-t-3);background:0 0;border:none;font-size:14px;line-height:1}.VWh0dG_balanceDetailClose:hover{color:var(--ds-t-1)}.VWh0dG_balanceDetailGrid{flex-direction:column;gap:4px;display:inline-flex}.VWh0dG_balanceDetailRow{color:var(--ds-t-2);font-variant-numeric:tabular-nums;justify-content:space-between;gap:16px;font-size:11px;line-height:15px;display:flex}.VWh0dG_balanceDetailLabel{color:var(--ds-t-3)}.VWh0dG_balanceDetailValue{color:var(--ds-t-1);font-weight:500}.VWh0dG_currencyToggle{background:var(--dsw-alias-bg-layer-3);border:none;border-radius:8px;align-items:center;gap:2px;margin-right:8px;padding:2px;display:inline-flex}.VWh0dG_currencyButton{color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:4px 8px;font-size:11px;font-weight:700;line-height:1}.VWh0dG_currencyButtonActive{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}.VWh0dG_subscriptionGrid{grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:10px;display:grid}.VWh0dG_subscriptionCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);-webkit-backdrop-filter:blur(12px)saturate(1.3);transition:border-color var(--ds-t-fast);padding:14px 16px;position:relative;overflow:hidden}.VWh0dG_subscriptionHead{flex-wrap:wrap;align-items:baseline;gap:6px;margin-bottom:8px;display:flex}.VWh0dG_subscriptionName{color:var(--ds-t-1);font-size:13px;font-weight:600}.VWh0dG_subscriptionPlan{color:var(--ds-t-2);font-size:11px}.VWh0dG_subscriptionPlan[data-kind=code],.VWh0dG_subscriptionPlan[data-kind=token]{color:var(--ds-t-2);background:var(--dsb-3);border-radius:999px;padding:1px 8px;font-weight:500}.VWh0dG_subscriptionTier{color:var(--ds-t-3);margin-left:6px}.VWh0dG_subscriptionAuto{border:1px solid color-mix(in srgb, var(--ds-blue) 36%, transparent);color:var(--ds-blue);background:color-mix(in srgb, var(--ds-blue) 12%, transparent);border-radius:999px;margin-left:6px;padding:1px 6px;font-size:10px}.VWh0dG_subscriptionStatus{color:var(--ds-t-2);margin-bottom:6px;font-size:11px}.VWh0dG_subscriptionWindow{align-items:center;gap:10px;margin-top:8px;font-size:11px;display:flex}.VWh0dG_subscriptionWindowLabel{color:var(--ds-t-3);flex:0 0 44px}.VWh0dG_subscriptionTrack{background:var(--dsb-3);height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.VWh0dG_subscriptionFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px;display:block}.VWh0dG_subscriptionFillWarn{background:var(--ds-amber)}.VWh0dG_subscriptionFillOver{background:var(--ds-red)}.VWh0dG_subscriptionMeta{flex-direction:column;flex:none;align-items:flex-end;gap:2px;display:flex}.VWh0dG_subscriptionPct{text-align:right;min-width:52px;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1);flex:none}.VWh0dG_subscriptionExhausted{color:var(--ds-red);min-width:52px;font-weight:600}.VWh0dG_subscriptionReset{color:var(--ds-t-3);white-space:nowrap;flex:none;font-size:10px}.VWh0dG_providerGroupList{flex-direction:column;gap:10px;display:flex}.VWh0dG_providerGroup{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);padding:12px 14px}.VWh0dG_providerGroupHead{justify-content:space-between;align-items:baseline;gap:12px;margin-bottom:10px;display:flex}.VWh0dG_providerGroupTitle{align-items:center;gap:7px;min-width:0;display:inline-flex}.VWh0dG_kindBadge{border:1px solid color-mix(in srgb, var(--ds-c-1) 32%, transparent);background:color-mix(in srgb, var(--ds-c-1) 10%, transparent);color:var(--ds-c-1);border-radius:4px;flex:none;padding:1px 6px;font-size:10px;font-weight:600;line-height:15px}.VWh0dG_kindBadgeRelay{border-color:color-mix(in srgb, var(--ds-c-2) 32%, transparent);background:color-mix(in srgb, var(--ds-c-2) 10%, transparent);color:var(--ds-c-2)}.VWh0dG_kindBadgeUnknown{border-color:var(--ds-border);background:color-mix(in srgb, var(--ds-t-3) 12%, transparent);color:var(--ds-t-3)}.VWh0dG_providerGroupName{color:var(--ds-t-1);font-size:13px;font-weight:600;line-height:18px}.VWh0dG_providerGroupMeta{flex:none;align-items:center;gap:10px;display:inline-flex}.VWh0dG_providerGroupBadge{border:1px solid color-mix(in srgb, var(--ds-green) 36%, transparent);color:var(--ds-green);background:color-mix(in srgb, var(--ds-green) 12%, transparent);border-radius:999px;justify-content:center;align-items:center;padding:1px 8px;font-size:10px;font-weight:500;line-height:16px;display:inline-flex}.VWh0dG_providerGroupBalance,.VWh0dG_providerGroupCost{color:var(--ds-t-2);font-variant-numeric:tabular-nums;white-space:nowrap;justify-content:flex-end;align-items:baseline;gap:6px;min-width:118px;font-size:12px;line-height:17px;display:inline-flex}.VWh0dG_providerGroupCostLabel{font-size:11px}.VWh0dG_providerGroupCostValue{color:var(--ds-t-1);text-align:right;min-width:56px;font-weight:600}.VWh0dG_providerGroupBalanceLabel{color:var(--ds-t-3);font-size:11px;line-height:17px}.VWh0dG_rounds{margin-top:10px}.VWh0dG_roundsBars{align-items:flex-end;gap:3px;height:124px;padding:16px 2px 0;display:flex;overflow-x:auto}.VWh0dG_roundsBarCol{border-radius:5px 5px 0 0;flex-direction:column;flex:1 0 28px;justify-content:flex-end;align-items:stretch;height:100%;display:flex;position:relative}.VWh0dG_roundsBarColPeak{background:color-mix(in srgb, var(--ds-amber) 16%, transparent)}.VWh0dG_roundsBarColOff{background:var(--dsb-3)}.VWh0dG_roundsBarLabel{text-align:center;color:var(--ds-t-2);white-space:nowrap;text-overflow:ellipsis;max-width:100%;font-size:9px;line-height:1.2;position:absolute;bottom:0;left:0;right:0;overflow:hidden;transform:translateY(-100%)}.VWh0dG_roundsBarWrap{flex:1;align-items:flex-end;min-height:0;display:flex}.VWh0dG_roundsBar{background:var(--ds-blue);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.VWh0dG_roundsBarFlagged{background:var(--ds-red);border-radius:2px 2px 0 0;width:100%;min-height:2px;position:relative}.VWh0dG_roundsFlagMark{background:var(--ds-red);border-radius:50%;width:7px;height:7px;position:absolute;top:-3px;right:-3px}.VWh0dG_roundsAxis{color:var(--ds-t-3);justify-content:space-between;margin-top:6px;font-size:10px;display:flex}.VWh0dG_roundsEmpty{color:var(--ds-t-2);margin-top:10px;font-size:12px}.VWh0dG_heatmap{margin-top:10px}.VWh0dG_heatmapGrid{grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;display:grid}.VWh0dG_heatmapCellEmpty{box-sizing:border-box;border:1px dashed var(--ds-border);height:30px;color:var(--ds-t-4);font-variant-numeric:tabular-nums;background:0 0;border-radius:2px;justify-content:center;align-items:center;font-size:11px;display:flex}.VWh0dG_heatmapCell{font-variant-numeric:tabular-nums;cursor:pointer;border:0;border-radius:2px;justify-content:center;align-items:center;height:30px;padding:0;font-size:11px;display:flex}.VWh0dG_heatmapCell[data-level="0"],.VWh0dG_heatmapCell[data-level="1"],.VWh0dG_heatmapCell[data-level="2"]{color:var(--dsw-alias-label-primary)}.VWh0dG_heatmapCell[data-level="3"],.VWh0dG_heatmapCell[data-level="4"]{color:var(--dsw-static-neutral-bluish-00)}.VWh0dG_heatmapFooter{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin-top:10px;font-size:10px;display:flex}.VWh0dG_heatmapLegend{gap:3px;display:inline-flex}.VWh0dG_heatmapLegend i{border-radius:2px;width:14px;height:14px;display:block}.VWh0dG_heatmapHover{font-variant-numeric:tabular-nums;margin-left:auto;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace}.VWh0dG_heatmapRangeSwitch{gap:4px;margin-left:auto;display:inline-flex}.VWh0dG_heatmapRangeButton{border:1px solid var(--ds-border);color:var(--ds-t-2);cursor:pointer;background:0 0;border-radius:6px;padding:2px 8px;font-size:11px;line-height:1.4}.VWh0dG_heatmapRangeButtonActive{border-color:var(--ds-border-strong);color:var(--ds-t-1);font-weight:600}.VWh0dG_heatmapYear{flex-direction:column;gap:6px;display:flex}.VWh0dG_heatmapYearBody{align-items:flex-start;gap:6px;display:flex}.VWh0dG_heatmapYearWeekdays{color:var(--ds-t-3);flex:none;grid-template-rows:repeat(7,11px);gap:3px;padding-top:12px;font-size:9px;line-height:11px;display:grid}.VWh0dG_heatmapYearWeekday{white-space:nowrap;text-align:right;height:11px}.VWh0dG_heatmapYearMonths{min-width:max-content;color:var(--ds-t-3);grid-template-columns:repeat(52,11px);gap:3px;font-size:9px;line-height:12px;display:grid;overflow:visible}.VWh0dG_heatmapYearMonth{white-space:nowrap;overflow:visible}.VWh0dG_heatmapYearScroll{padding-bottom:2px;overflow-x:auto}.VWh0dG_heatmapYearGrid{grid-template-rows:repeat(7,11px);grid-auto-flow:column;gap:3px;min-width:max-content;display:grid}.VWh0dG_heatmapYearCell{cursor:pointer;border:0;border-radius:2px;width:11px;height:11px;padding:0}.VWh0dG_floatSub{flex-direction:column;gap:6px;min-width:0;display:flex}.VWh0dG_floatSubHead{flex-wrap:wrap;align-items:baseline;gap:6px;min-width:0;display:flex}.VWh0dG_floatSubName{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:700}.VWh0dG_floatSubPlan{color:var(--dsw-alias-label-secondary);font-size:10px}.VWh0dG_floatSub .VWh0dG_subscriptionWindow{flex-wrap:wrap;gap:4px 10px}.VWh0dG_floatSub .VWh0dG_subscriptionWindowLabel{flex:none}.VWh0dG_floatSub .VWh0dG_subscriptionMeta{min-width:0;max-width:100%}.VWh0dG_floatSub .VWh0dG_subscriptionPct{min-width:0}.VWh0dG_floatSub .VWh0dG_subscriptionReset{white-space:normal;overflow-wrap:anywhere}.VWh0dG_triggerPopEmpty{color:var(--dsw-alias-label-tertiary);padding:2px 0;font-size:11px;line-height:1.5}.VWh0dG_triggerPopSwitcher{justify-content:flex-end;align-items:center;gap:8px;margin-top:2px;display:flex}.VWh0dG_triggerPopSwitchCount{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;font-size:10px}.VWh0dG_floatModeBtn{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;border-radius:10px;flex:1;padding:7px 10px;font-size:12px}.VWh0dG_floatModeBtnOn{border-color:var(--ds-blue);color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--ds-blue) 16%, transparent)}.VWh0dG_rdoRow{justify-content:space-between;align-items:center;gap:8px;margin-top:10px;display:flex}.VWh0dG_rdoLabel{color:var(--dsw-alias-label-secondary);font-size:12px}.VWh0dG_rdoSelect{border:1px solid color-mix(in srgb, var(--dsw-alias-border-l1) 75%, transparent);background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 60%, transparent);color:var(--dsw-alias-label-primary);white-space:nowrap;cursor:pointer;border-radius:10px;align-items:center;gap:5px;padding:5px 8px 5px 10px;font-size:12px;display:inline-flex}.VWh0dG_rdoSelect:hover{background:color-mix(in srgb, var(--dsw-alias-bg-layer-2) 85%, transparent)}.VWh0dG_rdoSelect:focus-visible{border-color:var(--ds-blue);outline:none}.VWh0dG_rdoChevron{color:var(--dsw-alias-label-tertiary);transition:transform .15s;display:inline-flex}.VWh0dG_rdoChevronOpen{transform:rotate(180deg)}.VWh0dG_floatTarget{color:var(--dsw-alias-label-secondary);cursor:pointer;align-items:center;gap:5px;font-size:12px;display:inline-flex}.VWh0dG_floatTargetLabel{color:var(--dsw-alias-label-secondary)}.VWh0dG_staleNotice{color:var(--ds-amber);background:color-mix(in srgb, var(--ds-amber) 12%, transparent);border:1px solid color-mix(in srgb, var(--ds-amber) 30%, transparent);border-radius:10px;align-items:center;gap:6px;margin:0 0 10px;padding:8px 10px;font-size:11px;display:flex}.VWh0dG_plgHead{align-items:flex-start;gap:12px;display:flex}.VWh0dG_plgIcon{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);width:40px;height:40px;color:var(--dsw-alias-label-secondary);border-radius:10px;flex:none;justify-content:center;align-items:center;display:inline-flex}.VWh0dG_plgTitle{flex-direction:column;gap:4px;min-width:0;display:flex}.VWh0dG_plgNameRow{align-items:center;gap:8px;display:flex}.VWh0dG_plgName{color:var(--dsw-alias-label-primary);margin:0;font-size:13px;font-weight:600;line-height:18px}.VWh0dG_plgTag{height:18px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3);white-space:nowrap;border-radius:5px;align-items:center;padding:0 6px;font-size:10px;font-weight:600;display:inline-flex}.VWh0dG_plgDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:11px;line-height:16px}.VWh0dG_plgGrid{border-top:1px solid var(--dsw-alias-border-l1);grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding-top:12px;display:grid}.VWh0dG_plgItem{flex-direction:column;gap:2px;min-width:0;display:flex}.VWh0dG_plgLabel{color:var(--dsw-alias-label-tertiary);font-size:10px;line-height:14px}.VWh0dG_plgVal{color:var(--dsw-alias-label-primary);word-break:break-all;font-size:12px;line-height:17px}.VWh0dG_plgLink{color:var(--ds-blue);word-break:break-all;font-size:12px;line-height:17px;text-decoration:none}.VWh0dG_plgLink:hover{text-decoration:underline}.VWh0dG_tokenPanel{flex-direction:column;gap:14px;display:flex}.VWh0dG_tokenModelBar{background:var(--dsw-alias-bg-layer-2);border-radius:999px;height:8px;overflow:hidden}.VWh0dG_tokenModelParts{height:100%;display:flex}.VWh0dG_tokenModelPartIn{background:var(--ds-blue)}.VWh0dG_tokenModelPartOut{background:var(--ds-amber)}.VWh0dG_tokenModelShareRow{align-items:center;gap:6px;display:inline-flex}@media (width<=640px){.VWh0dG_kpiGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.VWh0dG_hero{gap:14px}.VWh0dG_heroTop{flex-direction:column;align-items:flex-start;gap:12px}.VWh0dG_heroGauge{width:72px;height:72px}.VWh0dG_heroSide{gap:12px}.VWh0dG_heroSideSpacer{display:none}}.VWh0dG_peakCard{z-index:2000;border-radius:var(--ds-r-2);border:1px solid var(--ds-border-strong);background:var(--dsb-glass-strong);-webkit-backdrop-filter:blur(14px)saturate(1.2);min-width:280px;max-width:380px;box-shadow:var(--ds-shadow-2);animation:VWh0dG_peakAlertIn var(--ds-t-fast);flex-direction:column;gap:12px;padding:14px 16px;display:flex;position:fixed}.VWh0dG_peakCardCorner{bottom:18px;right:18px}.VWh0dG_peakCardCenter{top:20%;left:50%;transform:translate(-50%)}.VWh0dG_peakCardPeak{color:var(--ds-blue)}.VWh0dG_peakCardOff{color:var(--ds-cyan)}.VWh0dG_peakHead{justify-content:space-between;align-items:center;gap:8px;display:flex}.VWh0dG_peakTag{white-space:nowrap;border-radius:6px;align-items:center;gap:6px;height:20px;padding:0 8px;font-size:11px;font-weight:600;line-height:14px;display:inline-flex}.VWh0dG_peakTagPrimary{background:var(--dsw-alias-bg-layer-3);color:var(--ds-blue)}.VWh0dG_peakTagSuccess{background:var(--dsw-alias-bg-layer-3);color:var(--ds-cyan)}.VWh0dG_peakDot{border-radius:999px;flex:none;width:6px;height:6px}.VWh0dG_peakDotPrimary{background:var(--ds-blue)}.VWh0dG_peakDotSuccess{background:var(--ds-cyan)}.VWh0dG_peakClose{width:24px;height:24px;color:var(--ds-t-3);cursor:pointer;transition:background-color var(--ds-t-fast), color var(--ds-t-fast);background:0 0;border:0;border-radius:6px;justify-content:center;align-items:center;font-size:15px;line-height:1;display:inline-flex}.VWh0dG_peakClose:hover{color:var(--ds-t-1);background:var(--dsw-alias-bg-layer-2)}.VWh0dG_peakCount{font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,ui-monospace,monospace;font-size:28px;font-weight:600;line-height:1}.VWh0dG_peakCountPrimary{color:var(--ds-blue)}.VWh0dG_peakCountSuccess{color:var(--ds-cyan)}.VWh0dG_peakDesc{color:var(--ds-t-1);margin:4px 0 0;font-size:12px;line-height:18px}@keyframes VWh0dG_peakAlertIn{0%{opacity:0}to{opacity:1}}.VWh0dG_setCard{border:1px solid var(--ds-border);border-radius:var(--ds-r-2);background:var(--dsb-glass);flex-direction:column;gap:12px;padding:16px 18px;display:flex}.VWh0dG_setGrid3,.VWh0dG_setGrid2{gap:10px;display:grid}.VWh0dG_setGrid3{grid-template-columns:repeat(3,minmax(0,1fr))}.VWh0dG_setGrid2{grid-template-columns:repeat(2,minmax(0,1fr))}@media (width<=720px){.VWh0dG_setGrid3,.VWh0dG_setGrid2{grid-template-columns:1fr}}.VWh0dG_setCell{border:1px solid var(--ds-border);border-radius:var(--ds-r-1);flex-direction:column;gap:8px;min-width:0;padding:12px 14px;display:flex}.VWh0dG_setCardHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}.VWh0dG_setCardMeta{flex-direction:column;gap:4px;min-width:0;display:flex}.VWh0dG_setCardTitle{color:var(--ds-t-1);margin:0;font-size:13px;font-weight:600;line-height:18px}.VWh0dG_setCardDesc{color:var(--ds-t-3);margin:0;font-size:11px;line-height:16px}.VWh0dG_ctlCol{flex-direction:column;gap:10px;padding-top:2px;display:flex}.VWh0dG_ctlRow{align-items:center;gap:12px;min-height:28px;display:flex}.VWh0dG_ctlRowStretch{display:flex}.VWh0dG_ctlLabel{color:var(--ds-t-3);flex:0 0 96px;font-size:11px;line-height:16px}.VWh0dG_ctlGroup{flex-wrap:wrap;align-items:center;gap:8px;display:inline-flex}.VWh0dG_userPriceRow{border-bottom:1px solid var(--ds-border);align-items:center;gap:10px;padding:8px 0;display:flex}.VWh0dG_userPriceCheck{width:14px;height:14px;accent-color:var(--ds-blue);flex:none;margin:0}.VWh0dG_userPriceBody{flex-direction:column;flex:1;gap:8px;min-width:0;display:flex}.VWh0dG_userPriceLineMeta{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) auto;align-items:end;gap:8px 10px;display:grid}@media (width<=720px){.VWh0dG_userPriceLineMeta{grid-template-columns:repeat(2,minmax(0,1fr))}}.VWh0dG_userPriceLineMeta .VWh0dG_userPriceInput{box-sizing:border-box;width:100%;min-width:0;max-width:none}.VWh0dG_userPriceBody .VWh0dG_ctlGroup{flex-wrap:nowrap}.VWh0dG_userPriceLineMeta .VWh0dG_userPriceField .VWh0dG_ctlLabel{align-items:flex-end;min-height:30px;display:flex}.VWh0dG_userPricePriceLine{border-left:2px solid var(--ds-amber);flex-wrap:wrap;align-items:center;gap:10px;width:calc(100% - 22px);margin-left:10px;padding:2px 0 6px 12px;display:flex}.VWh0dG_userPricePriceLine>.VWh0dG_ctlLabel{color:var(--ds-t-3);flex:0 0 44px;font-size:11px}.VWh0dG_userPricePriceLine .VWh0dG_userPriceInputNum{box-sizing:border-box;flex:1 1 0;width:auto;min-width:120px;max-width:240px}.VWh0dG_userPriceField{flex-direction:column;gap:4px;min-width:0;display:flex}.VWh0dG_userPriceField .VWh0dG_ctlLabel{flex:none;font-size:11px}.VWh0dG_userPriceInput,.VWh0dG_userPriceInputNum{border:1px solid var(--ds-border);background:var(--dsb-3);min-width:96px;max-width:160px;color:var(--ds-t-1);border-radius:6px;padding:4px 8px;font-size:12px;line-height:16px}.VWh0dG_userPriceInputNum{min-width:72px;max-width:88px}.VWh0dG_rdo{color:var(--ds-t-2);cursor:pointer;white-space:nowrap;align-items:center;gap:6px;font-size:12px;line-height:16px;display:inline-flex}.VWh0dG_rdo input{opacity:0;pointer-events:none;position:absolute}.VWh0dG_rdoDot{border:1px solid var(--ds-border-strong);background:var(--dsb-3);border-radius:50%;flex:none;width:14px;height:14px;position:relative}.VWh0dG_rdo input:checked+.VWh0dG_rdoDot{border-color:var(--ds-blue)}.VWh0dG_rdo input:checked+.VWh0dG_rdoDot:after{content:"";background:var(--ds-blue);border-radius:50%;position:absolute;inset:3px}.VWh0dG_inp{border:1px solid var(--ds-border);background:var(--dsb-3);border-radius:6px;align-items:center;gap:4px;padding:2px 6px;display:inline-flex}.VWh0dG_affix{color:var(--ds-t-3);font-size:11px;line-height:16px}.VWh0dG_prog{background:var(--dsb-3);min-width:0;height:6px;box-shadow:inset 0 0 0 1px var(--ds-border);border-radius:3px;flex:1;overflow:hidden}.VWh0dG_progFill{background:var(--ds-blue);height:calc(100% - 2px);transition:width var(--ds-t-fast);border-radius:2px;margin:1px}.VWh0dG_btn{border:1px solid var(--ds-border);height:28px;color:var(--ds-t-2);cursor:pointer;transition:border-color var(--ds-t-fast), color var(--ds-t-fast), background-color var(--ds-t-fast);background:0 0;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;line-height:16px;display:inline-flex}.VWh0dG_btn:hover{border-color:var(--ds-blue);color:var(--ds-t-1);background:color-mix(in srgb, var(--ds-blue) 12%, transparent)}.VWh0dG_modelTable tbody td:not(:first-child) tbody td:not(:first-child){text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ds-t-1)}`,document.head.appendChild(e)}var P={affix:`VWh0dG_affix`,balanceCell:`VWh0dG_balanceCell`,balanceDaysBadge:`VWh0dG_balanceDaysBadge`,balanceDaysBadgeLow:`VWh0dG_balanceDaysBadgeLow`,balanceDetailClose:`VWh0dG_balanceDetailClose`,balanceDetailGrid:`VWh0dG_balanceDetailGrid`,balanceDetailHead:`VWh0dG_balanceDetailHead`,balanceDetailLabel:`VWh0dG_balanceDetailLabel`,balanceDetailPop:`VWh0dG_balanceDetailPop`,balanceDetailRow:`VWh0dG_balanceDetailRow`,balanceDetailTitle:`VWh0dG_balanceDetailTitle`,balanceDetailValue:`VWh0dG_balanceDetailValue`,"billing-trigger":`VWh0dG_billing-trigger`,btn:`VWh0dG_btn`,bucketCost:`VWh0dG_bucketCost`,bucketOfficial:`VWh0dG_bucketOfficial`,bucketSep:`VWh0dG_bucketSep`,bucketThird:`VWh0dG_bucketThird`,budgetFillOver:`VWh0dG_budgetFillOver`,budgetFillWarn:`VWh0dG_budgetFillWarn`,budgetInput:`VWh0dG_budgetInput`,budgetPulse:`VWh0dG_budgetPulse`,chartAxisLabel:`VWh0dG_chartAxisLabel`,chartBar:`VWh0dG_chartBar`,chartBarPlaceholder:`VWh0dG_chartBarPlaceholder`,chartCrosshair:`VWh0dG_chartCrosshair`,chartEmpty:`VWh0dG_chartEmpty`,chartGrid:`VWh0dG_chartGrid`,chartHoverDot:`VWh0dG_chartHoverDot`,chartLegend:`VWh0dG_chartLegend`,chartLegendBar:`VWh0dG_chartLegendBar`,chartLegendItem:`VWh0dG_chartLegendItem`,chartLegendItemActive:`VWh0dG_chartLegendItemActive`,chartLegendLine:`VWh0dG_chartLegendLine`,chartLine:`VWh0dG_chartLine`,chartStack:`VWh0dG_chartStack`,chartSvg:`VWh0dG_chartSvg`,chartTooltip:`VWh0dG_chartTooltip`,chartTooltipAlignLeft:`VWh0dG_chartTooltipAlignLeft`,chartTooltipAlignRight:`VWh0dG_chartTooltipAlignRight`,chartTooltipDate:`VWh0dG_chartTooltipDate`,chartTooltipHead:`VWh0dG_chartTooltipHead`,chartTooltipLabel:`VWh0dG_chartTooltipLabel`,chartTooltipModelDetail:`VWh0dG_chartTooltipModelDetail`,chartTooltipRow:`VWh0dG_chartTooltipRow`,chartTooltipSplit:`VWh0dG_chartTooltipSplit`,chartTooltipSwatch:`VWh0dG_chartTooltipSwatch`,chartWrap:`VWh0dG_chartWrap`,closeButton:`VWh0dG_closeButton`,ctlCol:`VWh0dG_ctlCol`,ctlGroup:`VWh0dG_ctlGroup`,ctlLabel:`VWh0dG_ctlLabel`,ctlRow:`VWh0dG_ctlRow`,ctlRowStretch:`VWh0dG_ctlRowStretch`,currencyButton:`VWh0dG_currencyButton`,currencyButtonActive:`VWh0dG_currencyButtonActive`,currencyToggle:`VWh0dG_currencyToggle`,dashboard:`VWh0dG_dashboard`,dashboardBody:`VWh0dG_dashboardBody`,dashboardHead:`VWh0dG_dashboardHead`,dashboardIn:`VWh0dG_dashboardIn`,dashboardModal:`VWh0dG_dashboardModal`,dashboardRight:`VWh0dG_dashboardRight`,dashboardSubtitle:`VWh0dG_dashboardSubtitle`,dashboardTitle:`VWh0dG_dashboardTitle`,delta:`VWh0dG_delta`,deltaDown:`VWh0dG_deltaDown`,deltaUp:`VWh0dG_deltaUp`,emptyRow:`VWh0dG_emptyRow`,estimatedTag:`VWh0dG_estimatedTag`,exportBar:`VWh0dG_exportBar`,exportButton:`VWh0dG_exportButton`,exportLabel:`VWh0dG_exportLabel`,feeBar:`VWh0dG_feeBar`,feeBarAbove:`VWh0dG_feeBarAbove`,feeChipAlert:`VWh0dG_feeChipAlert`,feeChipError:`VWh0dG_feeChipError`,feeChipOff:`VWh0dG_feeChipOff`,feeChipPrimary:`VWh0dG_feeChipPrimary`,feeCount:`VWh0dG_feeCount`,feeInline:`VWh0dG_feeInline`,feeInlineAlert:`VWh0dG_feeInlineAlert`,feeInlineError:`VWh0dG_feeInlineError`,feeInlineNum:`VWh0dG_feeInlineNum`,feeItem:`VWh0dG_feeItem`,feeNum:`VWh0dG_feeNum`,feeSep:`VWh0dG_feeSep`,feeSuffix:`VWh0dG_feeSuffix`,flatTag:`VWh0dG_flatTag`,floatModeBtn:`VWh0dG_floatModeBtn`,floatModeBtnOn:`VWh0dG_floatModeBtnOn`,floatSub:`VWh0dG_floatSub`,floatSubHead:`VWh0dG_floatSubHead`,floatSubName:`VWh0dG_floatSubName`,floatSubPlan:`VWh0dG_floatSubPlan`,floatTarget:`VWh0dG_floatTarget`,floatTargetLabel:`VWh0dG_floatTargetLabel`,healthBad:`VWh0dG_healthBad`,healthBadge:`VWh0dG_healthBadge`,healthBadgeBad:`VWh0dG_healthBadgeBad`,healthBadgeOk:`VWh0dG_healthBadgeOk`,healthDot:`VWh0dG_healthDot`,healthIdle:`VWh0dG_healthIdle`,healthOk:`VWh0dG_healthOk`,heatmap:`VWh0dG_heatmap`,heatmapCell:`VWh0dG_heatmapCell`,heatmapCellEmpty:`VWh0dG_heatmapCellEmpty`,heatmapFooter:`VWh0dG_heatmapFooter`,heatmapGrid:`VWh0dG_heatmapGrid`,heatmapHover:`VWh0dG_heatmapHover`,heatmapLegend:`VWh0dG_heatmapLegend`,heatmapRangeButton:`VWh0dG_heatmapRangeButton`,heatmapRangeButtonActive:`VWh0dG_heatmapRangeButtonActive`,heatmapRangeSwitch:`VWh0dG_heatmapRangeSwitch`,heatmapYear:`VWh0dG_heatmapYear`,heatmapYearBody:`VWh0dG_heatmapYearBody`,heatmapYearCell:`VWh0dG_heatmapYearCell`,heatmapYearGrid:`VWh0dG_heatmapYearGrid`,heatmapYearMonth:`VWh0dG_heatmapYearMonth`,heatmapYearMonths:`VWh0dG_heatmapYearMonths`,heatmapYearScroll:`VWh0dG_heatmapYearScroll`,heatmapYearWeekday:`VWh0dG_heatmapYearWeekday`,heatmapYearWeekdays:`VWh0dG_heatmapYearWeekdays`,hero:`VWh0dG_hero`,heroCurrency:`VWh0dG_heroCurrency`,heroGauge:`VWh0dG_heroGauge`,heroGaugeArc:`VWh0dG_heroGaugeArc`,heroGaugeArcOver:`VWh0dG_heroGaugeArcOver`,heroGaugeCenter:`VWh0dG_heroGaugeCenter`,heroGaugeDial:`VWh0dG_heroGaugeDial`,heroGaugeLabel:`VWh0dG_heroGaugeLabel`,heroGaugeRemain:`VWh0dG_heroGaugeRemain`,heroGaugeRemainOver:`VWh0dG_heroGaugeRemainOver`,heroGaugeSub:`VWh0dG_heroGaugeSub`,heroGaugeSvg:`VWh0dG_heroGaugeSvg`,heroGaugeTrack:`VWh0dG_heroGaugeTrack`,heroLabel:`VWh0dG_heroLabel`,heroMain:`VWh0dG_heroMain`,heroMeta:`VWh0dG_heroMeta`,heroReadout:`VWh0dG_heroReadout`,heroSide:`VWh0dG_heroSide`,heroSideItem:`VWh0dG_heroSideItem`,heroSideLabel:`VWh0dG_heroSideLabel`,heroSideSpacer:`VWh0dG_heroSideSpacer`,heroSideValue:`VWh0dG_heroSideValue`,heroTop:`VWh0dG_heroTop`,heroValue:`VWh0dG_heroValue`,inp:`VWh0dG_inp`,kindBadge:`VWh0dG_kindBadge`,kindBadgeRelay:`VWh0dG_kindBadgeRelay`,kindBadgeUnknown:`VWh0dG_kindBadgeUnknown`,kpiDetail:`VWh0dG_kpiDetail`,kpiGreen:`VWh0dG_kpiGreen`,kpiGrid:`VWh0dG_kpiGrid`,kpiLabel:`VWh0dG_kpiLabel`,kpiTile:`VWh0dG_kpiTile`,kpiValue:`VWh0dG_kpiValue`,kpiZone:`VWh0dG_kpiZone`,kpiZoneHead:`VWh0dG_kpiZoneHead`,kpiZoneLabel:`VWh0dG_kpiZoneLabel`,metricCell:`VWh0dG_metricCell`,metricGrid:`VWh0dG_metricGrid`,metricLabel:`VWh0dG_metricLabel`,metricValue:`VWh0dG_metricValue`,metricValueSuccess:`VWh0dG_metricValueSuccess`,modalFooter:`VWh0dG_modalFooter`,modelCell:`VWh0dG_modelCell`,modelDot:`VWh0dG_modelDot`,modelName:`VWh0dG_modelName`,modelProvider:`VWh0dG_modelProvider`,modelRowActive:`VWh0dG_modelRowActive`,modelRowFocusable:`VWh0dG_modelRowFocusable`,modelTable:`VWh0dG_modelTable`,na:`VWh0dG_na`,numCol:`VWh0dG_numCol`,panel:`VWh0dG_panel`,panelHead:`VWh0dG_panelHead`,panelHeadControls:`VWh0dG_panelHeadControls`,panelHint:`VWh0dG_panelHint`,panelTitle:`VWh0dG_panelTitle`,peakAlertIn:`VWh0dG_peakAlertIn`,peakCard:`VWh0dG_peakCard`,peakCardCenter:`VWh0dG_peakCardCenter`,peakCardCorner:`VWh0dG_peakCardCorner`,peakCardOff:`VWh0dG_peakCardOff`,peakCardPeak:`VWh0dG_peakCardPeak`,peakClose:`VWh0dG_peakClose`,peakCount:`VWh0dG_peakCount`,peakCountPrimary:`VWh0dG_peakCountPrimary`,peakCountSuccess:`VWh0dG_peakCountSuccess`,peakDesc:`VWh0dG_peakDesc`,peakDot:`VWh0dG_peakDot`,peakDotPrimary:`VWh0dG_peakDotPrimary`,peakDotSuccess:`VWh0dG_peakDotSuccess`,peakHead:`VWh0dG_peakHead`,peakTag:`VWh0dG_peakTag`,peakTagPrimary:`VWh0dG_peakTagPrimary`,peakTagSuccess:`VWh0dG_peakTagSuccess`,perfBar:`VWh0dG_perfBar`,perfChip:`VWh0dG_perfChip`,perfChipDot:`VWh0dG_perfChipDot`,perfChipOff:`VWh0dG_perfChipOff`,perfChips:`VWh0dG_perfChips`,planTag:`VWh0dG_planTag`,planTagBadge:`VWh0dG_planTagBadge`,plgDesc:`VWh0dG_plgDesc`,plgGrid:`VWh0dG_plgGrid`,plgHead:`VWh0dG_plgHead`,plgIcon:`VWh0dG_plgIcon`,plgItem:`VWh0dG_plgItem`,plgLabel:`VWh0dG_plgLabel`,plgLink:`VWh0dG_plgLink`,plgName:`VWh0dG_plgName`,plgNameRow:`VWh0dG_plgNameRow`,plgTag:`VWh0dG_plgTag`,plgTitle:`VWh0dG_plgTitle`,plgVal:`VWh0dG_plgVal`,popDot:`VWh0dG_popDot`,popDotDirect:`VWh0dG_popDotDirect`,popDotNeutral:`VWh0dG_popDotNeutral`,popDotSub:`VWh0dG_popDotSub`,popHead:`VWh0dG_popHead`,popModel:`VWh0dG_popModel`,popModelLabel:`VWh0dG_popModelLabel`,popModelName:`VWh0dG_popModelName`,popModelRow:`VWh0dG_popModelRow`,popModelStatus:`VWh0dG_popModelStatus`,popModelStatusLow:`VWh0dG_popModelStatusLow`,popTagPrimary:`VWh0dG_popTagPrimary`,popTagSub:`VWh0dG_popTagSub`,popTitle:`VWh0dG_popTitle`,prog:`VWh0dG_prog`,progFill:`VWh0dG_progFill`,providerGroup:`VWh0dG_providerGroup`,providerGroupBadge:`VWh0dG_providerGroupBadge`,providerGroupBalance:`VWh0dG_providerGroupBalance`,providerGroupBalanceLabel:`VWh0dG_providerGroupBalanceLabel`,providerGroupCost:`VWh0dG_providerGroupCost`,providerGroupCostLabel:`VWh0dG_providerGroupCostLabel`,providerGroupCostValue:`VWh0dG_providerGroupCostValue`,providerGroupHead:`VWh0dG_providerGroupHead`,providerGroupList:`VWh0dG_providerGroupList`,providerGroupMeta:`VWh0dG_providerGroupMeta`,providerGroupName:`VWh0dG_providerGroupName`,providerGroupRecharge:`VWh0dG_providerGroupRecharge`,providerGroupTitle:`VWh0dG_providerGroupTitle`,railButton:`VWh0dG_railButton`,rangeButton:`VWh0dG_rangeButton`,rangeButtonActive:`VWh0dG_rangeButtonActive`,rangeToggle:`VWh0dG_rangeToggle`,rdo:`VWh0dG_rdo`,rdoChevron:`VWh0dG_rdoChevron`,rdoChevronOpen:`VWh0dG_rdoChevronOpen`,rdoDot:`VWh0dG_rdoDot`,rdoLabel:`VWh0dG_rdoLabel`,rdoRow:`VWh0dG_rdoRow`,rdoSelect:`VWh0dG_rdoSelect`,reconcileDismiss:`VWh0dG_reconcileDismiss`,reconcileIcon:`VWh0dG_reconcileIcon`,reconcileNotice:`VWh0dG_reconcileNotice`,reconcileText:`VWh0dG_reconcileText`,rounds:`VWh0dG_rounds`,roundsAxis:`VWh0dG_roundsAxis`,roundsBar:`VWh0dG_roundsBar`,roundsBarCol:`VWh0dG_roundsBarCol`,roundsBarColOff:`VWh0dG_roundsBarColOff`,roundsBarColPeak:`VWh0dG_roundsBarColPeak`,roundsBarFlagged:`VWh0dG_roundsBarFlagged`,roundsBarLabel:`VWh0dG_roundsBarLabel`,roundsBarWrap:`VWh0dG_roundsBarWrap`,roundsBars:`VWh0dG_roundsBars`,roundsEmpty:`VWh0dG_roundsEmpty`,roundsFlagMark:`VWh0dG_roundsFlagMark`,sessionChildRow:`VWh0dG_sessionChildRow`,sessionGroupRow:`VWh0dG_sessionGroupRow`,setCard:`VWh0dG_setCard`,setCardDesc:`VWh0dG_setCardDesc`,setCardHead:`VWh0dG_setCardHead`,setCardMeta:`VWh0dG_setCardMeta`,setCardTitle:`VWh0dG_setCardTitle`,setCell:`VWh0dG_setCell`,setGrid2:`VWh0dG_setGrid2`,setGrid3:`VWh0dG_setGrid3`,shareDot:`VWh0dG_shareDot`,shareItem:`VWh0dG_shareItem`,shareLegend:`VWh0dG_shareLegend`,shareSeg:`VWh0dG_shareSeg`,shareSegAssistant:`VWh0dG_shareSegAssistant`,shareSegOff:`VWh0dG_shareSegOff`,shareSegPeak:`VWh0dG_shareSegPeak`,shareSegTool:`VWh0dG_shareSegTool`,shareSegUser:`VWh0dG_shareSegUser`,shareTrack:`VWh0dG_shareTrack`,shareValue:`VWh0dG_shareValue`,siteKindDirect:`VWh0dG_siteKindDirect`,siteKindSite:`VWh0dG_siteKindSite`,siteKindTag:`VWh0dG_siteKindTag`,siteKindUnknown:`VWh0dG_siteKindUnknown`,siteRow:`VWh0dG_siteRow`,siteRowCalls:`VWh0dG_siteRowCalls`,siteRowCallsLow:`VWh0dG_siteRowCallsLow`,siteRowCost:`VWh0dG_siteRowCost`,siteRowMeta:`VWh0dG_siteRowMeta`,siteRowName:`VWh0dG_siteRowName`,siteRowTitle:`VWh0dG_siteRowTitle`,staleNotice:`VWh0dG_staleNotice`,subscriptionAuto:`VWh0dG_subscriptionAuto`,subscriptionCard:`VWh0dG_subscriptionCard`,subscriptionExhausted:`VWh0dG_subscriptionExhausted`,subscriptionFill:`VWh0dG_subscriptionFill`,subscriptionFillOver:`VWh0dG_subscriptionFillOver`,subscriptionFillWarn:`VWh0dG_subscriptionFillWarn`,subscriptionGrid:`VWh0dG_subscriptionGrid`,subscriptionHead:`VWh0dG_subscriptionHead`,subscriptionMeta:`VWh0dG_subscriptionMeta`,subscriptionName:`VWh0dG_subscriptionName`,subscriptionPct:`VWh0dG_subscriptionPct`,subscriptionPlan:`VWh0dG_subscriptionPlan`,subscriptionReset:`VWh0dG_subscriptionReset`,subscriptionStatus:`VWh0dG_subscriptionStatus`,subscriptionTier:`VWh0dG_subscriptionTier`,subscriptionTrack:`VWh0dG_subscriptionTrack`,subscriptionWindow:`VWh0dG_subscriptionWindow`,subscriptionWindowLabel:`VWh0dG_subscriptionWindowLabel`,switch:`VWh0dG_switch`,switchKnob:`VWh0dG_switchKnob`,switchOn:`VWh0dG_switchOn`,tabButton:`VWh0dG_tabButton`,tabButtonActive:`VWh0dG_tabButtonActive`,tabNav:`VWh0dG_tabNav`,tabPanel:`VWh0dG_tabPanel`,tabPanelIn:`VWh0dG_tabPanelIn`,tableScroll:`VWh0dG_tableScroll`,tokenModelBar:`VWh0dG_tokenModelBar`,tokenModelPartIn:`VWh0dG_tokenModelPartIn`,tokenModelPartOut:`VWh0dG_tokenModelPartOut`,tokenModelParts:`VWh0dG_tokenModelParts`,tokenModelShareRow:`VWh0dG_tokenModelShareRow`,tokenPanel:`VWh0dG_tokenPanel`,trigger:`VWh0dG_trigger`,triggerBudgetHot:`VWh0dG_triggerBudgetHot`,triggerBudgetOver:`VWh0dG_triggerBudgetOver`,triggerBudgetPulse:`VWh0dG_triggerBudgetPulse`,triggerGaugeArc:`VWh0dG_triggerGaugeArc`,triggerGaugeNeedle:`VWh0dG_triggerGaugeNeedle`,triggerIcon:`VWh0dG_triggerIcon`,triggerLabel:`VWh0dG_triggerLabel`,triggerMain:`VWh0dG_triggerMain`,triggerMetric:`VWh0dG_triggerMetric`,triggerPop:`VWh0dG_triggerPop`,triggerPopEmpty:`VWh0dG_triggerPopEmpty`,triggerPopShown:`VWh0dG_triggerPopShown`,triggerPopSwitchCount:`VWh0dG_triggerPopSwitchCount`,triggerPopSwitcher:`VWh0dG_triggerPopSwitcher`,triggerPrimary:`VWh0dG_triggerPrimary`,triggerScan:`VWh0dG_triggerScan`,triggerSpark:`VWh0dG_triggerSpark`,triggerSparkBar:`VWh0dG_triggerSparkBar`,triggerSparkBreath:`VWh0dG_triggerSparkBreath`,triggerSparkHot:`VWh0dG_triggerSparkHot`,triggerWrap:`VWh0dG_triggerWrap`,triggerYen:`VWh0dG_triggerYen`,ubAlert:`VWh0dG_ubAlert`,ubAlertLeft:`VWh0dG_ubAlertLeft`,ubAlertNote:`VWh0dG_ubAlertNote`,ubCard:`VWh0dG_ubCard`,ubCardControlGroup:`VWh0dG_ubCardControlGroup`,ubCardHead:`VWh0dG_ubCardHead`,ubCardSub:`VWh0dG_ubCardSub`,ubCardTitle:`VWh0dG_ubCardTitle`,ubChipLabel:`VWh0dG_ubChipLabel`,ubChipOff:`VWh0dG_ubChipOff`,ubChipPeak:`VWh0dG_ubChipPeak`,ubExtraName:`VWh0dG_ubExtraName`,ubExtraNote:`VWh0dG_ubExtraNote`,ubExtraRow:`VWh0dG_ubExtraRow`,ubModel:`VWh0dG_ubModel`,ubModelName:`VWh0dG_ubModelName`,ubNotes:`VWh0dG_ubNotes`,ubNotesDesc:`VWh0dG_ubNotesDesc`,ubNotesItem:`VWh0dG_ubNotesItem`,ubNotesTerm:`VWh0dG_ubNotesTerm`,ubRate:`VWh0dG_ubRate`,ubTable:`VWh0dG_ubTable`,ubTablewrap:`VWh0dG_ubTablewrap`,ubTag:`VWh0dG_ubTag`,ubTagAlert:`VWh0dG_ubTagAlert`,ubTagError:`VWh0dG_ubTagError`,ubTagNeutral:`VWh0dG_ubTagNeutral`,ubTagPromo:`VWh0dG_ubTagPromo`,ubTagSuccess:`VWh0dG_ubTagSuccess`,uncataloguedTag:`VWh0dG_uncataloguedTag`,unpricedHint:`VWh0dG_unpricedHint`,userPriceBody:`VWh0dG_userPriceBody`,userPriceCheck:`VWh0dG_userPriceCheck`,userPriceField:`VWh0dG_userPriceField`,userPriceInput:`VWh0dG_userPriceInput`,userPriceInputNum:`VWh0dG_userPriceInputNum`,userPriceLineMeta:`VWh0dG_userPriceLineMeta`,userPricePriceLine:`VWh0dG_userPricePriceLine`,userPriceRow:`VWh0dG_userPriceRow`,vendorLetter:`VWh0dG_vendorLetter`};let F={"opencode-go":{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},opencode:{type:`code`,subscription:{amount:10,currency:`USD`,period:`month`},tier:{amount:10,currency:`USD`,periodDays:7,label:`周额度 $30`}},"kimi-coding":{type:`code`},"zai-coding-cn":{type:`code`},"zai-coding":{type:`code`},"qwen-token-plan":{type:`code`},"qwen-token-plan-cn":{type:`code`},"xiaomi-token-plan-ams":{type:`code`},"xiaomi-token-plan-cn":{type:`code`},"xiaomi-token-plan-sgp":{type:`code`},"volcengine-token-plan":{type:`code`},"ark-token-plan":{type:`code`},"doubao-token-plan":{type:`code`},minimax:{type:`code`},"minimax-cn":{type:`code`},"minimax-token-plan":{type:`code`},"minimax-token-plan-cn":{type:`code`},"hunyuan-token-plan":{type:`code`},"tencent-token-plan":{type:`code`},"hy-token-plan":{type:`code`},"xinghuo-token-plan":{type:`code`},"xfyun-coding":{type:`code`},"spark-coding":{type:`code`},"huawei-token-plan":{type:`code`},"pangu-token-plan":{type:`code`},"huawei-maas-token-plan":{type:`code`},"volcengine-agent-plan":{type:`code`},"ark-agent-plan":{type:`code`},"baidu-token-plan":{type:`code`},"ernie-token-plan":{type:`code`},"wenxin-token-plan":{type:`code`}},I={glm:`zai-coding-cn`,bigmodel:`zai-coding-cn`,zhipu:`zai-coding-cn`,zhipuai:`zai-coding-cn`,zai:`zai-coding`,ark:`volcengine-token-plan`,volcengine:`volcengine-token-plan`,doubao:`doubao-token-plan`,moonshot:`kimi-coding`,kimi:`kimi-coding`,xiaomi:`xiaomi-token-plan-cn`,opencode:`opencode-go`};function oe(e){return e===``?e:I[e]??e}function se(e){let t=F[oe(e)];return t?.type===`code`?t.tier:void 0}let ce=[{key:`deepseek-v4-flash`,input:.14,cacheHit:.0028,output:.28},{key:`deepseek-v4-pro`,input:.435,cacheHit:.003625,output:.87},{key:`gpt-5.6-sol`,input:5,cacheHit:.5,output:30},{key:`gpt-5.6-terra`,input:2,cacheHit:.2,output:12},{key:`gpt-5.6-luna`,input:.2,cacheHit:.02,output:1.2},{key:`glm-5.2`,input:1.4,cacheHit:.26,output:4.4},{key:`qwen3.8-max`,input:2,cacheHit:.21,output:6},{key:`kimi-k3`,input:2.82,cacheHit:.28,output:14.08},{key:`grok-4.6`,input:2,cacheHit:.5,output:6},{key:`gemini-2.5-pro`,input:1.25,cacheHit:.125,output:10}],le,ue,de,fe,pe;function me(e){let t=/:\/\//.test(e)?e:`https://${e}`;try{return new URL(t).origin}catch{return e.trim().toLowerCase().replace(/\/+$/,``)}}function he(e,t){return me(e)===me(t)}function ge(e){pe=e.length>0?e:void 0}function _e(){return pe}function L(e){return U(e)}function ve(e,t){let n=ye(e,t);if(n!==void 0)return{input:n.input,cacheHit:n.cacheHit,output:n.output,...n.currency===void 0?{}:{currency:n.currency},...n.offPeak===void 0?{}:{offPeak:n.offPeak}}}function ye(e,t){if(pe===void 0)return;let n=L(e),r=H(n),i=e=>L(e.key)===n||H(e.key)===r;if(t!==void 0){for(let e of pe)if(!(e.origin===void 0||e.origin===``)&&i(e)&&he(e.origin,t))return e}for(let e of pe)if(!(e.origin!==void 0&&e.origin!==``)&&i(e))return e}function be(e){if(pe===void 0)return;let t=L(e),n=H(t);return pe.find(e=>e.origin!==void 0&&e.origin!==``&&(L(e.key)===t||H(e.key)===n))}function xe(e){le=typeof e.rate==`number`&&Number.isFinite(e.rate)&&e.rate>0?e.rate:void 0,ue=e.prices,de=e.extraModels}function Se(e){fe=e}function Ce(){return le??6.79}function we(){return{rate:Ce(),live:le!==void 0}}let Te=.5;function Ee(e){return e==null||!Number.isFinite(e)?`peak`:De(e,z)}function De(e,t){if(R(e))return`offPeak`;let n=Math.floor(B(e)/6e4);for(let e=0;e+1<t.length;e+=2){let r=t[e]??0,i=t[e+1]??0;if(n>=r&&n<i)return`peak`}return`offPeak`}function R(e){let t=new Date(e+8*36e5).getUTCDay();return t===0||t===6}let z=[540,720,840,1080],Oe=[840,1080];function B(e){return((e+8*36e5)%864e5+864e5)%864e5}function ke(e,t){let n=De(e,t),r=B(e);for(let i=0;i<7;i++){let a=i*864e5-r;for(let r of t){let i=a+r*6e4;if(!(i<=0)&&De(e+i,t)!==n)return{tier:n,nextSwitchInMs:i}}}let i=t[0]??0;return{tier:n,nextSwitchInMs:864e5-r+i*6e4}}function Ae(e,t,n){let{nextSwitchInMs:r}=ke(e,t);if(r>n)return null;let i=e+r;return{entering:De(i,t),atMs:i}}function je(e,t){if(e===void 0||e===``)return`none`;let n=U(e),r=V.find(e=>e.key===n)?.provider;return r===`DeepSeek`?`deepseek-metered`:t&&r===`智谱 AI`?`zhipu-coding-plan`:`none`}function Me(e,t){switch(t){case`deepseek-metered`:return ke(e,z);case`zhipu-coding-plan`:return ke(e,Oe);case`none`:return null}}function Ne(e,t,n){switch(t){case`deepseek-metered`:return Ae(e,z,n);case`zhipu-coding-plan`:return Ae(e,Oe,n);case`none`:return null}}function Pe(e){let t=Math.max(1,Math.ceil(e/6e4)),n=Math.floor(t/60),r=t%60;return n>0?`${n}h${String(r).padStart(2,`0`)}m`:`${r}m`}let Fe=`09:00-12:00 / 14:00-18:00`,Ie=`Standard / Flex`,V=[{key:`flash`,name:`DeepSeek V4.1 Flash`,provider:`DeepSeek`,colorVar:`ds-blue`,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:Fe},{key:`flash-vision-exp`,name:`DeepSeek V4 Flash Vision (Exp)`,provider:`DeepSeek`,colorVar:`ds-blue`,retired:!0,price:{currency:`CNY`,input:2,cacheHit:.04,output:8,offPeak:{input:1,cacheHit:.02,output:4}},peakHours:Fe},{key:`pro`,name:`DeepSeek V4 Pro`,provider:`DeepSeek`,colorVar:`dsw-static-deepseek-500`,price:{currency:`CNY`,input:9,cacheHit:.3,output:27,offPeak:{input:4.5,cacheHit:.15,output:13.5}},peakHours:Fe},{key:`glm`,name:`GLM-5.2`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3`,name:`GLM-5.3`,provider:`智谱 AI`,colorVar:`ds-blue`,price:{currency:`CNY`,input:8,cacheHit:2,output:28}},{key:`glm-5.3-flash`,name:`GLM-5.3-Flash`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.23,output:2.8},promo:{factor:.5,endsAtMs:Date.UTC(2026,8,8,16,0,0),note:`限时 5 折`}},{key:`glm-4.6`,name:`GLM-4.6`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16}},{key:`glm-4.5-air`,name:`GLM-4.5-Air`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:.8,cacheHit:.16,output:2}},{key:`glm-4.7`,name:`GLM-4.7`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5-turbo`,name:`GLM-5-Turbo`,provider:`智谱 AI`,colorVar:`ds-blue`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`glm-5.1`,name:`GLM-5.1`,provider:`智谱 AI`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24}},{key:`glm-5v-turbo`,name:`GLM-5V-Turbo`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:5,cacheHit:1.2,output:22}},{key:`qwen-3.8-max`,name:`Qwen3.8 Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-600`,price:{currency:`CNY`,input:12,cacheHit:1.5,output:36},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-3.8-flash`,name:`Qwen3.8 Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:1,cacheHit:.1,output:3},extraRows:[{label:`显式缓存创建`,input:1.25},{label:`显式缓存命中`,input:.1},{label:`Batch File`,input:.5,output:1.5,note:`长期半价`},{label:`Batch Chat`,input:1,output:3,note:`与标准价一致`}]},{key:`qwen-max`,name:`Qwen3.7-Max`,provider:`阿里通义`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:12,cacheHit:1.2,output:36},promo:{factor:.5,note:`限时 5 折`},extraRows:[{label:`显式缓存创建`,input:15},{label:`显式缓存命中`,input:1.2},{label:`Batch File`,input:6,output:18,note:`长期半价`},{label:`Batch Chat`,input:12,output:36,note:`与标准价一致`}]},{key:`qwen-plus`,name:`Qwen3.5-Plus`,provider:`阿里通义`,colorVar:`ds-blue`,price:{currency:`CNY`,input:.8,cacheHit:.08,output:4.8},extraRows:[{label:`显式缓存创建`,input:1},{label:`显式缓存命中`,input:.08},{label:`Batch File`,input:.4,output:2.4,note:`长期半价`},{label:`Batch Chat`,input:.8,output:4.8,note:`与标准价一致`}]},{key:`qwen-flash`,name:`Qwen3.5-Flash`,provider:`阿里通义`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2},extraRows:[{label:`显式缓存创建`,input:.25},{label:`显式缓存命中`,input:.02}]},{key:`doubao`,name:`Doubao Seed-2.0 Pro`,provider:`字节豆包`,colorVar:`ds-red`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-mini`,name:`Doubao Seed-2.0 Mini`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.2,cacheHit:.02,output:2}},{key:`doubao-1.6`,name:`Doubao Seed-1.6`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:.8,cacheHit:0,output:8}},{key:`doubao-seed-evolving`,name:`Doubao-Seed-Evolving`,provider:`字节豆包`,colorVar:`ds-red`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-pro`,name:`Doubao Seed-2.1 Pro`,provider:`字节豆包`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:30}},{key:`doubao-seed-2.1-turbo`,name:`Doubao Seed-2.1 Turbo`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:3,cacheHit:.6,output:15}},{key:`kimi`,name:`Kimi K2.7 Code`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27}},{key:`kimi-k2.7-hs`,name:`Kimi K2.7 Code HighSpeed`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-600`,price:{currency:`CNY`,input:13,cacheHit:2.6,output:54}},{key:`kimi-k2.6`,name:`Kimi K2.6`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27}},{key:`kimi-k3`,name:`Kimi K3`,provider:`月之暗面`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:20,cacheHit:2,output:100}},{key:`mimo-v2.5`,name:`MiMo V2.5`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:1,cacheHit:.02,output:2}},{key:`mimo-v2.5-pro`,name:`MiMo V2.5 Pro`,provider:`小米`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:3,cacheHit:.025,output:6}},{key:`minimax`,name:`MiniMax-M3`,provider:`MiniMax`,colorVar:`ds-amber`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7`,name:`MiniMax-M2.7`,provider:`MiniMax`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:2.1,cacheHit:.42,output:8.4}},{key:`minimax-m2.7-highspeed`,name:`MiniMax-M2.7-highspeed`,provider:`MiniMax`,colorVar:`ds-amber`,price:{currency:`CNY`,input:4.2,cacheHit:.42,output:16.8}},{key:`ernie`,name:`ERNIE-5.1`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:4,cacheHit:.4,output:18}},{key:`hunyuan`,name:`混元 Hy3`,provider:`腾讯混元`,colorVar:`dsw-static-amber-400`,price:{currency:`CNY`,input:1,cacheHit:.25,output:4}},{key:`hunyuan-t1`,name:`混元 T1`,provider:`腾讯混元`,colorVar:`dsw-static-amber-300`,price:{currency:`CNY`,input:1,cacheHit:.1,output:4}},{key:`yi`,name:`Yi-Lightning`,provider:`零一万物`,colorVar:`ds-green`,price:{currency:`CNY`,input:.99,cacheHit:.1,output:.99}},{key:`step`,name:`Step 3.7 Flash`,provider:`阶跃星辰`,colorVar:`dsw-static-neutral-bluish-400`,price:{currency:`CNY`,input:1.35,cacheHit:.27,output:8.1}},{key:`spark`,name:`Spark 4.0 Ultra`,provider:`科大讯飞`,colorVar:`dsw-static-green-400`,price:{currency:`CNY`,input:5,cacheHit:.5,output:10},estimated:!0},{key:`sensenova`,name:`SenseNova 6.5`,provider:`商汤`,colorVar:`dsw-static-red-400`,price:{currency:`CNY`,input:4.5,cacheHit:.45,output:9},estimated:!0},{key:`baichuan`,name:`Baichuan M3-Plus`,provider:`百川智能`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:5,cacheHit:.5,output:9}},{key:`gpt-6-astra`,name:`GPT-6 Astra`,provider:`OpenAI`,colorVar:`ds-green`,price:{currency:`USD`,input:10,cacheHit:1,output:50}},{key:`gpt-5.6-sol`,name:`GPT-5.6 Sol`,provider:`OpenAI`,colorVar:`ds-green`,price:{currency:`USD`,input:5,cacheHit:.5,output:30},promo:{factor:.8,factors:{output:2/3},endsAtMs:Date.UTC(2026,10,21,16,0,0),note:`限时促销至 2026-11-21`}},{key:`gpt-5.6-terra`,name:`GPT-5.6 Terra`,provider:`OpenAI`,colorVar:`dsw-static-green-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:12}},{key:`gpt-5.6-luna`,name:`GPT-5.6 Luna`,provider:`OpenAI`,colorVar:`ds-green`,price:{currency:`USD`,input:.2,cacheHit:.02,output:1.2}},{key:`gemini-pro`,name:`Gemini 3.1 Pro`,provider:`Google`,colorVar:`dsw-static-blue-600`,price:{currency:`USD`,input:2,cacheHit:.2,output:12,offPeak:{input:1,cacheHit:.1,output:6}},peakHours:Ie,tierSemantics:`latency`},{key:`gemini-flash`,name:`Gemini 3.6 Flash`,provider:`Google`,colorVar:`dsw-static-blue-400`,price:{currency:`USD`,input:1.5,cacheHit:.15,output:7.5,offPeak:{input:.75,cacheHit:.075,output:3.75}},peakHours:Ie,tierSemantics:`latency`},{key:`grok`,name:`Grok 4.6`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-700`,price:{currency:`USD`,input:2,cacheHit:.5,output:6}},{key:`grok-4.3`,name:`Grok 4.3`,provider:`xAI`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`USD`,input:1.25,cacheHit:.2,output:2.5}},{key:`llama`,name:`Llama 4 Maverick`,provider:`Meta`,colorVar:`ds-red`,price:{currency:`USD`,input:.2,cacheHit:.05,output:.6}},{key:`llama-scout`,name:`Llama 4 Scout`,provider:`Meta`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:.1,cacheHit:.025,output:.3}},{key:`claude-opus-4-6`,name:`Claude Opus 4.6`,provider:`Anthropic`,colorVar:`ds-red`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:3,cacheHit:.3,output:15}},{key:`claude-haiku-4-5`,name:`Claude Haiku 4.5`,provider:`Anthropic`,colorVar:`dsw-static-red-300`,price:{currency:`USD`,input:1,cacheHit:.1,output:5}},{key:`claude-opus-5`,name:`Claude Opus 5`,provider:`Anthropic`,colorVar:`ds-red`,price:{currency:`USD`,input:5,cacheHit:.5,output:25}},{key:`claude-sonnet-5`,name:`Claude Sonnet 5`,provider:`Anthropic`,colorVar:`dsw-static-red-400`,price:{currency:`USD`,input:2,cacheHit:.2,output:10}},{key:`mistral-large-2512`,name:`Mistral Large 3`,provider:`Mistral AI`,colorVar:`ds-violet`,price:{currency:`USD`,input:.5,cacheHit:.05,output:1.5}},{key:`mistral-small-2603`,name:`Mistral Small 4`,provider:`Mistral AI`,colorVar:`dsw-static-violet-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`ministral-8b-latest`,name:`Ministral 8B`,provider:`Mistral AI`,colorVar:`dsw-static-violet-300`,price:{currency:`USD`,input:.1,cacheHit:.01,output:.1}},{key:`command-a-03-2025`,name:`Command A`,provider:`Cohere`,colorVar:`ds-cyan`,price:{currency:`USD`,input:2.5,cacheHit:.25,output:10}},{key:`command-r-08-2024`,name:`Command R`,provider:`Cohere`,colorVar:`dsw-static-cyan-400`,price:{currency:`USD`,input:.15,cacheHit:.015,output:.6}},{key:`longcat-2.0`,name:`LongCat 2.0`,provider:`美团`,colorVar:`ds-amber`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`minicpm-v-4.5`,name:`MiniCPM-V 4.5`,provider:`面壁智能`,colorVar:`ds-green`,price:{currency:`CNY`,input:1,cacheHit:.2,output:4},estimated:!0},{key:`ernie-4.5`,name:`ERNIE-4.5 300B`,provider:`百度文心`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`dots-3-note-preview`,name:`Dots3-Note Preview`,provider:`小红书`,colorVar:`ds-red`,price:{currency:`CNY`,input:2,cacheHit:.4,output:8},estimated:!0},{key:`qwen3.6-max`,name:`Qwen3.6 Max`,provider:`阿里通义`,colorVar:`dsw-static-orange-500`,price:{currency:`CNY`,input:9,cacheHit:.9,output:54},extraRows:[{label:`显式缓存创建`,input:11.25},{label:`显式缓存命中`,input:.9}]},{key:`qwen3-coder-plus`,name:`Qwen3-Coder Plus`,provider:`阿里通义`,colorVar:`dsw-static-orange-400`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},extraRows:[{label:`显式缓存创建`,input:5},{label:`显式缓存命中`,input:.4}]},{key:`qwen3-coder`,name:`Qwen3-Coder 480B`,provider:`阿里通义`,colorVar:`dsw-static-orange-300`,price:{currency:`CNY`,input:4,cacheHit:.8,output:16},estimated:!0},{key:`glm-4.5-x`,name:`GLM-4.5-X`,provider:`智谱 AI`,colorVar:`dsw-static-blue-400`,price:{currency:`CNY`,input:4,cacheHit:1,output:16},estimated:!0},{key:`glm-5.2-fast`,name:`GLM-5.2 Fast`,provider:`智谱 AI`,colorVar:`dsw-static-blue-300`,price:{currency:`CNY`,input:6,cacheHit:1.2,output:24},estimated:!0},{key:`kimi-k3-fast`,name:`Kimi K3 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:20,cacheHit:2,output:100},estimated:!0},{key:`kimi-k2.7-code-fast`,name:`Kimi K2.7 Code Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27},estimated:!0},{key:`kimi-k2.8-preview`,name:`Kimi K2.8 Preview`,provider:`月之暗面`,colorVar:`dsw-static-cyan-400`,price:{currency:`CNY`,input:6.5,cacheHit:1.3,output:27},estimated:!0},{key:`kimi-k2.6-fast`,name:`Kimi K2.6 Fast`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2.6-turbo`,name:`Kimi K2.6 Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:6.5,cacheHit:1.1,output:27},estimated:!0},{key:`kimi-k2-thinking-turbo`,name:`Kimi K2 Thinking Turbo`,provider:`月之暗面`,colorVar:`dsw-static-cyan-300`,price:{currency:`CNY`,input:8,cacheHit:1,output:58}},{key:`doubao-seed-2.0-code`,name:`Doubao Seed-2.0 Code`,provider:`字节豆包`,colorVar:`ds-red`,price:{currency:`CNY`,input:3.2,cacheHit:.64,output:16}},{key:`doubao-seed-2.0-lite`,name:`Doubao Seed-2.0 Lite`,provider:`字节豆包`,colorVar:`dsw-static-red-300`,price:{currency:`CNY`,input:.6,cacheHit:.12,output:3.6}},{key:`other`,name:`其他模型`,provider:`Custom`,colorVar:`dsw-static-neutral-bluish-500`,price:{currency:`CNY`,input:0,cacheHit:0,cacheMiss:0,output:0}}],Le={"deepseek-v4-flash":`flash`,"deepseek-v4-flash-vision-exp":`flash-vision-exp`,"deepseek-v4.1-flash":`flash`,"deepseek-v4.1-flash-expires-on-0910":`flash`,"deepseek-flash":`flash`,"deepseek-v4-pro":`pro`,"glm-5.2":`glm`,"glm-4.5-air":`glm-4.5-air`,"glm-4.5air":`glm-4.5-air`,"glm-4.7":`glm-4.7`,"glm-5-turbo":`glm-5-turbo`,"glm-5.1":`glm-5.1`,"glm-5.3-flash":`glm-5.3-flash`,"glm-5v-turbo":`glm-5v-turbo`,"glm-5v.1":`glm-5v-turbo`,"claude-opus-4-6":`claude-opus-4-6`,"claude-opus-4.6":`claude-opus-4-6`,"claude-sonnet-4-6":`claude-sonnet-4-6`,"claude-sonnet-4.6":`claude-sonnet-4-6`,"claude-haiku-4-5":`claude-haiku-4-5`,"claude-haiku-4.5":`claude-haiku-4-5`,"claude-opus-5":`claude-opus-5`,"claude-sonnet-5":`claude-sonnet-5`,"mistral-large-2512":`mistral-large-2512`,"mistral-large-3":`mistral-large-2512`,"mistral-small-2603":`mistral-small-2603`,"mistral-small-4":`mistral-small-2603`,"ministral-8b-latest":`ministral-8b-latest`,"ministral-8b":`ministral-8b-latest`,"command-a-03-2025":`command-a-03-2025`,"command-a":`command-a-03-2025`,"command-r-08-2024":`command-r-08-2024`,"command-r":`command-r-08-2024`,hy3:`hunyuan`,"longcat-2.0":`longcat-2.0`,"longcat-2":`longcat-2.0`,"minicpm-v-4.5":`minicpm-v-4.5`,"minicpm-v-4.5-thinking":`minicpm-v-4.5`,"ernie-4.5":`ernie-4.5`,"ernie-4.5-300b":`ernie-4.5`,"dots-3-note-preview":`dots-3-note-preview`,"dots-3-note":`dots-3-note-preview`,"dots3-note-preview":`dots-3-note-preview`,"rednote-dots3":`dots-3-note-preview`,"doubao-seed-evolving":`doubao-seed-evolving`,"doubao-seed-evolve":`doubao-seed-evolving`,"doubao-seed-2.1-pro":`doubao-seed-2.1-pro`,"doubao-seed-2.1-pro-290000":`doubao-seed-2.1-pro`,"doubao-seed-2.1-turbo":`doubao-seed-2.1-turbo`,"doubao-seed-2-1-turbo":`doubao-seed-2.1-turbo`,"qwen3.8-max":`qwen-3.8-max`,"qwen3.8-flash":`qwen-3.8-flash`,"qwen3.7-max":`qwen-max`,"qwen3.6-max":`qwen3.6-max`,"qwen3.6-max-preview":`qwen3.6-max`,"qwen3-coder-plus":`qwen3-coder-plus`,"qwen3-coder":`qwen3-coder`,"qwen3-coder-480b":`qwen3-coder`,"glm-4.5-x":`glm-4.5-x`,"glm-4.5x":`glm-4.5-x`,"glm-5.2-fast":`glm-5.2-fast`,"glm-5.2f":`glm-5.2-fast`,"kimi-k3-fast":`kimi-k3-fast`,"kimi-k3f":`kimi-k3-fast`,"kimi-k2.7-code-fast":`kimi-k2.7-code-fast`,"kimi-k2.7-code-f":`kimi-k2.7-code-fast`,"kimi-k2.6-fast":`kimi-k2.6-fast`,"kimi-k2.6-turbo":`kimi-k2.6-turbo`,"kimi-k2-thinking-turbo":`kimi-k2-thinking-turbo`,"doubao-seed-2.0-code":`doubao-seed-2.0-code`,"doubao-seed-2-0-code":`doubao-seed-2.0-code`,"doubao-seed-2.0-lite":`doubao-seed-2.0-lite`,"doubao-seed-2-0-lite":`doubao-seed-2.0-lite`,"qwen-max":`qwen-max`,"hunyuan-t1":`hunyuan-t1`,"step-3.7-flash":`step`,"seed-2.0-mini":`doubao-mini`,k3:`kimi-k3`,"kimi-k3":`kimi-k3`,"kimi-k2.8-preview":`kimi-k2.8-preview`,"kimi-k2.8":`kimi-k2.8-preview`,"kimi-k2-8-preview":`kimi-k2.8-preview`,"kimi-k2-8":`kimi-k2.8-preview`,"k2.8-preview":`kimi-k2.8-preview`,"k2.8":`kimi-k2.8-preview`,"minimax-m1":`minimax`,"minimax-m2":`minimax`,"minimax-m3":`minimax`,"minimax-m2.7":`minimax-m2.7`,"minimax-m2.7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2.7-high-speed":`minimax-m2.7-highspeed`,"minimax-m2-7":`minimax-m2.7`,"minimax-m2-7-highspeed":`minimax-m2.7-highspeed`,"minimax-m2-7-high-speed":`minimax-m2.7-highspeed`,"gpt-6":`gpt-6-astra`,"gpt-6-astra":`gpt-6-astra`};function H(e){return String(e).toLowerCase().replace(/\([^)]*\)/g,``).replace(/[^a-z0-9]+/g,``)}let Re=(()=>{let e=new Map,t=(t,n)=>{let r=H(t);r!==``&&!e.has(r)&&e.set(r,n)};for(let e of V)t(e.key,e.key);for(let[e,n]of Object.entries(Le))t(e,n);for(let e of ce)t(e.key,e.key);return e})();function ze(e){let t=[],n=e=>{e!==``&&!t.includes(e)&&t.push(e)},r=e=>{let t=e;for(;;){let e=t.replace(/[-_]\d{3,}$/u,``);if(e===t||e===``)return;t=e,n(t)}},i=e.lastIndexOf(`/`);if(i>0&&i<e.length-1){let t=e.slice(i+1);n(t),r(t)}return r(e),t}function Be(e){let t=Le[e];if(t!==void 0)return t;let n=H(e);if(n===``)return;let r=Re.get(n);return r===void 0?(de??[]).find(e=>H(e.key)===n)?.key:r}function U(e){let t=Le[e]??e;if(t===e){let t=H(e);if(t!==``){let e=Re.get(t);if(e!==void 0)return e;let n=(de??[]).find(e=>H(e.key)===t);if(n!==void 0)return n.key}for(let t of ze(e)){let e=Be(t);if(e!==void 0)return e}}return t}function W(e){let t=U(e),n=ue?.[t];if(n!==void 0)return n;let r=ce.find(e=>e.key.toLowerCase()===t.toLowerCase());if(r!==void 0)return{input:r.input,cacheHit:r.cacheHit,output:r.output}}function Ve(e){let t=U(e),n=V.find(e=>e.key===t),r=de?.find(e=>e.key===t),i=n??(r===void 0?(()=>{let e=V.at(-1);if(e!==void 0)return e;throw Error(`MODEL_CATALOG must not be empty`)})():He(r)),a=ve(t);if(a!==void 0)return{...i,userPriced:!0,price:{currency:a.currency??`CNY`,input:a.input,cacheHit:a.cacheHit,output:a.output,...a.offPeak===void 0?{}:{offPeak:a.offPeak}}};let o=W(t);return o===void 0?i:{...i,price:{currency:`USD`,input:o.input,cacheHit:o.cacheHit,output:o.output}}}function He(e){return{key:e.key,name:e.name,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:e.price.input,cacheHit:e.price.cacheHit,output:e.price.output}}}function Ue(e,t){let n=e.endsAtMs!==void 0&&t>=e.endsAtMs;return Number.isFinite(t)&&!n&&e.factor>0&&e.factor<1}function We(e,t){let{promo:n}=e;if(n===void 0||!Ue(n,t))return e;let r=e=>n.factors?.[e]??n.factor,i=e=>({input:e.input*r(`input`),cacheHit:e.cacheHit*r(`cacheHit`),...e.cacheMiss===void 0?{}:{cacheMiss:e.cacheMiss*r(`cacheMiss`)},output:e.output*r(`output`)});return{...e,price:{...i(e.price),currency:e.price.currency,...e.price.offPeak===void 0?{}:{offPeak:i(e.price.offPeak)}}}}function Ge(e=Date.now()){let t=[...V.filter(e=>e.retired!==!0).map(t=>We(t,e))],n=new Set(t.map(e=>e.key.toLowerCase())),r=new Set(t.map(e=>H(e.key)));for(let e of fe??[]){let i=e.id.toLowerCase();if((()=>{let t=U(e.id);return V.find(e=>e.key===t)})()!==void 0)continue;let a=H(e.id);if(n.has(i)||a!==``&&r.has(a))continue;let o=(de??[]).find(e=>H(e.key)===a),s;if(o!==void 0)s=He(o),e.name!==void 0&&e.name!==``&&(s={...s,name:e.name});else{let t=W(i);s=t===void 0?{key:U(e.id),name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:0,cacheHit:0,output:0},uncatalogued:!0}:{key:i,name:e.name??e.id,provider:e.provider,colorVar:`dsw-static-neutral-400`,price:{currency:`USD`,input:t.input,cacheHit:t.cacheHit,output:t.output}}}n.add(s.key.toLowerCase()),a!==``&&r.add(a),t.push(s)}return t.map(e=>{let t=ve(e.key);return t===void 0?e:{...e,userPriced:!0,price:{currency:t.currency??`CNY`,input:t.input,cacheHit:t.cacheHit,output:t.output}}})}function Ke(e){let t=getComputedStyle(document.documentElement).getPropertyValue(`--${e}`).trim();return t===``?`#8b95a3`:t}function G(e,t,n){let r=t.cacheMiss>0?t.cacheMiss:Math.max(0,t.input-t.cacheHit),i=Math.min(t.cacheHit,t.input),a=(r*(e.cacheMiss??e.input)+i*e.cacheHit+t.output*e.output)/1e6;return n===`USD`?a*Ce():a}function qe(e,t,n=Te,r=Date.now()){let i=We(e,r),a=G(i.price,t,i.price.currency),o=i.price.offPeak===void 0?a:G(i.price.offPeak,t,i.price.currency);return a*n+o*(1-n)}function Je(e){let t=Ce();return t>0?e/t:e}function K(e,t=`cny`){let n=Number(e);if(!Number.isFinite(n))return t===`cny`?`¥0`:`$0`;let r=t===`cny`?`¥`:`$`;return n<=0?`${r}0`:n>=1e3?`${r}${n.toFixed(0)}`:n>=10?`${r}${n.toFixed(1)}`:n>=.1?`${r}${n.toFixed(2)}`:`${r}${n.toFixed(3)}`}function Ye(e,t=`CNY`){return e===0?`免费`:t===`USD`?e>=10?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`:e>=10?`¥${e.toFixed(1)}`:`¥${e.toFixed(2)}`}function Xe(e,t,n,r){return r<=0||!Number.isFinite(r)||t===(n===`usd`?`USD`:`CNY`)?e:n===`usd`?e/r:e*r}function q(e){return e>=1e9?`${(e/1e9).toFixed(2)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function Ze(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(1)}%`:`0.0%`}let J={top:18,right:40,bottom:26,left:46};function Qe(e){let[,t,n]=e.split(`-`);return`${Number(t)}/${Number(n)}`}function $e(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function et(e,t){let n=[];for(let r=0;r<e;r+=t)n.push(r);return e>0&&n[n.length-1]!==e-1&&n.push(e-1),n}let tt={key:`__total__`,name:`总计`,color:``};function nt({data:e,models:t=[],currency:n=`cny`,metric:i=`cost`}){let[a,s]=(0,r.useState)(null),c=e=>K(n===`usd`?Je(e):e,n),l=e=>i===`tokens`?$e(e):c(e),u=e=>i===`tokens`?e.tokens??0:e.cost,d=(0,r.useMemo)(()=>{let n=e.length;if(n===0)return null;let r=680-J.left-J.right,a=220-J.top-J.bottom,o=e=>n===1?J.left+r/2:J.left+r*e/(n-1),s=Math.max(...i===`tokens`?e.map(e=>e.tokens??0):e.map(e=>Math.max(e.cost,Object.values(e.byModel??{}).reduce((e,t)=>e+t,0))),1e-4),c=e=>J.top+a-e/s*a,l=Math.max(...e.map(e=>e.calls),1),d=e=>J.top+a-e/l*a,f=r/n,p=Math.min(18,f*.6);return{n,plotW:r,plotH:a,inner:o,yCost:c,yCalls:d,barW:p,bars:e.flatMap((e,n)=>{let r=o(n)-p/2;if(t.length===0||i===`tokens`)return[{date:e.date,model:tt,x:r,base:0,value:u(e),topRounded:!0}];let a=null;for(let n of t)(e.byModel?.[n.key]??0)>0&&(a=n.key);let s=0;return t.map(t=>{let n=e.byModel?.[t.key]??0,i={date:e.date,model:t,x:r,base:s,value:n,topRounded:t.key===a};return s+=n,i})}),costTicks:[0,.25,.5,.75,1].map(e=>s*e).reverse(),callsTicks:[0,.25,.5,.75,1].map(e=>l*e).reverse(),linePath:e.map((e,t)=>{let n=d(e.calls);return`${t===0?`M`:`L`}${o(t)} ${n}`}).join(` `)}},[e,t,i]);if(d===null)return(0,o.jsx)(`div`,{className:P.chartEmpty,children:`暂无趋势数据`});let{n:f,plotW:p,plotH:m,inner:h,yCost:g,yCalls:_,barW:v,bars:y,costTicks:b,callsTicks:x,linePath:S}=d,C=a===null?void 0:e[a],w=et(f,Math.max(1,Math.ceil(f/8)));return(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 220`,className:P.chartSvg,role:`img`,"aria-label":`Daily cost by model and total calls`,onMouseLeave:()=>{s(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-J.left)/p,r=Math.round(n*(f-1));s(Math.min(Math.max(r,0),f-1))},children:[b.map((e,t)=>{let n=g(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:J.left,x2:680-J.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:J.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:l(e)})]},`cost-${t}`)}),y.map(t=>{if(t.value>0)return(0,o.jsx)(`rect`,{x:t.x,y:g(t.base+t.value),width:v,height:g(t.base)-g(t.base+t.value),rx:t.topRounded?2:0,className:t.model.color===``?P.chartBar:P.chartStack,style:t.model.color===``?void 0:{fill:t.model.color}},`${t.date}-${t.model.key}`);let n=e.find(e=>e.date===t.date);return n!==void 0&&n.calls>0&&t.base===0?(0,o.jsx)(`rect`,{x:t.x,y:g(0)-1,width:v,height:1,rx:0,className:P.chartBarPlaceholder},`${t.date}-${t.model.key}-placeholder`):null}),(0,o.jsx)(`path`,{d:S,fill:`none`,className:P.chartLine}),x.map((e,t)=>{let n=_(e);return(0,o.jsx)(`text`,{x:680-J.right+8,y:n+3,textAnchor:`start`,className:P.chartAxisLabel,children:$e(e)},`calls-${t}`)}),w.map(t=>{let n=e[t];return n===void 0?null:(0,o.jsx)(`text`,{x:h(t),y:214,textAnchor:`middle`,className:P.chartAxisLabel,children:Qe(n.date)},n.date)}),a!==null&&(0,o.jsx)(`line`,{x1:h(a),x2:h(a),y1:J.top,y2:J.top+m,className:P.chartCrosshair})]}),C!==void 0&&a!==null&&(0,o.jsxs)(`div`,{className:P.chartTooltip,style:{left:`${h(a)/680*100}%`,top:`${g(C.cost)/220*100}%`},children:[(0,o.jsx)(`div`,{className:P.chartTooltipDate,children:C.date}),i!==`tokens`&&t.filter(e=>(C.byModel?.[e.key]??0)>0).map(e=>(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:c(C.byModel?.[e.key]??0)})]},e.key)),(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartLegendBar}),`总计 `,(0,o.jsx)(`strong`,{children:i===`tokens`?$e(C.tokens??0):c(C.cost)})]}),(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartLegendLine}),`调用 `,(0,o.jsx)(`strong`,{children:C.calls.toLocaleString()})]})]}),t.length>0&&i!==`tokens`&&(0,o.jsxs)(`div`,{className:P.chartLegend,children:[t.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key)),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartLegendLine}),`调用`]})]})]})}let Y={top:14,right:42,bottom:22,left:46};function rt(e){return e.slice(5,13).replace(`T`,` `)}function it(e){return String(e>=100?Math.round(e):Number(e.toFixed(1)))}function at(e){return e<1e4?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function ot(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:e.toFixed(1)}function X(e,t,n){return t===`ttft`?`${Math.round(e)} ms`:`${e.toFixed(1)} ${n(`perfTpsUnit`)}`}function st({perf:e,models:t,t:n}){let[i,a]=(0,r.useState)(()=>ae()),[s,c]=(0,r.useState)(null),l=e=>{a(e),M(e)},u=e=>t.find(t=>t.key===e)?.color??`#8b95a3`,f=(0,r.useMemo)(()=>e===void 0?[]:Object.entries(e.byModel).map(([e,n])=>({key:e,name:t.find(t=>t.key===e)?.name??e,color:u(e),samples:n.samples,ttftAvg:n.ttftAvg,ttftP50:n.ttftP50,ttftP90:n.ttftP90,...n.ttftMax===void 0?{}:{ttftMax:n.ttftMax},...n.ttftSpikes===void 0?{}:{ttftSpikes:n.ttftSpikes},...n.tpsAvg===void 0?{}:{tpsAvg:n.tpsAvg},latencyAvg:n.latencyAvg,estimatedSamples:n.estimatedSamples})).sort((e,t)=>t.samples-e.samples||t.ttftP90-e.ttftP90),[e,t]),p=(0,r.useMemo)(()=>{if(e===void 0)return[];if(i.models!==void 0){let t=new Set(Object.keys(e.byModel));return i.models.filter(e=>t.has(e))}return f.slice(0,5).map(e=>e.key)},[e,f,i.models]),m=(0,r.useMemo)(()=>{if(e===void 0)return null;let t=Object.keys(e.byHourModel).sort().slice(-48);if(t.length===0)return null;let n=t.length,r=680-Y.left-Y.right,a=180-Y.top-Y.bottom,o=e=>n===1?Y.left+r/2:Y.left+r*e/(n-1),s=new Set(p),c=e=>i.metric===`ttft`?e?.ttftAvg:e?.tpsAvg,l=[],u=0;for(let r of f){if(!s.has(r.key))continue;let i=[];for(let a=0;a<n;a++){let n=t[a];if(n===void 0)continue;let s=c(e.byHourModel[n]?.[r.key]);s===void 0||!Number.isFinite(s)||(i.push({i:a,x:o(a),y:0,v:s}),s>u&&(u=s))}l.push({key:r.key,name:r.name,color:r.color,segments:[],points:i})}let d=l.reduce((e,t)=>e+t.points.length,0);u=Math.max(u,1);let m=e=>Y.top+a-e/u*a;for(let e of l){let t=``,n=-2;for(let r of e.points)r.y=m(r.v),t!==``&&r.i!==n+1&&(e.segments.push(t),t=``),t+=`${t===``?`M`:`L`}${r.x} ${r.y} `,n=r.i;t!==``&&e.segments.push(t)}let h=Math.max(1,Math.ceil(n/8)),g=[];for(let e=0;e<n;e+=h)g.push(e);return g[g.length-1]!==n-1&&g.push(n-1),{hourKeys:t,n,plotW:r,plotH:a,inner:o,yOf:m,series:l,ticks:[0,.5,1].map(e=>u*e).reverse(),xTicks:g,totalPoints:d}},[e,f,p,i.metric]);if(e===void 0||f.length===0)return(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-empty`,children:n(`perfEmpty`)});let h=e=>{let t=p.includes(e)?p.filter(t=>t!==e):[...p,e];l({metric:i.metric,models:t})},g=e=>{l({metric:e,...i.models===void 0?{}:{models:i.models}})},_=s===null||m===null?[]:m.series.flatMap(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?[]:[{key:e.key,name:e.name,color:e.color,v:t.v}]});return(0,o.jsxs)(`div`,{"data-testid":`billing-perf-panel`,children:[(0,o.jsx)(`div`,{className:P.tableScroll,"data-testid":`billing-perf-table`,children:(0,o.jsxs)(`table`,{className:P.modelTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:n(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfSamples`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfTtft`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfP50`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfP90`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfMax`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfTps`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfLatency`)}),(0,o.jsx)(`th`,{className:P.numCol,children:n(`perfEstimated`)})]})}),(0,o.jsx)(`tbody`,{children:f.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:P.modelCell,children:[(0,o.jsx)(`span`,{className:P.modelDot,style:{background:e.color}}),(0,o.jsx)(`span`,{className:P.modelName,children:e.name})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.samples.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:at(e.ttftAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:at(e.ttftP50)}),(0,o.jsx)(`td`,{className:P.numCol,children:at(e.ttftP90)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.ttftMax===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):(0,o.jsxs)(`span`,{children:[at(e.ttftMax),e.ttftSpikes!==void 0&&e.ttftSpikes>0?` (${e.ttftSpikes}↑)`:``]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.tpsAvg===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):ot(e.tpsAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:at(e.latencyAvg)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.estimatedSamples>0?e.estimatedSamples:(0,o.jsx)(`span`,{className:P.na,children:`—`})})]},e.key))})]})}),m!==null&&(0,o.jsxs)(`div`,{"data-testid":`billing-perf-hour`,children:[(0,o.jsx)(`div`,{className:P.perfBar,children:(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":n(`perfTitle`),children:[`ttft`,`tps`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,i.metric===e&&P.rangeButtonActive),"aria-pressed":i.metric===e,"data-testid":`billing-perf-tab-${e}`,onClick:()=>{g(e)},children:e===`ttft`?`${n(`perfTtft`)} (ms)`:`${n(`perfTps`)} (${n(`perfTpsUnit`)})`},e))})}),(0,o.jsxs)(`div`,{className:P.perfChips,role:`group`,"aria-label":n(`model`),children:[(0,o.jsx)(`button`,{type:`button`,className:P.perfChip,"data-testid":`billing-perf-chip-all`,onClick:()=>{l({metric:i.metric,models:f.map(e=>e.key)})},children:n(`perfAll`)}),f.map(e=>{let t=p.includes(e.key);return(0,o.jsxs)(`button`,{type:`button`,className:d(P.perfChip,!t&&P.perfChipOff),style:t?{color:e.color,borderColor:`color-mix(in srgb, ${e.color} 45%, transparent)`}:void 0,"aria-pressed":t,"data-testid":`billing-perf-chip-${e.key}`,onClick:()=>{h(e.key)},children:[(0,o.jsx)(`span`,{className:P.perfChipDot,style:{background:t?e.color:`var(--dsw-alias-label-dimmed)`}}),e.name]},e.key)})]}),m.totalPoints>0?(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 180`,className:P.chartSvg,role:`img`,"aria-label":`Hourly perf comparison by model`,onMouseLeave:()=>{c(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Y.left)/m.plotW,r=Math.round(n*(m.n-1));c(Math.min(Math.max(r,0),m.n-1))},children:[m.ticks.map((e,t)=>{let n=m.yOf(e);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Y.left,x2:680-Y.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:Y.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:it(e)})]},`tick-${t}`)}),m.series.map(e=>e.segments.map((t,n)=>(0,o.jsx)(`path`,{d:t,fill:`none`,className:P.chartLine,style:{stroke:e.color}},`${e.key}-${n}`))),m.xTicks.map(e=>{let t=m.hourKeys[e];return t===void 0?null:(0,o.jsx)(`text`,{x:m.inner(e),y:174,textAnchor:`middle`,className:P.chartAxisLabel,children:rt(t)},t)}),s!==null&&(0,o.jsx)(`line`,{x1:m.inner(s),x2:m.inner(s),y1:Y.top,y2:Y.top+m.plotH,className:P.chartCrosshair}),s!==null&&m.series.map(e=>{let t=e.points.find(e=>e.i===s);return t===void 0?null:(0,o.jsx)(`circle`,{cx:t.x,cy:t.y,r:3.5,fill:e.color,className:P.chartHoverDot},`${e.key}-dot`)})]}),s!==null&&_.length>0&&(0,o.jsxs)(`div`,{className:P.chartTooltip,"data-testid":`billing-perf-tooltip`,style:{left:`${m.inner(s)/680*100}%`,top:`${(Y.top+m.plotH/2)/180*100}%`},children:[(0,o.jsx)(`div`,{className:P.chartTooltipDate,children:rt(m.hourKeys[s]??``)}),_.map(e=>(0,o.jsxs)(`div`,{className:P.chartTooltipRow,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name,` `,(0,o.jsx)(`strong`,{children:X(e.v,i.metric,n)})]},e.key))]})]}):(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]}),m===null&&(0,o.jsx)(`div`,{className:P.chartEmpty,"data-testid":`billing-perf-chart-empty`,children:n(`perfChartEmpty`)})]})}let ct=`@kenz1117/dsh-ui-usage-billing`,lt=`kenz1117`;function ut({t:e,version:t}){return(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-plugin-info`,children:[(0,o.jsxs)(`div`,{className:P.plgHead,children:[(0,o.jsx)(`span`,{className:P.plgIcon,"aria-hidden":`true`,children:(0,o.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,o.jsx)(`path`,{d:`M10 3a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v2a2 2 0 0 0 4 0V4a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v1a2 2 0 0 0 4 0 1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0 0 4h1a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-1a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1a2 2 0 0 0-4 0 1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 0-4H3a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1h1a2 2 0 0 0 4 0z`})})}),(0,o.jsxs)(`div`,{className:P.plgTitle,children:[(0,o.jsxs)(`div`,{className:P.plgNameRow,children:[(0,o.jsx)(`h3`,{className:P.plgName,children:ct}),(0,o.jsx)(`span`,{className:P.plgTag,children:t===void 0?`—`:`v${t}`})]}),(0,o.jsx)(`p`,{className:P.plgDesc,children:`Usage billing dashboard for DeepSeek Harness`})]})]}),(0,o.jsxs)(`div`,{className:P.plgGrid,children:[(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginAuthor`)}),(0,o.jsxs)(`a`,{className:P.plgLink,href:`https://github.com/${lt}`,target:`_blank`,rel:`noreferrer`,children:[`KenZ`,` (`,lt,`)`]})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginRepository`)}),(0,o.jsx)(`a`,{className:P.plgLink,href:`https://github.com/kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:`GitHub`})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginNpm`)}),(0,o.jsx)(`a`,{className:P.plgLink,href:`https://www.npmjs.com/package/@kenz1117/dsh-ui-usage-billing`,target:`_blank`,rel:`noreferrer`,children:ct})]}),(0,o.jsxs)(`div`,{className:P.plgItem,children:[(0,o.jsx)(`span`,{className:P.plgLabel,children:e(`pluginLicense`)}),(0,o.jsx)(`span`,{className:P.plgVal,children:`MIT`})]})]})]})}function dt(e=Date.now()){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function ft(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}let Z={top:14,right:18,bottom:22,left:46},pt=`var(--ds-blue)`,mt=`var(--ds-cyan)`,ht=`var(--ds-amber)`;function gt(e,t,n,r){return JSON.stringify({days:e,models:t,dayModels:n,total:r},null,2)}function _t(e){let{stats:t,trendDays:n,onTrendDays:i,t:a}=e,s=e.money,c=e.models??[],{byDay:l,byModel:u,total:f}=t,[p,m]=(0,r.useState)(null),[h,g]=(0,r.useState)(`structure`),[_,v]=(0,r.useState)(null),y=t.byDayModels!==void 0,b=e=>{g(e),v(null)},x=(0,r.useMemo)(()=>{let e=t.byRole;if(e===void 0)return[];let n=e.user+e.assistant+e.tool;return n<=0?[]:[{label:a(`roleUser`),value:e.user,seg:P.shareSegUser},{label:a(`roleAssistant`),value:e.assistant,seg:P.shareSegAssistant},{label:a(`roleTool`),value:e.tool,seg:P.shareSegTool}].map(e=>({...e,pct:e.value/n*100}))},[t.byRole,a]),S=(0,r.useMemo)(()=>{let e=[];for(let t=n-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t);let r=dt(n.getTime()),i=l[r];e.push({date:r,miss:i?.cacheMiss??0,hit:i?.cacheHit??0,output:i?.output??0,reasoning:i?.reasoning??0})}return e},[l,n]),C=(0,r.useMemo)(()=>{let e=[];for(let r=n-1;r>=0;--r){let n=new Date;n.setDate(n.getDate()-r);let i=dt(n.getTime()),a=t.byDayModels?.[i],o={},s=0;if(a!==void 0)for(let[e,t]of Object.entries(a)){let n=t.cacheHit??0,r=t.cacheMiss??0,i=t.output??0,a=n+r+i;a<=0||(o[e]={hit:n,miss:r,output:i,total:a},s+=a)}e.push({date:i,models:o,total:s})}return e},[t.byDayModels,n]),w=(0,r.useMemo)(()=>{let e=new Map;for(let t of C)for(let[n,r]of Object.entries(t.models))e.set(n,(e.get(n)??0)+r.total);return[...e.entries()].sort((e,t)=>t[1]-e[1]).map(([e])=>({key:e,name:c.find(t=>t.key===e)?.name??Ve(e).name,color:c.find(t=>t.key===e)?.color??`#8b95a3`}))},[C,c]),T=_!==null&&w.some(e=>e.key===_)?_:null,ee=e=>{if(y){if(h!==`model`){g(`model`),v(e);return}v(t=>t===e?null:e)}},E=(0,r.useMemo)(()=>{let e=0;return Object.entries(u).filter(([,e])=>e.calls>0).map(([t,n])=>{let r=n.input+n.output;e+=r;let i=n.cacheHit+n.cacheMiss;return{key:t,name:Ve(t).name,input:n.input,output:n.output,reasoning:n.reasoning??0,calls:n.calls,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,cacheHitRate:i>0?n.cacheHit/i*100:0,total:r,share:0}}).sort((e,t)=>t.total-e.total).map(t=>({...t,share:e>0?t.total/e:0}))},[u]),D=(0,r.useMemo)(()=>{let e=Object.entries(t.byTool??{}),n=e.slice(0,8),r=e.slice(8).reduce((e,[,t])=>e+t,0),i=e.reduce((e,[,t])=>e+t,0);return{top:n,rest:r>0?[[`…`,r]]:[],totalCalls:i}},[t.byTool]),O=(0,r.useMemo)(()=>{let e=S.length;if(e===0)return null;let t=680-Z.left-Z.right,n=200-Z.top-Z.bottom,r=Math.max(...h===`model`?C.map(e=>e.total):S.map(e=>e.miss+e.hit+e.output),1),i=e=>Z.top+n-e/r*n,a=t/e,o=Math.min(20,a*.6),s=n=>e===1?Z.left+t/2:Z.left+t*n/(e-1),c=Math.max(1,Math.ceil(e/8)),l=[];for(let t=0;t<e;t+=c)l.push(t);return e>0&&l[l.length-1]!==e-1&&l.push(e-1),{n:e,plotW:t,plotH:n,max:r,y:i,barW:o,inner:s,indices:l,groupW:a}},[S,C,h]),te=()=>{let e=new Blob([vt(S)],{type:`text/csv`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-daily-${dt()}.csv`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},k=()=>{let e=new Blob([gt(S,E,C,f)],{type:`application/json`}),t=document.createElement(`a`);t.href=URL.createObjectURL(e),t.download=`token-${dt()}.json`,t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),0)},A=p===null?void 0:S[p],j=p===null?void 0:C[p],ne=O===null?0:Math.ceil(80/Math.max(O.groupW,1)),re=p===null||O===null?void 0:p>=O.n-ne?P.chartTooltipAlignRight:p<ne?P.chartTooltipAlignLeft:void 0;return(0,o.jsxs)(`div`,{className:P.tokenPanel,"data-testid":`billing-token-panel`,children:[(0,o.jsxs)(`div`,{className:P.exportBar,role:`group`,"aria-label":a(`tokenExport`),children:[(0,o.jsx)(`span`,{className:P.exportLabel,children:a(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-token-export-csv`,onClick:te,children:a(`tokenExportCsv`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-token-export-json`,onClick:k,children:a(`exportJson`)})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-daily`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`tokenDaily`)}),(0,o.jsxs)(`span`,{className:P.panelHeadControls,children:[y&&(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[`structure`,`model`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,h===e&&P.rangeButtonActive),"aria-pressed":h===e,onClick:()=>{b(e)},"data-testid":`billing-token-view-${e}`,children:a(e===`structure`?`tokenViewStructure`:`tokenViewModel`)},e))}),(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":a(`tokenDaily`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,n===e&&P.rangeButtonActive),"aria-pressed":n===e,onClick:()=>{i(e)},"data-testid":`billing-token-${e}d`,children:a(e===7?`trend7d`:`trend30d`)},e))})]})]}),O===null||h===`model`&&w.length===0?(0,o.jsx)(`div`,{className:P.chartEmpty,children:a(`trendEmpty`)}):(0,o.jsxs)(`div`,{className:P.chartWrap,children:[(0,o.jsxs)(`svg`,{viewBox:`0 0 680 200`,className:P.chartSvg,role:`img`,"aria-label":a(`tokenDaily`),onMouseLeave:()=>{m(null)},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=((e.clientX-t.left)/t.width*680-Z.left)/O.plotW,r=Math.round(n*(O.n-1));m(Math.min(Math.max(r,0),O.n-1))},children:[[0,.5,1].map(e=>{let t=O.max*e,n=O.y(t);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`line`,{x1:Z.left,x2:680-Z.right,y1:n,y2:n,className:P.chartGrid}),(0,o.jsx)(`text`,{x:Z.left-8,y:n+3,textAnchor:`end`,className:P.chartAxisLabel,children:ft(t)})]},e)}),h===`structure`?S.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=O.y(0),i=O.y(e.miss),a=O.y(e.miss+e.hit),s=O.y(e.miss+e.hit+e.output);return(0,o.jsxs)(`g`,{children:[(0,o.jsx)(`rect`,{x:n,y:i,width:O.barW,height:r-i,fill:pt}),(0,o.jsx)(`rect`,{x:n,y:a,width:O.barW,height:i-a,fill:mt}),(0,o.jsx)(`rect`,{x:n,y:s,width:O.barW,height:a-s,fill:ht})]},e.date)}):C.map((e,t)=>{let n=O.inner(t)-O.barW/2,r=0;return(0,o.jsx)(`g`,{children:w.map(t=>{let i=e.models[t.key];if(i===void 0)return null;let a=O.y(r);r+=i.total;let s=O.y(r),c=T!==null&&t.key!==T;return(0,o.jsx)(`rect`,{x:n,y:s,width:O.barW,height:a-s,fill:t.color,opacity:c?.15:1},t.key)})},e.date)}),O.indices.map(e=>{let t=S[e];return t===void 0?null:(0,o.jsx)(`text`,{x:O.inner(e),y:194,textAnchor:`middle`,className:P.chartAxisLabel,children:t.date.slice(5)},t.date)}),p!==null&&(0,o.jsx)(`line`,{x1:O.inner(p),x2:O.inner(p),y1:Z.top,y2:Z.top+O.plotH,className:P.chartCrosshair})]}),p!==null&&h===`structure`&&A!==void 0&&(0,o.jsxs)(`div`,{className:d(P.chartTooltip,re),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(p)/680*100}%`,top:`${O.y(A.miss+A.hit+A.output)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:P.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:P.chartTooltipDate,children:A.date}),(0,o.jsx)(`strong`,{children:(A.miss+A.hit+A.output).toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:mt}}),a(`tokenHit`)]}),(0,o.jsx)(`strong`,{children:A.hit.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:pt}}),a(`tokenMiss`)]}),(0,o.jsx)(`strong`,{children:A.miss.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:ht}}),a(`tokenOutput`)]}),(0,o.jsx)(`strong`,{children:A.output.toLocaleString()})]})]}),p!==null&&h===`model`&&j!==void 0&&(0,o.jsxs)(`div`,{className:d(P.chartTooltip,re),"data-testid":`billing-token-tooltip`,style:{left:`${O.inner(p)/680*100}%`,top:`${O.y(j.total)/200*100}%`},children:[(0,o.jsxs)(`div`,{className:P.chartTooltipHead,children:[(0,o.jsx)(`span`,{className:P.chartTooltipDate,children:j.date}),(0,o.jsx)(`strong`,{children:j.total.toLocaleString()})]}),w.map(e=>{let t=j.models[e.key];return t===void 0?null:(0,o.jsxs)(`div`,{className:P.chartTooltipModel,children:[(0,o.jsxs)(`div`,{className:d(P.chartTooltipRow,P.chartTooltipSplit),children:[(0,o.jsxs)(`span`,{className:P.chartTooltipLabel,children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]}),(0,o.jsx)(`strong`,{children:t.total.toLocaleString()})]}),(0,o.jsxs)(`div`,{className:P.chartTooltipModelDetail,children:[a(`tokenHitShort`),` `,t.hit.toLocaleString(),` · `,a(`tokenMissShort`),` `,t.miss.toLocaleString(),` · `,a(`tokenOutput`),` `,t.output.toLocaleString()]})]},e.key)})]}),(0,o.jsx)(`div`,{className:P.chartLegend,children:h===`structure`?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:pt}}),a(`tokenMiss`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:mt}}),a(`tokenHit`)]}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:ht}}),a(`tokenOutput`)]})]}):w.map(e=>(0,o.jsxs)(`button`,{type:`button`,className:d(P.chartLegendItem,T===e.key&&P.chartLegendItemActive),"aria-pressed":T===e.key,"data-testid":`billing-token-legend-${e.key}`,onClick:()=>{ee(e.key)},children:[(0,o.jsx)(`span`,{className:P.chartTooltipSwatch,style:{background:e.color}}),e.name]},e.key))})]})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-models`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`tokenByModel`)})}),E.length===0?(0,o.jsx)(`div`,{className:P.emptyRow,children:a(`noData`)}):(0,o.jsx)(`div`,{className:P.tableScroll,children:(0,o.jsxs)(`table`,{className:P.modelTable,"data-testid":`billing-token-model-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`inputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`outputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenReasoningShort`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenTotal`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenShare`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`calls`)})]})}),(0,o.jsx)(`tbody`,{children:E.map(e=>(0,o.jsxs)(`tr`,{"data-testid":`billing-token-model`,className:d(y&&P.modelRowFocusable,T===e.key&&P.modelRowActive),"aria-selected":y?T===e.key:void 0,onClick:y?()=>{ee(e.key)}:void 0,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelName,children:e.name})}),(0,o.jsx)(`td`,{className:P.numCol,children:q(e.input)}),(0,o.jsx)(`td`,{className:P.numCol,children:q(e.output)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.reasoning>0?q(e.reasoning):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsxs)(`td`,{className:P.numCol,children:[e.cacheHitRate.toFixed(1),`%`]}),(0,o.jsx)(`td`,{className:P.numCol,children:q(e.total)}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsxs)(`span`,{className:P.tokenModelShareRow,children:[(0,o.jsx)(`span`,{className:P.tokenModelBar,children:(0,o.jsxs)(`span`,{className:P.tokenModelParts,style:{width:`${(e.share*100).toFixed(2)}%`},children:[(0,o.jsx)(`span`,{className:P.tokenModelPartIn,style:{width:`${e.total>0?e.input/e.total*100:0}%`}}),(0,o.jsx)(`span`,{className:P.tokenModelPartOut,style:{width:`${e.total>0?e.output/e.total*100:0}%`}})]})}),(e.share*100).toFixed(1),`%`]})}),(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()})]},e.key))})]})})]}),D.totalCalls>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-token-tools`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`toolRank`)})}),(0,o.jsx)(`div`,{className:P.tableScroll,children:(0,o.jsxs)(`table`,{className:P.modelTable,"data-testid":`billing-tool-table`,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:a(`toolName`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:a(`tokenShare`)})]})}),(0,o.jsx)(`tbody`,{children:[...D.top,...D.rest].map(([e,t])=>(0,o.jsxs)(`tr`,{"data-testid":`billing-tool-row`,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelName,children:e})}),(0,o.jsx)(`td`,{className:P.numCol,children:t.toLocaleString()}),(0,o.jsxs)(`td`,{className:P.numCol,children:[(t/D.totalCalls*100).toFixed(1),`%`]})]},e))})]})})]}),x.length>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-roles`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:a(`roleCost`)}),(0,o.jsx)(`span`,{className:P.panelHint,children:a(`roleHint`)})]}),(0,o.jsx)(`div`,{className:P.shareTrack,"data-testid":`billing-role-track`,children:x.map(e=>(0,o.jsx)(`div`,{className:d(P.shareSeg,e.seg),style:{width:`${e.pct}%`}},e.label))}),(0,o.jsx)(`div`,{className:P.shareLegend,children:x.map(e=>(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:d(P.shareDot,e.seg)}),e.label,(0,o.jsxs)(`span`,{className:P.shareValue,children:[s(e.value),` · `,e.pct.toFixed(1),`%`]})]},e.label))})]})]})}function vt(e){return[`date,missInput,cacheHit,output,reasoning,total`,...e.map(e=>`${e.date},${e.miss},${e.hit},${e.output},${e.reasoning},${e.miss+e.hit+e.output}`)].join(`
|
|
2
|
+
`)}function yt(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}`}function bt(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function xt(e){let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${String(t%60).padStart(2,`0`)}s`}function St({rounds:e,flags:t,currency:n,t:i}){let a=(0,r.useMemo)(()=>e.slice(-40),[e]),s=(0,r.useMemo)(()=>new Set(t.map(e=>`${e.sessionId}:${e.turn}`)),[t]),c=(0,r.useMemo)(()=>Math.max(1e-4,...a.map(e=>e.cost)),[a]);if(a.length===0)return(0,o.jsxs)(`div`,{className:P.roundsEmpty,children:[i(`model`),` —`]});let l=e=>K(n===`usd`?Je(e):e,n);return(0,o.jsxs)(`div`,{className:P.rounds,children:[(0,o.jsx)(`div`,{className:P.roundsBars,role:`img`,"aria-label":`cost per turn`,children:a.map(e=>{let t=s.has(`${e.sessionId}:${e.turn}`),n=Math.max(1,e.cost/c*100),r=Ee(e.startedAt)===`peak`;return(0,o.jsxs)(`div`,{className:d(P.roundsBarCol,r?P.roundsBarColPeak:P.roundsBarColOff),children:[(0,o.jsx)(`span`,{className:P.roundsBarLabel,style:{bottom:`${n}%`},children:l(e.cost)}),(0,o.jsx)(`div`,{className:P.roundsBarWrap,children:(0,o.jsx)(`div`,{className:t?P.roundsBarFlagged:P.roundsBar,style:{height:`${n}%`},"data-testid":`round-bar`,title:`${i(`model`)} ${e.model} · ${l(e.cost)} · ${bt(e.startedAt)}${e.endedAt===void 0?``:` → ${yt(e.endedAt)} (${xt(e.endedAt-e.startedAt)})`}`,children:t&&(0,o.jsx)(`span`,{className:P.roundsFlagMark,"aria-hidden":`true`})})})]},`${e.sessionId}:${e.turn}`)})}),(0,o.jsxs)(`div`,{className:P.roundsAxis,children:[(0,o.jsxs)(`span`,{children:[i(`costAbbr`),` `,l(c)]}),(0,o.jsxs)(`span`,{children:[a.length,` 轮`]})]})]})}let Ct=[`color-mix(in srgb, var(--ds-blue) 10%, var(--dsb-3))`,`color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))`,`color-mix(in srgb, var(--ds-blue) 60%, var(--dsb-3))`,`color-mix(in srgb, var(--ds-blue) 90%, var(--dsb-3))`,`var(--ds-blue)`],wt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Tt(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Et(e,t){let n=new Map;for(let t of e)n.set(t.date,t.value);let r=0;for(let e of n.values())e>r&&(r=e);let i=t.getFullYear(),a=t.getMonth(),o=t.getDate(),s=new Date(i,a+1,0).getDate(),c=new Date(i,a,1).getDay(),l=c+s,u=Math.ceil(l/7),d=[];for(let e=0;e<u;e+=1){let t=[];for(let l=0;l<7;l+=1){let u=e*7+l-c+1;if(u<1){let e=new Date(i,a,u);t.push({date:Tt(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}if(u>s){let e=new Date(i,a+1,u-s);t.push({date:Tt(e),dayNum:e.getDate(),value:0,level:0,placeholder:!0});continue}let d=Tt(new Date(i,a,u)),f=n.get(d)??0,p=0;if(f>0&&r>0){let e=Math.ceil(f/r*4);p=Math.min(4,Math.max(1,e))}let m=u>o;t.push({date:d,dayNum:u,value:m?0:f,level:m?0:p,placeholder:m})}d.push(t)}return d}function Dt(e,t){let n=new Map;for(let t of e)n.set(t.date,t.value);let r=0;for(let e of n.values())e>r&&(r=e);let i=Tt(t),a=new Date(t);a.setHours(0,0,0,0),a.setDate(a.getDate()-a.getDay());let o=new Date(a);o.setDate(a.getDate()-357);let s=[];for(let e=0;e<52;e+=1){let t=[];for(let a=0;a<7;a+=1){let s=new Date(o);s.setDate(o.getDate()+e*7+a);let c=Tt(s),l=c>i,u=l?0:n.get(c)??0,d=0;if(!l&&u>0&&r>0){let e=Math.ceil(u/r*4);d=Math.min(4,Math.max(1,e))}t.push({date:c,dayNum:s.getDate(),value:u,level:d,placeholder:l})}s.push(t)}return s}function Ot({days:e,currency:t,now:n,t:i,range:a=`month`}){let[s,c]=(0,r.useState)(null),l=e=>K(t===`usd`?Je(e):e,t),u=(0,r.useMemo)(()=>Et(e,n??new Date),[e,n]);if(a===`year`){let t=Dt(e,n??new Date),r=[],a=-1;return t.forEach((e,t)=>{let n=Number(e[0]?.date.slice(5,7)??0);n!==a&&(r.push({index:t,label:wt[n-1]??``}),a=n)}),(0,o.jsxs)(`div`,{className:P.heatmapYear,"data-testid":`heatmap-year`,children:[(0,o.jsxs)(`div`,{className:P.heatmapYearBody,children:[(0,o.jsx)(`div`,{className:P.heatmapYearWeekdays,"aria-hidden":`true`,children:[{label:`Mon`,row:1},{label:`Wed`,row:3},{label:`Fri`,row:5}].map(e=>(0,o.jsx)(`span`,{className:P.heatmapYearWeekday,style:{gridRow:e.row},children:e.label},e.label))}),(0,o.jsxs)(`div`,{className:P.heatmapYearScroll,children:[(0,o.jsx)(`div`,{className:P.heatmapYearMonths,"aria-hidden":`true`,"data-testid":`heatmap-year-months`,children:r.map(e=>(0,o.jsx)(`span`,{className:P.heatmapYearMonth,style:{gridColumn:e.index+1},children:e.label},e.index))}),(0,o.jsx)(`div`,{className:P.heatmapYearGrid,role:`img`,"aria-label":`yearly cost heatmap`,"data-testid":`heatmap-year-grid`,children:t.flat().map(e=>(0,o.jsx)(`button`,{type:`button`,className:P.heatmapYearCell,"data-testid":`heatmap-year-cell`,"data-level":e.level,style:{background:Ct[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`},e.date))})]})]}),(0,o.jsxs)(`div`,{className:P.heatmapFooter,children:[(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:P.heatmapLegend,children:Ct.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapMore`)})]})]})}return(0,o.jsxs)(`div`,{className:P.heatmap,children:[(0,o.jsx)(`div`,{className:P.heatmapGrid,role:`img`,"aria-label":`daily cost heatmap`,children:u.map(e=>e.map(e=>e.placeholder?(0,o.jsx)(`div`,{className:P.heatmapCellEmpty,children:e.dayNum},e.date):(0,o.jsx)(`button`,{type:`button`,className:P.heatmapCell,"data-testid":`heatmap-cell`,"data-level":e.level,style:{background:Ct[e.level]},title:`${e.date} · ${l(e.value)}`,"aria-label":`${e.date}: ${l(e.value)}`,onMouseEnter:()=>{c(e)},onMouseLeave:()=>{c(null)},onFocus:()=>{c(e)},onBlur:()=>{c(null)},children:e.dayNum},e.date)))}),(0,o.jsxs)(`div`,{className:P.heatmapFooter,children:[(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapLess`)}),(0,o.jsx)(`span`,{className:P.heatmapLegend,children:Ct.map((e,t)=>(0,o.jsx)(`i`,{style:{background:e}},t))}),(0,o.jsx)(`span`,{className:P.heatmapLegendText,children:i(`heatmapMore`)}),s!==null&&(0,o.jsxs)(`span`,{className:P.heatmapHover,"data-testid":`heatmap-hover`,children:[s.date,` · `,l(s.value)]})]})]})}let kt={window:6,threshold:2,reasonFactor:1.8,reasonHitDropPp:15};function At(e){if(e.length===0)return null;let t=0;for(let n of e)t+=n;return t/e.length}function jt(e){let t=e.cacheHit+e.cacheMiss;return t<=0?null:e.cacheHit/t*100}function Mt(e,t){let n=t?.window??kt.window,r=t?.threshold??kt.threshold,i=t?.reasonFactor??kt.reasonFactor,a=t?.reasonHitDropPp??kt.reasonHitDropPp,o=[];if(n<=0||r<=0)return o;let s=[],c=[],l=[],u=[];for(let t of e){if(t.cost<=0)continue;let e=t.output,d=t.input,f=jt(t),p=At(s),m=[];if(p!==null&&p>0&&t.cost>p*r){let n=At(c),r=At(l),s=At(u);n!==null&&n>0&&e>n*i&&m.push(`output-growth`),r!==null&&r>0&&d>r*i&&m.push(`context-bloat`),s!==null&&f!==null&&f<s-a&&m.push(`cache-hit-drop`),o.push({sessionId:t.sessionId,turn:t.turn,cost:t.cost,reasons:m})}for(s.push(t.cost),c.push(e),l.push(d),f!==null&&u.push(f);s.length>n;)s.shift();for(;c.length>n;)c.shift();for(;l.length>n;)l.shift();for(;u.length>n;)u.shift()}return o}function Nt(e){return/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function Pt(e){return/^[=+\-@\t\r]/.test(e)?`'${e}`:e}function Ft(e){return e.toFixed(2)}function It(e){return[`date,calls,input,output,cache_hit,cache_miss,cost_cny`,...Object.keys(e).sort().map(t=>{let n=e[t];return n===void 0?``:[t,n.calls,n.input,n.output,n.cacheHit,n.cacheMiss,Ft(n.cost)].join(`,`)})].join(`
|
|
3
|
+
`)}function Lt(e){return[`site,kind,calls,cost_cny`,...Object.entries(e).map(([e,t])=>{let n=e.startsWith(`site:`)?e.slice(5):e.startsWith(`direct:`)?e.slice(7):`unknown`,r=e.startsWith(`site:`)?`site`:e.startsWith(`direct:`)?`direct`:`unknown`;return[Nt(Pt(n)),r,t.calls,Ft(t.cost)].join(`,`)})].join(`
|
|
4
|
+
`)}function Rt(e){return e===void 0?``:e.split(/[\\/]/).filter(Boolean).pop()??e}function zt(e){return[`session_id,title,project,calls,cost_cny,last_active`,...e.map(e=>[Nt(Pt(e.id)),Nt(Pt(e.title??``)),Nt(Pt(Rt(e.cwd))),e.calls,Ft(e.cost),e.lastActive>0?new Date(e.lastActive).toISOString():``].join(`,`))].join(`
|
|
5
|
+
`)}function Bt(e,t,n){let r=[...n].sort(),i=r[0],a=r.at(-1);return`${e}${i!==void 0&&a!==void 0?`-${i}_${a}`:``}.${t}`}function Vt(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:n})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),setTimeout(()=>URL.revokeObjectURL(r),0)}let Ht=`usageBilling`,Ut={title:`使用统计`,cost:`费用`,todayCost:`今日费用`,monthCost:`本月费用`,yearCost:`本年费用`,monthProjected:`本月预计`,liveTurn:`本轮`,liveSession:`会话`,calls:`调用`,cacheHitRate:`缓存命中率`,tokens:`Token`,inputTokens:`输入`,outputTokens:`输出`,avgCost:`平均成本`,kpiRange:`统计范围`,avgRangeToday:`今日`,avgRange7d:`近7天`,avgRangeWeek:`本周`,avgRangeMonth:`本月`,avgRangeAll:`累计`,trend:`每日费用与调用趋势`,trend7d:`7 天`,trend30d:`30 天`,trendMetric:`趋势指标`,trendMetricCost:`费用`,trendMetricTokens:`Token`,trendEmpty:`暂无趋势数据`,budget:`本月预算`,budgetRemain:`剩余预算`,budgetAmount:`预算金额`,budgetSummary:`本月已用 {used} / {total};达到 80% 时提醒,达到 100% 时红色脉冲警示`,sessions:`会话明细`,sessionTitle:`标题`,lastActive:`最后活跃`,sessionOverflow:`仅显示花费前 {limit} 个,共 {total} 个会话`,budgetTierBody:`本月花费 {cost} 已达预算 {budget} 的 {pct}%`,models:`模型计费明细`,providerBilling:`提供商计费与订阅`,channelUnknown:`未知路由`,directTag:`直连`,relayTag:`中转`,unknownTag:`未知`,planCountUnit:`套餐`,actual:`实际`,pricing:`模型单价表`,input:`输入`,output:`输出`,cacheHit:`缓存命中`,peak:`高峰`,offPeak:`低谷`,flat:`全天统一`,band:`时段`,close:`关闭`,footer:`每 30s 自动轮询 · 仅统计本机 dsh 会话`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`数据更新于`,noData:`暂无计费数据`,todayRate:`今日汇率`,rateLive:`实时`,rateBuiltin:`内置`,promoBadge:`促`,promoUntil:`促销价至 {date},之后自动恢复刊例价`,promoOpenEnded:`厂商未公布截止时间,当前按折扣计价;公告截止后自动恢复刊例价`,pricingTip:`DeepSeek 现行刊例:V4.1 Flash 谷档 未命中 ¥1 / 缓存命中 ¥0.02 / 输出 ¥4;V4 Pro 谷档 未命中 ¥4.5 / 缓存命中 ¥0.15 / 输出 ¥13.5;峰价均为谷价 × 2。工作日 9-12 / 14-18 为高峰价,其余时段(含周末全天)为低谷价;费用按调用时刻计。`,pricingUnit:`单位:人民币 / 每百万 Token`,pricingNotes:`计价说明`,ubPeak:`峰`,ubOff:`谷`,ubStd:`标准`,peakBand:`峰谷分带`,pricingSource:`数据来源`,noteCache:`命中部分按缓存价计费,显著降低成本。`,noteBand:`高峰与空闲时段单价不同,空闲约半价。`,noteSource:`价格来自实时汇率 + 模型定价目录,未收录模型按 0 计并提示。`,balance:`余额`,recharge:`充值`,rechargeHint:`打开该厂商官方平台的充值页`,balanceUnconfigured:`未配置`,balanceUnauthorized:`密钥无效`,balanceUnreachable:`查询失败`,uncatalogued:`未收录`,estimatedPricing:`估算价`,balanceDays:`约可撑 {days} 天`,balanceLowBody:`{name} 余额 {balance},约可撑 {days} 天,请及时充值`,reconcileDrift:`系统监控到{provider}官方余额变动 {spent},本面板记录 {today},差额通常由其它工具或 API 的消耗所致`,reconcileDismiss:`知道了`,subscriptionNotConfigured:`未配置密钥`,subscriptionUnauthorized:`密钥无效`,subscriptionUnavailable:`查询失败`,subscriptionInvalid:`响应异常`,subscriptionRateLimited:`触发限流`,subscriptionSession:`本次`,subscriptionWeekly:`本周`,subscriptionMonthly:`本月`,subscriptionBilling:`计费周期`,subscriptionRemaining:`剩余 {pct}%`,subscriptionExhausted:`已用尽`,subscriptionReset:`{date} 重置`,subscriptionNoApi:`该厂商暂未提供用量查询接口`,floatWindow:`模型用量悬浮窗`,floatModeCombined:`综合`,floatModeSubscription:`订阅卡`,floatMode:`展示模式`,floatTargets:`订阅目标`,floatWindowHint:`悬浮在左下角计费卡上的用量速览;综合=当前样式,订阅卡=每次展示一张订阅额度卡(可切换)。`,floatPrimaryToday:`今日`,floatPrimaryWeek:`本周`,floatPrimaryMonth:`本月`,cardDisplay:`计费卡显示`,cardDisplayHint:`切换左下角计费卡的主指标与主数字统计范围(迷你柱跟随视角,悬浮窗不受影响)。`,cardMetric:`主指标`,cardMetricMoney:`花费金额`,cardMetricTokens:`Token 消耗`,cardSpan:`统计范围`,cardSpanDay:`日`,cardSpanWeek:`周`,cardSpanMonth:`月`,floatNoTargets:`未指定订阅通道,请在设置中勾选要展示的订阅。`,floatNoTargetsHint:`暂无可选的订阅通道。`,subscriptionsStale:`订阅额度刷新失败,以下为缓存数据`,staleLedgerNotice:`{count} 个会话出自旧版算法存档(日志已删,无法重算),模型归属可能有误差`,tokenCacheWrite:`写入`,toolRank:`工具排行`,toolName:`工具`,userPrices:`自定义单价`,userPricesHint:`为未收录或变价模型填入实付单价,总览与日趋势按此重估;模型可用下拉候选(目录键或模型 id);来源留空=该模型默认价,填入中转站域名=仅该来源的同名模型用此价(协议可省);低谷价三栏填后按峰/谷混合估算,留空=平档`,userPriceSave:`保存`,userPriceModel:`模型`,userPriceSource:`来源(中转站域名)`,userPriceSourceHint:`留空=默认价,或 https://api.中转站.com`,userPriceOffPeak:`低谷价`,userPriceNormal:`标准价`,userPriceCurrency:`币种`,userPriceAdd:`新增`,userPriceRemoveSelected:`删除所选`,userPriceSelect:`选择此行`,sessionStaleBadge:`旧版统计`,sessionUntitled:`未命名会话`,heatmapLess:`少`,heatmapMore:`多`,currency:`币种`,currencyCny:`人民币`,currencyUsd:`美元`,heatmap:`用量热力图`,rounds:`每轮费用`,roundsHint:`最近 {count} 轮 · 柱顶为金额 · 底色为峰谷时段`,anomaly:`成本突增`,model:`模型`,thModel:`模型名称`,thInputMiss:`输入缓存未命中`,thInputHit:`输入缓存命中`,costAbbr:`费用`,tabOverview:`概览`,tabTrends:`趋势`,tabProviders:`账单`,tabPricing:`费率`,tabSettings:`设置`,budgetHint:`设置月度上限,用于本月预计与超支分段提醒`,peakAlertHint:`在切档前弹窗提醒,可选同步系统通知`,peakAlertDescPeak:`即将进入高峰时段,价格将上调,请提前安排长任务`,peakAlertDescOff:`即将进入平价时段,价格减半,适合运行大批量任务`,peakAlertDescPeakZhipu:`即将进入高峰时段(工作日 14:00–18:00),Coding Plan 额度将按基础积分全额抵扣`,peakAlertDescOffZhipu:`即将进入非高峰时段,Coding Plan 额度按基础积分 5 折抵扣`,export:`导出`,exportCsvDay:`按日 CSV`,exportCsvSession:`按会话 CSV`,exportJson:`全量 JSON`,peakShare:`峰谷时段占比`,peakSharePerCall:`按调用时刻精确判档`,offPeakSavings:`挪谷可省约 {amount}`,perfMax:`最大 TTFT`,weekCost:`本周`,roleCost:`费用构成`,roleUser:`用户输入`,roleAssistant:`助手输出`,roleTool:`工具结果`,roleHint:`估算:输出按实测计价,输入按消息长度摊分`,tierPeak:`峰时`,tierOff:`平价`,tierToPeak:`后转峰时`,tierToOff:`后转平价`,tierAlertEnterPeak:`{minutes} 分钟后进入峰时(DeepSeek 高峰价 ×2),不急的调用可稍等`,tierAlertEnterOff:`{minutes} 分钟后进入平价(价格减半)`,tierAlertEnterPeakZhipu:`{minutes} 分钟后进入智谱高峰时段,Coding Plan 额度将全额抵扣`,tierAlertEnterOffZhipu:`{minutes} 分钟后进入智谱非高峰时段,额度按基础积分 5 折抵扣`,peakAlertTitlePeak:`即将进入高峰价`,peakAlertTitleOff:`即将进入平价`,peakAlert:`峰谷切换提醒`,peakAlertLeadMin:`提前量(分钟)`,peakAlertPos:`位置`,peakAlertMode:`提醒模式`,peakAlertPosCorner:`右下角`,peakAlertPosCenter:`屏幕居中`,peakAlertModePeak:`仅进入峰时`,peakAlertModeOff:`仅进入平价`,peakAlertModeBoth:`峰与谷都提醒`,peakAlertWebNotify:`同时发系统通知`,peakAlertPreview:`预览提醒`,planTypeCode:`订阅制`,planTypeToken:`按量`,subscriptionFeePerMonth:`{amount}/月`,triggerToday:`今日`,triggerMonth:`当月`,triggerMonthTokens:`当月 Token`,triggerTodayTokens:`今日 Token`,triggerWeekTokens:`本周 Token`,subscriptionTag:`订阅`,free:`免费`,perfSamples:`样本`,perfTtft:`首字延时`,perfP50:`P50`,perfP90:`P90`,perfTps:`生成速度`,perfLatency:`总延迟`,perfEstimated:`估算样本`,perfEmpty:`暂无性能数据`,perfTpsUnit:`tok/s`,perfTitle:`性能`,perfHint:`按模型与按小时聚合;估算样本为工具续写步骤`,perfAll:`全选`,perfChartEmpty:`未选择模型或该指标暂无数据`,heatmapYear:`年`,heatmapMonth:`月`,activeDays:`活跃天数`,streakDays:`连续使用`,subscriptionAutoDetect:`自动识别`,pluginAuthor:`作者`,pluginRepository:`仓库`,pluginNpm:`npm`,pluginLicense:`许可证`,tabToken:`用量`,tokenExport:`导出 Token`,tokenExportCsv:`按日 Token CSV`,tokenReasoningShare:`思考占比`,tokenReasoningShort:`思考`,tokenIo:`输入/输出比`,tokenPeak:`峰值日`,tokenDaily:`每日 Token`,tokenByModel:`模型 Token`,tokenMiss:`输入(缓存未命中)`,tokenHit:`输入(缓存命中)`,tokenOutput:`输出`,tokenViewStructure:`按结构`,tokenViewModel:`按模型`,tokenHitShort:`命中`,tokenMissShort:`未命中`,tokenTotal:`总 Token`,tokenShare:`占比`,usageStatsTool:`注入用量查询工具`,usageStatsToolHint:`让模型可在对话中查询用量/费用;会占用模型每次请求的上下文,coding 场景建议关闭(改后需重载应用生效)`,balanceGranted:`赠金余额`,balanceTopped:`充值余额`,balanceDaily:`日均消耗`,balanceDaysLong:`约可撑`,balanceDaysUnit:`天`,popTodayModel:`主力消耗模型余额`,popTitle:`用量速览`,popNoConsumption:`暂无消耗`,popDirectLead:`直联`,popSubLead:`订阅`,unpricedHint:`{count} 个模型未收录计价,费用已按 0 计`,searchEstimateHint:`含 {count} 次联网搜索请求的估算费用(每次约 {each};日志无用量事件,按次估算,可在配置 searchCallEstimateCny 调整或关闭)`,siteListDisplay:`中转站列表`,siteListDisplayHint:`隐藏「未识别」占位条目,净化中转站额度列表`,liveCostBar:`平价消耗胶囊`,liveCostBarHint:`输入框旁的即时代费条,悬浮可看详情`,liveCostBarPosition:`位置`,liveCostBarPosBelow:`输入框下方`,liveCostBarPosAbove:`输入框上方`,liveCostBarPosToolbar:`输入框内部`,exportCsvSite:`按站点 CSV`,panelRelayQuota:`中转站额度`,relayBalance:`余额`,relayNoQuota:`未读出额度`,relayWindowUsed:`已用`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`未识别`},Wt={title:`Usage`,cost:`Cost`,todayCost:`Today`,monthCost:`This month`,yearCost:`This year`,monthProjected:`Projected`,liveTurn:`Turn`,liveSession:`Session`,calls:`Calls`,cacheHitRate:`Cache Hit`,tokens:`Tokens`,inputTokens:`Input`,outputTokens:`Output`,avgCost:`Avg cost`,kpiRange:`Range`,avgRangeToday:`Today`,avgRange7d:`7d`,avgRangeWeek:`Week`,avgRangeMonth:`Month`,avgRangeAll:`All`,trend:`Daily cost & calls`,trend7d:`7D`,trend30d:`30D`,trendMetric:`Trend metric`,trendMetricCost:`Cost`,trendMetricTokens:`Tokens`,trendEmpty:`No trend data yet`,budget:`Monthly budget`,budgetRemain:`Remaining`,budgetAmount:`Budget amount`,budgetSummary:`Used {used} / {total} this month; warn at 80%, pulse red at 100%`,sessions:`Sessions`,sessionTitle:`Title`,lastActive:`Last active`,sessionOverflow:`Top {limit} of {total} sessions by cost`,budgetTierBody:`This month {cost} reached {pct}% of the budget {budget}`,models:`Model billing`,providerBilling:`Provider billing & subscriptions`,channelUnknown:`Unknown routes`,directTag:`Direct`,relayTag:`Relay`,unknownTag:`Unknown`,planCountUnit:`plan(s)`,actual:`Actual`,pricing:`Model pricing`,input:`Input`,output:`Output`,cacheHit:`Cache hit`,peak:`Peak`,offPeak:`Off-peak`,flat:`Flat`,band:`Band`,close:`Close`,footer:`Polls every 30s · local dsh sessions only`,footerCredit:`dsh-ui-usage-billing {version} · MIT`,lastUpdated:`Updated`,noData:`No billing data yet`,todayRate:`Today rate`,rateLive:`Live`,rateBuiltin:`Built-in`,promoBadge:`Promo`,promoUntil:`Promo price until {date}, then list price resumes automatically`,promoOpenEnded:`End date not announced; billed at the discounted rate until further notice, then list price resumes`,pricingTip:`DeepSeek list rates: V4.1 Flash off-peak ¥1 miss / ¥0.02 cache-hit / ¥4 output; V4 Pro off-peak ¥4.5 miss / ¥0.15 cache-hit / ¥13.5 output; peak = 2× off-peak. Weekday 9-12 / 14-18 bills at peak, all other times (weekends included) at off-peak; billed at call time.`,pricingUnit:`Unit: CNY / per 1M tokens`,pricingNotes:`Pricing notes`,ubPeak:`Peak`,ubOff:`Off`,ubStd:`Std`,peakBand:`Peak/off-peak band`,pricingSource:`Data source`,noteCache:`Cache hits are billed at the cache rate, cutting cost.`,noteBand:`Peak and off-peak prices differ; off-peak is roughly half price.`,noteSource:`Prices come from the live rate + model catalog; unlisted models count as 0 and are flagged.`,balance:`Balance`,recharge:`Top up`,rechargeHint:`Open the vendor's official top-up page`,balanceUnconfigured:`Not set`,balanceUnauthorized:`Bad key`,balanceUnreachable:`Unavailable`,uncatalogued:`Not catalogued`,estimatedPricing:`Estimated`,balanceDays:`~{days} days left`,balanceLowBody:`{name} balance {balance}, ~{days} days left, please top up`,reconcileDrift:`Detected {provider} official balance moved {spent}, this panel recorded {today}; the gap usually comes from other tools or APIs consuming too`,reconcileDismiss:`Got it`,subscriptionNotConfigured:`Key not set`,subscriptionUnauthorized:`Bad key`,subscriptionUnavailable:`Unavailable`,subscriptionInvalid:`Bad response`,subscriptionRateLimited:`Rate limited`,subscriptionSession:`Current`,subscriptionWeekly:`Weekly`,subscriptionMonthly:`Monthly`,subscriptionBilling:`Billing`,subscriptionRemaining:`{pct}% left`,subscriptionExhausted:`Exhausted`,subscriptionReset:`Resets {date}`,subscriptionNoApi:`Provider does not offer a usage API`,floatWindow:`Model usage popover`,floatModeCombined:`Combined`,floatModeSubscription:`Subscription card`,floatMode:`Display mode`,floatTargets:`Targets`,floatWindowHint:`Usage summary floating on the footer card; Combined=current style, Subscription cards=one quota card at a time (switchable).`,floatPrimaryToday:`Today`,floatPrimaryWeek:`Week`,floatPrimaryMonth:`Month`,cardDisplay:`Billing card`,cardDisplayHint:`Switch the bottom-left billing card between cost and token usage, and pick the figure range (sparkline follows; the popover is unaffected).`,cardMetric:`Main metric`,cardMetricMoney:`Cost`,cardMetricTokens:`Token usage`,cardSpan:`Range`,cardSpanDay:`Day`,cardSpanWeek:`Week`,cardSpanMonth:`Month`,floatNoTargets:`No subscription selected — pick some in Settings.`,floatNoTargetsHint:`No subscription channel available.`,subscriptionsStale:`Subscription refresh failed — showing cached data`,staleLedgerNotice:`{count} sessions use legacy-algorithm archives (logs deleted); attribution may be off`,tokenCacheWrite:`written`,toolRank:`Tool calls`,toolName:`Tool`,userPrices:`Custom prices`,userPricesHint:`Enter actual per-1M-token prices; main views are re-costed. Pick a model key from the dropdown candidates. Leave source empty for the model default, or enter a relay origin (protocol optional) to price only that source. Fill all three off-peak fields for peak/off-peak estimation; leave them empty for flat pricing.`,userPriceSave:`Save`,userPriceModel:`Model`,userPriceSource:`Source (relay origin)`,userPriceSourceHint:`Empty = default; e.g. https://api.relay.com`,userPriceOffPeak:`Off-peak price`,userPriceNormal:`Standard price`,userPriceCurrency:`Currency`,userPriceAdd:`Add`,userPriceRemoveSelected:`Remove selected`,userPriceSelect:`Select this row`,sessionStaleBadge:`legacy`,sessionUntitled:`Untitled session`,heatmapLess:`Less`,heatmapMore:`More`,currency:`Currency`,currencyCny:`CNY`,currencyUsd:`USD`,heatmap:`Usage heatmap`,rounds:`Cost per turn`,roundsHint:`Last {count} rounds · bar tops show amount · fill = peak/off-peak`,anomaly:`Cost spike`,model:`Model`,thModel:`Model name`,thInputMiss:`Input (cache miss)`,thInputHit:`Input (cache hit)`,costAbbr:`cost`,tabOverview:`Overview`,tabTrends:`Trends`,tabProviders:`Bills`,tabPricing:`Rates`,tabSettings:`Settings`,budgetHint:`Set a monthly cap for projections and tier alerts`,peakAlertHint:`Alert before a tier switch, optionally via system notification`,peakAlertDescPeak:`About to enter peak hours — prices rise, plan long tasks ahead`,peakAlertDescOff:`About to enter off-peak hours — price halves, ideal for large batches`,peakAlertDescPeakZhipu:`Peak hours soon (weekdays 14:00–18:00) — Coding Plan credits will be deducted at full rate`,peakAlertDescOffZhipu:`Off-peak soon — Coding Plan credits will be deducted at 50% of base credits`,export:`Export`,exportCsvDay:`Daily CSV`,exportCsvSession:`Sessions CSV`,exportJson:`Full JSON`,peakShare:`Peak vs off-peak`,peakSharePerCall:`per-call attribution, full history`,offPeakSavings:`Shift peak to off-peak: save ~{amount}`,perfMax:`Max TTFT`,weekCost:`This week`,roleCost:`Cost breakdown`,roleUser:`User input`,roleAssistant:`Assistant output`,roleTool:`Tool results`,roleHint:`Estimated: output priced exactly, input split by message size`,tierPeak:`Peak`,tierOff:`Off-peak`,tierToPeak:`until peak`,tierToOff:`until off-peak`,tierAlertEnterPeak:`Peak pricing (2x) starts in {minutes} min — non-urgent calls can wait`,tierAlertEnterOff:`Off-peak pricing (50% off) starts in {minutes} min`,tierAlertEnterPeakZhipu:`Zhipu peak hours in {minutes} min — Coding Plan credits burn at full rate`,tierAlertEnterOffZhipu:`Zhipu off-peak in {minutes} min — credit burn drops to 50%`,peakAlertTitlePeak:`Peak pricing incoming`,peakAlertTitleOff:`Off-peak incoming`,peakAlert:`Peak/off-peak alert`,peakAlertLeadMin:`Lead time (min)`,peakAlertPos:`Position`,peakAlertMode:`Remind mode`,peakAlertPosCorner:`Bottom-right`,peakAlertPosCenter:`Center`,peakAlertModePeak:`Entering peak only`,peakAlertModeOff:`Entering off-peak only`,peakAlertModeBoth:`Both`,peakAlertWebNotify:`Also send system notification`,peakAlertPreview:`Preview alert`,planTypeCode:`Subscription`,planTypeToken:`Usage`,subscriptionFeePerMonth:`{amount}/mo`,triggerToday:`Today`,triggerMonth:`This month`,triggerMonthTokens:`Monthly tokens`,triggerTodayTokens:`Today's tokens`,triggerWeekTokens:`This week's tokens`,subscriptionTag:`Plan`,free:`Free`,perfSamples:`Samples`,perfTtft:`TTFT`,perfP50:`P50`,perfP90:`P90`,perfTps:`Speed`,perfLatency:`Total latency`,perfEstimated:`Estimated`,perfEmpty:`No performance data yet`,perfTpsUnit:`tok/s`,perfTitle:`Performance`,perfHint:`Per model & per hour; estimated samples are tool-continuation steps`,perfAll:`All`,perfChartEmpty:`No model selected or no data for this metric`,heatmapYear:`Year`,heatmapMonth:`Month`,activeDays:`Active days`,streakDays:`Streak`,subscriptionAutoDetect:`Auto`,pluginAuthor:`Author`,pluginRepository:`Repository`,pluginNpm:`npm`,pluginLicense:`License`,tabToken:`Usage`,tokenExport:`Export tokens`,tokenExportCsv:`Daily token CSV`,tokenReasoningShare:`Reasoning share`,tokenReasoningShort:`reasoning`,tokenIo:`In/out ratio`,tokenPeak:`Peak day`,tokenDaily:`Daily tokens`,tokenByModel:`Tokens by model`,tokenMiss:`Input (cache miss)`,tokenHit:`Input (cache hit)`,tokenOutput:`Output`,tokenViewStructure:`Structure`,tokenViewModel:`By model`,tokenHitShort:`Hit`,tokenMissShort:`Miss`,tokenTotal:`Total tokens`,tokenShare:`Share`,usageStatsTool:`Inject usage-stats tool`,usageStatsToolHint:`Lets the model query usage/cost inside a conversation; it consumes context per request, so keep it off for coding (takes effect after a reload)`,balanceGranted:`Granted`,balanceTopped:`Topped up`,balanceDaily:`Daily burn`,balanceDaysLong:`~days left`,balanceDaysUnit:`days`,popTodayModel:`Main model balance`,popTitle:`Usage overview`,popNoConsumption:`No usage yet`,popDirectLead:`Direct`,popSubLead:`Subscription`,unpricedHint:`{count} models not priced; their cost counts as 0`,searchEstimateHint:`Includes estimated cost of {count} web-search requests (~{each} each; no usage events logged, per-call estimate; tune via searchCallEstimateCny)`,siteListDisplay:`Relay lists`,siteListDisplayHint:`Hide "unidentified" placeholder rows in the relay quota list`,liveCostBar:`Live cost capsule`,liveCostBarHint:`Live cost bar beside the composer; hover for details`,liveCostBarPosition:`Position`,liveCostBarPosBelow:`Below composer`,liveCostBarPosAbove:`Above composer`,liveCostBarPosToolbar:`Inside composer`,exportCsvSite:`By site CSV`,panelRelayQuota:`Relay quotas`,relayBalance:`Balance`,relayNoQuota:`No quota`,relayWindowUsed:`used`,relayKindNewApi:`New API`,relayKindSub2Api:`Sub2API`,relayKindUnknown:`Unknown`},Gt={"智谱 AI":`Zhipu AI`,阿里通义:`Alibaba Qwen`,字节豆包:`ByteDance Doubao`,月之暗面:`Moonshot AI`,小米:`Xiaomi`,百度文心:`Baidu ERNIE`,腾讯混元:`Tencent Hunyuan`,零一万物:`01.AI`,阶跃星辰:`StepFun`,科大讯飞:`iFlytek Spark`,商汤:`SenseNova`,百川智能:`Baichuan`,"小米 Token Plan(海外)":`Xiaomi Token Plan (Global)`,"小米 Token Plan(国内)":`Xiaomi Token Plan (CN)`,"小米 Token Plan(新加坡)":`Xiaomi Token Plan (SG)`,"火山引擎 Token Plan":`Volcengine Token Plan`,"火山方舟 Token Plan":`Volcengine Ark Token Plan`,"豆包 Token Plan":`Doubao Token Plan`,"百度文心 Plan":`Baidu ERNIE Plan`,"MiniMax Token Plan(国内)":`MiniMax Token Plan (CN)`};function Kt(e,t){return t===`en`?Gt[e]??e:e}let qt={"https://tokenhub.tencentmaas.com":`腾讯云 TokenHub`,"https://api.lkeap.cloud.tencent.com":`腾讯云 Token Plan`,"https://api.deepseek.com":`DeepSeek 官方`},Jt={"腾讯云 TokenHub":`Tencent Cloud TokenHub`,"腾讯云 Token Plan":`Tencent Cloud Token Plan`,"DeepSeek 官方":`DeepSeek Official`};function Yt(e){try{return new URL(e).host}catch{return e}}function Xt(e,t=`zh`){if(e.startsWith(`site:`)){let n=e.slice(5),r=qt[n];return r===void 0?Yt(n):t===`en`?Jt[r]??r:r}if(e.startsWith(`direct:`)){let n=e.slice(7);return/^deepseek(?:-[a-z0-9-]+)?$/i.test(n)?t===`en`?`DeepSeek Official`:`DeepSeek 官方`:`${t===`en`?`Direct`:`直连`} · ${n}`}}let Zt=[`直连 · `,`Direct · `];function Qt(e){for(let t of Zt)if(e.startsWith(t))return e.slice(t.length)}let $t=`dsh-billing-peak-alert-v1`,en={enabled:!1,leadMin:2,position:`bottom-right`,webNotify:!0,mode:`both`};function tn(){try{let e=localStorage.getItem($t);if(e===null)return{...en};let t=JSON.parse(e),n=t.mode===`peak`||t.mode===`offPeak`?t.mode:en.mode,r=t.position===`center`?`center`:`bottom-right`;return{enabled:t.enabled===!0,leadMin:typeof t.leadMin==`number`&&Number.isFinite(t.leadMin)?Math.min(30,Math.max(1,Math.round(t.leadMin))):en.leadMin,position:r,webNotify:t.webNotify!==!1,mode:n}}catch{return{...en}}}function nn(e){try{localStorage.setItem($t,JSON.stringify(e))}catch{}}function rn(e,t,n,r){if(!t.enabled)return null;let i=Ne(e,r,t.leadMin*6e4);return i===null||t.mode===`peak`&&i.entering!==`peak`||t.mode===`offPeak`&&i.entering!==`offPeak`||i.atMs===n?null:{...i,channel:r}}function an({hit:e,config:t,t:n,onDismiss:i}){let[a,s]=(0,r.useState)(()=>Date.now());if((0,r.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]),(0,r.useEffect)(()=>{a>=e.atMs&&i()},[a,e.atMs,i]),a>=e.atMs)return null;let c=Math.max(1,Math.round((e.atMs-a)/6e4)),l=e.entering,u=n(l===`peak`?`tierPeak`:`tierOff`),f=n(e.channel===`zhipu-coding-plan`?l===`peak`?`peakAlertDescPeakZhipu`:`peakAlertDescOffZhipu`:l===`peak`?`peakAlertDescPeak`:`peakAlertDescOff`),p=l===`peak`;return(0,o.jsxs)(`div`,{className:d(P.peakCard,p?P.peakCardPeak:P.peakCardOff,t.position===`center`?P.peakCardCenter:P.peakCardCorner),"data-testid":`billing-peak-alert`,role:`alert`,children:[(0,o.jsxs)(`div`,{className:P.peakHead,children:[(0,o.jsxs)(`span`,{className:d(P.peakTag,p?P.peakTagPrimary:P.peakTagSuccess),children:[(0,o.jsx)(`span`,{className:d(P.peakDot,p?P.peakDotPrimary:P.peakDotSuccess),"aria-hidden":`true`}),u]}),(0,o.jsx)(`button`,{type:`button`,className:P.peakClose,onClick:i,"aria-label":n(`close`),children:`×`})]}),(0,o.jsxs)(`div`,{className:d(P.peakCount,p?P.peakCountPrimary:P.peakCountSuccess),children:[c,`min`]}),(0,o.jsx)(`p`,{className:P.peakDesc,children:f})]})}let on=[{id:`overview`,labelKey:`tabOverview`},{id:`providers`,labelKey:`tabProviders`},{id:`token`,labelKey:`tabToken`},{id:`trends`,labelKey:`tabTrends`},{id:`pricing`,labelKey:`tabPricing`},{id:`settings`,labelKey:`tabSettings`}],sn=[50,80,100],cn={checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]},ln={DeepSeek:[`deepseek`],"智谱 AI":[`zhipu`,`glm`,`z.ai`],阿里通义:[`qwen`,`tongyi`,`dashscope`,`aliyun`],字节豆包:[`doubao`,`volcengine`,`ark`],月之暗面:[`moonshot`,`kimi`],小米:[`xiaomi`,`mi`,`mimo`],MiniMax:[`minimax`],百度文心:[`ernie`,`wenxin`,`qianfan`,`baidu`],腾讯混元:[`hunyuan`,`tencent`],零一万物:[`01.ai`,`lingyi`,`yi`],阶跃星辰:[`step`,`stepfun`,`step-3.7`],科大讯飞:[`spark`,`xfyun`,`iflytek`],商汤:[`sensenova`,`sensetime`],百川智能:[`baichuan`],OpenAI:[`openai`],Google:[`google`,`gemini`],xAI:[`xai`,`grok`],Meta:[`meta`,`llama`],Anthropic:[`claude`,`anthropic`],"Mistral AI":[`mistral`,`ministral`,`devstral`],Cohere:[`cohere`,`command`],美团:[`longcat`,`meituan`],面壁智能:[`minicpm`,`modelbest`],小红书:[`dots`,`rednote`,`xiaohongshu`]};function Q(e){return e.trim().toLowerCase().replace(/[\s_/-]+/g,``)}function un(e,t){if(e.length===0||t.length===0)return!1;if(e===t)return!0;let[n,r]=e.length<=t.length?[e,t]:[t,e];return n.length>=3&&r.includes(n)}function dn(e,t){let n=Q(e),r=Q(t);if(un(n,r))return!0;let i=ln[e];return i!==void 0&&i.some(e=>un(Q(e),r))}function fn(e){let t=e.trim().toLowerCase(),n=t.replace(/[\s_/-]+/g,``);if(n.length!==0){for(let[e,n]of Object.entries(ln))for(let r of n){let n=Q(r);if(n.length!==0&&(t===n||t.startsWith(`${n}-`)||t.startsWith(`${n}/`)||t.startsWith(`${n}_`)||t.includes(`${n}-`)||t.includes(`${n}/`)||t.includes(`${n}_`)))return e}for(let[e,t]of Object.entries(ln))for(let r of t){let t=Q(r);if(!(t.length<4)&&n.includes(t))return e}}}let pn={"kimi-coding":`月之暗面`,"zai-coding-cn":`智谱 AI`,"zai-coding":`智谱 AI`,"qwen-token-plan":`阿里通义`,"qwen-token-plan-cn":`阿里通义`,"xiaomi-token-plan-ams":`小米`,"xiaomi-token-plan-cn":`小米`,"xiaomi-token-plan-sgp":`小米`,"volcengine-token-plan":`字节豆包`,"ark-token-plan":`字节豆包`,"doubao-token-plan":`字节豆包`,ernie:`百度文心`,baidu:`百度文心`,wenxin:`百度文心`,minimax:`MiniMax`,"minimax-cn":`MiniMax`,"minimax-token-plan":`MiniMax`,"minimax-token-plan-cn":`MiniMax`,"hunyuan-token-plan":`腾讯混元`,"tencent-token-plan":`腾讯混元`,"hy-token-plan":`腾讯混元`,"xinghuo-token-plan":`讯飞星火`,"xfyun-coding":`讯飞星火`,"spark-coding":`讯飞星火`,"huawei-token-plan":`华为云`,"pangu-token-plan":`华为云`,"huawei-maas-token-plan":`华为云`,"volcengine-agent-plan":`字节豆包`,"ark-agent-plan":`字节豆包`,"baidu-token-plan":`百度文心`,"ernie-token-plan":`百度文心`,"wenxin-token-plan":`百度文心`,opencode:`OpenCode`,"opencode-go":`OpenCode`};function mn(e){let t=pn[e];return t===void 0?fn(e)??e:t}let hn=`https://platform.kimi.com/console/pay`,gn=`https://open.bigmodel.cn/finance-center/finance/pay`,_n=`https://bailian.console.aliyun.com/`,vn=`https://console.volcengine.com/ark`,yn=`https://console.anthropic.com/settings/billing`,bn=`https://console.cloud.google.com/billing`,xn=`https://console.x.ai/`,Sn=`https://platform.xiaomimimo.com/console/balance`,Cn=`https://console.cloud.tencent.com/expense/recharge`,wn={deepseek:`https://platform.deepseek.com/top_up`,minimax:`https://platform.minimax.cn/console/recharge-records`,moonshot:hn,kimi:hn,zhipu:gn,bigmodel:gn,qwen:_n,dashscope:_n,doubao:vn,volcengine:vn,ark:vn,openai:`https://platform.openai.com/settings/organization/billing`,anthropic:yn,claude:yn,google:bn,gemini:bn,xai:xn,grok:xn,siliconflow:`https://cloud.siliconflow.cn/account/charge`,hunyuan:Cn,tencent:Cn,腾讯云:Cn,xiaomi:Sn,mimo:Sn,mi:Sn,qianfan:`https://console.bce.baidu.com/qianfan/overview`};function Tn(e){let t=wn[e];if(t!==void 0)return t;let n=Object.keys(wn).find(t=>e.startsWith(t));return n===void 0?void 0:wn[n]}function En(e){let t=Q(e),n=Tn(t);if(n!==void 0)return n;for(let[e,n]of Object.entries(ln))if(un(Q(e),t))for(let e of n){let t=Tn(Q(e));if(t!==void 0)return t}}function Dn(e,t){let n=Object.keys(e).filter(e=>e<=t).sort().slice(-7);return n.length===0?0:n.reduce((t,n)=>t+(e[n]?.cost??0),0)/n.length}function On(e,t,n){let r=Object.keys(e).filter(e=>e.startsWith(t)),i=t.split(`-`),a=new Date(Number(i[0]),Number(i[1]),0).getDate(),o=r.length>0?r.reduce((t,n)=>t+(e[n]?.cost??0),0)/r.length:Dn(e,n);return o<=0?0:o*a}function kn(e){let t=_e();if(t===void 0||e.byDayModels===void 0)return e;let n=we().rate,r=e.byDayModelsSite!==void 0,i={},a={},o=new Map,s=0,c=e=>t.some(t=>t.origin!==void 0&&t.origin!==``&&(t.key===e||H(t.key)===H(e))),l=(e,t,r)=>{if(e===void 0)return r;let i=Math.min(t.cacheHit,t.cacheMiss+t.cacheHit),a=r=>{let a=(t.cacheMiss*r.input+i*r.cacheHit+t.output*r.output)/1e6;return e.currency===`USD`?a*n:a};return e.offPeak===void 0?a(e):a(e)*Te+a(e.offPeak)*(1-Te)};for(let[t,n]of Object.entries(e.byDayModels)){let u=0,d={};for(let[i,a]of Object.entries(n)){let n=ve(i)??be(i),s=r&&c(i),f;if((n!==void 0||s)&&s&&e.byDayModelsSite?.[t]?.[i]!==void 0){let r=0;for(let[a,o]of Object.entries(e.byDayModelsSite[t][i])){let e=a.startsWith(`site:`)?a.slice(5):void 0,t=e===void 0?void 0:ve(i,e);r+=l(t??n,o,o.cost)}f=r}else f=l(n,a,a.cost);u+=f,d[i]={...a,cost:f},o.set(i,(o.get(i)??0)+f)}let f=e.byDay[t];f!==void 0&&(i[t]={...f,cost:u}),a[t]=d,s+=u}return{...e,total:{...e.total,cost:s},byDay:i,byDayModels:a,byModel:Object.fromEntries(Object.entries(e.byModel).map(([e,t])=>{let n=o.get(e);return[e,n===void 0?t:{...t,cost:n}]})),unpricedModels:(e.unpricedModels??[]).filter(e=>!ve(e)&&!be(e))}}function An(){return typeof Notification<`u`&&Notification.permission===`granted`}let jn=new Set;function Mn(e,t){jn.has(e)||(jn.add(e),fetch(`/api/billing/notify-claim`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e})}).then(e=>e.json()).then(e=>{e.claimed!==!1&&t()}).catch(()=>t()))}function Nn(e){return Object.keys(e).length}function Pn(e,t=Date.now()){let n=0,r=new Date(t);for(;$(r.getTime())in e;)n+=1,r.setDate(r.getDate()-1);return n}function Fn(e){let t=[];for(let n=6;n>=0;--n){let r=new Date;r.setDate(r.getDate()-n);let i=$(r.getTime());t.push({date:i,cost:e[i]?.cost??0})}return t}function In(e,t,n=e=>e.cost){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=0;for(let t=0;t<=i;t+=1){let i=new Date(r);i.setDate(i.getDate()-t);let o=e[$(i.getTime())];o!==void 0&&(a+=n(o))}return a}function Ln(e,t,n){let r=new Date(`${t}T00:00:00`),i=(r.getDay()+6)%7,a=new Date(r);a.setDate(a.getDate()-i);let o=$(a.getTime()),s=new Date(r);s.setDate(s.getDate()-6);let c=$(s.getTime()),l=0,u=0,d=0,f=0,p=0,m=0,h=0,g,_=0;for(let[r,i]of Object.entries(e)){if(!(n===`today`?r===t:n===`7d`?r>=c&&r<=t:n===`week`?r>=o&&r<=t:r.startsWith(t.slice(0,7))))continue;l+=i.cost,u+=i.calls,d+=i.input,f+=i.output,p+=i.cacheHit,m+=i.cacheMiss,h+=i.reasoning??0;let e=i.cacheMiss+i.cacheHit+i.output;e>_&&(_=e,g=r)}return{cost:l,calls:u,input:d,output:f,cacheHit:p,cacheMiss:m,reasoning:h,peakDay:g,peakTokens:_}}function Rn(e,t){return e.checked?e.okProviders.some(e=>dn(t,e))?P.healthOk:e.badProviders.some(e=>dn(t,e))?P.healthBad:P.healthIdle:P.healthIdle}function zn(e){let t=new Map,n=[];for(let r of e){if(r.title===void 0||r.title===``){n.push(r);continue}let e=t.get(r.title);if(e===void 0){let e={...r,mergedCount:1};t.set(r.title,e),n.push(e);continue}e.children===void 0&&(e.children=[{...e}]),e.children.push({...r}),e.calls+=r.calls,e.cost+=r.cost,e.lastActive=Math.max(e.lastActive,r.lastActive),r.stale===!0&&(e.stale=!0),e.mergedCount=(e.mergedCount??1)+1}return n.sort((e,t)=>t.cost-e.cost||t.lastActive-e.lastActive)}function Bn(e,t){switch(e){case`ok`:return``;case`not-configured`:return t(`subscriptionNotConfigured`);case`unauthorized`:return t(`subscriptionUnauthorized`);case`rate-limited`:return t(`subscriptionRateLimited`);case`invalid-response`:return t(`subscriptionInvalid`);default:return t(`subscriptionUnavailable`)}}function Vn(e,t){switch(e){case`session`:return t(`subscriptionSession`);case`weekly`:return t(`subscriptionWeekly`);case`monthly`:return t(`subscriptionMonthly`);case`billing`:return t(`subscriptionBilling`)}}function Hn(e,t){switch(e){case`new-api`:return t(`relayKindNewApi`);case`sub2api`:return t(`relayKindSub2Api`);default:return t(`relayKindUnknown`)}}let Un={"new-api":P.siteKindSite,sub2api:P.siteKindDirect,unknown:P.siteKindUnknown},Wn=3e4;function $(e=Date.now()){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Gn(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}let Kn=[`#4f8cff`,`#2dd4bf`,`#a78bfa`,`#f59e0b`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#6366f1`,`#f97316`,`#14b8a6`],qn={total:{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0,reasoning:0},byModel:{},byDay:{},byDayModels:{}};async function Jn(){try{let e=await fetch(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n||!(`total`in n))return null;let r=n,i=e=>typeof e==`object`&&!!e;return{total:r.total??qn.total,byModel:r.byModel??{},byDay:r.byDay??{},...r.byDayModels===void 0?{}:{byDayModels:r.byDayModels},...i(r.byDayModelsSite)?{byDayModelsSite:r.byDayModelsSite}:{},...r.updatedAt===void 0?{}:{updatedAt:r.updatedAt},...typeof r.budget==`number`?{budget:r.budget}:{},...typeof r.lowBalanceThreshold==`number`?{lowBalanceThreshold:r.lowBalanceThreshold}:{},...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{},...Array.isArray(r.byWorkspace)?{byWorkspace:r.byWorkspace}:{},...i(r.bySite)?{bySite:r.bySite}:{},...i(r.byTier)?{byTier:r.byTier}:{},...i(r.byTool)?{byTool:r.byTool}:{},...Array.isArray(r.unpricedModels)?{unpricedModels:r.unpricedModels}:{},...typeof r.staleLedgerSessions==`number`?{staleLedgerSessions:r.staleLedgerSessions}:{},...typeof r.searchCallEstimateCny==`number`?{searchCallEstimateCny:r.searchCallEstimateCny}:{},...r.byRole!==null&&typeof r.byRole==`object`?{byRole:r.byRole}:{},...r.perf!==null&&typeof r.perf==`object`&&r.perf.byModel!==null&&typeof r.perf.byModel==`object`&&r.perf.byHourModel!==null&&typeof r.perf.byHourModel==`object`?{perf:r.perf}:{},...typeof r.pluginVersion==`string`?{pluginVersion:r.pluginVersion}:{}}}catch{return null}}let Yn=!1;async function Xn(e=0){try{let t=await fetch(`/api/billing/pricing`);if(!t.ok){Yn=!1;return}let n=await t.text(),r=JSON.parse(n);if(typeof r!=`object`||!r||!(`source`in r)){Yn=!1;return}let i=r;if(i.source===`builtin`&&e<3){if(e===0){if(Yn)return;Yn=!0}setTimeout(()=>{Xn(e+1)},2e3);return}Yn=!1,xe(i)}catch{Yn=!1}}async function Zn(){try{let e=await fetch(`/api/billing/balance`);if(!e.ok)return{balances:[]};let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return{balances:[]};let r=n;return{balances:Array.isArray(r.balances)?r.balances:[],...r.reconcile===void 0?{}:{reconcile:r.reconcile}}}catch{return{balances:[]}}}async function Qn(){let e=await fetch(`/api/billing/subscriptions`);if(!e.ok)throw Error(`subscriptions HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n)return n.quotas;throw Error(`subscriptions: invalid response`)}async function $n(){let e=await fetch(`/api/billing/relay-quotas`);if(!e.ok)throw Error(`relay-quotas HTTP ${String(e.status)}`);let t=await e.text(),n=JSON.parse(t);if(typeof n==`object`&&n&&`quotas`in n)return n.quotas;throw Error(`relay-quotas: invalid response`)}async function er(){try{let e=await fetch(`/api/billing/usage-tool`);if(!e.ok)return;let t=JSON.parse(await e.text());return typeof t.enabled==`boolean`?t.enabled:void 0}catch{return}}async function tr(e){try{let t=await fetch(`/api/billing/usage-tool`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:e})});return t.ok?JSON.parse(await t.text()).ok===!0:!1}catch{return!1}}let nr=e=>e.models.reduce((e,t)=>e+(t.actual??(t.plan===!0?0:t.estimated)),0);function rr(e){let{wide:t,t:n,onOpen:a,monthCost:s,todayCost:c,weekCost:l,days:u,vendorStatus:f,dash:p,floatPrefs:m,subscriptions:h,cardPrefs:g,monthTokens:_,todayTokens:v,weekTokens:y,budgetPressure:b}=e,x=(0,r.useMemo)(()=>m.targets.map(e=>h.find(t=>t.provider===e)).filter(e=>e!==void 0),[m.targets,h]),[S,C]=(0,r.useState)(0),w=x.length===0?0:Math.min(S,x.length-1),T=x[w];(0,r.useEffect)(()=>{if(m.mode!==`subscription`||x.length<2)return;let e=setInterval(()=>C(e=>(e+1)%x.length),1500);return()=>clearInterval(e)},[m.mode,x.length]);let ee=(0,r.useRef)(null),[E,D]=(0,r.useState)(!1),[O,te]=(0,r.useState)({left:0,top:0}),k=(0,r.useRef)(void 0),A=(0,r.useCallback)(()=>{window.clearTimeout(k.current),D(!0)},[]),j=(0,r.useCallback)(()=>{window.clearTimeout(k.current),k.current=window.setTimeout(()=>D(!1),120)},[]);(0,r.useEffect)(()=>()=>window.clearTimeout(k.current),[]);let ne=(0,r.useCallback)(()=>{let e=ee.current?.getBoundingClientRect();e!==void 0&&te({left:e.left,top:e.top-8})},[]);(0,r.useEffect)(()=>{if(!E)return;let e=()=>ne();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[E,ne]);let re=u.length>0?u.reduce((e,t)=>e+t.cost,0)/u.length:0,ie=re>0?Math.max(0,Math.min(1,c/re)):0,ae=-80+ie*160,M=(0,o.jsxs)(`svg`,{viewBox:`0 0 40 40`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,opacity:.16}),(0,o.jsx)(`path`,{d:`M5.23 26.4A15 15 0 0 1 34.77 26.4`,strokeWidth:3,strokeDasharray:`${(41.9*ie).toFixed(2)} 41.9`,className:P.triggerGaugeArc}),(0,o.jsx)(`path`,{d:`M5.23 26.4 8.18 26.92M10.36 17.51 12.29 19.81M20 14v3M27.71 19.81 29.64 17.51M31.82 26.92 34.77 26.4`,strokeWidth:1.6,opacity:.7}),(0,o.jsx)(`path`,{d:`M7.01 21.5 8.31 22.25M14.87 14.91 15.38 16.31M24.62 16.31 25.13 14.91M31.69 22.25 32.99 21.5`,strokeWidth:1.2,opacity:.38}),(0,o.jsx)(`line`,{x1:`20`,y1:`29`,x2:`20`,y2:`19.5`,strokeWidth:2,className:P.triggerGaugeNeedle,style:{transform:`rotate(${ae}deg)`,transformOrigin:`20px 29px`}}),(0,o.jsx)(`circle`,{cx:`20`,cy:`29`,r:`1.5`,fill:`currentColor`,stroke:`none`})]});if(!t)return(0,o.jsx)(`button`,{type:`button`,className:d(P.railButton,b!==`none`&&P.triggerBudgetPulse,b===`over`&&P.triggerBudgetOver),"data-testid":`billing-rail-button`,onClick:a,title:`${n(`title`)} · ${K(g.span===`day`?c:g.span===`week`?l:s)}`,children:M});let N=g.metric===`tokens`,F=u.map(e=>N?e.tokens:e.cost),I=Math.max(...F,0),oe=F.map(e=>I>0?4+e/I*12:4);return(0,o.jsxs)(`span`,{ref:ee,className:P.triggerWrap,onMouseEnter:()=>{ne(),A()},onMouseLeave:j,onFocusCapture:()=>{ne(),A()},onBlurCapture:()=>D(!1),children:[(0,o.jsxs)(`button`,{type:`button`,className:d(P.trigger,b!==`none`&&P.triggerBudgetPulse,b===`over`&&P.triggerBudgetOver),"data-testid":`billing-trigger`,onClick:a,title:`${n(`title`)} · ${K(g.span===`day`?c:g.span===`week`?l:s)}`,children:[(0,o.jsx)(`span`,{className:d(P.triggerIcon,b!==`none`&&P.triggerBudgetHot),"data-testid":`billing-trigger-icon`,children:M}),(0,o.jsx)(`span`,{className:P.triggerMain,children:(0,o.jsxs)(`span`,{className:P.triggerPrimary,children:[(0,o.jsx)(`span`,{className:P.triggerLabel,children:N?g.span===`day`?n(`triggerTodayTokens`):g.span===`week`?n(`triggerWeekTokens`):n(`triggerMonthTokens`):g.span===`day`?n(`triggerToday`):g.span===`week`?n(`weekCost`):n(`triggerMonth`)}),(()=>{let e=g.span===`day`?N?v:c:g.span===`week`?N?y:l:N?_:s;return N?(0,o.jsx)(`span`,{className:P.triggerMetric,"data-testid":`billing-trigger-span-tokens`,children:q(e)}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.triggerYen,"aria-hidden":`true`,children:K(e).charAt(0)}),(0,o.jsx)(`span`,{className:P.triggerMetric,"data-testid":`billing-trigger-span-money`,children:K(e).slice(1)})]})})()]})}),(0,o.jsx)(`span`,{className:P.triggerSpark,"data-testid":`billing-trigger-spark`,"aria-hidden":`true`,children:oe.map((e,t)=>(0,o.jsx)(`span`,{className:t===oe.length-1?P.triggerSparkHot:P.triggerSparkBar,style:{height:`${e}px`}},u[t]?.date??String(t)))})]}),(0,i.createPortal)((0,o.jsx)(`span`,{className:d(P.triggerPop,E&&P.triggerPopShown),style:{left:`${O.left}px`,top:`${O.top}px`},"data-testid":`billing-trigger-pop`,"aria-hidden":!E,onMouseEnter:A,onMouseLeave:j,children:m.mode===`subscription`?(0,o.jsx)(o.Fragment,{children:x.length===0?(0,o.jsx)(`span`,{className:P.triggerPopEmpty,children:n(`floatNoTargets`)}):(0,o.jsxs)(o.Fragment,{children:[T!==void 0&&(0,o.jsxs)(`div`,{className:P.floatSub,"data-testid":`billing-float-subscription`,children:[(0,o.jsxs)(`div`,{className:P.floatSubHead,children:[(0,o.jsx)(`span`,{className:P.floatSubName,children:T.displayName}),T.plan!==void 0&&(0,o.jsx)(`span`,{className:P.floatSubPlan,children:T.plan})]}),T.windows.map(e=>(()=>{let t=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:P.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:P.subscriptionWindowLabel,children:Vn(e.kind,n)}),(0,o.jsx)(`span`,{className:P.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(P.subscriptionFill,t>=100&&P.subscriptionFillOver,t>=80&&t<100&&P.subscriptionFillWarn),style:{width:`${t}%`}})}),(0,o.jsxs)(`span`,{className:P.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(P.subscriptionPct,r&&P.subscriptionExhausted),children:r?n(`subscriptionExhausted`):n(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionReset,children:n(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${Gn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]}),x.length>1&&(0,o.jsx)(`span`,{className:P.triggerPopSwitcher,"data-testid":`billing-float-switcher`,children:(0,o.jsxs)(`span`,{className:P.triggerPopSwitchCount,children:[w+1,`/`,x.length]})})]})}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.popHead,children:(0,o.jsx)(`span`,{className:P.popTitle,children:n(`popTitle`)})}),(0,o.jsxs)(`span`,{className:P.metricGrid,children:[(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`floatPrimaryToday`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:K(c)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`floatPrimaryWeek`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:K(l)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`floatPrimaryMonth`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:K(s)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`input`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:q(p.input)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`output`)}),(0,o.jsx)(`span`,{className:P.metricValue,children:q(p.output)})]}),(0,o.jsxs)(`span`,{className:P.metricCell,children:[(0,o.jsx)(`span`,{className:P.metricLabel,children:n(`cacheHit`)}),(0,o.jsx)(`span`,{className:d(P.metricValue,P.metricValueSuccess),children:Ze(p.cacheRead+p.cacheMiss>0?p.cacheRead/(p.cacheRead+p.cacheMiss)*100:0)})]})]}),(0,o.jsxs)(`span`,{className:P.popModel,children:[(0,o.jsx)(`span`,{className:P.popModelLabel,children:n(`popTodayModel`)}),f.direct!==void 0||f.sub!==void 0?(0,o.jsxs)(o.Fragment,{children:[f.direct!==void 0&&(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotDirect),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popTagPrimary,children:n(`popDirectLead`)}),(0,o.jsx)(`span`,{className:P.popModelName,children:f.direct.name}),(0,o.jsx)(`span`,{className:d(P.popModelStatus,f.direct.low&&P.popModelStatusLow),children:f.direct.text})]}),f.sub!==void 0&&(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotSub),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popTagSub,children:n(`popSubLead`)}),(0,o.jsx)(`span`,{className:P.popModelName,children:f.sub.name}),(0,o.jsx)(`span`,{className:d(P.popModelStatus,f.sub.low&&P.popModelStatusLow),children:f.sub.text})]})]}):(0,o.jsxs)(`span`,{className:P.popModelRow,children:[(0,o.jsx)(`span`,{className:d(P.popDot,P.popDotNeutral),"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:P.popModelStatus,children:n(`popNoConsumption`)})]})]})]})}),document.body)]})}function ir({balance:e,days:t,dailyBurn:n,money:r,t:i,onClose:a}){let s=t=>t===void 0?void 0:e.currency===`USD`?`$${t.toFixed(2)}`:r(t),c=s(e.totalBalance),l=s(e.grantedBalance),u=s(e.toppedUpBalance);return(0,o.jsxs)(`span`,{className:P.balanceDetailPop,"data-testid":`billing-balance-detail-pop`,children:[(0,o.jsxs)(`span`,{className:P.balanceDetailHead,children:[(0,o.jsx)(`span`,{className:P.balanceDetailTitle,children:e.displayName}),(0,o.jsx)(`button`,{type:`button`,className:P.balanceDetailClose,"aria-label":i(`close`),onClick:a,children:`×`})]}),(0,o.jsxs)(`span`,{className:P.balanceDetailGrid,children:[c!==void 0&&(0,o.jsx)(ar,{label:i(`balance`),value:c}),l!==void 0&&(0,o.jsx)(ar,{label:i(`balanceGranted`),value:l}),u!==void 0&&(0,o.jsx)(ar,{label:i(`balanceTopped`),value:u}),(0,o.jsx)(ar,{label:i(`balanceDaily`),value:r(n)}),(0,o.jsx)(ar,{label:i(`balanceDaysLong`),value:`${t} ${i(`balanceDaysUnit`)}`})]})]})}function ar({label:e,value:t}){return(0,o.jsxs)(`span`,{className:P.balanceDetailRow,children:[(0,o.jsx)(`span`,{className:P.balanceDetailLabel,children:e}),(0,o.jsx)(`span`,{className:P.balanceDetailValue,children:t})]})}function or({userPrices:e,onUserPrices:t,t:n}){let[i,a]=(0,r.useState)(()=>[...e]),[s,c]=(0,r.useState)(new Set),l=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),u=()=>{a(e=>e.filter((e,t)=>!s.has(t))),c(new Set)},f=(e,t)=>a(n=>n.map((n,r)=>r===e?{...n,...t}:n)),p=()=>a(e=>[...e,{key:``,input:0,cacheHit:0,output:0}]),m=e=>{let t=i[e]?.offPeak;return{input:t===void 0?``:String(t.input),cacheHit:t===void 0?``:String(t.cacheHit),output:t===void 0?``:String(t.output)}},h=(e,t,n)=>a(r=>r.map((r,i)=>{if(i!==e)return r;let a={...m(e),[t]:n},o=[a.input,a.cacheHit,a.output].some(e=>e.trim()!==``),s=[a.input,a.cacheHit,a.output].map(e=>Number(e)),c=o&&s.every(e=>Number.isFinite(e)&&e>=0)&&s.some(e=>e>0),{offPeak:l,...u}=r;return c?{...u,offPeak:{input:s[0]??0,cacheHit:s[1]??0,output:s[2]??0}}:u})),g=()=>t(i.filter(e=>e.key.trim()!==``).map(e=>({...e,key:e.key.trim(),...e.origin===void 0||e.origin.trim()===``?{}:{origin:me(e.origin.trim())}}))),_=Ge().map(e=>e.key),v=(e,t)=>a(n=>n.map((n,r)=>{if(r!==e)return n;let{currency:i,...a}=n;return t===`USD`?{...a,currency:`USD`}:a})),y=e=>Number.isFinite(e)&&e!==0?String(e):``,b=(e,t,n)=>{let r=Number(n);f(e,{[t]:Number.isFinite(r)&&r>=0?r:0})};return(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-user-prices`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:n(`userPrices`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:n(`userPricesHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsx)(`datalist`,{id:`billing-price-model-keys`,children:_.map(e=>(0,o.jsx)(`option`,{value:e},e))}),i.map((e,t)=>(0,o.jsxs)(`div`,{className:P.userPriceRow,"data-testid":`billing-user-price-row`,children:[(0,o.jsx)(`input`,{type:`checkbox`,className:P.userPriceCheck,"data-testid":`billing-user-price-select`,checked:s.has(t),"aria-label":n(`userPriceSelect`),onChange:()=>l(t)}),(0,o.jsxs)(`div`,{className:P.userPriceBody,children:[(0,o.jsxs)(`div`,{className:P.userPriceLineMeta,children:[(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceModel`)}),(0,o.jsx)(`input`,{className:P.userPriceInput,"data-testid":`billing-user-price-model`,type:`text`,list:`billing-price-model-keys`,value:e.key,placeholder:`flash`,"aria-label":n(`userPriceModel`),onChange:e=>f(t,{key:e.target.value})})]}),(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceSource`)}),(0,o.jsx)(`input`,{className:P.userPriceInput,"data-testid":`billing-user-price-origin`,type:`text`,value:e.origin??``,placeholder:n(`userPriceSourceHint`),"aria-label":n(`userPriceSource`),onChange:e=>f(t,{origin:e.target.value.trim()})})]}),(0,o.jsxs)(`div`,{className:P.userPriceField,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceCurrency`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,e.currency!==`USD`&&P.floatModeBtnOn),onClick:()=>v(t,`CNY`),children:`CNY`}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,e.currency===`USD`&&P.floatModeBtnOn),onClick:()=>v(t,`USD`),children:`USD`})]})]})]}),(0,o.jsxs)(`div`,{className:P.userPricePriceLine,"data-testid":`billing-user-price-normal`,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceNormal`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:P.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceNormal`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:y(e[r]),onChange:e=>b(t,r,e.target.value)},r))]}),(()=>{let e=m(t);return(0,o.jsxs)(`div`,{className:P.userPricePriceLine,"data-testid":`billing-user-price-offpeak`,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:n(`userPriceOffPeak`)}),[`input`,`cacheHit`,`output`].map(r=>(0,o.jsx)(`input`,{className:P.userPriceInputNum,type:`number`,min:0,step:.01,placeholder:n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`),"aria-label":`${n(`userPriceOffPeak`)} ${n(r===`input`?`tokenMiss`:r===`cacheHit`?`tokenHit`:`tokenOutput`)}`,value:e[r],onChange:e=>h(t,r,e.target.value)},r))]})})()]})]},t)),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-add`,onClick:p,children:n(`userPriceAdd`)}),(0,o.jsxs)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-remove-selected`,disabled:s.size===0,onClick:u,children:[n(`userPriceRemoveSelected`),s.size>0?` (${s.size})`:``]}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-user-price-save`,onClick:g,children:n(`userPriceSave`)})]})]})]})}function sr({stats:e,t,onClose:n,userPrices:i,onUserPrices:s,health:c,balances:l,reconcile:u,quotas:f,relayQuotas:p,currency:m,onCurrency:h,turns:g,renderSlot:_,budgetEnabled:v,budgetAmount:y,onToggleBudget:b,onBudgetAmount:C,peakConfig:w,onPeakConfig:T,onPreviewPeak:ee,floatPrefs:E,onFloatPrefs:D,cardPrefs:O,onCardPrefs:te,sitePrefs:k,onSitePrefs:A,liveCostPrefs:j,onLiveCostPrefs:ne,quotasStale:re}){let[ie,ae]=(0,r.useState)(`cost`),{total:M,byModel:N,byDay:F}=e,[I,oe]=(0,r.useState)(`overview`),[ce,le]=(0,r.useState)(7),[ue,de]=(0,r.useState)(()=>{try{return window.localStorage.getItem(`dsh-billing:reconcile-dismissed`)??``}catch{return``}}),fe=()=>{let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`},pe=(0,r.useCallback)(()=>{let e=fe();de(e);try{window.localStorage.setItem(`dsh-billing:reconcile-dismissed`,e)}catch{}},[]),[me,he]=(0,r.useState)(`month`),[ge,_e]=(0,r.useState)(x),L=(0,r.useMemo)(()=>f.filter(e=>e.status===`ok`&&e.windows.length>0).map(e=>({id:e.provider,label:e.displayName})),[f]),[ve,ye]=(0,r.useState)(),[be,xe]=(0,r.useState)(new Set),Se=(0,r.useCallback)(e=>{xe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),[Ce,Te]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=!0;return er().then(t=>{e&&t!==void 0&&Te(t)}),()=>{e=!1}},[]);let Ee=(0,r.useCallback)(()=>{let e=!Ce;Te(e),tr(e).then(t=>{t||Te(!e)})},[Ce]),De=we(),R=e=>K(m===`usd`?Je(e):e,m),z=m===`usd`?`en`:`zh`,Oe=e=>Kt(e,z),B=(e,n)=>e===0?t(`free`):Ye(Xe(e,n,m,De.rate),m===`usd`?`USD`:`CNY`),ke=(0,r.useMemo)(()=>Mt([...g].reverse()),[g]),Ae={peak:e.byTier?.peak.cost??0,offPeak:e.byTier?.offPeak.cost??0},je=Ae.peak/2,Me=Dn(F,$()),Ne=e=>l.find(t=>Q(t.provider)===Q(e)),Pe=e=>e.balance?.error===`unconfigured`&&e.models.length>0&&e.models.every(e=>e.plan),Fe=e=>{if(e===void 0)return(0,o.jsx)(`span`,{className:P.na,children:`—`});if(e.error===`unconfigured`)return t(`balanceUnconfigured`);if(e.error===`unauthorized`)return t(`balanceUnauthorized`);if(e.error===`unreachable`)return t(`balanceUnreachable`);if(e.totalBalance===void 0)return(0,o.jsx)(`span`,{className:P.na,children:`—`});let n=e.currency===`USD`?`$${e.totalBalance.toFixed(2)}`:R(e.totalBalance),r=e.currency===`USD`?e.totalBalance*De.rate:e.totalBalance,i=Me>0?Math.floor(r/Me):void 0;return(0,o.jsxs)(`span`,{className:P.balanceCell,children:[(0,o.jsx)(`span`,{children:n}),i!==void 0&&i>=0&&(0,o.jsx)(`button`,{type:`button`,className:d(P.balanceDaysBadge,i<=3&&P.balanceDaysBadgeLow),"data-testid":`billing-balance-days-badge`,title:t(`balanceDays`).replace(`{days}`,String(i)),"aria-label":`${e.displayName} ${t(`balanceDays`).replace(`{days}`,String(i))}`,onClick:()=>{ye(ve===e.provider?void 0:e.provider)},children:`?`}),ve===e.provider&&(0,o.jsx)(ir,{balance:e,days:i??0,dailyBurn:Me,money:R,t,onClose:()=>{ye(void 0)}})]})},Ie=Object.keys(F).sort(),V=$(),Le=F[V]?.cost??0,H=V.slice(0,7),Re=V.slice(0,4),ze=Ie.reduce((e,t)=>e+(t.startsWith(H)?F[t]?.cost??0:0),0),Be=Ie.reduce((e,t)=>e+(t.startsWith(Re)?F[t]?.cost??0:0),0),U=(0,r.useMemo)(()=>On(F,H,V)+f.reduce((e,t)=>e+(t.planType===`code`?t.subscriptionAmount??0:0),0),[F,H,V,f]),W=(0,r.useMemo)(()=>{if(!(v&&y>0))return null;let e=y-ze;return{over:e<=0,remainRatio:Math.max(0,Math.min(1,e/y)),remainCny:Math.max(0,e)}},[v,y,ze]),He=(0,r.useMemo)(()=>{let e=[];for(let t=ce-1;t>=0;--t){let n=new Date;n.setDate(n.getDate()-t),e.push($(n.getTime()))}return e},[ce]),We=He.at(-1)??V,G=(0,r.useMemo)(()=>Object.entries(F).map(([e,t])=>({date:e,value:t.cost})),[F]),J=Nn(F),Qe=Pn(F),$e=(0,r.useMemo)(()=>He.map(t=>{let n={},r=e.byDayModels?.[t];if(r!==void 0)for(let[e,t]of Object.entries(r))t.cost>0&&(n[e]=t.cost);let i=F[t];return{date:t,cost:i?.cost??0,calls:i?.calls??0,byModel:n,tokens:i===void 0?0:i.input+i.output+i.cacheHit+i.cacheMiss}}),[He,F,e.byDayModels]),et=(0,r.useMemo)(()=>Object.entries(N).filter(([,e])=>e.calls>0).map(([e,t])=>{let n=Ve(e),r=n.key===`other`,i=r?fn(e):void 0,a={input:t.input,cacheHit:t.cacheHit,cacheMiss:t.cacheMiss,output:t.output};return{key:e,name:r?e:n.name,provider:i??n.provider,calls:t.calls,input:t.input,output:t.output,cacheHitRate:t.cacheHit+t.cacheMiss>0?t.cacheHit/(t.cacheHit+t.cacheMiss)*100:0,estimated:qe(n,a),plan:t.plan===!0,...t.cost>0?{actual:t.cost}:{},uncatalogued:r,estimatedPricing:n.estimated===!0,officialCalls:t.officialCalls??0,officialCost:t.officialCost??0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated)).map((e,t)=>({...e,color:Kn[t%Kn.length]??`#8b95a3`})),[N]),tt=(0,r.useMemo)(()=>k.hideUnidentified?p.filter(e=>e.kind!==`unknown`):p,[p,k.hideUnidentified]),Y=(0,r.useMemo)(()=>{let n=new Map;for(let t of Object.values(e.byDayModelsSite??{}))for(let[e,r]of Object.entries(t))for(let[t,i]of Object.entries(r)){let r=n.get(t);r===void 0&&(r=new Map,n.set(t,r));let a=r.get(e)??{calls:0,input:0,output:0,cacheHit:0,cacheMiss:0,cost:0};a.calls+=i.calls,a.input+=i.input,a.output+=i.output,a.cacheHit+=i.cacheHit,a.cacheMiss+=i.cacheMiss,a.cost+=i.cost,r.set(e,a)}let r=new Map;for(let[t,i]of n){let n=[...i.entries()].filter(([,e])=>e.calls>0).map(([t,n],r)=>{let i=Ve(t),a=i.key===`other`,o=a?fn(t)??i.provider:i.provider;return{key:t,name:a?t:i.name,provider:o,color:Kn[r%Kn.length]??`#8b95a3`,calls:n.calls,input:n.input,output:n.output,cacheHitRate:n.cacheHit+n.cacheMiss>0?n.cacheHit/(n.cacheHit+n.cacheMiss)*100:0,estimated:qe(i,{input:n.input,cacheHit:n.cacheHit,cacheMiss:n.cacheMiss,output:n.output}),plan:e.byModel?.[t]?.plan===!0,...n.cost>0?{actual:n.cost}:{},uncatalogued:a,estimatedPricing:i.estimated===!0,officialCalls:0,officialCost:0}}).sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));n.length>0&&r.set(t,n)}let i=e=>Xt(e,z)??t(`channelUnknown`),a=new Map,o=new Map,s=e=>e.startsWith(`direct:`)?`direct`:e.startsWith(`site:`)?`site`:`unknown`,u={direct:2,site:1,unknown:0,vendor:0};for(let[e,t]of r){let n=i(e),r=a.get(n);if(r===void 0)a.set(n,[...t]),o.set(n,s(e));else{r.push(...t),r.sort((e,t)=>(t.actual??t.estimated)-(e.actual??e.estimated));let i=o.get(n)??`unknown`,a=s(e);u[a]>u[i]&&o.set(n,a)}}let d=new Map,p=new Map;for(let e of f){if(e.status===`not-configured`)continue;let t=e.displayName??mn(e.provider),n=i(`direct:${e.provider}`),r=a.has(t)?t:a.has(n)?n:void 0,o=r??`sub:${mn(e.provider)}`;p.set(o,r??mn(e.provider));let s=d.get(o);s===void 0?d.set(o,[e]):s.push(e)}let m=e=>e===i(`direct:deepseek`)||e===i(`site:https://api.deepseek.com`)?Ne(`deepseek`)??Ne(e):Ne(e),h=[];for(let[e,t]of a)h.push({name:e,models:t,subscriptions:d.get(e)??[],balance:m(e),dot:Rn(c,t[0]?.provider??``),channelKind:o.get(e)??`unknown`});for(let[e,t]of p)a.has(e)||h.push({name:t,models:[],subscriptions:d.get(e)??[],balance:Ne(t),dot:Rn(c,t),channelKind:`vendor`});let g=new Set(h.flatMap(e=>[Q(e.name),...e.balance===void 0?[]:[Q(e.balance.provider)]]));for(let e of l)g.has(Q(e.provider))||(e.error===void 0||e.provider.startsWith(`custom:`))&&h.push({name:e.displayName,models:[],subscriptions:[],balance:e,dot:Rn(c,e.displayName),channelKind:`vendor`});return h.sort((e,t)=>{let n=nr(t)-nr(e);return n===0?e.models.length===0&&t.models.length===0?0:t.models.length===0?-1:e.models.length===0?1:e.name.localeCompare(t.name,`zh`):n})},[e.byDayModelsSite,e.byModel,f,l,c,z,t]),rt=(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`model`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`inputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`outputTokens`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`cacheHitRate`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`actual`)})]})}),it=e=>{let n=e.color??(e.colorVar===void 0?void 0:Ke(e.colorVar));return(0,o.jsxs)(`span`,{className:P.modelCell,children:[(0,o.jsx)(cr,{provider:e.provider,...n===void 0?{}:{colorVar:n}}),(0,o.jsxs)(`span`,{children:[(0,o.jsxs)(`span`,{className:P.modelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:P.uncataloguedTag,"data-testid":`billing-uncatalogued-tag`,children:t(`uncatalogued`)}),e.estimatedPricing&&(0,o.jsx)(`span`,{className:P.estimatedTag,"data-testid":`billing-estimated-tag`,children:t(`estimatedPricing`)})]}),(0,o.jsx)(`span`,{className:P.modelProvider,children:Oe(e.provider)})]})]})},at=et.reduce((e,t)=>e+t.estimated,0),ot=M.cost>0?M.cost:at,X=(0,r.useMemo)(()=>{if(ge===`all`){let e,t=0;for(let[n,r]of Object.entries(F)){let i=r.cacheMiss+r.cacheHit+r.output;i>t&&(t=i,e=n)}return{cost:ot,calls:M.calls,input:M.input,output:M.output,cacheHit:M.cacheHit,cacheMiss:M.cacheMiss,reasoning:M.reasoning??0,peakDay:e,peakTokens:t}}return Ln(F,$(),ge)},[ge,ot,M,F]),ct=(0,r.useMemo)(()=>et.map(e=>({key:e.key,name:e.name,color:e.color})),[et]),lt=$e.length>=2?$e.at(-2)?.cost??0:0,dt=lt>0?(Le-lt)/lt*100:0;return(0,o.jsx)(a.Modal,{open:!0,onClose:n,title:t(`title`),headless:!0,className:d(P.dashboardModal,`dsh-billing-modal`),children:(0,o.jsxs)(`div`,{className:P.dashboard,"data-testid":`billing-dashboard`,children:[(0,o.jsxs)(`div`,{className:P.dashboardHead,"data-testid":`billing-dashboard-head`,children:[(0,o.jsxs)(`div`,{children:[_(`billing.dashboard.decor`,{position:`head`}),(0,o.jsxs)(`div`,{className:P.headTitleRow,children:[(0,o.jsx)(`h2`,{className:P.dashboardTitle,children:t(`title`)}),_(`billing.dashboard.decor`,{position:`headTitle`})]}),(0,o.jsxs)(`p`,{className:P.dashboardSubtitle,children:[t(`lastUpdated`),` `,We,e.timezone===void 0?null:` · ${e.timezone.name} (${e.timezone.offset})`]})]}),(0,o.jsxs)(`div`,{className:P.dashboardRight,children:[(0,o.jsx)(`span`,{className:P.currencyToggle,role:`group`,"aria-label":t(`currency`),children:[`cny`,`usd`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.currencyButton,m===e&&P.currencyButtonActive),"aria-pressed":m===e,"data-testid":`billing-currency-${e}`,title:t(e===`cny`?`currencyCny`:`currencyUsd`),onClick:()=>{h(e)},children:e===`cny`?`¥ CNY`:`$ USD`},e))}),c.checked&&(0,o.jsxs)(`span`,{className:d(P.healthBadge,c.available?P.healthBadgeOk:P.healthBadgeBad),children:[(0,o.jsx)(`span`,{className:d(P.healthDot,c.available?P.healthOk:P.healthBad),"aria-hidden":`true`}),c.available?`${c.models} 模型可用${c.failures>0?` · ${c.failures} 厂商失效`:``}`:`${c.failures} 厂商不可用`]}),(0,o.jsx)(`button`,{type:`button`,className:P.closeButton,"aria-label":t(`close`),"data-testid":`billing-close`,onClick:n,children:(0,o.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"aria-hidden":`true`,children:[(0,o.jsx)(`path`,{d:`M18 6 6 18`}),(0,o.jsx)(`path`,{d:`m6 6 12 12`})]})})]})]}),(0,o.jsx)(`nav`,{className:P.tabNav,"data-testid":`billing-tab-nav`,role:`tablist`,"aria-label":t(`title`),children:on.map(e=>(0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":I===e.id,className:d(P.tabButton,I===e.id&&P.tabButtonActive),"data-testid":`billing-tab-${e.id}`,onClick:()=>{oe(e.id)},children:t(e.labelKey)},e.id))}),(0,o.jsxs)(`div`,{className:P.dashboardBody,children:[I===`overview`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-overview`,children:[u?.kind===`drift`&&u.spent!==void 0&&ue!==fe()&&(0,o.jsxs)(`div`,{className:P.reconcileNotice,"data-testid":`billing-reconcile-notice`,role:`note`,children:[(0,o.jsx)(`span`,{className:P.reconcileIcon,"aria-hidden":`true`,children:(0,o.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,o.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,o.jsx)(`line`,{x1:`12`,y1:`10`,x2:`12`,y2:`16`}),(0,o.jsx)(`line`,{x1:`12`,y1:`7.5`,x2:`12.01`,y2:`7.5`})]})}),(0,o.jsx)(`span`,{className:P.reconcileText,children:t(`reconcileDrift`).replace(`{provider}`,u.provider??``).replace(`{spent}`,R(u.spent)).replace(`{today}`,R(u.todayOfficialCost??0))}),(0,o.jsx)(`button`,{type:`button`,className:P.reconcileDismiss,"data-testid":`billing-reconcile-dismiss`,onClick:pe,children:t(`reconcileDismiss`)})]}),(0,o.jsxs)(`section`,{className:P.hero,"data-testid":`billing-hero`,children:[_(`billing.dashboard.decor`,{position:`hero`}),(0,o.jsxs)(`div`,{className:P.heroTop,children:[(0,o.jsxs)(`div`,{className:P.heroMain,children:[(0,o.jsx)(`span`,{className:P.heroLabel,children:t(`monthCost`)}),(0,o.jsxs)(`div`,{className:P.heroReadout,children:[(0,o.jsx)(`span`,{className:P.heroCurrency,"aria-hidden":`true`,children:m===`usd`?`$`:`¥`}),(0,o.jsx)(`span`,{className:P.heroValue,children:R(ze).slice(1)})]}),(0,o.jsxs)(`span`,{className:P.heroMeta,children:[M.calls.toLocaleString(),` `,t(`calls`)]})]}),W!==null&&(0,o.jsxs)(`div`,{className:P.heroGauge,"data-testid":`billing-hero-gauge`,children:[(0,o.jsxs)(`div`,{className:P.heroGaugeDial,children:[(0,o.jsxs)(`svg`,{className:P.heroGaugeSvg,viewBox:`0 0 120 120`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:P.heroGaugeTrack,cx:`60`,cy:`60`,r:`52`}),(0,o.jsx)(`circle`,{className:d(P.heroGaugeArc,W.over&&P.heroGaugeArcOver),cx:`60`,cy:`60`,r:`52`,style:{strokeDasharray:`${W.remainRatio*326.7} 326.7`}})]}),(0,o.jsxs)(`span`,{className:P.heroGaugeCenter,children:[(0,o.jsxs)(`span`,{className:d(P.heroGaugeRemain,W.over&&P.heroGaugeRemainOver),children:[m===`usd`?`$`:`¥`,(m===`usd`?Je(W.remainCny):W.remainCny).toFixed(2)]}),(0,o.jsx)(`span`,{className:P.heroGaugeLabel,children:t(`budgetRemain`)})]})]}),(0,o.jsxs)(`span`,{className:P.heroGaugeSub,children:[R(ze),` / `,R(y)]})]})]}),(0,o.jsxs)(`div`,{className:P.heroSide,children:[(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`yearCost`)}),(0,o.jsx)(`span`,{className:P.heroSideValue,children:R(Be)})]}),(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`todayCost`)}),(0,o.jsxs)(`span`,{className:P.heroSideValue,children:[R(Le),(0,o.jsxs)(`span`,{className:d(P.delta,dt>=0?P.deltaUp:P.deltaDown),children:[dt>=0?`▲`:`▼`,` `,Math.abs(dt).toFixed(1),`%`]})]})]}),U>0&&(0,o.jsxs)(`div`,{className:P.heroSideItem,children:[(0,o.jsx)(`span`,{className:P.heroSideLabel,children:t(`monthProjected`)}),(0,o.jsx)(`span`,{className:P.heroSideValue,children:R(U)})]}),U<=0&&(0,o.jsx)(`span`,{className:P.heroSideSpacer,"aria-hidden":`true`})]})]}),(e.unpricedModels?.length??0)>0&&(0,o.jsx)(`div`,{className:P.unpricedHint,"data-testid":`billing-unpriced-hint`,children:t(`unpricedHint`).replace(`{count}`,String(e.unpricedModels?.length??0))}),(e.total.searchCalls??0)>0&&(0,o.jsx)(`div`,{className:P.unpricedHint,"data-testid":`billing-search-estimate-hint`,children:t(`searchEstimateHint`).replace(`{count}`,String(e.total.searchCalls??0)).replace(`{each}`,R(e.searchCallEstimateCny??0))}),(0,o.jsxs)(`div`,{className:P.kpiZone,children:[(0,o.jsxs)(`div`,{className:P.kpiZoneHead,children:[(0,o.jsx)(`span`,{className:P.kpiZoneLabel,children:t(`kpiRange`)}),(0,o.jsx)(`div`,{className:P.heatmapRangeSwitch,"data-testid":`billing-kpi-range`,role:`group`,"aria-label":t(`kpiRange`),children:[[`today`,`avgRangeToday`],[`7d`,`avgRange7d`],[`week`,`avgRangeWeek`],[`month`,`avgRangeMonth`],[`all`,`avgRangeAll`]].map(([e,n])=>(0,o.jsx)(`button`,{type:`button`,className:d(P.heatmapRangeButton,ge===e&&P.heatmapRangeButtonActive),"data-testid":`billing-kpi-range-${e}`,"aria-pressed":ge===e,onClick:()=>{_e(e),S(e)},children:t(n)},e))})]}),(0,o.jsxs)(`section`,{className:P.kpiGrid,"data-testid":`billing-kpi-grid`,children:[(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-tile`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`cacheHitRate`)}),(0,o.jsx)(`span`,{className:d(P.kpiValue,P.kpiGreen),children:Ze(X.cacheHit+X.cacheMiss>0?X.cacheHit/(X.cacheHit+X.cacheMiss)*100:0)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[q(X.cacheHit),` / `,q(X.cacheHit+X.cacheMiss),(M.cacheWrite??0)>0?` · ${t(`tokenCacheWrite`)} ${q(M.cacheWrite??0)}`:``]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokens`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:q(X.input+X.output)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[t(`inputTokens`),` `,q(X.input),` · `,t(`outputTokens`),` `,q(X.output)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-avg`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`avgCost`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:R(X.calls>0?X.cost/X.calls:0)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[t(`calls`),` `,X.calls.toLocaleString()]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`calls`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:X.calls.toLocaleString()}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[et.length,` `,t(`models`)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-think`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokenReasoningShare`)}),(0,o.jsx)(`span`,{className:d(P.kpiValue,P.kpiGreen),children:Ze(X.output>0?X.reasoning/X.output*100:0)}),(0,o.jsx)(`span`,{className:P.kpiDetail,children:q(X.reasoning)})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-io`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokenIo`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:(X.output>0?X.input/X.output:0).toFixed(2)}),(0,o.jsxs)(`span`,{className:P.kpiDetail,children:[q(X.input),` / `,q(X.output)]})]}),(0,o.jsxs)(`div`,{className:P.kpiTile,"data-testid":`billing-kpi-peak`,children:[(0,o.jsx)(`span`,{className:P.kpiLabel,children:t(`tokenPeak`)}),(0,o.jsx)(`span`,{className:P.kpiValue,children:X.peakTokens>0?ft(X.peakTokens):`—`}),(0,o.jsx)(`span`,{className:P.kpiDetail,children:X.peakDay??`—`})]})]})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-heatmap`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`heatmap`)}),(0,o.jsx)(`div`,{className:P.heatmapRangeSwitch,"data-testid":`billing-heatmap-range`,role:`group`,"aria-label":t(`heatmap`),children:[`month`,`year`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.heatmapRangeButton,me===e&&P.heatmapRangeButtonActive),"data-testid":`billing-heatmap-range-${e}`,"aria-pressed":me===e,onClick:()=>{he(e)},children:t(e===`month`?`heatmapMonth`:`heatmapYear`)},e))}),(0,o.jsxs)(`span`,{className:P.panelHint,"data-testid":`billing-heatmap-summary`,children:[t(`activeDays`),` `,J,` · `,t(`streakDays`),` `,Qe]})]}),(0,o.jsx)(Ot,{days:G,currency:m,t,range:me})]})]}),I===`settings`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-settings`,children:[(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-budget`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`budget`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`budgetHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":v,"aria-label":t(`budget`),"data-testid":`billing-budget-toggle`,className:d(P.switch,v&&P.switchOn),onClick:b,children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),v&&(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`budgetAmount`)}),(0,o.jsxs)(`span`,{className:P.inp,"data-testid":`billing-budget-input-wrap`,children:[(0,o.jsx)(`span`,{className:P.affix,"aria-hidden":`true`,children:`¥`}),(0,o.jsx)(`input`,{className:P.budgetInput,"data-testid":`billing-budget-input`,type:`number`,min:0,step:1,value:y===0?``:y,placeholder:e.budget===void 0?`0`:String(e.budget),"aria-label":`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,title:`${t(`budget`)}(${m===`usd`?`USD`:`CNY`})`,onChange:e=>{C(e.target.valueAsNumber)}})]})]}),y>0&&(()=>{let e=ze/y*100;return(0,o.jsx)(`div`,{className:P.ctlRowStretch,children:(0,o.jsx)(`div`,{className:P.prog,role:`progressbar`,"aria-valuenow":Math.min(e,100),"aria-valuemin":0,"aria-valuemax":100,"aria-label":t(`budget`),"data-testid":`billing-budget-track`,children:(0,o.jsx)(`div`,{className:d(P.progFill,e>=100&&P.budgetFillOver,e>=80&&e<100&&P.budgetFillWarn),style:{width:`${Math.min(e,100)}%`}})})})})(),y>0&&(0,o.jsx)(`p`,{className:P.setCardDesc,"data-testid":`billing-budget-value`,children:t(`budgetSummary`).replace(`{used}`,R(ze)).replace(`{total}`,R(y))})]})]}),(0,o.jsxs)(`section`,{className:P.setCard,"data-testid":`billing-peak-alert-settings`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`peakAlert`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`peakAlertHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":w.enabled,"aria-label":t(`peakAlert`),"data-testid":`billing-peak-alert-toggle`,className:d(P.switch,w.enabled&&P.switchOn),onClick:()=>{T({...w,enabled:!w.enabled})},children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),w.enabled&&(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`label`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertLeadMin`)}),(0,o.jsx)(`span`,{className:P.inp,children:(0,o.jsx)(`input`,{type:`number`,min:1,max:30,step:1,value:w.leadMin,className:P.budgetInput,"aria-label":t(`peakAlertLeadMin`),onChange:e=>{let t=Number(e.target.valueAsNumber);T({...w,leadMin:Number.isFinite(t)?Math.min(30,Math.max(1,Math.round(t))):w.leadMin})}})})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertPos`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertPos`),children:[`bottom-right`,`center`].map(e=>(0,o.jsxs)(`label`,{className:P.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-pos`,checked:w.position===e,onChange:()=>T({...w,position:e})}),(0,o.jsx)(`span`,{className:P.rdoDot,"aria-hidden":`true`}),t(e===`bottom-right`?`peakAlertPosCorner`:`peakAlertPosCenter`)]},e))})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertMode`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,role:`radiogroup`,"aria-label":t(`peakAlertMode`),children:[`both`,`peak`,`offPeak`].map(e=>(0,o.jsxs)(`label`,{className:P.rdo,children:[(0,o.jsx)(`input`,{type:`radio`,name:`peak-mode`,checked:w.mode===e,onChange:()=>T({...w,mode:e})}),(0,o.jsx)(`span`,{className:P.rdoDot,"aria-hidden":`true`}),t(e===`both`?`peakAlertModeBoth`:e===`peak`?`peakAlertModePeak`:`peakAlertModeOff`)]},e))})]}),(0,o.jsxs)(`label`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`peakAlertWebNotify`)}),(0,o.jsx)(`input`,{type:`checkbox`,checked:w.webNotify,"aria-label":t(`peakAlertWebNotify`),onChange:e=>{T({...w,webNotify:e.target.checked})}})]}),(0,o.jsx)(`div`,{className:P.ctlRow,children:(0,o.jsx)(`button`,{type:`button`,className:P.btn,onClick:ee,children:t(`peakAlertPreview`)})})]})]}),(0,o.jsx)(`section`,{className:P.setCard,"data-testid":`billing-toggle-setting`,children:(0,o.jsxs)(`div`,{className:P.setGrid3,children:[(0,o.jsx)(`div`,{className:P.setCell,"data-testid":`billing-usage-stats-tool-setting`,children:(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`usageStatsTool`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`usageStatsToolHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":Ce,"aria-label":t(`usageStatsTool`),"data-testid":`billing-usage-stats-tool-toggle`,className:d(P.switch,Ce&&P.switchOn),onClick:Ee,children:(0,o.jsx)(`span`,{className:P.switchKnob})})]})}),(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-livecost-setting`,children:[(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`liveCostBar`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`liveCostBarHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":j.show,"aria-label":t(`liveCostBar`),"data-testid":`billing-livecost-toggle`,className:d(P.switch,j.show&&P.switchOn),onClick:()=>ne({...j,show:!j.show}),children:(0,o.jsx)(`span`,{className:P.switchKnob})})]}),j.show&&(0,o.jsxs)(`div`,{className:P.rdoRow,"data-testid":`billing-livecost-position`,children:[(0,o.jsx)(`span`,{className:P.rdoLabel,children:t(`liveCostBarPosition`)}),(0,o.jsx)(ur,{liveCostPrefs:j,onLiveCostPrefs:ne,t})]})]}),(0,o.jsx)(`div`,{className:P.setCell,"data-testid":`billing-site-list-setting`,children:(0,o.jsxs)(`div`,{className:P.setCardHead,children:[(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`siteListDisplay`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`siteListDisplayHint`)})]}),(0,o.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":k.hideUnidentified,"aria-label":t(`siteListDisplay`),"data-testid":`billing-site-hide-unidentified`,className:d(P.switch,k.hideUnidentified&&P.switchOn),onClick:()=>A({hideUnidentified:!k.hideUnidentified}),children:(0,o.jsx)(`span`,{className:P.switchKnob})})]})})]})}),(0,o.jsx)(`section`,{className:P.setCard,"data-testid":`billing-display-setting`,children:(0,o.jsxs)(`div`,{className:P.setGrid2,children:[(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-float-setting`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`floatWindow`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`floatWindowHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`floatMode`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,"data-testid":`billing-float-mode`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,E.mode===`combined`&&P.floatModeBtnOn),"data-testid":`billing-float-mode-combined`,onClick:()=>D({mode:`combined`,targets:E.targets}),children:t(`floatModeCombined`)}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,E.mode===`subscription`&&P.floatModeBtnOn),"data-testid":`billing-float-mode-subscription`,onClick:()=>D({mode:`subscription`,targets:E.targets}),children:t(`floatModeSubscription`)})]})]}),E.mode===`subscription`&&(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`floatTargets`)}),(0,o.jsxs)(`span`,{className:P.ctlGroup,"data-testid":`billing-float-targets`,children:[L.map(e=>{let t=E.targets.includes(e.id);return(0,o.jsxs)(`label`,{className:P.floatTarget,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:t,"data-testid":`billing-float-target-${e.id}`,onChange:()=>D({mode:`subscription`,targets:t?E.targets.filter(t=>t!==e.id):[...E.targets,e.id]})}),(0,o.jsx)(`span`,{className:P.floatTargetLabel,children:e.label})]},e.id)}),L.length===0&&(0,o.jsx)(`span`,{className:P.setCardDesc,children:t(`floatNoTargetsHint`)})]})]})]})]}),(0,o.jsxs)(`div`,{className:P.setCell,"data-testid":`billing-card-setting`,children:[(0,o.jsx)(`div`,{className:P.setCardHead,children:(0,o.jsxs)(`div`,{className:P.setCardMeta,children:[(0,o.jsx)(`h3`,{className:P.setCardTitle,children:t(`cardDisplay`)}),(0,o.jsx)(`p`,{className:P.setCardDesc,children:t(`cardDisplayHint`)})]})}),(0,o.jsxs)(`div`,{className:P.ctlCol,children:[(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`cardMetric`)}),(0,o.jsxs)(`div`,{className:P.ctlGroup,"data-testid":`billing-card-metric`,children:[(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,O.metric===`money`&&P.floatModeBtnOn),"data-testid":`billing-card-money`,onClick:()=>te({...O,metric:`money`}),children:t(`cardMetricMoney`)}),(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,O.metric===`tokens`&&P.floatModeBtnOn),"data-testid":`billing-card-tokens`,onClick:()=>te({...O,metric:`tokens`}),children:t(`cardMetricTokens`)})]})]}),(0,o.jsxs)(`div`,{className:P.ctlRow,children:[(0,o.jsx)(`span`,{className:P.ctlLabel,children:t(`cardSpan`)}),(0,o.jsx)(`div`,{className:P.ctlGroup,"data-testid":`billing-card-span`,children:[[`day`,`cardSpanDay`],[`week`,`cardSpanWeek`],[`month`,`cardSpanMonth`]].map(([e,n])=>(0,o.jsx)(`button`,{type:`button`,className:d(P.floatModeBtn,O.span===e&&P.floatModeBtnOn),"data-testid":`billing-card-span-${e}`,"aria-pressed":O.span===e,onClick:()=>te({...O,span:e}),children:t(n)},e))})]})]})]})]})}),(0,o.jsx)(or,{userPrices:i,onUserPrices:s,t}),(0,o.jsx)(ut,{t,version:e.pluginVersion})]}),I===`trends`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-trends`,children:[(0,o.jsxs)(`section`,{className:d(P.ubCard,P.trendPanel),"data-testid":`billing-panel-trend`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`trend`)}),_(`billing.dashboard.decor`,{position:`trend`}),(0,o.jsxs)(`span`,{className:P.ubCardControlGroup,children:[(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":t(`trend`),children:[7,30].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,ce===e&&P.rangeButtonActive),"aria-pressed":ce===e,"data-testid":`billing-trend-${e}d`,onClick:()=>{le(e)},children:t(e===7?`trend7d`:`trend30d`)},e))}),(0,o.jsx)(`span`,{className:P.rangeToggle,role:`group`,"aria-label":t(`trendMetric`),children:[`cost`,`tokens`].map(e=>(0,o.jsx)(`button`,{type:`button`,className:d(P.rangeButton,ie===e&&P.rangeButtonActive),"aria-pressed":ie===e,"data-testid":`billing-trend-metric-${e}`,onClick:()=>{ae(e)},children:t(e===`cost`?`trendMetricCost`:`trendMetricTokens`)},e))})]}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:We})]}),(0,o.jsx)(nt,{data:$e,models:ct,currency:m,metric:ie})]}),g.length>0&&(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-rounds`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`rounds`)}),ke.length>0&&(0,o.jsxs)(`span`,{className:P.ubTagError,"data-testid":`billing-rounds-flag-count`,children:[ke.length,` `,t(`anomaly`)]})]}),(0,o.jsx)(`p`,{className:P.ubCardSub,children:t(`roundsHint`).replace(`{count}`,String(g.length))}),(0,o.jsx)(St,{rounds:g,flags:ke,currency:m,t})]}),e.byTier!==void 0&&(()=>{let e=Ae.peak+Ae.offPeak;if(e<=0)return null;let n=Ae.peak/e*100;return(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-share`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`peakShare`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:t(`peakSharePerCall`)})]}),(0,o.jsxs)(`div`,{className:P.shareTrack,"data-testid":`billing-share-track`,children:[(0,o.jsx)(`div`,{className:d(P.shareSeg,P.shareSegPeak),style:{width:`${n}%`}}),(0,o.jsx)(`div`,{className:d(P.shareSeg,P.shareSegOff),style:{width:`${100-n}%`}})]}),(0,o.jsxs)(`div`,{className:P.shareLegend,children:[(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:P.shareDot,style:{background:`var(--ds-blue)`}}),t(`peak`),(0,o.jsxs)(`span`,{className:P.shareValue,"data-testid":`billing-share-peak`,children:[R(Ae.peak),` · `,n.toFixed(1),`%`]})]}),(0,o.jsxs)(`span`,{className:P.shareItem,children:[(0,o.jsx)(`span`,{className:P.shareDot,style:{background:`color-mix(in srgb, var(--ds-blue) 30%, var(--dsb-3))`}}),t(`offPeak`),(0,o.jsxs)(`span`,{className:P.shareValue,"data-testid":`billing-share-offpeak`,children:[R(Ae.offPeak),` · `,(100-n).toFixed(1),`%`]})]})]}),je>0&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-share-savings`,children:t(`offPeakSavings`).replace(`{amount}`,R(je))})]})})()]}),I===`providers`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-providers`,children:[tt.length>0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-relay-quota`,children:[(0,o.jsx)(`div`,{className:P.panelHead,children:(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`panelRelayQuota`)})}),(0,o.jsx)(`div`,{className:P.providerGroupList,"data-testid":`billing-relay-quotas`,children:tt.map(e=>(0,o.jsxs)(`div`,{className:P.siteRow,"data-testid":`billing-relay-quota`,children:[(0,o.jsxs)(`span`,{className:P.siteRowName,children:[(0,o.jsx)(`span`,{className:d(P.siteKindTag,Un[e.kind]),children:Hn(e.kind,t)}),(0,o.jsx)(`span`,{className:P.siteRowTitle,children:e.origin})]}),(0,o.jsxs)(`span`,{className:P.siteRowMeta,children:[e.balance!==void 0&&(0,o.jsxs)(`span`,{className:P.siteRowCost,children:[t(`relayBalance`),` `,e.balance.toFixed(2)]}),(e.windows?.length??0)>0?e.windows?.map(e=>{let n=e.remainingPercent<20;return(0,o.jsxs)(`span`,{className:d(P.siteRowCalls,n&&P.siteRowCallsLow),children:[t(`relayWindowUsed`),` `,e.usedPercent,`%`]},e.kind)}):(0,o.jsx)(`span`,{className:P.siteRowCalls,children:t(`relayNoQuota`)})]})]},e.route))})]}),(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-providers`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`providerBilling`)}),_(`billing.dashboard.decor`,{position:`models`}),(0,o.jsx)(`span`,{className:P.panelHint,children:e.updatedAt===void 0?``:`${t(`lastUpdated`)} ${Gn(e.updatedAt)}`})]}),re&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-subscriptions-stale`,children:t(`subscriptionsStale`)}),Y.length===0?(0,o.jsx)(`div`,{className:P.emptyRow,"data-testid":`billing-provider-empty`,children:t(`noData`)}):(0,o.jsx)(`div`,{className:P.providerGroupList,"data-testid":`billing-provider-groups`,children:Y.map(e=>(0,o.jsxs)(`div`,{className:P.providerGroup,"data-testid":`billing-provider-group`,children:[(0,o.jsxs)(`div`,{className:P.providerGroupHead,children:[(0,o.jsxs)(`span`,{className:P.providerGroupTitle,children:[(0,o.jsx)(`span`,{className:d(P.healthDot,e.dot),"aria-hidden":`true`}),(()=>{let n=Oe(e.name),r=e.channelKind===`direct`?Qt(n):void 0,i=e.channelKind===`direct`?t(`directTag`):e.channelKind===`site`?t(`relayTag`):e.channelKind===`unknown`?t(`unknownTag`):void 0;return(0,o.jsxs)(o.Fragment,{children:[i!==void 0&&(0,o.jsx)(`span`,{className:d(P.kindBadge,e.channelKind===`direct`&&P.kindBadgeDirect,e.channelKind===`site`&&P.kindBadgeRelay,e.channelKind===`unknown`&&P.kindBadgeUnknown),"data-testid":`billing-kind-badge`,children:i}),e.channelKind!==`unknown`&&(0,o.jsx)(`span`,{className:P.providerGroupName,children:r??n})]})})(),e.subscriptions.length>0&&(0,o.jsxs)(`span`,{className:P.providerGroupBadge,"data-testid":`billing-provider-sub-count`,children:[e.subscriptions.length,` `,t(`planCountUnit`)]})]}),(0,o.jsxs)(`span`,{className:P.providerGroupMeta,children:[(0,o.jsxs)(`span`,{className:P.providerGroupCost,"data-testid":`billing-provider-cost`,children:[(0,o.jsx)(`span`,{className:P.providerGroupCostLabel,children:t(`cost`)}),(0,o.jsx)(`span`,{className:P.providerGroupCostValue,children:R(nr(e))})]}),!Pe(e)&&e.balance!==void 0?(0,o.jsxs)(`span`,{className:P.providerGroupBalance,"data-testid":`billing-provider-balance`,children:[(0,o.jsx)(`span`,{className:P.providerGroupBalanceLabel,children:t(`balance`)}),Fe(e.balance)]}):(0,o.jsx)(`span`,{className:P.providerGroupBalance,"aria-hidden":`true`}),En(e.name)===void 0?(0,o.jsx)(`span`,{className:P.providerGroupRecharge,"aria-hidden":`true`}):(0,o.jsx)(`a`,{className:P.providerGroupRecharge,"data-testid":`billing-group-recharge`,href:En(e.name),target:`_blank`,rel:`noreferrer`,title:t(`rechargeHint`),"aria-label":`${Oe(e.name)} ${t(`recharge`)}`,children:t(`recharge`)})]})]}),e.models.length>0&&(0,o.jsx)(`div`,{className:d(P.tableScroll,P.modelTableScroll),"data-testid":`billing-table-scroll`,children:(0,o.jsxs)(`table`,{className:P.modelTable,children:[rt,(0,o.jsx)(`tbody`,{children:e.models.map(e=>(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:it(e)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:q(e.input)}),(0,o.jsx)(`td`,{className:P.numCol,children:q(e.output)}),(0,o.jsx)(`td`,{className:P.numCol,children:Ze(e.cacheHitRate)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.plan?(0,o.jsxs)(`span`,{className:P.planTag,children:[e.estimated>0?(0,o.jsxs)(`span`,{children:[`≈`,R(e.estimated)]}):null,(0,o.jsx)(`span`,{className:P.planTagBadge,"data-testid":`billing-plan-badge`,children:t(`subscriptionTag`)})]}):e.actual===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):(()=>{let t=e.officialCost,n=e.actual-t;return t>0&&n>0?(0,o.jsxs)(`span`,{className:P.bucketCost,children:[(0,o.jsx)(`span`,{className:P.bucketOfficial,children:R(t)}),(0,o.jsx)(`span`,{className:P.bucketSep,children:`/`}),(0,o.jsx)(`span`,{className:P.bucketThird,children:R(n)})]}):R(e.actual)})()})]},e.key))})]})}),e.subscriptions.length>0&&(0,o.jsx)(`div`,{className:P.subscriptionGrid,"data-testid":`billing-subscriptions-grid`,children:e.subscriptions.map(e=>{let n=Bn(e.status,t);return(0,o.jsxs)(`div`,{className:P.subscriptionCard,"data-testid":`billing-subscription-card`,children:[(0,o.jsxs)(`div`,{className:P.subscriptionHead,children:[(0,o.jsx)(`span`,{className:P.subscriptionName,children:Oe(e.displayName)}),e.planType===`code`&&(()=>{let n=se(e.provider),r=n===void 0?void 0:t(`subscriptionFeePerMonth`).replace(`{amount}`,n.currency===`USD`?`$${n.amount}`:`¥${n.amount}`);return(0,o.jsxs)(`span`,{className:P.subscriptionPlan,"data-kind":`code`,children:[r??(e.subscriptionAmount!==void 0&&e.subscriptionAmount>0?t(`subscriptionFeePerMonth`).replace(`{amount}`,R(e.subscriptionAmount)):t(`planTypeCode`)),n?.label!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionTier,"data-testid":`billing-tier-${e.provider}`,children:n.label}),n!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionAuto,"data-testid":`billing-auto-${e.provider}`,children:t(`subscriptionAutoDetect`)})]})})(),e.planType===`token`&&(0,o.jsx)(`span`,{className:P.subscriptionPlan,"data-kind":`token`,children:t(`planTypeToken`)}),e.plan!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionPlan,children:e.plan})]}),n!==``&&(0,o.jsx)(`div`,{className:P.subscriptionStatus,children:n}),e.windows.length===0&&n===``&&(0,o.jsx)(`div`,{className:P.subscriptionStatus,children:t(`subscriptionNoApi`)}),e.windows.map(e=>(()=>{let n=Math.min(100,Math.max(0,e.usedPercent)),r=Math.min(100,Math.max(0,e.remainingPercent))<=0;return(0,o.jsxs)(`div`,{className:P.subscriptionWindow,children:[(0,o.jsx)(`span`,{className:P.subscriptionWindowLabel,children:Vn(e.kind,t)}),(0,o.jsx)(`span`,{className:P.subscriptionTrack,"aria-hidden":`true`,children:(0,o.jsx)(`span`,{className:d(P.subscriptionFill,n>=100&&P.subscriptionFillOver,n>=80&&n<100&&P.subscriptionFillWarn),style:{width:`${n}%`}})}),(0,o.jsxs)(`span`,{className:P.subscriptionMeta,children:[(0,o.jsx)(`span`,{className:d(P.subscriptionPct,r&&P.subscriptionExhausted),children:r?t(`subscriptionExhausted`):t(`subscriptionRemaining`).replace(`{pct}`,String(e.remainingPercent))}),e.resetsAt!==void 0&&(0,o.jsx)(`span`,{className:P.subscriptionReset,children:t(`subscriptionReset`).replace(`{date}`,`${$(new Date(e.resetsAt).getTime())} ${Gn(new Date(e.resetsAt).getTime())}`)})]})]},e.kind)})())]},e.provider)})})]},e.name))})]}),(0,o.jsxs)(`div`,{className:P.exportBar,"data-testid":`billing-export-bar`,role:`group`,"aria-label":t(`export`),children:[(0,o.jsx)(`span`,{className:P.exportLabel,children:t(`export`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-day`,onClick:()=>{Vt(Bt(`usage-daily`,`csv`,Object.keys(F)),It(F),`text/csv`)},children:t(`exportCsvDay`)}),e.bySession!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-sessions`,onClick:()=>{Vt(Bt(`usage-sessions`,`csv`,Object.keys(F)),zt(e.bySession??[]),`text/csv`)},children:t(`exportCsvSession`)}),e.bySite!==void 0&&(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-sites`,onClick:()=>{Vt(Bt(`usage-sites`,`csv`,Object.keys(F)),Lt(e.bySite??{}),`text/csv`)},children:t(`exportCsvSite`)}),(0,o.jsx)(`button`,{type:`button`,className:P.exportButton,"data-testid":`billing-export-json`,onClick:()=>{Vt(Bt(`usage-stats`,`json`,Object.keys(F)),JSON.stringify(e,null,2),`application/json`)},children:t(`exportJson`)})]}),e.bySession!==void 0&&(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-sessions`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`sessions`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:e.bySession.length>20?t(`sessionOverflow`).replace(`{limit}`,`20`).replace(`{total}`,String(e.bySession.length)):`${e.bySession.length}`})]}),(e.staleLedgerSessions??0)>0&&(0,o.jsx)(`div`,{className:P.staleNotice,"data-testid":`billing-sessions-stale`,children:t(`staleLedgerNotice`).replace(`{count}`,String(e.staleLedgerSessions))}),(0,o.jsx)(`div`,{className:P.ubTablewrap,"data-testid":`billing-sessions-table`,children:(0,o.jsxs)(`table`,{className:P.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`sessionTitle`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`calls`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`actual`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`lastActive`)})]})}),(0,o.jsxs)(`tbody`,{children:[zn(e.bySession??[]).length===0&&(0,o.jsx)(`tr`,{children:(0,o.jsx)(`td`,{colSpan:4,className:P.emptyRow,children:t(`noData`)})}),zn(e.bySession??[]).slice(0,20).map(e=>{let n=e.children!==void 0,i=n&&be.has(e.id),a=e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{className:P.numCol,children:e.calls.toLocaleString()}),(0,o.jsx)(`td`,{className:P.numCol,children:R(e.cost)}),(0,o.jsx)(`td`,{className:P.numCol,children:e.lastActive>0?`${$(e.lastActive)} ${Gn(e.lastActive)}`:`—`})]});return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{className:n?P.sessionGroupRow:void 0,"aria-expanded":n?i:void 0,onClick:n?()=>{Se(e.id)}:void 0,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsxs)(`span`,{className:P.modelName,children:[e.title??`${t(`sessionUntitled`)} · ${e.id.slice(0,8)}`,(e.mergedCount??1)>1?` ×${e.mergedCount}`:``]}),e.stale===!0&&(0,o.jsx)(`span`,{className:d(P.ubTag,P.ubTagNeutral),"data-testid":`billing-session-stale`,children:t(`sessionStaleBadge`)})]}),a(e)]}),i&&e.children?.map(e=>(0,o.jsxs)(`tr`,{className:P.sessionChildRow,children:[(0,o.jsx)(`td`,{children:(0,o.jsx)(`span`,{className:P.modelProvider,children:e.id.slice(0,8)})}),a(e)]},e.id))]},e.id)})]})]})})]})]}),I===`token`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-token`,children:[(0,o.jsx)(_t,{stats:e,trendDays:ce,onTrendDays:le,models:ct,money:R,t}),e.perf!==void 0&&(0,o.jsxs)(`section`,{className:P.panel,"data-testid":`billing-panel-perf`,children:[(0,o.jsxs)(`div`,{className:P.panelHead,children:[(0,o.jsx)(`h3`,{className:P.panelTitle,children:t(`perfTitle`)}),(0,o.jsx)(`span`,{className:P.panelHint,children:t(`perfHint`)})]}),(0,o.jsx)(st,{perf:e.perf,models:ct,t})]})]}),I===`pricing`&&(0,o.jsxs)(`div`,{className:P.tabPanel,"data-testid":`billing-tab-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:P.ubAlert,role:`note`,children:[(0,o.jsxs)(`div`,{className:P.ubAlertLeft,children:[(0,o.jsxs)(`span`,{className:P.ubRate,"data-testid":`billing-rate`,children:[t(`todayRate`),` 1 USD = `,K(De.rate)]}),(0,o.jsx)(`span`,{className:d(P.ubTag,De.live?P.ubTagSuccess:P.ubTagNeutral),children:De.live?t(`rateLive`):t(`rateBuiltin`)})]}),(0,o.jsx)(`p`,{className:P.ubAlertNote,children:t(`pricingTip`)})]}),(0,o.jsxs)(`section`,{className:P.ubCard,"data-testid":`billing-panel-pricing`,children:[(0,o.jsxs)(`div`,{className:P.ubCardHead,children:[(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`pricing`)}),(0,o.jsx)(`span`,{className:P.ubCardSub,children:t(`pricingUnit`)})]}),(0,o.jsx)(`div`,{className:P.ubTablewrap,children:(0,o.jsxs)(`table`,{className:P.ubTable,children:[(0,o.jsx)(`thead`,{children:(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`th`,{children:t(`thModel`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`thInputMiss`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`thInputHit`)}),(0,o.jsx)(`th`,{className:P.numCol,children:t(`output`)}),(0,o.jsx)(`th`,{className:P.numCol,colSpan:2,children:t(`band`)})]})}),(0,o.jsx)(`tbody`,{children:Ge().map(e=>{let n=e.price.input>0||e.price.output>0;return(0,o.jsxs)(r.Fragment,{children:[(0,o.jsxs)(`tr`,{children:[(0,o.jsx)(`td`,{children:(0,o.jsxs)(`span`,{className:P.ubModel,children:[(0,o.jsx)(cr,{provider:e.provider,colorVar:Ke(e.colorVar)}),(0,o.jsxs)(`span`,{className:P.ubModelName,children:[e.name,e.uncatalogued&&(0,o.jsx)(`span`,{className:P.ubTagAlert,"data-testid":`billing-price-uncatalogued`,children:t(`uncatalogued`)}),e.promo!==void 0&&Ue(e.promo,Date.now())&&(0,o.jsx)(a.Tooltip,{label:[e.promo.note,e.promo.endsAtMs===void 0?t(`promoOpenEnded`):t(`promoUntil`,{date:new Date(e.promo.endsAtMs).toLocaleDateString()})].filter(Boolean).join(` · `),side:`top`,maxWidth:280,children:(0,o.jsx)(`span`,{className:P.ubTagPromo,"data-testid":`billing-price-promo`,children:t(`promoBadge`)})})]})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?B(e.price.input,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?B(e.price.cacheHit,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:n?B(e.price.output,e.price.currency):(0,o.jsx)(`span`,{className:P.na,children:`—`})}),n&&e.price.offPeak!==void 0&&e.peakHours!==void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsxs)(`span`,{className:P.ubChipPeak,children:[(0,o.jsx)(`span`,{className:P.ubChipLabel,children:e.tierSemantics===`latency`?t(`ubStd`):t(`ubPeak`)}),(0,o.jsxs)(`span`,{className:P.num,children:[B(e.price.input,e.price.currency),`/`,B(e.price.output,e.price.currency)]})]})}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsxs)(`span`,{className:P.ubChipOff,children:[(0,o.jsx)(`span`,{className:P.ubChipLabel,children:e.tierSemantics===`latency`?`Flex`:t(`ubOff`)}),(0,o.jsxs)(`span`,{className:P.num,children:[B(e.price.offPeak.input,e.price.currency),` / `,B(e.price.offPeak.output,e.price.currency)]})]})})]}):(0,o.jsx)(`td`,{className:P.numCol,colSpan:2,children:n?(0,o.jsx)(`span`,{className:P.flatTag,children:t(`flat`)}):(0,o.jsx)(`span`,{className:P.na,children:`—`})})]}),(e.extraRows??[]).map(t=>(0,o.jsxs)(`tr`,{className:P.ubExtraRow,children:[(0,o.jsxs)(`td`,{children:[(0,o.jsx)(`span`,{className:P.ubExtraName,children:t.label}),t.note!==void 0&&(0,o.jsx)(`span`,{className:P.ubExtraNote,children:t.note})]}),(0,o.jsx)(`td`,{className:P.numCol,children:t.input===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):B(t.input,e.price.currency)}),(0,o.jsx)(`td`,{className:P.numCol,children:(0,o.jsx)(`span`,{className:P.na,children:`—`})}),(0,o.jsx)(`td`,{className:P.numCol,children:t.output===void 0?(0,o.jsx)(`span`,{className:P.na,children:`—`}):B(t.output,e.price.currency)}),(0,o.jsx)(`td`,{className:P.numCol,colSpan:2,children:(0,o.jsx)(`span`,{className:P.na,children:`—`})})]},`${e.key}:${t.label}`))]},e.key)})})]})})]}),(0,o.jsxs)(`section`,{className:P.ubCard,children:[(0,o.jsx)(`div`,{className:P.ubCardHead,children:(0,o.jsx)(`h3`,{className:P.ubCardTitle,children:t(`pricingNotes`)})}),(0,o.jsxs)(`ul`,{className:P.ubNotes,children:[(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`cacheHit`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteCache`)})]}),(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`peakBand`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteBand`)})]}),(0,o.jsxs)(`li`,{className:P.ubNotesItem,children:[(0,o.jsx)(`span`,{className:P.ubNotesTerm,children:t(`pricingSource`)}),(0,o.jsx)(`span`,{className:P.ubNotesDesc,children:t(`noteSource`)})]})]})]})]}),_(`billing.dashboard.decor`,{position:`footer`})]}),(0,o.jsxs)(`footer`,{className:P.modalFooter,"data-testid":`billing-footer`,children:[(0,o.jsx)(`span`,{children:t(`footer`)}),(0,o.jsx)(`span`,{children:t(`footerCredit`).replace(`{version}`,e.pluginVersion===void 0?`—`:`v${e.pluginVersion}`)})]})]})})}function cr({provider:e,colorVar:t}){return(0,o.jsx)(`span`,{className:P.vendorLetter,style:t===void 0?void 0:{background:t},"aria-hidden":`true`,children:e.trim().charAt(0).toUpperCase()})}let lr=[`below`,`above`,`toolbar`];function ur({liveCostPrefs:e,onLiveCostPrefs:t,t:n}){let[i,s]=(0,r.useState)(!1),c={below:n(`liveCostBarPosBelow`),above:n(`liveCostBarPosAbove`),toolbar:n(`liveCostBarPosToolbar`)};return(0,o.jsx)(a.Menu,{open:i,align:`end`,portal:!0,compact:!0,items:lr.map(e=>({id:e,label:c[e]})),selectedId:e.position,onSelect:n=>{s(!1);let r=lr.find(e=>e===n);r!==void 0&&t({...e,position:r})},onClose:()=>{s(!1)},anchor:(0,o.jsxs)(`button`,{type:`button`,className:P.rdoSelect,"data-testid":`billing-livecost-position-select`,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{s(!i)},children:[(0,o.jsx)(`span`,{children:c[e.position]}),(0,o.jsx)(`span`,{className:d(P.rdoChevron,i&&P.rdoChevronOpen),"aria-hidden":!0,children:(0,o.jsx)(a.IconChevronDownOutline14,{})})]})})}function dr(e){let{t,checkModels:n,publishCosts:i,registerOpen:a,renderSlot:s,useStore:c,actions:l}=e,[u,d]=(0,r.useState)(qn),[f,p]=(0,r.useState)(cn),[g,_]=(0,r.useState)([]),[b,x]=(0,r.useState)(void 0),[S,C]=(0,r.useState)([]),[w,E]=(0,r.useState)(!1),[D,A]=(0,r.useState)([]),[re,ie]=(0,r.useState)(`cny`),[ae,M]=(0,r.useState)(()=>m()),N=(0,r.useCallback)(e=>{M(e),h(e)},[]),[P,F]=(0,r.useState)(()=>T()),I=(0,r.useCallback)(e=>{F(e),ee(e)},[]),[oe,se]=(0,r.useState)(()=>te()),ce=(0,r.useCallback)(e=>{se(e),k(e),window.dispatchEvent(new CustomEvent(O))},[]),[le,ue]=(0,r.useState)(()=>v()),de=(0,r.useCallback)(e=>{ue(e),y(e)},[]),[fe,pe]=(0,r.useState)(()=>{let e=j();return ge(e),e}),me=(0,r.useCallback)(e=>{pe(e),ge(e),ne(e)},[]),he=(0,r.useMemo)(()=>kn(u),[u,fe]),_e=re===`usd`?`en`:`zh`,L=(0,r.useCallback)((e,n)=>{let r=(_e===`en`?Wt:Ut)[e]??t(e);if(n===void 0)return r;let i=r;for(let[e,t]of Object.entries(n))i=i.replaceAll(`{${e}}`,String(t));return i},[_e,t]),[ve,ye]=(0,r.useState)(!1),be=(0,r.useCallback)(()=>{ye(!1)},[]),xe=(0,r.useCallback)(()=>{Jn().then(e=>{e!==null&&d(kn(e))}),Zn().then(({balances:e,reconcile:t})=>{e.length>0&&_(e),x(t)}),Qn().then(e=>{e.length>0&&C(e),E(!1)}).catch(()=>{E(!0)}),$n().then(e=>{A(e)}).catch(()=>{})},[]),Ce=(0,r.useCallback)(()=>{xe(),Xn(),ye(!0)},[xe]);(0,r.useEffect)(()=>{xe(),Xn()},[xe]);let[Te,De]=(0,r.useState)(()=>typeof document>`u`||!document.hidden);(0,r.useEffect)(()=>{if(typeof document>`u`)return;let e=()=>{De(!document.hidden),document.hidden||(xe(),Xn())};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[xe]),(0,r.useEffect)(()=>{if(!Te)return;let e=setInterval(()=>{xe(),Xn()},ve?Wn:3e5);return()=>{clearInterval(e)}},[xe,ve,Te]),(0,r.useEffect)(()=>{let e=!0;return n().then(t=>{e&&(p(t),Se(t.catalog??[]))}),()=>{e=!1}},[n]);let R=$(),z=Object.entries(u.byDay).filter(([e])=>e.startsWith(R.slice(0,7))).reduce((e,[,t])=>e+t.cost,0),Oe=u.byDay[R]?.cost??0,B=In(u.byDay,R),ke=(0,r.useMemo)(()=>Fn(u.byDay).map(e=>{let t=u.byDay[e.date];return{date:e.date,cost:e.cost,tokens:t===void 0?0:t.input+t.output}}),[u.byDay]),Ae=Object.entries(u.byDay).filter(([e])=>e.startsWith(R.slice(0,7))).reduce((e,[,t])=>e+t.input+t.output,0),Me=(()=>{let e=u.byDay[R];return e===void 0?0:e.input+e.output})(),Ne=In(u.byDay,R,e=>e.input+e.output),Pe=c(e=>e.enabled),Fe=c(e=>e.amount),Ie=c(e=>e.tierAlertDays),V=c(e=>e.lastTierSwitchAt),[Le,H]=(0,r.useState)(()=>tn()),[Re,ze]=(0,r.useState)(null),[Be,U]=(0,r.useState)(null),[W,He]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=setInterval(()=>He(Date.now()),Wn);return()=>{clearInterval(e)}},[]);let Ue=(0,r.useCallback)(e=>{H(e),nn(e)},[]),We=S.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`),Ge=je(u.byTurn?.[0]?.model,We),Ke=(0,r.useCallback)(()=>{U({entering:Ee(Date.now())===`peak`?`offPeak`:`peak`,atMs:Date.now()+3*6e4,channel:Ge})},[Ge]),G=Fe>0?Fe:u.budget??0,qe=Pe&&G>0?z/G>=1?`over`:z/G>=.8?`warn`:`none`:`none`,Je=(0,r.useCallback)(()=>{let e=!Pe;l.setEnabled(e),e&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission()},[l,Pe]);(0,r.useEffect)(()=>{if(!Pe||G<=0)return;let e=z/G*100,t=sn.filter(t=>e>=t&&Ie?.[String(t)]!==R);if(t.length===0)return;let n=t[t.length-1]??100;if(l.markTierAlerted(t,R),!An())return;let r=L(`budgetTierBody`).replace(`{cost}`,K(z)).replace(`{budget}`,K(G)).replace(`{pct}`,String(n));Mn(`budget:${n}:${R}`,()=>{new Notification(L(`budget`),{body:r})})},[Pe,G,z,Ie,R,l,L]),(0,r.useEffect)(()=>{let e=rn(W,Le,V,Ge);if(e===null||(l.markTierSwitchAlerted(e.atMs),ze(e),!Le.webNotify||!An()))return;let t=Math.max(1,Math.round((e.atMs-W)/6e4)),n=L(e.entering===`peak`?`peakAlertTitlePeak`:`peakAlertTitleOff`),r=L(e.channel===`zhipu-coding-plan`?e.entering===`peak`?`tierAlertEnterPeakZhipu`:`tierAlertEnterOffZhipu`:e.entering===`peak`?`tierAlertEnterPeak`:`tierAlertEnterOff`).replace(`{minutes}`,String(t));Mn(`peak:${e.atMs}`,()=>{new Notification(n,{body:r})})},[W,V,Le,Ge,S,u.byTurn,l,L]);let Ye=c(e=>e.lastBalanceAlertDay),Xe=u.lowBalanceThreshold??50,q=(0,r.useMemo)(()=>{if(g.length===0)return;let e=Dn(u.byDay,R),t=we().rate;for(let n of g){if(n.totalBalance===void 0||n.error!==void 0)continue;let r=n.currency===`USD`?n.totalBalance*t:n.totalBalance;if(r>=Xe)continue;let i=e>0?Math.floor(r/e):void 0;return{name:n.displayName,cny:r,days:i}}},[g,u.lowBalanceThreshold,u.byDay,R]);(0,r.useEffect)(()=>{if(q===void 0||Ye===R||(l.markBalanceAlerted(R),!An()))return;let e=L(`balanceLowBody`).replace(`{name}`,q.name).replace(`{balance}`,K(q.cny)).replace(`{days}`,q.days===void 0?`—`:String(q.days));Mn(`balance:${R}`,()=>{new Notification(L(`balance`),{body:e})})},[q,Ye,R,l,L]);let Ze=(0,r.useMemo)(()=>{let e=R.slice(0,7),t=new Map;for(let[n,r]of Object.entries(u.byDayModels??{}))if(n.startsWith(e))for(let[e,n]of Object.entries(r)){if(n.cost<=0)continue;let r=Ve(e).provider,i=u.byModel?.[e]?.plan===!0,a=t.get(r)??{cost:0,plan:i};a.cost+=n.cost,i||(a.plan=!1),t.set(r,a)}let n,r;for(let e of t){let t=e[1].plan?r:n;(t===void 0||e[1].cost>t[1].cost)&&(e[1].plan?r=e:n=e)}let i=e=>{let t=g.find(t=>Q(t.provider)===Q(e));if(t===void 0||t.totalBalance===void 0){if(e===`Custom`){let e=g.filter(e=>e.totalBalance!==void 0&&e.error===void 0),t=e[0];return t!==void 0&&e.length===1?i(t.provider):void 0}return{text:t?.error===`unauthorized`?L(`balanceUnauthorized`):t?.error===`unreachable`||t?.error===`invalid`?L(`balanceUnreachable`):L(`balanceUnconfigured`),low:!1}}let n=t.currency===`USD`?`$${t.totalBalance.toFixed(2)}`:K(t.totalBalance),r=we().rate;return{text:n,low:(t.currency===`USD`?t.totalBalance*r:t.totalBalance)<Xe}},a=e=>{let t=S.find(t=>t.displayName===e||mn(t.provider)===e);if(t===void 0||t.windows.length===0)return{text:L(`subscriptionNoApi`),low:!1};let n=t.windows.reduce((e,t)=>Math.min(e,t.remainingPercent),100);return{text:n<=0?L(`subscriptionExhausted`):L(`subscriptionRemaining`).replace(`{pct}`,String(n)),low:n<20}},o=n===void 0?void 0:i(n[0]);return{direct:n===void 0||o===void 0?void 0:{name:n[0],...o},sub:r===void 0?void 0:{name:r[0],...a(r[0])}}},[u.byDayModels,u.byModel,u.lowBalanceThreshold,g,S,R]),J=(0,r.useMemo)(()=>{let e=u.total;return{input:e.input,output:e.output,cacheRead:e.cacheHit,cacheMiss:e.cacheMiss,calls:e.calls}},[u]);(0,r.useEffect)(()=>{i({todayCost:Oe,monthCost:z})},[Oe,z,i]),(0,r.useEffect)(()=>a(Ce),[a,Ce]);let Qe=(0,r.useMemo)(()=>u.byTurn??[],[u.byTurn]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(rr,{...e,t:L,onOpen:Ce,monthCost:z,todayCost:Oe,weekCost:B,days:ke,vendorStatus:Ze,dash:J,cardPrefs:le,monthTokens:Ae,todayTokens:Me,weekTokens:Ne,floatPrefs:ae,subscriptions:S,budgetPressure:qe}),ve&&(0,o.jsx)(sr,{stats:he,t:L,onClose:be,userPrices:fe,onUserPrices:me,health:f,balances:g,...b===void 0?{}:{reconcile:b},quotas:S,relayQuotas:D,currency:re,onCurrency:ie,turns:Qe,renderSlot:s,budgetEnabled:Pe,budgetAmount:G,onToggleBudget:Je,onBudgetAmount:l.setAmount,peakConfig:Le,onPeakConfig:Ue,onPreviewPeak:Ke,floatPrefs:ae,onFloatPrefs:N,cardPrefs:le,onCardPrefs:de,sitePrefs:P,onSitePrefs:I,liveCostPrefs:oe,onLiveCostPrefs:ce,quotasStale:w}),(Re!==null||Be!==null)&&(0,o.jsx)(an,{hit:Re??Be,config:Le,t:L,onDismiss:()=>{ze(null),U(null)}})]})}function fr(e,t){return t===void 0||e?.bySession===void 0?0:e.bySession.find(e=>e.id===t)?.cost??0}function pr(e,t){if(t===void 0||e?.byTurn===void 0)return 0;let n=0,r=-1;for(let i of e.byTurn)i.sessionId===t&&(r===-1||i.turn>r)&&(r=i.turn,n=i.cost);return n}function mr(e,t=20){let n=[];for(let r of e)if(r.status===`ok`)for(let e of r.windows)e.remainingPercent>t||n.push({name:r.displayName,kind:e.kind,pct:e.remainingPercent});return n.sort((e,t)=>e.pct-t.pct).slice(0,3)}function hr(e,t){if(t===void 0||e?.byTurn===void 0)return;let n=-1,r;for(let i of e.byTurn)i.sessionId===t&&(n===-1||i.turn>n)&&(n=i.turn,r=i.model);return r}async function gr(){try{let e=await fetch(`/api/billing/usage-stats`);if(!e.ok)return null;let t=await e.text(),n=JSON.parse(t);if(typeof n!=`object`||!n)return null;let r=n;return{...Array.isArray(r.bySession)?{bySession:r.bySession}:{},...Array.isArray(r.byTurn)?{byTurn:r.byTurn}:{}}}catch{return null}}async function _r(){try{let e=await fetch(`/api/billing/subscriptions`);if(!e.ok)return[];let t=JSON.parse(await e.text());if(typeof t!=`object`||!t||!(`quotas`in t))return[];let n=t.quotas;return Array.isArray(n)?n:[]}catch{return[]}}function vr(e){switch(e){case`session`:return`subscriptionSession`;case`weekly`:return`subscriptionWeekly`;case`monthly`:return`subscriptionMonthly`;default:return`subscriptionBilling`}}function yr(){let[e,t]=(0,r.useState)(()=>te().show),[n,i]=(0,r.useState)(()=>te().position);return(0,r.useEffect)(()=>{let e=()=>{t(te().show),i(te().position)};return window.addEventListener(O,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(O,e),window.removeEventListener(`storage`,e)}},[]),{visible:e,position:n}}function br(e){let[t,n]=(0,r.useState)(null),[i,a]=(0,r.useState)([]),[o,s]=(0,r.useState)(()=>Date.now());(0,r.useEffect)(()=>{let e=!1,t=()=>{gr().then(t=>{!e&&t!==null&&n(t)}),_r().then(t=>{e||a(t)}),e||s(Date.now())};t();let r=setInterval(t,3e4);return()=>{e=!0,clearInterval(r)}},[e]);let c=(0,r.useMemo)(()=>fr(t,e),[t,e]),l=(0,r.useMemo)(()=>pr(t,e),[t,e]),u=(0,r.useMemo)(()=>mr(i),[i]),d=(0,r.useMemo)(()=>je(hr(t,e),i.some(e=>e.displayName===`Z.ai Coding Plan`&&e.status===`ok`)),[t,e,i]);return{sessionCost:c,turnCost:l,tier:(0,r.useMemo)(()=>Me(o,d),[o,d]),chips:u}}function xr({sessionId:e,t}){let{visible:n,position:r}=yr(),{sessionCost:i,turnCost:a,tier:s,chips:c}=br(e),l=e=>K(e,`cny`),u=i>0||a>0,f=s?.tier===`peak`;return!n||r===`toolbar`?null:(0,o.jsxs)(`span`,{className:r===`above`?d(P.feeBar,P.feeBarAbove):P.feeBar,"data-testid":`billing-live-cost-bar`,children:[s!==null&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:f?P.feeChipPrimary:P.feeChipOff,"data-testid":`billing-live-tier`,children:t(f?`tierPeak`:`tierOff`)}),(0,o.jsx)(`span`,{className:P.feeCount,children:Pe(s.nextSwitchInMs)}),(0,o.jsx)(`span`,{className:P.feeSuffix,children:t(f?`tierToOff`:`tierToPeak`)})]}),u&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:P.feeItem,"data-testid":`billing-live-turn`,children:[t(`liveTurn`),` `,(0,o.jsx)(`span`,{className:P.feeNum,children:l(a)})]}),(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:P.feeItem,"data-testid":`billing-live-session`,children:[t(`liveSession`),` `,(0,o.jsx)(`span`,{className:P.feeNum,children:l(i)})]})]}),c.map(e=>(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`span`,{className:P.feeSep,"aria-hidden":`true`,children:`·`}),(0,o.jsxs)(`span`,{className:e.pct<=10?P.feeChipError:P.feeChipAlert,"data-testid":`billing-live-quota`,children:[e.name,` `,t(vr(e.kind)),` `,e.pct,`%`]})]},`${e.name}:${e.kind}`))]})}function Sr({sessionId:e,t}){let{visible:n,position:r}=yr(),{sessionCost:i,turnCost:s,tier:c,chips:l}=br(e);if(!n||r!==`toolbar`)return null;let u=c?.tier===`peak`,d=l.reduce((e,t)=>Math.min(e,t.pct),100),f=d<=10?P.feeInlineError:d<=20?P.feeInlineAlert:P.feeInline,p=[...c===null?[]:[`${Pe(c.nextSwitchInMs)} ${t(u?`tierToOff`:`tierToPeak`)}`],`${t(`liveTurn`)} ${K(s,`cny`)}`,`${t(`liveSession`)} ${K(i,`cny`)}`,...l.map(e=>`${e.name} ${t(vr(e.kind))} ${e.pct}%`)].join(` · `);return(0,o.jsx)(a.Tooltip,{label:p,side:`top`,delayMs:500,children:(0,o.jsxs)(`span`,{className:f,"data-testid":`billing-live-cost-chip`,role:`note`,"aria-label":p,children:[c!==null&&(0,o.jsx)(`span`,{className:u?P.feeChipPrimary:P.feeChipOff,"data-testid":`billing-live-tier`,children:t(u?`tierPeak`:`tierOff`)}),i>0&&(0,o.jsx)(`span`,{className:P.feeInlineNum,children:K(i,`cny`)})]})})}function Cr(){let e,t,n=new Set;return{readCosts:()=>e,subscribeCosts:t=>(t(e),n.add(t),()=>{n.delete(t)}),openDashboard:()=>{t?.()},publishCosts:t=>{e=t;for(let e of n)try{e(t)}catch{}},registerOpen:e=>(t=e,()=>{t===e&&(t=void 0)})}}function wr(){return(0,s.defineStore)({init:()=>({enabled:!1,amount:0,tierAlertDays:{},lastBalanceAlertDay:``,lastTierSwitchAt:0}),persist:`dsh.ui-usage-billing.budget`,actions:{setEnabled:(e,t)=>{e.enabled=t},setAmount:(e,t)=>{e.amount=Number.isFinite(t)&&t>0?t:0},markTierAlerted:(e,t,n)=>{e.tierAlertDays??={};for(let r of t)e.tierAlertDays[String(r)]=n},markBalanceAlerted:(e,t)=>{e.lastBalanceAlertDay=t},markTierSwitchAlerted:(e,t)=>{e.lastTierSwitchAt=t}}})}let Tr={enabled:!1,timeout:0};function Er(){try{let e=localStorage.getItem(`dsh-billing-completion-notify-v1`);if(e===null)return{...Tr};let t=JSON.parse(e);return{enabled:t.enabled===!0,timeout:typeof t.timeout==`number`?t.timeout:0}}catch{return{...Tr}}}function Dr(e){return e.completed===!0?!0:e.running===!1}function Or(e,t){let n=new Set,r=new Set,i,a=e.getSnapshot();for(let e of a.ids){let t=a.byId[e];t!==void 0&&(r.add(String(e)),Dr(t)&&n.add(String(e)))}let o=e=>{let{enabled:n,timeout:r}=t();if(n&&!(typeof Notification>`u`)&&Notification.permission===`granted`)try{let t=new Notification(e,{body:e,tag:`dsh-billing-completion`,requireInteraction:r===0});r>0&&(i!==void 0&&clearTimeout(i),i=setTimeout(()=>t.close(),r*1e3))}catch{}},s=e.subscribe(()=>{let t=e.getSnapshot(),i=[];for(let e of t.ids){let a=t.byId[e];if(a===void 0)continue;let o=String(e),s=Dr(a),c=!r.has(o);c&&r.add(o),s&&!c&&!n.has(o)&&i.push(a.title??a.id??o),s?n.add(o):n.delete(o)}if(i.length>0){let e=i.length===1?i[0]:`${i.length} 个会话已完成`;e!==void 0&&o(e)}});return()=>{s(),i!==void 0&&clearTimeout(i)}}let kr=[`slots`,`locale`,`remote`,`sessions`];function Ar(e){let t=Cr();e.provide(`billingMetrics`,t);let n=wr();e.effect(()=>e.locale.register(Ht,{zh:Ut,en:Wt}),`ui-usage-billing: dictionaries`),e.slots.inject(`sidebar.footer.action`,()=>e.slots.register({name:`sidebar.footer.action`,id:`usage-billing`,order:-10,locale:Ht,children:{"billing.dashboard.decor":{kind:`list`,scope:`root`}},store:n,inject:()=>({checkModels:async()=>{try{let[t,n]=await Promise.all([e.remote.llm.listProviders(),e.remote.llm.listConfigurableProviders()]);if(!t.ok||!n.ok)return{checked:!0,available:!1,models:0,failures:0,okProviders:[],badProviders:[]};let r=new Map(n.value.map(e=>[e.provider,e])),i=await Promise.all(t.value.map(async t=>{let n=r.get(t.id);if(n===void 0)return{provider:t,models:[]};let i=await e.remote.llm.discoverModels(n.settingsNs,{provider:t.id});return i.ok?{provider:t,models:i.value}:{provider:t,failed:!0}})),a=[],o=[],s=[],c=0;for(let e of i){if(`failed`in e){s.push(e.provider.name);continue}o.push(e.provider.name),c+=e.models.length;for(let t of e.models)a.push({id:t.id,...typeof t.name==`string`&&t.name!==``?{name:t.name}:{},provider:e.provider.name})}return{checked:!0,available:o.length>0,models:c,failures:s.length,okProviders:o,badProviders:s,catalog:a}}catch{return{checked:!1,available:!1,models:0,failures:0,okProviders:[],badProviders:[]}}},publishCosts:e=>{t.publishCosts(e)},registerOpen:e=>t.registerOpen(e)})},dr)),e.slots.inject(`conversation.composer.dock`,()=>e.slots.register({name:`conversation.composer.dock`,id:`usage-billing-cost`,order:0,locale:Ht,inject:e=>({sessionId:l(e)})},xr)),e.slots.inject(`conversation.input.right`,()=>e.slots.register({name:`conversation.input.right`,id:`usage-billing-cost-chip`,order:0,locale:Ht,inject:e=>({sessionId:l(e)})},Sr)),e.effect(()=>Or(e.sessions.list,Er),`ui-usage-billing: completion notifier`)}return n.UsageBilling=dr,n.apply=Ar,n.inject=kr,t.exports}});
|
|
6
6
|
//# sourceMappingURL=client.js.map
|