tokentracker-cli 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{DashboardPage-BAb5mCnt.js → DashboardPage-4iRwUaHk.js} +1 -1
- package/dashboard/dist/assets/{LandingExtras-yaFs24Wt.js → LandingExtras-B9IdYCfA.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-5mTskSwq.js → LeaderboardPage-DW7CMnjR.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-ccbyuG4J.js → LeaderboardProfilePage-mAuhFhYv.js} +1 -1
- package/dashboard/dist/assets/{MatrixRain-jvkSzQkB.js → MatrixRain-Bfjc_8I0.js} +1 -1
- package/dashboard/dist/assets/{MatrixShell-unVoF8fw.js → MatrixShell-BpQQnI5A.js} +1 -1
- package/dashboard/dist/assets/{main-DQ7YU0WX.js → main-DFYFVRqg.js} +4 -4
- package/dashboard/dist/assets/{vibeusage-api-BkDJCLN3.js → vibeusage-api-BGa0zUOb.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/local-api.js +119 -5
- package/src/lib/rollout.js +8 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DashboardPage-4iRwUaHk.js","assets/vibeusage-api-BGa0zUOb.js","assets/LeaderboardPage-DW7CMnjR.js","assets/MatrixShell-BpQQnI5A.js","assets/MatrixRain-Bfjc_8I0.js","assets/LeaderboardProfilePage-mAuhFhYv.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function Yw(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const a in i)if(a!=="default"&&!(a in e)){const l=Object.getOwnPropertyDescriptor(i,a);l&&Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:()=>i[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();function Zg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Gw(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function i(){var a=!1;try{a=this instanceof i}catch{}return a?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,a.get?a:{enumerable:!0,get:function(){return e[i]}})}),r}var Ec={exports:{}},ia={},Pc={exports:{}},Oe={};var Yp;function Jw(){if(Yp)return Oe;Yp=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.iterator;function _(N){return N===null||typeof N!="object"?null:(N=v&&N[v]||N["@@iterator"],typeof N=="function"?N:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,x={};function E(N,V,he){this.props=N,this.context=V,this.refs=x,this.updater=he||k}E.prototype.isReactComponent={},E.prototype.setState=function(N,V){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,V,"setState")},E.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function z(){}z.prototype=E.prototype;function I(N,V,he){this.props=N,this.context=V,this.refs=x,this.updater=he||k}var F=I.prototype=new z;F.constructor=I,T(F,E.prototype),F.isPureReactComponent=!0;var M=Array.isArray,W=Object.prototype.hasOwnProperty,O={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function R(N,V,he){var ye,Le={},Te=null,Ie=null;if(V!=null)for(ye in V.ref!==void 0&&(Ie=V.ref),V.key!==void 0&&(Te=""+V.key),V)W.call(V,ye)&&!H.hasOwnProperty(ye)&&(Le[ye]=V[ye]);var De=arguments.length-2;if(De===1)Le.children=he;else if(1<De){for(var ze=Array(De),xe=0;xe<De;xe++)ze[xe]=arguments[xe+2];Le.children=ze}if(N&&N.defaultProps)for(ye in De=N.defaultProps,De)Le[ye]===void 0&&(Le[ye]=De[ye]);return{$$typeof:e,type:N,key:Te,ref:Ie,props:Le,_owner:O.current}}function fe(N,V){return{$$typeof:e,type:N.type,key:V,ref:N.ref,props:N.props,_owner:N._owner}}function me(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function $e(N){var V={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(he){return V[he]})}var Ce=/\/+/g;function je(N,V){return typeof N=="object"&&N!==null&&N.key!=null?$e(""+N.key):V.toString(36)}function Pe(N,V,he,ye,Le){var Te=typeof N;(Te==="undefined"||Te==="boolean")&&(N=null);var Ie=!1;if(N===null)Ie=!0;else switch(Te){case"string":case"number":Ie=!0;break;case"object":switch(N.$$typeof){case e:case t:Ie=!0}}if(Ie)return Ie=N,Le=Le(Ie),N=ye===""?"."+je(Ie,0):ye,M(Le)?(he="",N!=null&&(he=N.replace(Ce,"$&/")+"/"),Pe(Le,V,he,"",function(xe){return xe})):Le!=null&&(me(Le)&&(Le=fe(Le,he+(!Le.key||Ie&&Ie.key===Le.key?"":(""+Le.key).replace(Ce,"$&/")+"/")+N)),V.push(Le)),1;if(Ie=0,ye=ye===""?".":ye+":",M(N))for(var De=0;De<N.length;De++){Te=N[De];var ze=ye+je(Te,De);Ie+=Pe(Te,V,he,ze,Le)}else if(ze=_(N),typeof ze=="function")for(N=ze.call(N),De=0;!(Te=N.next()).done;)Te=Te.value,ze=ye+je(Te,De++),Ie+=Pe(Te,V,he,ze,Le);else if(Te==="object")throw V=String(N),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.");return Ie}function Se(N,V,he){if(N==null)return N;var ye=[],Le=0;return Pe(N,ye,"","",function(Te){return V.call(he,Te,Le++)}),ye}function ce(N){if(N._status===-1){var V=N._result;V=V(),V.then(function(he){(N._status===0||N._status===-1)&&(N._status=1,N._result=he)},function(he){(N._status===0||N._status===-1)&&(N._status=2,N._result=he)}),N._status===-1&&(N._status=0,N._result=V)}if(N._status===1)return N._result.default;throw N._result}var _e={current:null},Y={transition:null},te={ReactCurrentDispatcher:_e,ReactCurrentBatchConfig:Y,ReactCurrentOwner:O};function ne(){throw Error("act(...) is not supported in production builds of React.")}return Oe.Children={map:Se,forEach:function(N,V,he){Se(N,function(){V.apply(this,arguments)},he)},count:function(N){var V=0;return Se(N,function(){V++}),V},toArray:function(N){return Se(N,function(V){return V})||[]},only:function(N){if(!me(N))throw Error("React.Children.only expected to receive a single React element child.");return N}},Oe.Component=E,Oe.Fragment=r,Oe.Profiler=a,Oe.PureComponent=I,Oe.StrictMode=i,Oe.Suspense=p,Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=te,Oe.act=ne,Oe.cloneElement=function(N,V,he){if(N==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+N+".");var ye=T({},N.props),Le=N.key,Te=N.ref,Ie=N._owner;if(V!=null){if(V.ref!==void 0&&(Te=V.ref,Ie=O.current),V.key!==void 0&&(Le=""+V.key),N.type&&N.type.defaultProps)var De=N.type.defaultProps;for(ze in V)W.call(V,ze)&&!H.hasOwnProperty(ze)&&(ye[ze]=V[ze]===void 0&&De!==void 0?De[ze]:V[ze])}var ze=arguments.length-2;if(ze===1)ye.children=he;else if(1<ze){De=Array(ze);for(var xe=0;xe<ze;xe++)De[xe]=arguments[xe+2];ye.children=De}return{$$typeof:e,type:N.type,key:Le,ref:Te,props:ye,_owner:Ie}},Oe.createContext=function(N){return N={$$typeof:c,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},N.Provider={$$typeof:l,_context:N},N.Consumer=N},Oe.createElement=R,Oe.createFactory=function(N){var V=R.bind(null,N);return V.type=N,V},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(N){return{$$typeof:f,render:N}},Oe.isValidElement=me,Oe.lazy=function(N){return{$$typeof:g,_payload:{_status:-1,_result:N},_init:ce}},Oe.memo=function(N,V){return{$$typeof:m,type:N,compare:V===void 0?null:V}},Oe.startTransition=function(N){var V=Y.transition;Y.transition={};try{N()}finally{Y.transition=V}},Oe.unstable_act=ne,Oe.useCallback=function(N,V){return _e.current.useCallback(N,V)},Oe.useContext=function(N){return _e.current.useContext(N)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(N){return _e.current.useDeferredValue(N)},Oe.useEffect=function(N,V){return _e.current.useEffect(N,V)},Oe.useId=function(){return _e.current.useId()},Oe.useImperativeHandle=function(N,V,he){return _e.current.useImperativeHandle(N,V,he)},Oe.useInsertionEffect=function(N,V){return _e.current.useInsertionEffect(N,V)},Oe.useLayoutEffect=function(N,V){return _e.current.useLayoutEffect(N,V)},Oe.useMemo=function(N,V){return _e.current.useMemo(N,V)},Oe.useReducer=function(N,V,he){return _e.current.useReducer(N,V,he)},Oe.useRef=function(N){return _e.current.useRef(N)},Oe.useState=function(N){return _e.current.useState(N)},Oe.useSyncExternalStore=function(N,V,he){return _e.current.useSyncExternalStore(N,V,he)},Oe.useTransition=function(){return _e.current.useTransition()},Oe.version="18.3.1",Oe}var Gp;function Sd(){return Gp||(Gp=1,Pc.exports=Jw()),Pc.exports}var Jp;function Qw(){if(Jp)return ia;Jp=1;var e=Sd(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(f,p,m){var g,v={},_=null,k=null;m!==void 0&&(_=""+m),p.key!==void 0&&(_=""+p.key),p.ref!==void 0&&(k=p.ref);for(g in p)i.call(p,g)&&!l.hasOwnProperty(g)&&(v[g]=p[g]);if(f&&f.defaultProps)for(g in p=f.defaultProps,p)v[g]===void 0&&(v[g]=p[g]);return{$$typeof:t,type:f,key:_,ref:k,props:v,_owner:a.current}}return ia.Fragment=r,ia.jsx=c,ia.jsxs=c,ia}var Qp;function Xw(){return Qp||(Qp=1,Ec.exports=Qw()),Ec.exports}var A=Xw(),b=Sd();const qr=Zg(b),xd=Yw({__proto__:null,default:qr},[b]);var Ed=b.createContext(void 0);Ed.displayName="InsforgeContext";var qg=b.createContext(void 0);qg.displayName="InsforgeAuthStateContext";var Kg=b.createContext(void 0);Kg.displayName="InsforgeMethodsContext";var Yg=b.createContext(void 0);Yg.displayName="InsforgeConfigContext";function J(e,t,r){function i(f,p){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:p,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,p);const m=c.prototype,g=Object.keys(m);for(let v=0;v<g.length;v++){const _=g[v];_ in f||(f[_]=m[_].bind(f))}}const a=r?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function c(f){var p;const m=r?.Parent?new l:this;i(m,f),(p=m._zod).deferred??(p.deferred=[]);for(const g of m._zod.deferred)g();return m}return Object.defineProperty(c,"init",{value:i}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>r?.Parent&&f instanceof r.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(c,"name",{value:e}),c}class si extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Gg extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const e1={};function go(e){return e1}function Kc(e,t){return typeof t=="bigint"?t.toString():t}function Pd(e){return e==null}function Td(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Xp=Symbol("evaluating");function Xe(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==Xp)return i===void 0&&(i=Xp,i=r()),i},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function t1(...e){const t={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function n1(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Jg="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function em(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Yc(e){if(em(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(em(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Qg(e){return Yc(e)?{...e}:Array.isArray(e)?[...e]:e}function Cd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function r1(e,t,r){const i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function Ae(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ii(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function o1(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Zs(e){return typeof e=="string"?e:e?.message}function yo(e,t,r){const i={...e,path:e.path??[]};if(!e.message){const a=Zs(e.inst?._zod.def?.error?.(e))??Zs(t?.error?.(e))??Zs(r.customError?.(e))??Zs(r.localeError?.(e))??"Invalid input";i.message=a}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Rd(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _a(...e){const[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}const Xg=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Kc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ey=J("$ZodError",Xg),ty=J("$ZodError",Xg,{Parent:Error});function i1(e,t=r=>r.message){const r={},i=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):i.push(t(a));return{formErrors:i,fieldErrors:r}}function a1(e,t=r=>r.message){const r={_errors:[]},i=a=>{for(const l of a.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>i({issues:c}));else if(l.code==="invalid_key")i({issues:l.issues});else if(l.code==="invalid_element")i({issues:l.issues});else if(l.path.length===0)r._errors.push(t(l));else{let c=r,f=0;for(;f<l.path.length;){const p=l.path[f];f===l.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(t(l))):c[p]=c[p]||{_errors:[]},c=c[p],f++}}};return i(e),r}const Ld=e=>(t,r,i,a)=>{const l=i?Object.assign(i,{async:!1}):{async:!1},c=t._zod.run({value:r,issues:[]},l);if(c instanceof Promise)throw new si;if(c.issues.length){const f=new(a?.Err??e)(c.issues.map(p=>yo(p,l,go())));throw Jg(f,a?.callee),f}return c.value},Ad=e=>async(t,r,i,a)=>{const l=i?Object.assign(i,{async:!0}):{async:!0};let c=t._zod.run({value:r,issues:[]},l);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new(a?.Err??e)(c.issues.map(p=>yo(p,l,go())));throw Jg(f,a?.callee),f}return c.value},Ll=e=>(t,r,i)=>{const a=i?{...i,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},a);if(l instanceof Promise)throw new si;return l.issues.length?{success:!1,error:new(e??ey)(l.issues.map(c=>yo(c,a,go())))}:{success:!0,data:l.value}},s1=Ll(ty),Al=e=>async(t,r,i)=>{const a=i?Object.assign(i,{async:!0}):{async:!0};let l=t._zod.run({value:r,issues:[]},a);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(c=>yo(c,a,go())))}:{success:!0,data:l.value}},l1=Al(ty),u1=e=>(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ld(e)(t,r,a)},c1=e=>(t,r,i)=>Ld(e)(t,r,i),d1=e=>async(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ad(e)(t,r,a)},f1=e=>async(t,r,i)=>Ad(e)(t,r,i),h1=e=>(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ll(e)(t,r,a)},p1=e=>(t,r,i)=>Ll(e)(t,r,i),m1=e=>async(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Al(e)(t,r,a)},g1=e=>async(t,r,i)=>Al(e)(t,r,i),y1=/^[cC][^\s-]{8,}$/,v1=/^[0-9a-z]+$/,w1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_1=/^[0-9a-vA-V]{20}$/,b1=/^[A-Za-z0-9]{27}$/,k1=/^[a-zA-Z0-9_-]{21}$/,S1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,x1=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tm=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,E1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,P1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function T1(){return new RegExp(P1,"u")}const C1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,R1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,L1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,A1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ny=/^[A-Za-z0-9_-]*$/,N1=/^\+[1-9]\d{6,14}$/,ry="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",O1=new RegExp(`^${ry}$`);function oy(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function M1(e){return new RegExp(`^${oy(e)}$`)}function I1(e){const t=oy({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${r.join("|")})`;return new RegExp(`^${ry}T(?:${i})$`)}const D1=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},z1=/^[^A-Z]*$/,U1=/^[^a-z]*$/,Zn=J("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),F1=J("$ZodCheckMaxLength",(e,t)=>{var r;Zn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const a=i.value;return!Pd(a)&&a.length!==void 0}),e._zod.onattach.push(i=>{const a=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{const a=i.value;if(a.length<=t.maximum)return;const c=Rd(a);i.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),j1=J("$ZodCheckMinLength",(e,t)=>{var r;Zn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const a=i.value;return!Pd(a)&&a.length!==void 0}),e._zod.onattach.push(i=>{const a=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const a=i.value;if(a.length>=t.minimum)return;const c=Rd(a);i.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),B1=J("$ZodCheckLengthEquals",(e,t)=>{var r;Zn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const a=i.value;return!Pd(a)&&a.length!==void 0}),e._zod.onattach.push(i=>{const a=i._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=i=>{const a=i.value,l=a.length;if(l===t.length)return;const c=Rd(a),f=l>t.length;i.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),$l=J("$ZodCheckStringFormat",(e,t)=>{var r,i;Zn.init(e,t),e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),H1=J("$ZodCheckRegex",(e,t)=>{$l.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),V1=J("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=z1),$l.init(e,t)}),W1=J("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=U1),$l.init(e,t)}),Z1=J("$ZodCheckIncludes",(e,t)=>{Zn.init(e,t);const r=Cd(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(a=>{const l=a._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(i)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),q1=J("$ZodCheckStartsWith",(e,t)=>{Zn.init(e,t);const r=new RegExp(`^${Cd(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),K1=J("$ZodCheckEndsWith",(e,t)=>{Zn.init(e,t);const r=new RegExp(`.*${Cd(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}}),Y1=J("$ZodCheckOverwrite",(e,t)=>{Zn.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),G1={major:4,minor:3,patch:6},Wt=J("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=G1;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const a of i)for(const l of a._zod.onattach)l(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(c,f,p)=>{let m=ii(c),g;for(const v of f){if(v._zod.def.when){if(!v._zod.def.when(c))continue}else if(m)continue;const _=c.issues.length,k=v._zod.check(c);if(k instanceof Promise&&p?.async===!1)throw new si;if(g||k instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await k,c.issues.length!==_&&(m||(m=ii(c,_)))});else{if(c.issues.length===_)continue;m||(m=ii(c,_))}}return g?g.then(()=>c):c},l=(c,f,p)=>{if(ii(c))return c.aborted=!0,c;const m=a(f,i,p);if(m instanceof Promise){if(p.async===!1)throw new si;return m.then(g=>e._zod.parse(g,p))}return e._zod.parse(m,p)};e._zod.run=(c,f)=>{if(f.skipChecks)return e._zod.parse(c,f);if(f.direction==="backward"){const m=e._zod.parse({value:c.value,issues:[]},{...f,skipChecks:!0});return m instanceof Promise?m.then(g=>l(g,c,f)):l(m,c,f)}const p=e._zod.parse(c,f);if(p instanceof Promise){if(f.async===!1)throw new si;return p.then(m=>a(m,i,f))}return a(p,i,f)}}Xe(e,"~standard",()=>({validate:a=>{try{const l=s1(e,a);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return l1(e,a).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},vendor:"zod",version:1}))}),$d=J("$ZodString",(e,t)=>{Wt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??D1(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),st=J("$ZodStringFormat",(e,t)=>{$l.init(e,t),$d.init(e,t)}),J1=J("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=x1),st.init(e,t)}),Q1=J("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tm(i))}else t.pattern??(t.pattern=tm());st.init(e,t)}),X1=J("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=E1),st.init(e,t)}),e_=J("$ZodURL",(e,t)=>{st.init(e,t),e._zod.check=r=>{try{const i=r.value.trim(),a=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=a.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),t_=J("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=T1()),st.init(e,t)}),n_=J("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=k1),st.init(e,t)}),r_=J("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=y1),st.init(e,t)}),o_=J("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=v1),st.init(e,t)}),i_=J("$ZodULID",(e,t)=>{t.pattern??(t.pattern=w1),st.init(e,t)}),a_=J("$ZodXID",(e,t)=>{t.pattern??(t.pattern=_1),st.init(e,t)}),s_=J("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=b1),st.init(e,t)}),l_=J("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=I1(t)),st.init(e,t)}),u_=J("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=O1),st.init(e,t)}),c_=J("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=M1(t)),st.init(e,t)}),d_=J("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=S1),st.init(e,t)}),f_=J("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=C1),st.init(e,t),e._zod.bag.format="ipv4"}),h_=J("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=R1),st.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),p_=J("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=L1),st.init(e,t)}),m_=J("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=A1),st.init(e,t),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[a,l]=i;if(!l)throw new Error;const c=Number(l);if(`${c}`!==l)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function iy(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const g_=J("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$1),st.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{iy(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function y_(e){if(!ny.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return iy(r)}const v_=J("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ny),st.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{y_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),w_=J("$ZodE164",(e,t)=>{t.pattern??(t.pattern=N1),st.init(e,t)});function __(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const a=JSON.parse(atob(i));return!("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const b_=J("$ZodJWT",(e,t)=>{st.init(e,t),e._zod.check=r=>{__(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});function nm(e,t,r){e.issues.length&&t.issues.push(...o1(r,e.issues)),t.value[r]=e.value}const k_=J("$ZodArray",(e,t)=>{Wt.init(e,t),e._zod.parse=(r,i)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const l=[];for(let c=0;c<a.length;c++){const f=a[c],p=t.element._zod.run({value:f,issues:[]},i);p instanceof Promise?l.push(p.then(m=>nm(m,r,c))):nm(p,r,c)}return l.length?Promise.all(l).then(()=>r):r}});function rm(e,t,r,i){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const a=e.filter(l=>!ii(l));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(l=>l.issues.map(c=>yo(c,i,go())))}),t)}const S_=J("$ZodUnion",(e,t)=>{Wt.init(e,t),Xe(e._zod,"optin",()=>t.options.some(a=>a._zod.optin==="optional")?"optional":void 0),Xe(e._zod,"optout",()=>t.options.some(a=>a._zod.optout==="optional")?"optional":void 0),Xe(e._zod,"values",()=>{if(t.options.every(a=>a._zod.values))return new Set(t.options.flatMap(a=>Array.from(a._zod.values)))}),Xe(e._zod,"pattern",()=>{if(t.options.every(a=>a._zod.pattern)){const a=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${a.map(l=>Td(l.source)).join("|")})$`)}});const r=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(a,l)=>{if(r)return i(a,l);let c=!1;const f=[];for(const p of t.options){const m=p._zod.run({value:a.value,issues:[]},l);if(m instanceof Promise)f.push(m),c=!0;else{if(m.issues.length===0)return m;f.push(m)}}return c?Promise.all(f).then(p=>rm(p,a,e,l)):rm(f,a,e,l)}}),x_=J("$ZodIntersection",(e,t)=>{Wt.init(e,t),e._zod.parse=(r,i)=>{const a=r.value,l=t.left._zod.run({value:a,issues:[]},i),c=t.right._zod.run({value:a,issues:[]},i);return l instanceof Promise||c instanceof Promise?Promise.all([l,c]).then(([p,m])=>om(r,p,m)):om(r,l,c)}});function Gc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Yc(e)&&Yc(t)){const r=Object.keys(t),i=Object.keys(e).filter(l=>r.indexOf(l)!==-1),a={...e,...t};for(const l of i){const c=Gc(e[l],t[l]);if(!c.valid)return{valid:!1,mergeErrorPath:[l,...c.mergeErrorPath]};a[l]=c.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<e.length;i++){const a=e[i],l=t[i],c=Gc(a,l);if(!c.valid)return{valid:!1,mergeErrorPath:[i,...c.mergeErrorPath]};r.push(c.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function om(e,t,r){const i=new Map;let a;for(const f of t.issues)if(f.code==="unrecognized_keys"){a??(a=f);for(const p of f.keys)i.has(p)||i.set(p,{}),i.get(p).l=!0}else e.issues.push(f);for(const f of r.issues)if(f.code==="unrecognized_keys")for(const p of f.keys)i.has(p)||i.set(p,{}),i.get(p).r=!0;else e.issues.push(f);const l=[...i].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(l.length&&a&&e.issues.push({...a,keys:l}),ii(e))return e;const c=Gc(t.value,r.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const E_=J("$ZodTransform",(e,t)=>{Wt.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Gg(e.constructor.name);const a=t.transform(r.value,r);if(i.async)return(a instanceof Promise?a:Promise.resolve(a)).then(c=>(r.value=c,r));if(a instanceof Promise)throw new si;return r.value=a,r}});function im(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ay=J("$ZodOptional",(e,t)=>{Wt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Xe(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Td(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(t.innerType._zod.optin==="optional"){const a=t.innerType._zod.run(r,i);return a instanceof Promise?a.then(l=>im(l,r.value)):im(a,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,i)}}),P_=J("$ZodExactOptional",(e,t)=>{ay.init(e,t),Xe(e._zod,"values",()=>t.innerType._zod.values),Xe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,i)=>t.innerType._zod.run(r,i)}),T_=J("$ZodNullable",(e,t)=>{Wt.init(e,t),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Td(r.source)}|null)$`):void 0}),Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)}),C_=J("$ZodDefault",(e,t)=>{Wt.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);if(r.value===void 0)return r.value=t.defaultValue,r;const a=t.innerType._zod.run(r,i);return a instanceof Promise?a.then(l=>am(l,t)):am(a,t)}});function am(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const R_=J("$ZodPrefault",(e,t)=>{Wt.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,i))}),L_=J("$ZodNonOptional",(e,t)=>{Wt.init(e,t),Xe(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(r,i)=>{const a=t.innerType._zod.run(r,i);return a instanceof Promise?a.then(l=>sm(l,e)):sm(a,e)}});function sm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const A_=J("$ZodCatch",(e,t)=>{Wt.init(e,t),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);const a=t.innerType._zod.run(r,i);return a instanceof Promise?a.then(l=>(r.value=l.value,l.issues.length&&(r.value=t.catchValue({...r,error:{issues:l.issues.map(c=>yo(c,i,go()))},input:r.value}),r.issues=[]),r)):(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(l=>yo(l,i,go()))},input:r.value}),r.issues=[]),r)}}),$_=J("$ZodPipe",(e,t)=>{Wt.init(e,t),Xe(e._zod,"values",()=>t.in._zod.values),Xe(e._zod,"optin",()=>t.in._zod.optin),Xe(e._zod,"optout",()=>t.out._zod.optout),Xe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){const l=t.out._zod.run(r,i);return l instanceof Promise?l.then(c=>qs(c,t.in,i)):qs(l,t.in,i)}const a=t.in._zod.run(r,i);return a instanceof Promise?a.then(l=>qs(l,t.out,i)):qs(a,t.out,i)}});function qs(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const N_=J("$ZodReadonly",(e,t)=>{Wt.init(e,t),Xe(e._zod,"propValues",()=>t.innerType._zod.propValues),Xe(e._zod,"values",()=>t.innerType._zod.values),Xe(e._zod,"optin",()=>t.innerType?._zod?.optin),Xe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);const a=t.innerType._zod.run(r,i);return a instanceof Promise?a.then(lm):lm(a)}});function lm(e){return e.value=Object.freeze(e.value),e}const O_=J("$ZodCustom",(e,t)=>{Zn.init(e,t),Wt.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,a=t.fn(i);if(a instanceof Promise)return a.then(l=>um(l,r,i,e));um(a,r,i,e)}});function um(e,t,r,i){if(!e){const a={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(a.params=i._zod.def.params),t.issues.push(_a(a))}}var cm;class M_{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const i=r[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const i={...this.get(r)??{}};delete i.id;const a={...i,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function I_(){return new M_}(cm=globalThis).__zod_globalRegistry??(cm.__zod_globalRegistry=I_());const da=globalThis.__zod_globalRegistry;function D_(e,t){return new e({type:"string",...Ae(t)})}function z_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ae(t)})}function dm(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ae(t)})}function U_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ae(t)})}function F_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ae(t)})}function j_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ae(t)})}function B_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ae(t)})}function H_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ae(t)})}function V_(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ae(t)})}function W_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ae(t)})}function Z_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ae(t)})}function q_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ae(t)})}function K_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ae(t)})}function Y_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ae(t)})}function G_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ae(t)})}function J_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ae(t)})}function Q_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ae(t)})}function X_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ae(t)})}function eb(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ae(t)})}function tb(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ae(t)})}function nb(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ae(t)})}function rb(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ae(t)})}function ob(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ae(t)})}function ib(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ae(t)})}function ab(e,t){return new e({type:"string",format:"date",check:"string_format",...Ae(t)})}function sb(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ae(t)})}function lb(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ae(t)})}function sy(e,t){return new F1({check:"max_length",...Ae(t),maximum:e})}function wl(e,t){return new j1({check:"min_length",...Ae(t),minimum:e})}function ly(e,t){return new B1({check:"length_equals",...Ae(t),length:e})}function ub(e,t){return new H1({check:"string_format",format:"regex",...Ae(t),pattern:e})}function cb(e){return new V1({check:"string_format",format:"lowercase",...Ae(e)})}function db(e){return new W1({check:"string_format",format:"uppercase",...Ae(e)})}function fb(e,t){return new Z1({check:"string_format",format:"includes",...Ae(t),includes:e})}function hb(e,t){return new q1({check:"string_format",format:"starts_with",...Ae(t),prefix:e})}function pb(e,t){return new K1({check:"string_format",format:"ends_with",...Ae(t),suffix:e})}function pi(e){return new Y1({check:"overwrite",tx:e})}function mb(e){return pi(t=>t.normalize(e))}function gb(){return pi(e=>e.trim())}function yb(){return pi(e=>e.toLowerCase())}function vb(){return pi(e=>e.toUpperCase())}function wb(){return pi(e=>n1(e))}function _b(e,t,r){return new e({type:"array",element:t,...Ae(r)})}function bb(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ae(r)})}function kb(e){const t=Sb(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(_a(i,r.value,t._zod.def));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),a.continue??(a.continue=!t._zod.def.abort),r.issues.push(_a(a))}},e(r.value,r)));return t}function Sb(e,t){const r=new Zn({check:"custom",...Ae(t)});return r._zod.check=e,r}function uy(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??da,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Vt(e,t,r={path:[],schemaPath:[]}){var i;const a=e._zod.def,l=t.seen.get(e);if(l)return l.count++,r.schemaPath.includes(e)&&(l.cycle=r.path),l.schema;const c={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,c);const f=e._zod.toJSONSchema?.();if(f)c.schema=f;else{const g={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,g);else{const _=c.schema,k=t.processors[a.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);k(e,t,_,g)}const v=e._zod.parent;v&&(c.ref||(c.ref=v),Vt(v,t,g),t.seen.get(v).isParent=!0)}const p=t.metadataRegistry.get(e);return p&&Object.assign(c.schema,p),t.io==="input"&&Bt(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((i=c.schema).default??(i.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function cy(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const c of e.seen.entries()){const f=e.metadataRegistry.get(c[0])?.id;if(f){const p=i.get(f);if(p&&p!==c[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(f,c[0])}}const a=c=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const v=e.external.registry.get(c[0])?.id,_=e.external.uri??(T=>T);if(v)return{ref:_(v)};const k=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=k,{defId:k,ref:`${_("__shared")}#/${f}/${k}`}}if(c[1]===r)return{ref:"#"};const m=`#/${f}/`,g=c[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:m+g}},l=c=>{if(c[1].schema.$ref)return;const f=c[1],{ref:p,defId:m}=a(c);f.def={...f.schema},m&&(f.defId=m);const g=f.schema;for(const v in g)delete g[v];g.$ref=p};if(e.cycles==="throw")for(const c of e.seen.entries()){const f=c[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
|
|
3
3
|
|
|
4
4
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of e.seen.entries()){const f=c[1];if(t===c[0]){l(c);continue}if(e.external){const m=e.external.registry.get(c[0])?.id;if(t!==c[0]&&m){l(c);continue}}if(e.metadataRegistry.get(c[0])?.id){l(c);continue}if(f.cycle){l(c);continue}if(f.count>1&&e.reused==="ref"){l(c);continue}}}function dy(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=c=>{const f=e.seen.get(c);if(f.ref===null)return;const p=f.def??f.schema,m={...p},g=f.ref;if(f.ref=null,g){i(g);const _=e.seen.get(g),k=_.schema;if(k.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(k)):Object.assign(p,k),Object.assign(p,m),c._zod.parent===g)for(const x in p)x==="$ref"||x==="allOf"||x in m||delete p[x];if(k.$ref&&_.def)for(const x in p)x==="$ref"||x==="allOf"||x in _.def&&JSON.stringify(p[x])===JSON.stringify(_.def[x])&&delete p[x]}const v=c._zod.parent;if(v&&v!==g){i(v);const _=e.seen.get(v);if(_?.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const k in p)k==="$ref"||k==="allOf"||k in _.def&&JSON.stringify(p[k])===JSON.stringify(_.def[k])&&delete p[k]}e.override({zodSchema:c,jsonSchema:p,path:f.path??[]})};for(const c of[...e.seen.entries()].reverse())i(c[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(c)}Object.assign(a,r.def??r.schema);const l=e.external?.defs??{};for(const c of e.seen.entries()){const f=c[1];f.def&&f.defId&&(l[f.defId]=f.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?a.$defs=l:a.definitions=l);try{const c=JSON.parse(JSON.stringify(a));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:_l(t,"input",e.processors),output:_l(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Bt(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Bt(i.element,r);if(i.type==="set")return Bt(i.valueType,r);if(i.type==="lazy")return Bt(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Bt(i.innerType,r);if(i.type==="intersection")return Bt(i.left,r)||Bt(i.right,r);if(i.type==="record"||i.type==="map")return Bt(i.keyType,r)||Bt(i.valueType,r);if(i.type==="pipe")return Bt(i.in,r)||Bt(i.out,r);if(i.type==="object"){for(const a in i.shape)if(Bt(i.shape[a],r))return!0;return!1}if(i.type==="union"){for(const a of i.options)if(Bt(a,r))return!0;return!1}if(i.type==="tuple"){for(const a of i.items)if(Bt(a,r))return!0;return!!(i.rest&&Bt(i.rest,r))}return!1}const xb=(e,t={})=>r=>{const i=uy({...r,processors:t});return Vt(e,i),cy(i,e),dy(i,e)},_l=(e,t,r={})=>i=>{const{libraryOptions:a,target:l}=i??{},c=uy({...a??{},target:l,io:t,processors:r});return Vt(e,c),cy(c,e),dy(c,e)},Eb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Pb=(e,t,r,i)=>{const a=r;a.type="string";const{minimum:l,maximum:c,format:f,patterns:p,contentEncoding:m}=e._zod.bag;if(typeof l=="number"&&(a.minLength=l),typeof c=="number"&&(a.maxLength=c),f&&(a.format=Eb[f]??f,a.format===""&&delete a.format,f==="time"&&delete a.format),m&&(a.contentEncoding=m),p&&p.size>0){const g=[...p];g.length===1?a.pattern=g[0].source:g.length>1&&(a.allOf=[...g.map(v=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:v.source}))])}},Tb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Cb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Rb=(e,t,r,i)=>{const a=r,l=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(a.minItems=c),typeof f=="number"&&(a.maxItems=f),a.type="array",a.items=Vt(l.element,t,{...i,path:[...i.path,"items"]})},Lb=(e,t,r,i)=>{const a=e._zod.def,l=a.inclusive===!1,c=a.options.map((f,p)=>Vt(f,t,{...i,path:[...i.path,l?"oneOf":"anyOf",p]}));l?r.oneOf=c:r.anyOf=c},Ab=(e,t,r,i)=>{const a=e._zod.def,l=Vt(a.left,t,{...i,path:[...i.path,"allOf",0]}),c=Vt(a.right,t,{...i,path:[...i.path,"allOf",1]}),f=m=>"allOf"in m&&Object.keys(m).length===1,p=[...f(l)?l.allOf:[l],...f(c)?c.allOf:[c]];r.allOf=p},$b=(e,t,r,i)=>{const a=e._zod.def,l=Vt(a.innerType,t,i),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=a.innerType,r.nullable=!0):r.anyOf=[l,{type:"null"}]},Nb=(e,t,r,i)=>{const a=e._zod.def;Vt(a.innerType,t,i);const l=t.seen.get(e);l.ref=a.innerType},Ob=(e,t,r,i)=>{const a=e._zod.def;Vt(a.innerType,t,i);const l=t.seen.get(e);l.ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))},Mb=(e,t,r,i)=>{const a=e._zod.def;Vt(a.innerType,t,i);const l=t.seen.get(e);l.ref=a.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},Ib=(e,t,r,i)=>{const a=e._zod.def;Vt(a.innerType,t,i);const l=t.seen.get(e);l.ref=a.innerType;let c;try{c=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=c},Db=(e,t,r,i)=>{const a=e._zod.def,l=t.io==="input"?a.in._zod.def.type==="transform"?a.out:a.in:a.out;Vt(l,t,i);const c=t.seen.get(e);c.ref=l},zb=(e,t,r,i)=>{const a=e._zod.def;Vt(a.innerType,t,i);const l=t.seen.get(e);l.ref=a.innerType,r.readOnly=!0},fy=(e,t,r,i)=>{const a=e._zod.def;Vt(a.innerType,t,i);const l=t.seen.get(e);l.ref=a.innerType},Ub=J("ZodISODateTime",(e,t)=>{l_.init(e,t),ct.init(e,t)});function Fb(e){return ib(Ub,e)}const jb=J("ZodISODate",(e,t)=>{u_.init(e,t),ct.init(e,t)});function Bb(e){return ab(jb,e)}const Hb=J("ZodISOTime",(e,t)=>{c_.init(e,t),ct.init(e,t)});function Vb(e){return sb(Hb,e)}const Wb=J("ZodISODuration",(e,t)=>{d_.init(e,t),ct.init(e,t)});function Zb(e){return lb(Wb,e)}const qb=(e,t)=>{ey.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>a1(e,r)},flatten:{value:r=>i1(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Kc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Kc,2)}},isEmpty:{get(){return e.issues.length===0}}})},bn=J("ZodError",qb,{Parent:Error}),Kb=Ld(bn),Yb=Ad(bn),Gb=Ll(bn),Jb=Al(bn),Qb=u1(bn),Xb=c1(bn),ek=d1(bn),tk=f1(bn),nk=h1(bn),rk=p1(bn),ok=m1(bn),ik=g1(bn),Zt=J("ZodType",(e,t)=>(Wt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:_l(e,"input"),output:_l(e,"output")}}),e.toJSONSchema=xb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(t1(t,{checks:[...t.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),e.with=e.check,e.clone=(r,i)=>r1(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.parse=(r,i)=>Kb(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Gb(e,r,i),e.parseAsync=async(r,i)=>Yb(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Jb(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>Qb(e,r,i),e.decode=(r,i)=>Xb(e,r,i),e.encodeAsync=async(r,i)=>ek(e,r,i),e.decodeAsync=async(r,i)=>tk(e,r,i),e.safeEncode=(r,i)=>nk(e,r,i),e.safeDecode=(r,i)=>rk(e,r,i),e.safeEncodeAsync=async(r,i)=>ok(e,r,i),e.safeDecodeAsync=async(r,i)=>ik(e,r,i),e.refine=(r,i)=>e.check(Kk(r,i)),e.superRefine=r=>e.check(Yk(r)),e.overwrite=r=>e.check(pi(r)),e.optional=()=>hm(e),e.exactOptional=()=>Ok(e),e.nullable=()=>pm(e),e.nullish=()=>hm(pm(e)),e.nonoptional=r=>jk(e,r),e.array=()=>Ek(e),e.or=r=>Tk([e,r]),e.and=r=>Rk(e,r),e.transform=r=>mm(e,Ak(r)),e.default=r=>Dk(e,r),e.prefault=r=>Uk(e,r),e.catch=r=>Hk(e,r),e.pipe=r=>mm(e,r),e.readonly=()=>Zk(e),e.describe=r=>{const i=e.clone();return da.add(i,{description:r}),i},Object.defineProperty(e,"description",{get(){return da.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return da.get(e);const i=e.clone();return da.add(i,r[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),hy=J("_ZodString",(e,t)=>{$d.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(i,a,l)=>Pb(e,i,a);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...i)=>e.check(ub(...i)),e.includes=(...i)=>e.check(fb(...i)),e.startsWith=(...i)=>e.check(hb(...i)),e.endsWith=(...i)=>e.check(pb(...i)),e.min=(...i)=>e.check(wl(...i)),e.max=(...i)=>e.check(sy(...i)),e.length=(...i)=>e.check(ly(...i)),e.nonempty=(...i)=>e.check(wl(1,...i)),e.lowercase=i=>e.check(cb(i)),e.uppercase=i=>e.check(db(i)),e.trim=()=>e.check(gb()),e.normalize=(...i)=>e.check(mb(...i)),e.toLowerCase=()=>e.check(yb()),e.toUpperCase=()=>e.check(vb()),e.slugify=()=>e.check(wb())}),ak=J("ZodString",(e,t)=>{$d.init(e,t),hy.init(e,t),e.email=r=>e.check(z_(sk,r)),e.url=r=>e.check(H_(lk,r)),e.jwt=r=>e.check(ob(Sk,r)),e.emoji=r=>e.check(V_(uk,r)),e.guid=r=>e.check(dm(fm,r)),e.uuid=r=>e.check(U_(Ks,r)),e.uuidv4=r=>e.check(F_(Ks,r)),e.uuidv6=r=>e.check(j_(Ks,r)),e.uuidv7=r=>e.check(B_(Ks,r)),e.nanoid=r=>e.check(W_(ck,r)),e.guid=r=>e.check(dm(fm,r)),e.cuid=r=>e.check(Z_(dk,r)),e.cuid2=r=>e.check(q_(fk,r)),e.ulid=r=>e.check(K_(hk,r)),e.base64=r=>e.check(tb(_k,r)),e.base64url=r=>e.check(nb(bk,r)),e.xid=r=>e.check(Y_(pk,r)),e.ksuid=r=>e.check(G_(mk,r)),e.ipv4=r=>e.check(J_(gk,r)),e.ipv6=r=>e.check(Q_(yk,r)),e.cidrv4=r=>e.check(X_(vk,r)),e.cidrv6=r=>e.check(eb(wk,r)),e.e164=r=>e.check(rb(kk,r)),e.datetime=r=>e.check(Fb(r)),e.date=r=>e.check(Bb(r)),e.time=r=>e.check(Vb(r)),e.duration=r=>e.check(Zb(r))});function py(e){return D_(ak,e)}const ct=J("ZodStringFormat",(e,t)=>{st.init(e,t),hy.init(e,t)}),sk=J("ZodEmail",(e,t)=>{X1.init(e,t),ct.init(e,t)}),fm=J("ZodGUID",(e,t)=>{J1.init(e,t),ct.init(e,t)}),Ks=J("ZodUUID",(e,t)=>{Q1.init(e,t),ct.init(e,t)}),lk=J("ZodURL",(e,t)=>{e_.init(e,t),ct.init(e,t)}),uk=J("ZodEmoji",(e,t)=>{t_.init(e,t),ct.init(e,t)}),ck=J("ZodNanoID",(e,t)=>{n_.init(e,t),ct.init(e,t)}),dk=J("ZodCUID",(e,t)=>{r_.init(e,t),ct.init(e,t)}),fk=J("ZodCUID2",(e,t)=>{o_.init(e,t),ct.init(e,t)}),hk=J("ZodULID",(e,t)=>{i_.init(e,t),ct.init(e,t)}),pk=J("ZodXID",(e,t)=>{a_.init(e,t),ct.init(e,t)}),mk=J("ZodKSUID",(e,t)=>{s_.init(e,t),ct.init(e,t)}),gk=J("ZodIPv4",(e,t)=>{f_.init(e,t),ct.init(e,t)}),yk=J("ZodIPv6",(e,t)=>{h_.init(e,t),ct.init(e,t)}),vk=J("ZodCIDRv4",(e,t)=>{p_.init(e,t),ct.init(e,t)}),wk=J("ZodCIDRv6",(e,t)=>{m_.init(e,t),ct.init(e,t)}),_k=J("ZodBase64",(e,t)=>{g_.init(e,t),ct.init(e,t)}),bk=J("ZodBase64URL",(e,t)=>{v_.init(e,t),ct.init(e,t)}),kk=J("ZodE164",(e,t)=>{w_.init(e,t),ct.init(e,t)}),Sk=J("ZodJWT",(e,t)=>{b_.init(e,t),ct.init(e,t)}),xk=J("ZodArray",(e,t)=>{k_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Rb(e,r,i,a),e.element=t.element,e.min=(r,i)=>e.check(wl(r,i)),e.nonempty=r=>e.check(wl(1,r)),e.max=(r,i)=>e.check(sy(r,i)),e.length=(r,i)=>e.check(ly(r,i)),e.unwrap=()=>e.element});function Ek(e,t){return _b(xk,e,t)}const Pk=J("ZodUnion",(e,t)=>{S_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Lb(e,r,i,a),e.options=t.options});function Tk(e,t){return new Pk({type:"union",options:e,...Ae(t)})}const Ck=J("ZodIntersection",(e,t)=>{x_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Ab(e,r,i,a)});function Rk(e,t){return new Ck({type:"intersection",left:e,right:t})}const Lk=J("ZodTransform",(e,t)=>{E_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Cb(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Gg(e.constructor.name);r.addIssue=l=>{if(typeof l=="string")r.issues.push(_a(l,r.value,t));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=r.value),c.inst??(c.inst=e),r.issues.push(_a(c))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(l=>(r.value=l,r)):(r.value=a,r)}});function Ak(e){return new Lk({type:"transform",transform:e})}const $k=J("ZodOptional",(e,t)=>{ay.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>fy(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function hm(e){return new $k({type:"optional",innerType:e})}const Nk=J("ZodExactOptional",(e,t)=>{P_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>fy(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function Ok(e){return new Nk({type:"optional",innerType:e})}const Mk=J("ZodNullable",(e,t)=>{T_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>$b(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function pm(e){return new Mk({type:"nullable",innerType:e})}const Ik=J("ZodDefault",(e,t)=>{C_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Ob(e,r,i,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Dk(e,t){return new Ik({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Qg(t)}})}const zk=J("ZodPrefault",(e,t)=>{R_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Mb(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function Uk(e,t){return new zk({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Qg(t)}})}const Fk=J("ZodNonOptional",(e,t)=>{L_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Nb(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function jk(e,t){return new Fk({type:"nonoptional",innerType:e,...Ae(t)})}const Bk=J("ZodCatch",(e,t)=>{A_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Ib(e,r,i,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Hk(e,t){return new Bk({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vk=J("ZodPipe",(e,t)=>{$_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Db(e,r,i,a),e.in=t.in,e.out=t.out});function mm(e,t){return new Vk({type:"pipe",in:e,out:t})}const Wk=J("ZodReadonly",(e,t)=>{N_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>zb(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function Zk(e){return new Wk({type:"readonly",innerType:e})}const qk=J("ZodCustom",(e,t)=>{O_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Tb(e,r)});function Kk(e,t={}){return bb(qk,e,t)}function Yk(e){return kb(e)}var Tc={exports:{}},Qt={},Cc={exports:{}},Rc={};var gm;function Gk(){return gm||(gm=1,(function(e){function t(Y,te){var ne=Y.length;Y.push(te);e:for(;0<ne;){var N=ne-1>>>1,V=Y[N];if(0<a(V,te))Y[N]=te,Y[ne]=V,ne=N;else break e}}function r(Y){return Y.length===0?null:Y[0]}function i(Y){if(Y.length===0)return null;var te=Y[0],ne=Y.pop();if(ne!==te){Y[0]=ne;e:for(var N=0,V=Y.length,he=V>>>1;N<he;){var ye=2*(N+1)-1,Le=Y[ye],Te=ye+1,Ie=Y[Te];if(0>a(Le,ne))Te<V&&0>a(Ie,Le)?(Y[N]=Ie,Y[Te]=ne,N=Te):(Y[N]=Le,Y[ye]=ne,N=ye);else if(Te<V&&0>a(Ie,ne))Y[N]=Ie,Y[Te]=ne,N=Te;else break e}}return te}function a(Y,te){var ne=Y.sortIndex-te.sortIndex;return ne!==0?ne:Y.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var p=[],m=[],g=1,v=null,_=3,k=!1,T=!1,x=!1,E=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function F(Y){for(var te=r(m);te!==null;){if(te.callback===null)i(m);else if(te.startTime<=Y)i(m),te.sortIndex=te.expirationTime,t(p,te);else break;te=r(m)}}function M(Y){if(x=!1,F(Y),!T)if(r(p)!==null)T=!0,ce(W);else{var te=r(m);te!==null&&_e(M,te.startTime-Y)}}function W(Y,te){T=!1,x&&(x=!1,z(R),R=-1),k=!0;var ne=_;try{for(F(te),v=r(p);v!==null&&(!(v.expirationTime>te)||Y&&!$e());){var N=v.callback;if(typeof N=="function"){v.callback=null,_=v.priorityLevel;var V=N(v.expirationTime<=te);te=e.unstable_now(),typeof V=="function"?v.callback=V:v===r(p)&&i(p),F(te)}else i(p);v=r(p)}if(v!==null)var he=!0;else{var ye=r(m);ye!==null&&_e(M,ye.startTime-te),he=!1}return he}finally{v=null,_=ne,k=!1}}var O=!1,H=null,R=-1,fe=5,me=-1;function $e(){return!(e.unstable_now()-me<fe)}function Ce(){if(H!==null){var Y=e.unstable_now();me=Y;var te=!0;try{te=H(!0,Y)}finally{te?je():(O=!1,H=null)}}else O=!1}var je;if(typeof I=="function")je=function(){I(Ce)};else if(typeof MessageChannel<"u"){var Pe=new MessageChannel,Se=Pe.port2;Pe.port1.onmessage=Ce,je=function(){Se.postMessage(null)}}else je=function(){E(Ce,0)};function ce(Y){H=Y,O||(O=!0,je())}function _e(Y,te){R=E(function(){Y(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_continueExecution=function(){T||k||(T=!0,ce(W))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):fe=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_getFirstCallbackNode=function(){return r(p)},e.unstable_next=function(Y){switch(_){case 1:case 2:case 3:var te=3;break;default:te=_}var ne=_;_=te;try{return Y()}finally{_=ne}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,te){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ne=_;_=Y;try{return te()}finally{_=ne}},e.unstable_scheduleCallback=function(Y,te,ne){var N=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?N+ne:N):ne=N,Y){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=ne+V,Y={id:g++,callback:te,priorityLevel:Y,startTime:ne,expirationTime:V,sortIndex:-1},ne>N?(Y.sortIndex=ne,t(m,Y),r(p)===null&&Y===r(m)&&(x?(z(R),R=-1):x=!0,_e(M,ne-N))):(Y.sortIndex=V,t(p,Y),T||k||(T=!0,ce(W))),Y},e.unstable_shouldYield=$e,e.unstable_wrapCallback=function(Y){var te=_;return function(){var ne=_;_=te;try{return Y.apply(this,arguments)}finally{_=ne}}}})(Rc)),Rc}var ym;function Jk(){return ym||(ym=1,Cc.exports=Gk()),Cc.exports}var vm;function Qk(){if(vm)return Qt;vm=1;var e=Sd(),t=Jk();function r(n){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+n,s=1;s<arguments.length;s++)o+="&args[]="+encodeURIComponent(arguments[s]);return"Minified React error #"+n+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,a={};function l(n,o){c(n,o),c(n+"Capture",o)}function c(n,o){for(a[n]=o,n=0;n<o.length;n++)i.add(o[n])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,g={},v={};function _(n){return p.call(v,n)?!0:p.call(g,n)?!1:m.test(n)?v[n]=!0:(g[n]=!0,!1)}function k(n,o,s,u){if(s!==null&&s.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return u?!1:s!==null?!s.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function T(n,o,s,u){if(o===null||typeof o>"u"||k(n,o,s,u))return!0;if(u)return!1;if(s!==null)switch(s.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function x(n,o,s,u,d,h,y){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=u,this.attributeNamespace=d,this.mustUseProperty=s,this.propertyName=n,this.type=o,this.sanitizeURL=h,this.removeEmptyString=y}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){E[n]=new x(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var o=n[0];E[o]=new x(o,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){E[n]=new x(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){E[n]=new x(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){E[n]=new x(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){E[n]=new x(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){E[n]=new x(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){E[n]=new x(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){E[n]=new x(n,5,!1,n.toLowerCase(),null,!1,!1)});var z=/[\-:]([a-z])/g;function I(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var o=n.replace(z,I);E[o]=new x(o,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var o=n.replace(z,I);E[o]=new x(o,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var o=n.replace(z,I);E[o]=new x(o,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){E[n]=new x(n,1,!1,n.toLowerCase(),null,!1,!1)}),E.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){E[n]=new x(n,1,!1,n.toLowerCase(),null,!0,!0)});function F(n,o,s,u){var d=E.hasOwnProperty(o)?E[o]:null;(d!==null?d.type!==0:u||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(T(o,s,d,u)&&(s=null),u||d===null?_(o)&&(s===null?n.removeAttribute(o):n.setAttribute(o,""+s)):d.mustUseProperty?n[d.propertyName]=s===null?d.type===3?!1:"":s:(o=d.attributeName,u=d.attributeNamespace,s===null?n.removeAttribute(o):(d=d.type,s=d===3||d===4&&s===!0?"":""+s,u?n.setAttributeNS(u,o,s):n.setAttribute(o,s))))}var M=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,W=Symbol.for("react.element"),O=Symbol.for("react.portal"),H=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),fe=Symbol.for("react.profiler"),me=Symbol.for("react.provider"),$e=Symbol.for("react.context"),Ce=Symbol.for("react.forward_ref"),je=Symbol.for("react.suspense"),Pe=Symbol.for("react.suspense_list"),Se=Symbol.for("react.memo"),ce=Symbol.for("react.lazy"),_e=Symbol.for("react.offscreen"),Y=Symbol.iterator;function te(n){return n===null||typeof n!="object"?null:(n=Y&&n[Y]||n["@@iterator"],typeof n=="function"?n:null)}var ne=Object.assign,N;function V(n){if(N===void 0)try{throw Error()}catch(s){var o=s.stack.trim().match(/\n( *(at )?)/);N=o&&o[1]||""}return`
|
|
@@ -2042,12 +2042,12 @@ live_sniffer.event.capture,ui,LiveSniffer,LiveSniffer,event,"> CAPTURE: +128 NEU
|
|
|
2042
2042
|
`))}logResponse(e,t,r,i,a){if(!this.enabled)return;const l=[`← ${e} ${t} ${r} (${i}ms)`],c=Lg(wa(a));if(c){const f=c.length>1e3?c.slice(0,1e3)+"... [truncated]":c;l.push(` Body: ${f}`)}r>=400?this.error(l.join(`
|
|
2043
2043
|
`)):this.log(l.join(`
|
|
2044
2044
|
`))}},fC=new Set([500,502,503,504]),hC=new Set(["GET","HEAD","PUT","DELETE","OPTIONS"]),pC=class{constructor(e,t){if(this.userToken=null,this.baseUrl=e.baseUrl||"http://localhost:7130",this.fetch=e.fetch||(globalThis.fetch?globalThis.fetch.bind(globalThis):void 0),this.anonKey=e.anonKey,this.defaultHeaders={...e.headers},this.logger=t||new Kv(!1),this.timeout=e.timeout??3e4,this.retryCount=e.retryCount??3,this.retryDelay=e.retryDelay??500,!this.fetch)throw new Error("Fetch is not available. Please provide a fetch implementation in the config.")}buildUrl(e,t){const r=new URL(e,this.baseUrl);return t&&Object.entries(t).forEach(([i,a])=>{if(i==="select"){let l=a.replace(/\s+/g," ").trim();l=l.replace(/\s*\(\s*/g,"(").replace(/\s*\)\s*/g,")").replace(/\(\s+/g,"(").replace(/\s+\)/g,")").replace(/,\s+(?=[^()]*\))/g,","),r.searchParams.append(i,l)}else r.searchParams.append(i,a)}),r.toString()}isRetryableStatus(e){return fC.has(e)}computeRetryDelay(e){const r=this.retryDelay*Math.pow(2,e-1)*(.85+Math.random()*.3);return Math.round(r)}async request(e,t,r={}){const{params:i,headers:a={},body:l,signal:c,...f}=r,p=this.buildUrl(t,i),m=Date.now(),v=hC.has(e.toUpperCase())||r.idempotent===!0?this.retryCount:0,_={...this.defaultHeaders},k=this.userToken||this.anonKey;k&&(_.Authorization=`Bearer ${k}`);let T;l!==void 0&&(typeof FormData<"u"&&l instanceof FormData?T=l:(e!=="GET"&&(_["Content-Type"]="application/json;charset=UTF-8"),T=JSON.stringify(l))),a instanceof Headers?a.forEach((E,z)=>{_[z]=E}):Array.isArray(a)?a.forEach(([E,z])=>{_[E]=z}):Object.assign(_,a),this.logger.logRequest(e,p,_,T);let x;for(let E=0;E<=v;E++){if(E>0){const F=this.computeRetryDelay(E);if(this.logger.warn(`Retry ${E}/${v} for ${e} ${p} in ${F}ms`),c?.aborted)throw c.reason;await new Promise((M,W)=>{const O=()=>{clearTimeout(H),W(c.reason)},H=setTimeout(()=>{c&&c.removeEventListener("abort",O),M()},F);c&&c.addEventListener("abort",O,{once:!0})})}let z,I;if((this.timeout>0||c)&&(z=new AbortController,this.timeout>0&&(I=setTimeout(()=>z.abort(),this.timeout)),c))if(c.aborted)z.abort(c.reason);else{const F=()=>z.abort(c.reason);c.addEventListener("abort",F,{once:!0}),z.signal.addEventListener("abort",()=>{c.removeEventListener("abort",F)},{once:!0})}try{const F=await this.fetch(p,{method:e,headers:_,body:T,...f,...z?{signal:z.signal}:{}});if(this.isRetryableStatus(F.status)&&E<v){I!==void 0&&clearTimeout(I),await F.body?.cancel(),x=new He(`Server error: ${F.status} ${F.statusText}`,F.status,"SERVER_ERROR");continue}if(F.status===204){I!==void 0&&clearTimeout(I);return}let M;const W=F.headers.get("content-type");try{W?.includes("json")?M=await F.json():M=await F.text()}catch(O){throw I!==void 0&&clearTimeout(I),new He(`Failed to parse response body: ${O?.message||"Unknown error"}`,F.status,F.ok?"PARSE_ERROR":"REQUEST_FAILED")}if(I!==void 0&&clearTimeout(I),!F.ok){if(this.logger.logResponse(e,p,F.status,Date.now()-m,M),M&&typeof M=="object"&&"error"in M){!M.statusCode&&!M.status&&(M.statusCode=F.status);const O=He.fromApiError(M);throw Object.keys(M).forEach(H=>{H!=="error"&&H!=="message"&&H!=="statusCode"&&(O[H]=M[H])}),O}throw new He(`Request failed: ${F.statusText}`,F.status,"REQUEST_FAILED")}return this.logger.logResponse(e,p,F.status,Date.now()-m,M),M}catch(F){if(I!==void 0&&clearTimeout(I),F?.name==="AbortError")throw z&&z.signal.aborted&&this.timeout>0&&!c?.aborted?new He(`Request timed out after ${this.timeout}ms`,408,"REQUEST_TIMEOUT"):F;if(F instanceof He)throw F;if(E<v){x=F;continue}throw new He(`Network request failed: ${F?.message||"Unknown error"}`,0,"NETWORK_ERROR")}}throw x||new He("Request failed after all retry attempts",0,"NETWORK_ERROR")}get(e,t){return this.request("GET",e,t)}post(e,t,r){return this.request("POST",e,{...r,body:t})}put(e,t,r){return this.request("PUT",e,{...r,body:t})}patch(e,t,r){return this.request("PATCH",e,{...r,body:t})}delete(e,t){return this.request("DELETE",e,t)}setAuthToken(e){this.userToken=e}getHeaders(){const e={...this.defaultHeaders},t=this.userToken||this.anonKey;return t&&(e.Authorization=`Bearer ${t}`),e}},_f="insforge_csrf_token";function mC(){if(typeof document>"u")return null;const e=document.cookie.split(";").find(t=>t.trim().startsWith(`${_f}=`));return e&&e.split("=")[1]||null}function Ag(e){if(typeof document>"u")return;const t=10080*60,r=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${_f}=${encodeURIComponent(e)}; path=/; max-age=${t}; SameSite=Lax${r}`}function gC(){if(typeof document>"u")return;const e=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${_f}=; path=/; max-age=0; SameSite=Lax${e}`}var yC=class{constructor(){this.accessToken=null,this.user=null,this.onTokenChange=null}saveSession(e){const t=e.accessToken!==this.accessToken;this.accessToken=e.accessToken,this.user=e.user,t&&this.onTokenChange&&this.onTokenChange()}getSession(){return!this.accessToken||!this.user?null:{accessToken:this.accessToken,user:this.user}}getAccessToken(){return this.accessToken}setAccessToken(e){const t=e!==this.accessToken;this.accessToken=e,t&&this.onTokenChange&&this.onTokenChange()}getUser(){return this.user}setUser(e){this.user=e}clearSession(){const e=this.accessToken!==null;this.accessToken=null,this.user=null,e&&this.onTokenChange&&this.onTokenChange()}},wd="insforge_pkce_verifier";function Yv(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function vC(){const e=new Uint8Array(32);return crypto.getRandomValues(e),Yv(e)}async function wC(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return Yv(new Uint8Array(i))}function _C(e){typeof sessionStorage<"u"&&sessionStorage.setItem(wd,e)}function bC(){if(typeof sessionStorage>"u")return null;const e=sessionStorage.getItem(wd);return e&&sessionStorage.removeItem(wd),e}function an(e,t){return e instanceof He?{data:null,error:e}:{data:null,error:new He(e instanceof Error?e.message:t,500,"UNEXPECTED_ERROR")}}function Wc(...e){if(typeof window>"u")return;const t=new URL(window.location.href);e.forEach(r=>t.searchParams.delete(r)),window.history.replaceState({},document.title,t.toString())}var kC=class{constructor(e,t,r={}){this.http=e,this.tokenManager=t,this.options=r,this.authCallbackHandled=this.detectAuthCallback()}isServerMode(){return!!this.options.isServerMode}saveSessionFromResponse(e){if(!e.accessToken||!e.user)return!1;const t={accessToken:e.accessToken,user:e.user};return!this.isServerMode()&&e.csrfToken&&Ag(e.csrfToken),this.isServerMode()||this.tokenManager.saveSession(t),this.http.setAuthToken(e.accessToken),!0}async detectAuthCallback(){if(!(this.isServerMode()||typeof window>"u"))try{const e=new URLSearchParams(window.location.search),t=e.get("error");if(t){Wc("error"),console.debug("OAuth callback error:",t);return}const r=e.get("insforge_code");if(r){Wc("insforge_code");const{error:c}=await this.exchangeOAuthCode(r);c&&console.debug("OAuth code exchange failed:",c.message);return}const i=e.get("access_token"),a=e.get("user_id"),l=e.get("email");if(i&&a&&l){const c=e.get("csrf_token"),f=e.get("name");c&&Ag(c);const p={accessToken:i,user:{id:a,email:l,profile:{name:f||""},metadata:null,emailVerified:!1,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}};this.tokenManager.saveSession(p),this.http.setAuthToken(i),Wc("access_token","user_id","email","name","csrf_token")}}catch(e){console.debug("OAuth callback detection skipped:",e)}}async signUp(e){try{const t=await this.http.post(this.isServerMode()?"/api/auth/users?client_type=mobile":"/api/auth/users",e,{credentials:"include"});return t.accessToken&&t.user&&this.saveSessionFromResponse(t),{data:t,error:null}}catch(t){return an(t,"An unexpected error occurred during sign up")}}async signInWithPassword(e){try{const t=await this.http.post(this.isServerMode()?"/api/auth/sessions?client_type=mobile":"/api/auth/sessions",e,{credentials:"include"});return this.saveSessionFromResponse(t),{data:t,error:null}}catch(t){return an(t,"An unexpected error occurred during sign in")}}async signOut(){try{try{await this.http.post(this.isServerMode()?"/api/auth/logout?client_type=mobile":"/api/auth/logout",void 0,{credentials:"include"})}catch{}return this.tokenManager.clearSession(),this.http.setAuthToken(null),this.isServerMode()||gC(),{error:null}}catch{return{error:new He("Failed to sign out",500,"SIGNOUT_ERROR")}}}async signInWithOAuth(e){try{const{provider:t,redirectTo:r,skipBrowserRedirect:i}=e,a=vC(),l=await wC(a);_C(a);const c={code_challenge:l};r&&(c.redirect_uri=r);const f=await this.http.get(`/api/auth/oauth/${t}`,{params:c});return!this.isServerMode()&&typeof window<"u"&&!i?(window.location.href=f.authUrl,{data:{},error:null}):{data:{url:f.authUrl,provider:t,codeVerifier:a},error:null}}catch(t){return t instanceof He?{data:{},error:t}:{data:{},error:new He("An unexpected error occurred during OAuth initialization",500,"UNEXPECTED_ERROR")}}}async exchangeOAuthCode(e,t){try{const r=t??bC();if(!r)return{data:null,error:new He("PKCE code verifier not found. Ensure signInWithOAuth was called in the same browser session.",400,"PKCE_VERIFIER_MISSING")};const i={code:e,code_verifier:r},a=await this.http.post(this.isServerMode()?"/api/auth/oauth/exchange?client_type=mobile":"/api/auth/oauth/exchange",i,{credentials:"include"});return this.saveSessionFromResponse(a),{data:{accessToken:a.accessToken,refreshToken:a.refreshToken,user:a.user,redirectTo:a.redirectTo},error:null}}catch(r){return an(r,"An unexpected error occurred during OAuth code exchange")}}async signInWithIdToken(e){try{const{provider:t,token:r}=e,i=await this.http.post("/api/auth/id-token?client_type=mobile",{provider:t,token:r},{credentials:"include"});return this.saveSessionFromResponse(i),{data:{accessToken:i.accessToken,refreshToken:i.refreshToken,user:i.user},error:null}}catch(t){return an(t,"An unexpected error occurred during ID token sign in")}}async refreshSession(e){try{if(this.isServerMode()&&!e?.refreshToken)return{data:null,error:new He("refreshToken is required when refreshing session in server mode",400,"REFRESH_TOKEN_REQUIRED")};const t=this.isServerMode()?null:mC(),r=await this.http.post(this.isServerMode()?"/api/auth/refresh?client_type=mobile":"/api/auth/refresh",this.isServerMode()?{refresh_token:e?.refreshToken}:void 0,{headers:t?{"X-CSRF-Token":t}:{},credentials:"include"});return r.accessToken&&this.saveSessionFromResponse(r),{data:r,error:null}}catch(t){return an(t,"An unexpected error occurred during session refresh")}}async getCurrentUser(){await this.authCallbackHandled;try{if(this.isServerMode()){const t=this.tokenManager.getAccessToken();return t?(this.http.setAuthToken(t),{data:{user:(await this.http.get("/api/auth/sessions/current")).user??null},error:null}):{data:{user:null},error:null}}const e=this.tokenManager.getSession();if(e)return this.http.setAuthToken(e.accessToken),{data:{user:e.user},error:null};if(typeof window<"u"){const{data:t,error:r}=await this.refreshSession();if(r)return{data:{user:null},error:r};if(t?.accessToken)return{data:{user:t.user??null},error:null}}return{data:{user:null},error:null}}catch(e){return e instanceof He?{data:{user:null},error:e}:{data:{user:null},error:new He("An unexpected error occurred while getting user",500,"UNEXPECTED_ERROR")}}}async getProfile(e){try{return{data:await this.http.get(`/api/auth/profiles/${e}`),error:null}}catch(t){return an(t,"An unexpected error occurred while fetching user profile")}}async setProfile(e){try{const t=await this.http.patch("/api/auth/profiles/current",{profile:e}),r=this.tokenManager.getUser();return!this.isServerMode()&&r&&t.profile!==void 0&&this.tokenManager.setUser({...r,profile:t.profile}),{data:t,error:null}}catch(t){return an(t,"An unexpected error occurred while updating user profile")}}async resendVerificationEmail(e){try{return{data:await this.http.post("/api/auth/email/send-verification",e),error:null}}catch(t){return an(t,"An unexpected error occurred while sending verification code")}}async sendVerificationEmail(e){return this.resendVerificationEmail(e)}async verifyEmail(e){try{const t=await this.http.post(this.isServerMode()?"/api/auth/email/verify?client_type=mobile":"/api/auth/email/verify",e,{credentials:"include"});return this.saveSessionFromResponse(t),{data:t,error:null}}catch(t){return an(t,"An unexpected error occurred while verifying email")}}async sendResetPasswordEmail(e){try{return{data:await this.http.post("/api/auth/email/send-reset-password",e),error:null}}catch(t){return an(t,"An unexpected error occurred while sending password reset code")}}async exchangeResetPasswordToken(e){try{return{data:await this.http.post("/api/auth/email/exchange-reset-password-token",e),error:null}}catch(t){return an(t,"An unexpected error occurred while verifying reset code")}}async resetPassword(e){try{return{data:await this.http.post("/api/auth/email/reset-password",e),error:null}}catch(t){return an(t,"An unexpected error occurred while resetting password")}}async getPublicAuthConfig(){try{return{data:await this.http.get("/api/auth/public-config"),error:null}}catch(e){return an(e,"An unexpected error occurred while fetching auth configuration")}}};function SC(e,t){return async(r,i)=>{const a=typeof r=="string"?r:r.toString(),l=new URL(a),c=l.pathname.slice(1),f=c.match(/^rpc\/(.+)$/),p=f?`/api/database/rpc/${f[1]}`:`/api/database/records/${c}`,m=`${e.baseUrl}${p}${l.search}`,g=t.getAccessToken(),v=e.getHeaders(),_=g||v.Authorization?.replace("Bearer ",""),k=new Headers(i?.headers);return _&&!k.has("Authorization")&&k.set("Authorization",`Bearer ${_}`),await fetch(m,{...i,headers:k})}}var xC=class{constructor(e,t){this.postgrest=new mT("http://dummy",{fetch:SC(e,t),headers:{}})}from(e){return this.postgrest.from(e)}rpc(e,t,r){return this.postgrest.rpc(e,t,r)}},EC=class{constructor(e,t){this.bucketName=e,this.http=t}async upload(e,t){try{const r=await this.http.post(`/api/storage/buckets/${this.bucketName}/upload-strategy`,{filename:e,contentType:t.type||"application/octet-stream",size:t.size});if(r.method==="presigned")return await this.uploadWithPresignedUrl(r,t);if(r.method==="direct"){const i=new FormData;return i.append("file",t),{data:await this.http.request("PUT",`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(e)}`,{body:i,headers:{}}),error:null}}throw new He(`Unsupported upload method: ${r.method}`,500,"STORAGE_ERROR")}catch(r){return{data:null,error:r instanceof He?r:new He("Upload failed",500,"STORAGE_ERROR")}}}async uploadAuto(e){try{const t=e instanceof File?e.name:"file",r=await this.http.post(`/api/storage/buckets/${this.bucketName}/upload-strategy`,{filename:t,contentType:e.type||"application/octet-stream",size:e.size});if(r.method==="presigned")return await this.uploadWithPresignedUrl(r,e);if(r.method==="direct"){const i=new FormData;return i.append("file",e),{data:await this.http.request("POST",`/api/storage/buckets/${this.bucketName}/objects`,{body:i,headers:{}}),error:null}}throw new He(`Unsupported upload method: ${r.method}`,500,"STORAGE_ERROR")}catch(t){return{data:null,error:t instanceof He?t:new He("Upload failed",500,"STORAGE_ERROR")}}}async uploadWithPresignedUrl(e,t){try{const r=new FormData;e.fields&&Object.entries(e.fields).forEach(([a,l])=>{r.append(a,l)}),r.append("file",t);const i=await fetch(e.uploadUrl,{method:"POST",body:r});if(!i.ok)throw new He(`Upload to storage failed: ${i.statusText}`,i.status,"STORAGE_ERROR");return e.confirmRequired&&e.confirmUrl?{data:await this.http.post(e.confirmUrl,{size:t.size,contentType:t.type||"application/octet-stream"}),error:null}:{data:{key:e.key,bucket:this.bucketName,size:t.size,mimeType:t.type||"application/octet-stream",uploadedAt:new Date().toISOString(),url:this.getPublicUrl(e.key)},error:null}}catch(r){throw r instanceof He?r:new He("Presigned upload failed",500,"STORAGE_ERROR")}}async download(e){try{const t=await this.http.post(`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(e)}/download-strategy`,{expiresIn:3600}),r=t.url,i={};t.method==="direct"&&Object.assign(i,this.http.getHeaders());const a=await fetch(r,{method:"GET",headers:i});if(!a.ok)try{const c=await a.json();throw He.fromApiError(c)}catch{throw new He(`Download failed: ${a.statusText}`,a.status,"STORAGE_ERROR")}return{data:await a.blob(),error:null}}catch(t){return{data:null,error:t instanceof He?t:new He("Download failed",500,"STORAGE_ERROR")}}}getPublicUrl(e){return`${this.http.baseUrl}/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(e)}`}async list(e){try{const t={};return e?.prefix&&(t.prefix=e.prefix),e?.search&&(t.search=e.search),e?.limit&&(t.limit=e.limit.toString()),e?.offset&&(t.offset=e.offset.toString()),{data:await this.http.get(`/api/storage/buckets/${this.bucketName}/objects`,{params:t}),error:null}}catch(t){return{data:null,error:t instanceof He?t:new He("List failed",500,"STORAGE_ERROR")}}}async remove(e){try{return{data:await this.http.delete(`/api/storage/buckets/${this.bucketName}/objects/${encodeURIComponent(e)}`),error:null}}catch(t){return{data:null,error:t instanceof He?t:new He("Delete failed",500,"STORAGE_ERROR")}}}},PC=class{constructor(e){this.http=e}from(e){return new EC(e,this.http)}},TC=class{constructor(e){this.http=e,this.chat=new CC(e),this.images=new AC(e),this.embeddings=new LC(e)}},CC=class{constructor(e){this.completions=new RC(e)}},RC=class{constructor(e){this.http=e}async create(e){const t={model:e.model,messages:e.messages,temperature:e.temperature,maxTokens:e.maxTokens,topP:e.topP,stream:e.stream,webSearch:e.webSearch,fileParser:e.fileParser,thinking:e.thinking,tools:e.tools,toolChoice:e.toolChoice,parallelToolCalls:e.parallelToolCalls};if(e.stream){const a=this.http.getHeaders();a["Content-Type"]="application/json";const l=await this.http.fetch(`${this.http.baseUrl}/api/ai/chat/completion`,{method:"POST",headers:a,body:JSON.stringify(t)});if(!l.ok){const c=await l.json();throw new Error(c.error||"Stream request failed")}return this.parseSSEStream(l,e.model)}const r=await this.http.post("/api/ai/chat/completion",t),i=r.text||"";return{id:`chatcmpl-${Date.now()}`,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:r.metadata?.model,choices:[{index:0,message:{role:"assistant",content:i,...r.tool_calls?.length&&{tool_calls:r.tool_calls},...r.annotations?.length&&{annotations:r.annotations}},finish_reason:r.tool_calls?.length?"tool_calls":"stop"}],usage:r.metadata?.usage||{prompt_tokens:0,completion_tokens:0,total_tokens:0}}}async*parseSSEStream(e,t){const r=e.body.getReader(),i=new TextDecoder;let a="";try{for(;;){const{done:l,value:c}=await r.read();if(l)break;a+=i.decode(c,{stream:!0});const f=a.split(`
|
|
2045
|
-
`);a=f.pop()||"";for(const p of f)if(p.startsWith("data: ")){const m=p.slice(6).trim();if(m)try{const g=JSON.parse(m);if((g.chunk||g.content)&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t,choices:[{index:0,delta:{content:g.chunk||g.content},finish_reason:null}]}),g.tool_calls?.length&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t,choices:[{index:0,delta:{tool_calls:g.tool_calls},finish_reason:"tool_calls"}]}),g.done){r.releaseLock();return}}catch{console.warn("Failed to parse SSE data:",m)}}}}finally{r.releaseLock()}}},LC=class{constructor(e){this.http=e}async create(e){const t=await this.http.post("/api/ai/embeddings",e);return{object:t.object,data:t.data,model:t.metadata?.model,usage:t.metadata?.usage?{prompt_tokens:t.metadata.usage.promptTokens||0,total_tokens:t.metadata.usage.totalTokens||0}:{prompt_tokens:0,total_tokens:0}}}},AC=class{constructor(e){this.http=e}async generate(e){const t=await this.http.post("/api/ai/image/generation",e);let r=[];return t.images&&t.images.length>0?r=t.images.map(i=>({b64_json:i.imageUrl.replace(/^data:image\/\w+;base64,/,""),content:t.text})):t.text&&(r=[{content:t.text}]),{created:Math.floor(Date.now()/1e3),data:r,...t.metadata?.usage&&{usage:{total_tokens:t.metadata.usage.totalTokens||0,input_tokens:t.metadata.usage.promptTokens||0,output_tokens:t.metadata.usage.completionTokens||0}}}}},$C=class Gv{constructor(t,r){this.http=t,this.functionsUrl=r||Gv.deriveSubhostingUrl(t.baseUrl)}static deriveSubhostingUrl(t){try{const{hostname:r}=new URL(t);return r.endsWith(".insforge.app")?`https://${r.split(".")[0]}.functions.insforge.app`:void 0}catch{return}}async invoke(t,r={}){const{method:i="POST",body:a,headers:l={}}=r;if(this.functionsUrl)try{return{data:await this.http.request(i,`${this.functionsUrl}/${t}`,{body:a,headers:l}),error:null}}catch(c){if(c?.statusCode!==404)return{data:null,error:c}}try{const c=`/functions/${t}`;return{data:await this.http.request(i,c,{body:a,headers:l}),error:null}}catch(c){return{data:null,error:c}}}},$g=1e4,NC=class{constructor(e,t,r){this.socket=null,this.connectPromise=null,this.subscribedChannels=new Set,this.eventListeners=new Map,this.baseUrl=e,this.tokenManager=t,this.anonKey=r,this.tokenManager.onTokenChange=()=>this.onTokenChange()}notifyListeners(e,t){const r=this.eventListeners.get(e);if(r)for(const i of r)try{i(t)}catch(a){console.error(`Error in ${e} callback:`,a)}}connect(){return this.socket?.connected?Promise.resolve():this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((e,t)=>{const r=this.tokenManager.getAccessToken()??this.anonKey;this.socket=vl(this.baseUrl,{transports:["websocket"],auth:r?{token:r}:void 0});let i=!0,a=null;const l=()=>{a&&(clearTimeout(a),a=null)};a=setTimeout(()=>{i&&(i=!1,this.connectPromise=null,this.socket?.disconnect(),this.socket=null,t(new Error(`Connection timeout after ${$g}ms`)))},$g),this.socket.on("connect",()=>{l();for(const c of this.subscribedChannels)this.socket.emit("realtime:subscribe",{channel:c});this.notifyListeners("connect"),i&&(i=!1,this.connectPromise=null,e())}),this.socket.on("connect_error",c=>{l(),this.notifyListeners("connect_error",c),i&&(i=!1,this.connectPromise=null,t(c))}),this.socket.on("disconnect",c=>{this.notifyListeners("disconnect",c)}),this.socket.on("realtime:error",c=>{this.notifyListeners("error",c)}),this.socket.onAny((c,f)=>{c!=="realtime:error"&&this.notifyListeners(c,f)})}),this.connectPromise)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null),this.subscribedChannels.clear()}onTokenChange(){const e=this.tokenManager.getAccessToken()??this.anonKey;this.socket&&(this.socket.auth=e?{token:e}:{}),this.socket&&(this.socket.connected||this.connectPromise)&&(this.socket.disconnect(),this.socket.connect())}get isConnected(){return this.socket?.connected??!1}get connectionState(){return this.socket?this.socket.connected?"connected":"connecting":"disconnected"}get socketId(){return this.socket?.id}async subscribe(e){if(this.subscribedChannels.has(e))return{ok:!0,channel:e};if(!this.socket?.connected)try{await this.connect()}catch(t){const r=t instanceof Error?t.message:"Connection failed";return{ok:!1,channel:e,error:{code:"CONNECTION_FAILED",message:r}}}return new Promise(t=>{this.socket.emit("realtime:subscribe",{channel:e},r=>{r.ok&&this.subscribedChannels.add(e),t(r)})})}unsubscribe(e){this.subscribedChannels.delete(e),this.socket?.connected&&this.socket.emit("realtime:unsubscribe",{channel:e})}async publish(e,t,r){if(!this.socket?.connected)throw new Error("Not connected to realtime server. Call connect() first.");this.socket.emit("realtime:publish",{channel:e,event:t,payload:r})}on(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t)}off(e,t){const r=this.eventListeners.get(e);r&&(r.delete(t),r.size===0&&this.eventListeners.delete(e))}once(e,t){const r=i=>{this.off(e,r),t(i)};this.on(e,r)}getSubscribedChannels(){return Array.from(this.subscribedChannels)}},OC=class{constructor(e){this.http=e}async send(e){try{return{data:await this.http.post("/api/email/send-raw",e),error:null}}catch(t){return{data:null,error:t instanceof Error?t:new Error(String(t))}}}},MC=class{constructor(e={}){const t=new Kv(e.debug);this.http=new pC(e,t),this.tokenManager=new yC,e.edgeFunctionToken&&(this.http.setAuthToken(e.edgeFunctionToken),this.tokenManager.setAccessToken(e.edgeFunctionToken)),this.auth=new kC(this.http,this.tokenManager,{isServerMode:e.isServerMode??!1}),this.database=new xC(this.http,this.tokenManager),this.storage=new PC(this.http),this.ai=new TC(this.http),this.functions=new $C(this.http,e.functionsUrl),this.realtime=new NC(this.http.baseUrl,this.tokenManager,e.anonKey),this.emails=new OC(this.http)}getHttpClient(){return this.http}};function Jv(e){return new MC(e)}const IC={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.3.7"},Ng=15e3,DC=1e3,zC=3e4;function UC({env:e}={}){const r=HC(e??(typeof import.meta<"u"?IC:void 0),["VITE_VIBEUSAGE_HTTP_TIMEOUT_MS"]);if(r==null||r==="")return Ng;const i=Number(r);return Number.isFinite(i)?i<=0?0:BC(i,DC,zC):Ng}function FC(e,{env:t}={}){if(e)return async(r,i={})=>{const a=UC({env:t});if(!a)return e(r,i);const l=new AbortController,c=setTimeout(()=>l.abort(),a),f=[],p=i.signal;p&&f.push(p);const m=jC(r);m&&m!==p&&f.push(m);const g=f.map(v=>{const _=()=>l.abort();return v.addEventListener("abort",_,{once:!0}),v.aborted&&l.abort(),()=>v.removeEventListener("abort",_)});try{return await e(r,{...i,signal:l.signal})}catch(v){const _=f.some(k=>k.aborted);if(l.signal.aborted&&!_){const k=new Error(`Client timeout after ${a}ms`);throw k.cause=v,k}throw v}finally{clearTimeout(c);for(const v of g)v()}}}function jC(e){if(!e||typeof e!="object")return null;const t=e.signal;return t&&typeof t=="object"?t:null}function BC(e,t,r){const i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(t,Math.floor(i))):t}function HC(e,t){if(!(!e||!t?.length))for(const r of t){const i=e?.[r];if(i!=null&&i!=="")return i}}const Qv="vibeusage.insforge.session.v1",Og="insforge-auth-token",Xv=1,VC=360*60*1e3;function e0(e){if(!e||typeof e!="object")return null;const t=e.tokenManager;return!t||typeof t!="object"?null:t}function WC(e){if(typeof e!="string"||e.length===0)return null;const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.padEnd(t.length+(4-t.length%4)%4,"=");try{if(typeof globalThis.atob=="function")return globalThis.atob(r)}catch{}try{if(typeof Buffer<"u")return Buffer.from(r,"base64").toString("utf8")}catch{}return null}function ZC(e){if(typeof e!="string"||e.length===0)return null;const t=e.split(".");if(t.length<2)return null;const r=WC(t[1]);if(!r)return null;try{const a=JSON.parse(r)?.exp;return typeof a!="number"||!Number.isFinite(a)||a<=0?null:Math.floor(a*1e3)}catch{return null}}function Mg(e){const t=Date.now(),r=ZC(e)??t+VC;return JSON.stringify({v:Xv,token:e,expiresAt:r})}function Zc(e){if(typeof e!="string"||e.length===0)return{token:null,shouldMigrate:!1};try{const t=JSON.parse(e);if(t&&typeof t=="object"&&t.v===Xv&&typeof t.token=="string"&&t.token.length>0)return{token:t.token,shouldMigrate:!1}}catch{}return{token:e,shouldMigrate:!0}}function Cl(e){return`${Qv}.${e}`}function ri(e,t,r){if(!e)return!1;try{return e.setItem(Cl(t),r),!0}catch{return!1}}function Ig(e,t){if(e)try{e.removeItem(Cl(t))}catch{}}function bf(){if(typeof window>"u")return;const e=`${Qv}.`,t=a=>{if(a)try{const l=[];for(let c=0;c<a.length;c+=1){const f=a.key(c);typeof f=="string"&&f.startsWith(e)&&l.push(f)}for(const c of l)a.removeItem(c)}catch{}};let r=null,i=null;try{r=window.localStorage}catch{r=null}try{i=window.sessionStorage}catch{i=null}t(r),t(i)}function t0(){const e=new Map;function t(){if(typeof window>"u")return null;try{const i=window.localStorage,a="__vibeusage_storage_test__";return i.setItem(a,"1"),i.removeItem(a),i}catch{return null}}function r(){if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}}return{getItem(i){const a=t(),l=r(),c=Cl(i),f=Cl(i),p=i===Og,m=x=>{if(!p)return;const E=Mg(x);ri(a,i,E),ri(l,i,E),e.set(i,E)},g=(x,E)=>{if(!x)return null;try{return x.getItem(E)}catch{return null}},v=g(a,c);if(v!==null){if(e.set(i,v),!p)return v;const x=Zc(v);return x.token?(x.shouldMigrate&&m(x.token),x.token):null}const _=g(l,f);if(_!==null){if(e.set(i,_),!p)return ri(a,i,_),_;const x=Zc(_);return x.token?(x.shouldMigrate?m(x.token):ri(a,i,_),x.token):null}const k=e.get(i);if(k===void 0)return null;if(!p)return k;const T=Zc(k);return T.token?(T.shouldMigrate&&m(T.token),T.token):null},setItem(i,a){const l=i===Og?Mg(a):a;e.set(i,l);const c=t();c&&ri(c,i,l);const f=r();f&&ri(f,i,l)},removeItem(i){e.delete(i);const a=t();Ig(a,i);const l=r();Ig(l,i)}}}function R4({baseUrl:e,accessToken:t}={}){const r=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!e&&!r)throw new Error("Missing baseUrl");const i=e||window?.location?.origin||"",a=Rv(),l=FC(globalThis.fetch);return Jv({baseUrl:i,anonKey:a||void 0,edgeFunctionToken:t||void 0,storage:t0(),fetch:l})}function qC(){const e=hf(),t=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!e&&!t)throw new Error("Missing baseUrl");const r=e||window?.location?.origin||"",i=Rv(),a=Jv({baseUrl:r,anonKey:i||void 0,storage:t0()});return YC(a),KC(a),a}function n0(e,t){if(!t?.accessToken)return;const r=e0(e);!r||typeof r.saveSession!="function"||(typeof r.setStorageMode=="function"&&r.setStorageMode(),r.saveSession(t))}function KC(e){const t=e?.auth;if(!t||typeof t.getCurrentSession!="function")return;const r="__vibeusage_session_bridge_installed_v1__",i=e;if(i[r])return;const a=t.getCurrentSession.bind(t);t.getCurrentSession=async(...l)=>{const c=await a(...l);return n0(e,c?.data?.session??null),c},i[r]=!0}function YC(e){try{const t=e0(e);if(!t||typeof t.setStorageMode!="function")return;t.setStorageMode(),typeof t.getSession=="function"&&n0(e,t.getSession())}catch{}}const Zr=qC();function L4(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function A4(e=new Date){const t=e instanceof Date?e:new Date(e);if(!Number.isFinite(t.getTime()))return 0;const r=t.getTimezoneOffset();return Number.isFinite(r)?-r:0}function r0(e){if(!Number.isFinite(e)||e===0)return"UTC";const t=e>=0?"+":"-",r=Math.abs(e),i=String(Math.floor(r/60)).padStart(2,"0"),a=String(r%60).padStart(2,"0");return`UTC${t}${i}:${a}`}function $4({timeZone:e,offsetMinutes:t}={}){const r=r0(t);return e&&e!=="UTC"?`${e} (${r})`:r}function N4({timeZone:e,offsetMinutes:t}={}){return Number.isFinite(t)?r0(t):e||"UTC"}function O4({timeZone:e,offsetMinutes:t,date:r=new Date}={}){const i=r instanceof Date?r:new Date(r);if(!Number.isFinite(i.getTime()))return"";if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const c=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((g,v)=>(v.type&&v.value&&(g[v.type]=v.value),g),{}),f=c.year,p=c.month,m=c.day;if(f&&p&&m)return`${f}-${p}-${m}`}catch{}if(typeof t=="number"&&Number.isFinite(t)){const a=new Date(i.getTime()+t*6e4);return JC(a)}return QC(i)}function GC({timeZone:e,offsetMinutes:t,date:r=new Date}={}){const i=r instanceof Date?r:new Date(r);if(!Number.isFinite(i.getTime()))return null;if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const c=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((g,v)=>(v.type&&v.value&&(g[v.type]=v.value),g),{}),f=Number(c.year),p=Number(c.month),m=Number(c.day);if(Number.isFinite(f)&&Number.isFinite(p)&&Number.isFinite(m))return{year:f,month:p,day:m}}catch{}if(typeof t=="number"&&Number.isFinite(t)){const a=new Date(i.getTime()+t*6e4);return{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate()}}return{year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()}}function M4({timeZone:e,offsetMinutes:t}={}){return e?`tz:${e}`:typeof t=="number"&&Number.isFinite(t)?`offset:${Math.trunc(t)}`:"utc"}function JC(e){const t=e.getUTCFullYear(),r=String(e.getUTCMonth()+1).padStart(2,"0"),i=String(e.getUTCDate()).padStart(2,"0");return`${t}-${r}-${i}`}function QC(e){const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${i}`}function it(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())).toISOString().slice(0,10)}function Yn(e){const t=e instanceof Date?e:new Date(e);if(!Number.isFinite(t.getTime()))return"";const r=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${r}-${i}-${a}`}function XC(e){if(!e)return null;const t=String(e).trim(),r=t.split("-");if(r.length!==3)return null;const i=Number(r[0]),a=Number(r[1])-1,l=Number(r[2]);if(!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l))return null;const c=new Date(Date.UTC(i,a,l));return Number.isFinite(c.getTime())&&it(c)===t?c:null}function e3(e){if(!e)return"";const t=e.year,r=String(e.month).padStart(2,"0"),i=String(e.day).padStart(2,"0");return!t||!r||!i?"":`${t}-${r}-${i}`}function t3(e,{timeZone:t,offsetMinutes:r,now:i}={}){const a=i instanceof Date&&Number.isFinite(i.getTime())?i:new Date,l=GC({timeZone:t,offsetMinutes:r,date:a});if(!l){const p=Yn(new Date);return{from:p,to:p}}const c=e3(l),f=XC(c);if(!f)return{from:c,to:c};if(e==="day")return{from:c,to:c};if(e==="week"){const p=new Date(f),g=(p.getUTCDay()+6)%7;p.setUTCDate(p.getUTCDate()-g);const v=new Date(p);return v.setUTCDate(v.getUTCDate()+6),{from:it(p),to:it(v)}}if(e==="month"){const p=new Date(Date.UTC(f.getUTCFullYear(),f.getUTCMonth(),1)),m=new Date(Date.UTC(f.getUTCFullYear(),f.getUTCMonth()+1,0));return{from:it(p),to:it(m)}}if(e==="total"){const p=new Date(Date.UTC(f.getUTCFullYear(),f.getUTCMonth()-23,1));return{from:it(p),to:c}}return t3("week")}function I4(e){if(e==null)return"-";try{if(typeof e=="bigint")return new Intl.NumberFormat().format(e);if(typeof e=="number")return new Intl.NumberFormat().format(e);const t=String(e).trim();return/^[0-9]+$/.test(t)?new Intl.NumberFormat().format(BigInt(t)):t}catch{return String(e)}}function D4(e,{thousandSuffix:t="K",millionSuffix:r="M",billionSuffix:i="B",decimals:a=1}={}){const l=Number(String(e));if(!Number.isFinite(l))return"-";const c=l<0?"-":"",f=Math.abs(l),p=Math.max(0,Math.min(6,Math.floor(a)));if(f<1e3)return`${c}${String(f)}`;const m=(k,T)=>{const x=k.toFixed(p),E=Number(x).toString();return`${c}${E}${T}`},g=(k,T,x)=>{const E=k.toFixed(p),z=Number(E);return x&&z>=1e3?m(z/1e3,x):`${c}${z.toString()}${T}`};if(f>=1e9)return m(f/1e9,i);if(f>=1e6)return g(f/1e6,r,i);const v=f/1e3,_=Number(v.toFixed(p));return _>=1e3?m(_/1e3,r):m(_,t)}function o0(e){const t=Number(String(e));return Number.isFinite(t)?t:null}function z4(e,{decimals:t=2}={}){if(e==null)return"-";const r=String(e).trim();if(!r)return"-";const i=r.match(/^(-?\d+)(?:\.(\d+))?$/);if(!i)return r;const a=i[1],l=i[2]||"";let c=a;try{c=new Intl.NumberFormat().format(BigInt(a))}catch{c=a}const f=Math.max(0,Math.min(6,Math.floor(t))),p=f?l.slice(0,f).padEnd(f,"0"):"",m=a.startsWith("-")?"-":"",g=f?`${c.replace("-","")}.${p}`:c.replace("-","");return`${m}$${g}`}function Rl(e){if(typeof e!="string")return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2])-1,a=Number(t[3]),l=new Date(Date.UTC(r,i,a));return Number.isFinite(l.getTime())&&it(l)===e.trim()?l:null}function po(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function n3(e,t){const r=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return Math.floor(r/864e5)}function qc(e,t){if(!Array.isArray(e)||e.length===0)return 0;const r=e.length,i=(r-1)*t,a=Math.floor(i),l=i-a,c=e[a]??e[r-1],f=e[Math.min(r-1,a+1)]??e[r-1];return Math.round(c+(f-c)*l)}function r3(e){return e<=0?0:e>=4?4:e}function i0({weeks:e=52,now:t,weekStartsOn:r="sun"}={}){const i=t instanceof Date&&Number.isFinite(t.getTime())?t:new Date,a=Yn(i),l=Rl(a)||new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),c=r==="mon"?1:0,f=l.getUTCDay(),p=po(l,-((f-c+7)%7)),m=po(p,-7*(Math.max(1,e)-1));return{from:it(m),to:a}}function o3({dailyRows:e,weeks:t=52,to:r,weekStartsOn:i="sun"}={}){const a=Rl(r)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:l}=i0({weeks:t,now:a,weekStartsOn:i}),c=Rl(l)||po(a,-(t*7-1)),f=(()=>{const M=(c.getUTCDay()-(i==="mon"?1:0)+7)%7;return po(c,-M)})(),p=new Map;for(const I of Array.isArray(e)?e:[]){const F=typeof I?.day=="string"?I.day:null;if(!F)continue;const M=o0(I?.billable_total_tokens??I?.total_tokens)??0;p.set(F,Math.max(0,M))}const m=n3(f,a)+1,g=Math.ceil(m/7),v=[];for(let I=0;I<m;I++){const F=po(f,I),M=it(F),W=p.get(M)??0;W>0&&v.push(W)}v.sort((I,F)=>I-F);const _=qc(v,.5),k=qc(v,.75),T=qc(v,.9);function x(I){return!I||I<=0?0:I<=_?1:I<=k?2:I<=T?3:4}const E=[];for(let I=0;I<g;I++){const F=[];for(let M=0;M<7;M++){const W=I*7+M,O=po(f,W);if(O.getTime()>a.getTime()){F.push(null);continue}const H=it(O),R=p.get(H)??0;F.push({day:H,value:R,level:r3(x(R))})}E.push(F)}const z=E.length>t?E.slice(E.length-t):E;return{from:l,to:it(a),weeks:z,thresholds:{t1:_,t2:k,t3:T}}}function i3({dailyRows:e,to:t}={}){const r=Rl(t)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),i=new Map;for(const l of Array.isArray(e)?e:[]){const c=typeof l?.day=="string"?l.day:null;if(!c)continue;const f=o0(l?.billable_total_tokens??l?.total_tokens)??0;i.set(c,Math.max(0,f))}let a=0;for(let l=0;l<370;l++){const c=it(po(r,-l));if((i.get(c)??0)>0){a+=1;continue}break}return a}const Vl={},a0="vibeusage",a3=["victorgpt/vibeusage","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],Dg=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function s0(){if(typeof import.meta<"u"&&Vl){const e="".toLowerCase();if(e==="1"||e==="true")return!0}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock")||"").toLowerCase();if(t==="1"||t==="true")return!0}return!1}function s3(){if(typeof import.meta<"u"&&Vl){const e="".trim();if(e)return e;const t="".trim();if(t)return t}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock_now")||"").trim();if(t)return t;const r=String(e.get("mock_today")||"").trim();if(r)return r}return""}function l3(e){if(!e)return null;const t=String(e).trim();if(!t)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[i,a,l]=t.split("-").map(Number);if(!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l))return null;const c=new Date(i,a-1,l,12,0,0);return Number.isFinite(c.getTime())?c:null}const r=new Date(t);return Number.isFinite(r.getTime())?r:null}function U4(){return s0()?l3(s3()):null}function u3(){if(typeof import.meta<"u"&&Vl){const e="".trim();if(e)return e}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock_seed")||"").trim();if(t)return t}return a0}function c3(){if(typeof import.meta<"u"&&Vl){const e="".trim(),t=Number(e);if(Number.isFinite(t)&&t>0)return Math.floor(t)}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock_missing")||"").trim(),r=Number(t);if(Number.isFinite(r)&&r>0)return Math.floor(r)}return 0}function Ua(e){return(e==null?u3():String(e)).trim()||a0}function Fa(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function Ht(e){if(typeof e!="string")return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2])-1,a=Number(t[3]),l=new Date(Date.UTC(r,i,a));return Number.isFinite(l.getTime())&&it(l)===e.trim()?l:null}function Ra(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function l0(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function d3(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}`}function hi({from:e,to:t,seed:r}){const i=Ht(Yn(new Date))||new Date,a=Ht(e)||i,l=Ht(t)||a,c=[],f=Ua(r),p=Math.floor((Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate())-Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))/864e5)+1;for(let m=0;m<p;m+=1){const g=Ra(a,m),v=it(g),_=Fa(`${f}:${v}`),k=_%1e3/1e3,T=.6+.4*Math.sin(m/6*Math.PI*.5),x=g.getUTCDay()===0||g.getUTCDay()===6?.65:1,E=18e3+Math.round(12e3*k),z=Math.max(0,Math.round(E*T*x)),I=Math.round(z*.46),F=Math.round(z*.34),M=Math.round(z*.14),W=Math.max(0,z-I-F-M);c.push({day:v,total_tokens:z,billable_total_tokens:z,input_tokens:I,output_tokens:F,cached_input_tokens:M,reasoning_output_tokens:W,conversation_count:1+_%5})}return c}function f3({day:e,seed:t}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=Ua(t),l=Array.from({length:48},(f,p)=>{const m=Math.floor(p/2),g=p%2===0?0:30,_=Fa(`${a}:${i}:${m}:${g}`)%1e3/1e3,k=(m+g/60)/24,T=.4+.6*Math.sin(k*Math.PI*2),x=900+Math.round(700*_),E=Math.max(0,Math.round(x*T)),z=Math.round(E*.46),I=Math.round(E*.34),F=Math.round(E*.14),M=Math.max(0,E-z-I-F);return{hour:`${i}T${String(m).padStart(2,"0")}:${String(g).padStart(2,"0")}:00`,total_tokens:E,billable_total_tokens:E,input_tokens:z,output_tokens:I,cached_input_tokens:F,reasoning_output_tokens:M}}),c=Math.max(0,Math.min(48,c3()));if(c>0){const f=Date.now(),p=l.map((v,_)=>{const k=Date.parse(v.hour);return Number.isFinite(k)&&k<=f?{index:_,ts:k}:null}).filter(Boolean),m=Math.max(0,p.length-c),g=p.slice(m);for(const v of g){const _=l[v.index];_&&(l[v.index]={..._,missing:!0})}}return l}function h3({months:e=24,to:t,seed:r}){const i=Ht(t)||Ht(Yn(new Date))||new Date,a=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),l=Ua(r),c=[];for(let f=e-1;f>=0;f-=1){const p=l0(a,-f),m=d3(p),v=Fa(`${l}:${m}`)%1e3/1e3,_=.7+.3*Math.sin(c.length/6*Math.PI*.5),k=36e4+Math.round(2e5*v),T=Math.max(0,Math.round(k*_)),x=Math.round(T*.46),E=Math.round(T*.34),z=Math.round(T*.14),I=Math.max(0,T-x-E-z);c.push({month:m,total_tokens:T,billable_total_tokens:T,input_tokens:x,output_tokens:E,cached_input_tokens:z,reasoning_output_tokens:I})}return c}function kf(e){return e.reduce((t,r)=>(t.total_tokens+=Number(r.total_tokens||0),t.billable_total_tokens+=Number(r.billable_total_tokens||r.total_tokens||0),t.input_tokens+=Number(r.input_tokens||0),t.output_tokens+=Number(r.output_tokens||0),t.cached_input_tokens+=Number(r.cached_input_tokens||0),t.reasoning_output_tokens+=Number(r.reasoning_output_tokens||0),t.conversation_count+=Number(r.conversation_count||0),t),{total_tokens:0,billable_total_tokens:0,input_tokens:0,output_tokens:0,cached_input_tokens:0,reasoning_output_tokens:0,conversation_count:0})}function p3(e,t=1.75){const r=Number(e||0);return!Number.isFinite(r)||r<=0?"0.000000":(r*t/1e6).toFixed(6)}function zg(e,t){const r=Number.isFinite(t)?t:0;return{total_tokens:Math.max(0,Math.round(e.total_tokens*r)),billable_total_tokens:Math.max(0,Math.round((e.billable_total_tokens??e.total_tokens)*r)),input_tokens:Math.max(0,Math.round(e.input_tokens*r)),output_tokens:Math.max(0,Math.round(e.output_tokens*r)),cached_input_tokens:Math.max(0,Math.round(e.cached_input_tokens*r)),reasoning_output_tokens:Math.max(0,Math.round(e.reasoning_output_tokens*r))}}function _d(e){return{...e,total_cost_usd:p3(e.total_tokens)}}function F4({from:e,to:t,seed:r}={}){const i=hi({from:e,to:t,seed:r});return{from:e,to:t,data:i}}function j4({day:e,seed:t}={}){const r=Ht(e)||new Date,i=it(r),a=f3({day:i,seed:t});return{day:i,data:a}}function B4({months:e=24,to:t,seed:r}={}){const i=Ht(t)||Ht(Yn(new Date))||new Date,a=it(i),l=h3({months:e,to:a,seed:r}),c=l0(new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),-(e-1));return{from:it(c),to:a,months:e,data:l}}function H4({from:e,to:t,seed:r,rolling:i=!0}={}){const a=hi({from:e,to:t,seed:r}),l=kf(a),c=_d(l),f=i?m3({to:t,seed:r}):null;return{from:e,to:t,days:a.length,totals:c,...f?{rolling:f}:{}}}function m3({to:e,seed:t}={}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=it(Ra(r,-6)),l=it(Ra(r,-29)),c=hi({from:a,to:i,seed:t}),f=hi({from:l,to:i,seed:t});return{last_7d:Ug({rows:c,from:a,to:i}),last_30d:Ug({rows:f,from:l,to:i})}}function Ug({rows:e,from:t,to:r}={}){const i=kf(e||[]),a=(e||[]).filter(c=>Number(c.billable_total_tokens??c.total_tokens)>0).length,l=a>0?Math.floor(i.billable_total_tokens/a):0;return{from:t,to:r,totals:{billable_total_tokens:i.billable_total_tokens,conversation_count:i.conversation_count},active_days:a,avg_per_active_day:l}}function V4({seed:e,limit:t=3}={}){const r=Ua(e),i=a3.map((a,l)=>{const f=12e4+Fa(`${r}:${a}`)%9e5,p=l%4*4200,m=Math.max(0,f+p),g=Math.max(0,Math.round(m*.96));return{project_key:a,project_ref:`https://github.com/${a}`,total_tokens:String(m),billable_total_tokens:String(g)}}).sort((a,l)=>Number(l.billable_total_tokens)-Number(a.billable_total_tokens)).slice(0,Math.max(1,Math.min(10,Math.floor(Number(t)||3))));return{generated_at:new Date().toISOString(),entries:i}}function g3(e){const t=Ht(Yn(new Date))||new Date,r=String(e).trim().toLowerCase()||"week";if(r==="total")return{from:"1970-01-01",to:"9999-12-31"};if(r==="month"){const c=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1)),f=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,0));return{from:it(c),to:it(f)}}const i=t.getUTCDay(),a=it(Ra(t,-i)),l=it(Ra(t,-i+6));return{from:a,to:l}}function W4({seed:e,period:t,metric:r,limit:i=20,offset:a=0}={}){const l=Ua(e),c=Math.max(1,Math.min(100,Math.floor(Number(i)||20))),f=Math.max(0,Math.min(1e4,Math.floor(Number(a)||0))),p=String(r||"all").trim().toLowerCase()||"all",m=String(t||"week").trim().toLowerCase()||"week",g=m==="month"||m==="total"||m==="week"?m:"week",{from:v,to:_}=g3(g),k=250,T=k>0?Math.ceil(k/c):0,x=Math.floor(f/c)+1,E=Array.from({length:k},(H,R)=>{const fe=R+1,me=`00000000-0000-0000-0000-${String(fe).padStart(12,"0")}`,$e=Dg[fe%Dg.length],je=18e4+Fa(`${l}:${$e}:${fe}`)%9e5,Pe=Math.max(0,je+fe*1200),Se=Math.floor(Pe*.55),ce=Math.floor(Pe*.25),_e=Math.max(0,Pe-Se-ce),Y=fe%7!==0;return{id:fe,user_id:me,is_public:Y,is_me:!1,display_name:Y?$e:"Anonymous",avatar_url:null,gpt_tokens:Se,claude_tokens:ce,other_tokens:_e,total_tokens:Pe}}),z=Math.max(0,Math.min(k-1,Math.floor(k*.8)));E[z]&&(E[z].is_me=!0);const I=p==="gpt"?"gpt_tokens":p==="claude"?"claude_tokens":p==="other"?"other_tokens":"total_tokens",F=E.slice().sort((H,R)=>Number(R[I])-Number(H[I])||H.id-R.id).map((H,R)=>({user_id:H.is_public?H.user_id:null,rank:R+1,is_me:!!H.is_me,display_name:H.display_name,avatar_url:H.avatar_url,gpt_tokens:String(H.gpt_tokens),claude_tokens:String(H.claude_tokens),other_tokens:String(H.other_tokens),total_tokens:String(H.total_tokens),is_public:!!H.is_public})),M=F.find(H=>H?.is_me)||null,W=M?{rank:M.rank,gpt_tokens:M.gpt_tokens,claude_tokens:M.claude_tokens,other_tokens:M.other_tokens,total_tokens:M.total_tokens}:{rank:null,gpt_tokens:"0",claude_tokens:"0",other_tokens:"0",total_tokens:"0"},O=F.slice(f,f+c);return{period:g,metric:p,from:v,to:_,generated_at:new Date().toISOString(),page:x,limit:c,offset:f,total_entries:k,total_pages:T,entries:O,me:W}}function Z4({weeks:e=52,to:t,weekStartsOn:r="sun",seed:i}={}){const a=i0({weeks:e,now:Ht(t)||Ht(Yn(new Date))||new Date,weekStartsOn:r}),l=hi({from:a.from,to:a.to,seed:i});return{...o3({dailyRows:l,weeks:e,to:a.to,weekStartsOn:r}),week_starts_on:r,active_days:l.filter(f=>Number(f.billable_total_tokens??f.total_tokens)>0).length,streak_days:i3({dailyRows:l,to:a.to})}}function q4({from:e,to:t,seed:r}={}){const i=hi({from:e,to:t,seed:r}),a=kf(i),c=[{source:"codex",weight:.7,models:[{model:"gpt-5.2-codex",model_id:"gpt-5.2-codex",weight:.2},{model:"unknown",model_id:"unknown",weight:.8}]},{source:"claude",weight:.2,models:[{model:"claude-3.5",model_id:"claude-3.5",weight:.3},{model:"unknown",model_id:"unknown",weight:.7}]},{source:"every-code",weight:.1,models:[{model:"unknown",model_id:"unknown",weight:1}]}].map(f=>{const p=zg(a,f.weight),m=f.models.map(g=>{const v=zg(p,g.weight);return{model:g.model,model_id:g.model_id||g.model,totals:_d(v)}});return{source:f.source,totals:_d(p),models:m}});return{from:e,to:t,days:i.length,sources:c,pricing:{model:"mock",pricing_mode:"add",source:"mock",effective_from:Yn(new Date),rates_per_million_usd:{input:"1.750000",cached_input:"0.175000",output:"14.000000",reasoning_output:"14.000000"}}}}function u0(){return typeof window>"u"?null:window.localStorage||null}function c0(){return typeof navigator>"u"?null:navigator.clipboard||null}function y3(){return typeof window>"u"?null:window.ClipboardItem||null}function La(e,{storage:t}={}){const r=t??u0();if(!r||typeof r.getItem!="function")return null;try{return r.getItem(e)}catch{return null}}function bd(e,t,{storage:r}={}){const i=r??u0();if(!i||typeof i.setItem!="function")return!1;try{return i.setItem(e,t),!0}catch{return!1}}async function d0(e,{clipboard:t}={}){const r=t??c0();if(!r||typeof r.writeText!="function")return!1;try{return await r.writeText(e),!0}catch{return!1}}async function K4(e,{clipboard:t}={}){const r=t??c0(),i=y3();if(!e||!r||typeof r.write!="function"||!i)return!1;try{const a=e.type||"image/png",l=e.type&&e.type!==a?e.slice(0,e.size,a):e.type?e:e.slice(0,e.size,a),c=new i({[a]:l});return await r.write([c]),!0}catch{return!1}}const Sf="vibeusage.latest_tracker_version",f0="vibeusage.latest_tracker_version_at",v3=360*60*1e3,w3="https://registry.npmjs.org/vibeusage/latest";function xf(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function _3(e){const t=La(Sf);if(!xf(t))return null;const r=La(f0),i=Number(r);return!Number.isFinite(i)||e-i>v3?null:t}function il(){const e=La(Sf);return xf(e)?e:null}function b3(e,t){bd(Sf,e),bd(f0,String(t))}async function k3({allowStale:e=!0}={}){const t=Date.now(),r=_3(t);if(r)return r;if(typeof fetch!="function")return e?il():null;let i=null,a=null;const l=typeof window<"u"&&window.setTimeout?window.setTimeout:setTimeout,c=typeof window<"u"&&window.clearTimeout?window.clearTimeout:clearTimeout;if(typeof AbortController<"u"){const f=new AbortController;a=f,i=l(()=>f.abort(),2500)}try{const f=await fetch(w3,{headers:{accept:"application/json"},signal:a?.signal});if(!f.ok)return e?il():null;const p=await f.json(),m=typeof p?.version=="string"?p.version:"";return xf(m)?(b3(m,t),m):e?il():null}catch{return e?il():null}finally{i&&c(i)}}function Ef(e=""){if(typeof e!="string"||e.length===0)return!1;const t=new URLSearchParams(e),r=String(t.get("screenshot")||"").toLowerCase();return r==="1"||r==="true"}function S3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}const Fg=({text:e="",className:t=""})=>{const[r,i]=b.useState(()=>String(e||"")),a=S3(),l=b.useMemo(()=>typeof window>"u"?!1:Ef(window.location.search),[]),c="0101XYZA@#$%";return b.useEffect(()=>{const f=String(e||"");if(!f||(i(f),a||l||typeof window>"u"))return;let p=0;const m=Math.max(1,Math.ceil(f.length/12)),v=setInterval(()=>{i(()=>{const _=String(f);return _.split("").map((k,T)=>T<p?_[T]:c[Math.floor(Math.random()*c.length)]).join("")}),p>=f.length&&clearInterval(v),p+=m},24);return()=>clearInterval(v)},[a,e]),A.jsx("span",{className:t,children:r})};function x3({as:e="button",children:t,primary:r=!1,size:i="default",className:a="",...l}){const m=`${i==="header"?"matrix-header-chip matrix-header-action text-caption uppercase font-bold tracking-[0.2em] select-none":"inline-flex items-center justify-center px-3 py-2 border text-caption uppercase font-bold transition-colors select-none"} ${i==="header"?"text-matrix-primary":r?"bg-matrix-primary text-black border-matrix-primary hover:bg-white hover:border-white":"bg-matrix-panel text-matrix-primary border-matrix-ghost hover:bg-matrix-panelStrong hover:border-matrix-dim"} disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-matrix-panel ${a}`;if(e==="button")return A.jsx(Ta,{className:m,...l,children:t});const g=l.role;return A.jsx(Ta,{className:m,...l,nativeButton:!1,render:v=>{const{children:_,role:k,...T}=v,x=e==="a"&&g===void 0?void 0:k;return A.jsx(e,{...T,role:x,children:_})},children:t})}function E3({prefersReducedMotion:e,screenshotCapture:t}){return!(t||e)}const P3=({repo:e="victorGPT/vibeusage",isFixed:t=!0,size:r="default",className:i=""})=>{const[a,l]=b.useState(null);b.useEffect(()=>{if(typeof window>"u")return;const p=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,m=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));E3({prefersReducedMotion:p,screenshotCapture:m})&&fetch(`https://api.github.com/repos/${e}`).then(g=>g.json()).then(g=>{g&&typeof g.stargazers_count=="number"&&l(g.stargazers_count)}).catch(()=>{})},[e]);const c=r==="header"?"matrix-header-chip matrix-header-action text-caption uppercase font-bold tracking-[0.2em] select-none group gap-3 no-underline overflow-hidden":"group flex items-center gap-3 px-4 py-2 bg-matrix-panel border border-matrix-ghost backdrop-blur-md transition-all duration-300 hover:border-matrix-primary hover:bg-matrix-panelStrong no-underline overflow-hidden",f=t?"fixed top-6 right-6 z-[100]":"relative";return A.jsxs("a",{href:`https://github.com/${e}`,target:"_blank",rel:"noopener noreferrer",className:`${c} ${f} ${i}`,children:[A.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-1.5 border-t border-l border-matrix-dim group-hover:border-matrix-primary"}),A.jsx("div",{className:"absolute bottom-0 right-0 w-1.5 h-1.5 border-b border-r border-matrix-dim group-hover:border-matrix-primary"}),A.jsx("div",{className:"relative",children:A.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"fill-matrix-primary group-hover:scale-110 group-hover:drop-shadow-[0_0_8px_rgba(0,255,65,0.8)] transition-all duration-500",children:A.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}),A.jsxs("div",{className:"flex items-center gap-2 leading-none",children:[A.jsx("span",{className:"text-matrix-primary",children:"STAR"}),A.jsx("span",{className:"text-matrix-bright tabular-nums tracking-normal",children:a!==null?a:"---"})]}),A.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity",children:A.jsx("div",{className:"absolute top-0 left-0 w-full h-[1px] bg-matrix-dim animate-[scanner_2s_linear_infinite]"})}),A.jsx("style",{children:`
|
|
2045
|
+
`);a=f.pop()||"";for(const p of f)if(p.startsWith("data: ")){const m=p.slice(6).trim();if(m)try{const g=JSON.parse(m);if((g.chunk||g.content)&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t,choices:[{index:0,delta:{content:g.chunk||g.content},finish_reason:null}]}),g.tool_calls?.length&&(yield{id:`chatcmpl-${Date.now()}`,object:"chat.completion.chunk",created:Math.floor(Date.now()/1e3),model:t,choices:[{index:0,delta:{tool_calls:g.tool_calls},finish_reason:"tool_calls"}]}),g.done){r.releaseLock();return}}catch{console.warn("Failed to parse SSE data:",m)}}}}finally{r.releaseLock()}}},LC=class{constructor(e){this.http=e}async create(e){const t=await this.http.post("/api/ai/embeddings",e);return{object:t.object,data:t.data,model:t.metadata?.model,usage:t.metadata?.usage?{prompt_tokens:t.metadata.usage.promptTokens||0,total_tokens:t.metadata.usage.totalTokens||0}:{prompt_tokens:0,total_tokens:0}}}},AC=class{constructor(e){this.http=e}async generate(e){const t=await this.http.post("/api/ai/image/generation",e);let r=[];return t.images&&t.images.length>0?r=t.images.map(i=>({b64_json:i.imageUrl.replace(/^data:image\/\w+;base64,/,""),content:t.text})):t.text&&(r=[{content:t.text}]),{created:Math.floor(Date.now()/1e3),data:r,...t.metadata?.usage&&{usage:{total_tokens:t.metadata.usage.totalTokens||0,input_tokens:t.metadata.usage.promptTokens||0,output_tokens:t.metadata.usage.completionTokens||0}}}}},$C=class Gv{constructor(t,r){this.http=t,this.functionsUrl=r||Gv.deriveSubhostingUrl(t.baseUrl)}static deriveSubhostingUrl(t){try{const{hostname:r}=new URL(t);return r.endsWith(".insforge.app")?`https://${r.split(".")[0]}.functions.insforge.app`:void 0}catch{return}}async invoke(t,r={}){const{method:i="POST",body:a,headers:l={}}=r;if(this.functionsUrl)try{return{data:await this.http.request(i,`${this.functionsUrl}/${t}`,{body:a,headers:l}),error:null}}catch(c){if(c?.statusCode!==404)return{data:null,error:c}}try{const c=`/functions/${t}`;return{data:await this.http.request(i,c,{body:a,headers:l}),error:null}}catch(c){return{data:null,error:c}}}},$g=1e4,NC=class{constructor(e,t,r){this.socket=null,this.connectPromise=null,this.subscribedChannels=new Set,this.eventListeners=new Map,this.baseUrl=e,this.tokenManager=t,this.anonKey=r,this.tokenManager.onTokenChange=()=>this.onTokenChange()}notifyListeners(e,t){const r=this.eventListeners.get(e);if(r)for(const i of r)try{i(t)}catch(a){console.error(`Error in ${e} callback:`,a)}}connect(){return this.socket?.connected?Promise.resolve():this.connectPromise?this.connectPromise:(this.connectPromise=new Promise((e,t)=>{const r=this.tokenManager.getAccessToken()??this.anonKey;this.socket=vl(this.baseUrl,{transports:["websocket"],auth:r?{token:r}:void 0});let i=!0,a=null;const l=()=>{a&&(clearTimeout(a),a=null)};a=setTimeout(()=>{i&&(i=!1,this.connectPromise=null,this.socket?.disconnect(),this.socket=null,t(new Error(`Connection timeout after ${$g}ms`)))},$g),this.socket.on("connect",()=>{l();for(const c of this.subscribedChannels)this.socket.emit("realtime:subscribe",{channel:c});this.notifyListeners("connect"),i&&(i=!1,this.connectPromise=null,e())}),this.socket.on("connect_error",c=>{l(),this.notifyListeners("connect_error",c),i&&(i=!1,this.connectPromise=null,t(c))}),this.socket.on("disconnect",c=>{this.notifyListeners("disconnect",c)}),this.socket.on("realtime:error",c=>{this.notifyListeners("error",c)}),this.socket.onAny((c,f)=>{c!=="realtime:error"&&this.notifyListeners(c,f)})}),this.connectPromise)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null),this.subscribedChannels.clear()}onTokenChange(){const e=this.tokenManager.getAccessToken()??this.anonKey;this.socket&&(this.socket.auth=e?{token:e}:{}),this.socket&&(this.socket.connected||this.connectPromise)&&(this.socket.disconnect(),this.socket.connect())}get isConnected(){return this.socket?.connected??!1}get connectionState(){return this.socket?this.socket.connected?"connected":"connecting":"disconnected"}get socketId(){return this.socket?.id}async subscribe(e){if(this.subscribedChannels.has(e))return{ok:!0,channel:e};if(!this.socket?.connected)try{await this.connect()}catch(t){const r=t instanceof Error?t.message:"Connection failed";return{ok:!1,channel:e,error:{code:"CONNECTION_FAILED",message:r}}}return new Promise(t=>{this.socket.emit("realtime:subscribe",{channel:e},r=>{r.ok&&this.subscribedChannels.add(e),t(r)})})}unsubscribe(e){this.subscribedChannels.delete(e),this.socket?.connected&&this.socket.emit("realtime:unsubscribe",{channel:e})}async publish(e,t,r){if(!this.socket?.connected)throw new Error("Not connected to realtime server. Call connect() first.");this.socket.emit("realtime:publish",{channel:e,event:t,payload:r})}on(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t)}off(e,t){const r=this.eventListeners.get(e);r&&(r.delete(t),r.size===0&&this.eventListeners.delete(e))}once(e,t){const r=i=>{this.off(e,r),t(i)};this.on(e,r)}getSubscribedChannels(){return Array.from(this.subscribedChannels)}},OC=class{constructor(e){this.http=e}async send(e){try{return{data:await this.http.post("/api/email/send-raw",e),error:null}}catch(t){return{data:null,error:t instanceof Error?t:new Error(String(t))}}}},MC=class{constructor(e={}){const t=new Kv(e.debug);this.http=new pC(e,t),this.tokenManager=new yC,e.edgeFunctionToken&&(this.http.setAuthToken(e.edgeFunctionToken),this.tokenManager.setAccessToken(e.edgeFunctionToken)),this.auth=new kC(this.http,this.tokenManager,{isServerMode:e.isServerMode??!1}),this.database=new xC(this.http,this.tokenManager),this.storage=new PC(this.http),this.ai=new TC(this.http),this.functions=new $C(this.http,e.functionsUrl),this.realtime=new NC(this.http.baseUrl,this.tokenManager,e.anonKey),this.emails=new OC(this.http)}getHttpClient(){return this.http}};function Jv(e){return new MC(e)}const IC={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.3.9"},Ng=15e3,DC=1e3,zC=3e4;function UC({env:e}={}){const r=HC(e??(typeof import.meta<"u"?IC:void 0),["VITE_VIBEUSAGE_HTTP_TIMEOUT_MS"]);if(r==null||r==="")return Ng;const i=Number(r);return Number.isFinite(i)?i<=0?0:BC(i,DC,zC):Ng}function FC(e,{env:t}={}){if(e)return async(r,i={})=>{const a=UC({env:t});if(!a)return e(r,i);const l=new AbortController,c=setTimeout(()=>l.abort(),a),f=[],p=i.signal;p&&f.push(p);const m=jC(r);m&&m!==p&&f.push(m);const g=f.map(v=>{const _=()=>l.abort();return v.addEventListener("abort",_,{once:!0}),v.aborted&&l.abort(),()=>v.removeEventListener("abort",_)});try{return await e(r,{...i,signal:l.signal})}catch(v){const _=f.some(k=>k.aborted);if(l.signal.aborted&&!_){const k=new Error(`Client timeout after ${a}ms`);throw k.cause=v,k}throw v}finally{clearTimeout(c);for(const v of g)v()}}}function jC(e){if(!e||typeof e!="object")return null;const t=e.signal;return t&&typeof t=="object"?t:null}function BC(e,t,r){const i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(t,Math.floor(i))):t}function HC(e,t){if(!(!e||!t?.length))for(const r of t){const i=e?.[r];if(i!=null&&i!=="")return i}}const Qv="vibeusage.insforge.session.v1",Og="insforge-auth-token",Xv=1,VC=360*60*1e3;function e0(e){if(!e||typeof e!="object")return null;const t=e.tokenManager;return!t||typeof t!="object"?null:t}function WC(e){if(typeof e!="string"||e.length===0)return null;const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.padEnd(t.length+(4-t.length%4)%4,"=");try{if(typeof globalThis.atob=="function")return globalThis.atob(r)}catch{}try{if(typeof Buffer<"u")return Buffer.from(r,"base64").toString("utf8")}catch{}return null}function ZC(e){if(typeof e!="string"||e.length===0)return null;const t=e.split(".");if(t.length<2)return null;const r=WC(t[1]);if(!r)return null;try{const a=JSON.parse(r)?.exp;return typeof a!="number"||!Number.isFinite(a)||a<=0?null:Math.floor(a*1e3)}catch{return null}}function Mg(e){const t=Date.now(),r=ZC(e)??t+VC;return JSON.stringify({v:Xv,token:e,expiresAt:r})}function Zc(e){if(typeof e!="string"||e.length===0)return{token:null,shouldMigrate:!1};try{const t=JSON.parse(e);if(t&&typeof t=="object"&&t.v===Xv&&typeof t.token=="string"&&t.token.length>0)return{token:t.token,shouldMigrate:!1}}catch{}return{token:e,shouldMigrate:!0}}function Cl(e){return`${Qv}.${e}`}function ri(e,t,r){if(!e)return!1;try{return e.setItem(Cl(t),r),!0}catch{return!1}}function Ig(e,t){if(e)try{e.removeItem(Cl(t))}catch{}}function bf(){if(typeof window>"u")return;const e=`${Qv}.`,t=a=>{if(a)try{const l=[];for(let c=0;c<a.length;c+=1){const f=a.key(c);typeof f=="string"&&f.startsWith(e)&&l.push(f)}for(const c of l)a.removeItem(c)}catch{}};let r=null,i=null;try{r=window.localStorage}catch{r=null}try{i=window.sessionStorage}catch{i=null}t(r),t(i)}function t0(){const e=new Map;function t(){if(typeof window>"u")return null;try{const i=window.localStorage,a="__vibeusage_storage_test__";return i.setItem(a,"1"),i.removeItem(a),i}catch{return null}}function r(){if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}}return{getItem(i){const a=t(),l=r(),c=Cl(i),f=Cl(i),p=i===Og,m=x=>{if(!p)return;const E=Mg(x);ri(a,i,E),ri(l,i,E),e.set(i,E)},g=(x,E)=>{if(!x)return null;try{return x.getItem(E)}catch{return null}},v=g(a,c);if(v!==null){if(e.set(i,v),!p)return v;const x=Zc(v);return x.token?(x.shouldMigrate&&m(x.token),x.token):null}const _=g(l,f);if(_!==null){if(e.set(i,_),!p)return ri(a,i,_),_;const x=Zc(_);return x.token?(x.shouldMigrate?m(x.token):ri(a,i,_),x.token):null}const k=e.get(i);if(k===void 0)return null;if(!p)return k;const T=Zc(k);return T.token?(T.shouldMigrate&&m(T.token),T.token):null},setItem(i,a){const l=i===Og?Mg(a):a;e.set(i,l);const c=t();c&&ri(c,i,l);const f=r();f&&ri(f,i,l)},removeItem(i){e.delete(i);const a=t();Ig(a,i);const l=r();Ig(l,i)}}}function R4({baseUrl:e,accessToken:t}={}){const r=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!e&&!r)throw new Error("Missing baseUrl");const i=e||window?.location?.origin||"",a=Rv(),l=FC(globalThis.fetch);return Jv({baseUrl:i,anonKey:a||void 0,edgeFunctionToken:t||void 0,storage:t0(),fetch:l})}function qC(){const e=hf(),t=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!e&&!t)throw new Error("Missing baseUrl");const r=e||window?.location?.origin||"",i=Rv(),a=Jv({baseUrl:r,anonKey:i||void 0,storage:t0()});return YC(a),KC(a),a}function n0(e,t){if(!t?.accessToken)return;const r=e0(e);!r||typeof r.saveSession!="function"||(typeof r.setStorageMode=="function"&&r.setStorageMode(),r.saveSession(t))}function KC(e){const t=e?.auth;if(!t||typeof t.getCurrentSession!="function")return;const r="__vibeusage_session_bridge_installed_v1__",i=e;if(i[r])return;const a=t.getCurrentSession.bind(t);t.getCurrentSession=async(...l)=>{const c=await a(...l);return n0(e,c?.data?.session??null),c},i[r]=!0}function YC(e){try{const t=e0(e);if(!t||typeof t.setStorageMode!="function")return;t.setStorageMode(),typeof t.getSession=="function"&&n0(e,t.getSession())}catch{}}const Zr=qC();function L4(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function A4(e=new Date){const t=e instanceof Date?e:new Date(e);if(!Number.isFinite(t.getTime()))return 0;const r=t.getTimezoneOffset();return Number.isFinite(r)?-r:0}function r0(e){if(!Number.isFinite(e)||e===0)return"UTC";const t=e>=0?"+":"-",r=Math.abs(e),i=String(Math.floor(r/60)).padStart(2,"0"),a=String(r%60).padStart(2,"0");return`UTC${t}${i}:${a}`}function $4({timeZone:e,offsetMinutes:t}={}){const r=r0(t);return e&&e!=="UTC"?`${e} (${r})`:r}function N4({timeZone:e,offsetMinutes:t}={}){return Number.isFinite(t)?r0(t):e||"UTC"}function O4({timeZone:e,offsetMinutes:t,date:r=new Date}={}){const i=r instanceof Date?r:new Date(r);if(!Number.isFinite(i.getTime()))return"";if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const c=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((g,v)=>(v.type&&v.value&&(g[v.type]=v.value),g),{}),f=c.year,p=c.month,m=c.day;if(f&&p&&m)return`${f}-${p}-${m}`}catch{}if(typeof t=="number"&&Number.isFinite(t)){const a=new Date(i.getTime()+t*6e4);return JC(a)}return QC(i)}function GC({timeZone:e,offsetMinutes:t,date:r=new Date}={}){const i=r instanceof Date?r:new Date(r);if(!Number.isFinite(i.getTime()))return null;if(e&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const c=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i).reduce((g,v)=>(v.type&&v.value&&(g[v.type]=v.value),g),{}),f=Number(c.year),p=Number(c.month),m=Number(c.day);if(Number.isFinite(f)&&Number.isFinite(p)&&Number.isFinite(m))return{year:f,month:p,day:m}}catch{}if(typeof t=="number"&&Number.isFinite(t)){const a=new Date(i.getTime()+t*6e4);return{year:a.getUTCFullYear(),month:a.getUTCMonth()+1,day:a.getUTCDate()}}return{year:i.getFullYear(),month:i.getMonth()+1,day:i.getDate()}}function M4({timeZone:e,offsetMinutes:t}={}){return e?`tz:${e}`:typeof t=="number"&&Number.isFinite(t)?`offset:${Math.trunc(t)}`:"utc"}function JC(e){const t=e.getUTCFullYear(),r=String(e.getUTCMonth()+1).padStart(2,"0"),i=String(e.getUTCDate()).padStart(2,"0");return`${t}-${r}-${i}`}function QC(e){const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${i}`}function it(e){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())).toISOString().slice(0,10)}function Yn(e){const t=e instanceof Date?e:new Date(e);if(!Number.isFinite(t.getTime()))return"";const r=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${r}-${i}-${a}`}function XC(e){if(!e)return null;const t=String(e).trim(),r=t.split("-");if(r.length!==3)return null;const i=Number(r[0]),a=Number(r[1])-1,l=Number(r[2]);if(!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l))return null;const c=new Date(Date.UTC(i,a,l));return Number.isFinite(c.getTime())&&it(c)===t?c:null}function e3(e){if(!e)return"";const t=e.year,r=String(e.month).padStart(2,"0"),i=String(e.day).padStart(2,"0");return!t||!r||!i?"":`${t}-${r}-${i}`}function t3(e,{timeZone:t,offsetMinutes:r,now:i}={}){const a=i instanceof Date&&Number.isFinite(i.getTime())?i:new Date,l=GC({timeZone:t,offsetMinutes:r,date:a});if(!l){const p=Yn(new Date);return{from:p,to:p}}const c=e3(l),f=XC(c);if(!f)return{from:c,to:c};if(e==="day")return{from:c,to:c};if(e==="week"){const p=new Date(f),g=(p.getUTCDay()+6)%7;p.setUTCDate(p.getUTCDate()-g);const v=new Date(p);return v.setUTCDate(v.getUTCDate()+6),{from:it(p),to:it(v)}}if(e==="month"){const p=new Date(Date.UTC(f.getUTCFullYear(),f.getUTCMonth(),1)),m=new Date(Date.UTC(f.getUTCFullYear(),f.getUTCMonth()+1,0));return{from:it(p),to:it(m)}}if(e==="total"){const p=new Date(Date.UTC(f.getUTCFullYear(),f.getUTCMonth()-23,1));return{from:it(p),to:c}}return t3("week")}function I4(e){if(e==null)return"-";try{if(typeof e=="bigint")return new Intl.NumberFormat().format(e);if(typeof e=="number")return new Intl.NumberFormat().format(e);const t=String(e).trim();return/^[0-9]+$/.test(t)?new Intl.NumberFormat().format(BigInt(t)):t}catch{return String(e)}}function D4(e,{thousandSuffix:t="K",millionSuffix:r="M",billionSuffix:i="B",decimals:a=1}={}){const l=Number(String(e));if(!Number.isFinite(l))return"-";const c=l<0?"-":"",f=Math.abs(l),p=Math.max(0,Math.min(6,Math.floor(a)));if(f<1e3)return`${c}${String(f)}`;const m=(k,T)=>{const x=k.toFixed(p),E=Number(x).toString();return`${c}${E}${T}`},g=(k,T,x)=>{const E=k.toFixed(p),z=Number(E);return x&&z>=1e3?m(z/1e3,x):`${c}${z.toString()}${T}`};if(f>=1e9)return m(f/1e9,i);if(f>=1e6)return g(f/1e6,r,i);const v=f/1e3,_=Number(v.toFixed(p));return _>=1e3?m(_/1e3,r):m(_,t)}function o0(e){const t=Number(String(e));return Number.isFinite(t)?t:null}function z4(e,{decimals:t=2}={}){if(e==null)return"-";const r=String(e).trim();if(!r)return"-";const i=r.match(/^(-?\d+)(?:\.(\d+))?$/);if(!i)return r;const a=i[1],l=i[2]||"";let c=a;try{c=new Intl.NumberFormat().format(BigInt(a))}catch{c=a}const f=Math.max(0,Math.min(6,Math.floor(t))),p=f?l.slice(0,f).padEnd(f,"0"):"",m=a.startsWith("-")?"-":"",g=f?`${c.replace("-","")}.${p}`:c.replace("-","");return`${m}$${g}`}function Rl(e){if(typeof e!="string")return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2])-1,a=Number(t[3]),l=new Date(Date.UTC(r,i,a));return Number.isFinite(l.getTime())&&it(l)===e.trim()?l:null}function po(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function n3(e,t){const r=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return Math.floor(r/864e5)}function qc(e,t){if(!Array.isArray(e)||e.length===0)return 0;const r=e.length,i=(r-1)*t,a=Math.floor(i),l=i-a,c=e[a]??e[r-1],f=e[Math.min(r-1,a+1)]??e[r-1];return Math.round(c+(f-c)*l)}function r3(e){return e<=0?0:e>=4?4:e}function i0({weeks:e=52,now:t,weekStartsOn:r="sun"}={}){const i=t instanceof Date&&Number.isFinite(t.getTime())?t:new Date,a=Yn(i),l=Rl(a)||new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),c=r==="mon"?1:0,f=l.getUTCDay(),p=po(l,-((f-c+7)%7)),m=po(p,-7*(Math.max(1,e)-1));return{from:it(m),to:a}}function o3({dailyRows:e,weeks:t=52,to:r,weekStartsOn:i="sun"}={}){const a=Rl(r)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:l}=i0({weeks:t,now:a,weekStartsOn:i}),c=Rl(l)||po(a,-(t*7-1)),f=(()=>{const M=(c.getUTCDay()-(i==="mon"?1:0)+7)%7;return po(c,-M)})(),p=new Map;for(const I of Array.isArray(e)?e:[]){const F=typeof I?.day=="string"?I.day:null;if(!F)continue;const M=o0(I?.billable_total_tokens??I?.total_tokens)??0;p.set(F,Math.max(0,M))}const m=n3(f,a)+1,g=Math.ceil(m/7),v=[];for(let I=0;I<m;I++){const F=po(f,I),M=it(F),W=p.get(M)??0;W>0&&v.push(W)}v.sort((I,F)=>I-F);const _=qc(v,.5),k=qc(v,.75),T=qc(v,.9);function x(I){return!I||I<=0?0:I<=_?1:I<=k?2:I<=T?3:4}const E=[];for(let I=0;I<g;I++){const F=[];for(let M=0;M<7;M++){const W=I*7+M,O=po(f,W);if(O.getTime()>a.getTime()){F.push(null);continue}const H=it(O),R=p.get(H)??0;F.push({day:H,value:R,level:r3(x(R))})}E.push(F)}const z=E.length>t?E.slice(E.length-t):E;return{from:l,to:it(a),weeks:z,thresholds:{t1:_,t2:k,t3:T}}}function i3({dailyRows:e,to:t}={}){const r=Rl(t)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),i=new Map;for(const l of Array.isArray(e)?e:[]){const c=typeof l?.day=="string"?l.day:null;if(!c)continue;const f=o0(l?.billable_total_tokens??l?.total_tokens)??0;i.set(c,Math.max(0,f))}let a=0;for(let l=0;l<370;l++){const c=it(po(r,-l));if((i.get(c)??0)>0){a+=1;continue}break}return a}const Vl={},a0="vibeusage",a3=["victorgpt/vibeusage","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],Dg=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function s0(){if(typeof import.meta<"u"&&Vl){const e="".toLowerCase();if(e==="1"||e==="true")return!0}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock")||"").toLowerCase();if(t==="1"||t==="true")return!0}return!1}function s3(){if(typeof import.meta<"u"&&Vl){const e="".trim();if(e)return e;const t="".trim();if(t)return t}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock_now")||"").trim();if(t)return t;const r=String(e.get("mock_today")||"").trim();if(r)return r}return""}function l3(e){if(!e)return null;const t=String(e).trim();if(!t)return null;if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[i,a,l]=t.split("-").map(Number);if(!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l))return null;const c=new Date(i,a-1,l,12,0,0);return Number.isFinite(c.getTime())?c:null}const r=new Date(t);return Number.isFinite(r.getTime())?r:null}function U4(){return s0()?l3(s3()):null}function u3(){if(typeof import.meta<"u"&&Vl){const e="".trim();if(e)return e}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock_seed")||"").trim();if(t)return t}return a0}function c3(){if(typeof import.meta<"u"&&Vl){const e="".trim(),t=Number(e);if(Number.isFinite(t)&&t>0)return Math.floor(t)}if(typeof window<"u"){const e=new URLSearchParams(window.location.search),t=String(e.get("mock_missing")||"").trim(),r=Number(t);if(Number.isFinite(r)&&r>0)return Math.floor(r)}return 0}function Ua(e){return(e==null?u3():String(e)).trim()||a0}function Fa(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}function Ht(e){if(typeof e!="string")return null;const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2])-1,a=Number(t[3]),l=new Date(Date.UTC(r,i,a));return Number.isFinite(l.getTime())&&it(l)===e.trim()?l:null}function Ra(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function l0(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function d3(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}`}function hi({from:e,to:t,seed:r}){const i=Ht(Yn(new Date))||new Date,a=Ht(e)||i,l=Ht(t)||a,c=[],f=Ua(r),p=Math.floor((Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate())-Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()))/864e5)+1;for(let m=0;m<p;m+=1){const g=Ra(a,m),v=it(g),_=Fa(`${f}:${v}`),k=_%1e3/1e3,T=.6+.4*Math.sin(m/6*Math.PI*.5),x=g.getUTCDay()===0||g.getUTCDay()===6?.65:1,E=18e3+Math.round(12e3*k),z=Math.max(0,Math.round(E*T*x)),I=Math.round(z*.46),F=Math.round(z*.34),M=Math.round(z*.14),W=Math.max(0,z-I-F-M);c.push({day:v,total_tokens:z,billable_total_tokens:z,input_tokens:I,output_tokens:F,cached_input_tokens:M,reasoning_output_tokens:W,conversation_count:1+_%5})}return c}function f3({day:e,seed:t}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=Ua(t),l=Array.from({length:48},(f,p)=>{const m=Math.floor(p/2),g=p%2===0?0:30,_=Fa(`${a}:${i}:${m}:${g}`)%1e3/1e3,k=(m+g/60)/24,T=.4+.6*Math.sin(k*Math.PI*2),x=900+Math.round(700*_),E=Math.max(0,Math.round(x*T)),z=Math.round(E*.46),I=Math.round(E*.34),F=Math.round(E*.14),M=Math.max(0,E-z-I-F);return{hour:`${i}T${String(m).padStart(2,"0")}:${String(g).padStart(2,"0")}:00`,total_tokens:E,billable_total_tokens:E,input_tokens:z,output_tokens:I,cached_input_tokens:F,reasoning_output_tokens:M}}),c=Math.max(0,Math.min(48,c3()));if(c>0){const f=Date.now(),p=l.map((v,_)=>{const k=Date.parse(v.hour);return Number.isFinite(k)&&k<=f?{index:_,ts:k}:null}).filter(Boolean),m=Math.max(0,p.length-c),g=p.slice(m);for(const v of g){const _=l[v.index];_&&(l[v.index]={..._,missing:!0})}}return l}function h3({months:e=24,to:t,seed:r}){const i=Ht(t)||Ht(Yn(new Date))||new Date,a=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),l=Ua(r),c=[];for(let f=e-1;f>=0;f-=1){const p=l0(a,-f),m=d3(p),v=Fa(`${l}:${m}`)%1e3/1e3,_=.7+.3*Math.sin(c.length/6*Math.PI*.5),k=36e4+Math.round(2e5*v),T=Math.max(0,Math.round(k*_)),x=Math.round(T*.46),E=Math.round(T*.34),z=Math.round(T*.14),I=Math.max(0,T-x-E-z);c.push({month:m,total_tokens:T,billable_total_tokens:T,input_tokens:x,output_tokens:E,cached_input_tokens:z,reasoning_output_tokens:I})}return c}function kf(e){return e.reduce((t,r)=>(t.total_tokens+=Number(r.total_tokens||0),t.billable_total_tokens+=Number(r.billable_total_tokens||r.total_tokens||0),t.input_tokens+=Number(r.input_tokens||0),t.output_tokens+=Number(r.output_tokens||0),t.cached_input_tokens+=Number(r.cached_input_tokens||0),t.reasoning_output_tokens+=Number(r.reasoning_output_tokens||0),t.conversation_count+=Number(r.conversation_count||0),t),{total_tokens:0,billable_total_tokens:0,input_tokens:0,output_tokens:0,cached_input_tokens:0,reasoning_output_tokens:0,conversation_count:0})}function p3(e,t=1.75){const r=Number(e||0);return!Number.isFinite(r)||r<=0?"0.000000":(r*t/1e6).toFixed(6)}function zg(e,t){const r=Number.isFinite(t)?t:0;return{total_tokens:Math.max(0,Math.round(e.total_tokens*r)),billable_total_tokens:Math.max(0,Math.round((e.billable_total_tokens??e.total_tokens)*r)),input_tokens:Math.max(0,Math.round(e.input_tokens*r)),output_tokens:Math.max(0,Math.round(e.output_tokens*r)),cached_input_tokens:Math.max(0,Math.round(e.cached_input_tokens*r)),reasoning_output_tokens:Math.max(0,Math.round(e.reasoning_output_tokens*r))}}function _d(e){return{...e,total_cost_usd:p3(e.total_tokens)}}function F4({from:e,to:t,seed:r}={}){const i=hi({from:e,to:t,seed:r});return{from:e,to:t,data:i}}function j4({day:e,seed:t}={}){const r=Ht(e)||new Date,i=it(r),a=f3({day:i,seed:t});return{day:i,data:a}}function B4({months:e=24,to:t,seed:r}={}){const i=Ht(t)||Ht(Yn(new Date))||new Date,a=it(i),l=h3({months:e,to:a,seed:r}),c=l0(new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),-(e-1));return{from:it(c),to:a,months:e,data:l}}function H4({from:e,to:t,seed:r,rolling:i=!0}={}){const a=hi({from:e,to:t,seed:r}),l=kf(a),c=_d(l),f=i?m3({to:t,seed:r}):null;return{from:e,to:t,days:a.length,totals:c,...f?{rolling:f}:{}}}function m3({to:e,seed:t}={}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=it(Ra(r,-6)),l=it(Ra(r,-29)),c=hi({from:a,to:i,seed:t}),f=hi({from:l,to:i,seed:t});return{last_7d:Ug({rows:c,from:a,to:i}),last_30d:Ug({rows:f,from:l,to:i})}}function Ug({rows:e,from:t,to:r}={}){const i=kf(e||[]),a=(e||[]).filter(c=>Number(c.billable_total_tokens??c.total_tokens)>0).length,l=a>0?Math.floor(i.billable_total_tokens/a):0;return{from:t,to:r,totals:{billable_total_tokens:i.billable_total_tokens,conversation_count:i.conversation_count},active_days:a,avg_per_active_day:l}}function V4({seed:e,limit:t=3}={}){const r=Ua(e),i=a3.map((a,l)=>{const f=12e4+Fa(`${r}:${a}`)%9e5,p=l%4*4200,m=Math.max(0,f+p),g=Math.max(0,Math.round(m*.96));return{project_key:a,project_ref:`https://github.com/${a}`,total_tokens:String(m),billable_total_tokens:String(g)}}).sort((a,l)=>Number(l.billable_total_tokens)-Number(a.billable_total_tokens)).slice(0,Math.max(1,Math.min(10,Math.floor(Number(t)||3))));return{generated_at:new Date().toISOString(),entries:i}}function g3(e){const t=Ht(Yn(new Date))||new Date,r=String(e).trim().toLowerCase()||"week";if(r==="total")return{from:"1970-01-01",to:"9999-12-31"};if(r==="month"){const c=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1)),f=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,0));return{from:it(c),to:it(f)}}const i=t.getUTCDay(),a=it(Ra(t,-i)),l=it(Ra(t,-i+6));return{from:a,to:l}}function W4({seed:e,period:t,metric:r,limit:i=20,offset:a=0}={}){const l=Ua(e),c=Math.max(1,Math.min(100,Math.floor(Number(i)||20))),f=Math.max(0,Math.min(1e4,Math.floor(Number(a)||0))),p=String(r||"all").trim().toLowerCase()||"all",m=String(t||"week").trim().toLowerCase()||"week",g=m==="month"||m==="total"||m==="week"?m:"week",{from:v,to:_}=g3(g),k=250,T=k>0?Math.ceil(k/c):0,x=Math.floor(f/c)+1,E=Array.from({length:k},(H,R)=>{const fe=R+1,me=`00000000-0000-0000-0000-${String(fe).padStart(12,"0")}`,$e=Dg[fe%Dg.length],je=18e4+Fa(`${l}:${$e}:${fe}`)%9e5,Pe=Math.max(0,je+fe*1200),Se=Math.floor(Pe*.55),ce=Math.floor(Pe*.25),_e=Math.max(0,Pe-Se-ce),Y=fe%7!==0;return{id:fe,user_id:me,is_public:Y,is_me:!1,display_name:Y?$e:"Anonymous",avatar_url:null,gpt_tokens:Se,claude_tokens:ce,other_tokens:_e,total_tokens:Pe}}),z=Math.max(0,Math.min(k-1,Math.floor(k*.8)));E[z]&&(E[z].is_me=!0);const I=p==="gpt"?"gpt_tokens":p==="claude"?"claude_tokens":p==="other"?"other_tokens":"total_tokens",F=E.slice().sort((H,R)=>Number(R[I])-Number(H[I])||H.id-R.id).map((H,R)=>({user_id:H.is_public?H.user_id:null,rank:R+1,is_me:!!H.is_me,display_name:H.display_name,avatar_url:H.avatar_url,gpt_tokens:String(H.gpt_tokens),claude_tokens:String(H.claude_tokens),other_tokens:String(H.other_tokens),total_tokens:String(H.total_tokens),is_public:!!H.is_public})),M=F.find(H=>H?.is_me)||null,W=M?{rank:M.rank,gpt_tokens:M.gpt_tokens,claude_tokens:M.claude_tokens,other_tokens:M.other_tokens,total_tokens:M.total_tokens}:{rank:null,gpt_tokens:"0",claude_tokens:"0",other_tokens:"0",total_tokens:"0"},O=F.slice(f,f+c);return{period:g,metric:p,from:v,to:_,generated_at:new Date().toISOString(),page:x,limit:c,offset:f,total_entries:k,total_pages:T,entries:O,me:W}}function Z4({weeks:e=52,to:t,weekStartsOn:r="sun",seed:i}={}){const a=i0({weeks:e,now:Ht(t)||Ht(Yn(new Date))||new Date,weekStartsOn:r}),l=hi({from:a.from,to:a.to,seed:i});return{...o3({dailyRows:l,weeks:e,to:a.to,weekStartsOn:r}),week_starts_on:r,active_days:l.filter(f=>Number(f.billable_total_tokens??f.total_tokens)>0).length,streak_days:i3({dailyRows:l,to:a.to})}}function q4({from:e,to:t,seed:r}={}){const i=hi({from:e,to:t,seed:r}),a=kf(i),c=[{source:"codex",weight:.7,models:[{model:"gpt-5.2-codex",model_id:"gpt-5.2-codex",weight:.2},{model:"unknown",model_id:"unknown",weight:.8}]},{source:"claude",weight:.2,models:[{model:"claude-3.5",model_id:"claude-3.5",weight:.3},{model:"unknown",model_id:"unknown",weight:.7}]},{source:"every-code",weight:.1,models:[{model:"unknown",model_id:"unknown",weight:1}]}].map(f=>{const p=zg(a,f.weight),m=f.models.map(g=>{const v=zg(p,g.weight);return{model:g.model,model_id:g.model_id||g.model,totals:_d(v)}});return{source:f.source,totals:_d(p),models:m}});return{from:e,to:t,days:i.length,sources:c,pricing:{model:"mock",pricing_mode:"add",source:"mock",effective_from:Yn(new Date),rates_per_million_usd:{input:"1.750000",cached_input:"0.175000",output:"14.000000",reasoning_output:"14.000000"}}}}function u0(){return typeof window>"u"?null:window.localStorage||null}function c0(){return typeof navigator>"u"?null:navigator.clipboard||null}function y3(){return typeof window>"u"?null:window.ClipboardItem||null}function La(e,{storage:t}={}){const r=t??u0();if(!r||typeof r.getItem!="function")return null;try{return r.getItem(e)}catch{return null}}function bd(e,t,{storage:r}={}){const i=r??u0();if(!i||typeof i.setItem!="function")return!1;try{return i.setItem(e,t),!0}catch{return!1}}async function d0(e,{clipboard:t}={}){const r=t??c0();if(!r||typeof r.writeText!="function")return!1;try{return await r.writeText(e),!0}catch{return!1}}async function K4(e,{clipboard:t}={}){const r=t??c0(),i=y3();if(!e||!r||typeof r.write!="function"||!i)return!1;try{const a=e.type||"image/png",l=e.type&&e.type!==a?e.slice(0,e.size,a):e.type?e:e.slice(0,e.size,a),c=new i({[a]:l});return await r.write([c]),!0}catch{return!1}}const Sf="vibeusage.latest_tracker_version",f0="vibeusage.latest_tracker_version_at",v3=360*60*1e3,w3="https://registry.npmjs.org/vibeusage/latest";function xf(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function _3(e){const t=La(Sf);if(!xf(t))return null;const r=La(f0),i=Number(r);return!Number.isFinite(i)||e-i>v3?null:t}function il(){const e=La(Sf);return xf(e)?e:null}function b3(e,t){bd(Sf,e),bd(f0,String(t))}async function k3({allowStale:e=!0}={}){const t=Date.now(),r=_3(t);if(r)return r;if(typeof fetch!="function")return e?il():null;let i=null,a=null;const l=typeof window<"u"&&window.setTimeout?window.setTimeout:setTimeout,c=typeof window<"u"&&window.clearTimeout?window.clearTimeout:clearTimeout;if(typeof AbortController<"u"){const f=new AbortController;a=f,i=l(()=>f.abort(),2500)}try{const f=await fetch(w3,{headers:{accept:"application/json"},signal:a?.signal});if(!f.ok)return e?il():null;const p=await f.json(),m=typeof p?.version=="string"?p.version:"";return xf(m)?(b3(m,t),m):e?il():null}catch{return e?il():null}finally{i&&c(i)}}function Ef(e=""){if(typeof e!="string"||e.length===0)return!1;const t=new URLSearchParams(e),r=String(t.get("screenshot")||"").toLowerCase();return r==="1"||r==="true"}function S3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}const Fg=({text:e="",className:t=""})=>{const[r,i]=b.useState(()=>String(e||"")),a=S3(),l=b.useMemo(()=>typeof window>"u"?!1:Ef(window.location.search),[]),c="0101XYZA@#$%";return b.useEffect(()=>{const f=String(e||"");if(!f||(i(f),a||l||typeof window>"u"))return;let p=0;const m=Math.max(1,Math.ceil(f.length/12)),v=setInterval(()=>{i(()=>{const _=String(f);return _.split("").map((k,T)=>T<p?_[T]:c[Math.floor(Math.random()*c.length)]).join("")}),p>=f.length&&clearInterval(v),p+=m},24);return()=>clearInterval(v)},[a,e]),A.jsx("span",{className:t,children:r})};function x3({as:e="button",children:t,primary:r=!1,size:i="default",className:a="",...l}){const m=`${i==="header"?"matrix-header-chip matrix-header-action text-caption uppercase font-bold tracking-[0.2em] select-none":"inline-flex items-center justify-center px-3 py-2 border text-caption uppercase font-bold transition-colors select-none"} ${i==="header"?"text-matrix-primary":r?"bg-matrix-primary text-black border-matrix-primary hover:bg-white hover:border-white":"bg-matrix-panel text-matrix-primary border-matrix-ghost hover:bg-matrix-panelStrong hover:border-matrix-dim"} disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-matrix-panel ${a}`;if(e==="button")return A.jsx(Ta,{className:m,...l,children:t});const g=l.role;return A.jsx(Ta,{className:m,...l,nativeButton:!1,render:v=>{const{children:_,role:k,...T}=v,x=e==="a"&&g===void 0?void 0:k;return A.jsx(e,{...T,role:x,children:_})},children:t})}function E3({prefersReducedMotion:e,screenshotCapture:t}){return!(t||e)}const P3=({repo:e="victorGPT/vibeusage",isFixed:t=!0,size:r="default",className:i=""})=>{const[a,l]=b.useState(null);b.useEffect(()=>{if(typeof window>"u")return;const p=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,m=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));E3({prefersReducedMotion:p,screenshotCapture:m})&&fetch(`https://api.github.com/repos/${e}`).then(g=>g.json()).then(g=>{g&&typeof g.stargazers_count=="number"&&l(g.stargazers_count)}).catch(()=>{})},[e]);const c=r==="header"?"matrix-header-chip matrix-header-action text-caption uppercase font-bold tracking-[0.2em] select-none group gap-3 no-underline overflow-hidden":"group flex items-center gap-3 px-4 py-2 bg-matrix-panel border border-matrix-ghost backdrop-blur-md transition-all duration-300 hover:border-matrix-primary hover:bg-matrix-panelStrong no-underline overflow-hidden",f=t?"fixed top-6 right-6 z-[100]":"relative";return A.jsxs("a",{href:`https://github.com/${e}`,target:"_blank",rel:"noopener noreferrer",className:`${c} ${f} ${i}`,children:[A.jsx("div",{className:"absolute top-0 left-0 w-1.5 h-1.5 border-t border-l border-matrix-dim group-hover:border-matrix-primary"}),A.jsx("div",{className:"absolute bottom-0 right-0 w-1.5 h-1.5 border-b border-r border-matrix-dim group-hover:border-matrix-primary"}),A.jsx("div",{className:"relative",children:A.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"fill-matrix-primary group-hover:scale-110 group-hover:drop-shadow-[0_0_8px_rgba(0,255,65,0.8)] transition-all duration-500",children:A.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}),A.jsxs("div",{className:"flex items-center gap-2 leading-none",children:[A.jsx("span",{className:"text-matrix-primary",children:"STAR"}),A.jsx("span",{className:"text-matrix-bright tabular-nums tracking-normal",children:a!==null?a:"---"})]}),A.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity",children:A.jsx("div",{className:"absolute top-0 left-0 w-full h-[1px] bg-matrix-dim animate-[scanner_2s_linear_infinite]"})}),A.jsx("style",{children:`
|
|
2046
2046
|
@keyframes scanner {
|
|
2047
2047
|
0% { transform: translateY(0); }
|
|
2048
2048
|
100% { transform: translateY(44px); }
|
|
2049
2049
|
}
|
|
2050
|
-
`})]})};function T3({className:e="w-5 h-5"}){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 260",className:e,fill:"currentColor","aria-hidden":"true",children:A.jsx("path",{d:"M239.184 106.203a64.72 64.72 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.72 64.72 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.67 64.67 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.77 64.77 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483m-97.56 136.338a48.4 48.4 0 0 1-31.105-11.255l1.535-.87l51.67-29.825a8.6 8.6 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601M37.158 197.93a48.35 48.35 0 0 1-5.781-32.589l1.534.921l51.722 29.826a8.34 8.34 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803M23.549 85.38a48.5 48.5 0 0 1 25.58-21.333v61.39a8.29 8.29 0 0 0 4.195 7.316l62.874 36.272l-21.845 12.636a.82.82 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405zm179.466 41.695l-63.08-36.63L161.73 77.86a.82.82 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.54 8.54 0 0 0-4.4-7.213m21.742-32.69l-1.535-.922l-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.72.72 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391zM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87l-51.67 29.825a8.6 8.6 0 0 0-4.246 7.367zm11.868-25.58L128.067 97.3l28.188 16.218v32.434l-28.086 16.218l-28.188-16.218z"})})}function C3({className:e="w-5 h-5"}){return A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 110",className:e,fill:"currentColor","aria-hidden":"true",children:[A.jsx("path",{fill:"#D97757",d:"m21.564 73.123l21.62-12.132l.361-1.057l-.361-.584h-1.058l-3.617-.223l-12.354-.334l-10.712-.445l-10.379-.556l-2.615-.557L0 54.007l.25-1.613l2.199-1.475l3.144.278l6.956.473l10.434.724l7.568.445l11.214 1.168h1.78l.25-.723l-.611-.445l-.473-.445l-10.796-7.318l-11.687-7.735l-6.12-4.452l-3.312-2.254l-1.67-2.115l-.723-4.619l3.005-3.31l4.035.277l1.03.279l4.09 3.144l8.736 6.761l11.408 8.403l1.67 1.391l.668-.473l.083-.333l-.751-1.253l-6.205-11.213l-6.622-11.408l-2.95-4.73l-.779-2.838c-.278-1.169-.473-2.143-.473-3.34L28.771.613L30.663 0l4.563.612l1.92 1.67l2.838 6.483l4.591 10.211l7.123 13.885l2.087 4.118l1.113 3.812l.417 1.168h.724v-.667l.584-7.819l1.085-9.6l1.058-12.354l.361-3.478l1.725-4.173l3.423-2.254l2.67 1.28l2.2 3.144l-.307 2.031l-1.308 8.487l-2.56 13.3l-1.67 8.904h.975l1.113-1.113l4.507-5.983l7.569-9.46l3.339-3.756l3.895-4.146l2.504-1.976h4.73l3.478 5.176l-1.558 5.342l-4.869 6.177l-4.035 5.231l-5.787 7.79l-3.617 6.234l.334.5l.862-.083l13.078-2.782l7.067-1.28l8.431-1.447l3.812 1.78l.417 1.81l-1.502 3.7l-9.015 2.226l-10.574 2.114l-15.748 3.729l-.195.139l.222.278l7.096.668l3.033.167h7.429l13.829 1.03l3.617 2.392l2.17 2.922l-.362 2.226l-5.565 2.838l-7.512-1.78l-17.53-4.174l-6.01-1.503h-.835v.5l5.009 4.898l9.182 8.292L97.776 88.12l.584 2.644l-1.475 2.087l-1.558-.223l-10.1-7.596l-3.896-3.423l-8.82-7.429h-.584v.78l2.03 2.977l10.741 16.138l.556 4.953l-.779 1.613l-2.782.974l-3.06-.556l-6.29-8.82l-6.482-9.934l-5.231-8.904l-.64.362l-3.089 33.25l-1.447 1.698l-3.339 1.28l-2.782-2.115l-1.475-3.423l1.475-6.76l1.78-8.821l1.448-7.012l1.307-8.71l.78-2.893l-.056-.195l-.64.084l-6.567 9.015l-9.989 13.495l-7.902 8.459l-1.892.75l-3.283-1.697l.306-3.032l1.836-2.7l10.935-13.912l6.595-8.625l4.257-4.98l-.028-.724h-.25L18.92 85.06l-5.175.668l-2.226-2.087l.279-3.423l1.057-1.113l8.737-6.01z"}),A.jsx("path",{d:"M179.413 93.351c-13.968 0-23.512-7.79-28.02-19.783a53.4 53.4 0 0 1-3.422-19.56c0-20.118 9.015-34.086 28.938-34.086c13.383 0 21.647 5.844 26.35 19.784h5.731l-.779-19.227c-8.013-5.175-18.03-7.791-30.217-7.791c-17.168 0-31.776 7.68-39.9 21.536a46.66 46.66 0 0 0-6.178 24.068c0 15.387 7.263 29.022 20.897 36.59a48.7 48.7 0 0 0 24.29 5.732c13.3 0 23.846-2.532 33.195-6.956l2.42-21.203h-5.842c-3.506 9.683-7.68 15.498-14.608 18.587c-3.395 1.53-7.68 2.31-12.855 2.31m60.24-73.429l.557-9.46h-3.952l-17.585 5.287v2.866l7.791 3.617V88.4c0 4.507-2.31 5.509-8.347 6.26v4.842h29.911V94.66c-6.065-.751-8.347-1.753-8.347-6.26V19.95zm118.95 80.692h2.31l20.228-3.84V91.82l-2.838-.222c-4.73-.446-5.955-1.42-5.955-5.287V51.03l.557-11.324h-3.2L350.59 42.46v4.842l1.864.334c5.175.75 6.706 2.198 6.706 5.815v31.442c-4.953 3.84-9.683 6.26-15.304 6.26c-6.233 0-10.1-3.172-10.1-10.573V51.058l.556-11.325h-3.283l-19.143 2.755v4.842l1.975.333c5.176.752 6.706 2.199 6.706 5.816v29.02c0 12.3 6.956 18.142 18.03 18.142c8.459 0 15.387-4.507 20.59-10.768l-.556 10.768zm-55.593-39.15c0-15.72-8.348-21.758-23.429-21.758c-13.3 0-22.955 5.509-22.955 14.635c0 2.727.974 4.814 2.95 6.26l10.128-1.335c-.446-3.06-.668-4.925-.668-5.704c0-5.175 2.754-7.79 8.347-7.79c8.264 0 12.438 5.815 12.438 15.164v3.06l-20.869 6.261c-6.956 1.892-10.907 3.534-13.55 7.374a13.9 13.9 0 0 0-1.948 7.79c0 8.904 6.121 15.193 16.583 15.193c7.569 0 14.275-3.423 20.118-9.906c2.087 6.483 5.286 9.906 10.99 9.906c4.62 0 8.793-1.865 12.521-5.51l-1.113-3.84a17.8 17.8 0 0 1-4.813.668c-3.2 0-4.73-2.532-4.73-7.484zM276.298 91.71c-5.704 0-9.238-3.311-9.238-9.127c0-3.95 1.865-6.26 5.843-7.596l16.918-5.37v16.25c-5.398 4.09-8.57 5.843-13.523 5.843m176.13 5.064V91.82l-2.866-.222c-4.73-.446-5.927-1.42-5.927-5.287v-66.39l.557-9.46h-3.98l-17.585 5.287v2.866l7.791 3.617V43.99a24.57 24.57 0 0 0-14.941-4.285c-17.474 0-31.108 13.3-31.108 33.194c0 16.39 9.794 27.714 25.932 27.714c8.348 0 15.61-4.063 20.117-10.351l-.556 10.35h2.337zM415.81 46.3c8.348 0 14.608 4.842 14.608 13.745v25.043a20.03 20.03 0 0 1-14.496 5.843c-11.965 0-18.03-9.46-18.03-22.093c0-14.19 6.928-22.538 17.918-22.538m79.384 12.521c-1.558-7.346-6.066-11.52-12.326-11.52c-9.35 0-15.833 7.04-15.833 17.14c0 14.943 7.903 24.625 20.674 24.625a23.93 23.93 0 0 0 20.563-12.103L512 77.964c-1.67 12.967-13.411 22.65-27.825 22.65c-16.917 0-28.575-12.521-28.575-30.33c0-17.946 12.66-30.578 29.577-30.578c12.632 0 21.536 7.596 24.402 20.785l-44.074 13.522V68.06l29.689-9.21z"})]})}function R3({className:e="w-5 h-5"}){return A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 188",className:e,fill:"currentColor","aria-hidden":"true",children:[A.jsxs("defs",{children:[A.jsxs("radialGradient",{id:"geminiGrad1",cx:"85.738%",cy:"25.354%",r:"103.154%",children:[A.jsx("stop",{offset:"0%",stopColor:"#5BAEFF"}),A.jsx("stop",{offset:"100%",stopColor:"#9CBFFF"})]}),A.jsxs("radialGradient",{id:"geminiGrad2",cx:"61.879%",cy:"26.683%",r:"80.612%",children:[A.jsx("stop",{offset:"0%",stopColor:"#409DFF"}),A.jsx("stop",{offset:"100%",stopColor:"#64B0FF"})]}),A.jsxs("radialGradient",{id:"geminiGrad3",cx:"53.184%",cy:"19.021%",r:"110.789%",children:[A.jsx("stop",{offset:"0%",stopColor:"#177CFF"}),A.jsx("stop",{offset:"100%",stopColor:"#4DA4FF"})]}),A.jsxs("radialGradient",{id:"geminiGrad4",cx:"-182.665%",cy:"10.869%",r:"521.404%",children:[A.jsx("stop",{offset:"0%",stopColor:"#1C7AFF"}),A.jsx("stop",{offset:"100%",stopColor:"#76A9FF"})]}),A.jsxs("linearGradient",{id:"geminiGrad5",x1:"48.887%",x2:"48.887%",y1:"8.809%",y2:"100%",children:[A.jsx("stop",{offset:"0%",stopColor:"#076EFF"}),A.jsx("stop",{offset:"100%",stopColor:"#3E93FF"})]}),A.jsxs("linearGradient",{id:"geminiGrad6",x1:"13.217%",x2:"78.598%",y1:"0%",y2:"94.201%",children:[A.jsx("stop",{offset:"0%",stopColor:"#076EFF"}),A.jsx("stop",{offset:"100%",stopColor:"#69A3FF"})]})]}),A.jsx("path",{fill:"url(#geminiGrad1)",d:"M125.939 126.64q0 26.094-15.482 41.575q-17.395 18.438-45.748 18.438q-27.135 0-45.923-18.786Q0 149.08 0 121.597q0-27.485 18.786-46.27Q37.573 56.54 64.71 56.54q13.741 0 25.918 4.87t20.004 13.742l-11.48 11.48q-5.74-6.957-14.873-10.871t-19.57-3.914q-20.351 0-34.441 14.09q-13.916 14.264-13.916 35.66t13.916 35.659q14.09 14.09 34.442 14.09q18.613 0 30.963-10.437t14.263-28.702H64.71v-14.96h60.36q.87 4.872.87 9.394"}),A.jsx("path",{fill:"url(#geminiGrad2)",d:"M176.17 96.205q19.152 0 30.485 12.387q11.334 12.388 11.334 34.703l-.176 1.757h-67.648q.352 12.651 8.434 20.382q8.083 7.73 19.328 7.73q15.462 0 24.248-15.461l14.408 7.028q-5.799 10.894-16.077 17.044t-23.282 6.15q-18.976 0-31.276-13.003t-12.299-32.857q0-19.68 11.948-32.77t30.573-13.09m-.351 14.76q-9.137 0-15.726 5.622q-6.59 5.623-8.698 15.11h49.374q-.702-8.96-7.292-14.846t-17.658-5.887"}),A.jsx("path",{fill:"url(#geminiGrad3)",d:"M244.493 184.843h-16.116V99.008h15.416v11.912h.7q3.68-6.306 11.299-10.51q7.62-4.206 15.153-4.205q9.459 0 16.641 4.38q7.182 4.379 10.51 12.086q10.687-16.466 29.605-16.466q14.89 0 22.948 9.11q8.058 9.108 8.058 25.925v53.603h-16.116v-51.15q0-12.088-4.38-17.43q-4.379-5.343-14.714-5.343q-9.285 0-15.59 7.883q-6.307 7.882-6.307 18.568v47.472h-16.116v-51.15q0-12.088-4.38-17.43q-4.379-5.343-14.714-5.343q-9.285 0-15.59 7.883q-6.307 7.882-6.307 18.568z"}),A.jsx("path",{fill:"url(#geminiGrad5)",d:"M393.263 69.216q0 4.737-3.334 8.07q-3.334 3.335-8.071 3.335t-8.071-3.334t-3.334-8.071q0-4.738 3.334-8.071q3.334-3.334 8.07-3.334q4.74 0 8.072 3.334q3.334 3.334 3.334 8.07m-3.334 29.652v85.975h-16.142V98.868z"}),A.jsx("path",{fill:"url(#geminiGrad4)",d:"M512 69.216q0 4.737-3.334 8.07q-3.334 3.335-8.07 3.335q-4.74 0-8.072-3.334q-3.333-3.334-3.334-8.071q0-4.738 3.334-8.071q3.334-3.334 8.071-3.334t8.071 3.334t3.334 8.07m-3.334 29.652v85.975h-16.142V98.868z"}),A.jsx("path",{fill:"url(#geminiGrad6)",d:"M404.004 99.008h15.415v11.912h.7q3.68-6.306 11.3-10.51q7.62-4.206 15.853-4.205q15.765 0 24.261 9.022q8.496 9.02 8.496 25.663v53.953h-16.116v-52.902q-.526-21.021-21.196-21.021q-9.634 0-16.116 7.795t-6.481 18.656v47.472h-16.116z"}),A.jsx("path",{fill:"#076EFF",d:"M348.374 72.76c-2.846-18.788-17.592-33.533-36.38-36.38c18.788-2.847 33.534-17.593 36.38-36.38c2.847 18.787 17.593 33.533 36.38 36.38c-18.787 2.847-33.533 17.592-36.38 36.38"})]})}function L3({className:e="w-5 h-5"}){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,fill:"currentColor","aria-hidden":"true",children:A.jsx("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})})}function A3({className:e="w-5 h-5"}){return A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,fill:"currentColor","aria-hidden":"true",children:[A.jsx("path",{d:"M12 2C9.5 2 7.5 3.5 7 5.5c-.3 1-.2 2 .3 3-.5.3-1 .7-1.3 1.2-.5.8-.7 1.8-.5 2.8.1.5.4 1 .8 1.3-.2.3-.3.6-.3 1 0 .8.4 1.5 1 2-.1.3-.2.6-.2 1 0 1.1.6 2 1.5 2.5-.2.3-.3.7-.3 1.1 0 1.4 1.1 2.5 2.5 2.5h2.5c1.4 0 2.5-1.1 2.5-2.5 0-.4-.1-.8-.3-1.1.9-.5 1.5-1.4 1.5-2.5 0-.4-.1-.7-.2-1 .6-.5 1-1.2 1-2 0-.4-.1-.7-.3-1 .4-.3.7-.8.8-1.3.2-1 0-2-.5-2.8-.3-.5-.8-.9-1.3-1.2.5-1 .6-2 .3-3-.5-2-2.5-3.5-5-3.5z"}),A.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",d:"M8 6c-1.5 0-2.5 1-3 2.5M16 6c1.5 0 2.5 1 3 2.5"}),A.jsx("circle",{cx:"9.5",cy:"9",r:"1",fill:"#000"}),A.jsx("circle",{cx:"14.5",cy:"9",r:"1",fill:"#000"})]})}const $3=[{id:"codex",name:"Codex",Icon:T3},{id:"claude",name:"Claude Code",Icon:C3},{id:"gemini",name:"Gemini",Icon:R3},{id:"opencode",name:"OpenCode",Icon:L3},{id:"openclaw",name:"OpenClaw",Icon:A3}];function N3({className:e=""}){return A.jsx("div",{className:`flex flex-wrap items-center justify-center gap-3 ${e}`,children:$3.map(({id:t,name:r,Icon:i})=>A.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded border border-matrix-ghost/50 bg-matrix-panel/50",title:r,children:[A.jsx(i,{className:"w-4 h-4 text-matrix-primary"}),A.jsx("span",{className:"text-caption text-matrix-bright",children:r})]},t))})}const O3=qr.lazy(()=>za(()=>import("./MatrixRain-jvkSzQkB.js"),[]).then(e=>({default:e.MatrixRain}))),M3=qr.lazy(()=>za(()=>import("./LandingExtras-yaFs24Wt.js"),[]).then(e=>({default:e.LandingExtras})));function al({children:e,className:t="",header:r}){return A.jsxs("section",{className:`relative overflow-hidden border border-[#00FF41]/45 bg-[#04130b]/72 ${t}`,children:[A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(rgba(18,16,16,0)_50%,rgba(0,0,0,0.12)_50%)] bg-[length:100%_4px] opacity-25"}),r?A.jsx("header",{className:"relative border-b border-[#00FF41]/25 px-5 py-3",children:A.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-[#00FF41]/78",children:r})}):null,A.jsx("div",{className:"relative p-5",children:e})]})}function jg({command:e,copied:t,onCopy:r,label:i,helper:a}){return A.jsxs("div",{className:"space-y-3",children:[i&&A.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] text-[#00FF41]/50 font-mono",children:i}),A.jsx("div",{className:"relative",children:A.jsxs("div",{className:"relative flex items-center gap-0 border border-[#00FF41]/40 bg-black/80",children:[A.jsx("div",{className:"shrink-0 px-3 py-3 border-r border-[#00FF41]/25 bg-[#00FF41]/6",children:A.jsx("span",{className:"text-[#00FF41] font-mono text-sm",children:"$"})}),A.jsx("div",{className:"flex-1 min-w-0 px-4 py-3 overflow-x-auto",children:A.jsx("code",{className:"font-mono text-sm text-[#00FF41] whitespace-nowrap block",children:e})}),A.jsx("button",{type:"button",onClick:r,className:"shrink-0 px-4 py-3 border-l border-[#00FF41]/25 text-[#00FF41]/70 hover:text-[#00FF41] hover:bg-[#00FF41]/10 transition-colors duration-200",title:t?"Copied!":"Copy to clipboard",children:t?A.jsx("svg",{viewBox:"0 0 16 16",className:"w-4 h-4",fill:"currentColor",children:A.jsx("path",{d:"M6 10.5L3.5 8l-1 1L6 13l7-7-1-1-6 5.5z"})}):A.jsxs("svg",{viewBox:"0 0 16 16",className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[A.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),A.jsx("path",{d:"M3 11V3h8",strokeLinecap:"round"})]})})]})}),a&&A.jsx("p",{className:"text-[10px] uppercase tracking-[0.15em] text-[#00FF41]/40 font-mono pl-1",children:a})]})}function I3({copy:e,effectsReady:t,signInUrl:r,signUpUrl:i,loginLabel:a,signupLabel:l,handle:c,onHandleChange:f,specialHandle:p,handlePlaceholder:m,rankLabel:g,installCommand:v,installCopied:_,onCopyInstallCommand:k}){const[T,x]=b.useState(!1),E=()=>{navigator.clipboard.writeText(e("landing.ai_agent.guide_url")),x(!0),setTimeout(()=>x(!1),2e3)},z=A.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 w-full max-w-3xl",children:[A.jsx("div",{className:"h-44 border border-[#00FF41]/15 bg-[#00FF41]/5 animate-pulse"}),A.jsx("div",{className:"h-44 border border-[#00FF41]/15 bg-[#00FF41]/5 animate-pulse"})]});return A.jsxs("div",{className:"min-h-screen bg-[#0a0a0a] font-mono text-[#00FF41] flex flex-col items-center justify-center p-4 sm:p-6 relative overflow-hidden selection:bg-[#00FF41] selection:text-black",children:[A.jsx("div",{className:"fixed inset-0 z-0 opacity-20",children:A.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(rgba(0,255,65,0.03)_1px,transparent_1px),linear-gradient(90deg,rgba(0,255,65,0.03)_1px,transparent_1px)] bg-[size:50px_50px]"})}),t?A.jsx(b.Suspense,{fallback:null,children:A.jsx(O3,{})}):null,A.jsxs("div",{className:"fixed top-4 sm:top-6 right-4 sm:right-6 z-[70] flex items-center gap-3",children:[A.jsx(P3,{isFixed:!1,size:"header"}),A.jsx(x3,{as:"a",href:i,size:"header",className:"matrix-header-chip--solid",children:A.jsx("span",{className:"font-mono font-bold text-xs tracking-[0.15em] text-black uppercase",children:e("landing.nav.login_signup")})})]}),A.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 bg-[linear-gradient(rgba(18,16,16,0)_50%,rgba(0,0,0,0.15)_50%)] bg-[length:100%_3px]"}),A.jsxs("main",{className:"w-full max-w-4xl relative z-10 flex flex-col items-center space-y-8 sm:space-y-12 py-8 sm:py-12",children:[A.jsxs("div",{className:"text-center space-y-6",children:[A.jsxs("h1",{className:"text-4xl sm:text-6xl md:text-8xl font-black text-white tracking-tighter leading-none select-none",children:[A.jsx(Fg,{text:e("landing.hero.title_primary")})," ",A.jsx("br",{}),A.jsx("span",{className:"text-[#00FF41]",children:A.jsx(Fg,{text:e("landing.hero.title_secondary")})})]}),A.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[A.jsx(N3,{}),A.jsx("p",{className:"text-xs sm:text-sm text-[#00FF41]/60 uppercase tracking-[0.2em] max-w-lg text-center",children:e("landing.hero.subtagline")})]})]}),t?A.jsx(b.Suspense,{fallback:z,children:A.jsx(M3,{handle:c,onHandleChange:f,specialHandle:p,handlePlaceholder:m,rankLabel:g})}):z,A.jsx(al,{className:"w-full max-w-2xl",header:e("landing.ai_agent.title"),children:A.jsxs("div",{className:"space-y-4",children:[A.jsx("p",{className:"text-sm text-[#00FF41]/70 leading-relaxed",children:e("landing.ai_agent.description")}),A.jsx(jg,{command:e("landing.ai_agent.command"),copied:T,onCopy:E,helper:e("landing.ai_agent.helper")})]})}),A.jsx(al,{className:"w-full max-w-2xl",header:"Quick Install",children:A.jsx(jg,{command:v,copied:_,onCopy:k,label:e("landing.install.prompt"),helper:e("landing.install.helper")})}),A.jsx(al,{className:"w-full max-w-4xl",header:"Dashboard Preview",children:A.jsxs("div",{className:"relative overflow-hidden border border-[#00FF41]/35 bg-black/60",children:[A.jsx("img",{src:"/landing-dashboard.jpg",alt:e("landing.screenshot.alt"),className:"block w-full h-auto",loading:"lazy",decoding:"async"}),A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-tr from-[#00FF41]/10 via-transparent to-transparent"})]})}),A.jsx(al,{className:"w-full max-w-2xl",header:"Feature Brief",children:A.jsxs("div",{className:"space-y-5",children:[A.jsx("h2",{className:"text-xl sm:text-2xl font-bold text-[#00FF41] tracking-tight",children:e("landing.seo.title")}),A.jsx("p",{className:"text-sm text-[#00FF41]/70 leading-relaxed",children:e("landing.seo.summary")}),A.jsx("ul",{className:"space-y-3",children:[e("landing.seo.point1"),e("landing.seo.point2"),e("landing.seo.point3")].map((I,F)=>A.jsxs("li",{className:"flex items-start gap-3 text-sm text-[#00FF41]/80",children:[A.jsxs("span",{className:"shrink-0 text-[#00FF41] font-mono text-xs mt-0.5",children:["[",F+1,"]"]}),A.jsx("span",{children:I})]},F))}),A.jsx("div",{className:"pt-3 border-t border-[#00FF41]/20",children:A.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] text-[#00FF41]/40",children:e("landing.seo.roadmap")})})]})}),A.jsx("div",{className:"w-full max-w-sm",children:A.jsxs("a",{href:i,className:"group relative block w-full text-center overflow-hidden",children:[A.jsx("div",{className:"relative bg-[#00FF41] text-black font-black uppercase tracking-[0.3em] py-4 px-6 hover:bg-white transition-colors duration-200",children:A.jsx("span",{className:"relative z-10",children:e("landing.cta.login_signup")})}),A.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-black/20"})]})}),A.jsxs("div",{className:"flex items-center gap-4 text-[10px] uppercase tracking-[0.2em] text-[#00FF41]/40",children:[A.jsxs("span",{className:"flex items-center gap-2",children:[A.jsx("span",{className:"w-1.5 h-1.5 bg-[#00FF41]/60 rounded-full animate-pulse"}),"v",e("version")||"0.2.21"]}),A.jsx("span",{children:"|"}),A.jsx("span",{children:e("landing.footer.system_ready")})]})]}),A.jsx("style",{children:`
|
|
2050
|
+
`})]})};function T3({className:e="w-5 h-5"}){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 260",className:e,fill:"currentColor","aria-hidden":"true",children:A.jsx("path",{d:"M239.184 106.203a64.72 64.72 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.72 64.72 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.67 64.67 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.77 64.77 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483m-97.56 136.338a48.4 48.4 0 0 1-31.105-11.255l1.535-.87l51.67-29.825a8.6 8.6 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601M37.158 197.93a48.35 48.35 0 0 1-5.781-32.589l1.534.921l51.722 29.826a8.34 8.34 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803M23.549 85.38a48.5 48.5 0 0 1 25.58-21.333v61.39a8.29 8.29 0 0 0 4.195 7.316l62.874 36.272l-21.845 12.636a.82.82 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405zm179.466 41.695l-63.08-36.63L161.73 77.86a.82.82 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.54 8.54 0 0 0-4.4-7.213m21.742-32.69l-1.535-.922l-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.72.72 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391zM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87l-51.67 29.825a8.6 8.6 0 0 0-4.246 7.367zm11.868-25.58L128.067 97.3l28.188 16.218v32.434l-28.086 16.218l-28.188-16.218z"})})}function C3({className:e="w-5 h-5"}){return A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 110",className:e,fill:"currentColor","aria-hidden":"true",children:[A.jsx("path",{fill:"#D97757",d:"m21.564 73.123l21.62-12.132l.361-1.057l-.361-.584h-1.058l-3.617-.223l-12.354-.334l-10.712-.445l-10.379-.556l-2.615-.557L0 54.007l.25-1.613l2.199-1.475l3.144.278l6.956.473l10.434.724l7.568.445l11.214 1.168h1.78l.25-.723l-.611-.445l-.473-.445l-10.796-7.318l-11.687-7.735l-6.12-4.452l-3.312-2.254l-1.67-2.115l-.723-4.619l3.005-3.31l4.035.277l1.03.279l4.09 3.144l8.736 6.761l11.408 8.403l1.67 1.391l.668-.473l.083-.333l-.751-1.253l-6.205-11.213l-6.622-11.408l-2.95-4.73l-.779-2.838c-.278-1.169-.473-2.143-.473-3.34L28.771.613L30.663 0l4.563.612l1.92 1.67l2.838 6.483l4.591 10.211l7.123 13.885l2.087 4.118l1.113 3.812l.417 1.168h.724v-.667l.584-7.819l1.085-9.6l1.058-12.354l.361-3.478l1.725-4.173l3.423-2.254l2.67 1.28l2.2 3.144l-.307 2.031l-1.308 8.487l-2.56 13.3l-1.67 8.904h.975l1.113-1.113l4.507-5.983l7.569-9.46l3.339-3.756l3.895-4.146l2.504-1.976h4.73l3.478 5.176l-1.558 5.342l-4.869 6.177l-4.035 5.231l-5.787 7.79l-3.617 6.234l.334.5l.862-.083l13.078-2.782l7.067-1.28l8.431-1.447l3.812 1.78l.417 1.81l-1.502 3.7l-9.015 2.226l-10.574 2.114l-15.748 3.729l-.195.139l.222.278l7.096.668l3.033.167h7.429l13.829 1.03l3.617 2.392l2.17 2.922l-.362 2.226l-5.565 2.838l-7.512-1.78l-17.53-4.174l-6.01-1.503h-.835v.5l5.009 4.898l9.182 8.292L97.776 88.12l.584 2.644l-1.475 2.087l-1.558-.223l-10.1-7.596l-3.896-3.423l-8.82-7.429h-.584v.78l2.03 2.977l10.741 16.138l.556 4.953l-.779 1.613l-2.782.974l-3.06-.556l-6.29-8.82l-6.482-9.934l-5.231-8.904l-.64.362l-3.089 33.25l-1.447 1.698l-3.339 1.28l-2.782-2.115l-1.475-3.423l1.475-6.76l1.78-8.821l1.448-7.012l1.307-8.71l.78-2.893l-.056-.195l-.64.084l-6.567 9.015l-9.989 13.495l-7.902 8.459l-1.892.75l-3.283-1.697l.306-3.032l1.836-2.7l10.935-13.912l6.595-8.625l4.257-4.98l-.028-.724h-.25L18.92 85.06l-5.175.668l-2.226-2.087l.279-3.423l1.057-1.113l8.737-6.01z"}),A.jsx("path",{d:"M179.413 93.351c-13.968 0-23.512-7.79-28.02-19.783a53.4 53.4 0 0 1-3.422-19.56c0-20.118 9.015-34.086 28.938-34.086c13.383 0 21.647 5.844 26.35 19.784h5.731l-.779-19.227c-8.013-5.175-18.03-7.791-30.217-7.791c-17.168 0-31.776 7.68-39.9 21.536a46.66 46.66 0 0 0-6.178 24.068c0 15.387 7.263 29.022 20.897 36.59a48.7 48.7 0 0 0 24.29 5.732c13.3 0 23.846-2.532 33.195-6.956l2.42-21.203h-5.842c-3.506 9.683-7.68 15.498-14.608 18.587c-3.395 1.53-7.68 2.31-12.855 2.31m60.24-73.429l.557-9.46h-3.952l-17.585 5.287v2.866l7.791 3.617V88.4c0 4.507-2.31 5.509-8.347 6.26v4.842h29.911V94.66c-6.065-.751-8.347-1.753-8.347-6.26V19.95zm118.95 80.692h2.31l20.228-3.84V91.82l-2.838-.222c-4.73-.446-5.955-1.42-5.955-5.287V51.03l.557-11.324h-3.2L350.59 42.46v4.842l1.864.334c5.175.75 6.706 2.198 6.706 5.815v31.442c-4.953 3.84-9.683 6.26-15.304 6.26c-6.233 0-10.1-3.172-10.1-10.573V51.058l.556-11.325h-3.283l-19.143 2.755v4.842l1.975.333c5.176.752 6.706 2.199 6.706 5.816v29.02c0 12.3 6.956 18.142 18.03 18.142c8.459 0 15.387-4.507 20.59-10.768l-.556 10.768zm-55.593-39.15c0-15.72-8.348-21.758-23.429-21.758c-13.3 0-22.955 5.509-22.955 14.635c0 2.727.974 4.814 2.95 6.26l10.128-1.335c-.446-3.06-.668-4.925-.668-5.704c0-5.175 2.754-7.79 8.347-7.79c8.264 0 12.438 5.815 12.438 15.164v3.06l-20.869 6.261c-6.956 1.892-10.907 3.534-13.55 7.374a13.9 13.9 0 0 0-1.948 7.79c0 8.904 6.121 15.193 16.583 15.193c7.569 0 14.275-3.423 20.118-9.906c2.087 6.483 5.286 9.906 10.99 9.906c4.62 0 8.793-1.865 12.521-5.51l-1.113-3.84a17.8 17.8 0 0 1-4.813.668c-3.2 0-4.73-2.532-4.73-7.484zM276.298 91.71c-5.704 0-9.238-3.311-9.238-9.127c0-3.95 1.865-6.26 5.843-7.596l16.918-5.37v16.25c-5.398 4.09-8.57 5.843-13.523 5.843m176.13 5.064V91.82l-2.866-.222c-4.73-.446-5.927-1.42-5.927-5.287v-66.39l.557-9.46h-3.98l-17.585 5.287v2.866l7.791 3.617V43.99a24.57 24.57 0 0 0-14.941-4.285c-17.474 0-31.108 13.3-31.108 33.194c0 16.39 9.794 27.714 25.932 27.714c8.348 0 15.61-4.063 20.117-10.351l-.556 10.35h2.337zM415.81 46.3c8.348 0 14.608 4.842 14.608 13.745v25.043a20.03 20.03 0 0 1-14.496 5.843c-11.965 0-18.03-9.46-18.03-22.093c0-14.19 6.928-22.538 17.918-22.538m79.384 12.521c-1.558-7.346-6.066-11.52-12.326-11.52c-9.35 0-15.833 7.04-15.833 17.14c0 14.943 7.903 24.625 20.674 24.625a23.93 23.93 0 0 0 20.563-12.103L512 77.964c-1.67 12.967-13.411 22.65-27.825 22.65c-16.917 0-28.575-12.521-28.575-30.33c0-17.946 12.66-30.578 29.577-30.578c12.632 0 21.536 7.596 24.402 20.785l-44.074 13.522V68.06l29.689-9.21z"})]})}function R3({className:e="w-5 h-5"}){return A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 188",className:e,fill:"currentColor","aria-hidden":"true",children:[A.jsxs("defs",{children:[A.jsxs("radialGradient",{id:"geminiGrad1",cx:"85.738%",cy:"25.354%",r:"103.154%",children:[A.jsx("stop",{offset:"0%",stopColor:"#5BAEFF"}),A.jsx("stop",{offset:"100%",stopColor:"#9CBFFF"})]}),A.jsxs("radialGradient",{id:"geminiGrad2",cx:"61.879%",cy:"26.683%",r:"80.612%",children:[A.jsx("stop",{offset:"0%",stopColor:"#409DFF"}),A.jsx("stop",{offset:"100%",stopColor:"#64B0FF"})]}),A.jsxs("radialGradient",{id:"geminiGrad3",cx:"53.184%",cy:"19.021%",r:"110.789%",children:[A.jsx("stop",{offset:"0%",stopColor:"#177CFF"}),A.jsx("stop",{offset:"100%",stopColor:"#4DA4FF"})]}),A.jsxs("radialGradient",{id:"geminiGrad4",cx:"-182.665%",cy:"10.869%",r:"521.404%",children:[A.jsx("stop",{offset:"0%",stopColor:"#1C7AFF"}),A.jsx("stop",{offset:"100%",stopColor:"#76A9FF"})]}),A.jsxs("linearGradient",{id:"geminiGrad5",x1:"48.887%",x2:"48.887%",y1:"8.809%",y2:"100%",children:[A.jsx("stop",{offset:"0%",stopColor:"#076EFF"}),A.jsx("stop",{offset:"100%",stopColor:"#3E93FF"})]}),A.jsxs("linearGradient",{id:"geminiGrad6",x1:"13.217%",x2:"78.598%",y1:"0%",y2:"94.201%",children:[A.jsx("stop",{offset:"0%",stopColor:"#076EFF"}),A.jsx("stop",{offset:"100%",stopColor:"#69A3FF"})]})]}),A.jsx("path",{fill:"url(#geminiGrad1)",d:"M125.939 126.64q0 26.094-15.482 41.575q-17.395 18.438-45.748 18.438q-27.135 0-45.923-18.786Q0 149.08 0 121.597q0-27.485 18.786-46.27Q37.573 56.54 64.71 56.54q13.741 0 25.918 4.87t20.004 13.742l-11.48 11.48q-5.74-6.957-14.873-10.871t-19.57-3.914q-20.351 0-34.441 14.09q-13.916 14.264-13.916 35.66t13.916 35.659q14.09 14.09 34.442 14.09q18.613 0 30.963-10.437t14.263-28.702H64.71v-14.96h60.36q.87 4.872.87 9.394"}),A.jsx("path",{fill:"url(#geminiGrad2)",d:"M176.17 96.205q19.152 0 30.485 12.387q11.334 12.388 11.334 34.703l-.176 1.757h-67.648q.352 12.651 8.434 20.382q8.083 7.73 19.328 7.73q15.462 0 24.248-15.461l14.408 7.028q-5.799 10.894-16.077 17.044t-23.282 6.15q-18.976 0-31.276-13.003t-12.299-32.857q0-19.68 11.948-32.77t30.573-13.09m-.351 14.76q-9.137 0-15.726 5.622q-6.59 5.623-8.698 15.11h49.374q-.702-8.96-7.292-14.846t-17.658-5.887"}),A.jsx("path",{fill:"url(#geminiGrad3)",d:"M244.493 184.843h-16.116V99.008h15.416v11.912h.7q3.68-6.306 11.299-10.51q7.62-4.206 15.153-4.205q9.459 0 16.641 4.38q7.182 4.379 10.51 12.086q10.687-16.466 29.605-16.466q14.89 0 22.948 9.11q8.058 9.108 8.058 25.925v53.603h-16.116v-51.15q0-12.088-4.38-17.43q-4.379-5.343-14.714-5.343q-9.285 0-15.59 7.883q-6.307 7.882-6.307 18.568v47.472h-16.116v-51.15q0-12.088-4.38-17.43q-4.379-5.343-14.714-5.343q-9.285 0-15.59 7.883q-6.307 7.882-6.307 18.568z"}),A.jsx("path",{fill:"url(#geminiGrad5)",d:"M393.263 69.216q0 4.737-3.334 8.07q-3.334 3.335-8.071 3.335t-8.071-3.334t-3.334-8.071q0-4.738 3.334-8.071q3.334-3.334 8.07-3.334q4.74 0 8.072 3.334q3.334 3.334 3.334 8.07m-3.334 29.652v85.975h-16.142V98.868z"}),A.jsx("path",{fill:"url(#geminiGrad4)",d:"M512 69.216q0 4.737-3.334 8.07q-3.334 3.335-8.07 3.335q-4.74 0-8.072-3.334q-3.333-3.334-3.334-8.071q0-4.738 3.334-8.071q3.334-3.334 8.071-3.334t8.071 3.334t3.334 8.07m-3.334 29.652v85.975h-16.142V98.868z"}),A.jsx("path",{fill:"url(#geminiGrad6)",d:"M404.004 99.008h15.415v11.912h.7q3.68-6.306 11.3-10.51q7.62-4.206 15.853-4.205q15.765 0 24.261 9.022q8.496 9.02 8.496 25.663v53.953h-16.116v-52.902q-.526-21.021-21.196-21.021q-9.634 0-16.116 7.795t-6.481 18.656v47.472h-16.116z"}),A.jsx("path",{fill:"#076EFF",d:"M348.374 72.76c-2.846-18.788-17.592-33.533-36.38-36.38c18.788-2.847 33.534-17.593 36.38-36.38c2.847 18.787 17.593 33.533 36.38 36.38c-18.787 2.847-33.533 17.592-36.38 36.38"})]})}function L3({className:e="w-5 h-5"}){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,fill:"currentColor","aria-hidden":"true",children:A.jsx("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})})}function A3({className:e="w-5 h-5"}){return A.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:e,fill:"currentColor","aria-hidden":"true",children:[A.jsx("path",{d:"M12 2C9.5 2 7.5 3.5 7 5.5c-.3 1-.2 2 .3 3-.5.3-1 .7-1.3 1.2-.5.8-.7 1.8-.5 2.8.1.5.4 1 .8 1.3-.2.3-.3.6-.3 1 0 .8.4 1.5 1 2-.1.3-.2.6-.2 1 0 1.1.6 2 1.5 2.5-.2.3-.3.7-.3 1.1 0 1.4 1.1 2.5 2.5 2.5h2.5c1.4 0 2.5-1.1 2.5-2.5 0-.4-.1-.8-.3-1.1.9-.5 1.5-1.4 1.5-2.5 0-.4-.1-.7-.2-1 .6-.5 1-1.2 1-2 0-.4-.1-.7-.3-1 .4-.3.7-.8.8-1.3.2-1 0-2-.5-2.8-.3-.5-.8-.9-1.3-1.2.5-1 .6-2 .3-3-.5-2-2.5-3.5-5-3.5z"}),A.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",d:"M8 6c-1.5 0-2.5 1-3 2.5M16 6c1.5 0 2.5 1 3 2.5"}),A.jsx("circle",{cx:"9.5",cy:"9",r:"1",fill:"#000"}),A.jsx("circle",{cx:"14.5",cy:"9",r:"1",fill:"#000"})]})}const $3=[{id:"codex",name:"Codex",Icon:T3},{id:"claude",name:"Claude Code",Icon:C3},{id:"gemini",name:"Gemini",Icon:R3},{id:"opencode",name:"OpenCode",Icon:L3},{id:"openclaw",name:"OpenClaw",Icon:A3}];function N3({className:e=""}){return A.jsx("div",{className:`flex flex-wrap items-center justify-center gap-3 ${e}`,children:$3.map(({id:t,name:r,Icon:i})=>A.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded border border-matrix-ghost/50 bg-matrix-panel/50",title:r,children:[A.jsx(i,{className:"w-4 h-4 text-matrix-primary"}),A.jsx("span",{className:"text-caption text-matrix-bright",children:r})]},t))})}const O3=qr.lazy(()=>za(()=>import("./MatrixRain-Bfjc_8I0.js"),[]).then(e=>({default:e.MatrixRain}))),M3=qr.lazy(()=>za(()=>import("./LandingExtras-B9IdYCfA.js"),[]).then(e=>({default:e.LandingExtras})));function al({children:e,className:t="",header:r}){return A.jsxs("section",{className:`relative overflow-hidden border border-[#00FF41]/45 bg-[#04130b]/72 ${t}`,children:[A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[linear-gradient(rgba(18,16,16,0)_50%,rgba(0,0,0,0.12)_50%)] bg-[length:100%_4px] opacity-25"}),r?A.jsx("header",{className:"relative border-b border-[#00FF41]/25 px-5 py-3",children:A.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.16em] text-[#00FF41]/78",children:r})}):null,A.jsx("div",{className:"relative p-5",children:e})]})}function jg({command:e,copied:t,onCopy:r,label:i,helper:a}){return A.jsxs("div",{className:"space-y-3",children:[i&&A.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] text-[#00FF41]/50 font-mono",children:i}),A.jsx("div",{className:"relative",children:A.jsxs("div",{className:"relative flex items-center gap-0 border border-[#00FF41]/40 bg-black/80",children:[A.jsx("div",{className:"shrink-0 px-3 py-3 border-r border-[#00FF41]/25 bg-[#00FF41]/6",children:A.jsx("span",{className:"text-[#00FF41] font-mono text-sm",children:"$"})}),A.jsx("div",{className:"flex-1 min-w-0 px-4 py-3 overflow-x-auto",children:A.jsx("code",{className:"font-mono text-sm text-[#00FF41] whitespace-nowrap block",children:e})}),A.jsx("button",{type:"button",onClick:r,className:"shrink-0 px-4 py-3 border-l border-[#00FF41]/25 text-[#00FF41]/70 hover:text-[#00FF41] hover:bg-[#00FF41]/10 transition-colors duration-200",title:t?"Copied!":"Copy to clipboard",children:t?A.jsx("svg",{viewBox:"0 0 16 16",className:"w-4 h-4",fill:"currentColor",children:A.jsx("path",{d:"M6 10.5L3.5 8l-1 1L6 13l7-7-1-1-6 5.5z"})}):A.jsxs("svg",{viewBox:"0 0 16 16",className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[A.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),A.jsx("path",{d:"M3 11V3h8",strokeLinecap:"round"})]})})]})}),a&&A.jsx("p",{className:"text-[10px] uppercase tracking-[0.15em] text-[#00FF41]/40 font-mono pl-1",children:a})]})}function I3({copy:e,effectsReady:t,signInUrl:r,signUpUrl:i,loginLabel:a,signupLabel:l,handle:c,onHandleChange:f,specialHandle:p,handlePlaceholder:m,rankLabel:g,installCommand:v,installCopied:_,onCopyInstallCommand:k}){const[T,x]=b.useState(!1),E=()=>{navigator.clipboard.writeText(e("landing.ai_agent.guide_url")),x(!0),setTimeout(()=>x(!1),2e3)},z=A.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 w-full max-w-3xl",children:[A.jsx("div",{className:"h-44 border border-[#00FF41]/15 bg-[#00FF41]/5 animate-pulse"}),A.jsx("div",{className:"h-44 border border-[#00FF41]/15 bg-[#00FF41]/5 animate-pulse"})]});return A.jsxs("div",{className:"min-h-screen bg-[#0a0a0a] font-mono text-[#00FF41] flex flex-col items-center justify-center p-4 sm:p-6 relative overflow-hidden selection:bg-[#00FF41] selection:text-black",children:[A.jsx("div",{className:"fixed inset-0 z-0 opacity-20",children:A.jsx("div",{className:"absolute inset-0 bg-[linear-gradient(rgba(0,255,65,0.03)_1px,transparent_1px),linear-gradient(90deg,rgba(0,255,65,0.03)_1px,transparent_1px)] bg-[size:50px_50px]"})}),t?A.jsx(b.Suspense,{fallback:null,children:A.jsx(O3,{})}):null,A.jsxs("div",{className:"fixed top-4 sm:top-6 right-4 sm:right-6 z-[70] flex items-center gap-3",children:[A.jsx(P3,{isFixed:!1,size:"header"}),A.jsx(x3,{as:"a",href:i,size:"header",className:"matrix-header-chip--solid",children:A.jsx("span",{className:"font-mono font-bold text-xs tracking-[0.15em] text-black uppercase",children:e("landing.nav.login_signup")})})]}),A.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 bg-[linear-gradient(rgba(18,16,16,0)_50%,rgba(0,0,0,0.15)_50%)] bg-[length:100%_3px]"}),A.jsxs("main",{className:"w-full max-w-4xl relative z-10 flex flex-col items-center space-y-8 sm:space-y-12 py-8 sm:py-12",children:[A.jsxs("div",{className:"text-center space-y-6",children:[A.jsxs("h1",{className:"text-4xl sm:text-6xl md:text-8xl font-black text-white tracking-tighter leading-none select-none",children:[A.jsx(Fg,{text:e("landing.hero.title_primary")})," ",A.jsx("br",{}),A.jsx("span",{className:"text-[#00FF41]",children:A.jsx(Fg,{text:e("landing.hero.title_secondary")})})]}),A.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[A.jsx(N3,{}),A.jsx("p",{className:"text-xs sm:text-sm text-[#00FF41]/60 uppercase tracking-[0.2em] max-w-lg text-center",children:e("landing.hero.subtagline")})]})]}),t?A.jsx(b.Suspense,{fallback:z,children:A.jsx(M3,{handle:c,onHandleChange:f,specialHandle:p,handlePlaceholder:m,rankLabel:g})}):z,A.jsx(al,{className:"w-full max-w-2xl",header:e("landing.ai_agent.title"),children:A.jsxs("div",{className:"space-y-4",children:[A.jsx("p",{className:"text-sm text-[#00FF41]/70 leading-relaxed",children:e("landing.ai_agent.description")}),A.jsx(jg,{command:e("landing.ai_agent.command"),copied:T,onCopy:E,helper:e("landing.ai_agent.helper")})]})}),A.jsx(al,{className:"w-full max-w-2xl",header:"Quick Install",children:A.jsx(jg,{command:v,copied:_,onCopy:k,label:e("landing.install.prompt"),helper:e("landing.install.helper")})}),A.jsx(al,{className:"w-full max-w-4xl",header:"Dashboard Preview",children:A.jsxs("div",{className:"relative overflow-hidden border border-[#00FF41]/35 bg-black/60",children:[A.jsx("img",{src:"/landing-dashboard.jpg",alt:e("landing.screenshot.alt"),className:"block w-full h-auto",loading:"lazy",decoding:"async"}),A.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-tr from-[#00FF41]/10 via-transparent to-transparent"})]})}),A.jsx(al,{className:"w-full max-w-2xl",header:"Feature Brief",children:A.jsxs("div",{className:"space-y-5",children:[A.jsx("h2",{className:"text-xl sm:text-2xl font-bold text-[#00FF41] tracking-tight",children:e("landing.seo.title")}),A.jsx("p",{className:"text-sm text-[#00FF41]/70 leading-relaxed",children:e("landing.seo.summary")}),A.jsx("ul",{className:"space-y-3",children:[e("landing.seo.point1"),e("landing.seo.point2"),e("landing.seo.point3")].map((I,F)=>A.jsxs("li",{className:"flex items-start gap-3 text-sm text-[#00FF41]/80",children:[A.jsxs("span",{className:"shrink-0 text-[#00FF41] font-mono text-xs mt-0.5",children:["[",F+1,"]"]}),A.jsx("span",{children:I})]},F))}),A.jsx("div",{className:"pt-3 border-t border-[#00FF41]/20",children:A.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] text-[#00FF41]/40",children:e("landing.seo.roadmap")})})]})}),A.jsx("div",{className:"w-full max-w-sm",children:A.jsxs("a",{href:i,className:"group relative block w-full text-center overflow-hidden",children:[A.jsx("div",{className:"relative bg-[#00FF41] text-black font-black uppercase tracking-[0.3em] py-4 px-6 hover:bg-white transition-colors duration-200",children:A.jsx("span",{className:"relative z-10",children:e("landing.cta.login_signup")})}),A.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-black/20"})]})}),A.jsxs("div",{className:"flex items-center gap-4 text-[10px] uppercase tracking-[0.2em] text-[#00FF41]/40",children:[A.jsxs("span",{className:"flex items-center gap-2",children:[A.jsx("span",{className:"w-1.5 h-1.5 bg-[#00FF41]/60 rounded-full animate-pulse"}),"v",e("version")||"0.2.21"]}),A.jsx("span",{children:"|"}),A.jsx("span",{children:e("landing.footer.system_ready")})]})]}),A.jsx("style",{children:`
|
|
2051
2051
|
@keyframes scan {
|
|
2052
2052
|
0% { transform: translateX(-100%); }
|
|
2053
2053
|
100% { transform: translateX(100%); }
|
|
@@ -2055,4 +2055,4 @@ live_sniffer.event.capture,ui,LiveSniffer,LiveSniffer,event,"> CAPTURE: +128 NEU
|
|
|
2055
2055
|
.animate-scan {
|
|
2056
2056
|
animation: scan 3s linear infinite;
|
|
2057
2057
|
}
|
|
2058
|
-
`})]})}function D3({prefersReducedMotion:e,screenshotMode:t}){return!(t||e)}function z3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function U3(e=0,t=!0){const[r,i]=b.useState(()=>!t);return b.useEffect(()=>{if(!t){i(!0);return}let a=null,l=null;const c=()=>i(!0);return typeof window<"u"&&"requestIdleCallback"in window?(l=window.requestIdleCallback(c,{timeout:e||200}),()=>{typeof window.cancelIdleCallback=="function"&&l!=null&&window.cancelIdleCallback(l)}):(a=window.setTimeout(c,e),()=>{a!=null&&window.clearTimeout(a)})},[e,t]),r}function F3({signInUrl:e,signUpUrl:t}){const r=ot("landing.handle.special"),i=ot("landing.handle.default"),a=ot("landing.nav.login"),l=ot("landing.nav.signup"),[c,f]=b.useState(i),p=z3(),m=b.useMemo(()=>typeof window>"u"?!1:Ef(window.location.search),[]),g=D3({prefersReducedMotion:p,screenshotMode:m}),v=U3(250,g),_="vibeusage.dashboard.from_landing.v1";b.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(_,"1")}catch{}},[_]);const k=b.useMemo(()=>ot("landing.handle.placeholder",{handle:r}),[r]),T=b.useMemo(()=>{const M=ot(c===r?"landing.rank.singularity":"landing.rank.unranked");return ot("landing.rank.expectation",{rank:M})},[c,r]),x=ot("landing.install.command"),[E,z]=b.useState(!1),I=M=>{f(M.target.value.toUpperCase())},F=async()=>{await d0(x)&&(z(!0),window.setTimeout(()=>z(!1),2e3))};return A.jsx(I3,{copy:ot,effectsReady:v,signInUrl:e,signUpUrl:t,loginLabel:a,signupLabel:l,handle:c,onHandleChange:I,specialHandle:r,handlePlaceholder:k,rankLabel:T,installCommand:x,installCopied:E,onCopyInstallCommand:F})}let Bg=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const j3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},B3={valid(e){return e===null?null:e?{[Bg.valid]:""}:{[Bg.invalid]:""}}},H3=b.createContext({invalid:void 0,name:void 0,validityData:{state:j3,errors:[],error:"",value:"",initialValue:null},setValidityData:Nn,disabled:void 0,touched:!1,setTouched:Nn,dirty:!1,setDirty:Nn,filled:!1,setFilled:Nn,focused:!1,setFocused:Nn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=cr)=>e,getInputValidationProps:(e=cr)=>e,inputRef:{current:null},commit:async()=>{}}});function kd(e=!0){const t=b.useContext(H3);if(t.setValidityData===Nn&&!e)throw new Error(af(28));return t}const V3=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Nn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function W3(){return b.useContext(V3)}const Z3={...xd};let Hg=0;function q3(e,t="mui"){const[r,i]=b.useState(e),a=e||r;return b.useEffect(()=>{r==null&&(Hg+=1,i(`${t}-${Hg}`))},[r,t]),a}const Vg=Z3.useId;function K3(e,t){if(Vg!==void 0){const r=Vg();return e??(t?`${t}-${r}`:r)}return q3(e,t)}function Y3(e){return K3(e,"base-ui")}const G3=b.createContext({controlId:void 0,setControlId:Nn,labelId:void 0,setLabelId:Nn,messageIds:[],setMessageIds:Nn,getDescriptionProps:e=>e});function h0(){return b.useContext(G3)}function J3(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Q3({controlled:e,default:t,name:r,state:i="value"}){const{current:a}=b.useRef(e!==void 0),[l,c]=b.useState(t),f=a?e:l,p=b.useCallback(m=>{a||c(m)},[]);return[f,p]}function X3(e={}){const{id:t,implicit:r=!1,controlRef:i}=e,{controlId:a,setControlId:l}=h0(),c=Y3(t);return ui(()=>{if(!(!r&&!t||l===Nn)){if(r){const f=i?.current;nf(f)&&f.closest("label")!=null?l(t??null):l(a??c)}else t&&l(t);return()=>{t&&l(void 0)}}},[t,i,a,l,r,c]),a??c}function e4(e){const{enabled:t=!0,value:r,id:i,name:a,controlRef:l,commit:c}=e,{formRef:f}=W3(),{invalid:p,markedDirtyRef:m,validityData:g,setValidityData:v}=kd(),_=xl(e.getValue);ui(()=>{if(!t)return;let k=r;k===void 0&&(k=_()),g.initialValue===null&&k!==null&&v(T=>({...T,initialValue:k}))},[t,v,r,g.initialValue,_]),ui(()=>{!t||!i||f.current.fields.set(i,{getValue:_,name:a,controlRef:l,validityData:J3(g,p),validate(k=!0){let T=r;T===void 0&&(T=_()),m.current=!0,k?gy.flushSync(()=>c(T)):c(T)}})},[c,l,t,f,_,i,p,m,a,g,r]),ui(()=>{const k=f.current.fields;return()=>{i&&k.delete(i)}},[f,i])}const t4="none",Y4="trigger-press",G4="trigger-hover",J4="outside-press",Q4="close-press",X4="focus-out",eR="escape-key",tR="imperative-action";function n4(e,t,r,i){let a=!1,l=!1;const c=cr;return{reason:e,event:t??new Event("base-ui"),cancel(){a=!0},allowPropagation(){l=!0},get isCanceled(){return a},get isPropagationAllowed(){return l},trigger:r,...c}}const r4=b.forwardRef(function(t,r){const{render:i,className:a,id:l,name:c,value:f,disabled:p=!1,onValueChange:m,defaultValue:g,...v}=t,{state:_,name:k,disabled:T}=kd(),x=T||p,E=k??c,z=b.useMemo(()=>({..._,disabled:x}),[_,x]),{setTouched:I,setDirty:F,validityData:M,setFocused:W,setFilled:O,validationMode:H,validation:R}=kd(),{labelId:fe}=h0(),me=X3({id:l});ui(()=>{const ce=f!=null;R.inputRef.current?.value||ce&&f!==""?O(!0):ce&&f===""&&O(!1)},[R.inputRef,O,f]);const[$e,Ce]=Q3({controlled:f,default:g,name:"FieldControl",state:"value"}),je=f!==void 0,Pe=xl((ce,_e)=>{m?.(ce,_e),!_e.isCanceled&&Ce(ce)});return e4({id:me,name:E,commit:R.commit,value:$e,getValue:()=>R.inputRef.current?.value,controlRef:R.inputRef}),_v("input",t,{ref:r,state:z,props:[{id:me,disabled:x,name:E,ref:R.inputRef,"aria-labelledby":fe,...je?{value:$e}:{defaultValue:g},onChange(ce){const _e=ce.currentTarget.value;Pe(_e,n4(t4,ce.nativeEvent)),F(_e!==M.initialValue),O(_e!=="")},onFocus(){W(!0)},onBlur(ce){I(!0),W(!1),H==="onBlur"&&R.commit(ce.currentTarget.value)},onKeyDown(ce){ce.currentTarget.tagName==="INPUT"&&ce.key==="Enter"&&(I(!0),R.commit(ce.currentTarget.value))}},R.getInputValidationProps(),v],stateAttributesMapping:B3})}),o4=b.forwardRef(function(t,r){return A.jsx(r4,{ref:r,...t})});function i4({requiredVersion:e,installCommand:t,onClose:r}){const i=typeof e=="string"?e.trim():"",a=i.length>0,l="vibeusage_upgrade_dismissed_unknown",c=t??ot("dashboard.upgrade_alert.install_command"),f=ot("dashboard.upgrade_alert.sparkle"),p=ot("dashboard.upgrade_alert.title"),m=a?ot("dashboard.upgrade_alert.subtitle",{required:i}):ot("dashboard.upgrade_alert.subtitle_generic"),g=ot("dashboard.upgrade_alert.prompt"),v=ot("dashboard.upgrade_alert.copy"),_=ot("dashboard.upgrade_alert.copied"),k=ot("dashboard.upgrade_alert.ignore"),[T,x]=b.useState(!1),E=b.useMemo(()=>a?`vibeusage_upgrade_dismissed_${i}`:l,[a,i,l]),[z,I]=b.useState(()=>typeof window>"u"?!0:!La(E)),F=b.useRef(null);if(b.useEffect(()=>{if(typeof window>"u")return;const O=La(E);I(!O)},[E]),b.useEffect(()=>{if(typeof document>"u")return;const O=document.documentElement;if(!z){O.style.setProperty("--matrix-banner-offset","0px");return}const H=()=>{const R=F.current?.offsetHeight??0;O.style.setProperty("--matrix-banner-offset",`${R}px`)};return H(),window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H)}},[z]),!z)return null;const M=async()=>{await d0(c)&&(x(!0),setTimeout(()=>x(!1),2e3))},W=()=>{bd(E,"true"),I(!1),r&&r()};return A.jsxs("div",{ref:F,className:"fixed top-0 left-0 right-0 z-[200] border-b border-gold/30 bg-matrix-dark/95 backdrop-blur-md shadow-[0_0_20px_rgba(255,215,0,0.1)] overflow-hidden",children:[A.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-10",children:A.jsx("div",{className:"w-full h-full bg-[linear-gradient(rgba(255,215,0,0)_50%,rgba(255,215,0,0.1)_50%)] bg-[length:100%_4px]"})}),A.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-2 relative flex flex-col md:flex-row items-center justify-between gap-4",children:[A.jsxs("div",{className:"flex items-center space-x-3",children:[A.jsx("span",{className:"text-xl animate-pulse",children:f}),A.jsxs("div",{className:"flex flex-col",children:[A.jsx("h3",{className:"text-gold font-black text-heading uppercase leading-none",children:p}),A.jsx("p",{className:"text-caption text-gold/60 uppercase mt-1",children:m})]})]}),A.jsx("div",{className:"flex-1 flex items-center justify-center max-w-xl w-full",children:A.jsxs("div",{className:"flex items-center w-full bg-matrix-panel border border-gold/20 pl-3 rounded-sm group hover:border-gold/40 transition-all overflow-hidden",children:[A.jsx("span",{className:"text-caption text-gold/80 shrink-0",children:g}),A.jsx(o4,{readOnly:!0,value:c,className:"bg-transparent border-none text-body text-gray-300 w-full px-2 py-1 outline-none pointer-events-none"}),A.jsx(Ta,{onClick:M,className:"shrink-0 bg-gold/10 hover:bg-gold/20 border-l border-gold/20 px-3 py-1.5 text-caption font-black uppercase text-gold transition-all",children:T?_:v})]})}),A.jsx("div",{className:"flex items-center space-x-4",children:A.jsx(Ta,{onClick:W,className:"text-caption font-black uppercase text-gold/40 hover:text-gold transition-all tracking-[0.2em]",children:k})})]})]})}function Wg(e,t){if(typeof e!="string"||e.length===0)return"/";if(typeof t!="string"||t.length===0||t==="/")return e;const r=new URLSearchParams;return r.set("next",t),`${e}?${r.toString()}`}const a4=qr.lazy(()=>za(()=>import("./DashboardPage-BAb5mCnt.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DashboardPage}))),s4=qr.lazy(()=>za(()=>import("./LeaderboardPage-5mTskSwq.js"),__vite__mapDeps([2,3,1,4])).then(e=>({default:e.LeaderboardPage}))),l4=qr.lazy(()=>za(()=>import("./LeaderboardProfilePage-ccbyuG4J.js"),__vite__mapDeps([5,3,1,4])).then(e=>({default:e.LeaderboardProfilePage})));function u4(){const e=qn(),t=Ia(),r=b.useMemo(()=>hf(),[]),{isLoaded:i,isSignedIn:a,signOut:l}=cx(),c=s0(),f=b.useMemo(()=>typeof window>"u"?!1:Ef(window.location.search),[]),[p,m]=b.useState(null),[g,v]=b.useState(),[_,k]=b.useState(()=>Pv()),[T,x]=b.useState(()=>Tv());b.useEffect(()=>{let xe=!0;return k3({allowStale:!0}).then(Ye=>{xe&&m(Ye)}),()=>{xe=!1}},[]),b.useEffect(()=>{if(typeof window>"u")return;const{saved:xe}=uf(window.location.search);if(!xe)return;const Ye=lf(window.location.href);!Ye||Ye===window.location.href||window.history.replaceState(null,"",Ye)},[]),b.useEffect(()=>{if(!i){v(void 0);return}let xe=!0;return Zr.auth.refreshSession().then(({data:_t})=>{if(!xe)return;const Ne=_t?.session??null;v(Ne),window.location.search.includes("debug=1")&&console.log("[Auth] Session refreshed:",{hasSession:!!Ne?.accessToken,userId:Ne?.user?.id??null,timestamp:new Date().toISOString()})}).catch(_t=>{xe&&(v(null),window.location.search.includes("debug=1")&&console.warn("[Auth] Session refresh failed:",_t))}),()=>{xe=!1}},[i,a]),b.useEffect(()=>eT(xe=>{k(!!xe)}),[]),b.useEffect(()=>tT(xe=>{x(!!xe)}),[]),b.useEffect(()=>{i&&(g?.accessToken&&!Jo(g.accessToken)||T&&va())},[i,g,T]);const E=b.useCallback(async()=>{const xe=Jo(g?.accessToken)?null:g?.accessToken??null;if(!a)return xe;const{data:Ye}=await Zr.auth.getCurrentSession(),_t=Ye?.session?.accessToken??null;return Jo(_t)?xe:_t},[g,a]);b.useEffect(()=>{if(!T)return()=>{};if(!a)return()=>{};let xe=!0;const Ye=async()=>{if(xe&&!(document.visibilityState&&document.visibilityState!=="visible"))try{const{data:bt}=await Zr.auth.getCurrentSession();if(!xe)return;bt?.session?.accessToken&&va()}catch{}},_t=()=>{xe&&document.visibilityState==="visible"&&Ye()},Ne=()=>{Ye()};return document.addEventListener("visibilitychange",_t),window.addEventListener("focus",Ne),Ye(),()=>{xe=!1,document.removeEventListener("visibilitychange",_t),window.removeEventListener("focus",Ne)}},[a,T]);const z=b.useMemo(()=>{const xe=g?.accessToken??null;if(!xe||Jo(xe))return null;const Ye=g.user,Ne=Ye?.profile?.name??Ye?.name??null;return{accessToken:xe,getAccessToken:E,userId:Ye?.id??null,email:Ye?.email??null,name:Ne,savedAt:new Date().toISOString()}},[E,g]),I=b.useRef(!1);b.useEffect(()=>{if(I.current)return;const xe=g?.accessToken??null;if(!xe||Jo(xe)||_)return;const Ye=GP(window.location.search);if(Ye){const Mn=g.user,en=Mn?.profile?.name??Mn?.name??null;I.current=!0;const wo=YP(Ye,{accessToken:xe,userId:Mn?.id??null,email:Mn?.email??null,name:en});window.location.assign(wo);return}if((window.location.pathname.replace(/\/+$/,"")||"/")!=="/auth/callback")return;const Ne=JP(),bt=Ne&&Ne!=="/auth/callback"?Ne:"/";I.current=!0,t(bt,{replace:!0})},[g,t,_]);const F=!!(g?.accessToken&&!Jo(g.accessToken)),W=i&&a||i&&F,O=W&&F,H=b.useMemo(()=>!W||!F?null:z,[F,z,W]),R=b.useMemo(()=>async()=>{try{W&&await l()}finally{bf(),df(),ff(),va(),v(null)}},[l,W]),fe=e?.pathname||"/",me=new URL(window.location.href),$e=me.pathname.replace(/\/+$/,"")||"/",je=$e.match(/^\/share\/([^/?#]+)$/i)?.[1]||null,Pe=me.searchParams.get("token")||null,Se=je||Pe,ce=$e==="/share"||$e==="/share.html"||$e.startsWith("/share/"),_e=b.useMemo(()=>{if(typeof window>"u")return null;const xe=fe.replace(/\/+$/,"")||"/";if(xe==="/auth/callback")return null;const Ye=e?.search||"",_t=e?.hash||"",Ne=new URL(`${xe}${Ye}${_t}`,window.location.origin);Ne.searchParams.delete("redirect"),Ne.searchParams.delete("base_url");const bt=`${Ne.pathname}${Ne.search}${Ne.hash}`;return bt==="/"?null:bt},[e?.hash,e?.search,fe]),Y=b.useMemo(()=>Wg("/sign-in",_e),[_e]),te=b.useMemo(()=>Wg("/sign-up",_e),[_e]);b.useEffect(()=>{typeof window>"u"||!i||window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||!DP({pathname:window.location.pathname,search:window.location.search,hasSession:!!g?.accessToken,sessionResolved:g!==void 0,storage:RP()})||t(Y,{replace:!0})},[i,g,t,Y]);const ne=A.jsx("div",{className:"min-h-screen bg-[#050505]"}),N=!ce&&!c&&!T&&(!i||g===void 0),V=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),he=BP({publicMode:ce,mockEnabled:c,sessionSoftExpired:T,signedIn:O,authPending:N}),ye=V?"dashboard":he,Le=fe.replace(/\/+$/,"")||"/",Te=Le.match(/^\/leaderboard\/u\/([^/]+)$/i),Ie=Te?Te[1]:null,De=Ie?l4:Le==="/leaderboard"?s4:a4;let ze=null;return ye==="loading"?ze=ne:ye==="landing"?ze=A.jsx(F3,{signInUrl:Y,signUpUrl:te}):ze=A.jsxs(b.Suspense,{fallback:ne,children:[!ce&&!f&&!V?A.jsx(i4,{requiredVersion:p}):null,A.jsx(De,{baseUrl:r,auth:H,signedIn:O,sessionSoftExpired:T,signOut:R,publicMode:ce,publicToken:Se,userId:Ie,signInUrl:Y,signUpUrl:te})]}),A.jsx(CP,{children:A.jsx(jP,{children:ze})})}function c4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function d4(){const e=b.useMemo(()=>c4(),[]),t=Ia();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=uf(window.location.search),{saved:i}=xv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=lf(a);l&&(a=l);const c=Sv(a);c&&(a=c),!(!a||a===window.location.href)&&window.history.replaceState(null,"",a)},[]),b.useEffect(()=>typeof window>"u"?void 0:((async()=>{try{await Zr.auth.signOut().catch(()=>{}),bf(),df(),ff(),va();const{error:i}=await Zr.auth.signInWithOAuth({provider:"github",redirectTo:e});i&&(console.error("OAuth init failed:",i),t("/",{replace:!0}))}catch(i){console.error("Sign-in redirect failed:",i),t("/",{replace:!0})}})(),()=>{}),[e,t]),A.jsx("div",{className:"min-h-screen bg-matrix-dark"})}function f4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function h4(){const e=b.useMemo(()=>f4(),[]),t=Ia();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=uf(window.location.search),{saved:i}=xv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=lf(a);l&&(a=l);const c=Sv(a);c&&(a=c),!(!a||a===window.location.href)&&window.history.replaceState(null,"",a)},[]),b.useEffect(()=>typeof window>"u"?void 0:((async()=>{try{await Zr.auth.signOut().catch(()=>{}),bf(),df(),ff(),va();const{error:i}=await Zr.auth.signInWithOAuth({provider:"github",redirectTo:e});i&&(console.error("OAuth init failed:",i),t("/",{replace:!0}))}catch(i){console.error("Sign-up redirect failed:",i),t("/",{replace:!0})}})(),()=>{}),[e,t]),A.jsx("div",{className:"min-h-screen bg-matrix-dark"})}const p4=hf(),m4="/auth/callback",g4=k2([{path:"/sign-in",element:A.jsx(d4,{})},{path:"/sign-up",element:A.jsx(h4,{})},...z2({baseUrl:p4,afterSignInUrl:m4,builtInAuth:!1}),{path:"*",element:A.jsx(u4,{})}]);F2.createRoot(document.getElementById("root")).render(A.jsx(qr.StrictMode,{children:A.jsx(D2,{client:Zr,children:A.jsx(M2,{router:g4})})}));export{Q4 as $,cv as A,_v as B,pg as C,G4 as D,cr as E,J4 as F,gi as G,hv as H,Y4 as I,fg as J,nf as K,H2 as L,Y2 as M,Nn as N,K2 as O,V2 as P,sd as Q,fv as R,y4 as S,zP as T,q2 as U,v4 as V,dv as W,w4 as X,eR as Y,t4 as Z,lP as _,rf as a,tR as a0,Y3 as a1,qr as a2,z4 as a3,D4 as a4,Ef as a5,fo as a6,L4 as a7,A4 as a8,U4 as a9,t3 as aa,$4 as ab,N4 as ac,I4 as ad,za as ae,K4 as af,d0 as ag,qn as ah,Ia as ai,x3 as aj,P3 as ak,W4 as al,R4 as am,_4 as an,F4 as ao,H4 as ap,q4 as aq,V4 as ar,j4 as as,B4 as at,Z4 as au,va as av,Zr as aw,Yn as ax,Fg as ay,o4 as az,s0 as b,k4 as c,b4 as d,o3 as e,i3 as f,i0 as g,M4 as h,dg as i,O4 as j,it as k,ot as l,A as m,ui as n,af as o,Sd as p,pP as q,b as r,xl as s,o0 as t,of as u,K3 as v,tf as w,gy as x,n4 as y,X4 as z};
|
|
2058
|
+
`})]})}function D3({prefersReducedMotion:e,screenshotMode:t}){return!(t||e)}function z3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function U3(e=0,t=!0){const[r,i]=b.useState(()=>!t);return b.useEffect(()=>{if(!t){i(!0);return}let a=null,l=null;const c=()=>i(!0);return typeof window<"u"&&"requestIdleCallback"in window?(l=window.requestIdleCallback(c,{timeout:e||200}),()=>{typeof window.cancelIdleCallback=="function"&&l!=null&&window.cancelIdleCallback(l)}):(a=window.setTimeout(c,e),()=>{a!=null&&window.clearTimeout(a)})},[e,t]),r}function F3({signInUrl:e,signUpUrl:t}){const r=ot("landing.handle.special"),i=ot("landing.handle.default"),a=ot("landing.nav.login"),l=ot("landing.nav.signup"),[c,f]=b.useState(i),p=z3(),m=b.useMemo(()=>typeof window>"u"?!1:Ef(window.location.search),[]),g=D3({prefersReducedMotion:p,screenshotMode:m}),v=U3(250,g),_="vibeusage.dashboard.from_landing.v1";b.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(_,"1")}catch{}},[_]);const k=b.useMemo(()=>ot("landing.handle.placeholder",{handle:r}),[r]),T=b.useMemo(()=>{const M=ot(c===r?"landing.rank.singularity":"landing.rank.unranked");return ot("landing.rank.expectation",{rank:M})},[c,r]),x=ot("landing.install.command"),[E,z]=b.useState(!1),I=M=>{f(M.target.value.toUpperCase())},F=async()=>{await d0(x)&&(z(!0),window.setTimeout(()=>z(!1),2e3))};return A.jsx(I3,{copy:ot,effectsReady:v,signInUrl:e,signUpUrl:t,loginLabel:a,signupLabel:l,handle:c,onHandleChange:I,specialHandle:r,handlePlaceholder:k,rankLabel:T,installCommand:x,installCopied:E,onCopyInstallCommand:F})}let Bg=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const j3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},B3={valid(e){return e===null?null:e?{[Bg.valid]:""}:{[Bg.invalid]:""}}},H3=b.createContext({invalid:void 0,name:void 0,validityData:{state:j3,errors:[],error:"",value:"",initialValue:null},setValidityData:Nn,disabled:void 0,touched:!1,setTouched:Nn,dirty:!1,setDirty:Nn,filled:!1,setFilled:Nn,focused:!1,setFocused:Nn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=cr)=>e,getInputValidationProps:(e=cr)=>e,inputRef:{current:null},commit:async()=>{}}});function kd(e=!0){const t=b.useContext(H3);if(t.setValidityData===Nn&&!e)throw new Error(af(28));return t}const V3=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Nn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function W3(){return b.useContext(V3)}const Z3={...xd};let Hg=0;function q3(e,t="mui"){const[r,i]=b.useState(e),a=e||r;return b.useEffect(()=>{r==null&&(Hg+=1,i(`${t}-${Hg}`))},[r,t]),a}const Vg=Z3.useId;function K3(e,t){if(Vg!==void 0){const r=Vg();return e??(t?`${t}-${r}`:r)}return q3(e,t)}function Y3(e){return K3(e,"base-ui")}const G3=b.createContext({controlId:void 0,setControlId:Nn,labelId:void 0,setLabelId:Nn,messageIds:[],setMessageIds:Nn,getDescriptionProps:e=>e});function h0(){return b.useContext(G3)}function J3(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Q3({controlled:e,default:t,name:r,state:i="value"}){const{current:a}=b.useRef(e!==void 0),[l,c]=b.useState(t),f=a?e:l,p=b.useCallback(m=>{a||c(m)},[]);return[f,p]}function X3(e={}){const{id:t,implicit:r=!1,controlRef:i}=e,{controlId:a,setControlId:l}=h0(),c=Y3(t);return ui(()=>{if(!(!r&&!t||l===Nn)){if(r){const f=i?.current;nf(f)&&f.closest("label")!=null?l(t??null):l(a??c)}else t&&l(t);return()=>{t&&l(void 0)}}},[t,i,a,l,r,c]),a??c}function e4(e){const{enabled:t=!0,value:r,id:i,name:a,controlRef:l,commit:c}=e,{formRef:f}=W3(),{invalid:p,markedDirtyRef:m,validityData:g,setValidityData:v}=kd(),_=xl(e.getValue);ui(()=>{if(!t)return;let k=r;k===void 0&&(k=_()),g.initialValue===null&&k!==null&&v(T=>({...T,initialValue:k}))},[t,v,r,g.initialValue,_]),ui(()=>{!t||!i||f.current.fields.set(i,{getValue:_,name:a,controlRef:l,validityData:J3(g,p),validate(k=!0){let T=r;T===void 0&&(T=_()),m.current=!0,k?gy.flushSync(()=>c(T)):c(T)}})},[c,l,t,f,_,i,p,m,a,g,r]),ui(()=>{const k=f.current.fields;return()=>{i&&k.delete(i)}},[f,i])}const t4="none",Y4="trigger-press",G4="trigger-hover",J4="outside-press",Q4="close-press",X4="focus-out",eR="escape-key",tR="imperative-action";function n4(e,t,r,i){let a=!1,l=!1;const c=cr;return{reason:e,event:t??new Event("base-ui"),cancel(){a=!0},allowPropagation(){l=!0},get isCanceled(){return a},get isPropagationAllowed(){return l},trigger:r,...c}}const r4=b.forwardRef(function(t,r){const{render:i,className:a,id:l,name:c,value:f,disabled:p=!1,onValueChange:m,defaultValue:g,...v}=t,{state:_,name:k,disabled:T}=kd(),x=T||p,E=k??c,z=b.useMemo(()=>({..._,disabled:x}),[_,x]),{setTouched:I,setDirty:F,validityData:M,setFocused:W,setFilled:O,validationMode:H,validation:R}=kd(),{labelId:fe}=h0(),me=X3({id:l});ui(()=>{const ce=f!=null;R.inputRef.current?.value||ce&&f!==""?O(!0):ce&&f===""&&O(!1)},[R.inputRef,O,f]);const[$e,Ce]=Q3({controlled:f,default:g,name:"FieldControl",state:"value"}),je=f!==void 0,Pe=xl((ce,_e)=>{m?.(ce,_e),!_e.isCanceled&&Ce(ce)});return e4({id:me,name:E,commit:R.commit,value:$e,getValue:()=>R.inputRef.current?.value,controlRef:R.inputRef}),_v("input",t,{ref:r,state:z,props:[{id:me,disabled:x,name:E,ref:R.inputRef,"aria-labelledby":fe,...je?{value:$e}:{defaultValue:g},onChange(ce){const _e=ce.currentTarget.value;Pe(_e,n4(t4,ce.nativeEvent)),F(_e!==M.initialValue),O(_e!=="")},onFocus(){W(!0)},onBlur(ce){I(!0),W(!1),H==="onBlur"&&R.commit(ce.currentTarget.value)},onKeyDown(ce){ce.currentTarget.tagName==="INPUT"&&ce.key==="Enter"&&(I(!0),R.commit(ce.currentTarget.value))}},R.getInputValidationProps(),v],stateAttributesMapping:B3})}),o4=b.forwardRef(function(t,r){return A.jsx(r4,{ref:r,...t})});function i4({requiredVersion:e,installCommand:t,onClose:r}){const i=typeof e=="string"?e.trim():"",a=i.length>0,l="vibeusage_upgrade_dismissed_unknown",c=t??ot("dashboard.upgrade_alert.install_command"),f=ot("dashboard.upgrade_alert.sparkle"),p=ot("dashboard.upgrade_alert.title"),m=a?ot("dashboard.upgrade_alert.subtitle",{required:i}):ot("dashboard.upgrade_alert.subtitle_generic"),g=ot("dashboard.upgrade_alert.prompt"),v=ot("dashboard.upgrade_alert.copy"),_=ot("dashboard.upgrade_alert.copied"),k=ot("dashboard.upgrade_alert.ignore"),[T,x]=b.useState(!1),E=b.useMemo(()=>a?`vibeusage_upgrade_dismissed_${i}`:l,[a,i,l]),[z,I]=b.useState(()=>typeof window>"u"?!0:!La(E)),F=b.useRef(null);if(b.useEffect(()=>{if(typeof window>"u")return;const O=La(E);I(!O)},[E]),b.useEffect(()=>{if(typeof document>"u")return;const O=document.documentElement;if(!z){O.style.setProperty("--matrix-banner-offset","0px");return}const H=()=>{const R=F.current?.offsetHeight??0;O.style.setProperty("--matrix-banner-offset",`${R}px`)};return H(),window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H)}},[z]),!z)return null;const M=async()=>{await d0(c)&&(x(!0),setTimeout(()=>x(!1),2e3))},W=()=>{bd(E,"true"),I(!1),r&&r()};return A.jsxs("div",{ref:F,className:"fixed top-0 left-0 right-0 z-[200] border-b border-gold/30 bg-matrix-dark/95 backdrop-blur-md shadow-[0_0_20px_rgba(255,215,0,0.1)] overflow-hidden",children:[A.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-10",children:A.jsx("div",{className:"w-full h-full bg-[linear-gradient(rgba(255,215,0,0)_50%,rgba(255,215,0,0.1)_50%)] bg-[length:100%_4px]"})}),A.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-2 relative flex flex-col md:flex-row items-center justify-between gap-4",children:[A.jsxs("div",{className:"flex items-center space-x-3",children:[A.jsx("span",{className:"text-xl animate-pulse",children:f}),A.jsxs("div",{className:"flex flex-col",children:[A.jsx("h3",{className:"text-gold font-black text-heading uppercase leading-none",children:p}),A.jsx("p",{className:"text-caption text-gold/60 uppercase mt-1",children:m})]})]}),A.jsx("div",{className:"flex-1 flex items-center justify-center max-w-xl w-full",children:A.jsxs("div",{className:"flex items-center w-full bg-matrix-panel border border-gold/20 pl-3 rounded-sm group hover:border-gold/40 transition-all overflow-hidden",children:[A.jsx("span",{className:"text-caption text-gold/80 shrink-0",children:g}),A.jsx(o4,{readOnly:!0,value:c,className:"bg-transparent border-none text-body text-gray-300 w-full px-2 py-1 outline-none pointer-events-none"}),A.jsx(Ta,{onClick:M,className:"shrink-0 bg-gold/10 hover:bg-gold/20 border-l border-gold/20 px-3 py-1.5 text-caption font-black uppercase text-gold transition-all",children:T?_:v})]})}),A.jsx("div",{className:"flex items-center space-x-4",children:A.jsx(Ta,{onClick:W,className:"text-caption font-black uppercase text-gold/40 hover:text-gold transition-all tracking-[0.2em]",children:k})})]})]})}function Wg(e,t){if(typeof e!="string"||e.length===0)return"/";if(typeof t!="string"||t.length===0||t==="/")return e;const r=new URLSearchParams;return r.set("next",t),`${e}?${r.toString()}`}const a4=qr.lazy(()=>za(()=>import("./DashboardPage-4iRwUaHk.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DashboardPage}))),s4=qr.lazy(()=>za(()=>import("./LeaderboardPage-DW7CMnjR.js"),__vite__mapDeps([2,3,1,4])).then(e=>({default:e.LeaderboardPage}))),l4=qr.lazy(()=>za(()=>import("./LeaderboardProfilePage-mAuhFhYv.js"),__vite__mapDeps([5,3,1,4])).then(e=>({default:e.LeaderboardProfilePage})));function u4(){const e=qn(),t=Ia(),r=b.useMemo(()=>hf(),[]),{isLoaded:i,isSignedIn:a,signOut:l}=cx(),c=s0(),f=b.useMemo(()=>typeof window>"u"?!1:Ef(window.location.search),[]),[p,m]=b.useState(null),[g,v]=b.useState(),[_,k]=b.useState(()=>Pv()),[T,x]=b.useState(()=>Tv());b.useEffect(()=>{let xe=!0;return k3({allowStale:!0}).then(Ye=>{xe&&m(Ye)}),()=>{xe=!1}},[]),b.useEffect(()=>{if(typeof window>"u")return;const{saved:xe}=uf(window.location.search);if(!xe)return;const Ye=lf(window.location.href);!Ye||Ye===window.location.href||window.history.replaceState(null,"",Ye)},[]),b.useEffect(()=>{if(!i){v(void 0);return}let xe=!0;return Zr.auth.refreshSession().then(({data:_t})=>{if(!xe)return;const Ne=_t?.session??null;v(Ne),window.location.search.includes("debug=1")&&console.log("[Auth] Session refreshed:",{hasSession:!!Ne?.accessToken,userId:Ne?.user?.id??null,timestamp:new Date().toISOString()})}).catch(_t=>{xe&&(v(null),window.location.search.includes("debug=1")&&console.warn("[Auth] Session refresh failed:",_t))}),()=>{xe=!1}},[i,a]),b.useEffect(()=>eT(xe=>{k(!!xe)}),[]),b.useEffect(()=>tT(xe=>{x(!!xe)}),[]),b.useEffect(()=>{i&&(g?.accessToken&&!Jo(g.accessToken)||T&&va())},[i,g,T]);const E=b.useCallback(async()=>{const xe=Jo(g?.accessToken)?null:g?.accessToken??null;if(!a)return xe;const{data:Ye}=await Zr.auth.getCurrentSession(),_t=Ye?.session?.accessToken??null;return Jo(_t)?xe:_t},[g,a]);b.useEffect(()=>{if(!T)return()=>{};if(!a)return()=>{};let xe=!0;const Ye=async()=>{if(xe&&!(document.visibilityState&&document.visibilityState!=="visible"))try{const{data:bt}=await Zr.auth.getCurrentSession();if(!xe)return;bt?.session?.accessToken&&va()}catch{}},_t=()=>{xe&&document.visibilityState==="visible"&&Ye()},Ne=()=>{Ye()};return document.addEventListener("visibilitychange",_t),window.addEventListener("focus",Ne),Ye(),()=>{xe=!1,document.removeEventListener("visibilitychange",_t),window.removeEventListener("focus",Ne)}},[a,T]);const z=b.useMemo(()=>{const xe=g?.accessToken??null;if(!xe||Jo(xe))return null;const Ye=g.user,Ne=Ye?.profile?.name??Ye?.name??null;return{accessToken:xe,getAccessToken:E,userId:Ye?.id??null,email:Ye?.email??null,name:Ne,savedAt:new Date().toISOString()}},[E,g]),I=b.useRef(!1);b.useEffect(()=>{if(I.current)return;const xe=g?.accessToken??null;if(!xe||Jo(xe)||_)return;const Ye=GP(window.location.search);if(Ye){const Mn=g.user,en=Mn?.profile?.name??Mn?.name??null;I.current=!0;const wo=YP(Ye,{accessToken:xe,userId:Mn?.id??null,email:Mn?.email??null,name:en});window.location.assign(wo);return}if((window.location.pathname.replace(/\/+$/,"")||"/")!=="/auth/callback")return;const Ne=JP(),bt=Ne&&Ne!=="/auth/callback"?Ne:"/";I.current=!0,t(bt,{replace:!0})},[g,t,_]);const F=!!(g?.accessToken&&!Jo(g.accessToken)),W=i&&a||i&&F,O=W&&F,H=b.useMemo(()=>!W||!F?null:z,[F,z,W]),R=b.useMemo(()=>async()=>{try{W&&await l()}finally{bf(),df(),ff(),va(),v(null)}},[l,W]),fe=e?.pathname||"/",me=new URL(window.location.href),$e=me.pathname.replace(/\/+$/,"")||"/",je=$e.match(/^\/share\/([^/?#]+)$/i)?.[1]||null,Pe=me.searchParams.get("token")||null,Se=je||Pe,ce=$e==="/share"||$e==="/share.html"||$e.startsWith("/share/"),_e=b.useMemo(()=>{if(typeof window>"u")return null;const xe=fe.replace(/\/+$/,"")||"/";if(xe==="/auth/callback")return null;const Ye=e?.search||"",_t=e?.hash||"",Ne=new URL(`${xe}${Ye}${_t}`,window.location.origin);Ne.searchParams.delete("redirect"),Ne.searchParams.delete("base_url");const bt=`${Ne.pathname}${Ne.search}${Ne.hash}`;return bt==="/"?null:bt},[e?.hash,e?.search,fe]),Y=b.useMemo(()=>Wg("/sign-in",_e),[_e]),te=b.useMemo(()=>Wg("/sign-up",_e),[_e]);b.useEffect(()=>{typeof window>"u"||!i||window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||!DP({pathname:window.location.pathname,search:window.location.search,hasSession:!!g?.accessToken,sessionResolved:g!==void 0,storage:RP()})||t(Y,{replace:!0})},[i,g,t,Y]);const ne=A.jsx("div",{className:"min-h-screen bg-[#050505]"}),N=!ce&&!c&&!T&&(!i||g===void 0),V=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),he=BP({publicMode:ce,mockEnabled:c,sessionSoftExpired:T,signedIn:O,authPending:N}),ye=V?"dashboard":he,Le=fe.replace(/\/+$/,"")||"/",Te=Le.match(/^\/leaderboard\/u\/([^/]+)$/i),Ie=Te?Te[1]:null,De=Ie?l4:Le==="/leaderboard"?s4:a4;let ze=null;return ye==="loading"?ze=ne:ye==="landing"?ze=A.jsx(F3,{signInUrl:Y,signUpUrl:te}):ze=A.jsxs(b.Suspense,{fallback:ne,children:[!ce&&!f&&!V?A.jsx(i4,{requiredVersion:p}):null,A.jsx(De,{baseUrl:r,auth:H,signedIn:O,sessionSoftExpired:T,signOut:R,publicMode:ce,publicToken:Se,userId:Ie,signInUrl:Y,signUpUrl:te})]}),A.jsx(CP,{children:A.jsx(jP,{children:ze})})}function c4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function d4(){const e=b.useMemo(()=>c4(),[]),t=Ia();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=uf(window.location.search),{saved:i}=xv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=lf(a);l&&(a=l);const c=Sv(a);c&&(a=c),!(!a||a===window.location.href)&&window.history.replaceState(null,"",a)},[]),b.useEffect(()=>typeof window>"u"?void 0:((async()=>{try{await Zr.auth.signOut().catch(()=>{}),bf(),df(),ff(),va();const{error:i}=await Zr.auth.signInWithOAuth({provider:"github",redirectTo:e});i&&(console.error("OAuth init failed:",i),t("/",{replace:!0}))}catch(i){console.error("Sign-in redirect failed:",i),t("/",{replace:!0})}})(),()=>{}),[e,t]),A.jsx("div",{className:"min-h-screen bg-matrix-dark"})}function f4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function h4(){const e=b.useMemo(()=>f4(),[]),t=Ia();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=uf(window.location.search),{saved:i}=xv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=lf(a);l&&(a=l);const c=Sv(a);c&&(a=c),!(!a||a===window.location.href)&&window.history.replaceState(null,"",a)},[]),b.useEffect(()=>typeof window>"u"?void 0:((async()=>{try{await Zr.auth.signOut().catch(()=>{}),bf(),df(),ff(),va();const{error:i}=await Zr.auth.signInWithOAuth({provider:"github",redirectTo:e});i&&(console.error("OAuth init failed:",i),t("/",{replace:!0}))}catch(i){console.error("Sign-up redirect failed:",i),t("/",{replace:!0})}})(),()=>{}),[e,t]),A.jsx("div",{className:"min-h-screen bg-matrix-dark"})}const p4=hf(),m4="/auth/callback",g4=k2([{path:"/sign-in",element:A.jsx(d4,{})},{path:"/sign-up",element:A.jsx(h4,{})},...z2({baseUrl:p4,afterSignInUrl:m4,builtInAuth:!1}),{path:"*",element:A.jsx(u4,{})}]);F2.createRoot(document.getElementById("root")).render(A.jsx(qr.StrictMode,{children:A.jsx(D2,{client:Zr,children:A.jsx(M2,{router:g4})})}));export{Q4 as $,cv as A,_v as B,pg as C,G4 as D,cr as E,J4 as F,gi as G,hv as H,Y4 as I,fg as J,nf as K,H2 as L,Y2 as M,Nn as N,K2 as O,V2 as P,sd as Q,fv as R,y4 as S,zP as T,q2 as U,v4 as V,dv as W,w4 as X,eR as Y,t4 as Z,lP as _,rf as a,tR as a0,Y3 as a1,qr as a2,z4 as a3,D4 as a4,Ef as a5,fo as a6,L4 as a7,A4 as a8,U4 as a9,t3 as aa,$4 as ab,N4 as ac,I4 as ad,za as ae,K4 as af,d0 as ag,qn as ah,Ia as ai,x3 as aj,P3 as ak,W4 as al,R4 as am,_4 as an,F4 as ao,H4 as ap,q4 as aq,V4 as ar,j4 as as,B4 as at,Z4 as au,va as av,Zr as aw,Yn as ax,Fg as ay,o4 as az,s0 as b,k4 as c,b4 as d,o3 as e,i3 as f,i0 as g,M4 as h,dg as i,O4 as j,it as k,ot as l,A as m,ui as n,af as o,Sd as p,pP as q,b as r,xl as s,o0 as t,of as u,K3 as v,tf as w,gy as x,n4 as y,X4 as z};
|