quotacap 0.0.55 → 0.0.56
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/dist/adapters/opencode-go.js +1 -1
- package/dist/version.js +1 -1
- package/dist/web/src/components/OpencodeGoBanner.js +1 -1
- package/dist/web/src/components/settings/DaemonPanel.js +1 -1
- package/dist/webAssets.js +1 -1
- package/dist/webHtml.js +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{index-Bc6C7q-U.js → index-oqxiN-gi.js} +1 -1
- package/web/dist/index.html +1 -1
package/dist/webHtml.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by scripts/build-embed.mjs — do not edit
|
|
2
|
-
export const webHtml = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<title>QuotaCap</title>\n<script>\ntry {\n var stored = localStorage.getItem(\"quotacap-theme\");\n var dark = stored === \"dark\" || (stored !== \"light\" && matchMedia(\"(prefers-color-scheme: dark)\").matches);\n document.documentElement.dataset.theme = dark ? \"dark\" : \"light\";\n} catch (e) { /* default light theme stands */ }\n</script>\n <script type=\"module\" crossorigin src=\"/assets/index-
|
|
2
|
+
export const webHtml = "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<meta name=\"color-scheme\" content=\"light dark\">\n<title>QuotaCap</title>\n<script>\ntry {\n var stored = localStorage.getItem(\"quotacap-theme\");\n var dark = stored === \"dark\" || (stored !== \"light\" && matchMedia(\"(prefers-color-scheme: dark)\").matches);\n document.documentElement.dataset.theme = dark ? \"dark\" : \"light\";\n} catch (e) { /* default light theme stands */ }\n</script>\n <script type=\"module\" crossorigin src=\"/assets/index-oqxiN-gi.js\"></script>\n <link rel=\"stylesheet\" crossorigin href=\"/assets/index-Co33DTl5.css\">\n</head>\n<body><div id=\"app\"></div></body>\n</html>\n";
|
package/package.json
CHANGED
|
@@ -9,5 +9,5 @@ Error generating stack: `+e.message+`
|
|
|
9
9
|
`).replace(Ad,``)}function Md(e,t){return t=jd(t),jd(e)===t}function $(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Zt(e,``+r);break;case`className`:Ft(e,`class`,r);break;case`tabIndex`:Ft(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ft(e,n,r);break;case`style`:en(e,r,o);break;case`data`:if(t!==`object`){Ft(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&$(e,t,`name`,a.name,a,null),$(e,t,`formEncType`,a.formEncType,a,null),$(e,t,`formMethod`,a.formMethod,a,null),$(e,t,`formTarget`,a.formTarget,a,null)):($(e,t,`encType`,a.encType,a,null),$(e,t,`method`,a.method,a,null),$(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=on);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=an(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),M(e,`popover`,r);break;case`xlinkActuate`:It(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:It(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:It(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:It(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:It(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:It(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:M(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=nn.get(n)||n,M(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:en(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Zt(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=on);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Ot.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[mt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):M(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,o,s,n,null)}}a&&$(e,t,`srcSet`,n.srcSet,n,null),r&&$(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:$(e,t,r,d,n,null)}}Kt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:$(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Jt(e,!!r,n,!0):Jt(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:$(e,t,s,c,n,null)}Xt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:$(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<_d.length;r++)Q(_d[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:$(e,t,u,r,n,null)}return;default:if(tn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&$(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||$(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&$(e,t,p,m,r,f)}}Gt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||$(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&$(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Jt(e,!!n,n?[]:``,!1):Jt(e,!!n,t,!0)):Jt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:$(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&$(e,t,s,a,r,o)}Yt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:$(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:$(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&$(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:$(e,t,u,p,r,m)}return;default:if(tn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&$(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||$(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[bt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),xt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[bt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);xt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=E.d;E.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=bu();return e||t}function yf(e){var t=Ct(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),Et(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Wt(n.imageSizes)+`"]`)):i+=`[href="`+Wt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),Et(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Wt(r)+`"][href="`+Wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),Et(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=Tt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);Et(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=Tt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Et(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=Tt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),Et(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=he.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=Tt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=Tt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=Tt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Wt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),Et(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Wt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Wt(n.href)+`"]`);if(r)return t.instance=r,Et(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Et(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,Et(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),Et(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,Et(a),a):(r=n,(a=mf.get(o))&&(r=h({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Et(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[bt]||a[pt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Et(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),Et(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:ee,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=fi(3,null,null,t),e.current=a,a.stateNode=e,t=ua(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ua(a),e}function tp(e){return e?(e=ui,e):ui}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ga(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ka(e,r,t),n!==null&&(hu(n,e,t),qa(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=si(e,67108864);t!==null&&hu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=pu();t=ct(t);var n=si(e,t);n!==null&&hu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=T.T;T.T=null;var a=E.p;try{E.p=2,up(e,t,n,r)}finally{E.p=a,T.T=i}}function lp(e,t,n,r){var i=T.T;T.T=null;var a=E.p;try{E.p=8,up(e,t,n,r)}finally{E.p=a,T.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)wd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=Ct(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-We(o);s.entanglements[1]|=c,o&=~c}rd(a),!(G&6)&&(tu=Ne()+500,id(0,!1))}}break;case 31:case 13:s=si(a,2),s!==null&&hu(s,a,2),bu(),ip(a,2)}if(a=dp(r),a===null&&wd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else wd(e,t,r,null,n)}}function dp(e){return e=cn(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=St(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Pe()){case Fe:return 2;case Ie:return 8;case Le:case Re:return 32;case ze:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ct(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=St(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,dt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,dt(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sn=r,n.target.dispatchEvent(r),sn=null}else return t=Ct(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=Ct(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[mt]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[mt]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,pu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),bu(),t[ht]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(i(527,Lp,`19.2.8`));E.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:T,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{He=zp.inject(Rp),j=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[ht]=t.current,Sd(e),new Fp(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g();function y(){return typeof window<`u`&&window.location?.origin?`${window.location.origin}/api/state`:`/api/state`}var b=class extends Error{endpoint;constructor(e,t){super(`service unavailable: ${e}`),this.name=`StateNetworkError`,this.endpoint=e,t!==void 0&&(this.cause=t)}},x=class extends Error{status;constructor(e,t){super(t),this.name=`StateHttpError`,this.status=e}};async function S(e){try{let t=await e.json();if(typeof t==`object`&&t)for(let e of[`error`,`message`,`reason`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n}}catch{}return e.statusText||`HTTP ${e.status}`}async function ee(){let e;try{e=await fetch(`/api/state`)}catch(e){throw new b(`/api/state`,e)}if(!e.ok)throw new x(e.status,await S(e));return await e.json()}async function C(){let e;try{e=await fetch(`/api/token`)}catch(e){throw new b(`/api/token`,e)}if(!e.ok)throw new x(e.status,await S(e));return(await e.json()).token}function te(e){if(typeof e==`object`&&e)for(let t of[`message`,`error`,`reason`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}async function ne(){let e=await C(),t;try{t=await fetch(`/api/refresh`,{method:`POST`,headers:{"X-QuotaCap-Token":e}})}catch(e){throw new b(`/api/refresh`,e)}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new x(t.status,te(n)??t.statusText??`HTTP ${t.status}`);return{ok:t.ok,status:t.status,message:te(n),raw:n}}async function re(e,t){let n=await C(),r;try{r=await fetch(`/api/providers/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`,"X-QuotaCap-Token":n},body:JSON.stringify({displayName:t})})}catch(t){throw new b(`/api/providers/${e}`,t)}if(!r.ok)throw new x(r.status,await S(r))}async function w(e,t,n){let r=await C(),i;try{i=await fetch(`/api/providers/${encodeURIComponent(e)}/enabled`,{method:`POST`,headers:{"Content-Type":`application/json`,"X-QuotaCap-Token":r},body:JSON.stringify(n===void 0?{enabled:t}:{enabled:t,consent:n})})}catch(t){throw new b(`/api/providers/${e}/enabled`,t)}if(!i.ok)throw new x(i.status,await S(i))}function ie(e){let t=Array.isArray(e.providers)?e.providers.map(e=>({...e,displayName:typeof e.displayName==`string`&&e.displayName?e.displayName:e.id,builtinName:e.builtinName??null,vendor:e.vendor??null,harness:e.harness??null,description:e.description??null,evidence:Array.isArray(e.evidence)?[...e.evidence]:[],lastCloses:Array.isArray(e.lastCloses)?[...e.lastCloses]:[]})):[],n=Array.isArray(e.recommendation?.advisories)?[...e.recommendation.advisories]:[];return{asOf:e.asOf,runtime:{...e.runtime,detectedProviders:Array.isArray(e.runtime?.detectedProviders)?[...e.runtime.detectedProviders]:[],opencodeLoginCommand:typeof e.runtime?.opencodeLoginCommand==`string`?e.runtime.opencodeLoginCommand:null},providers:t,recommendation:{...e.recommendation,advisories:n}}}function ae(e){return e.providers.every(e=>e.quota===null||e.quota===void 0)}function oe(e){return!e.harness&&!e.vendor?null:e.harness&&e.vendor&&e.harness===e.displayName?e.vendor:[e.harness,e.vendor].filter(Boolean).join(` · `)}function se(e){return!e||e===`unknown`?null:e}function ce(e){switch(e.split(`:`)[0]){case`codex`:case`kimi`:case`agy`:case`claude`:case`muse`:case`opencode-go`:return`5h limit`;default:return null}}function le(e,t=Date.now()){let n=t-Date.parse(e);if(!Number.isFinite(n)||n<1e3)return`read just now`;let r=Math.floor(n/1e3);if(r<60)return`read ${r}s ago`;let i=Math.floor(r/60);if(i<60)return`read ${i}m ago`;let a=Math.floor(i/60);return a<48?`read ${a}h ago`:`read ${Math.floor(a/24)}d ago`}var ue=6e5;function T(e,t,n=Date.now(),r=ue){if(t===`in-progress`)return`Refreshing now`;if(!e)return`Next automatic refresh pending`;let i=Date.parse(e);if(!Number.isFinite(i))return`Next automatic refresh pending`;let a=r-(n-i);if(a<=0)return`Next automatic refresh due`;let o=Math.max(1,Math.round(a/6e4));if(o<60)return`Next automatic refresh in ${o}m`;let s=Math.floor(o/60),c=o%60;return c===0?`Next automatic refresh in ${s}h`:`Next automatic refresh in ${s}h ${c}m`}function E(e){if(e===null||!Number.isFinite(e)||e<0)return null;let t=Math.floor(e/6e4);return t<60?`${Math.max(1,t)}m`:t<2880?`${Math.floor(t/60)}h ${t%60}m`:`${Math.floor(t/1440)}d ${Math.floor(t%1440/60)}h`}var de=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),D=o(((e,t)=>{t.exports=de()}))();function fe(e){if(e.exclusionReason!==null)return`Not reporting`;let t=e.advisory;if(!t)return`Not reporting`;if(t.bindingWindow===`monthly`&&t.bindingRemaining===0)return`Monthly exhausted`;let n=A(e);if(typeof t.bindingRemaining==`number`&&t.bindingRemaining<=0||typeof t.remaining==`number`&&t.remaining<=0||n!==null&&n>=100)return`Quota exhausted`;if(t.status===`at risk`)return`Cap risk`;if(t.status===`watch`)return`Watch`;if(t.status===`unknown`)return`Measuring`;if(t.aheadOfElapsed===!0)return`Ahead of pace`;switch(t.urgency){case`burn now`:case`use soon`:case`save`:return`Behind pace`;case`slow down`:return`Ahead of pace`;case`on track`:return`On track`}}function O(e){return e.advisory?.bindingWindow===`monthly`&&!!e.quota?.monthlyResetsAt&&typeof e.quota?.monthlyPct==`number`}function k(e){return e.quota?O(e)?e.quota.monthlyResetsAt??null:e.quota.resetsAt??null:null}function A(e){return e.quota?O(e)?e.quota.monthlyPct??null:e.quota.weeklyPct??null:null}function pe(e){return O(e)?`Monthly`:`Weekly`}function me(e){let t=Date.parse(e);if(!Number.isFinite(t))return null;let n=new Date(t);return n.setMonth(n.getMonth()-1),n.toISOString()}function he(e){return e.quota?O(e)?e.quota.monthlyResetsAt?me(e.quota.monthlyResetsAt):null:e.quota.periodStart??null:null}function ge(e,t){let n=he(e),r=k(e);if(!n||!r)return null;let i=Date.parse(n),a=Date.parse(r);return!Number.isFinite(i)||!Number.isFinite(a)||a<=i||!Number.isFinite(t)?null:Math.min(100,Math.max(0,(t-i)/(a-i)*100))}function _e(e){return e.bindingWindow===`monthly`&&typeof e.bindingRemaining==`number`&&typeof e.bindingDaysLeft==`number`&&e.bindingDaysLeft>0?e.bindingRemaining/e.bindingDaysLeft:e.idealRate}function ve(e,t){if(!e.quota||!e.advisory)return null;if(!O(e))return e.advisory.avgPace??null;let n=e.quota.monthlyPct;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=he(e);if(!r)return null;let i=Date.parse(r);if(!Number.isFinite(i)||!Number.isFinite(t))return null;let a=(((e.advisory.bindingRemaining<=0||n>=100)&&e.advisory.exhaustedAt?Date.parse(e.advisory.exhaustedAt):t)-i)/864e5;if(a<.25)return null;let o=n/a;return Number.isFinite(o)?Math.max(0,o):null}function ye(e){return O(e)?!1:e.quota?.resetsAtEstimated===!0?!0:Array.isArray(e.evidence)?e.evidence.includes(`estimated-reset`):!1}function be(e){return e?{avg:e.avgPace??null,recent:e.recentRate===void 0?e.paceSource===`recent`?e.burnRate:null:e.recentRate}:{avg:null,recent:null}}function xe(e){let{avg:t,recent:n}=be(e);return{avg:t===null?`—`:`${t.toFixed(1)}%/day`,recent:n===null?`—`:`${n.toFixed(1)}%/day`}}function Se({provider:e,asOf:t}){let n=Date.parse(t),r=e.advisory,i=O(e),a=ve(e,n),o=xe(e.advisory),s=r?`${_e(r).toFixed(1)}%/day`:`—`,c=k(e),l=c?Ae(c,n):null;return(0,D.jsxs)(`div`,{className:`pstats`,children:[(0,D.jsxs)(`div`,{title:Ce.avg,children:[(0,D.jsx)(`span`,{className:`l`,children:`Avg pace`}),(0,D.jsx)(`span`,{className:`v`,children:a===null?`—`:`${a.toFixed(1)}%/day`})]}),(0,D.jsxs)(`div`,{title:Ce.recent,children:[(0,D.jsx)(`span`,{className:`l`,children:`24h pace`}),(0,D.jsx)(`span`,{className:`v`,children:i?`—`:o.recent})]}),(0,D.jsxs)(`div`,{title:Ce.ideal,children:[(0,D.jsx)(`span`,{className:`l`,children:`Ideal pace`}),(0,D.jsx)(`span`,{className:`v`,children:s})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`span`,{className:`l`,children:`Resets in`}),(0,D.jsx)(`span`,{className:`v`,children:l?`${l}${ye(e)?` (est.)`:``}`:Me(e,n)})]})]})}var Ce={avg:`Window average — quota used ÷ days elapsed. Your overall pace this window.`,recent:`Burn over the last 24 hours. Forecasts use this rate when recent readings exist.`,ideal:`The even pace that lands exactly on 100% at reset: remaining ÷ days left.`};function we(e,t,n){if(!e)return[];let r=t?O(t):e.bindingWindow===`monthly`,i=t&&n!==void 0?ve(t,n):be(e).avg,{recent:a}=be(e),o=_e(e)??e.idealRate,s=[];return i!==null&&s.push({label:`Avg`,value:`${i.toFixed(1)}%/day`,tip:Ce.avg}),!r&&a!==null&&s.push({label:`24h`,value:`${a.toFixed(1)}%/day`,tip:Ce.recent}),s.push({label:`Ideal`,value:`${o.toFixed(1)}%/day`,tip:Ce.ideal}),s}function Te(e){switch(e){case`stale`:return`stale`;case`reset-passed`:return`reset passed`;case`invalid`:return`invalid`;case`provider-failed`:return`provider failed`;case`not-reporting`:case null:return null}}function Ee(e){return e.evidence.includes(`estimated-reset`)}function De(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=new Date(n);return`${r.toLocaleDateString(t,{weekday:`short`})} ${r.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}`}function Oe(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return null;let r=new Date(n);return`${r.toLocaleDateString(t,{weekday:`short`})} ${r.toLocaleDateString(t,{day:`numeric`,month:`short`})} ${r.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,hour12:!1})}`}function ke(e){let t=new Date(e??``);return`${t.toLocaleDateString(`en-US`,{weekday:`short`})} ${t.toLocaleDateString(`en-US`,{day:`numeric`,month:`short`})}`}function Ae(e,t){let n=Date.parse(e);if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=n-t;if(r<=0)return null;let i=Math.floor(r/6e4),a=Math.floor(i/1440),o=Math.floor(i%1440/60),s=i%60;return a>=1?`${a}d ${o}h`:o>=1?`${o}h ${s}m`:`${Math.max(1,s)}m`}function je(e){if(!Number.isFinite(e)||e<=0)return`0m`;let t=Math.round(e*24*60);if(t<60)return`${Math.max(1,t)}m`;if(t<2880)return`${Math.floor(t/60)}h ${t%60}m`;let n=Math.floor(t/1440),r=t-n*24*60,i=Math.round(r/60);return i===24&&(n+=1,i=0),`${n}d ${i}h`}function Me(e,t){if(e.exclusionReason===`reset-passed`)return`awaiting fresh window`;if(!e.quota)return`no readings`;let n=k(e);if(!n)return`no readings`;let r=Ae(n,t);if(r===null){let e=Date.parse(n);return Number.isFinite(e)&&e<=t?`awaiting fresh window`:`reset unknown`}return`in ${r}${ye(e)?` (est.)`:``}`}function Ne(e,t){if(e.exclusionReason===`reset-passed`)return{top:`awaiting fresh window`,bottom:null};if(!e.quota)return{top:`no readings`,bottom:null};let n=k(e);if(!n)return{top:`no readings`,bottom:null};let r=O(e)?Oe(n):De(n),i=Ae(n,t),a=ye(e)?` (est.)`:``;if(r&&i)return{top:`${r}${a}`,bottom:`in ${i}`};if(i===null){let e=Date.parse(n);return Number.isFinite(e)&&e<=t?{top:`awaiting fresh window`,bottom:null}:{top:`reset unknown`,bottom:null}}return{top:`reset unknown`,bottom:null}}function Pe(e,t){let n=A(e);return{usedPct:n===null?0:Math.min(100,Math.max(0,n)),elapsedPct:ge(e,t)}}function Fe(e){switch(e){case`On track`:return`var(--fill-ontrack)`;case`Behind pace`:return`var(--fill-behind)`;case`Ahead of pace`:return`var(--fill-ahead)`;case`Watch`:return`var(--fill-watch)`;case`Quota exhausted`:case`Monthly exhausted`:case`Cap risk`:return`var(--fill-cap)`;case`Measuring`:return`var(--fill-out)`;case`Not reporting`:return`var(--fill-out)`}}function Ie(e){switch(e){case`On track`:return`var(--edge-ontrack)`;case`Behind pace`:return`var(--edge-behind)`;case`Ahead of pace`:return`var(--edge-ahead)`;case`Watch`:return`var(--edge-watch)`;case`Quota exhausted`:case`Monthly exhausted`:case`Cap risk`:return`var(--edge-cap)`;case`Measuring`:return`var(--edge-out)`;case`Not reporting`:return`var(--edge-out)`}}function Le(e){switch(e){case`Behind pace`:return`behind`;case`Watch`:return`watch`;case`Quota exhausted`:case`Monthly exhausted`:case`Cap risk`:return`cap`;case`On track`:return`ontrack`;default:return`none`}}function Re(e,t){let n;return e===`Quota exhausted`?n=`Quota fully used until reset`:e===`Monthly exhausted`?n=`Monthly quota fully used until reset`:e===`Cap risk`?n=`Burning faster than the window allows and ahead of elapsed time`:e===`Watch`&&(n=`Pace points at the cap, but position or the reset clock is uncertain`),n&&t&&(n+=` (estimated reset)`),n}function ze({provider:e,compact:t=!1}){let n=fe(e),r=Te(e.exclusionReason),i=n===`Behind pace`?`pace-behind`:n===`On track`?`pace-ontrack`:n===`Ahead of pace`?`pace-ahead`:n===`Watch`?`pace-watch`:n===`Cap risk`||n===`Monthly exhausted`||n===`Quota exhausted`?`pace-cap`:`pace-out`,a=t&&r?`${n} · ${r}`:Re(n,ye(e));return(0,D.jsxs)(`span`,{"data-testid":`pace-badge`,className:`pace ${i}`,title:a,children:[n,!t&&r?` · ${r}`:``]})}function Be(e,t){if(e.resetPassed)return!1;let n=k(e);if(!n)return!1;let r=Date.parse(n);if(Number.isFinite(r)&&t!==void 0&&r<=t)return!1;let i=A(e);return!!(i!==null&&i>=100||O(e)&&e.quota?.monthlyStatus===`exhausted`)}function Ve(e,t){let n=fe(e),r=e.advisory?.bindingWindow===`monthly`,i=e.advisory?.wastePct,a=!r&&i!=null&&Number.isFinite(i)&&i>=3,o=Be(e,t);if(e.exclusionReason!==null&&o){let t=j(e);return{text:t?`Exhausted · ${t}`:`Exhausted · quota fully used`,kind:`cap`,hatch:!1}}let s=a&&n===`Behind pace`?`${Math.round(i)}% expires unused`:j(e);return s?{text:s,kind:r?e.advisory.bindingRemaining===0?`cap`:`behind`:Le(n),hatch:a}:null}function He({provider:e,asOf:t,showHeadline:n=!0}){let r=fe(e),i=Date.parse(t),{usedPct:a,elapsedPct:o}=Pe(e,i),s=e.advisory?.wastePct,c=Ve(e,i),l=c?.hatch??!1,u=A(e),d=e.quota?`${e.id}: ${u??e.quota.weeklyPct}% used, ${r}`:`${e.id}: no readings, ${r}`,f=Be(e,i),p=f?`var(--fill-cap)`:Fe(r),m=f?`var(--edge-cap)`:Ie(r);return(0,D.jsxs)(`div`,{"data-testid":`pace-bar`,role:`img`,"aria-label":d,className:`trackwrap`,children:[n&&e.quota&&(0,D.jsxs)(`div`,{className:`tline`,children:[(0,D.jsxs)(`span`,{className:`used`,children:[u??e.quota.weeklyPct,`% used`]}),c&&c.kind!==`none`?(0,D.jsxs)(`span`,{className:`out out-${c.kind}`,children:[`→ `,c.text]}):c?(0,D.jsxs)(`span`,{className:`out out-none`,children:[`→ `,c.text]}):null]}),(0,D.jsxs)(`div`,{className:`track`,children:[(0,D.jsx)(`div`,{"aria-hidden":`true`,className:`fill`,style:{width:`${a}%`,background:p,"--fill-edge":m}}),l&&(0,D.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`pace-hatch`,className:`band band-waste`,style:{left:`${100-s}%`,width:`${s}%`}}),o!==null&&(0,D.jsx)(`div`,{"aria-hidden":`true`,title:`elapsed`,className:`mark`,style:{left:`${o}%`}})]}),(0,D.jsxs)(`div`,{className:`tfoot`,children:[(0,D.jsx)(`span`,{children:`start`}),(0,D.jsx)(`span`,{children:o===null?``:`Time elapsed: ${Math.round(o)}%`}),(0,D.jsx)(`span`,{children:`reset`})]})]})}function j(e){if(e.exclusionReason===`not-reporting`||!e.quota)return`Not reporting yet.`;switch(e.exclusionReason){case`stale`:{let t=E(e.ageMs);return t?`Stale. Last read ${t} ago.`:`Stale. Last read unknown.`}case`reset-passed`:return`Reset passed. Awaiting fresh window.`;case`invalid`:return`Reading invalid. Excluded from ranking.`;case`provider-failed`:return`Provider failed. Excluded from ranking.`}let t=e.advisory;return t?t.bindingWindow===`monthly`&&t.bindingRemaining<=0?`unused until ${ke(e.quota.monthlyResetsAt)}`:t.bindingWindow===`monthly`?`${Math.round(t.bindingRemaining)}% of month left`:t.remaining<=0?`Exhausted · quota fully used`:t.paceSource===`unknown`?`Measuring pace · ${Math.round(t.remaining)}% remaining`:t.status===`at risk`?t.daysToExhaust!==null&&Number.isFinite(t.daysToExhaust)?`Cap risk · exhausts in ${je(t.daysToExhaust)} at current pace`:`Cap risk at current pace`:t.status===`watch`?t.daysToExhaust!==null&&Number.isFinite(t.daysToExhaust)?`Watch · exhausts in ${je(t.daysToExhaust)} at current pace`:`Watch at current pace`:t.wastePct===null?`On track.`:`${Math.round(t.wastePct)}% waste in ${je(t.daysLeft)}`:null}var Ue={kimi:`M12 7v5l3 2M12 12m-8.5 0a8.5 8.5 0 1 0 17 0a8.5 8.5 0 1 0-17 0`,claude:`M6 3h8l4 4v14H6zM9 12h6M9 16h6`,grok:`M12 3.5l2.6 5.5 5.9.8-4.3 4.2 1 5.9-5.2-2.8-5.2 2.8 1-5.9L3.5 9.8l5.9-.8z`,codex:`M8 5l10 7-10 7z`,agy:`M12 4l7 7-7 9-7-9z`,muse:`M12 3l1.8 6.2L20 11l-6.2 1.8L12 19l-1.8-6.2L4 11l6.2-1.8z`};function We(e){return e.split(`:`)[0]}function Ge({id:e,title:t,size:n=17}){let r=We(e),i=Ue[r];return i?(0,D.jsx)(`svg`,{width:n,height:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:r===`kimi`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`path`,{d:`M12 7v5l3 2`}),(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})]}):r===`claude`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`path`,{d:`M6 3h8l4 4v14H6z`}),(0,D.jsx)(`path`,{d:`M9 12h6M9 16h6`})]}):(0,D.jsx)(`path`,{d:i})}):(0,D.jsx)(`span`,{"aria-hidden":`true`,children:t.charAt(0)})}function Ke(e){let t=We(e);return{background:`color-mix(in oklch, var(--p-${t}, var(--surface-raised)) 18%, transparent)`,color:`var(--p-${t}, var(--ink))`}}function qe(e,t){if(t!==null||e.bindingWindow===`monthly`&&e.bindingRemaining===0)return null;switch(e.urgency){case`burn now`:case`use soon`:case`save`:return`use-more`;case`slow down`:return`ease-off`;case`on track`:return null}}function Je(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[],i=[];for(let t of e){let e=n.get(t.provider);if(!e)continue;let a=qe(t,e.exclusionReason);a===`use-more`?r.push(t):a===`ease-off`&&i.push(t)}return{useMore:r,easeOff:i}}function Ye({testId:e,label:t,tintClass:n,laneClass:r,icon:i,members:a,providers:o,asOfMs:s,onSelectProvider:c}){if(a.length===0)return null;let l=new Map(o.map(e=>[e.id,e]));return(0,D.jsxs)(`div`,{"data-testid":e,"aria-label":t,className:`lane ${n}`,children:[(0,D.jsxs)(`span`,{className:`lane-l ${r}`,children:[i,t]}),(0,D.jsx)(`div`,{className:`items`,children:a.map(e=>{let t=l.get(e.provider),n=t?.quota,r=t?k(t):null,i=r?Ae(r,s):null,a=t?A(t):null,o=t?.displayName??e.provider;return(0,D.jsxs)(`div`,{className:`rsub`,children:[(0,D.jsx)(`span`,{className:`sq`,style:Ke(e.provider),"aria-hidden":`true`,children:(0,D.jsx)(Ge,{id:e.provider,title:o,size:13})}),(0,D.jsx)(`div`,{className:`rnm-group`,children:(0,D.jsx)(`button`,{type:`button`,className:`rnm`,onClick:()=>c?.(e.provider),"aria-label":`View ${o} details`,children:o})}),(0,D.jsx)(`span`,{className:`rnum`,children:n?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`b`,{children:[a,`%`]}),` used`,i?(0,D.jsxs)(D.Fragment,{children:[` · `,(0,D.jsx)(`b`,{children:i}),` left`]}):null]}):null})]},e.provider)})})]})}function Xe({recommendation:e,providers:t,asOf:n,onSelectProvider:r,onViewAdvice:i}){let{useMore:a,easeOff:o}=Je(e.advisories,t),s=Date.parse(n),c=e.use!==`none`&&e.wastePct===null,l=e.advisories.some(e=>e.status===`at risk`||e.status===`watch`),u=e.use===`none`&&a.length===0&&o.length===0&&!l,d=t.filter(e=>e.enabled&&e.id!==`manual`).length,f=o.some(e=>e.status===`watch`)?`tint-watch`:o.some(e=>e.status===`at risk`)?`tint-cap`:`tint-ahead`,p=f===`tint-cap`?`l-cap`:f===`tint-watch`?`l-watch`:`l-ahead`,m=t.find(t=>t.id===e.use),h=m?k(m):null,g=h?Ae(h,s):null,_=()=>{i?.()},v=(0,D.jsxs)(`div`,{className:`section-head`,children:[(0,D.jsx)(`h2`,{children:`Quota Advice & Pacing`}),(0,D.jsxs)(`span`,{className:`note`,children:[d,` tracked · `,le(n)]})]});return u?(0,D.jsxs)(`section`,{"aria-label":`Quota advice and pacing`,children:[v,(0,D.jsxs)(`section`,{"data-testid":`recommendation`,"aria-label":`Recommendation`,className:`recwrap is-clear`,role:`status`,children:[(0,D.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z`}),(0,D.jsx)(`path`,{d:`M8 12.5l2.8 2.8L16 10`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`b`,{children:`No subscription needs priority`}),(0,D.jsx)(`span`,{"data-testid":`rec-prose`,children:e.reason})]})]})]}):(0,D.jsxs)(`section`,{"aria-label":`Quota advice and pacing`,children:[v,(0,D.jsxs)(`section`,{"data-testid":`recommendation`,"aria-label":`Recommendation`,className:`recwrap`,role:`status`,children:[(0,D.jsxs)(`div`,{className:`rec-top`,children:[(0,D.jsxs)(`div`,{className:`rec-lead`,children:[(0,D.jsxs)(`span`,{className:`rec-badge`,children:[(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})}),`Recommendation`]}),e.use===`none`?(0,D.jsx)(`p`,{className:`rec-advice-prose`,"data-testid":`rec-prose`,children:e.reason}):(0,D.jsxs)(`p`,{className:`rec-advice-prose`,"data-testid":`rec-prose`,children:[`Switch to `,(0,D.jsx)(`strong`,{children:m?.displayName??e.use}),` next`,e.wastePct!==null&&e.bindingWindow!==`monthly`?(0,D.jsxs)(D.Fragment,{children:[` — `,(0,D.jsxs)(`strong`,{children:[Math.round(e.wastePct),`%`]}),` unused quota forecast`,g?(0,D.jsxs)(D.Fragment,{children:[` to expire in `,(0,D.jsx)(`strong`,{children:g})]}):null,`.`]}):(0,D.jsxs)(D.Fragment,{children:[` — `,e.reason]})]}),c&&(0,D.jsx)(`span`,{className:`rec-badge`,"data-testid":`rec-measuring`,style:{background:`var(--ahead-soft)`,color:`var(--ahead)`,borderColor:`var(--ahead)`},children:`measuring pace`})]}),e.use!==`none`&&(0,D.jsxs)(`button`,{type:`button`,className:`btn`,"data-testid":`view-advice`,title:`Open quota advice`,onClick:_,children:[`View advice`,(0,D.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M5 12h14M12 5l7 7-7 7`})})]})]}),(a.length>0||o.length>0)&&(0,D.jsxs)(`div`,{className:`recB`,children:[(0,D.jsx)(Ye,{testId:`lane-use-more`,label:`Use more`,tintClass:`tint-behind`,laneClass:`l-behind`,icon:(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,D.jsx)(`path`,{d:`M12 20V5M6 11l6-6 6 6`})}),members:a,providers:t,asOfMs:s,onSelectProvider:r}),(0,D.jsx)(Ye,{testId:`lane-ease-off`,label:`Ease off`,tintClass:f,laneClass:p,icon:(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.6`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,D.jsx)(`path`,{d:`M12 4v15M6 13l6 6 6-6`})}),members:o,providers:t,asOfMs:s,onSelectProvider:r})]})]})]})}var Ze=365.2425,Qe=6048e5,$e=864e5,et=86400;et*7,et*Ze/12*3;var tt=Symbol.for(`constructDateFrom`);function nt(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&tt in e?e[tt](t):e instanceof Date?new e.constructor(t):new Date(t)}function rt(e,t){return nt(t||e,e)}var it={};function at(){return it}function ot(e,t){let n=at(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=rt(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function st(e,t){return ot(e,{...t,weekStartsOn:1})}function ct(e,t){let n=rt(e,t?.in),r=n.getFullYear(),i=nt(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=st(i),o=nt(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=st(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function lt(e){let t=rt(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-n}function ut(e,...t){let n=nt.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function dt(e,t){let n=rt(e,t?.in);return n.setHours(0,0,0,0),n}function ft(e,t,n){let[r,i]=ut(n?.in,e,t),a=dt(r),o=dt(i),s=+a-lt(a),c=+o-lt(o);return Math.round((s-c)/$e)}function pt(e,t){let n=ct(e,t),r=nt(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),st(r)}function mt(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function ht(e){return!(!mt(e)&&typeof e!=`number`||isNaN(+rt(e)))}function gt(e,t){let n=rt(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var _t={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},vt=(e,t,n)=>{let r,i=_t[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function yt(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var bt={date:yt({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:yt({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:yt({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},xt={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},St=(e,t,n,r)=>xt[e];function Ct(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var wt={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Ct({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Ct({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Ct({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Ct({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Ct({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Tt(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Dt(s,e=>e.test(o)):Et(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Et(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Dt(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Ot(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var kt={code:`en-US`,formatDistance:vt,formatLong:bt,formatRelative:St,localize:wt,match:{ordinalNumber:Ot({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Tt({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Tt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Tt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Tt({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Tt({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function At(e,t){let n=rt(e,t?.in);return ft(n,gt(n))+1}function jt(e,t){let n=rt(e,t?.in),r=+st(n)-pt(n);return Math.round(r/Qe)+1}function Mt(e,t){let n=rt(e,t?.in),r=n.getFullYear(),i=at(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=nt(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=ot(o,t),c=nt(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=ot(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Nt(e,t){let n=at(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Mt(e,t),a=nt(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),ot(a,t)}function Pt(e,t){let n=rt(e,t?.in),r=+ot(n,t)-Nt(n,t);return Math.round(r/Qe)+1}function M(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var Ft={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return M(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):M(n+1,2)},d(e,t){return M(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return M(e.getHours()%12||12,t.length)},H(e,t){return M(e.getHours(),t.length)},m(e,t){return M(e.getMinutes(),t.length)},s(e,t){return M(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return M(Math.trunc(r*10**(n-3)),t.length)}},It={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},Lt={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return Ft.y(e,t)},Y:function(e,t,n,r){let i=Mt(e,r),a=i>0?i:1-i;return t===`YY`?M(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):M(a,t.length)},R:function(e,t){return M(ct(e),t.length)},u:function(e,t){return M(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return M(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return M(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return Ft.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return M(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Pt(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):M(i,t.length)},I:function(e,t,n){let r=jt(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):M(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):Ft.d(e,t)},D:function(e,t,n){let r=At(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):M(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return M(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return M(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return M(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?It.noon:r===0?It.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?It.evening:r>=12?It.afternoon:r>=4?It.morning:It.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return Ft.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):Ft.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):M(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):M(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):Ft.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):Ft.s(e,t)},S:function(e,t){return Ft.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return zt(r);case`XXXX`:case`XX`:return Bt(r);default:return Bt(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return zt(r);case`xxxx`:case`xx`:return Bt(r);default:return Bt(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+Rt(r,`:`);default:return`GMT`+Bt(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+Rt(r,`:`);default:return`GMT`+Bt(r,`:`)}},t:function(e,t,n){return M(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return M(+e,t.length)}};function Rt(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+M(a,2)}function zt(e,t){return e%60==0?(e>0?`-`:`+`)+M(Math.abs(e)/60,2):Bt(e,t)}function Bt(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=M(Math.trunc(r/60),2),a=M(r%60,2);return n+i+t+a}var Vt=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Ht=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},Ut={p:Ht,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Vt(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`})}return a.replace(`{{date}}`,Vt(r,t)).replace(`{{time}}`,Ht(i,t))}},Wt=/^D+$/,Gt=/^Y+$/,Kt=[`D`,`DD`,`YY`,`YYYY`];function qt(e){return Wt.test(e)}function Jt(e){return Gt.test(e)}function Yt(e,t,n){let r=Xt(e,t,n);if(console.warn(r),Kt.includes(e))throw RangeError(r)}function Xt(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Zt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Qt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$t=/^'([^]*?)'?$/,en=/''/g,tn=/[a-zA-Z]/;function nn(e,t,n){let r=at(),i=n?.locale??r.locale??kt,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=rt(e,n?.in);if(!ht(s))throw RangeError(`Invalid time value`);let c=t.match(Qt).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=Ut[t];return n(e,i.formatLong)}return e}).join(``).match(Zt).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:rn(e)};if(Lt[t])return{isToken:!0,value:e};if(t.match(tn))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&Jt(a)||!n?.useAdditionalDayOfYearTokens&&qt(a))&&Yt(a,t,String(e));let o=Lt[a[0]];return o(s,a,i.localize,l)}).join(``)}function rn(e){let t=e.match($t);return t?t[1].replace(en,`'`):e}var an=9e5;function on(e){let t=e.lastCloses;return Array.isArray(t)&&t.length>0?t[0]:null}function sn(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?nn(new Date(t),`d MMM`):null}function cn(e){if(!e.resetsAt)return!0;let t=Date.parse(e.resetsAt),n=Date.parse(e.sampledAt);return!Number.isFinite(t)||!Number.isFinite(n)||t-n>an}function ln(e){let t=Date.parse(e);return Number.isFinite(t)?nn(new Date(t),`EEE d MMM H:mm`):null}function un(e){let t=Date.parse(e);return Number.isFinite(t)?nn(new Date(t),`d MMM HH:mm`):null}function dn(e){if(e<6e4)return{n:Math.max(1,Math.floor(e/1e3)),unit:`s`};let t=Math.floor(e/6e4);if(t<60)return{n:t,unit:`m`};let n=Math.floor(t/60);return n<48?{n,unit:`h`}:{n:Math.floor(n/24),unit:`d`}}function fn(e){let{n:t,unit:n}=dn(e);return`${t}${n}`}function pn({closes:e,windowName:t}){if(!Array.isArray(e)||e.length===0)return null;let n=[...e].reverse(),r=n.map(e=>sn(e.resetsAt));return(0,D.jsxs)(`section`,{className:`dsec`,"aria-label":`History`,children:[t?(0,D.jsxs)(`div`,{className:`burn-head`,children:[(0,D.jsx)(`h3`,{children:`History`}),(0,D.jsxs)(`span`,{className:`burn-win`,children:[t,` quota window`]})]}):(0,D.jsx)(`h3`,{children:`History`}),(0,D.jsxs)(`div`,{className:`hchart`,"data-testid":`closed-weeks`,children:[(0,D.jsx)(`div`,{className:`hgrid`,children:(0,D.jsx)(`span`,{children:`100%`})}),n.map((e,t)=>{let n=Math.min(100,Math.max(0,e.usedPct)),i=Math.min(100,Math.max(0,e.leftoverPct)),a=cn(e),o=ln(e.sampledAt),s=e.resetsAt?un(e.resetsAt):null,c=e.resetsAt?Date.parse(e.resetsAt)-Date.parse(e.sampledAt):NaN,l=e.resetsAtEstimated?` (est.)`:``,u=[`${e.usedPct}% used`,`${e.leftoverPct}% leftover`,s?`reset ${s}${l}`:`reset unknown`,a&&o?`last reading ${o}`:null].filter(Boolean).join(`, `);return(0,D.jsxs)(`div`,{className:`hcol`,title:u,children:[(0,D.jsx)(`div`,{className:`hbars`,children:(0,D.jsxs)(`div`,{className:`hbar`,children:[i>=3&&(0,D.jsx)(`span`,{className:`hatch`,style:{height:`${i}%`}}),(0,D.jsx)(`span`,{className:`solid`,style:{height:`${n}%`}})]})}),(0,D.jsxs)(`div`,{className:`hlab`,children:[r[t]??`date unknown`,(0,D.jsxs)(`b`,{children:[e.leftoverPct,`% leftover`,l]}),a&&Number.isFinite(c)&&c>0&&(0,D.jsxs)(D.Fragment,{children:[`read `,fn(c),` early`]})]})]},`${e.detectedAt}-${e.sampledAt}`)})]})]})}var mn=6e4,hn=60*mn,gn=24*hn;function _n(e,t){let n=Date.parse(e)-t;return!Number.isFinite(n)||n<=0?null:n>=gn?`${Math.floor(n/gn)}d`:n>=hn?`${Math.floor(n/hn)}h`:`${Math.max(1,Math.floor(n/mn))}m`}function vn(e,t){return t||e>=100?`full`:e>=80?`hot`:``}function yn(e,t){let n=e.quota;if(!n)return[];let r=e.advisory?.bindingWindow===`monthly`&&n.monthlyKind===`included`&&typeof n.monthlyPct==`number`&&!!n.monthlyResetsAt,i=[];if(r&&typeof n.weeklyPct==`number`&&Number.isFinite(n.weeklyPct)){let e=_n(n.resetsAt,t);i.push({win:`week`,tag:`Wk`,cardLabel:`Weekly`,rowLabel:`Week`,pct:n.weeklyPct,heat:vn(n.weeklyPct,!1),time:e?`in ${e}`:null,reset:e?`in ${e}`:null})}if(typeof n.fiveHourPct==`number`&&Number.isFinite(n.fiveHourPct)){let e=n.fiveHourResetsAt&&Date.parse(n.fiveHourResetsAt)<=t?0:n.fiveHourPct;i.push({win:`five`,tag:`5h`,cardLabel:`5h limit`,rowLabel:`5h`,pct:e,heat:vn(e,!1),time:null,reset:null})}if(!r&&n.monthlyKind===`included`&&typeof n.monthlyPct==`number`&&n.monthlyResetsAt){let e=n.monthlyStatus===`exhausted`,r=_n(n.monthlyResetsAt,t),a=Oe(n.monthlyResetsAt);i.push({win:`month`,tag:`Mth`,cardLabel:`Monthly`,rowLabel:`Month`,pct:n.monthlyPct,heat:vn(n.monthlyPct,e),time:e?ke(n.monthlyResetsAt):r?`in ${r}`:null,reset:e?a?`resets ${a}`:null:r?`in ${r}`:null})}return i}function bn(e,t=!1){let n=t||e>=80;return{width:`${Math.min(100,Math.max(0,e))}%`,background:n?`var(--fill-cap)`:`var(--fill-ontrack)`,"--fill-edge":n?`var(--edge-cap)`:`var(--edge-ontrack)`}}function xn(e){return bn(e.pct,e.heat===`full`)}function Sn({provider:e,asOf:t,variant:n}){let[r,i]=_.useState(!1),a=yn(e,Date.parse(t));return a.length===0?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`button`,{type:`button`,className:`wline`,"data-testid":`wline-${e.id}`,"aria-expanded":r,"aria-label":`${e.displayName} other windows: ${a.map(e=>`${e.tag} ${e.pct}%${e.time?` ${e.time}`:``}`).join(`, `)}`,onClick:e=>{e.stopPropagation(),i(e=>!e)},children:[a.map(e=>(0,D.jsxs)(`span`,{className:`unit`,"data-win":e.win,children:[(0,D.jsxs)(`span`,{className:e.heat?`seg ${e.heat}`:`seg`,children:[(0,D.jsx)(`span`,{className:`k`,children:e.tag}),(0,D.jsxs)(`span`,{className:`n`,children:[e.pct,`%`]})]}),e.time&&(0,D.jsx)(`span`,{className:`t`,children:e.time})]},e.win)),(0,D.jsx)(`span`,{className:`chev`,"aria-hidden":`true`,children:(0,D.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,children:(0,D.jsx)(`path`,{d:`M4 6l4 4 4-4`})})})]}),r&&(0,D.jsx)(`div`,{className:`windows`,"data-testid":`windows-${e.id}`,children:a.map(e=>(0,D.jsxs)(`div`,{className:`win`,"data-win":e.win,children:[(0,D.jsx)(`span`,{className:`lab`,children:n===`card`?e.cardLabel:e.rowLabel}),(0,D.jsx)(`div`,{className:`track`,children:(0,D.jsx)(`div`,{className:`fill`,style:xn(e)})}),(0,D.jsxs)(`span`,{className:`pct`,children:[e.pct,`%`]}),n===`card`&&e.reset&&(0,D.jsx)(`span`,{className:`reset`,children:e.reset})]},e.win))})]})}function Cn(e){let t=k(e);if(!t)return null;let n=O(e)?Oe(t):De(t);return n?`Resets ${n}${ye(e)?` (est.)`:``}`:null}function wn({provider:e,recommended:t,asOf:n,onSelect:r}){let i=Date.parse(n),a=E(e.ageMs),o=e.displayName,s=on(e);return(0,D.jsxs)(`article`,{"data-testid":`provider-card-${e.id}`,role:`button`,tabIndex:0,"aria-label":`${o} details`,onClick:()=>r(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&t.target===t.currentTarget&&(t.preventDefault(),r(e.id))},className:`pcard ${t?`is-recommended is-top-pick`:``}`,children:[(0,D.jsxs)(`div`,{className:`pcard-head`,children:[(0,D.jsx)(`span`,{className:`picon`,style:Ke(e.id),"aria-hidden":`true`,children:(0,D.jsx)(Ge,{id:e.id,title:o})}),(0,D.jsxs)(`div`,{className:`who`,children:[(0,D.jsxs)(`b`,{children:[o,t&&(0,D.jsx)(`span`,{className:`rec-icon`,title:`Recommended for next session`,role:`img`,"aria-label":`recommended`,children:(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})})})]}),a&&(0,D.jsxs)(`span`,{className:`src`,children:[`Updated `,a,` ago`]})]}),(0,D.jsx)(ze,{provider:e})]}),(0,D.jsxs)(`div`,{className:`pcard-body`,children:[(0,D.jsx)(He,{provider:e,asOf:n}),(0,D.jsx)(Sn,{provider:e,asOf:n,variant:`card`}),(0,D.jsx)(Se,{provider:e,asOf:n})]}),(0,D.jsxs)(`div`,{className:`pcard-foot`,children:[(0,D.jsxs)(`div`,{className:`foot-meta`,children:[(0,D.jsx)(`span`,{children:Cn(e)??Me(e,i)}),s&&(0,D.jsxs)(`span`,{className:`last-week`,children:[`Last `,O(e)?`month`:`week`,` `,s.leftoverPct,`% leftover`,s.resetsAtEstimated?` (est.)`:``]})]}),(0,D.jsx)(`span`,{className:`rowbtn`,"aria-hidden":`true`,children:`Inspect`})]})]})}function Tn({provider:e,recommended:t,asOf:n,onSelect:r}){let i=e.quota,a=e.advisory,o=Date.parse(n),s=we(a,e,o),c=e.displayName,l=Ne(e,o),u=on(e);return(0,D.jsxs)(`div`,{"data-testid":`provider-row-${e.id}`,className:`lrow ${t?`is-recommended is-top-pick`:``}`,onClick:()=>r(e.id),children:[(0,D.jsxs)(`div`,{className:`prov`,"data-label":`Provider`,children:[(0,D.jsx)(`span`,{className:`dot`,style:{background:`var(--p-${e.id.split(`:`)[0]}, var(--surface-raised))`},"aria-hidden":`true`}),(0,D.jsx)(`span`,{children:(0,D.jsxs)(`span`,{className:`nm`,children:[c,t&&(0,D.jsx)(`span`,{className:`rec-icon`,title:`Recommended for next session`,role:`img`,"aria-label":`recommended`,children:(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})})})]})})]}),(0,D.jsx)(`div`,{"data-label":`Used vs elapsed`,children:i?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(He,{provider:e,asOf:n}),(0,D.jsx)(Sn,{provider:e,asOf:n,variant:`row`})]}):`—`}),(0,D.jsxs)(`div`,{"data-label":`Reset`,className:`reset-cell`,children:[(0,D.jsx)(`span`,{className:`cell-b`,children:l.top}),l.bottom&&(0,D.jsx)(`span`,{className:`cell-s`,children:l.bottom}),u&&(0,D.jsxs)(`span`,{className:`cell-s`,children:[`last `,O(e)?`month`:`week`,` `,u.leftoverPct,`% leftover`,u.resetsAtEstimated?` (est.)`:``]})]}),(0,D.jsxs)(`div`,{"data-label":`Pace`,children:[(0,D.jsx)(ze,{provider:e}),s.length>0&&(0,D.jsx)(`div`,{style:{marginTop:2},children:s.map(e=>(0,D.jsxs)(`div`,{className:`cell-s paceline`,title:e.tip,children:[(0,D.jsx)(`span`,{children:e.label}),(0,D.jsx)(`span`,{className:`cell-b`,children:e.value})]},e.label))})]}),(0,D.jsx)(`button`,{type:`button`,className:`rowbtn`,onClick:t=>{t.stopPropagation(),r(e.id)},children:`Inspect`}),(0,D.jsx)(`span`,{className:`sr-only`,children:j(e)})]})}var En=class extends _.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.error!==null&&this.setState({error:null})}render(){return this.state.error===null?this.props.children:this.props.fallback}};function Dn({id:e,name:t}){return(0,D.jsxs)(`article`,{"data-testid":`provider-card-${e}-error`,className:`pcard`,role:`alert`,children:[(0,D.jsx)(`div`,{className:`pcard-head`,children:(0,D.jsx)(`div`,{className:`who`,children:(0,D.jsx)(`b`,{children:t})})}),(0,D.jsx)(`div`,{className:`pcard-body`,children:(0,D.jsx)(`p`,{className:`cell-s`,children:`Couldn't show this subscription.`})})]})}function On({id:e,name:t}){return(0,D.jsxs)(`div`,{"data-testid":`provider-row-${e}-error`,className:`lrow`,role:`alert`,children:[(0,D.jsx)(`div`,{className:`prov`,"data-label":`Provider`,children:(0,D.jsx)(`span`,{children:(0,D.jsx)(`span`,{className:`nm`,children:t})})}),(0,D.jsx)(`div`,{"data-label":`Used vs elapsed`,children:(0,D.jsx)(`span`,{className:`cell-s`,children:`Couldn't show this subscription.`})})]})}function kn({name:e,onClose:t}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{"data-testid":`drawer-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:t}),(0,D.jsxs)(`aside`,{"data-testid":`provider-drawer-error`,role:`alert`,className:`drawer is-open`,children:[(0,D.jsxs)(`div`,{className:`drawer-head`,children:[(0,D.jsx)(`div`,{style:{flex:1,minWidth:0},children:(0,D.jsx)(`h2`,{children:e})}),(0,D.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close provider details`,onClick:t,children:(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,D.jsx)(`section`,{className:`dsec`,"aria-label":`Details unavailable`,children:(0,D.jsx)(`p`,{className:`cell-s`,children:`Couldn't show these details.`})})]})]})}function An(e,t,n){let r=[...e];if(t===`recommended`){let{useMore:t,easeOff:i}=Je(n.advisories,e),a=new Map,o=0;n.use!==`none`&&a.set(n.use,o++);for(let e of[...t,...i])a.has(e.provider)||a.set(e.provider,o++);let s=e=>e.exclusionReason!==null||e.advisory?.bindingWindow===`monthly`&&e.advisory.bindingRemaining===0,c=r.filter(e=>!s(e)&&a.has(e.id)).sort((e,t)=>a.get(e.id)-a.get(t.id)),l=r.filter(e=>!s(e)&&!a.has(e.id)),u=r.filter(s);return[...c,...l,...u]}let i=e=>{let t=k(e);return t?Date.parse(t):NaN},a=e=>{let t=A(e);return t===null?NaN:t},o=(e,t)=>r.sort((n,r)=>{let i=t(n),a=t(r),o=!Number.isFinite(i),s=!Number.isFinite(a);return o&&s?0:o?1:s?-1:e(i,a)});switch(t){case`reset-asc`:return o((e,t)=>e-t,i);case`reset-desc`:return o((e,t)=>t-e,i);case`used-desc`:return o((e,t)=>t-e,a);case`used-asc`:return o((e,t)=>e-t,a)}}function jn(e,t){return e}var Mn=[{value:`recommended`,label:`Recommended`},{value:`reset-asc`,label:`Earliest Reset`},{value:`reset-desc`,label:`Latest Reset`},{value:`used-desc`,label:`Highest Usage`},{value:`used-asc`,label:`Lowest Usage`}];function Nn({value:e,onChange:t}){let[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(null),a=Mn.find(t=>t.value===e)??Mn[0];return(0,_.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,D.jsxs)(`div`,{className:`sort-dropdown`,ref:i,children:[(0,D.jsxs)(`button`,{type:`button`,className:`sort-btn`,"data-testid":`sort-select`,"aria-label":`Sort by`,"aria-haspopup":`listbox`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,D.jsx)(`span`,{className:`sort-icon`,"aria-hidden":`true`,children:(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,D.jsx)(`line`,{x1:`4`,y1:`6`,x2:`20`,y2:`6`}),(0,D.jsx)(`line`,{x1:`4`,y1:`12`,x2:`14`,y2:`12`}),(0,D.jsx)(`line`,{x1:`4`,y1:`18`,x2:`8`,y2:`18`})]})}),(0,D.jsxs)(`span`,{className:`sort-display`,children:[(0,D.jsx)(`span`,{className:`sort-prefix`,children:`Sort by:`}),(0,D.jsx)(`span`,{className:`sort-val`,children:a.label})]}),(0,D.jsx)(`svg`,{className:`sort-chevron`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m6 9 6 6 6-6`})})]}),n&&(0,D.jsx)(`div`,{className:`sort-menu`,role:`listbox`,"aria-label":`Sort subscriptions`,children:Mn.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,className:`sort-option${n.value===e?` is-active`:``}`,"aria-selected":n.value===e,onClick:()=>{t(n.value),r(!1)},children:[(0,D.jsx)(`span`,{children:n.label}),(0,D.jsx)(`svg`,{className:`check-svg`,width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})]},n.value))})]})}function Pn({providers:e,recommendation:t,asOf:n,lastCompletedPollAt:r,polling:i,onSelectProvider:a}){let[o,s]=(0,_.useState)(`cards`),[c,l]=(0,_.useState)(`recommended`),u=jn(o,!1),d=An(e,c,t),f=d.filter(e=>e.enabled&&(e.id!==`manual`||e.quota!==null)),p=d.filter(e=>!e.enabled&&e.id!==`manual`),m=Date.parse(n),h=f.filter(e=>e.exclusionReason===null),g=f.filter(e=>e.exclusionReason!==null);return(0,D.jsxs)(`section`,{"aria-label":`Subscriptions`,children:[(0,D.jsxs)(`div`,{className:`section-head`,children:[(0,D.jsx)(`h2`,{children:`All subscriptions`}),(0,D.jsxs)(`div`,{className:`section-head-controls`,children:[(0,D.jsx)(Nn,{value:c,onChange:l}),(0,D.jsxs)(`div`,{role:`group`,"aria-label":`Display density`,className:`seg`,children:[(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":u===`cards`,onClick:()=>s(`cards`),children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,D.jsx)(`rect`,{x:`3`,y:`3`,width:`8`,height:`8`,rx:`2`}),(0,D.jsx)(`rect`,{x:`13`,y:`3`,width:`8`,height:`8`,rx:`2`}),(0,D.jsx)(`rect`,{x:`3`,y:`13`,width:`8`,height:`8`,rx:`2`}),(0,D.jsx)(`rect`,{x:`13`,y:`13`,width:`8`,height:`8`,rx:`2`})]}),`Cards`]}),(0,D.jsxs)(`button`,{type:`button`,"aria-pressed":u===`table`,onClick:()=>s(`table`),children:[(0,D.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,D.jsx)(`rect`,{x:`3`,y:`5`,width:`18`,height:`2.6`,rx:`1.3`}),(0,D.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`2.6`,rx:`1.3`}),(0,D.jsx)(`rect`,{x:`3`,y:`17`,width:`18`,height:`2.6`,rx:`1.3`})]}),`Table`]})]})]})]}),u===`cards`?(0,D.jsx)(`div`,{"data-testid":`cards-grid`,className:`cards cards-grid`,children:f.map(e=>(0,D.jsx)(En,{resetKey:e.quota?.fetchedAt??null,fallback:(0,D.jsx)(Dn,{id:e.id,name:e.displayName}),children:(0,D.jsx)(wn,{provider:e,recommended:e.id===t.use,asOf:n,onSelect:a})},e.id))}):(0,D.jsx)(`div`,{className:`table-scroll`,children:(0,D.jsxs)(`div`,{"data-testid":`ledger-table`,className:`ledger`,role:`table`,children:[(0,D.jsxs)(`div`,{className:`lrow lhead`,role:`row`,children:[(0,D.jsx)(`span`,{role:`columnheader`,children:`Provider`}),(0,D.jsx)(`span`,{role:`columnheader`,children:`Used vs elapsed`}),(0,D.jsx)(`span`,{role:`columnheader`,children:`Reset`}),(0,D.jsx)(`span`,{role:`columnheader`,children:`Pace`}),(0,D.jsx)(`span`,{role:`columnheader`})]}),f.map(e=>(0,D.jsx)(En,{resetKey:e.quota?.fetchedAt??null,fallback:(0,D.jsx)(On,{id:e.id,name:e.displayName}),children:(0,D.jsx)(Tn,{provider:e,recommended:e.id===t.use,asOf:n,onSelect:a})},e.id))]})}),(0,D.jsxs)(`footer`,{className:`health`,children:[(0,D.jsxs)(`ul`,{children:[(0,D.jsxs)(`li`,{className:`legend-rec`,children:[(0,D.jsx)(`svg`,{className:`legend-star`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})}),(0,D.jsx)(`span`,{children:`Recommended to use next`})]}),(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`dot`,style:{background:`var(--good)`}}),(0,D.jsxs)(`span`,{children:[h.length,` used in ranking`]})]}),g.length>0&&(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`dot`,style:{background:`var(--fill-out)`}}),(0,D.jsxs)(`span`,{children:[g.length,` not reporting`,g.length<=2?` · ${g.map(e=>e.displayName).join(`, `)}`:``]})]})]}),(0,D.jsx)(`span`,{children:T(r,i)})]}),p.length>0&&(0,D.jsxs)(`section`,{"aria-label":`Disabled providers`,children:[(0,D.jsxs)(`h3`,{children:[`Disabled (`,p.length,`)`]}),(0,D.jsx)(`ul`,{children:p.map(e=>(0,D.jsxs)(`li`,{style:{fontSize:`var(--t-2)`},children:[e.displayName,` · disabled · `,Me(e,m)]},e.id))})]})]})}var Fn=6048e5,In=3,Ln=2,Rn=1072,zn=6,Bn=10,Vn=160;function Hn(e){return(Math.min(e.length,16)*7+30)/2}function Un(e){return(e.length*6.6+12)/2}function Wn(e){let t=`${e.resetsAt===null?``:De(e.resetsAt)??``}${e.estimated?` (est.)`:``}`;return Math.max(Hn(e.label),Un(t))}var Gn=`quotacap-rail-mode`;function Kn(){try{return(typeof localStorage>`u`?null:localStorage.getItem(`quotacap-rail-mode`))===`grouped`?`grouped`:`separate`}catch{return`separate`}}function qn(e){try{localStorage.setItem(Gn,e)}catch{}}function Jn(e,t,n){let r=t.getTime(),i=[],a=[],o=[],s=[],c=[];for(let t of e){let e=t.resetsAt===null?NaN:Date.parse(t.resetsAt);if(!Number.isFinite(e)){s.push(t);continue}if(!(e<=r)){if(e-r>Fn){o.push(t);continue}c.push({row:t,resetMs:e,positionPct:(e-r)/Fn*100})}}c.sort((e,t)=>e.resetMs-t.resetMs);let l=[];for(let e of c){let t=l[l.length-1];t&&e.positionPct-t[0].positionPct<In?t.push(e):l.push([e])}let u=[];for(let e of l)if(n?.grouped&&e.length>Ln){let t=e.reduce((e,t)=>e+t.positionPct,0)/e.length,n=e.map(e=>e.row.id);u.push({kind:`cluster`,cluster:{ids:n,label:`${n.length} resets`,positionPct:t,band:`above`,offsetPx:0}})}else for(let t of e)u.push({kind:`pin`,pin:{...t.row,positionPct:t.positionPct,band:`above`,offsetPx:0}});u.sort((e,t)=>(e.kind===`pin`?e.pin.positionPct:e.cluster.positionPct)-(t.kind===`pin`?t.pin.positionPct:t.cluster.positionPct)),u.forEach((e,t)=>{let n=e.kind===`pin`?e.pin:e.cluster;n.band=t%2==0?`above`:`below`});let d=n?.railWidthPx&&n.railWidthPx>0?n.railWidthPx:Rn,f=Math.min(Vn,d*.3);for(let e of[`above`,`below`]){let t=u.filter(t=>(t.kind===`pin`?t.pin.band:t.cluster.band)===e).map(e=>{let t=e.kind===`pin`?e.pin:e.cluster;return{target:t,x:t.positionPct/100*d,half:e.kind===`pin`?Wn(e.pin):Hn(e.cluster.label)}}),n=[],r=[],i=-1/0,a=()=>{r.length>0&&n.push(r),r=[],i=-1/0};for(let e of t)e.x-e.half>i-Bn&&a(),r.push(e),i=Math.max(i,e.x+e.half);a();for(let e of n){if(e.length===1)continue;let t=(e[0].x+e[e.length-1].x)/2,n=t-(e.reduce((e,t)=>e+t.half*2,0)+zn*(e.length-1))/2,r=e.map(e=>{let t=n+e.half;return n+=e.half*2+zn,t}),i=r[r.length-1]+e[e.length-1].half-(r[0]-e[0].half);i>f&&(r=r.map(e=>t+(e-t)*f/i));let a=r[0]-e[0].half<0?-(r[0]-e[0].half):r[r.length-1]+e[e.length-1].half>d?d-(r[r.length-1]+e[e.length-1].half):0;e.forEach((e,t)=>{e.target.offsetPx=r[t]+a-e.x})}for(let e of t){if(e.target.offsetPx!==0)continue;let t=e.x-e.half,n=e.x+e.half;t<0?e.target.offsetPx=-t:n>d&&(e.target.offsetPx=d-n)}}for(let e of u)e.kind===`pin`?i.push(e.pin):a.push(e.cluster);return{placed:i,clusters:a,overflow:o,invalid:s}}function Yn({cluster:e,providers:t,asOfMs:n,onSelect:r,onClose:i}){let a=(0,_.useRef)(null);return(0,_.useEffect)(()=>{a.current?.focus();let e=e=>{e.key===`Escape`&&i()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),(0,D.jsxs)(`div`,{ref:a,tabIndex:-1,"data-testid":`cluster-popover`,role:`dialog`,"aria-label":`${e.ids.length} resets at the same time`,className:`cluster-popover`,style:{left:`${e.positionPct}%`,transform:`translateX(-${e.positionPct}%)`,top:e.band===`above`?`15%`:`55%`},children:[(0,D.jsxs)(`h4`,{children:[e.ids.length,` concurrent resets`]}),(0,D.jsx)(`ul`,{children:e.ids.map(e=>{let a=t.get(e),o=a?.displayName??e;return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,onClick:()=>{r(e),i()},children:[(0,D.jsx)(`b`,{children:o}),(0,D.jsxs)(`span`,{children:[a?.quota?`${A(a)}% · `:``,a?Me(a,n):``]})]})},e)})}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-quiet`,style:{marginTop:`var(--s2)`,width:`100%`},onClick:i,children:`Close`})]})}function Xn(){try{return new Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}catch{return``}}function Zn(e){if(!e)return{cls:`pace-out`,color:`var(--ink-soft)`};switch(fe(e)){case`Behind pace`:return{cls:`pace-behind`,color:`var(--warn)`};case`On track`:return{cls:`pace-ontrack`,color:`var(--good)`};case`Ahead of pace`:return{cls:`pace-ahead`,color:`var(--ahead)`};case`Watch`:return{cls:`pace-watch`,color:`var(--watch)`};case`Quota exhausted`:case`Monthly exhausted`:case`Cap risk`:return{cls:`pace-cap`,color:`var(--danger)`};default:return{cls:`pace-out`,color:`var(--ink-soft)`}}}function Qn(e){let t=k(e);return t?(O(e)?Oe(t):De(t))??``:``}function $n(e){return Array.from({length:7},(t,n)=>{let r=new Date(e+n*24*60*60*1e3);return`${r.toLocaleDateString(void 0,{weekday:`short`})} ${r.toLocaleDateString(void 0,{day:`numeric`})}`})}function er({band:e,offsetPx:t}){if(t===0)return(0,D.jsx)(`span`,{className:`pin-stem`});let n=Math.abs(t),r=Math.sqrt(n*n+196),i=Math.atan2(n,14)*180/Math.PI,a=e===`above`?Math.sign(t)*i:-Math.sign(t)*i,o=r-14,s=e===`above`?{height:r,marginTop:-o,transform:`rotate(${a}deg)`}:{height:r,marginBottom:-o,transform:`rotate(${a}deg)`};return(0,D.jsx)(`span`,{className:`pin-stem`,style:s})}function tr({providers:e,asOf:t,onSelectProvider:n,initialMode:r}){let[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(()=>r??Kn()),[c,l]=(0,_.useState)(Rn),u=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width;t&&t>0&&l(t)});return t.observe(e),()=>t.disconnect()},[]);let d=Date.parse(t),f=new Map(e.map(e=>[e.id,e])),p=Jn(e.filter(e=>e.enabled&&e.quota).map(e=>({id:e.id,label:e.displayName??e.id,resetsAt:k(e),estimated:ye(e)})),new Date(d),{grouped:o===`grouped`,railWidthPx:c}),m=$n(d),h=e=>{a(null),s(e),qn(e)};return(0,D.jsxs)(`section`,{"aria-label":`Upcoming resets`,children:[(0,D.jsxs)(`div`,{className:`section-head`,children:[(0,D.jsx)(`h2`,{id:`resets-h`,children:`Upcoming resets`}),(0,D.jsxs)(`div`,{className:`section-head-controls`,children:[(0,D.jsxs)(`span`,{className:`note`,children:[`Next 7 days · hover pin for usage · click for details · `,Xn(),p.overflow.length>0&&(0,D.jsxs)(`span`,{"data-testid":`rail-overflow`,title:p.overflow.map(e=>f.get(e.id)?.displayName??e.id).join(`, `),style:{marginLeft:8,fontWeight:600,color:`var(--ahead)`},children:[`+`,p.overflow.length,` beyond rail`]})]}),(0,D.jsxs)(`div`,{"data-testid":`rail-mode`,role:`group`,"aria-label":`Reset pin grouping`,className:`seg`,children:[(0,D.jsx)(`button`,{type:`button`,"aria-pressed":o===`separate`,onClick:()=>h(`separate`),children:`Separate`}),(0,D.jsx)(`button`,{type:`button`,"aria-pressed":o===`grouped`,onClick:()=>h(`grouped`),children:`Grouped`})]})]})]}),(0,D.jsx)(`div`,{"data-testid":`rail`,className:`rail-scroller`,tabIndex:0,role:`region`,"aria-label":`Upcoming resets over the next 7 days`,children:(0,D.jsxs)(`div`,{className:`rail`,ref:u,children:[(0,D.jsx)(`div`,{className:`rail-grid`,"aria-hidden":`true`,children:Array.from({length:7},(e,t)=>(0,D.jsx)(`span`,{},t))}),(0,D.jsx)(`div`,{className:`rail-axis`,"aria-hidden":`true`}),(0,D.jsx)(`div`,{className:`rail-now`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`rail-nowlabel`,"aria-hidden":`true`,children:`Now`}),p.placed.map(e=>{let t=f.get(e.id),r=t?.quota?Qn(t):t?Me(t,d):``,i=t?fe(t):``,a=t?k(t):null,o=a?Ae(a,d):null,s=t?.displayName??e.id,{cls:c,color:l}=Zn(t),u=e.positionPct<12?`pin-start`:e.positionPct>88?`pin-end`:``,p={"--pin-border":`color-mix(in oklch, ${l} 45%, var(--line))`},m=e.offsetPx===0?void 0:{translate:`${e.offsetPx}px 0`};return(0,D.jsxs)(`button`,{"data-testid":`pin`,type:`button`,className:`pin ${e.band} ${u}`,style:{left:`${e.positionPct}%`,"--dot-color":l},"aria-label":`${s}: ${i}, resets ${r}`,onClick:()=>n(e.id),children:[e.band===`above`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`pin-when`,style:m,children:e.estimated?`${r} (est.)`:r}),(0,D.jsx)(`span`,{className:`pin-label ${c}`,style:{...p,...m},children:s}),(0,D.jsx)(er,{band:e.band,offsetPx:e.offsetPx}),(0,D.jsx)(`span`,{className:`pin-dot`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`pin-dot`}),(0,D.jsx)(er,{band:e.band,offsetPx:e.offsetPx}),(0,D.jsx)(`span`,{className:`pin-label ${c}`,style:{...p,...m},children:s}),(0,D.jsx)(`span`,{className:`pin-when`,style:m,children:e.estimated?`${r} (est.)`:r})]}),(0,D.jsxs)(`span`,{className:`pin-tooltip`,role:`tooltip`,children:[(0,D.jsx)(`b`,{children:s}),(0,D.jsx)(`span`,{className:`pt-sep`,children:`·`}),t?.quota?`${A(t)}% used`:`no readings`,(0,D.jsx)(`span`,{className:`pt-sep`,children:`·`}),o?`${o} left`:r,e.estimated?` (est.)`:``]})]},e.id)}),p.clusters.map((e,t)=>{let n=e.positionPct<12?`pin-start`:e.positionPct>88?`pin-end`:``,r=e.offsetPx===0?void 0:{translate:`${e.offsetPx}px 0`};return(0,D.jsx)(`button`,{"data-testid":`cluster-pin`,type:`button`,className:`pin ${e.band} ${n}`,style:{left:`${e.positionPct}%`,"--dot-color":`var(--accent)`},"aria-label":`${e.ids.length} resets at the same time: ${e.ids.map(e=>f.get(e)?.displayName??e).join(`, `)}`,"aria-expanded":i===t,onClick:()=>a(i===t?null:t),children:e.band===`above`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`pin-label`,style:{borderColor:`var(--accent)`,color:`var(--accent)`,...r},children:[e.ids.length,` resets`]}),(0,D.jsx)(er,{band:e.band,offsetPx:e.offsetPx}),(0,D.jsx)(`span`,{className:`pin-dot`})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{className:`pin-dot`}),(0,D.jsx)(er,{band:e.band,offsetPx:e.offsetPx}),(0,D.jsxs)(`span`,{className:`pin-label`,style:{borderColor:`var(--accent)`,color:`var(--accent)`,...r},children:[e.ids.length,` resets`]})]})},e.ids.join(`+`))}),i!==null&&p.clusters[i]&&(0,D.jsx)(Yn,{cluster:p.clusters[i],providers:f,asOfMs:d,onSelect:n,onClose:()=>a(null)}),(0,D.jsx)(`div`,{className:`rail-days`,"aria-hidden":`true`,children:m.map(e=>(0,D.jsx)(`span`,{children:e},e))})]})})]})}function nr(e){switch(fe(e)){case`Quota exhausted`:case`Cap risk`:case`Monthly exhausted`:case`Watch`:return`cap`;case`Behind pace`:return`behind`;default:return`ontrack`}}function rr(e,t){if(!e.quota||!e.advisory||e.exclusionReason!==null)return null;let n=e.advisory,r=O(e),i,a,o;if(r)i=ve(e,t),a=n.bindingDaysLeft,o=i!==null&&i>0?n.bindingRemaining/i:1/0;else{if(n.paceSource===`unknown`)return null;i=n.burnRate,a=n.daysLeft,o=n.daysToExhaust}if(i===null||!Number.isFinite(i))return null;let{usedPct:s,elapsedPct:c}=Pe(e,t);if(c===null||!Number.isFinite(c))return null;let l=null,u=s>=100||r&&n.bindingRemaining<=0||n.remaining<=0;if(u){if(n.exhaustedAt){let t=Date.parse(n.exhaustedAt),i=r?e.quota.periodStart:he(e),a=r?e.quota.monthlyResetsAt:k(e),o=i?Date.parse(i):NaN,s=a?Date.parse(a):NaN;Number.isFinite(t)&&Number.isFinite(o)&&Number.isFinite(s)&&s>o&&(l=Math.min(c,Math.max(0,(t-o)/(s-o)*100)))}l===null&&(l=c)}let d,f,p=!1;if(u)p=!0,f=100,d=100;else if(o!==null&&Number.isFinite(o)&&o<a){p=!0,f=100;let n=he(e),r=k(e),i=n?Date.parse(n):NaN,s=r?Date.parse(r):NaN;if(Number.isFinite(i)&&Number.isFinite(s)&&s>i&&Number.isFinite(t)){let e=(s-i)/864e5;d=((t-i)/864e5+o)/e*100}else d=c<100&&a>0?c+o*(100-c)/a:100;d=Math.min(100,Math.max(c,d))}else d=100,f=s+i*a,Number.isFinite(f)||(f=s),f=Math.min(100,Math.max(s,f));return{usedPct:s,elapsedPct:c,projXPct:d,projYPct:f,exhaustsBeforeReset:p,tone:nr(e),exhaustedElapsedPct:l}}function ir(e,t){let n=Math.round(t.usedPct),r=Math.round(t.elapsedPct),i=`${pe(e).toLowerCase()} quota window`;if(t.exhaustedElapsedPct!==null&&t.usedPct>=100)return`Burn-down: 100 percent used at ${Math.round(t.exhaustedElapsedPct)} percent elapsed, currently ${r} percent elapsed (${i})`;if(t.exhaustsBeforeReset)return`Burn-down: ${n} percent used at ${r} percent elapsed, forecast exhausts the quota before reset (${i})`;let a=Math.round(t.projYPct),o=Math.round(100-t.projYPct);return o>0?`Burn-down: ${n} percent used at ${r} percent elapsed, forecast lands at ${a} percent with ${o} percent waste (${i})`:`Burn-down: ${n} percent used at ${r} percent elapsed, forecast lands at ${a} percent (${i})`}function ar(e,t){let n=e.advisory;if(!n||!O(e)&&n.paceSource===`unknown`)return`No current reading`;let{avg:r,recent:i}=be(n);if(!O(e)&&r===null&&i!==null)return Ce.recent;let a=he(e),o=a?Date.parse(a):NaN,s=e.quota&&e.quota.weeklyPct>=100||n.bindingRemaining<=0,c=s&&n.exhaustedAt?Date.parse(n.exhaustedAt):t;if(Number.isFinite(o)&&Number.isFinite(c)&&c>o){let e=(c-o)/864e5;if(e>=.1)return s&&n.exhaustedAt?`averaged over ${e.toFixed(1)} days to reach 100%`:`averaged over ${e.toFixed(1)} days of this window`}return e.evidence.includes(`measured`)||n.burnMeasured?`Measured`:n.paceSource===`window-average`||e.evidence.includes(`window-average`)?`Window avg`:Ce.avg}var N={left:48,right:388,top:28,bottom:142},or=(N.left+N.right)/2,sr=(N.top+N.bottom)/2;function cr(e){return N.left+e/100*(N.right-N.left)}function lr(e){return N.bottom-e/100*(N.bottom-N.top)}function P(e){return String(Math.round(e*10)/10)}function ur({provider:e,asOf:t,basis:n}){let r=Date.parse(t),i=rr(e,r);if(!i)return null;let a=n??ar(e,r),o=i.tone,s=cr(i.elapsedPct),c=lr(i.usedPct),l=i.exhaustedElapsedPct!==null&&i.usedPct>=100,u=l?cr(i.exhaustedElapsedPct):s,d=l?u:s,f=l?N.top:c,p=cr(i.projXPct),m=lr(i.projYPct),h=!l&&Math.hypot(p-s,m-c)>=3,g=ir(e,i),_=pe(e),v=`${Math.round(i.elapsedPct)}% elapsed`,y=Math.min(N.right-46,Math.max(N.left+46,s)),b=i.elapsedPct>52?35:66,x=cr(b),S=lr(b)-5;return(0,D.jsxs)(`section`,{className:`dsec`,"aria-label":`Pace`,"data-testid":`burn-down-section`,children:[(0,D.jsxs)(`div`,{className:`burn-head`,children:[(0,D.jsx)(`h3`,{children:`Pace`}),(0,D.jsxs)(`span`,{className:`burn-win`,children:[_,` quota window`]})]}),(0,D.jsxs)(`svg`,{className:`burn`,viewBox:`0 0 400 184`,role:`img`,"aria-label":g,"data-testid":`burn-down`,children:[(0,D.jsx)(`text`,{x:11,y:sr,className:`axis-y`,transform:`rotate(-90 11 ${sr})`,children:`Quota used (%)`}),(0,D.jsx)(`line`,{x1:N.left,y1:N.bottom,x2:N.right,y2:N.bottom,className:`grid`}),(0,D.jsx)(`line`,{x1:N.left,y1:sr,x2:N.right,y2:sr,className:`grid`}),(0,D.jsx)(`line`,{x1:N.left,y1:N.top,x2:N.right,y2:N.top,className:`grid`}),(0,D.jsx)(`line`,{x1:N.left,y1:N.bottom,x2:N.left,y2:N.bottom+4,className:`grid-tick`}),(0,D.jsx)(`line`,{x1:or,y1:N.bottom,x2:or,y2:N.bottom+4,className:`grid-tick`}),(0,D.jsx)(`line`,{x1:N.right,y1:N.bottom,x2:N.right,y2:N.bottom+4,className:`grid-tick`}),(0,D.jsx)(`text`,{x:40,y:N.bottom+3.5,className:`ylab`,children:`0%`}),(0,D.jsx)(`text`,{x:40,y:sr+3.5,className:`ylab`,children:`50%`}),(0,D.jsx)(`text`,{x:40,y:N.top+3.5,className:`ylab`,children:`100%`}),(0,D.jsx)(`line`,{x1:N.left,y1:N.bottom,x2:N.right,y2:N.top,className:`ideal`}),(0,D.jsx)(`text`,{x:P(x),y:P(S),className:`ideal-lab`,textAnchor:`middle`,transform:`rotate(-18.5 ${P(x)} ${P(S)})`,children:`ideal pace`}),(0,D.jsx)(`line`,{x1:P(s),y1:N.top-8,x2:P(s),y2:N.bottom,className:`now`}),(0,D.jsxs)(`text`,{x:P(y),y:12,className:`now-lab`,textAnchor:`middle`,children:[`now · `,v]}),(0,D.jsx)(`line`,{x1:N.left,y1:N.bottom,x2:P(l?u:s),y2:P(l?N.top:c),className:`actual ${o}`,"data-testid":`burn-actual`}),l&&s>u&&(0,D.jsx)(`line`,{x1:P(u),y1:N.top,x2:P(s),y2:N.top,className:`actual ${o}`,"data-testid":`burn-exhausted-plateau`}),(0,D.jsx)(`line`,{x1:P(s),y1:P(l?N.top:c),x2:P(p),y2:P(m),className:`proj ${o}`,"data-testid":`burn-proj`,"data-proj-x":P(i.projXPct),"data-proj-y":P(i.projYPct)}),(0,D.jsx)(`circle`,{cx:P(d),cy:P(f),r:4.5,className:`dot ${o}`,"data-testid":`burn-dot`}),h&&(0,D.jsx)(`circle`,{cx:P(p),cy:P(m),r:3.5,className:`dot ${o} hollow`}),(0,D.jsx)(`text`,{x:N.left,y:160,className:`xlab`,children:`start · 0%`}),(0,D.jsx)(`text`,{x:or,y:160,className:`xlab mid`,children:`50%`}),(0,D.jsx)(`text`,{x:N.right,y:160,className:`xlab end`,children:`quota reset · 100%`}),(0,D.jsx)(`text`,{x:or,y:178,className:`axis-x`,children:`Time elapsed in window (%)`})]}),(0,D.jsxs)(`p`,{className:`burn-legend`,children:[(0,D.jsx)(`span`,{className:`legend-label`,children:`Legend`}),(0,D.jsxs)(`span`,{className:`legend-item`,children:[(0,D.jsx)(`span`,{className:`burn-swatch-dot ${o}`,"aria-hidden":`true`}),l?`Dot is quota exhausted`:`Dot is now`]}),(0,D.jsxs)(`span`,{className:`legend-item`,children:[(0,D.jsx)(`span`,{className:`burn-swatch-proj ${o}`,"aria-hidden":`true`}),`Dashed is forecast`]})]}),(0,D.jsx)(Se,{provider:e,asOf:t}),(0,D.jsx)(`p`,{className:`pacecap`,children:(0,D.jsx)(`span`,{className:`basis`,children:a})})]})}function dr(e){switch(e){case`not-reporting`:return`Not reporting yet.`;case`stale`:return`Stale — excluded from ranking.`;case`reset-passed`:return`Reset passed — awaiting a fresh window.`;case`invalid`:return`Reading invalid — excluded from ranking.`;case`provider-failed`:return`Provider failed — excluded from ranking.`;case null:return null}}function fr(e){switch(e){case`auth`:return`Authentication failed`;case`timeout`:return`Timed out`;case`parse`:return`Unreadable output`;case`network`:return`Network error`;case`skipped`:return`Skipped`;case`unknown`:return`Unknown error`;case null:return null}}function pr(e){let t=e.advisory,n={id:e.id,name:e.displayName,badge:fe(e),burnRate:t?.burnRate??null,idealRate:t?t.idealRate:null,paceSource:t?t.paceSource:null,paceLabel:t&&t.burnMeasured?`Measured`:t&&t.paceSource===`window-average`?`Window avg`:null,daysLeft:t?t.daysLeft:null,daysToExhaust:t?.daysToExhaust??null,remaining:t?t.remaining:null,wastePct:t?.wastePct??null,periodStart:e.quota?e.quota.periodStart:null,resetsAt:e.quota?e.quota.resetsAt:null,estimatedReset:e.evidence.includes(`estimated-reset`),lastSuccessAt:e.lastSuccessAt,ageMs:e.ageMs,failureCategory:e.lastAttempt?.failureCategory??null,failureWords:e.lastAttempt?.summary??fr(e.lastAttempt?.failureCategory??null),evidence:[...e.evidence],exclusionReason:e.exclusionReason,exclusionWords:dr(e.exclusionReason)};e.quota?.fiveHourPct!==void 0&&e.quota.fiveHourPct!==null&&(n.fiveHourPct=e.quota.fiveHourPct),e.quota?.fiveHourResetsAt&&(n.fiveHourResetsAt=e.quota.fiveHourResetsAt);let r=e.quota;return r?.monthlyKind===`included`&&(n.monthlyKind=r.monthlyKind,r.monthlyPct!==void 0&&(n.monthlyPct=r.monthlyPct),r.monthlyResetsAt!==void 0&&(n.monthlyResetsAt=r.monthlyResetsAt),r.monthlyStatus!==void 0&&(n.monthlyStatus=r.monthlyStatus)),n}function mr(e){switch(e){case`cli`:return`Live CLI`;case`api`:return`Live API`;case`tui`:return`Live TUI`;case`scrape`:return`Live scrape`;case`manual`:return`Manual ingest`;default:return e||`unknown`}}function hr(e,t){let n=e.advisory;if(!n||!O(e)&&n.paceSource===`unknown`)return`No current reading`;let r=he(e),i=r?Date.parse(r):NaN,a=e.quota&&e.quota.weeklyPct>=100||n.bindingRemaining<=0,o=a&&n.exhaustedAt?Date.parse(n.exhaustedAt):t;if(Number.isFinite(i)&&Number.isFinite(o)&&o>i){let e=(o-i)/864e5;if(e>=.1)return a&&n.exhaustedAt?`averaged over ${e.toFixed(1)} days to reach 100%`:`averaged over ${e.toFixed(1)} days of this window`}return e.evidence.includes(`measured`)||n.burnMeasured?`Measured`:n.paceSource===`window-average`||e.evidence.includes(`window-average`)?`Window avg`:`No current reading`}function gr(e){let t=e.quota?.source;return e.id===`opencode-go`&&t===`api`?`read in-memory from OpenCode auth (opt-in), never stored`:t===`cli`||t===`tui`?`handled by ${e.displayName}`:`not stored by QuotaCap`}function _r(e){if(!e.quota)return null;let t=De(e.quota.resetsAt);return t?`${t}${Ee(e)?` (est.)`:``}`:null}function vr(e,t){let n=_r(e);return!n||!e.quota?null:{stamp:n,left:Ae(e.quota.resetsAt,t)}}function yr(e,t=!1){let n=bn(e,t);return!t&&e<80?{...n,background:`var(--fill-out)`,"--fill-edge":`var(--edge-out)`}:n}function br(e,t,n){if(!e||!t)return null;let r=Date.parse(e),i=Date.parse(t);return!Number.isFinite(r)||!Number.isFinite(i)||i<=r||!Number.isFinite(n)?null:Math.min(100,Math.max(0,(n-r)/(i-r)*100))}function xr(e,t){let n=e.quota?.monthlyResetsAt;if(!n)return null;let r=me(n);return r?br(r,n,t):null}function Sr(e,t){let n=e.quota?.fiveHourResetsAt;if(!n)return null;let r=Date.parse(n);return!Number.isFinite(r)||r<=t?null:br(new Date(r-18e6).toISOString(),n,t)}function Cr(e,t){let n=e.quota?.monthlyResetsAt;if(!n)return null;let r=Oe(n);return r?{stamp:r,left:Ae(n,t)}:null}function wr(e,t){let n=e.advisory,r=E(e.ageMs),i=!!n&&n.bindingWindow===`monthly`&&n.bindingRemaining===0;if(e.exclusionReason!==null){let t=Te(e.exclusionReason),n;return n=t&&r?`${t} · last read ${r} ago`:t||(r?`last read ${r} ago`:j(e)),{tone:`neutral`,label:`• Not ranked`,detail:n}}if(i)return{tone:`neutral`,label:`• Not ranked`,detail:j(e)};if(!n)return{tone:`neutral`,label:`• On track`,detail:j(e)};if(n.bindingWindow===`monthly`&&n.bindingRemaining>0)return{tone:`use-more`,label:`↑ Use more`,detail:`${Math.round(n.bindingRemaining)}% of month left`};let a=qe(n,e.exclusionReason);if(a===`use-more`){let r=n.wastePct!==null&&Number.isFinite(n.wastePct)?Math.round(n.wastePct):null,i=k(e),a=i&&t!==void 0?Ae(i,t):Number.isFinite(n.bindingDaysLeft??n.daysLeft)?je(n.bindingDaysLeft??n.daysLeft):null;return{tone:`use-more`,label:`↑ Use more`,detail:r!==null&&a?`${r}% waste forecast · resets in ${a}`:r===null?j(e):`${r}% waste forecast`}}return a===`ease-off`||n.status===`at risk`||n.status===`watch`?{tone:`ease-off`,label:`↓ Ease off`,detail:n.remaining<=0||fe(e)===`Quota exhausted`?`quota fully used`:n.daysToExhaust!==null&&Number.isFinite(n.daysToExhaust)?`exhausts in ${je(n.daysToExhaust)} at current pace`:fe(e)}:{tone:`neutral`,label:`• On track`,detail:j(e)}}async function Tr(e,t,n){let r=t.trim(),i=r.length===0?null:r;try{return await n(e,i),{success:!0,error:null}}catch(e){return{success:!1,error:e.message||`Failed to update display name`}}}function Er(e){if(e.exclusionReason!==null)return null;let t=Ve(e);if(!t||t.kind===`ontrack`)return null;let n=t.text.replace(/^(Cap risk|Watch) · /,``).replace(/^Measuring pace · /,``).replace(/^Exhausted · /,``).replace(/ at current pace$/,``);return!/\d/.test(n)&&n!==`quota fully used`?null:{...t,text:n}}function Dr({name:e,pct:t,quota:n,resetLine:r,forecast:i,hatchPct:a,fillStyle:o,elapsedPct:s,testId:c}){let l=s===null?`${t} percent of ${e.toLowerCase()} used`:`${t} percent of ${e.toLowerCase()} used, ${Math.round(s)} percent of the window elapsed`;return(0,D.jsxs)(`div`,{className:`limit-row`,"data-testid":c,children:[(0,D.jsxs)(`div`,{className:`limit-head`,children:[(0,D.jsx)(`span`,{className:`limit-name`,children:e}),n&&(0,D.jsx)(`span`,{className:`quota-tag`,children:`Quota reset`}),(0,D.jsxs)(`span`,{className:`limit-pct`,children:[t,`% used`]})]}),(0,D.jsxs)(`div`,{className:`limit-sub`,children:[r,i&&(0,D.jsxs)(`span`,{className:`out out-${i.kind}`,children:[`→ `,i.text]})]}),(0,D.jsxs)(`div`,{className:`track`,role:`img`,"aria-label":l,children:[(0,D.jsx)(`div`,{className:`fill`,style:o}),a!=null&&Number.isFinite(a)&&(0,D.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`limit-hatch`,className:`band band-waste`,style:{left:`${100-a}%`,width:`${a}%`}}),s!==null&&(0,D.jsx)(`div`,{"aria-hidden":`true`,className:`mark`,title:`Time elapsed: ${Math.round(s)}%`,style:{left:`${s}%`}})]})]})}function Or({provider:e,asOf:t,recommendation:n,onClose:r,onRenamed:i,renameAction:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(e?.displayName??``),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null);(0,_.useEffect)(()=>{e&&(d(e.displayName),l(!1),h(null))},[e?.id,e?.displayName]),(0,_.useEffect)(()=>{if(!e)return;s.current=document.activeElement,o.current?.focus();let t=e=>{if(e.key===`Escape`){r();return}if(e.key!==`Tab`||!o.current)return;let t=[...o.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],i=t[t.length-1],a=document.activeElement===n||document.activeElement===o.current;e.shiftKey&&a?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),s.current?.focus?.()}},[e,r]);let g=async t=>{if(t.preventDefault(),!e)return;p(!0),h(null);let n=await Tr(e.id,u,a??re);n.success?(l(!1),i?.()):h(n.error),p(!1)};if(!e)return null;let v=pr(e),y=`provider-drawer-title`,b=Date.parse(t),x=E(v.ageMs),S=vr(e,b),ee=[se(e.quota?.plan),mr(e.quota?.source)].filter(e=>e&&e!==`unknown`).join(` · `),C=Cr(e,b),te=e.quota?br(e.quota.periodStart,e.quota.resetsAt,b):null,ne=xr(e,b),w=Sr(e,b),ie=e.advisory?.bindingWindow===`monthly`&&v.monthlyKind===`included`&&v.monthlyPct!==void 0&&Number.isFinite(v.monthlyPct),ae=wr(e,b),le=[];v.exclusionWords&&le.push({key:`exclusion`,dot:`warn`,text:v.exclusionWords}),v.failureWords&&le.push({key:`failure`,dot:`bad`,text:v.failureWords}),v.estimatedReset&&le.push({key:`estimated`,dot:`warn`,text:`Reset time is estimated.`});let ue=[e.quota?mr(e.quota?.source):null,se(e.quota?.plan),x?`Updated ${x} ago`:`Updated unknown`].filter(Boolean).join(` · `);(e.stale||e.exclusionReason===`stale`)&&v.failureWords&&(ue+=` · ${v.failureWords}`);let T=e.id===`opencode-go`&&e.quota?.source===`api`,de=be(e.advisory),fe=e.advisory&&de.avg===null&&de.recent!==null?Ce.recent:hr(e,b),O=S?(0,D.jsxs)(`div`,{className:`winrow-sub reset-line`,children:[`Resets `,(0,D.jsx)(`strong`,{children:S.stamp}),S.left&&(0,D.jsxs)(D.Fragment,{children:[` `,`· in `,(0,D.jsx)(`strong`,{children:S.left})]})]}):(0,D.jsx)(`div`,{className:`winrow-sub`,children:`Reset not reported`}),k=C?(0,D.jsxs)(`div`,{className:`winrow-sub reset-line`,children:[`Resets `,(0,D.jsx)(`strong`,{children:C.stamp}),C.left&&(0,D.jsxs)(D.Fragment,{children:[` `,`· in `,(0,D.jsx)(`strong`,{children:C.left})]})]}):(0,D.jsx)(`div`,{className:`winrow-sub`,children:`Reset not reported`}),A=v.fiveHourResetsAt?De(v.fiveHourResetsAt):null,me=v.fiveHourResetsAt&&A?Ae(v.fiveHourResetsAt,b):null,he=A?me?(0,D.jsxs)(`div`,{className:`winrow-sub reset-line`,children:[`Resets `,(0,D.jsx)(`strong`,{children:A}),` · in `,(0,D.jsx)(`strong`,{children:me})]}):(0,D.jsxs)(`div`,{className:`winrow-sub reset-line`,children:[`Reset `,(0,D.jsx)(`strong`,{children:A})]}):(0,D.jsx)(`div`,{className:`winrow-sub`,children:`Reset not reported`}),ge=e.exclusionReason===null?Ve(e):null,_e=Er(e),ve=e.advisory?.wastePct??null,ye=!ie&&ge?.hatch?ve:null,xe=e.quota&&!e.resetPassed&&e.quota.weeklyPct>=100&&(!e.quota.resetsAt||Date.parse(e.quota.resetsAt)>b),Se=e.quota?(0,D.jsx)(Dr,{name:`Weekly limit`,pct:e.quota.weeklyPct,quota:!ie,resetLine:O,forecast:ie?null:_e,hatchPct:ye,fillStyle:ie?yr(e.quota.weeklyPct):xe?{width:`${Math.min(100,Math.max(0,e.quota.weeklyPct))}%`,background:`var(--fill-cap)`,"--fill-edge":`var(--edge-cap)`}:{width:`${Math.min(100,Math.max(0,e.quota.weeklyPct))}%`,background:Fe(v.badge),"--fill-edge":Ie(v.badge)},elapsedPct:te}):null,we=v.monthlyKind===`included`&&v.monthlyPct!==void 0&&Number.isFinite(v.monthlyPct)?(0,D.jsx)(Dr,{name:`Monthly limit`,pct:v.monthlyPct,quota:ie,resetLine:k,forecast:ie?_e:null,fillStyle:ie?bn(v.monthlyPct,v.monthlyStatus===`exhausted`):yr(v.monthlyPct,v.monthlyStatus===`exhausted`),elapsedPct:ne,testId:`drawer-monthly`}):null,Te=v.fiveHourResetsAt!==void 0&&Number.isFinite(Date.parse(v.fiveHourResetsAt))&&Date.parse(v.fiveHourResetsAt)<=b,Ee=Te?0:v.fiveHourPct,Oe=v.fiveHourPct!==void 0&&v.fiveHourPct!==null&&Number.isFinite(v.fiveHourPct)?(0,D.jsx)(Dr,{name:ce(e.id)??`5h limit`,pct:Ee??0,resetLine:he,fillStyle:yr(Ee??0),elapsedPct:Te?null:w}):null,ke=[te,ne,w].some(e=>e!==null);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{"data-testid":`drawer-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:r}),(0,D.jsxs)(`aside`,{ref:o,tabIndex:-1,"data-testid":`provider-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":y,className:`drawer is-open`,onClick:e=>e.stopPropagation(),children:[(0,D.jsxs)(`div`,{className:`drawer-head`,children:[(0,D.jsx)(`span`,{className:`picon`,style:Ke(e.id),children:(0,D.jsx)(Ge,{id:e.id,title:v.name})}),(0,D.jsxs)(`div`,{className:`who`,style:{flex:1,minWidth:0},children:[(0,D.jsxs)(`h2`,{id:y,style:c?{position:`absolute`,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,border:0}:{display:`inline-flex`,alignItems:`center`,gap:`var(--s1)`},children:[(0,D.jsx)(`span`,{children:v.name}),!c&&(0,D.jsx)(`button`,{type:`button`,className:`rename-btn`,"aria-label":`Rename ${v.name}`,onClick:e=>{e.stopPropagation(),l(!0)},children:(0,D.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`})})})]}),c&&(0,D.jsxs)(`form`,{onSubmit:g,style:{display:`flex`,flexDirection:`column`,gap:`var(--s1)`,marginBottom:`var(--s2)`},children:[(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`var(--s2)`},children:[(0,D.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Escape`&&(t.stopPropagation(),l(!1),d(e.displayName),h(null))},autoFocus:!0,maxLength:32,placeholder:e.builtinName??e.id,"aria-label":`Provider display name`,style:{font:`inherit`,fontSize:`var(--t-4)`,fontWeight:600,padding:`4px 8px`,borderRadius:`var(--r-sm)`,border:`1px solid var(--line)`,background:`var(--surface)`,color:`var(--ink)`,width:`100%`,maxWidth:`240px`}}),(0,D.jsx)(`button`,{type:`submit`,disabled:f,className:`btn btn-sm`,style:{flex:`none`},children:f?`Saving…`:`Save`}),(0,D.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>{l(!1),d(e.displayName),h(null)},className:`btn btn-quiet btn-sm`,style:{flex:`none`},children:`Cancel`})]}),m&&(0,D.jsx)(`span`,{style:{fontSize:`var(--t-2)`,color:`var(--danger)`},children:m})]}),e.builtinName&&e.displayName!==e.builtinName&&(0,D.jsx)(`div`,{className:`sub`,style:{marginTop:`2px`},"data-testid":`provider-builtin-name`,children:`Built-in: ${e.builtinName}`}),(0,D.jsx)(`span`,{className:`sub`,children:oe(e)??ee})]}),(0,D.jsx)(ze,{provider:e,compact:!0}),(0,D.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close provider details`,onClick:r,children:(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,D.jsxs)(`div`,{className:`verdict ${ae.tone}`,"data-testid":`drawer-verdict`,children:[(0,D.jsx)(`b`,{children:ae.label}),ae.detail&&(0,D.jsx)(`span`,{children:ae.detail})]}),e.description&&(0,D.jsx)(`p`,{className:`drawer-desc`,children:e.description}),le.length>0&&(0,D.jsxs)(`section`,{className:`dsec`,"aria-label":`Notes`,children:[(0,D.jsx)(`h3`,{children:`Notes`}),(0,D.jsx)(`div`,{className:`notes-list`,children:le.map(e=>(0,D.jsxs)(`div`,{className:`note`,children:[(0,D.jsx)(`span`,{className:`dot ${e.dot}`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{children:e.text})]},e.key))})]}),(0,D.jsxs)(`section`,{className:`dsec`,"aria-label":`Limits`,children:[(0,D.jsx)(`h3`,{children:`Limits`}),e.quota?(0,D.jsxs)(D.Fragment,{children:[ie?(0,D.jsxs)(D.Fragment,{children:[we,Se,Oe]}):(0,D.jsxs)(D.Fragment,{children:[Se,Oe,we]}),(ke||ye!==null)&&(0,D.jsxs)(`p`,{className:`limit-legend`,children:[(0,D.jsx)(`span`,{className:`legend-label`,children:`Legend`}),ke&&(0,D.jsxs)(`span`,{className:`legend-item`,children:[(0,D.jsx)(`span`,{className:`legend-mark`,"aria-hidden":`true`}),`Time elapsed`]}),ye!==null&&(0,D.jsxs)(`span`,{className:`legend-item`,children:[(0,D.jsx)(`span`,{className:`legend-hatch`,"aria-hidden":`true`}),`Projected waste`]})]})]}):(0,D.jsx)(`p`,{className:`cell-s`,children:`No readings yet.`})]}),(0,D.jsx)(ur,{provider:e,asOf:t,basis:fe}),(0,D.jsx)(pn,{closes:e.lastCloses,windowName:pe(e)}),(0,D.jsxs)(`div`,{className:`prov-foot`,children:[ue,T&&(0,D.jsx)(`span`,{className:`cred`,children:gr(e)})]})]})]})}function kr({text:e}){let[t,n]=(0,_.useState)(!1),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-quiet btn-sm`,onClick:async()=>{try{typeof navigator<`u`&&navigator.clipboard?.writeText&&await navigator.clipboard.writeText(e)}catch{}n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1500)},children:t?`Copied`:`Copy`}),(0,D.jsx)(`span`,{className:`sr-live`,role:`status`,"aria-live":`polite`,children:t?`Copied to clipboard.`:``})]})}function Ar({open:e,recommendation:t,providers:n,asOf:r,onClose:i,onSelectProvider:a}){let o=(0,_.useRef)(null),s=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!e)return;s.current=document.activeElement,o.current?.focus();let t=e=>{if(e.key===`Escape`){i();return}if(e.key!==`Tab`||!o.current)return;let t=[...o.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],r=t[t.length-1],a=document.activeElement===n||document.activeElement===o.current;e.shiftKey&&a?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),s.current?.focus?.()}},[e,i]),!e)return null;let c=Date.parse(r),{useMore:l,easeOff:u}=Je(t.advisories,n),d=t.use===`none`?l[0]?.provider:t.use,f=d?n.find(e=>e.id===d):void 0,p=f?f.displayName:null,m=f?.advisory?Math.round(f.advisory.bindingWindow===`monthly`?f.advisory.bindingRemaining:f.advisory.remaining):null,h=t.bindingWindow===`monthly`,g=h?null:t.wastePct===null?f?.advisory?.wastePct!==null&&f?.advisory?.wastePct!==void 0?Math.round(f.advisory.wastePct):null:Math.round(t.wastePct),v=f?k(f):null,y=v?Ae(v,c):null,b=f?.advisory?.paceSource===`window-average`?`window-average pace`:`current 24h pace`,x=l.filter(e=>e.provider!==d),S=`advice-drawer-title`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{"data-testid":`advice-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:i}),(0,D.jsxs)(`aside`,{ref:o,tabIndex:-1,"data-testid":`advice-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":S,className:`drawer is-open`,onClick:e=>e.stopPropagation(),children:[(0,D.jsxs)(`div`,{className:`drawer-head`,children:[(0,D.jsx)(`span`,{className:`picon rec-picon`,"aria-hidden":`true`,children:(0,D.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,D.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})})}),(0,D.jsxs)(`div`,{style:{flex:1},children:[(0,D.jsx)(`h2`,{id:S,children:`Quota Advice & Pacing`}),(0,D.jsx)(`span`,{className:`sub`,children:`Which quota to burn next, and why`})]}),(0,D.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close advice`,onClick:i,children:(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,D.jsxs)(`div`,{className:`dsec`,children:[(0,D.jsx)(`h3`,{children:`Recommended for next session`}),f&&p?(0,D.jsxs)(`div`,{className:`advice-card`,style:{marginTop:8},children:[(0,D.jsxs)(`div`,{className:`advice-card-main`,children:[(0,D.jsxs)(`div`,{className:`advice-card-lead`,children:[(0,D.jsx)(`span`,{className:`sq`,style:Ke(f.id),children:(0,D.jsx)(Ge,{id:f.id,title:p,size:16})}),(0,D.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,D.jsx)(`span`,{className:`name`,children:p}),(0,D.jsxs)(`span`,{className:`recommended-badge`,children:[(0,D.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3z`})}),`Recommended`]})]})]}),g!==null&&y&&(0,D.jsxs)(`div`,{className:`advice-card-stats`,children:[(0,D.jsxs)(`b`,{children:[g,`%`]}),` unused quota expires in `,(0,D.jsx)(`b`,{children:y})]})]}),(0,D.jsx)(`p`,{className:`advice-card-body`,children:m!==null&&y&&!h?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`b`,{children:p}),` has `,m,`% quota remaining with `,y,` to reset, forecast at the `,b,`.`]}):t.reason}),a&&(0,D.jsx)(`div`,{children:(0,D.jsxs)(`button`,{type:`button`,className:`goto-link`,onClick:()=>a(f.id),children:[`View `,p,` details →`]})})]}):(0,D.jsx)(`p`,{className:`advice-card-body`,children:t.reason})]}),(0,D.jsxs)(`div`,{className:`dsec`,children:[(0,D.jsx)(`h3`,{children:`Fleet Pacing Breakdown`}),(0,D.jsxs)(`dl`,{className:`lane-group`,children:[(0,D.jsxs)(`dt`,{className:`um`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`↑`}),` Use more`]}),(0,D.jsx)(`dd`,{children:x.length?x.map(e=>{let t=n.find(t=>t.id===e.provider),r=t?.displayName??e.provider,i=e.wastePct===null?null:`${Math.round(e.wastePct)}% unused`,a=t?k(t):null,o=a?Ae(a,c):null,s=[i,o?`resets in ${o}`:null].filter(Boolean).join(` · `);return(0,D.jsxs)(`div`,{className:`lane-row`,children:[(0,D.jsx)(`span`,{className:`nm`,children:r}),(0,D.jsx)(`span`,{className:`meta`,children:s})]},e.provider)}):`None`}),(0,D.jsxs)(`dt`,{className:`eo`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`↓`}),` Ease off`]}),(0,D.jsx)(`dd`,{children:u.length?u.map(e=>{let t=n.find(t=>t.id===e.provider),r=t?.displayName??e.provider,i=t?A(t):null,a=i===null?null:`${Math.round(i)}% used`,o=t?k(t):null,s=o?Ae(o,c):null,l=[a,s?`resets in ${s}`:null].filter(Boolean).join(` · `);return(0,D.jsxs)(`div`,{className:`lane-row`,children:[(0,D.jsx)(`span`,{className:`nm`,children:r}),(0,D.jsx)(`span`,{className:`meta`,children:l})]},e.provider)}):`None`})]})]}),(0,D.jsxs)(`div`,{className:`dsec`,children:[(0,D.jsx)(`h3`,{children:`CLI Command`}),(0,D.jsxs)(`div`,{className:`cli-wrap`,children:[(0,D.jsx)(`pre`,{className:`advice-cli`,children:(0,D.jsx)(`code`,{children:`$ quotacap advise`})}),(0,D.jsx)(kr,{text:`quotacap advise`})]})]})]})]})}function jr(e){return e.filter(e=>e.harness!==null)}var Mr=new Map([[`claude`,`Claude Code`],[`codex`,`Codex`],[`kimi`,`Kimi Code`],[`grok`,`Grok`],[`agy`,`Antigravity`],[`agy:3p`,`Antigravity 3P`],[`muse`,`Muse Code`],[`opencode-go`,`OpenCode Go`]]);function Nr(e){return Mr.get(e)??e}function Pr(e){let t=Fr(e),n=E(e.ageMs);return n?`${t} · ${n} ago`:t}function Fr(e){switch(e.exclusionReason){case`stale`:return`Stale`;case`provider-failed`:return`Failed`;case`invalid`:return`Invalid`;case`reset-passed`:return`Reset passed`;case`not-reporting`:return`Not reporting`;case null:return e.lastAttempt&&!e.lastAttempt.success?`Failed`:`Ready`}}function Ir(e){return e===`Ready`?`pill pill-ready`:e===`Failed`||e===`Invalid`?`pill pill-danger`:`pill pill-warn`}function Lr({providers:e,refreshing:t,onSetProviderEnabled:n}){let r=jr(e);return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`settings-h3`,children:`Active Tool Connections`}),(0,D.jsx)(`div`,{className:`settings-list`,children:r.map(e=>{let r=Fr(e);return(0,D.jsxs)(`div`,{className:`settings-row`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`b`,{className:`settings-row-name`,children:Nr(e.id)}),(0,D.jsx)(`span`,{className:`settings-row-source`,children:mr(e.quota?.source)})]}),(0,D.jsxs)(`div`,{className:`settings-row-actions`,children:[(0,D.jsx)(`span`,{className:Ir(r),children:Pr(e)}),n&&e.id!==`agy:3p`&&(0,D.jsx)(`button`,{type:`button`,className:`btn btn-quiet btn-sm`,"aria-label":`${e.enabled?`Disable`:`Enable`} ${Nr(e.id)}`,onClick:()=>n(e.id,!e.enabled),disabled:t,children:e.enabled?`Disable`:`Enable`})]})]},e.id)})})]})}var Rr=`[custom.quotacap]
|
|
10
10
|
command = "quotacap status --compact"
|
|
11
11
|
when = "command -v quotacap"
|
|
12
|
-
format = "[$output]($style) "`,zr=`set -g status-right '#(quotacap status --compact)'`,Br=`export PS1='$(quotacap status --compact) '$PS1`;function Vr(){return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`settings-h3`,children:`Shell Prompt Integration`}),(0,D.jsx)(`p`,{className:`settings-desc`,children:`Display active quota headroom in your shell prompt or multiplexer statusline:`}),(0,D.jsxs)(`div`,{className:`cli-block`,children:[(0,D.jsxs)(`b`,{className:`cli-block-label`,children:[`Starship Prompt (`,(0,D.jsx)(`code`,{children:`starship.toml`}),`):`]}),(0,D.jsxs)(`div`,{className:`cli-wrap`,children:[(0,D.jsx)(`pre`,{className:`cli-snippet`,children:Rr}),(0,D.jsx)(kr,{text:Rr})]})]}),(0,D.jsxs)(`div`,{className:`cli-block`,children:[(0,D.jsxs)(`b`,{className:`cli-block-label`,children:[`tmux (`,(0,D.jsx)(`code`,{children:`~/.tmux.conf`}),`):`]}),(0,D.jsxs)(`div`,{className:`cli-wrap`,children:[(0,D.jsx)(`pre`,{className:`cli-snippet`,children:zr}),(0,D.jsx)(kr,{text:zr})]})]}),(0,D.jsxs)(`div`,{className:`cli-block`,children:[(0,D.jsxs)(`b`,{className:`cli-block-label`,children:[`Bash / Zsh (`,(0,D.jsx)(`code`,{children:`~/.zshrc`}),`):`]}),(0,D.jsxs)(`div`,{className:`cli-wrap`,children:[(0,D.jsx)(`pre`,{className:`cli-snippet`,children:Br}),(0,D.jsx)(kr,{text:Br})]})]})]})}function Hr(){try{return window.location.port||null}catch{return null}}function Ur(){let e=Hr();return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`settings-h3`,children:`Local Daemon Process`}),(0,D.jsx)(`p`,{className:`settings-desc`,children:`Background process managing provider adapters and SQLite store.`}),(0,D.jsxs)(`dl`,{className:`dkv`,children:[(0,D.jsx)(`dt`,{children:`HTTP Service`}),(0,D.jsx)(`dd`,{children:(0,D.jsxs)(`code`,{children:[`127.0.0.1:`,e??`8787`]})}),(0,D.jsx)(`dt`,{children:`Polling Cadence`}),(0,D.jsx)(`dd`,{children:`Every 15 minutes (default)`}),(0,D.jsx)(`dt`,{children:`Database File`}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`code`,{children:`~/.quotacap/quotacap.db`})})]}),(0,D.jsxs)(`p`,{className:`settings-note`,children:[`Change the port and polling cadence in `,(0,D.jsx)(`code`,{children:`~/.quotacap/config.json`}),` (`,(0,D.jsx)(`code`,{children:`port`}),`,`,` `,(0,D.jsx)(`code`,{children:`pollMinutes`}),`; defaults 8787 and 10), then restart the daemon. These controls stay read-only until the server offers a settings API.`]})]})}var Wr=[{id:`providers`,label:`Providers`},{id:`cli`,label:`CLI & Shell`},{id:`daemon`,label:`Daemon`}];function Gr({open:e,providers:t,refreshing:n,onSetProviderEnabled:r,onClose:i}){let[a,o]=(0,_.useState)(`providers`),s=(0,_.useRef)(null),c=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!e)return;c.current=document.activeElement,s.current?.focus();let t=e=>{if(e.key===`Escape`){i();return}if(e.key!==`Tab`||!s.current)return;let t=[...s.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],r=t[t.length-1],a=document.activeElement===n||document.activeElement===s.current;e.shiftKey&&a?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),c.current?.focus?.()}},[e,i]),!e)return null;let l=`settings-drawer-title`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{"data-testid":`settings-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:i}),(0,D.jsxs)(`aside`,{ref:s,tabIndex:-1,"data-testid":`settings-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":l,className:`drawer is-open settings-drawer`,onClick:e=>e.stopPropagation(),children:[(0,D.jsxs)(`div`,{className:`drawer-head`,children:[(0,D.jsxs)(`div`,{className:`settings-head-main`,children:[(0,D.jsx)(`h2`,{id:l,className:`settings-title`,children:`Settings & Configuration`}),(0,D.jsx)(`span`,{className:`sub`,children:`Connected provider adapters and CLI prompt integration.`})]}),(0,D.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close settings`,onClick:i,children:(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,D.jsx)(`div`,{className:`seg settings-tabs`,role:`tablist`,"aria-label":`Settings sections`,children:Wr.map(e=>(0,D.jsx)(`button`,{type:`button`,role:`tab`,className:`settings-tab${a===e.id?` is-active`:``}`,"aria-selected":a===e.id,onClick:()=>o(e.id),children:e.label},e.id))}),(0,D.jsxs)(`div`,{role:`tabpanel`,className:`settings-panel`,children:[a===`providers`&&(0,D.jsx)(Lr,{providers:t,refreshing:n,onSetProviderEnabled:r}),a===`cli`&&(0,D.jsx)(Vr,{}),a===`daemon`&&(0,D.jsx)(Ur,{})]})]})]})}function Kr(e,t){return t?`/setup`:`/`}function qr(){try{return window.location.pathname||`/`}catch{return`/`}}function Jr(e){window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function Yr(){let[e,t]=(0,_.useState)(()=>qr());return(0,_.useEffect)(()=>{let e=()=>t(qr());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),e}function Xr(e,t){let n=t?.summary?.trim()||`${e} login required`,r=t?.action?.trim().replace(/select Refresh in the QuotaCap dashboard/,`select Retry`);return r?`${n}. ${r}`:`${n}. Open ${e} and follow its sign-in instructions. Then select Retry.`}function Zr(e,t){let n=e.displayName;if(e.lastAttempt?.failureCategory===`auth`)return e.id===`opencode-go`?{text:`${t?`Run \`${t}\`, then re-poll.`:"Run the login command for your OpenCode CLI version — v2 `opencode auth login opencode` or v1 `opencode console login` — then re-poll."} QuotaCap reads that key only because you enabled OpenCode Go — \`quotacap providers disable opencode-go\` stops it.`}:{text:Xr(n,e.lastAttempt)};switch(e.exclusionReason){case`stale`:return{text:`Poll again to refresh this reading.`};case`reset-passed`:return{text:`Poll again to capture the new window.`};case`invalid`:return{text:`Check the ${n} CLI output, then re-poll.`};case`provider-failed`:{let t=e.lastAttempt;if(t?.summary){let e=t.errorDetail?`: ${t.errorDetail}`:``,r=t.action??`Check the ${n} CLI, then re-poll.`;return{text:`${t.summary}${e}. ${r}`}}return{text:`${fr(e.lastAttempt?.failureCategory??null)??`Provider failed`} — check the ${n} CLI, then re-poll.`}}case`not-reporting`:return{text:`No readings yet — run a poll.`};case null:return{text:`Poll again to refresh this reading.`}}}function Qr(e){switch(e.exclusionReason){case`stale`:return`stopped reporting`;case`reset-passed`:return`reset passed`;case`invalid`:return`sent an invalid reading`;case`provider-failed`:return`failed`;case`not-reporting`:return`isn't reporting yet`;case null:return`needs attention`}}function $r({providers:e,onRepoll:t,repolling:n,polling:r,opencodeLoginCommand:i}){let a=n||r===`in-progress`,o=e.filter(e=>!(!e.enabled||e.exclusionReason===null||a&&(e.exclusionReason===`stale`||e.exclusionReason===`not-reporting`)));return o.length===0?null:(0,D.jsx)(`div`,{children:o.map(e=>{let r=E(e.ageMs),a=Zr(e,i);return(0,D.jsxs)(`div`,{"data-testid":`fault-banner`,role:`alert`,className:`alert`,children:[(0,D.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 8v5`}),(0,D.jsx)(`path`,{d:`M12 16.5v.01`}),(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),(0,D.jsxs)(`span`,{children:[(0,D.jsxs)(`strong`,{children:[e.displayName,` `,Qr(e),`.`]}),` `,r?`Last read ${r} ago; `:``,`excluded from ranking. `,a.text]}),(0,D.jsx)(`button`,{type:`button`,className:`linkbtn`,onClick:t,disabled:n,style:{flex:`none`,marginLeft:`auto`},children:n?`Polling…`:e.lastAttempt?.failureCategory===`auth`?`Retry ${e.displayName}`:`Check ${e.displayName}`})]},e.id)})})}function ei(e){let t=e.displayName,n=e.id===`agy:3p`?`Antigravity`:t;if(e.exclusionReason===null&&e.quota){let t=E(e.ageMs);return{status:`Ready`,detail:t?`Last read ${t} ago.`:`Reporting.`}}if(e.lastAttempt?.success&&e.lastAttempt.succeededAt)return{status:`Ready`,detail:`Connected — no readings yet.`};let r=`By default QuotaCap never reads credentials; the only exception is OpenCode Go, which you enable explicitly.`;return e.harness===null?{status:`Sign in first`,detail:`QuotaCap has no live adapter for ${t}. Use manual ingest via the CLI to add readings.`}:e.lastAttempt?.failureCategory===`auth`?{status:`Sign in first`,detail:Xr(n,e.lastAttempt)}:e.lastAttempt?{status:`Sign in first`,detail:`${fr(e.lastAttempt.failureCategory)??`Last attempt failed`} — check the ${n} CLI, then re-poll. ${r}`}:{status:`Sign in first`,detail:`Install the ${n} CLI and sign in, then run the first poll. ${r}`}}function ti({providers:e}){return(0,D.jsx)(`div`,{className:`provlist`,children:e.map(e=>{let t=ei(e),n=t.status===`Ready`;return(0,D.jsxs)(`div`,{className:`provrow`,children:[(0,D.jsx)(`b`,{children:e.displayName}),(0,D.jsx)(`span`,{className:`path`,children:t.detail}),(0,D.jsxs)(`span`,{className:n?`st-ready`:`st-todo`,children:[n?(0,D.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M20 6L9 17l-5-5`})}):(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),t.status]})]},e.id)})})}function ni(){return(0,D.jsxs)(`div`,{className:`preview`,"aria-label":`Sample payoff preview`,children:[(0,D.jsxs)(`div`,{className:`preview-head`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`var(--s3)`},children:[(0,D.jsx)(`span`,{style:{fontWeight:600},children:`What your first result will show`}),(0,D.jsx)(`span`,{className:`chip-sample`,style:{fontSize:`var(--t-1)`,padding:`2px 8px`,borderRadius:999,background:`var(--surface-raised)`,border:`1px solid var(--line-strong)`,fontWeight:600,color:`var(--ink-soft)`},children:`Sample data`})]}),(0,D.jsxs)(`div`,{className:`trackwrap`,children:[(0,D.jsxs)(`div`,{className:`tline`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-2)`,marginBottom:4},children:[(0,D.jsx)(`span`,{className:`used`,style:{fontWeight:600},children:`Kimi Code · 22% used`}),(0,D.jsx)(`span`,{className:`gap`,style:{color:`var(--ink-soft)`},children:`61 points behind pace`})]}),(0,D.jsxs)(`div`,{className:`track`,role:`img`,"aria-label":`Sample: 22 percent of quota used, 83 percent of the window elapsed`,children:[(0,D.jsx)(`div`,{className:`fill`,style:{width:`22%`,background:`var(--fill-behind)`,borderRight:`1px solid var(--edge-behind)`}}),(0,D.jsx)(`div`,{className:`mark`,style:{left:`83%`}})]}),(0,D.jsxs)(`div`,{className:`tfoot`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-1)`,color:`var(--ink-faint)`,marginTop:4},children:[(0,D.jsx)(`span`,{children:`start`}),(0,D.jsx)(`span`,{children:`time elapsed: 83%`}),(0,D.jsx)(`span`,{children:`reset`})]})]}),(0,D.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`var(--s3) 0 0`},children:`Switch to Kimi next — 67% waste in 1.2d`})]})}function ri({snapshot:e,onFirstPoll:t,polling:n,pollError:r}){let[i,a]=(0,_.useState)(1);return(0,D.jsxs)(`div`,{"data-testid":`setup-root`,style:{maxWidth:960,margin:`0 auto`,padding:`var(--s5) var(--s4) 56px`},children:[(0,D.jsx)(`p`,{className:`eyebrow`,style:{marginBottom:`var(--s1)`},children:`First run & accounts`}),(0,D.jsx)(`h1`,{style:{fontSize:`var(--t-6)`,letterSpacing:`-0.024em`,margin:`0 0 var(--s5)`,fontWeight:700},children:`Connect the subscriptions you already use`}),(0,D.jsxs)(`div`,{className:`setup`,children:[(0,D.jsxs)(`ol`,{className:`steps`,children:[(0,D.jsxs)(`li`,{className:i===1?`is-now`:``,"aria-current":i===1?`step`:void 0,children:[(0,D.jsx)(`span`,{className:`num`,children:`1`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`t`,children:`Detect`}),(0,D.jsx)(`span`,{className:`d`,children:`Find installed coding tools`})]})]}),(0,D.jsxs)(`li`,{className:i===2?`is-now`:``,"aria-current":i===2?`step`:void 0,children:[(0,D.jsx)(`span`,{className:`num`,children:`2`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`t`,children:`Review`}),(0,D.jsx)(`span`,{className:`d`,children:`Check what each adapter reads`})]})]}),(0,D.jsxs)(`li`,{className:i===3?`is-now`:``,"aria-current":i===3?`step`:void 0,children:[(0,D.jsx)(`span`,{className:`num`,children:`3`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`t`,children:`Start`}),(0,D.jsx)(`span`,{className:`d`,children:`Read current usage once`})]})]})]}),(0,D.jsxs)(`div`,{className:`panel`,children:[i===1&&(0,D.jsxs)(`section`,{"data-testid":`setup-step-1`,"aria-label":`Step 1: Detect`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Step 1 of 3`}),(0,D.jsx)(`h2`,{children:`What the daemon can see`}),(0,D.jsx)(`p`,{children:`QuotaCap asked the running daemon what it knows. The dashboard cannot scan this machine from the browser, so anything missing here needs the provider CLI installed and signed in first.`}),(0,D.jsxs)(`div`,{className:`privacy`,children:[(0,D.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,D.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`b`,{children:`Usage history stays on this machine`}),(0,D.jsx)(`span`,{children:`QuotaCap reads quota percentages and reset times only. It never accesses code or prompts.`})]})]})]}),(0,D.jsx)(ti,{providers:e.providers}),(0,D.jsxs)(`div`,{className:`panel-foot`,children:[(0,D.jsx)(`span`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`},children:`You can add, disable, or repair providers at any time.`}),(0,D.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(2),children:`Continue to review`})]})]}),i===2&&(0,D.jsxs)(`section`,{"data-testid":`setup-step-2`,"aria-label":`Step 2: Review`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Step 2 of 3`}),(0,D.jsx)(`h2`,{children:`Review accounts`}),(0,D.jsx)(`p`,{children:`QuotaCap reads usage through your own provider CLIs. It never asks for, stores, or transmits your provider credentials — sign-in happens in the provider CLI itself, not here.`}),(0,D.jsxs)(`div`,{className:`privacy`,children:[(0,D.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,D.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`b`,{children:`Zero credential storage`}),(0,D.jsx)(`span`,{children:`Authentication stays in official CLI keychains. QuotaCap never stores tokens, and reads one only if you explicitly enable OpenCode Go.`})]})]})]}),(0,D.jsx)(ti,{providers:e.providers}),(0,D.jsxs)(`div`,{className:`panel-foot`,children:[(0,D.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(1),children:`Back`}),(0,D.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(3),children:`Continue to first poll`})]})]}),i===3&&(0,D.jsxs)(`section`,{"data-testid":`setup-step-3`,"aria-label":`Step 3: Start`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Step 3 of 3`}),(0,D.jsx)(`h2`,{children:`Take the first readings`}),(0,D.jsx)(`p`,{children:`Run the first poll. The daemon will ask each provider CLI for current usage and the dashboard will open when readings land.`})]}),(0,D.jsx)(ni,{}),(0,D.jsxs)(`div`,{className:`panel-foot`,children:[(0,D.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(2),children:`Back`}),(0,D.jsx)(`button`,{"data-testid":`setup-poll-button`,className:`btn btn-primary`,type:`button`,onClick:t,disabled:n,children:n?`Polling…`:`Run first poll`})]}),r&&(0,D.jsxs)(`div`,{"data-testid":`setup-poll-error`,className:`alert`,role:`alert`,style:{margin:`var(--s4) var(--s5)`},children:[(0,D.jsx)(`span`,{children:r}),(0,D.jsx)(`button`,{className:`btn btn-quiet btn-sm`,type:`button`,onClick:t,children:`Retry`})]})]})]})]})]})}var ii=`quotacap-theme`;function ai(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}function oi(){try{return typeof localStorage>`u`?null:localStorage.getItem(ii)}catch{return null}}function si(){try{return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{return!1}}function ci(e){try{document.documentElement.dataset.theme=e}catch{}try{localStorage.setItem(ii,e)}catch{}return e}function li(){return ai(oi(),si())}function ui(){let[e,t]=(0,_.useState)(()=>li()),n=(0,_.useCallback)(()=>{t(e=>ci(e===`dark`?`light`:`dark`))},[]);return(0,D.jsx)(`button`,{"data-testid":`theme-toggle`,className:`iconbtn`,type:`button`,onClick:n,"aria-label":e===`dark`?`Switch to light theme`:`Switch to dark theme`,"aria-pressed":e===`dark`,title:e===`dark`?`Switch to light theme`:`Switch to dark theme`,children:e===`dark`?(0,D.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,D.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M19 5l-1.5 1.5M6.5 17.5L5 19`})]}):(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`})})})}function di(e){return e.available?e.polling===`in-progress`?`polling`:!e.ready||e.version===``?`not-ready`:`live`:`unreachable`}function fi(){try{return window.location.host||`127.0.0.1:8787`}catch{return`127.0.0.1:8787`}}function pi(e,t){switch(e){case`live`:return`daemon live`;case`polling`:return`Polling`;case`unreachable`:return`Daemon unreachable`;case`not-ready`:return t?.version===``?`Version unknown`:`Daemon not ready`}}function mi({runtime:e,refreshing:t,onRefresh:n,onSettings:r,unreachable:i=!1}){let a=i?`unreachable`:e?di(e):null,o=e?.update,s=!!o&&!o.upToDate&&!!o.latest;return(0,D.jsx)(`header`,{className:`topbar`,children:(0,D.jsxs)(`div`,{className:`topbar-inner`,children:[(0,D.jsxs)(`span`,{className:`brand`,children:[(0,D.jsxs)(`svg`,{width:`21`,height:`21`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M4 16.5a8 8 0 0 1 16 0`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`}),(0,D.jsx)(`path`,{d:`M12 16.5l4.8-4.6`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`})]}),`QuotaCap`]}),(0,D.jsxs)(`div`,{className:`topbar-end`,children:[a?(0,D.jsxs)(`span`,{"data-testid":`pill`,"data-state":a,role:`status`,className:`daemon`,title:e?`available: ${e.available}; ready: ${e.ready}; polling: ${e.polling}; version: ${e.version}`:`no snapshot yet`,children:[(0,D.jsx)(`span`,{className:`daemon-dot is-${a}`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`daemon-t`,children:pi(a,e)}),a===`live`&&(0,D.jsxs)(`code`,{className:`daemon-addr`,children:[` · `,fi()]})]}):(0,D.jsxs)(`span`,{"data-testid":`pill`,"data-state":`connecting`,role:`status`,className:`daemon`,children:[(0,D.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`daemon-t`,children:`Connecting…`})]}),s&&o&&o.latest?(0,D.jsxs)(`span`,{"data-testid":`update-badge`,role:`status`,className:`update-badge`,title:`Run 'quotacap update' to upgrade`,children:[(0,D.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`daemon-t`,children:`Update ${o.current} to ${o.latest}`})]}):null,(0,D.jsxs)(`div`,{className:`topbar-actions`,children:[(0,D.jsx)(ui,{}),(0,D.jsxs)(`button`,{"data-testid":`refresh-button`,className:`btn btn-quiet`,type:`button`,onClick:n,disabled:t,title:`Force refresh now`,children:[(0,D.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.5-5.8`}),(0,D.jsx)(`path`,{d:`M20 4v4h-4`})]}),(0,D.jsx)(`span`,{className:`btn-label`,children:t?`Refreshing…`:`Refresh`})]}),(0,D.jsxs)(`button`,{"data-testid":`settings-button`,className:`btn btn-quiet`,type:`button`,onClick:r,title:`Open Settings`,children:[(0,D.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,D.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),(0,D.jsx)(`span`,{className:`btn-label`,children:`Settings`})]})]})]})]})})}function hi(e){return[`• What is read: Bearer [REDACTED] already stored ${e?`when you ran \`${e}\``:"with the command for your CLI version: v2 `opencode auth login opencode` or v1 `opencode console login`"} (v2 \`~/.local/share/opencode/opencode.db\` active credential, else legacy \`~/.local/share/opencode/auth.json\`; \`opencode-go\` then \`opencode\`).`,`• Read frequency: in-memory, read-only once per poll (every 15 minutes by default).`,"• Request destination: sent only as `Authorization: Bearer` to `https://opencode.ai/zen/go/v1/usage` to fetch `rolling/weekly/monthly` `percent` + `resetsAt`.","• Never-list: never used to make chat or model requests, never written or rotated, never stored in the `quotacap` DB, never returned by the API or MCP, and never logged (errors show `[redacted]`).","• Revocation instructions: revoke at `https://opencode.ai/auth` or `opencode providers logout opencode-go` and run `quotacap providers disable opencode-go` to stop polling.","• Optional environment override: if you prefer no file access, set `OPENCODE_API_KEY` instead."].join(`
|
|
12
|
+
format = "[$output]($style) "`,zr=`set -g status-right '#(quotacap status --compact)'`,Br=`export PS1='$(quotacap status --compact) '$PS1`;function Vr(){return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`settings-h3`,children:`Shell Prompt Integration`}),(0,D.jsx)(`p`,{className:`settings-desc`,children:`Display active quota headroom in your shell prompt or multiplexer statusline:`}),(0,D.jsxs)(`div`,{className:`cli-block`,children:[(0,D.jsxs)(`b`,{className:`cli-block-label`,children:[`Starship Prompt (`,(0,D.jsx)(`code`,{children:`starship.toml`}),`):`]}),(0,D.jsxs)(`div`,{className:`cli-wrap`,children:[(0,D.jsx)(`pre`,{className:`cli-snippet`,children:Rr}),(0,D.jsx)(kr,{text:Rr})]})]}),(0,D.jsxs)(`div`,{className:`cli-block`,children:[(0,D.jsxs)(`b`,{className:`cli-block-label`,children:[`tmux (`,(0,D.jsx)(`code`,{children:`~/.tmux.conf`}),`):`]}),(0,D.jsxs)(`div`,{className:`cli-wrap`,children:[(0,D.jsx)(`pre`,{className:`cli-snippet`,children:zr}),(0,D.jsx)(kr,{text:zr})]})]}),(0,D.jsxs)(`div`,{className:`cli-block`,children:[(0,D.jsxs)(`b`,{className:`cli-block-label`,children:[`Bash / Zsh (`,(0,D.jsx)(`code`,{children:`~/.zshrc`}),`):`]}),(0,D.jsxs)(`div`,{className:`cli-wrap`,children:[(0,D.jsx)(`pre`,{className:`cli-snippet`,children:Br}),(0,D.jsx)(kr,{text:Br})]})]})]})}function Hr(){try{return window.location.port||null}catch{return null}}function Ur(){let e=Hr();return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h3`,{className:`settings-h3`,children:`Local Daemon Process`}),(0,D.jsx)(`p`,{className:`settings-desc`,children:`Background process managing provider adapters and SQLite store.`}),(0,D.jsxs)(`dl`,{className:`dkv`,children:[(0,D.jsx)(`dt`,{children:`HTTP Service`}),(0,D.jsx)(`dd`,{children:(0,D.jsxs)(`code`,{children:[`127.0.0.1:`,e??`8787`]})}),(0,D.jsx)(`dt`,{children:`Polling Cadence`}),(0,D.jsx)(`dd`,{children:`Every 10 minutes (default)`}),(0,D.jsx)(`dt`,{children:`Database File`}),(0,D.jsx)(`dd`,{children:(0,D.jsx)(`code`,{children:`~/.quotacap/quotacap.db`})})]}),(0,D.jsxs)(`p`,{className:`settings-note`,children:[`Change the port and polling cadence in `,(0,D.jsx)(`code`,{children:`~/.quotacap/config.json`}),` (`,(0,D.jsx)(`code`,{children:`port`}),`,`,` `,(0,D.jsx)(`code`,{children:`pollMinutes`}),`; defaults 8787 and 10), then restart the daemon. These controls stay read-only until the server offers a settings API.`]})]})}var Wr=[{id:`providers`,label:`Providers`},{id:`cli`,label:`CLI & Shell`},{id:`daemon`,label:`Daemon`}];function Gr({open:e,providers:t,refreshing:n,onSetProviderEnabled:r,onClose:i}){let[a,o]=(0,_.useState)(`providers`),s=(0,_.useRef)(null),c=(0,_.useRef)(null);if((0,_.useEffect)(()=>{if(!e)return;c.current=document.activeElement,s.current?.focus();let t=e=>{if(e.key===`Escape`){i();return}if(e.key!==`Tab`||!s.current)return;let t=[...s.current.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)].filter(e=>!e.hasAttribute(`disabled`));if(t.length===0)return;let n=t[0],r=t[t.length-1],a=document.activeElement===n||document.activeElement===s.current;e.shiftKey&&a?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t),c.current?.focus?.()}},[e,i]),!e)return null;let l=`settings-drawer-title`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{"data-testid":`settings-scrim`,className:`scrim is-open`,"aria-hidden":`true`,onClick:i}),(0,D.jsxs)(`aside`,{ref:s,tabIndex:-1,"data-testid":`settings-drawer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":l,className:`drawer is-open settings-drawer`,onClick:e=>e.stopPropagation(),children:[(0,D.jsxs)(`div`,{className:`drawer-head`,children:[(0,D.jsxs)(`div`,{className:`settings-head-main`,children:[(0,D.jsx)(`h2`,{id:l,className:`settings-title`,children:`Settings & Configuration`}),(0,D.jsx)(`span`,{className:`sub`,children:`Connected provider adapters and CLI prompt integration.`})]}),(0,D.jsx)(`button`,{className:`drawer-close`,type:`button`,"aria-label":`Close settings`,onClick:i,children:(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.4`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})})})]}),(0,D.jsx)(`div`,{className:`seg settings-tabs`,role:`tablist`,"aria-label":`Settings sections`,children:Wr.map(e=>(0,D.jsx)(`button`,{type:`button`,role:`tab`,className:`settings-tab${a===e.id?` is-active`:``}`,"aria-selected":a===e.id,onClick:()=>o(e.id),children:e.label},e.id))}),(0,D.jsxs)(`div`,{role:`tabpanel`,className:`settings-panel`,children:[a===`providers`&&(0,D.jsx)(Lr,{providers:t,refreshing:n,onSetProviderEnabled:r}),a===`cli`&&(0,D.jsx)(Vr,{}),a===`daemon`&&(0,D.jsx)(Ur,{})]})]})]})}function Kr(e,t){return t?`/setup`:`/`}function qr(){try{return window.location.pathname||`/`}catch{return`/`}}function Jr(e){window.history.pushState({},``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function Yr(){let[e,t]=(0,_.useState)(()=>qr());return(0,_.useEffect)(()=>{let e=()=>t(qr());return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),e}function Xr(e,t){let n=t?.summary?.trim()||`${e} login required`,r=t?.action?.trim().replace(/select Refresh in the QuotaCap dashboard/,`select Retry`);return r?`${n}. ${r}`:`${n}. Open ${e} and follow its sign-in instructions. Then select Retry.`}function Zr(e,t){let n=e.displayName;if(e.lastAttempt?.failureCategory===`auth`)return e.id===`opencode-go`?{text:`${t?`Run \`${t}\`, then re-poll.`:"Run the login command for your OpenCode CLI version — v2 `opencode auth login opencode` or v1 `opencode console login` — then re-poll."} QuotaCap reads that key only because you enabled OpenCode Go — \`quotacap providers disable opencode-go\` stops it.`}:{text:Xr(n,e.lastAttempt)};switch(e.exclusionReason){case`stale`:return{text:`Poll again to refresh this reading.`};case`reset-passed`:return{text:`Poll again to capture the new window.`};case`invalid`:return{text:`Check the ${n} CLI output, then re-poll.`};case`provider-failed`:{let t=e.lastAttempt;if(t?.summary){let e=t.errorDetail?`: ${t.errorDetail}`:``,r=t.action??`Check the ${n} CLI, then re-poll.`;return{text:`${t.summary}${e}. ${r}`}}return{text:`${fr(e.lastAttempt?.failureCategory??null)??`Provider failed`} — check the ${n} CLI, then re-poll.`}}case`not-reporting`:return{text:`No readings yet — run a poll.`};case null:return{text:`Poll again to refresh this reading.`}}}function Qr(e){switch(e.exclusionReason){case`stale`:return`stopped reporting`;case`reset-passed`:return`reset passed`;case`invalid`:return`sent an invalid reading`;case`provider-failed`:return`failed`;case`not-reporting`:return`isn't reporting yet`;case null:return`needs attention`}}function $r({providers:e,onRepoll:t,repolling:n,polling:r,opencodeLoginCommand:i}){let a=n||r===`in-progress`,o=e.filter(e=>!(!e.enabled||e.exclusionReason===null||a&&(e.exclusionReason===`stale`||e.exclusionReason===`not-reporting`)));return o.length===0?null:(0,D.jsx)(`div`,{children:o.map(e=>{let r=E(e.ageMs),a=Zr(e,i);return(0,D.jsxs)(`div`,{"data-testid":`fault-banner`,role:`alert`,className:`alert`,children:[(0,D.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.3`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 8v5`}),(0,D.jsx)(`path`,{d:`M12 16.5v.01`}),(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),(0,D.jsxs)(`span`,{children:[(0,D.jsxs)(`strong`,{children:[e.displayName,` `,Qr(e),`.`]}),` `,r?`Last read ${r} ago; `:``,`excluded from ranking. `,a.text]}),(0,D.jsx)(`button`,{type:`button`,className:`linkbtn`,onClick:t,disabled:n,style:{flex:`none`,marginLeft:`auto`},children:n?`Polling…`:e.lastAttempt?.failureCategory===`auth`?`Retry ${e.displayName}`:`Check ${e.displayName}`})]},e.id)})})}function ei(e){let t=e.displayName,n=e.id===`agy:3p`?`Antigravity`:t;if(e.exclusionReason===null&&e.quota){let t=E(e.ageMs);return{status:`Ready`,detail:t?`Last read ${t} ago.`:`Reporting.`}}if(e.lastAttempt?.success&&e.lastAttempt.succeededAt)return{status:`Ready`,detail:`Connected — no readings yet.`};let r=`By default QuotaCap never reads credentials; the only exception is OpenCode Go, which you enable explicitly.`;return e.harness===null?{status:`Sign in first`,detail:`QuotaCap has no live adapter for ${t}. Use manual ingest via the CLI to add readings.`}:e.lastAttempt?.failureCategory===`auth`?{status:`Sign in first`,detail:Xr(n,e.lastAttempt)}:e.lastAttempt?{status:`Sign in first`,detail:`${fr(e.lastAttempt.failureCategory)??`Last attempt failed`} — check the ${n} CLI, then re-poll. ${r}`}:{status:`Sign in first`,detail:`Install the ${n} CLI and sign in, then run the first poll. ${r}`}}function ti({providers:e}){return(0,D.jsx)(`div`,{className:`provlist`,children:e.map(e=>{let t=ei(e),n=t.status===`Ready`;return(0,D.jsxs)(`div`,{className:`provrow`,children:[(0,D.jsx)(`b`,{children:e.displayName}),(0,D.jsx)(`span`,{className:`path`,children:t.detail}),(0,D.jsxs)(`span`,{className:n?`st-ready`:`st-todo`,children:[n?(0,D.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M20 6L9 17l-5-5`})}):(0,D.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,D.jsx)(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),(0,D.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})]}),t.status]})]},e.id)})})}function ni(){return(0,D.jsxs)(`div`,{className:`preview`,"aria-label":`Sample payoff preview`,children:[(0,D.jsxs)(`div`,{className:`preview-head`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`var(--s3)`},children:[(0,D.jsx)(`span`,{style:{fontWeight:600},children:`What your first result will show`}),(0,D.jsx)(`span`,{className:`chip-sample`,style:{fontSize:`var(--t-1)`,padding:`2px 8px`,borderRadius:999,background:`var(--surface-raised)`,border:`1px solid var(--line-strong)`,fontWeight:600,color:`var(--ink-soft)`},children:`Sample data`})]}),(0,D.jsxs)(`div`,{className:`trackwrap`,children:[(0,D.jsxs)(`div`,{className:`tline`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-2)`,marginBottom:4},children:[(0,D.jsx)(`span`,{className:`used`,style:{fontWeight:600},children:`Kimi Code · 22% used`}),(0,D.jsx)(`span`,{className:`gap`,style:{color:`var(--ink-soft)`},children:`61 points behind pace`})]}),(0,D.jsxs)(`div`,{className:`track`,role:`img`,"aria-label":`Sample: 22 percent of quota used, 83 percent of the window elapsed`,children:[(0,D.jsx)(`div`,{className:`fill`,style:{width:`22%`,background:`var(--fill-behind)`,borderRight:`1px solid var(--edge-behind)`}}),(0,D.jsx)(`div`,{className:`mark`,style:{left:`83%`}})]}),(0,D.jsxs)(`div`,{className:`tfoot`,style:{display:`flex`,justifyContent:`space-between`,fontSize:`var(--t-1)`,color:`var(--ink-faint)`,marginTop:4},children:[(0,D.jsx)(`span`,{children:`start`}),(0,D.jsx)(`span`,{children:`time elapsed: 83%`}),(0,D.jsx)(`span`,{children:`reset`})]})]}),(0,D.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`var(--s3) 0 0`},children:`Switch to Kimi next — 67% waste in 1.2d`})]})}function ri({snapshot:e,onFirstPoll:t,polling:n,pollError:r}){let[i,a]=(0,_.useState)(1);return(0,D.jsxs)(`div`,{"data-testid":`setup-root`,style:{maxWidth:960,margin:`0 auto`,padding:`var(--s5) var(--s4) 56px`},children:[(0,D.jsx)(`p`,{className:`eyebrow`,style:{marginBottom:`var(--s1)`},children:`First run & accounts`}),(0,D.jsx)(`h1`,{style:{fontSize:`var(--t-6)`,letterSpacing:`-0.024em`,margin:`0 0 var(--s5)`,fontWeight:700},children:`Connect the subscriptions you already use`}),(0,D.jsxs)(`div`,{className:`setup`,children:[(0,D.jsxs)(`ol`,{className:`steps`,children:[(0,D.jsxs)(`li`,{className:i===1?`is-now`:``,"aria-current":i===1?`step`:void 0,children:[(0,D.jsx)(`span`,{className:`num`,children:`1`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`t`,children:`Detect`}),(0,D.jsx)(`span`,{className:`d`,children:`Find installed coding tools`})]})]}),(0,D.jsxs)(`li`,{className:i===2?`is-now`:``,"aria-current":i===2?`step`:void 0,children:[(0,D.jsx)(`span`,{className:`num`,children:`2`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`t`,children:`Review`}),(0,D.jsx)(`span`,{className:`d`,children:`Check what each adapter reads`})]})]}),(0,D.jsxs)(`li`,{className:i===3?`is-now`:``,"aria-current":i===3?`step`:void 0,children:[(0,D.jsx)(`span`,{className:`num`,children:`3`}),(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`span`,{className:`t`,children:`Start`}),(0,D.jsx)(`span`,{className:`d`,children:`Read current usage once`})]})]})]}),(0,D.jsxs)(`div`,{className:`panel`,children:[i===1&&(0,D.jsxs)(`section`,{"data-testid":`setup-step-1`,"aria-label":`Step 1: Detect`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Step 1 of 3`}),(0,D.jsx)(`h2`,{children:`What the daemon can see`}),(0,D.jsx)(`p`,{children:`QuotaCap asked the running daemon what it knows. The dashboard cannot scan this machine from the browser, so anything missing here needs the provider CLI installed and signed in first.`}),(0,D.jsxs)(`div`,{className:`privacy`,children:[(0,D.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,D.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`b`,{children:`Usage history stays on this machine`}),(0,D.jsx)(`span`,{children:`QuotaCap reads quota percentages and reset times only. It never accesses code or prompts.`})]})]})]}),(0,D.jsx)(ti,{providers:e.providers}),(0,D.jsxs)(`div`,{className:`panel-foot`,children:[(0,D.jsx)(`span`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`},children:`You can add, disable, or repair providers at any time.`}),(0,D.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(2),children:`Continue to review`})]})]}),i===2&&(0,D.jsxs)(`section`,{"data-testid":`setup-step-2`,"aria-label":`Step 2: Review`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Step 2 of 3`}),(0,D.jsx)(`h2`,{children:`Review accounts`}),(0,D.jsx)(`p`,{children:`QuotaCap reads usage through your own provider CLIs. It never asks for, stores, or transmits your provider credentials — sign-in happens in the provider CLI itself, not here.`}),(0,D.jsxs)(`div`,{className:`privacy`,children:[(0,D.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--good)`,strokeWidth:`2.2`,style:{flex:`none`},"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M12 3l7 3v5c0 5-3 8-7 10-4-2-7-5-7-10V6z`}),(0,D.jsx)(`path`,{d:`M9 12l2 2 4-4`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`b`,{children:`Zero credential storage`}),(0,D.jsx)(`span`,{children:`Authentication stays in official CLI keychains. QuotaCap never stores tokens, and reads one only if you explicitly enable OpenCode Go.`})]})]})]}),(0,D.jsx)(ti,{providers:e.providers}),(0,D.jsxs)(`div`,{className:`panel-foot`,children:[(0,D.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(1),children:`Back`}),(0,D.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:()=>a(3),children:`Continue to first poll`})]})]}),i===3&&(0,D.jsxs)(`section`,{"data-testid":`setup-step-3`,"aria-label":`Step 3: Start`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`p`,{className:`eyebrow`,children:`Step 3 of 3`}),(0,D.jsx)(`h2`,{children:`Take the first readings`}),(0,D.jsx)(`p`,{children:`Run the first poll. The daemon will ask each provider CLI for current usage and the dashboard will open when readings land.`})]}),(0,D.jsx)(ni,{}),(0,D.jsxs)(`div`,{className:`panel-foot`,children:[(0,D.jsx)(`button`,{className:`btn btn-quiet`,type:`button`,onClick:()=>a(2),children:`Back`}),(0,D.jsx)(`button`,{"data-testid":`setup-poll-button`,className:`btn btn-primary`,type:`button`,onClick:t,disabled:n,children:n?`Polling…`:`Run first poll`})]}),r&&(0,D.jsxs)(`div`,{"data-testid":`setup-poll-error`,className:`alert`,role:`alert`,style:{margin:`var(--s4) var(--s5)`},children:[(0,D.jsx)(`span`,{children:r}),(0,D.jsx)(`button`,{className:`btn btn-quiet btn-sm`,type:`button`,onClick:t,children:`Retry`})]})]})]})]})]})}var ii=`quotacap-theme`;function ai(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}function oi(){try{return typeof localStorage>`u`?null:localStorage.getItem(ii)}catch{return null}}function si(){try{return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches}catch{return!1}}function ci(e){try{document.documentElement.dataset.theme=e}catch{}try{localStorage.setItem(ii,e)}catch{}return e}function li(){return ai(oi(),si())}function ui(){let[e,t]=(0,_.useState)(()=>li()),n=(0,_.useCallback)(()=>{t(e=>ci(e===`dark`?`light`:`dark`))},[]);return(0,D.jsx)(`button`,{"data-testid":`theme-toggle`,className:`iconbtn`,type:`button`,onClick:n,"aria-label":e===`dark`?`Switch to light theme`:`Switch to dark theme`,"aria-pressed":e===`dark`,title:e===`dark`?`Switch to light theme`:`Switch to dark theme`,children:e===`dark`?(0,D.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,D.jsx)(`path`,{d:`M12 2v2M12 20v2M2 12h2M20 12h2M5 5l1.5 1.5M17.5 17.5L19 19M19 5l-1.5 1.5M6.5 17.5L5 19`})]}):(0,D.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,D.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`})})})}function di(e){return e.available?e.polling===`in-progress`?`polling`:!e.ready||e.version===``?`not-ready`:`live`:`unreachable`}function fi(){try{return window.location.host||`127.0.0.1:8787`}catch{return`127.0.0.1:8787`}}function pi(e,t){switch(e){case`live`:return`daemon live`;case`polling`:return`Polling`;case`unreachable`:return`Daemon unreachable`;case`not-ready`:return t?.version===``?`Version unknown`:`Daemon not ready`}}function mi({runtime:e,refreshing:t,onRefresh:n,onSettings:r,unreachable:i=!1}){let a=i?`unreachable`:e?di(e):null,o=e?.update,s=!!o&&!o.upToDate&&!!o.latest;return(0,D.jsx)(`header`,{className:`topbar`,children:(0,D.jsxs)(`div`,{className:`topbar-inner`,children:[(0,D.jsxs)(`span`,{className:`brand`,children:[(0,D.jsxs)(`svg`,{width:`21`,height:`21`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M4 16.5a8 8 0 0 1 16 0`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`}),(0,D.jsx)(`path`,{d:`M12 16.5l4.8-4.6`,stroke:`currentColor`,strokeWidth:`2.1`,strokeLinecap:`round`})]}),`QuotaCap`]}),(0,D.jsxs)(`div`,{className:`topbar-end`,children:[a?(0,D.jsxs)(`span`,{"data-testid":`pill`,"data-state":a,role:`status`,className:`daemon`,title:e?`available: ${e.available}; ready: ${e.ready}; polling: ${e.polling}; version: ${e.version}`:`no snapshot yet`,children:[(0,D.jsx)(`span`,{className:`daemon-dot is-${a}`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`daemon-t`,children:pi(a,e)}),a===`live`&&(0,D.jsxs)(`code`,{className:`daemon-addr`,children:[` · `,fi()]})]}):(0,D.jsxs)(`span`,{"data-testid":`pill`,"data-state":`connecting`,role:`status`,className:`daemon`,children:[(0,D.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`daemon-t`,children:`Connecting…`})]}),s&&o&&o.latest?(0,D.jsxs)(`span`,{"data-testid":`update-badge`,role:`status`,className:`update-badge`,title:`Run 'quotacap update' to upgrade`,children:[(0,D.jsx)(`span`,{className:`daemon-dot is-polling`,"aria-hidden":`true`}),(0,D.jsx)(`span`,{className:`daemon-t`,children:`Update ${o.current} to ${o.latest}`})]}):null,(0,D.jsxs)(`div`,{className:`topbar-actions`,children:[(0,D.jsx)(ui,{}),(0,D.jsxs)(`button`,{"data-testid":`refresh-button`,className:`btn btn-quiet`,type:`button`,onClick:n,disabled:t,title:`Force refresh now`,children:[(0,D.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.5-5.8`}),(0,D.jsx)(`path`,{d:`M20 4v4h-4`})]}),(0,D.jsx)(`span`,{className:`btn-label`,children:t?`Refreshing…`:`Refresh`})]}),(0,D.jsxs)(`button`,{"data-testid":`settings-button`,className:`btn btn-quiet`,type:`button`,onClick:r,title:`Open Settings`,children:[(0,D.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,D.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,D.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),(0,D.jsx)(`span`,{className:`btn-label`,children:`Settings`})]})]})]})]})})}function hi(e){return[`• What is read: Bearer [REDACTED] already stored ${e?`when you ran \`${e}\``:"with the command for your CLI version: v2 `opencode auth login opencode` or v1 `opencode console login`"} (v2 \`~/.local/share/opencode/opencode.db\` active credential, else legacy \`~/.local/share/opencode/auth.json\`; \`opencode-go\` then \`opencode\`).`,`• Read frequency: in-memory, read-only once per poll (every 10 minutes by default).`,"• Request destination: sent only as `Authorization: Bearer` to `https://opencode.ai/zen/go/v1/usage` to fetch `rolling/weekly/monthly` `percent` + `resetsAt`.","• Never-list: never used to make chat or model requests, never written or rotated, never stored in the `quotacap` DB, never returned by the API or MCP, and never logged (errors show `[redacted]`).","• Revocation instructions: revoke at `https://opencode.ai/auth` or `opencode providers logout opencode-go` and run `quotacap providers disable opencode-go` to stop polling.","• Optional environment override: if you prefer no file access, set `OPENCODE_API_KEY` instead."].join(`
|
|
13
13
|
`)}hi();function gi(e,t,n){let r=e?.detectedProviders?.includes(`opencode-go`)??!1,i=t.find(e=>e.id===`opencode-go`);return r&&!i?.enabled&&!n}function _i({onEnable:e}){return(0,D.jsxs)(`div`,{"data-testid":`opencode-go-banner`,role:`status`,className:`alert`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`strong`,{children:`OpenCode Go detected.`}),` Enable to track 5h/weekly usage? The API key stays with OpenCode until you enable tracking.`]}),(0,D.jsx)(`button`,{type:`button`,className:`linkbtn`,onClick:e,style:{flex:`none`,marginLeft:`auto`},children:`Enable OpenCode Go`})]})}function vi({onConfirm:e,onCancel:t,busy:n,loginCommand:r}){return(0,_.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,D.jsx)(`div`,{role:`presentation`,style:{position:`fixed`,inset:0,display:`grid`,placeItems:`center`,background:`var(--scrim, rgba(0,0,0,0.5))`,zIndex:60},children:(0,D.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`opencode-go-consent-title`,style:{background:`var(--surface)`,border:`1px solid var(--line)`,borderRadius:`var(--r-md)`,padding:`var(--s4) var(--s5)`,maxWidth:560,margin:`var(--s4)`},children:[(0,D.jsx)(`h2`,{id:`opencode-go-consent-title`,style:{fontSize:`var(--t-4)`,margin:`0 0 var(--s3)`},children:`Enable OpenCode Go?`}),(0,D.jsx)(`p`,{style:{fontSize:`var(--t-2)`,color:`var(--ink-soft)`,margin:`0 0 var(--s4)`,whiteSpace:`pre-line`},children:hi(r)}),(0,D.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`var(--s2)`},children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-quiet`,onClick:t,disabled:n,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:e,disabled:n,children:n?`Enabling…`:`Enable`})]})]})})}var yi=[{label:`On track`,cls:`pace-ontrack`,meaning:`Burning at a rate the window sustains`},{label:`Behind pace`,cls:`pace-behind`,meaning:`Burning slow; risk of unused quota waste`},{label:`Ahead of pace`,cls:`pace-ahead`,meaning:`Burning faster than time; monitor usage`},{label:`Cap risk`,cls:`pace-cap`,meaning:`Will hit cap before reset window closes`},{label:`Quota exhausted`,cls:`pace-cap`,meaning:`Quota is 100% consumed until next reset`},{label:`Watch`,cls:`pace-watch`,meaning:`Pace points at the cap, but position or the reset clock is uncertain`},{label:`Measuring`,cls:`pace-out`,meaning:`Not enough data yet; pace appears after 6h`},{label:`Not reporting`,cls:`pace-out`,meaning:`No usable reading; excluded from ranking`}];function bi(){let[e,t]=(0,_.useState)(!1),n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&!n.current.contains(e.target)&&t(!1)},i=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),(0,D.jsxs)(`div`,{className:`legend-wrap`,ref:n,children:[(0,D.jsx)(`button`,{type:`button`,className:`legend-btn`,"aria-expanded":e,"aria-controls":`pacing-legend`,onClick:()=>t(e=>!e),children:`Pacing Legend ▾`}),e&&(0,D.jsxs)(`div`,{id:`pacing-legend`,className:`legend-popover`,role:`dialog`,"aria-label":`Pacing legend`,children:[(0,D.jsxs)(`div`,{className:`legend-head`,children:[(0,D.jsx)(`b`,{children:`Pacing Scale Legend`}),(0,D.jsx)(`button`,{type:`button`,className:`legend-close`,"aria-label":`Close pacing legend`,onClick:()=>t(!1),children:`×`})]}),(0,D.jsx)(`p`,{className:`legend-intro`,children:`Pacing measures quota burn against elapsed window time:`}),(0,D.jsx)(`div`,{className:`legend-rows`,children:yi.map(e=>(0,D.jsxs)(`div`,{className:`legend-row`,children:[(0,D.jsx)(`span`,{className:`pace ${e.cls}`,children:e.label}),(0,D.jsx)(`span`,{children:e.meaning})]},e.label))}),(0,D.jsxs)(`div`,{className:`legend-foot`,children:[(0,D.jsx)(`code`,{children:`█`}),` quota used · `,(0,D.jsx)(`code`,{children:`│`}),` time elapsed · `,(0,D.jsx)(`code`,{children:`░`}),` projected waste`]}),(0,D.jsx)(`div`,{className:`legend-foot`,children:`Avg = used ÷ days elapsed · 24h = burn over the last day · Ideal = remaining ÷ days left`})]})]})}function xi(){try{return window.location.hostname||`127.0.0.1`}catch{return`127.0.0.1`}}function Si({version:e}){let t=e?`QuotaCap v${e}`:`QuotaCap`;return(0,D.jsxs)(`footer`,{className:`sitefoot`,children:[(0,D.jsxs)(`div`,{className:`sitefoot-start`,children:[(0,D.jsxs)(`span`,{children:[t,` · local quota tracker · bound to `,(0,D.jsx)(`code`,{children:xi()})]}),(0,D.jsx)(bi,{})]}),(0,D.jsx)(`span`,{children:`MIT licence · no telemetry · history stays on this machine`})]})}function Ci({endpoint:e,lastGood:t,onRetry:n}){return(0,D.jsxs)(`div`,{"data-testid":`state-unavailable`,role:`alert`,children:[(0,D.jsx)(`h2`,{children:`Service unavailable`}),(0,D.jsxs)(`p`,{children:[`The QuotaCap daemon did not answer at `,(0,D.jsx)(`code`,{children:e}),`. Start it with`,` `,(0,D.jsx)(`code`,{children:`quotacap daemon`}),`, then retry.`]}),(0,D.jsx)(`button`,{type:`button`,onClick:n,children:`Retry`}),t&&(0,D.jsxs)(`p`,{children:[`Showing last readings (`,le(t.asOf),`).`]})]})}function wi({status:e,message:t,lastGood:n,onRetry:r}){return(0,D.jsxs)(`div`,{"data-testid":`state-http-error`,role:`alert`,children:[(0,D.jsxs)(`h2`,{children:[`Request failed (HTTP `,e,`)`]}),(0,D.jsx)(`p`,{children:t}),(0,D.jsx)(`button`,{type:`button`,onClick:r,children:`Retry`}),n&&(0,D.jsxs)(`p`,{children:[`Showing last readings (`,le(n.asOf),`).`]})]})}function Ti({snapshot:e,onSelectProvider:t,onViewAdvice:n}){return(0,D.jsxs)(`div`,{"data-testid":`dashboard-root`,className:`dashboard`,children:[(0,D.jsx)(Xe,{recommendation:e.recommendation,providers:e.providers,asOf:e.asOf,onSelectProvider:t,onViewAdvice:n}),!ae(e)&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(tr,{providers:e.providers,asOf:e.asOf,onSelectProvider:t}),(0,D.jsx)(Pn,{providers:e.providers,recommendation:e.recommendation,asOf:e.asOf,lastCompletedPollAt:e.runtime.lastCompletedPollAt,polling:e.runtime.polling,onSelectProvider:t})]})]})}function Ei(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1),[te,re]=(0,_.useState)(!1),oe=Yr(),se=e?Kr(oe,ae(e)):null;(0,_.useEffect)(()=>{se&&se!==oe&&Jr(se)},[se,oe]);let ce=(0,_.useCallback)(async()=>{try{t(ie(await ee())),r(null)}catch(e){e instanceof b?r({kind:`service-unavailable`,message:e.message}):e instanceof x?r({kind:`http-error`,status:e.status,message:e.message}):r({kind:`http-error`,status:0,message:String(e)})}finally{a(!1)}},[]);(0,_.useEffect)(()=>{ce()},[ce]),(0,_.useEffect)(()=>{if(!e||e.runtime.polling!==`in-progress`)return;let t=setInterval(()=>void ce(),1e3);return()=>clearInterval(t)},[e,ce]);let ue=(0,_.useCallback)(async()=>{s(!0),l(null);try{let e=await ne();e.message?l(e.message):e.raw?.cooldown===!0&&l(`Already up to date — showing latest readings.`),await ce()}catch(e){e instanceof b?r({kind:`service-unavailable`,message:e.message}):e instanceof x?r({kind:`http-error`,status:e.status,message:e.message}):r({kind:`http-error`,status:0,message:String(e)})}finally{s(!1)}},[ce]),T=(e,t)=>{if(e===`opencode-go`&&t){v(!0);return}(async()=>{try{await w(e,t),t||re(!1),l(`${e===`opencode-go`?`OpenCode Go`:e} ${t?`enabled`:`disabled`} — restart the daemon to apply it.`)}catch(t){l(`Could not update ${e}: ${t instanceof Error?t.message:String(t)}`)}})()},E=se===`/setup`,de=n?n.kind===`http-error`?`Request failed (HTTP ${n.status}): ${n.message}`:`Service unavailable: ${n.message}`:null,fe=(0,D.jsx)(mi,{runtime:e?.runtime??null,unreachable:n?.kind===`service-unavailable`,refreshing:o,onRefresh:()=>void ue(),onSettings:()=>h(!0)});return e&&E?(0,D.jsxs)(D.Fragment,{children:[fe,(0,D.jsxs)(`main`,{children:[c&&(0,D.jsx)(`div`,{"data-testid":`refresh-notice`,role:`status`,children:c}),gi(e.runtime,e.providers,te)&&(0,D.jsx)(_i,{onEnable:()=>v(!0)}),(0,D.jsx)(ri,{snapshot:e,onFirstPoll:()=>void ue(),polling:o,pollError:de})]}),(0,D.jsx)(Gr,{open:m,providers:e.providers,refreshing:o,onSetProviderEnabled:T,onClose:()=>h(!1)}),g&&(0,D.jsx)(vi,{loginCommand:e?.runtime.opencodeLoginCommand,busy:S,onCancel:()=>v(!1),onConfirm:()=>void(async()=>{C(!0);try{await w(`opencode-go`,!0,!0),re(!0),v(!1),l(`OpenCode Go enabled — restart the daemon to apply it.`)}catch(e){l(`Could not enable OpenCode Go: ${e instanceof Error?e.message:String(e)}`)}finally{C(!1)}})()}),(0,D.jsx)(Si,{version:e.runtime.version})]}):(0,D.jsxs)(D.Fragment,{children:[fe,(0,D.jsxs)(`main`,{children:[c&&(0,D.jsx)(`div`,{"data-testid":`refresh-notice`,role:`status`,children:c}),i&&!e&&(0,D.jsx)(`div`,{"data-testid":`state-loading`,"aria-busy":`true`,"aria-label":`Loading quota state`,children:[0,1,2].map(e=>(0,D.jsx)(`div`,{"aria-hidden":`true`,className:`skel`,style:{height:64,background:`var(--surface-raised)`,border:e===0?`1px solid var(--rec)`:`1px solid var(--line)`,borderRadius:8,marginBottom:8}},e))}),n?.kind===`service-unavailable`&&!e&&(0,D.jsx)(Ci,{endpoint:y(),lastGood:e,onRetry:()=>void ce()}),n?.kind===`http-error`&&!e&&(0,D.jsx)(wi,{status:n.status,message:n.message,lastGood:e,onRetry:()=>void ce()}),n&&e&&(0,D.jsxs)(`div`,{"data-testid":`state-stale-error`,role:`alert`,children:[n.kind===`http-error`?`Request failed (HTTP ${n.status}): `:`Service unavailable: `,n.message,` Showing last readings (`,le(e.asOf),`).`,` `,(0,D.jsx)(`button`,{type:`button`,onClick:()=>void ce(),children:`Retry`})]}),e&&(0,D.jsx)($r,{providers:e.providers,onRepoll:()=>void ue(),repolling:o,polling:e.runtime.polling,opencodeLoginCommand:e.runtime.opencodeLoginCommand}),e&&gi(e.runtime,e.providers,te)&&(0,D.jsx)(_i,{onEnable:()=>v(!0)}),e&&(0,D.jsx)(Ti,{snapshot:e,onSelectProvider:e=>{p(!1),d(e)},onViewAdvice:()=>{d(null),p(!0)}})]}),(0,D.jsx)(En,{resetKey:u,fallback:(0,D.jsx)(kn,{name:e?.providers.find(e=>e.id===u)?.displayName??u??`provider`,onClose:()=>d(null)}),children:(0,D.jsx)(Or,{provider:e?.providers.find(e=>e.id===u)??null,asOf:e?.asOf??``,recommendation:e?.recommendation??null,onClose:()=>d(null),onRenamed:()=>void ce()})}),g&&(0,D.jsx)(vi,{loginCommand:e?.runtime.opencodeLoginCommand,busy:S,onCancel:()=>v(!1),onConfirm:()=>void(async()=>{C(!0);try{await w(`opencode-go`,!0,!0),re(!0),v(!1),l(`OpenCode Go enabled — restart the daemon to apply it.`)}catch(e){l(`Could not enable OpenCode Go: ${e instanceof Error?e.message:String(e)}`)}finally{C(!1)}})()}),e&&(0,D.jsx)(Ar,{open:f,recommendation:e.recommendation,providers:e.providers,asOf:e.asOf,onClose:()=>p(!1),onSelectProvider:e=>{p(!1),d(e)}}),(0,D.jsx)(Gr,{open:m,providers:e?.providers??[],refreshing:o,onSetProviderEnabled:T,onClose:()=>h(!1)}),(0,D.jsx)(Si,{version:e?.runtime.version})]})}var Di=typeof document>`u`?null:document.getElementById(`app`);Di&&(0,v.createRoot)(Di).render((0,D.jsx)(Ei,{}));
|
package/web/dist/index.html
CHANGED
|
@@ -12,7 +12,7 @@ try {
|
|
|
12
12
|
document.documentElement.dataset.theme = dark ? "dark" : "light";
|
|
13
13
|
} catch (e) { /* default light theme stands */ }
|
|
14
14
|
</script>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-oqxiN-gi.js"></script>
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-Co33DTl5.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body><div id="app"></div></body>
|