function u(r){return typeof r=="number"&&Number.isFinite(r)}function o(r,e){return!u(r)||!u(e)||e<=0?null:r/e}function a(r,e){const n=o(r,e);return n==null?null:n*1e6}function y(r,e,n={}){const t=a(r,e);if(t==null)return n.emptyValue??"-";const s=n.fractionDigits??4,i=t.toFixed(s);return n.withCurrencySymbol==!1?i:`$${i}`}function c(r){const e=r==null?void 0:r.trim().toLowerCase();return e?e==="fast"?"priority":e==="default"||e==="standard"?"standard":e:null}function f(r){const e=c(r);return e||"standard"}function d(r,e){const n=f(r);return n==="priority"?e("usage.serviceTierPriority"):n==="flex"?e("usage.serviceTierFlex"):n==="standard"?e("usage.serviceTierStandard"):n}const l=new Set(["unknown","sync","stream","ws_v2"]),m=r=>typeof r=="string"&&l.has(r),g=r=>m(r.request_type)?r.request_type:r.openai_ws_mode?"ws_v2":r.stream?"stream":"sync",_=r=>!r||r==="unknown"?null:r!=="sync";export{g as a,y as f,d as g,_ as r};
