tokentracker-cli 0.2.25 → 0.2.26
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/{AsciiBox-BTY8AuX7.js → AsciiBox-fxqdUErY.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BNW-6Myn.js → DashboardPage-rdYpdfso.js} +1 -1
- package/dashboard/dist/assets/{LandingExtras-C6oIZxN4.js → LandingExtras-7PDallbH.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-CdAHOBHv.js → LeaderboardPage-CU_JeLPO.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-CPBD0FCr.js → LeaderboardProfilePage-D3B45Jjd.js} +1 -1
- package/dashboard/dist/assets/{MatrixRain-hFJ62iN5.js → MatrixRain-DR9XEe-r.js} +1 -1
- package/dashboard/dist/assets/{MatrixShell-BfXpCNQj.js → MatrixShell-B6_X7zAp.js} +1 -1
- package/dashboard/dist/assets/{main-DepLUlUX.js → main-B206gspN.js} +4 -4
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/README.old.md +0 -324
- package/README.zh-CN.md +0 -440
|
@@ -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-rdYpdfso.js","assets/AsciiBox-fxqdUErY.js","assets/LeaderboardPage-CU_JeLPO.js","assets/MatrixShell-B6_X7zAp.js","assets/MatrixRain-DR9XEe-r.js","assets/LeaderboardProfilePage-D3B45Jjd.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function Vw(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 jg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ww(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 xc={exports:{}},oa={},Ec={exports:{}},Oe={};var Vp;function Zw(){if(Vp)return Oe;Vp=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(){}},C=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,C(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={},Ce=null,Ie=null;if(V!=null)for(ye in V.ref!==void 0&&(Ie=V.ref),V.key!==void 0&&(Ce=""+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:Ce,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 Te=/\/+/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 Ce=typeof N;(Ce==="undefined"||Ce==="boolean")&&(N=null);var Ie=!1;if(N===null)Ie=!0;else switch(Ce){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(Te,"$&/")+"/"),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(Te,"$&/")+"/")+N)),V.push(Le)),1;if(Ie=0,ye=ye===""?".":ye+":",M(N))for(var De=0;De<N.length;De++){Ce=N[De];var ze=ye+je(Ce,De);Ie+=Pe(Ce,V,he,ze,Le)}else if(ze=_(N),typeof ze=="function")for(N=ze.call(N),De=0;!(Ce=N.next()).done;)Ce=Ce.value,ze=ye+je(Ce,De++),Ie+=Pe(Ce,V,he,ze,Le);else if(Ce==="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(Ce){return V.call(he,Ce,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=C({},N.props),Le=N.key,Ce=N.ref,Ie=N._owner;if(V!=null){if(V.ref!==void 0&&(Ce=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:Ce,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 Wp;function bd(){return Wp||(Wp=1,Ec.exports=Zw()),Ec.exports}var Zp;function qw(){if(Zp)return oa;Zp=1;var e=bd(),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 oa.Fragment=r,oa.jsx=c,oa.jsxs=c,oa}var qp;function Kw(){return qp||(qp=1,xc.exports=qw()),xc.exports}var A=Kw(),b=bd();const qr=jg(b),kd=Vw({__proto__:null,default:qr},[b]);var Sd=b.createContext(void 0);Sd.displayName="InsforgeContext";var Bg=b.createContext(void 0);Bg.displayName="InsforgeAuthStateContext";var Hg=b.createContext(void 0);Hg.displayName="InsforgeMethodsContext";var Vg=b.createContext(void 0);Vg.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 ai extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Wg extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Yw={};function mo(e){return Yw}function qc(e,t){return typeof t=="bigint"?t.toString():t}function xd(e){return e==null}function Ed(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const Kp=Symbol("evaluating");function Xe(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==Kp)return i===void 0&&(i=Kp,i=r()),i},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Gw(...e){const t={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function Jw(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zg="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Kc(e){if(Yp(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Yp(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function qg(e){return Kc(e)?{...e}:Array.isArray(e)?[...e]:e}function Pd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qw(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 oi(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 Xw(e,t){return t.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function Ws(e){return typeof e=="string"?e:e?.message}function go(e,t,r){const i={...e,path:e.path??[]};if(!e.message){const a=Ws(e.inst?._zod.def?.error?.(e))??Ws(t?.error?.(e))??Ws(r.customError?.(e))??Ws(r.localeError?.(e))??"Invalid input";i.message=a}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Cd(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function wa(...e){const[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}const Kg=(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,qc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Yg=J("$ZodError",Kg),Gg=J("$ZodError",Kg,{Parent:Error});function e1(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 t1(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 Td=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 ai;if(c.issues.length){const f=new(a?.Err??e)(c.issues.map(p=>go(p,l,mo())));throw Zg(f,a?.callee),f}return c.value},Rd=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=>go(p,l,mo())));throw Zg(f,a?.callee),f}return c.value},Rl=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 ai;return l.issues.length?{success:!1,error:new(e??Yg)(l.issues.map(c=>go(c,a,mo())))}:{success:!0,data:l.value}},n1=Rl(Gg),Ll=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=>go(c,a,mo())))}:{success:!0,data:l.value}},r1=Ll(Gg),o1=e=>(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Td(e)(t,r,a)},i1=e=>(t,r,i)=>Td(e)(t,r,i),a1=e=>async(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Rd(e)(t,r,a)},s1=e=>async(t,r,i)=>Rd(e)(t,r,i),l1=e=>(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Rl(e)(t,r,a)},u1=e=>(t,r,i)=>Rl(e)(t,r,i),c1=e=>async(t,r,i)=>{const a=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ll(e)(t,r,a)},d1=e=>async(t,r,i)=>Ll(e)(t,r,i),f1=/^[cC][^\s-]{8,}$/,h1=/^[0-9a-z]+$/,p1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,m1=/^[0-9a-vA-V]{20}$/,g1=/^[A-Za-z0-9]{27}$/,y1=/^[a-zA-Z0-9_-]{21}$/,v1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,w1=/^([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})$/,Gp=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)$/,_1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,b1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function k1(){return new RegExp(b1,"u")}const S1=/^(?:(?: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])$/,x1=/^(([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}|:))$/,E1=/^((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])$/,P1=/^(([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])$/,C1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jg=/^[A-Za-z0-9_-]*$/,T1=/^\+[1-9]\d{6,14}$/,Qg="(?:(?:\\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])))",R1=new RegExp(`^${Qg}$`);function Xg(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 L1(e){return new RegExp(`^${Xg(e)}$`)}function A1(e){const t=Xg({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(`^${Qg}T(?:${i})$`)}const $1=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},N1=/^[^A-Z]*$/,O1=/^[^a-z]*$/,Zn=J("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),M1=J("$ZodCheckMaxLength",(e,t)=>{var r;Zn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const a=i.value;return!xd(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=Cd(a);i.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),I1=J("$ZodCheckMinLength",(e,t)=>{var r;Zn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const a=i.value;return!xd(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=Cd(a);i.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),D1=J("$ZodCheckLengthEquals",(e,t)=>{var r;Zn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const a=i.value;return!xd(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=Cd(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})}}),Al=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=()=>{})}),z1=J("$ZodCheckRegex",(e,t)=>{Al.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})}}),U1=J("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=N1),Al.init(e,t)}),F1=J("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=O1),Al.init(e,t)}),j1=J("$ZodCheckIncludes",(e,t)=>{Zn.init(e,t);const r=Pd(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})}}),B1=J("$ZodCheckStartsWith",(e,t)=>{Zn.init(e,t);const r=new RegExp(`^${Pd(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})}}),H1=J("$ZodCheckEndsWith",(e,t)=>{Zn.init(e,t);const r=new RegExp(`.*${Pd(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})}}),V1=J("$ZodCheckOverwrite",(e,t)=>{Zn.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),W1={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=W1;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=oi(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 ai;if(g||k instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await k,c.issues.length!==_&&(m||(m=oi(c,_)))});else{if(c.issues.length===_)continue;m||(m=oi(c,_))}}return g?g.then(()=>c):c},l=(c,f,p)=>{if(oi(c))return c.aborted=!0,c;const m=a(f,i,p);if(m instanceof Promise){if(p.async===!1)throw new ai;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 ai;return p.then(m=>a(m,i,f))}return a(p,i,f)}}Xe(e,"~standard",()=>({validate:a=>{try{const l=n1(e,a);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return r1(e,a).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},vendor:"zod",version:1}))}),Ld=J("$ZodString",(e,t)=>{Wt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$1(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)=>{Al.init(e,t),Ld.init(e,t)}),Z1=J("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=w1),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=Gp(i))}else t.pattern??(t.pattern=Gp());st.init(e,t)}),K1=J("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=_1),st.init(e,t)}),Y1=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})}}}),G1=J("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=k1()),st.init(e,t)}),J1=J("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=y1),st.init(e,t)}),Q1=J("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=f1),st.init(e,t)}),X1=J("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=h1),st.init(e,t)}),e_=J("$ZodULID",(e,t)=>{t.pattern??(t.pattern=p1),st.init(e,t)}),t_=J("$ZodXID",(e,t)=>{t.pattern??(t.pattern=m1),st.init(e,t)}),n_=J("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=g1),st.init(e,t)}),r_=J("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=A1(t)),st.init(e,t)}),o_=J("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=R1),st.init(e,t)}),i_=J("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=L1(t)),st.init(e,t)}),a_=J("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=v1),st.init(e,t)}),s_=J("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=S1),st.init(e,t),e._zod.bag.format="ipv4"}),l_=J("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=x1),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})}}}),u_=J("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=E1),st.init(e,t)}),c_=J("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=P1),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 ey(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const d_=J("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=C1),st.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{ey(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function f_(e){if(!Jg.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return ey(r)}const h_=J("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Jg),st.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{f_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),p_=J("$ZodE164",(e,t)=>{t.pattern??(t.pattern=T1),st.init(e,t)});function m_(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 g_=J("$ZodJWT",(e,t)=>{st.init(e,t),e._zod.check=r=>{m_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});function Jp(e,t,r){e.issues.length&&t.issues.push(...Xw(r,e.issues)),t.value[r]=e.value}const y_=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=>Jp(m,r,c))):Jp(p,r,c)}return l.length?Promise.all(l).then(()=>r):r}});function Qp(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=>!oi(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=>go(c,i,mo())))}),t)}const v_=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=>Ed(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=>Qp(p,a,e,l)):Qp(f,a,e,l)}}),w_=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])=>Xp(r,p,m)):Xp(r,l,c)}});function Yc(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(Kc(e)&&Kc(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=Yc(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=Yc(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 Xp(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}),oi(e))return e;const c=Yc(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 __=J("$ZodTransform",(e,t)=>{Wt.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Wg(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 ai;return r.value=a,r}});function em(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ty=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(`^(${Ed(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=>em(l,r.value)):em(a,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,i)}}),b_=J("$ZodExactOptional",(e,t)=>{ty.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)}),k_=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(`^(${Ed(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)}),S_=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=>tm(l,t)):tm(a,t)}});function tm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const x_=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))}),E_=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=>nm(l,e)):nm(a,e)}});function nm(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 P_=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=>go(c,i,mo()))},input:r.value}),r.issues=[]),r)):(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(l=>go(l,i,mo()))},input:r.value}),r.issues=[]),r)}}),C_=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=>Zs(c,t.in,i)):Zs(l,t.in,i)}const a=t.in._zod.run(r,i);return a instanceof Promise?a.then(l=>Zs(l,t.out,i)):Zs(a,t.out,i)}});function Zs(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const T_=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(rm):rm(a)}});function rm(e){return e.value=Object.freeze(e.value),e}const R_=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=>om(l,r,i,e));om(a,r,i,e)}});function om(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(wa(a))}}var im;class L_{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 A_(){return new L_}(im=globalThis).__zod_globalRegistry??(im.__zod_globalRegistry=A_());const ca=globalThis.__zod_globalRegistry;function $_(e,t){return new e({type:"string",...Ae(t)})}function N_(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ae(t)})}function am(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ae(t)})}function O_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ae(t)})}function M_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ae(t)})}function I_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ae(t)})}function D_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ae(t)})}function z_(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ae(t)})}function U_(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ae(t)})}function F_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ae(t)})}function j_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ae(t)})}function B_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ae(t)})}function H_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ae(t)})}function V_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ae(t)})}function W_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ae(t)})}function Z_(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 K_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ae(t)})}function Y_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ae(t)})}function G_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ae(t)})}function J_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ae(t)})}function Q_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ae(t)})}function X_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ae(t)})}function eb(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ae(t)})}function tb(e,t){return new e({type:"string",format:"date",check:"string_format",...Ae(t)})}function nb(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ae(t)})}function rb(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ae(t)})}function ny(e,t){return new M1({check:"max_length",...Ae(t),maximum:e})}function vl(e,t){return new I1({check:"min_length",...Ae(t),minimum:e})}function ry(e,t){return new D1({check:"length_equals",...Ae(t),length:e})}function ob(e,t){return new z1({check:"string_format",format:"regex",...Ae(t),pattern:e})}function ib(e){return new U1({check:"string_format",format:"lowercase",...Ae(e)})}function ab(e){return new F1({check:"string_format",format:"uppercase",...Ae(e)})}function sb(e,t){return new j1({check:"string_format",format:"includes",...Ae(t),includes:e})}function lb(e,t){return new B1({check:"string_format",format:"starts_with",...Ae(t),prefix:e})}function ub(e,t){return new H1({check:"string_format",format:"ends_with",...Ae(t),suffix:e})}function hi(e){return new V1({check:"overwrite",tx:e})}function cb(e){return hi(t=>t.normalize(e))}function db(){return hi(e=>e.trim())}function fb(){return hi(e=>e.toLowerCase())}function hb(){return hi(e=>e.toUpperCase())}function pb(){return hi(e=>Jw(e))}function mb(e,t,r){return new e({type:"array",element:t,...Ae(r)})}function gb(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ae(r)})}function yb(e){const t=vb(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(wa(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(wa(a))}},e(r.value,r)));return t}function vb(e,t){const r=new Zn({check:"custom",...Ae(t)});return r._zod.check=e,r}function oy(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??ca,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 iy(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??(C=>C);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 ay(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:wl(t,"input",e.processors),output:wl(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 wb=(e,t={})=>r=>{const i=oy({...r,processors:t});return Vt(e,i),iy(i,e),ay(i,e)},wl=(e,t,r={})=>i=>{const{libraryOptions:a,target:l}=i??{},c=oy({...a??{},target:l,io:t,processors:r});return Vt(e,c),iy(c,e),ay(c,e)},_b={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bb=(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=_b[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}))])}},kb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Sb=(e,t,r,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},xb=(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"]})},Eb=(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},Pb=(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},Cb=(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"}]},Tb=(e,t,r,i)=>{const a=e._zod.def;Vt(a.innerType,t,i);const l=t.seen.get(e);l.ref=a.innerType},Rb=(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))},Lb=(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)))},Ab=(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},$b=(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},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,r.readOnly=!0},sy=(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=J("ZodISODateTime",(e,t)=>{r_.init(e,t),ct.init(e,t)});function Mb(e){return eb(Ob,e)}const Ib=J("ZodISODate",(e,t)=>{o_.init(e,t),ct.init(e,t)});function Db(e){return tb(Ib,e)}const zb=J("ZodISOTime",(e,t)=>{i_.init(e,t),ct.init(e,t)});function Ub(e){return nb(zb,e)}const Fb=J("ZodISODuration",(e,t)=>{a_.init(e,t),ct.init(e,t)});function jb(e){return rb(Fb,e)}const Bb=(e,t)=>{Yg.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>t1(e,r)},flatten:{value:r=>e1(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,qc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,qc,2)}},isEmpty:{get(){return e.issues.length===0}}})},bn=J("ZodError",Bb,{Parent:Error}),Hb=Td(bn),Vb=Rd(bn),Wb=Rl(bn),Zb=Ll(bn),qb=o1(bn),Kb=i1(bn),Yb=a1(bn),Gb=s1(bn),Jb=l1(bn),Qb=u1(bn),Xb=c1(bn),ek=d1(bn),Zt=J("ZodType",(e,t)=>(Wt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wl(e,"input"),output:wl(e,"output")}}),e.toJSONSchema=wb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Gw(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)=>Qw(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.parse=(r,i)=>Hb(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>Wb(e,r,i),e.parseAsync=async(r,i)=>Vb(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>Zb(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>qb(e,r,i),e.decode=(r,i)=>Kb(e,r,i),e.encodeAsync=async(r,i)=>Yb(e,r,i),e.decodeAsync=async(r,i)=>Gb(e,r,i),e.safeEncode=(r,i)=>Jb(e,r,i),e.safeDecode=(r,i)=>Qb(e,r,i),e.safeEncodeAsync=async(r,i)=>Xb(e,r,i),e.safeDecodeAsync=async(r,i)=>ek(e,r,i),e.refine=(r,i)=>e.check(Hk(r,i)),e.superRefine=r=>e.check(Vk(r)),e.overwrite=r=>e.check(hi(r)),e.optional=()=>lm(e),e.exactOptional=()=>Rk(e),e.nullable=()=>um(e),e.nullish=()=>lm(um(e)),e.nonoptional=r=>Ik(e,r),e.array=()=>_k(e),e.or=r=>kk([e,r]),e.and=r=>xk(e,r),e.transform=r=>cm(e,Pk(r)),e.default=r=>$k(e,r),e.prefault=r=>Ok(e,r),e.catch=r=>zk(e,r),e.pipe=r=>cm(e,r),e.readonly=()=>jk(e),e.describe=r=>{const i=e.clone();return ca.add(i,{description:r}),i},Object.defineProperty(e,"description",{get(){return ca.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ca.get(e);const i=e.clone();return ca.add(i,r[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),ly=J("_ZodString",(e,t)=>{Ld.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(i,a,l)=>bb(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(ob(...i)),e.includes=(...i)=>e.check(sb(...i)),e.startsWith=(...i)=>e.check(lb(...i)),e.endsWith=(...i)=>e.check(ub(...i)),e.min=(...i)=>e.check(vl(...i)),e.max=(...i)=>e.check(ny(...i)),e.length=(...i)=>e.check(ry(...i)),e.nonempty=(...i)=>e.check(vl(1,...i)),e.lowercase=i=>e.check(ib(i)),e.uppercase=i=>e.check(ab(i)),e.trim=()=>e.check(db()),e.normalize=(...i)=>e.check(cb(...i)),e.toLowerCase=()=>e.check(fb()),e.toUpperCase=()=>e.check(hb()),e.slugify=()=>e.check(pb())}),tk=J("ZodString",(e,t)=>{Ld.init(e,t),ly.init(e,t),e.email=r=>e.check(N_(nk,r)),e.url=r=>e.check(z_(rk,r)),e.jwt=r=>e.check(X_(vk,r)),e.emoji=r=>e.check(U_(ok,r)),e.guid=r=>e.check(am(sm,r)),e.uuid=r=>e.check(O_(qs,r)),e.uuidv4=r=>e.check(M_(qs,r)),e.uuidv6=r=>e.check(I_(qs,r)),e.uuidv7=r=>e.check(D_(qs,r)),e.nanoid=r=>e.check(F_(ik,r)),e.guid=r=>e.check(am(sm,r)),e.cuid=r=>e.check(j_(ak,r)),e.cuid2=r=>e.check(B_(sk,r)),e.ulid=r=>e.check(H_(lk,r)),e.base64=r=>e.check(G_(mk,r)),e.base64url=r=>e.check(J_(gk,r)),e.xid=r=>e.check(V_(uk,r)),e.ksuid=r=>e.check(W_(ck,r)),e.ipv4=r=>e.check(Z_(dk,r)),e.ipv6=r=>e.check(q_(fk,r)),e.cidrv4=r=>e.check(K_(hk,r)),e.cidrv6=r=>e.check(Y_(pk,r)),e.e164=r=>e.check(Q_(yk,r)),e.datetime=r=>e.check(Mb(r)),e.date=r=>e.check(Db(r)),e.time=r=>e.check(Ub(r)),e.duration=r=>e.check(jb(r))});function uy(e){return $_(tk,e)}const ct=J("ZodStringFormat",(e,t)=>{st.init(e,t),ly.init(e,t)}),nk=J("ZodEmail",(e,t)=>{K1.init(e,t),ct.init(e,t)}),sm=J("ZodGUID",(e,t)=>{Z1.init(e,t),ct.init(e,t)}),qs=J("ZodUUID",(e,t)=>{q1.init(e,t),ct.init(e,t)}),rk=J("ZodURL",(e,t)=>{Y1.init(e,t),ct.init(e,t)}),ok=J("ZodEmoji",(e,t)=>{G1.init(e,t),ct.init(e,t)}),ik=J("ZodNanoID",(e,t)=>{J1.init(e,t),ct.init(e,t)}),ak=J("ZodCUID",(e,t)=>{Q1.init(e,t),ct.init(e,t)}),sk=J("ZodCUID2",(e,t)=>{X1.init(e,t),ct.init(e,t)}),lk=J("ZodULID",(e,t)=>{e_.init(e,t),ct.init(e,t)}),uk=J("ZodXID",(e,t)=>{t_.init(e,t),ct.init(e,t)}),ck=J("ZodKSUID",(e,t)=>{n_.init(e,t),ct.init(e,t)}),dk=J("ZodIPv4",(e,t)=>{s_.init(e,t),ct.init(e,t)}),fk=J("ZodIPv6",(e,t)=>{l_.init(e,t),ct.init(e,t)}),hk=J("ZodCIDRv4",(e,t)=>{u_.init(e,t),ct.init(e,t)}),pk=J("ZodCIDRv6",(e,t)=>{c_.init(e,t),ct.init(e,t)}),mk=J("ZodBase64",(e,t)=>{d_.init(e,t),ct.init(e,t)}),gk=J("ZodBase64URL",(e,t)=>{h_.init(e,t),ct.init(e,t)}),yk=J("ZodE164",(e,t)=>{p_.init(e,t),ct.init(e,t)}),vk=J("ZodJWT",(e,t)=>{g_.init(e,t),ct.init(e,t)}),wk=J("ZodArray",(e,t)=>{y_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>xb(e,r,i,a),e.element=t.element,e.min=(r,i)=>e.check(vl(r,i)),e.nonempty=r=>e.check(vl(1,r)),e.max=(r,i)=>e.check(ny(r,i)),e.length=(r,i)=>e.check(ry(r,i)),e.unwrap=()=>e.element});function _k(e,t){return mb(wk,e,t)}const bk=J("ZodUnion",(e,t)=>{v_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Eb(e,r,i,a),e.options=t.options});function kk(e,t){return new bk({type:"union",options:e,...Ae(t)})}const Sk=J("ZodIntersection",(e,t)=>{w_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Pb(e,r,i,a)});function xk(e,t){return new Sk({type:"intersection",left:e,right:t})}const Ek=J("ZodTransform",(e,t)=>{__.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Sb(e,r),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new Wg(e.constructor.name);r.addIssue=l=>{if(typeof l=="string")r.issues.push(wa(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(wa(c))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(l=>(r.value=l,r)):(r.value=a,r)}});function Pk(e){return new Ek({type:"transform",transform:e})}const Ck=J("ZodOptional",(e,t)=>{ty.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>sy(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function lm(e){return new Ck({type:"optional",innerType:e})}const Tk=J("ZodExactOptional",(e,t)=>{b_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>sy(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function Rk(e){return new Tk({type:"optional",innerType:e})}const Lk=J("ZodNullable",(e,t)=>{k_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Cb(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function um(e){return new Lk({type:"nullable",innerType:e})}const Ak=J("ZodDefault",(e,t)=>{S_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Rb(e,r,i,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $k(e,t){return new Ak({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():qg(t)}})}const Nk=J("ZodPrefault",(e,t)=>{x_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Lb(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function Ok(e,t){return new Nk({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():qg(t)}})}const Mk=J("ZodNonOptional",(e,t)=>{E_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Tb(e,r,i,a),e.unwrap=()=>e._zod.def.innerType});function Ik(e,t){return new Mk({type:"nonoptional",innerType:e,...Ae(t)})}const Dk=J("ZodCatch",(e,t)=>{P_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>Ab(e,r,i,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zk(e,t){return new Dk({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Uk=J("ZodPipe",(e,t)=>{C_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>$b(e,r,i,a),e.in=t.in,e.out=t.out});function cm(e,t){return new Uk({type:"pipe",in:e,out:t})}const Fk=J("ZodReadonly",(e,t)=>{T_.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){return new Fk({type:"readonly",innerType:e})}const Bk=J("ZodCustom",(e,t)=>{R_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,i,a)=>kb(e,r)});function Hk(e,t={}){return gb(Bk,e,t)}function Vk(e){return yb(e)}var Pc={exports:{}},Qt={},Cc={exports:{}},Tc={};var dm;function Wk(){return dm||(dm=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],Ce=ye+1,Ie=Y[Ce];if(0>a(Le,ne))Ce<V&&0>a(Ie,Le)?(Y[N]=Ie,Y[Ce]=ne,N=Ce):(Y[N]=Le,Y[ye]=ne,N=ye);else if(Ce<V&&0>a(Ie,ne))Y[N]=Ie,Y[Ce]=ne,N=Ce;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,C=!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),!C)if(r(p)!==null)C=!0,ce(W);else{var te=r(m);te!==null&&_e(M,te.startTime-Y)}}function W(Y,te){C=!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 Te(){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(Te)};else if(typeof MessageChannel<"u"){var Pe=new MessageChannel,Se=Pe.port2;Pe.port1.onmessage=Te,je=function(){Se.postMessage(null)}}else je=function(){E(Te,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(){C||k||(C=!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),C||k||(C=!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}}}})(Tc)),Tc}var fm;function Zk(){return fm||(fm=1,Cc.exports=Wk()),Cc.exports}var hm;function qk(){if(hm)return Qt;hm=1;var e=bd(),t=Zk();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 C(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")&&(C(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"),Te=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`
|
|
@@ -2040,12 +2040,12 @@ live_sniffer.event.capture,ui,LiveSniffer,LiveSniffer,event,"> CAPTURE: +128 NEU
|
|
|
2040
2040
|
`))}logResponse(e,t,r,i,a){if(!this.enabled)return;const l=[`← ${e} ${t} ${r} (${i}ms)`],c=Eg(va(a));if(c){const f=c.length>1e3?c.slice(0,1e3)+"... [truncated]":c;l.push(` Body: ${f}`)}r>=400?this.error(l.join(`
|
|
2041
2041
|
`)):this.log(l.join(`
|
|
2042
2042
|
`))}},aT=new Set([500,502,503,504]),sT=new Set(["GET","HEAD","PUT","DELETE","OPTIONS"]),lT=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 Hv(!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 aT.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=sT.has(e.toUpperCase())||r.idempotent===!0?this.retryCount:0,_={...this.defaultHeaders},k=this.userToken||this.anonKey;k&&(_.Authorization=`Bearer ${k}`);let C;l!==void 0&&(typeof FormData<"u"&&l instanceof FormData?C=l:(e!=="GET"&&(_["Content-Type"]="application/json;charset=UTF-8"),C=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,_,C);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:C,...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}},mf="insforge_csrf_token";function uT(){if(typeof document>"u")return null;const e=document.cookie.split(";").find(t=>t.trim().startsWith(`${mf}=`));return e&&e.split("=")[1]||null}function Pg(e){if(typeof document>"u")return;const t=10080*60,r=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${mf}=${encodeURIComponent(e)}; path=/; max-age=${t}; SameSite=Lax${r}`}function cT(){if(typeof document>"u")return;const e=typeof window<"u"&&window.location.protocol==="https:"?"; Secure":"";document.cookie=`${mf}=; path=/; max-age=0; SameSite=Lax${e}`}var dT=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()}},yd="insforge_pkce_verifier";function Vv(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function fT(){const e=new Uint8Array(32);return crypto.getRandomValues(e),Vv(e)}async function hT(e){const r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r);return Vv(new Uint8Array(i))}function pT(e){typeof sessionStorage<"u"&&sessionStorage.setItem(yd,e)}function mT(){if(typeof sessionStorage>"u")return null;const e=sessionStorage.getItem(yd);return e&&sessionStorage.removeItem(yd),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 Vc(...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 gT=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&&Pg(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){Vc("error"),console.debug("OAuth callback error:",t);return}const r=e.get("insforge_code");if(r){Vc("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&&Pg(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),Vc("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()||cT(),{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=fT(),l=await hT(a);pT(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??mT();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:uT(),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 yT(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 vT=class{constructor(e,t){this.postgrest=new uC("http://dummy",{fetch:yT(e,t),headers:{}})}from(e){return this.postgrest.from(e)}rpc(e,t,r){return this.postgrest.rpc(e,t,r)}},wT=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")}}}},_T=class{constructor(e){this.http=e}from(e){return new wT(e,this.http)}},bT=class{constructor(e){this.http=e,this.chat=new kT(e),this.images=new ET(e),this.embeddings=new xT(e)}},kT=class{constructor(e){this.completions=new ST(e)}},ST=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(`
|
|
2043
|
-
`);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()}}},xT=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}}}},ET=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}}}}},PT=class Wv{constructor(t,r){this.http=t,this.functionsUrl=r||Wv.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}}}},Cg=1e4,CT=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=yl(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 ${Cg}ms`)))},Cg),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)}},TT=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))}}}},RT=class{constructor(e={}){const t=new Hv(e.debug);this.http=new lT(e,t),this.tokenManager=new dT,e.edgeFunctionToken&&(this.http.setAuthToken(e.edgeFunctionToken),this.tokenManager.setAccessToken(e.edgeFunctionToken)),this.auth=new gT(this.http,this.tokenManager,{isServerMode:e.isServerMode??!1}),this.database=new vT(this.http,this.tokenManager),this.storage=new _T(this.http),this.ai=new bT(this.http),this.functions=new PT(this.http,e.functionsUrl),this.realtime=new CT(this.http.baseUrl,this.tokenManager,e.anonKey),this.emails=new TT(this.http)}getHttpClient(){return this.http}};function Zv(e){return new RT(e)}const LT={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.2.24"},Tg=15e3,AT=1e3,$T=3e4;function NT({env:e}={}){const r=DT(e??(typeof import.meta<"u"?LT:void 0),["VITE_VIBEUSAGE_HTTP_TIMEOUT_MS"]);if(r==null||r==="")return Tg;const i=Number(r);return Number.isFinite(i)?i<=0?0:IT(i,AT,$T):Tg}function OT(e,{env:t}={}){if(e)return async(r,i={})=>{const a=NT({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=MT(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 MT(e){if(!e||typeof e!="object")return null;const t=e.signal;return t&&typeof t=="object"?t:null}function IT(e,t,r){const i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(t,Math.floor(i))):t}function DT(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",Rg="insforge-auth-token",Kv=1,zT=360*60*1e3;function Yv(e){if(!e||typeof e!="object")return null;const t=e.tokenManager;return!t||typeof t!="object"?null:t}function UT(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 FT(e){if(typeof e!="string"||e.length===0)return null;const t=e.split(".");if(t.length<2)return null;const r=UT(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 Lg(e){const t=Date.now(),r=FT(e)??t+zT;return JSON.stringify({v:Kv,token:e,expiresAt:r})}function Wc(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===Kv&&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 ni(e,t,r){if(!e)return!1;try{return e.setItem(Cl(t),r),!0}catch{return!1}}function Ag(e,t){if(e)try{e.removeItem(Cl(t))}catch{}}function gf(){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 Gv(){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===Rg,m=x=>{if(!p)return;const E=Lg(x);ni(a,i,E),ni(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=Wc(v);return x.token?(x.shouldMigrate&&m(x.token),x.token):null}const _=g(l,f);if(_!==null){if(e.set(i,_),!p)return ni(a,i,_),_;const x=Wc(_);return x.token?(x.shouldMigrate?m(x.token):ni(a,i,_),x.token):null}const k=e.get(i);if(k===void 0)return null;if(!p)return k;const C=Wc(k);return C.token?(C.shouldMigrate&&m(C.token),C.token):null},setItem(i,a){const l=i===Rg?Lg(a):a;e.set(i,l);const c=t();c&&ni(c,i,l);const f=r();f&&ni(f,i,l)},removeItem(i){e.delete(i);const a=t();Ag(a,i);const l=r();Ag(l,i)}}}function b4({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=xv(),l=OT(globalThis.fetch);return Zv({baseUrl:i,anonKey:a||void 0,edgeFunctionToken:t||void 0,storage:Gv(),fetch:l})}function jT(){const e=lf(),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=xv(),a=Zv({baseUrl:r,anonKey:i||void 0,storage:Gv()});return HT(a),BT(a),a}function Jv(e,t){if(!t?.accessToken)return;const r=Yv(e);!r||typeof r.saveSession!="function"||(typeof r.setStorageMode=="function"&&r.setStorageMode(),r.saveSession(t))}function BT(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 Jv(e,c?.data?.session??null),c},i[r]=!0}function HT(e){try{const t=Yv(e);if(!t||typeof t.setStorageMode!="function")return;t.setStorageMode(),typeof t.getSession=="function"&&Jv(e,t.getSession())}catch{}}const Zr=jT();function k4(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function S4(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 Qv(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 x4({timeZone:e,offsetMinutes:t}={}){const r=Qv(t);return e&&e!=="UTC"?`${e} (${r})`:r}function E4({timeZone:e,offsetMinutes:t}={}){return Number.isFinite(t)?Qv(t):e||"UTC"}function P4({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 WT(a)}return ZT(i)}function VT({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 C4({timeZone:e,offsetMinutes:t}={}){return e?`tz:${e}`:typeof t=="number"&&Number.isFinite(t)?`offset:${Math.trunc(t)}`:"utc"}function WT(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 ZT(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 qT(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 KT(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 YT(e,{timeZone:t,offsetMinutes:r,now:i}={}){const a=i instanceof Date&&Number.isFinite(i.getTime())?i:new Date,l=VT({timeZone:t,offsetMinutes:r,date:a});if(!l){const p=Yn(new Date);return{from:p,to:p}}const c=KT(l),f=qT(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 YT("week")}function T4(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 R4(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,C)=>{const x=k.toFixed(p),E=Number(x).toString();return`${c}${E}${C}`},g=(k,C,x)=>{const E=k.toFixed(p),z=Number(E);return x&&z>=1e3?m(z/1e3,x):`${c}${z.toString()}${C}`};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 Xv(e){const t=Number(String(e));return Number.isFinite(t)?t:null}function L4(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 Tl(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 ho(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function GT(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 Zc(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 JT(e){return e<=0?0:e>=4?4:e}function e0({weeks:e=52,now:t,weekStartsOn:r="sun"}={}){const i=t instanceof Date&&Number.isFinite(t.getTime())?t:new Date,a=Yn(i),l=Tl(a)||new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),c=r==="mon"?1:0,f=l.getUTCDay(),p=ho(l,-((f-c+7)%7)),m=ho(p,-7*(Math.max(1,e)-1));return{from:it(m),to:a}}function QT({dailyRows:e,weeks:t=52,to:r,weekStartsOn:i="sun"}={}){const a=Tl(r)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:l}=e0({weeks:t,now:a,weekStartsOn:i}),c=Tl(l)||ho(a,-(t*7-1)),f=(()=>{const M=(c.getUTCDay()-(i==="mon"?1:0)+7)%7;return ho(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=Xv(I?.billable_total_tokens??I?.total_tokens)??0;p.set(F,Math.max(0,M))}const m=GT(f,a)+1,g=Math.ceil(m/7),v=[];for(let I=0;I<m;I++){const F=ho(f,I),M=it(F),W=p.get(M)??0;W>0&&v.push(W)}v.sort((I,F)=>I-F);const _=Zc(v,.5),k=Zc(v,.75),C=Zc(v,.9);function x(I){return!I||I<=0?0:I<=_?1:I<=k?2:I<=C?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=ho(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:JT(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:C}}}function XT({dailyRows:e,to:t}={}){const r=Tl(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=Xv(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(ho(r,-l));if((i.get(c)??0)>0){a+=1;continue}break}return a}const Hl={},t0="vibeusage",e3=["victorgpt/vibeusage","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],$g=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function n0(){if(typeof import.meta<"u"&&Hl){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 t3(){if(typeof import.meta<"u"&&Hl){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 n3(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 A4(){return n0()?n3(t3()):null}function r3(){if(typeof import.meta<"u"&&Hl){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 t0}function o3(){if(typeof import.meta<"u"&&Hl){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 za(e){return(e==null?r3():String(e)).trim()||t0}function Ua(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 Ta(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function r0(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function i3(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}`}function fi({from:e,to:t,seed:r}){const i=Ht(Yn(new Date))||new Date,a=Ht(e)||i,l=Ht(t)||a,c=[],f=za(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=Ta(a,m),v=it(g),_=Ua(`${f}:${v}`),k=_%1e3/1e3,C=.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*C*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 a3({day:e,seed:t}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=za(t),l=Array.from({length:48},(f,p)=>{const m=Math.floor(p/2),g=p%2===0?0:30,_=Ua(`${a}:${i}:${m}:${g}`)%1e3/1e3,k=(m+g/60)/24,C=.4+.6*Math.sin(k*Math.PI*2),x=900+Math.round(700*_),E=Math.max(0,Math.round(x*C)),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,o3()));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 s3({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=za(r),c=[];for(let f=e-1;f>=0;f-=1){const p=r0(a,-f),m=i3(p),v=Ua(`${l}:${m}`)%1e3/1e3,_=.7+.3*Math.sin(c.length/6*Math.PI*.5),k=36e4+Math.round(2e5*v),C=Math.max(0,Math.round(k*_)),x=Math.round(C*.46),E=Math.round(C*.34),z=Math.round(C*.14),I=Math.max(0,C-x-E-z);c.push({month:m,total_tokens:C,billable_total_tokens:C,input_tokens:x,output_tokens:E,cached_input_tokens:z,reasoning_output_tokens:I})}return c}function yf(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 l3(e,t=1.75){const r=Number(e||0);return!Number.isFinite(r)||r<=0?"0.000000":(r*t/1e6).toFixed(6)}function Ng(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 vd(e){return{...e,total_cost_usd:l3(e.total_tokens)}}function $4({from:e,to:t,seed:r}={}){const i=fi({from:e,to:t,seed:r});return{from:e,to:t,data:i}}function N4({day:e,seed:t}={}){const r=Ht(e)||new Date,i=it(r),a=a3({day:i,seed:t});return{day:i,data:a}}function O4({months:e=24,to:t,seed:r}={}){const i=Ht(t)||Ht(Yn(new Date))||new Date,a=it(i),l=s3({months:e,to:a,seed:r}),c=r0(new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),-(e-1));return{from:it(c),to:a,months:e,data:l}}function M4({from:e,to:t,seed:r,rolling:i=!0}={}){const a=fi({from:e,to:t,seed:r}),l=yf(a),c=vd(l),f=i?u3({to:t,seed:r}):null;return{from:e,to:t,days:a.length,totals:c,...f?{rolling:f}:{}}}function u3({to:e,seed:t}={}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=it(Ta(r,-6)),l=it(Ta(r,-29)),c=fi({from:a,to:i,seed:t}),f=fi({from:l,to:i,seed:t});return{last_7d:Og({rows:c,from:a,to:i}),last_30d:Og({rows:f,from:l,to:i})}}function Og({rows:e,from:t,to:r}={}){const i=yf(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 I4({seed:e,limit:t=3}={}){const r=za(e),i=e3.map((a,l)=>{const f=12e4+Ua(`${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 c3(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(Ta(t,-i)),l=it(Ta(t,-i+6));return{from:a,to:l}}function D4({seed:e,period:t,metric:r,limit:i=20,offset:a=0}={}){const l=za(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:_}=c3(g),k=250,C=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=$g[fe%$g.length],je=18e4+Ua(`${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:C,entries:O,me:W}}function z4({weeks:e=52,to:t,weekStartsOn:r="sun",seed:i}={}){const a=e0({weeks:e,now:Ht(t)||Ht(Yn(new Date))||new Date,weekStartsOn:r}),l=fi({from:a.from,to:a.to,seed:i});return{...QT({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:XT({dailyRows:l,to:a.to})}}function U4({from:e,to:t,seed:r}={}){const i=fi({from:e,to:t,seed:r}),a=yf(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=Ng(a,f.weight),m=f.models.map(g=>{const v=Ng(p,g.weight);return{model:g.model,model_id:g.model_id||g.model,totals:vd(v)}});return{source:f.source,totals:vd(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 o0(){return typeof window>"u"?null:window.localStorage||null}function i0(){return typeof navigator>"u"?null:navigator.clipboard||null}function d3(){return typeof window>"u"?null:window.ClipboardItem||null}function Ra(e,{storage:t}={}){const r=t??o0();if(!r||typeof r.getItem!="function")return null;try{return r.getItem(e)}catch{return null}}function wd(e,t,{storage:r}={}){const i=r??o0();if(!i||typeof i.setItem!="function")return!1;try{return i.setItem(e,t),!0}catch{return!1}}async function a0(e,{clipboard:t}={}){const r=t??i0();if(!r||typeof r.writeText!="function")return!1;try{return await r.writeText(e),!0}catch{return!1}}async function F4(e,{clipboard:t}={}){const r=t??i0(),i=d3();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 vf="vibeusage.latest_tracker_version",s0="vibeusage.latest_tracker_version_at",f3=360*60*1e3,h3="https://registry.npmjs.org/vibeusage/latest";function wf(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function p3(e){const t=Ra(vf);if(!wf(t))return null;const r=Ra(s0),i=Number(r);return!Number.isFinite(i)||e-i>f3?null:t}function ol(){const e=Ra(vf);return wf(e)?e:null}function m3(e,t){wd(vf,e),wd(s0,String(t))}async function g3({allowStale:e=!0}={}){const t=Date.now(),r=p3(t);if(r)return r;if(typeof fetch!="function")return e?ol():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(h3,{headers:{accept:"application/json"},signal:a?.signal});if(!f.ok)return e?ol():null;const p=await f.json(),m=typeof p?.version=="string"?p.version:"";return wf(m)?(m3(m,t),m):e?ol():null}catch{return e?ol():null}finally{i&&c(i)}}function _f(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 y3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}const Mg=({text:e="",className:t=""})=>{const[r,i]=b.useState(()=>String(e||"")),a=y3(),l=b.useMemo(()=>typeof window>"u"?!1:_f(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,C)=>C<p?_[C]: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 v3({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(Pa,{className:m,...l,children:t});const g=l.role;return A.jsx(Pa,{className:m,...l,nativeButton:!1,render:v=>{const{children:_,role:k,...C}=v,x=e==="a"&&g===void 0?void 0:k;return A.jsx(e,{...C,role:x,children:_})},children:t})}function w3({prefersReducedMotion:e,screenshotCapture:t}){return!(t||e)}const _3=({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"));w3({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:`
|
|
2043
|
+
`);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()}}},xT=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}}}},ET=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}}}}},PT=class Wv{constructor(t,r){this.http=t,this.functionsUrl=r||Wv.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}}}},Cg=1e4,CT=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=yl(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 ${Cg}ms`)))},Cg),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)}},TT=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))}}}},RT=class{constructor(e={}){const t=new Hv(e.debug);this.http=new lT(e,t),this.tokenManager=new dT,e.edgeFunctionToken&&(this.http.setAuthToken(e.edgeFunctionToken),this.tokenManager.setAccessToken(e.edgeFunctionToken)),this.auth=new gT(this.http,this.tokenManager,{isServerMode:e.isServerMode??!1}),this.database=new vT(this.http,this.tokenManager),this.storage=new _T(this.http),this.ai=new bT(this.http),this.functions=new PT(this.http,e.functionsUrl),this.realtime=new CT(this.http.baseUrl,this.tokenManager,e.anonKey),this.emails=new TT(this.http)}getHttpClient(){return this.http}};function Zv(e){return new RT(e)}const LT={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.2.25"},Tg=15e3,AT=1e3,$T=3e4;function NT({env:e}={}){const r=DT(e??(typeof import.meta<"u"?LT:void 0),["VITE_VIBEUSAGE_HTTP_TIMEOUT_MS"]);if(r==null||r==="")return Tg;const i=Number(r);return Number.isFinite(i)?i<=0?0:IT(i,AT,$T):Tg}function OT(e,{env:t}={}){if(e)return async(r,i={})=>{const a=NT({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=MT(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 MT(e){if(!e||typeof e!="object")return null;const t=e.signal;return t&&typeof t=="object"?t:null}function IT(e,t,r){const i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(t,Math.floor(i))):t}function DT(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",Rg="insforge-auth-token",Kv=1,zT=360*60*1e3;function Yv(e){if(!e||typeof e!="object")return null;const t=e.tokenManager;return!t||typeof t!="object"?null:t}function UT(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 FT(e){if(typeof e!="string"||e.length===0)return null;const t=e.split(".");if(t.length<2)return null;const r=UT(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 Lg(e){const t=Date.now(),r=FT(e)??t+zT;return JSON.stringify({v:Kv,token:e,expiresAt:r})}function Wc(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===Kv&&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 ni(e,t,r){if(!e)return!1;try{return e.setItem(Cl(t),r),!0}catch{return!1}}function Ag(e,t){if(e)try{e.removeItem(Cl(t))}catch{}}function gf(){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 Gv(){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===Rg,m=x=>{if(!p)return;const E=Lg(x);ni(a,i,E),ni(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=Wc(v);return x.token?(x.shouldMigrate&&m(x.token),x.token):null}const _=g(l,f);if(_!==null){if(e.set(i,_),!p)return ni(a,i,_),_;const x=Wc(_);return x.token?(x.shouldMigrate?m(x.token):ni(a,i,_),x.token):null}const k=e.get(i);if(k===void 0)return null;if(!p)return k;const C=Wc(k);return C.token?(C.shouldMigrate&&m(C.token),C.token):null},setItem(i,a){const l=i===Rg?Lg(a):a;e.set(i,l);const c=t();c&&ni(c,i,l);const f=r();f&&ni(f,i,l)},removeItem(i){e.delete(i);const a=t();Ag(a,i);const l=r();Ag(l,i)}}}function b4({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=xv(),l=OT(globalThis.fetch);return Zv({baseUrl:i,anonKey:a||void 0,edgeFunctionToken:t||void 0,storage:Gv(),fetch:l})}function jT(){const e=lf(),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=xv(),a=Zv({baseUrl:r,anonKey:i||void 0,storage:Gv()});return HT(a),BT(a),a}function Jv(e,t){if(!t?.accessToken)return;const r=Yv(e);!r||typeof r.saveSession!="function"||(typeof r.setStorageMode=="function"&&r.setStorageMode(),r.saveSession(t))}function BT(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 Jv(e,c?.data?.session??null),c},i[r]=!0}function HT(e){try{const t=Yv(e);if(!t||typeof t.setStorageMode!="function")return;t.setStorageMode(),typeof t.getSession=="function"&&Jv(e,t.getSession())}catch{}}const Zr=jT();function k4(){if(typeof Intl>"u"||!Intl.DateTimeFormat)return null;try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function S4(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 Qv(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 x4({timeZone:e,offsetMinutes:t}={}){const r=Qv(t);return e&&e!=="UTC"?`${e} (${r})`:r}function E4({timeZone:e,offsetMinutes:t}={}){return Number.isFinite(t)?Qv(t):e||"UTC"}function P4({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 WT(a)}return ZT(i)}function VT({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 C4({timeZone:e,offsetMinutes:t}={}){return e?`tz:${e}`:typeof t=="number"&&Number.isFinite(t)?`offset:${Math.trunc(t)}`:"utc"}function WT(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 ZT(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 qT(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 KT(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 YT(e,{timeZone:t,offsetMinutes:r,now:i}={}){const a=i instanceof Date&&Number.isFinite(i.getTime())?i:new Date,l=VT({timeZone:t,offsetMinutes:r,date:a});if(!l){const p=Yn(new Date);return{from:p,to:p}}const c=KT(l),f=qT(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 YT("week")}function T4(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 R4(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,C)=>{const x=k.toFixed(p),E=Number(x).toString();return`${c}${E}${C}`},g=(k,C,x)=>{const E=k.toFixed(p),z=Number(E);return x&&z>=1e3?m(z/1e3,x):`${c}${z.toString()}${C}`};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 Xv(e){const t=Number(String(e));return Number.isFinite(t)?t:null}function L4(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 Tl(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 ho(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function GT(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 Zc(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 JT(e){return e<=0?0:e>=4?4:e}function e0({weeks:e=52,now:t,weekStartsOn:r="sun"}={}){const i=t instanceof Date&&Number.isFinite(t.getTime())?t:new Date,a=Yn(i),l=Tl(a)||new Date(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate())),c=r==="mon"?1:0,f=l.getUTCDay(),p=ho(l,-((f-c+7)%7)),m=ho(p,-7*(Math.max(1,e)-1));return{from:it(m),to:a}}function QT({dailyRows:e,weeks:t=52,to:r,weekStartsOn:i="sun"}={}){const a=Tl(r)||new Date(Date.UTC(new Date().getFullYear(),new Date().getMonth(),new Date().getDate())),{from:l}=e0({weeks:t,now:a,weekStartsOn:i}),c=Tl(l)||ho(a,-(t*7-1)),f=(()=>{const M=(c.getUTCDay()-(i==="mon"?1:0)+7)%7;return ho(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=Xv(I?.billable_total_tokens??I?.total_tokens)??0;p.set(F,Math.max(0,M))}const m=GT(f,a)+1,g=Math.ceil(m/7),v=[];for(let I=0;I<m;I++){const F=ho(f,I),M=it(F),W=p.get(M)??0;W>0&&v.push(W)}v.sort((I,F)=>I-F);const _=Zc(v,.5),k=Zc(v,.75),C=Zc(v,.9);function x(I){return!I||I<=0?0:I<=_?1:I<=k?2:I<=C?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=ho(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:JT(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:C}}}function XT({dailyRows:e,to:t}={}){const r=Tl(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=Xv(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(ho(r,-l));if((i.get(c)??0)>0){a+=1;continue}break}return a}const Hl={},t0="vibeusage",e3=["victorgpt/vibeusage","spacedriveapp/spacedrive","acme/alpha","acme/beta","neo/nebula","signal/flux","matrix/terminal","orbit/atlas","lumen/core","delta/horizon"],$g=["NEO","TRINITY","MORPHEUS","ORACLE","CYPHER","SWITCH","APOC","TANK","SMITH","SERAPH","NIOBE","MOUSE","DOZER","LINK","BLADE"];function n0(){if(typeof import.meta<"u"&&Hl){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 t3(){if(typeof import.meta<"u"&&Hl){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 n3(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 A4(){return n0()?n3(t3()):null}function r3(){if(typeof import.meta<"u"&&Hl){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 t0}function o3(){if(typeof import.meta<"u"&&Hl){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 za(e){return(e==null?r3():String(e)).trim()||t0}function Ua(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 Ta(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function r0(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1))}function i3(e){return`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}`}function fi({from:e,to:t,seed:r}){const i=Ht(Yn(new Date))||new Date,a=Ht(e)||i,l=Ht(t)||a,c=[],f=za(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=Ta(a,m),v=it(g),_=Ua(`${f}:${v}`),k=_%1e3/1e3,C=.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*C*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 a3({day:e,seed:t}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=za(t),l=Array.from({length:48},(f,p)=>{const m=Math.floor(p/2),g=p%2===0?0:30,_=Ua(`${a}:${i}:${m}:${g}`)%1e3/1e3,k=(m+g/60)/24,C=.4+.6*Math.sin(k*Math.PI*2),x=900+Math.round(700*_),E=Math.max(0,Math.round(x*C)),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,o3()));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 s3({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=za(r),c=[];for(let f=e-1;f>=0;f-=1){const p=r0(a,-f),m=i3(p),v=Ua(`${l}:${m}`)%1e3/1e3,_=.7+.3*Math.sin(c.length/6*Math.PI*.5),k=36e4+Math.round(2e5*v),C=Math.max(0,Math.round(k*_)),x=Math.round(C*.46),E=Math.round(C*.34),z=Math.round(C*.14),I=Math.max(0,C-x-E-z);c.push({month:m,total_tokens:C,billable_total_tokens:C,input_tokens:x,output_tokens:E,cached_input_tokens:z,reasoning_output_tokens:I})}return c}function yf(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 l3(e,t=1.75){const r=Number(e||0);return!Number.isFinite(r)||r<=0?"0.000000":(r*t/1e6).toFixed(6)}function Ng(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 vd(e){return{...e,total_cost_usd:l3(e.total_tokens)}}function $4({from:e,to:t,seed:r}={}){const i=fi({from:e,to:t,seed:r});return{from:e,to:t,data:i}}function N4({day:e,seed:t}={}){const r=Ht(e)||new Date,i=it(r),a=a3({day:i,seed:t});return{day:i,data:a}}function O4({months:e=24,to:t,seed:r}={}){const i=Ht(t)||Ht(Yn(new Date))||new Date,a=it(i),l=s3({months:e,to:a,seed:r}),c=r0(new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1)),-(e-1));return{from:it(c),to:a,months:e,data:l}}function M4({from:e,to:t,seed:r,rolling:i=!0}={}){const a=fi({from:e,to:t,seed:r}),l=yf(a),c=vd(l),f=i?u3({to:t,seed:r}):null;return{from:e,to:t,days:a.length,totals:c,...f?{rolling:f}:{}}}function u3({to:e,seed:t}={}){const r=Ht(e)||Ht(Yn(new Date))||new Date,i=it(r),a=it(Ta(r,-6)),l=it(Ta(r,-29)),c=fi({from:a,to:i,seed:t}),f=fi({from:l,to:i,seed:t});return{last_7d:Og({rows:c,from:a,to:i}),last_30d:Og({rows:f,from:l,to:i})}}function Og({rows:e,from:t,to:r}={}){const i=yf(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 I4({seed:e,limit:t=3}={}){const r=za(e),i=e3.map((a,l)=>{const f=12e4+Ua(`${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 c3(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(Ta(t,-i)),l=it(Ta(t,-i+6));return{from:a,to:l}}function D4({seed:e,period:t,metric:r,limit:i=20,offset:a=0}={}){const l=za(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:_}=c3(g),k=250,C=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=$g[fe%$g.length],je=18e4+Ua(`${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:C,entries:O,me:W}}function z4({weeks:e=52,to:t,weekStartsOn:r="sun",seed:i}={}){const a=e0({weeks:e,now:Ht(t)||Ht(Yn(new Date))||new Date,weekStartsOn:r}),l=fi({from:a.from,to:a.to,seed:i});return{...QT({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:XT({dailyRows:l,to:a.to})}}function U4({from:e,to:t,seed:r}={}){const i=fi({from:e,to:t,seed:r}),a=yf(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=Ng(a,f.weight),m=f.models.map(g=>{const v=Ng(p,g.weight);return{model:g.model,model_id:g.model_id||g.model,totals:vd(v)}});return{source:f.source,totals:vd(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 o0(){return typeof window>"u"?null:window.localStorage||null}function i0(){return typeof navigator>"u"?null:navigator.clipboard||null}function d3(){return typeof window>"u"?null:window.ClipboardItem||null}function Ra(e,{storage:t}={}){const r=t??o0();if(!r||typeof r.getItem!="function")return null;try{return r.getItem(e)}catch{return null}}function wd(e,t,{storage:r}={}){const i=r??o0();if(!i||typeof i.setItem!="function")return!1;try{return i.setItem(e,t),!0}catch{return!1}}async function a0(e,{clipboard:t}={}){const r=t??i0();if(!r||typeof r.writeText!="function")return!1;try{return await r.writeText(e),!0}catch{return!1}}async function F4(e,{clipboard:t}={}){const r=t??i0(),i=d3();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 vf="vibeusage.latest_tracker_version",s0="vibeusage.latest_tracker_version_at",f3=360*60*1e3,h3="https://registry.npmjs.org/vibeusage/latest";function wf(e){return typeof e=="string"&&/^\d+\.\d+\.\d+/.test(e)}function p3(e){const t=Ra(vf);if(!wf(t))return null;const r=Ra(s0),i=Number(r);return!Number.isFinite(i)||e-i>f3?null:t}function ol(){const e=Ra(vf);return wf(e)?e:null}function m3(e,t){wd(vf,e),wd(s0,String(t))}async function g3({allowStale:e=!0}={}){const t=Date.now(),r=p3(t);if(r)return r;if(typeof fetch!="function")return e?ol():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(h3,{headers:{accept:"application/json"},signal:a?.signal});if(!f.ok)return e?ol():null;const p=await f.json(),m=typeof p?.version=="string"?p.version:"";return wf(m)?(m3(m,t),m):e?ol():null}catch{return e?ol():null}finally{i&&c(i)}}function _f(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 y3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}const Mg=({text:e="",className:t=""})=>{const[r,i]=b.useState(()=>String(e||"")),a=y3(),l=b.useMemo(()=>typeof window>"u"?!1:_f(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,C)=>C<p?_[C]: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 v3({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(Pa,{className:m,...l,children:t});const g=l.role;return A.jsx(Pa,{className:m,...l,nativeButton:!1,render:v=>{const{children:_,role:k,...C}=v,x=e==="a"&&g===void 0?void 0:k;return A.jsx(e,{...C,role:x,children:_})},children:t})}function w3({prefersReducedMotion:e,screenshotCapture:t}){return!(t||e)}const _3=({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"));w3({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:`
|
|
2044
2044
|
@keyframes scanner {
|
|
2045
2045
|
0% { transform: translateY(0); }
|
|
2046
2046
|
100% { transform: translateY(44px); }
|
|
2047
2047
|
}
|
|
2048
|
-
`})]})};function b3({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 k3({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 S3({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 x3({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 E3({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 P3=[{id:"codex",name:"Codex",Icon:b3},{id:"claude",name:"Claude Code",Icon:k3},{id:"gemini",name:"Gemini",Icon:S3},{id:"opencode",name:"OpenCode",Icon:x3},{id:"openclaw",name:"OpenClaw",Icon:E3}];function C3({className:e=""}){return A.jsx("div",{className:`flex flex-wrap items-center justify-center gap-3 ${e}`,children:P3.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 T3=qr.lazy(()=>Da(()=>import("./MatrixRain-hFJ62iN5.js"),[]).then(e=>({default:e.MatrixRain}))),R3=qr.lazy(()=>Da(()=>import("./LandingExtras-C6oIZxN4.js"),[]).then(e=>({default:e.LandingExtras})));function il({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 Ig({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 L3({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[C,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(T3,{})}):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(_3,{isFixed:!1,size:"header"}),A.jsx(v3,{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(Mg,{text:e("landing.hero.title_primary")})," ",A.jsx("br",{}),A.jsx("span",{className:"text-[#00FF41]",children:A.jsx(Mg,{text:e("landing.hero.title_secondary")})})]}),A.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[A.jsx(C3,{}),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(R3,{handle:c,onHandleChange:f,specialHandle:p,handlePlaceholder:m,rankLabel:g})}):z,A.jsx(il,{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(Ig,{command:e("landing.ai_agent.command"),copied:C,onCopy:E,helper:e("landing.ai_agent.helper")})]})}),A.jsx(il,{className:"w-full max-w-2xl",header:"Quick Install",children:A.jsx(Ig,{command:v,copied:_,onCopy:k,label:e("landing.install.prompt"),helper:e("landing.install.helper")})}),A.jsx(il,{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(il,{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:`
|
|
2048
|
+
`})]})};function b3({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 k3({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 S3({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 x3({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 E3({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 P3=[{id:"codex",name:"Codex",Icon:b3},{id:"claude",name:"Claude Code",Icon:k3},{id:"gemini",name:"Gemini",Icon:S3},{id:"opencode",name:"OpenCode",Icon:x3},{id:"openclaw",name:"OpenClaw",Icon:E3}];function C3({className:e=""}){return A.jsx("div",{className:`flex flex-wrap items-center justify-center gap-3 ${e}`,children:P3.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 T3=qr.lazy(()=>Da(()=>import("./MatrixRain-DR9XEe-r.js"),[]).then(e=>({default:e.MatrixRain}))),R3=qr.lazy(()=>Da(()=>import("./LandingExtras-7PDallbH.js"),[]).then(e=>({default:e.LandingExtras})));function il({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 Ig({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 L3({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[C,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(T3,{})}):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(_3,{isFixed:!1,size:"header"}),A.jsx(v3,{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(Mg,{text:e("landing.hero.title_primary")})," ",A.jsx("br",{}),A.jsx("span",{className:"text-[#00FF41]",children:A.jsx(Mg,{text:e("landing.hero.title_secondary")})})]}),A.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[A.jsx(C3,{}),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(R3,{handle:c,onHandleChange:f,specialHandle:p,handlePlaceholder:m,rankLabel:g})}):z,A.jsx(il,{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(Ig,{command:e("landing.ai_agent.command"),copied:C,onCopy:E,helper:e("landing.ai_agent.helper")})]})}),A.jsx(il,{className:"w-full max-w-2xl",header:"Quick Install",children:A.jsx(Ig,{command:v,copied:_,onCopy:k,label:e("landing.install.prompt"),helper:e("landing.install.helper")})}),A.jsx(il,{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(il,{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:`
|
|
2049
2049
|
@keyframes scan {
|
|
2050
2050
|
0% { transform: translateX(-100%); }
|
|
2051
2051
|
100% { transform: translateX(100%); }
|
|
@@ -2053,4 +2053,4 @@ live_sniffer.event.capture,ui,LiveSniffer,LiveSniffer,event,"> CAPTURE: +128 NEU
|
|
|
2053
2053
|
.animate-scan {
|
|
2054
2054
|
animation: scan 3s linear infinite;
|
|
2055
2055
|
}
|
|
2056
|
-
`})]})}function A3({prefersReducedMotion:e,screenshotMode:t}){return!(t||e)}function $3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function N3(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 O3({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=$3(),m=b.useMemo(()=>typeof window>"u"?!1:_f(window.location.search),[]),g=A3({prefersReducedMotion:p,screenshotMode:m}),v=N3(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]),C=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 a0(x)&&(z(!0),window.setTimeout(()=>z(!1),2e3))};return A.jsx(L3,{copy:ot,effectsReady:v,signInUrl:e,signUpUrl:t,loginLabel:a,signupLabel:l,handle:c,onHandleChange:I,specialHandle:r,handlePlaceholder:k,rankLabel:C,installCommand:x,installCopied:E,onCopyInstallCommand:F})}let Dg=(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 M3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},I3={valid(e){return e===null?null:e?{[Dg.valid]:""}:{[Dg.invalid]:""}}},D3=b.createContext({invalid:void 0,name:void 0,validityData:{state:M3,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 _d(e=!0){const t=b.useContext(D3);if(t.setValidityData===Nn&&!e)throw new Error(ef(28));return t}const z3=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Nn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function U3(){return b.useContext(z3)}const F3={...kd};let zg=0;function j3(e,t="mui"){const[r,i]=b.useState(e),a=e||r;return b.useEffect(()=>{r==null&&(zg+=1,i(`${t}-${zg}`))},[r,t]),a}const Ug=F3.useId;function B3(e,t){if(Ug!==void 0){const r=Ug();return e??(t?`${t}-${r}`:r)}return j3(e,t)}function H3(e){return B3(e,"base-ui")}const V3=b.createContext({controlId:void 0,setControlId:Nn,labelId:void 0,setLabelId:Nn,messageIds:[],setMessageIds:Nn,getDescriptionProps:e=>e});function l0(){return b.useContext(V3)}function W3(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Z3({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 q3(e={}){const{id:t,implicit:r=!1,controlRef:i}=e,{controlId:a,setControlId:l}=l0(),c=H3(t);return li(()=>{if(!(!r&&!t||l===Nn)){if(r){const f=i?.current;U2(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 K3(e){const{enabled:t=!0,value:r,id:i,name:a,controlRef:l,commit:c}=e,{formRef:f}=U3(),{invalid:p,markedDirtyRef:m,validityData:g,setValidityData:v}=_d(),_=Sl(e.getValue);li(()=>{if(!t)return;let k=r;k===void 0&&(k=_()),g.initialValue===null&&k!==null&&v(C=>({...C,initialValue:k}))},[t,v,r,g.initialValue,_]),li(()=>{!t||!i||f.current.fields.set(i,{getValue:_,name:a,controlRef:l,validityData:W3(g,p),validate(k=!0){let C=r;C===void 0&&(C=_()),m.current=!0,k?dy.flushSync(()=>c(C)):c(C)}})},[c,l,t,f,_,i,p,m,a,g,r]),li(()=>{const k=f.current.fields;return()=>{i&&k.delete(i)}},[f,i])}const Y3="none",j4="trigger-press",B4="trigger-hover",H4="outside-press",V4="close-press",W4="focus-out",Z4="escape-key",q4="imperative-action";function G3(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 J3=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:C}=_d(),x=C||p,E=k??c,z=b.useMemo(()=>({..._,disabled:x}),[_,x]),{setTouched:I,setDirty:F,validityData:M,setFocused:W,setFilled:O,validationMode:H,validation:R}=_d(),{labelId:fe}=l0(),me=q3({id:l});li(()=>{const ce=f!=null;R.inputRef.current?.value||ce&&f!==""?O(!0):ce&&f===""&&O(!1)},[R.inputRef,O,f]);const[$e,Te]=Z3({controlled:f,default:g,name:"FieldControl",state:"value"}),je=f!==void 0,Pe=Sl((ce,_e)=>{m?.(ce,_e),!_e.isCanceled&&Te(ce)});return K3({id:me,name:E,commit:R.commit,value:$e,getValue:()=>R.inputRef.current?.value,controlRef:R.inputRef}),mv("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,G3(Y3,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:I3})}),Q3=b.forwardRef(function(t,r){return A.jsx(J3,{ref:r,...t})});function X3({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"),[C,x]=b.useState(!1),E=b.useMemo(()=>a?`vibeusage_upgrade_dismissed_${i}`:l,[a,i,l]),[z,I]=b.useState(()=>typeof window>"u"?!0:!Ra(E)),F=b.useRef(null);if(b.useEffect(()=>{if(typeof window>"u")return;const O=Ra(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 a0(c)&&(x(!0),setTimeout(()=>x(!1),2e3))},W=()=>{wd(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(Q3,{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(Pa,{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:C?_:v})]})}),A.jsx("div",{className:"flex items-center space-x-4",children:A.jsx(Pa,{onClick:W,className:"text-caption font-black uppercase text-gold/40 hover:text-gold transition-all tracking-[0.2em]",children:k})})]})]})}function Fg(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 e4=qr.lazy(()=>Da(()=>import("./DashboardPage-BNW-6Myn.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DashboardPage}))),t4=qr.lazy(()=>Da(()=>import("./LeaderboardPage-CdAHOBHv.js"),__vite__mapDeps([2,3,1,4])).then(e=>({default:e.LeaderboardPage}))),n4=qr.lazy(()=>Da(()=>import("./LeaderboardProfilePage-CPBD0FCr.js"),__vite__mapDeps([5,3,1,4])).then(e=>({default:e.LeaderboardProfilePage})));function r4(){const e=qn(),t=Ma(),r=b.useMemo(()=>lf(),[]),{isLoaded:i,isSignedIn:a,signOut:l}=ix(),c=n0(),f=b.useMemo(()=>typeof window>"u"?!1:_f(window.location.search),[]),[p,m]=b.useState(null),[g,v]=b.useState(),[_,k]=b.useState(()=>bv()),[C,x]=b.useState(()=>kv());b.useEffect(()=>{let xe=!0;return g3({allowStale:!0}).then(Ye=>{xe&&m(Ye)}),()=>{xe=!1}},[]),b.useEffect(()=>{if(typeof window>"u")return;const{saved:xe}=rf(window.location.search);if(!xe)return;const Ye=nf(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(()=>KP(xe=>{k(!!xe)}),[]),b.useEffect(()=>YP(xe=>{x(!!xe)}),[]),b.useEffect(()=>{i&&(g?.accessToken&&!Go(g.accessToken)||C&&ya())},[i,g,C]);const E=b.useCallback(async()=>{const xe=Go(g?.accessToken)?null:g?.accessToken??null;if(!a)return xe;const{data:Ye}=await Zr.auth.getCurrentSession(),_t=Ye?.session?.accessToken??null;return Go(_t)?xe:_t},[g,a]);b.useEffect(()=>{if(!C)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&&ya()}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,C]);const z=b.useMemo(()=>{const xe=g?.accessToken??null;if(!xe||Go(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||Go(xe)||_)return;const Ye=VP(window.location.search);if(Ye){const Mn=g.user,en=Mn?.profile?.name??Mn?.name??null;I.current=!0;const vo=HP(Ye,{accessToken:xe,userId:Mn?.id??null,email:Mn?.email??null,name:en});window.location.assign(vo);return}if((window.location.pathname.replace(/\/+$/,"")||"/")!=="/auth/callback")return;const Ne=WP(),bt=Ne&&Ne!=="/auth/callback"?Ne:"/";I.current=!0,t(bt,{replace:!0})},[g,t,_]);const F=!!(g?.accessToken&&!Go(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{gf(),af(),sf(),ya(),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(()=>Fg("/sign-in",_e),[_e]),te=b.useMemo(()=>Fg("/sign-up",_e),[_e]);b.useEffect(()=>{typeof window>"u"||!i||window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||!AP({pathname:window.location.pathname,search:window.location.search,hasSession:!!g?.accessToken,sessionResolved:g!==void 0,storage:SP()})||t(Y,{replace:!0})},[i,g,t,Y]);const ne=A.jsx("div",{className:"min-h-screen bg-[#050505]"}),N=!ce&&!c&&!C&&(!i||g===void 0),V=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),he=IP({publicMode:ce,mockEnabled:c,sessionSoftExpired:C,signedIn:O,authPending:N}),ye=V?"dashboard":he,Le=fe.replace(/\/+$/,"")||"/",Ce=Le.match(/^\/leaderboard\/u\/([^/]+)$/i),Ie=Ce?Ce[1]:null,De=Ie?n4:Le==="/leaderboard"?t4:e4;let ze=null;return ye==="loading"?ze=ne:ye==="landing"?ze=A.jsx(O3,{signInUrl:Y,signUpUrl:te}):ze=A.jsxs(b.Suspense,{fallback:ne,children:[!ce&&!f&&!V?A.jsx(X3,{requiredVersion:p}):null,A.jsx(De,{baseUrl:r,auth:H,signedIn:O,sessionSoftExpired:C,signOut:R,publicMode:ce,publicToken:Se,userId:Ie,signInUrl:Y,signUpUrl:te})]}),A.jsx(kP,{children:A.jsx(MP,{children:ze})})}function o4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function i4(){const e=b.useMemo(()=>o4(),[]),t=Ma();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=rf(window.location.search),{saved:i}=wv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=nf(a);l&&(a=l);const c=vv(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(()=>{}),gf(),af(),sf(),ya();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 a4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function s4(){const e=b.useMemo(()=>a4(),[]),t=Ma();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=rf(window.location.search),{saved:i}=wv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=nf(a);l&&(a=l);const c=vv(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(()=>{}),gf(),af(),sf(),ya();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 l4=lf(),u4="/auth/callback",c4=y2([{path:"/sign-in",element:A.jsx(i4,{})},{path:"/sign-up",element:A.jsx(s4,{})},...N2({baseUrl:l4,afterSignInUrl:u4,builtInAuth:!1}),{path:"*",element:A.jsx(r4,{})}]);M2.createRoot(document.getElementById("root")).render(A.jsx(qr.StrictMode,{children:A.jsx($2,{client:Zr,children:A.jsx(L2,{router:c4})})}));export{k4 as $,av as A,mv as B,ug as C,B4 as D,cr as E,H4 as F,mi as G,j2 as H,Z4 as I,U2 as J,F2 as K,B2 as L,sg as M,Nn as N,j4 as O,d4 as P,Y3 as Q,lv as R,nP as S,$P as T,V4 as U,q4 as V,qr as W,L4 as X,R4 as Y,_f as Z,co as _,sv as a,S4 as a0,A4 as a1,YT as a2,x4 as a3,E4 as a4,T4 as a5,Da as a6,F4 as a7,a0 as a8,qn as a9,Ma as aa,v3 as ab,_3 as ac,D4 as ad,b4 as ae,f4 as af,$4 as ag,M4 as ah,U4 as ai,I4 as aj,N4 as ak,O4 as al,z4 as am,ya as an,Zr as ao,Yn as ap,Mg as aq,Q3 as ar,n0 as b,p4 as c,h4 as d,QT as e,XT as f,e0 as g,C4 as h,ag as i,P4 as j,it as k,ot as l,A as m,li as n,ef as o,bd as p,lP as q,b as r,Sl as s,Xv as t,Xd as u,iv as v,dy as w,G3 as x,W4 as y,B3 as z};
|
|
2056
|
+
`})]})}function A3({prefersReducedMotion:e,screenshotMode:t}){return!(t||e)}function $3(){return b.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function N3(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 O3({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=$3(),m=b.useMemo(()=>typeof window>"u"?!1:_f(window.location.search),[]),g=A3({prefersReducedMotion:p,screenshotMode:m}),v=N3(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]),C=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 a0(x)&&(z(!0),window.setTimeout(()=>z(!1),2e3))};return A.jsx(L3,{copy:ot,effectsReady:v,signInUrl:e,signUpUrl:t,loginLabel:a,signupLabel:l,handle:c,onHandleChange:I,specialHandle:r,handlePlaceholder:k,rankLabel:C,installCommand:x,installCopied:E,onCopyInstallCommand:F})}let Dg=(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 M3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},I3={valid(e){return e===null?null:e?{[Dg.valid]:""}:{[Dg.invalid]:""}}},D3=b.createContext({invalid:void 0,name:void 0,validityData:{state:M3,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 _d(e=!0){const t=b.useContext(D3);if(t.setValidityData===Nn&&!e)throw new Error(ef(28));return t}const z3=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Nn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function U3(){return b.useContext(z3)}const F3={...kd};let zg=0;function j3(e,t="mui"){const[r,i]=b.useState(e),a=e||r;return b.useEffect(()=>{r==null&&(zg+=1,i(`${t}-${zg}`))},[r,t]),a}const Ug=F3.useId;function B3(e,t){if(Ug!==void 0){const r=Ug();return e??(t?`${t}-${r}`:r)}return j3(e,t)}function H3(e){return B3(e,"base-ui")}const V3=b.createContext({controlId:void 0,setControlId:Nn,labelId:void 0,setLabelId:Nn,messageIds:[],setMessageIds:Nn,getDescriptionProps:e=>e});function l0(){return b.useContext(V3)}function W3(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Z3({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 q3(e={}){const{id:t,implicit:r=!1,controlRef:i}=e,{controlId:a,setControlId:l}=l0(),c=H3(t);return li(()=>{if(!(!r&&!t||l===Nn)){if(r){const f=i?.current;U2(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 K3(e){const{enabled:t=!0,value:r,id:i,name:a,controlRef:l,commit:c}=e,{formRef:f}=U3(),{invalid:p,markedDirtyRef:m,validityData:g,setValidityData:v}=_d(),_=Sl(e.getValue);li(()=>{if(!t)return;let k=r;k===void 0&&(k=_()),g.initialValue===null&&k!==null&&v(C=>({...C,initialValue:k}))},[t,v,r,g.initialValue,_]),li(()=>{!t||!i||f.current.fields.set(i,{getValue:_,name:a,controlRef:l,validityData:W3(g,p),validate(k=!0){let C=r;C===void 0&&(C=_()),m.current=!0,k?dy.flushSync(()=>c(C)):c(C)}})},[c,l,t,f,_,i,p,m,a,g,r]),li(()=>{const k=f.current.fields;return()=>{i&&k.delete(i)}},[f,i])}const Y3="none",j4="trigger-press",B4="trigger-hover",H4="outside-press",V4="close-press",W4="focus-out",Z4="escape-key",q4="imperative-action";function G3(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 J3=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:C}=_d(),x=C||p,E=k??c,z=b.useMemo(()=>({..._,disabled:x}),[_,x]),{setTouched:I,setDirty:F,validityData:M,setFocused:W,setFilled:O,validationMode:H,validation:R}=_d(),{labelId:fe}=l0(),me=q3({id:l});li(()=>{const ce=f!=null;R.inputRef.current?.value||ce&&f!==""?O(!0):ce&&f===""&&O(!1)},[R.inputRef,O,f]);const[$e,Te]=Z3({controlled:f,default:g,name:"FieldControl",state:"value"}),je=f!==void 0,Pe=Sl((ce,_e)=>{m?.(ce,_e),!_e.isCanceled&&Te(ce)});return K3({id:me,name:E,commit:R.commit,value:$e,getValue:()=>R.inputRef.current?.value,controlRef:R.inputRef}),mv("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,G3(Y3,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:I3})}),Q3=b.forwardRef(function(t,r){return A.jsx(J3,{ref:r,...t})});function X3({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"),[C,x]=b.useState(!1),E=b.useMemo(()=>a?`vibeusage_upgrade_dismissed_${i}`:l,[a,i,l]),[z,I]=b.useState(()=>typeof window>"u"?!0:!Ra(E)),F=b.useRef(null);if(b.useEffect(()=>{if(typeof window>"u")return;const O=Ra(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 a0(c)&&(x(!0),setTimeout(()=>x(!1),2e3))},W=()=>{wd(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(Q3,{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(Pa,{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:C?_:v})]})}),A.jsx("div",{className:"flex items-center space-x-4",children:A.jsx(Pa,{onClick:W,className:"text-caption font-black uppercase text-gold/40 hover:text-gold transition-all tracking-[0.2em]",children:k})})]})]})}function Fg(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 e4=qr.lazy(()=>Da(()=>import("./DashboardPage-rdYpdfso.js"),__vite__mapDeps([0,1])).then(e=>({default:e.DashboardPage}))),t4=qr.lazy(()=>Da(()=>import("./LeaderboardPage-CU_JeLPO.js"),__vite__mapDeps([2,3,1,4])).then(e=>({default:e.LeaderboardPage}))),n4=qr.lazy(()=>Da(()=>import("./LeaderboardProfilePage-D3B45Jjd.js"),__vite__mapDeps([5,3,1,4])).then(e=>({default:e.LeaderboardProfilePage})));function r4(){const e=qn(),t=Ma(),r=b.useMemo(()=>lf(),[]),{isLoaded:i,isSignedIn:a,signOut:l}=ix(),c=n0(),f=b.useMemo(()=>typeof window>"u"?!1:_f(window.location.search),[]),[p,m]=b.useState(null),[g,v]=b.useState(),[_,k]=b.useState(()=>bv()),[C,x]=b.useState(()=>kv());b.useEffect(()=>{let xe=!0;return g3({allowStale:!0}).then(Ye=>{xe&&m(Ye)}),()=>{xe=!1}},[]),b.useEffect(()=>{if(typeof window>"u")return;const{saved:xe}=rf(window.location.search);if(!xe)return;const Ye=nf(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(()=>KP(xe=>{k(!!xe)}),[]),b.useEffect(()=>YP(xe=>{x(!!xe)}),[]),b.useEffect(()=>{i&&(g?.accessToken&&!Go(g.accessToken)||C&&ya())},[i,g,C]);const E=b.useCallback(async()=>{const xe=Go(g?.accessToken)?null:g?.accessToken??null;if(!a)return xe;const{data:Ye}=await Zr.auth.getCurrentSession(),_t=Ye?.session?.accessToken??null;return Go(_t)?xe:_t},[g,a]);b.useEffect(()=>{if(!C)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&&ya()}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,C]);const z=b.useMemo(()=>{const xe=g?.accessToken??null;if(!xe||Go(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||Go(xe)||_)return;const Ye=VP(window.location.search);if(Ye){const Mn=g.user,en=Mn?.profile?.name??Mn?.name??null;I.current=!0;const vo=HP(Ye,{accessToken:xe,userId:Mn?.id??null,email:Mn?.email??null,name:en});window.location.assign(vo);return}if((window.location.pathname.replace(/\/+$/,"")||"/")!=="/auth/callback")return;const Ne=WP(),bt=Ne&&Ne!=="/auth/callback"?Ne:"/";I.current=!0,t(bt,{replace:!0})},[g,t,_]);const F=!!(g?.accessToken&&!Go(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{gf(),af(),sf(),ya(),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(()=>Fg("/sign-in",_e),[_e]),te=b.useMemo(()=>Fg("/sign-up",_e),[_e]);b.useEffect(()=>{typeof window>"u"||!i||window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||!AP({pathname:window.location.pathname,search:window.location.search,hasSession:!!g?.accessToken,sessionResolved:g!==void 0,storage:SP()})||t(Y,{replace:!0})},[i,g,t,Y]);const ne=A.jsx("div",{className:"min-h-screen bg-[#050505]"}),N=!ce&&!c&&!C&&(!i||g===void 0),V=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),he=IP({publicMode:ce,mockEnabled:c,sessionSoftExpired:C,signedIn:O,authPending:N}),ye=V?"dashboard":he,Le=fe.replace(/\/+$/,"")||"/",Ce=Le.match(/^\/leaderboard\/u\/([^/]+)$/i),Ie=Ce?Ce[1]:null,De=Ie?n4:Le==="/leaderboard"?t4:e4;let ze=null;return ye==="loading"?ze=ne:ye==="landing"?ze=A.jsx(O3,{signInUrl:Y,signUpUrl:te}):ze=A.jsxs(b.Suspense,{fallback:ne,children:[!ce&&!f&&!V?A.jsx(X3,{requiredVersion:p}):null,A.jsx(De,{baseUrl:r,auth:H,signedIn:O,sessionSoftExpired:C,signOut:R,publicMode:ce,publicToken:Se,userId:Ie,signInUrl:Y,signUpUrl:te})]}),A.jsx(kP,{children:A.jsx(MP,{children:ze})})}function o4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function i4(){const e=b.useMemo(()=>o4(),[]),t=Ma();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=rf(window.location.search),{saved:i}=wv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=nf(a);l&&(a=l);const c=vv(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(()=>{}),gf(),af(),sf(),ya();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 a4(){return typeof window>"u"?"/auth/callback":`${window.location.origin}/auth/callback`}function s4(){const e=b.useMemo(()=>a4(),[]),t=Ma();return b.useEffect(()=>{if(typeof window>"u")return;const{saved:r}=rf(window.location.search),{saved:i}=wv(window.location.search);if(!r&&!i)return;let a=window.location.href;const l=nf(a);l&&(a=l);const c=vv(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(()=>{}),gf(),af(),sf(),ya();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 l4=lf(),u4="/auth/callback",c4=y2([{path:"/sign-in",element:A.jsx(i4,{})},{path:"/sign-up",element:A.jsx(s4,{})},...N2({baseUrl:l4,afterSignInUrl:u4,builtInAuth:!1}),{path:"*",element:A.jsx(r4,{})}]);M2.createRoot(document.getElementById("root")).render(A.jsx(qr.StrictMode,{children:A.jsx($2,{client:Zr,children:A.jsx(L2,{router:c4})})}));export{k4 as $,av as A,mv as B,ug as C,B4 as D,cr as E,H4 as F,mi as G,j2 as H,Z4 as I,U2 as J,F2 as K,B2 as L,sg as M,Nn as N,j4 as O,d4 as P,Y3 as Q,lv as R,nP as S,$P as T,V4 as U,q4 as V,qr as W,L4 as X,R4 as Y,_f as Z,co as _,sv as a,S4 as a0,A4 as a1,YT as a2,x4 as a3,E4 as a4,T4 as a5,Da as a6,F4 as a7,a0 as a8,qn as a9,Ma as aa,v3 as ab,_3 as ac,D4 as ad,b4 as ae,f4 as af,$4 as ag,M4 as ah,U4 as ai,I4 as aj,N4 as ak,O4 as al,z4 as am,ya as an,Zr as ao,Yn as ap,Mg as aq,Q3 as ar,n0 as b,p4 as c,h4 as d,QT as e,XT as f,e0 as g,C4 as h,ag as i,P4 as j,it as k,ot as l,A as m,li as n,ef as o,bd as p,lP as q,b as r,Sl as s,Xv as t,Xd as u,iv as v,dy as w,G3 as x,W4 as y,B3 as z};
|