taximeter 0.3.1 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Taximeter
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Refresh the package overview and synchronize the published usage documentation.
8
+
3
9
  ## 0.3.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -8,8 +8,6 @@ the package or run a source checkout. Requires Node 20 or newer and npm.
8
8
 
9
9
  ![Taximeter dashboard showing an empty local ledger and a 100 USDC budget](https://raw.githubusercontent.com/Ding808/taximeter/main/docs/dashboard.png)
10
10
 
11
- Built with AI, with an auditable record of [protocol corrections](https://github.com/Ding808/taximeter/blob/main/SPEC-NOTES.md), [decisions](https://github.com/Ding808/taximeter/blob/main/DECISIONS.md), [verification](https://github.com/Ding808/taximeter/blob/main/VERIFICATION.md), and [reproducible benchmarks](https://github.com/Ding808/taximeter/tree/main/benchmarks).
12
-
13
11
  ## A 20-second demo
14
12
 
15
13
  ![Taximeter meters a real testnet payment and blocks the next payment](docs/demo.gif)
@@ -73,7 +71,7 @@ installed copy.
73
71
  You should now see:
74
72
 
75
73
  ```text
76
- Taximeter 0.3.1
74
+ Taximeter 0.3.2
77
75
  Proxy: http://127.0.0.1:8402
78
76
  Dashboard: http://127.0.0.1:8403
79
77
  Point an HTTP-proxy-aware agent at http://127.0.0.1:8402.
@@ -1701,7 +1701,7 @@ async function closeProxy(server) {
1701
1701
  import { z as z10 } from "zod";
1702
1702
 
1703
1703
  // package.json
1704
- var version = "0.3.1";
1704
+ var version = "0.3.2";
1705
1705
 
1706
1706
  // src/version.ts
1707
1707
  var version2 = z10.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/).parse(version);
package/dist/cli/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  totals,
29
29
  totalsForBudget,
30
30
  version
31
- } from "../chunk-LNGF6BWJ.js";
31
+ } from "../chunk-FZ6T7RLN.js";
32
32
 
33
33
  // src/cli/index.ts
34
34
  import { CommanderError } from "commander";
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  toJson,
19
19
  totals,
20
20
  version
21
- } from "./chunk-LNGF6BWJ.js";
21
+ } from "./chunk-FZ6T7RLN.js";
22
22
 
23
23
  // src/sdk/index.ts
24
24
  import { z } from "zod";
@@ -97,5 +97,5 @@ ${s.join(`
97
97
 
98
98
  `)}return J.write("payload.value = newResult;"),J.write("return payload;"),J.compile()};let h;const y=Hi,v=!Qt.jitless,z=v&&Tv.value,N=u.catchall;let w;l._zod.parse=(C,B)=>{w??(w=r.value);const X=C.value;return y(X)?v&&z&&B?.async===!1&&B.jitless!==!0?(h||(h=d(u.shape)),C=h(C,B),N?mp([],X,C,B,w,l):C):s(C,B):(C.issues.push({expected:"object",code:"invalid_type",input:X,inst:l}),C)}});function zm(l,u,s,r){for(const d of l)if(d.issues.length===0)return u.value=d.value,u;const o=l.filter(d=>!aa(d));return o.length===1?(u.value=o[0].value,o[0]):(u.issues.push({code:"invalid_union",input:u.value,inst:s,errors:l.map(d=>d.issues.map(h=>Kn(h,r,Wt())))}),u)}const wb=M("$ZodUnion",(l,u)=>{Ne.init(l,u),ve(l,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),ve(l,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ve(l,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),ve(l,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){const o=r.def.options.map(d=>d._zod.pattern);return new RegExp(`^(${o.map(d=>ks(d.source)).join("|")})$`)}});const s=u.options.length===1?u.options[0]._zod.run:null;l._zod.parse=(r,o)=>{if(s)return s(r,o);let d=!1;const h=[];for(const y of u.options){const v=y._zod.run({value:r.value,issues:[]},o);if(v instanceof Promise)h.push(v),d=!0;else{if(v.issues.length===0)return v;h.push(v)}}return d?Promise.all(h).then(y=>zm(y,r,l,o)):zm(h,r,l,o)}}),Rb=M("$ZodIntersection",(l,u)=>{Ne.init(l,u),l._zod.parse=(s,r)=>{const o=s.value,d=u.left._zod.run({value:o,issues:[]},r),h=u.right._zod.run({value:o,issues:[]},r);return d instanceof Promise||h instanceof Promise?Promise.all([d,h]).then(([v,p])=>Em(s,v,p)):Em(s,d,h)}});function Us(l,u){if(l===u)return{valid:!0,data:l};if(l instanceof Date&&u instanceof Date&&+l==+u)return{valid:!0,data:l};if(ca(l)&&ca(u)){const s=Object.keys(u),r=Object.keys(l).filter(d=>s.indexOf(d)!==-1),o={...l,...u};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(const d of r){if(d==="__proto__")continue;const h=Us(l[d],u[d]);if(!h.valid)return{valid:!1,mergeErrorPath:[d,...h.mergeErrorPath]};o[d]=h.data}return{valid:!0,data:o}}if(Array.isArray(l)&&Array.isArray(u)){if(l.length!==u.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let r=0;r<l.length;r++){const o=l[r],d=u[r],h=Us(o,d);if(!h.valid)return{valid:!1,mergeErrorPath:[r,...h.mergeErrorPath]};s.push(h.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function Em(l,u,s){const r=new Map;let o;const d=new Map,h=(p,z)=>{let N;if(p.code==="unrecognized_keys"&&!p.path?.length)o??(o=p),N=p.keys;else if(p.code==="invalid_key"&&p.origin==="record"&&p.path?.length===1){const w=String(p.path[0]);d.has(w)||d.set(w,p),N=[w]}else return!1;for(const w of N)r.has(w)||r.set(w,{}),r.get(w)[z]=!0;return!0};for(const p of u.issues)h(p,"l")||l.issues.push(p);for(const p of s.issues)h(p,"r")||l.issues.push(p);const y=[...r].filter(([,p])=>p.l&&p.r).map(([p])=>p);if(y.length){const p=o?y.filter(z=>o.keys.includes(z)):[];p.length&&l.issues.push({...o,keys:p});for(const z of y)!p.includes(z)&&d.has(z)&&l.issues.push(d.get(z))}const v=Us(u.value,s.value);if(!v.valid){if(aa(l))return l;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(v.mergeErrorPath)}`)}return l.value=v.data,l}const Cb=M("$ZodRecord",(l,u)=>{Ne.init(l,u);const s=Qt.memoizer;s?.attach(l),l._zod.parse=(r,o)=>{const d=r.value;if(!ca(d))return r.issues.push({expected:"record",code:"invalid_type",input:d,inst:l}),r;const h=[],y=u.keyType._zod.values;if(y&&!u.partial){r.value=s?s.alloc(l,r,{},o):{};const v=new Set;for(const z of y)if(typeof z=="string"||typeof z=="number"||typeof z=="symbol"){if(v.add(typeof z=="number"?z.toString():z),z==="__proto__")continue;const N=u.keyType._zod.run({value:z,issues:[]},o);if(N instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(N.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:N.issues.map(B=>Kn(B,o,Wt())),input:z,path:[z],inst:l});continue}const w=N.value;if(w==="__proto__")continue;const C=u.valueType._zod.run({value:d[z],issues:[]},o);C instanceof Promise?h.push(C.then(B=>{B.issues.length&&r.issues.push(...ua(z,B.issues)),r.value[w]=B.value})):(C.issues.length&&r.issues.push(...ua(z,C.issues)),r.value[w]=C.value)}let p;for(const z in d)if(!v.has(z))if(u.mode==="loose"){if(z==="__proto__")continue;r.value[z]=d[z]}else p=p??[],p.push(z);p&&p.length>0&&r.issues.push({code:"unrecognized_keys",input:d,inst:l,keys:p,continue:!0})}else{r.value=s?s.alloc(l,r,{},o):{};let v;for(const p of Reflect.ownKeys(d)){if(p==="__proto__"||!Object.prototype.propertyIsEnumerable.call(d,p))continue;let z=u.keyType._zod.run({value:p,issues:[]},o);if(z instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof p=="string"&&Vs.test(p)&&z.issues.length){const B=u.keyType._zod.run({value:Number(p),issues:[]},o);if(B instanceof Promise)throw new Error("Async schemas not supported in object keys currently");B.issues.length===0&&(z=B)}if(z.issues.length){u.mode==="loose"?r.value[p]=d[p]:y?(v=v??[],v.push(p)):r.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map(B=>Kn(B,o,Wt())),input:p,path:[p],inst:l});continue}const w=z.value;if(w==="__proto__")continue;const C=u.valueType._zod.run({value:d[p],issues:[]},o);C instanceof Promise?h.push(C.then(B=>{B.issues.length&&r.issues.push(...ua(p,B.issues)),r.value[w]=B.value})):(C.issues.length&&r.issues.push(...ua(p,C.issues)),r.value[w]=C.value)}v&&v.length>0&&r.issues.push({code:"unrecognized_keys",input:d,inst:l,keys:v,continue:!0})}return h.length?Promise.all(h).then(()=>r):r}}),Bb=M("$ZodEnum",(l,u)=>{Ne.init(l,u);const s=Vm(u.entries),r=new Set(s);l._zod.values=r;const o=s.filter(d=>Ov.has(typeof d));l._zod.pattern=new RegExp(o.length?`^(${o.map(d=>ra(d.toString())).join("|")})$`:"^[^\\s\\S]$"),l._zod.parse=(d,h)=>{const y=d.value;return r.has(y)||d.issues.push({code:"invalid_value",values:s,input:y,inst:l}),d}}),Hb=M("$ZodLiteral",(l,u)=>{Ne.init(l,u);const s=new Set(u.values);l._zod.values=s,l._zod.pattern=new RegExp(u.values.length?`^(${u.values.map(r=>typeof r=="string"?ra(r):r?ra(r.toString()):String(r)).join("|")})$`:"^[^\\s\\S]$"),l._zod.parse=(r,o)=>{const d=r.value;return s.has(d)||r.issues.push({code:"invalid_value",values:u.values,input:d,inst:l}),r}}),$b=M("$ZodTransform",(l,u)=>{Ne.init(l,u),l._zod.optin="optional",Qt.memoizer?.guard(l),l._zod.parse=(s,r)=>{if(r.direction==="backward")throw new Im(l.constructor.name);const o=u.transform(s.value,s);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(h=>(s.value=h,s));if(o instanceof Promise)throw new ia;return s.value=o,s}});function Tm(l,u){return l.value=u.issues.length?void 0:u.value,l}const pp=M("$ZodOptional",(l,u)=>{Ne.init(l,u),ve(l,"optin",s=>s.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),l._zod.optout="optional",ve(l,"values",s=>{const r=s.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),ve(l,"pattern",s=>{const r=s.def.innerType._zod.pattern;return r?new RegExp(`^(${ks(r.source)})?$`):void 0}),l._zod.parse=(s,r)=>{if(s.value===void 0){if(u.innerType._zod.optin!=="defaulted")return s;const o=u.innerType._zod.run({value:s.value,issues:[]},r);return o instanceof Promise?o.then(d=>Tm(s,d)):Tm(s,o)}return u.innerType._zod.run(s,r)}}),qb=M("$ZodExactOptional",(l,u)=>{pp.init(l,u),ve(l,"values",s=>s.def.innerType._zod.values),ve(l,"pattern",s=>s.def.innerType._zod.pattern),l._zod.parse=(s,r)=>u.innerType._zod.run(s,r)}),Yb=M("$ZodNullable",(l,u)=>{Ne.init(l,u),ve(l,"optin",s=>s.def.innerType._zod.optin),ve(l,"optout",s=>s.def.innerType._zod.optout),ve(l,"pattern",s=>{const r=s.def.innerType._zod.pattern;return r?new RegExp(`^(${ks(r.source)}|null)$`):void 0}),ve(l,"values",s=>s.def.innerType._zod.values?new Set([...s.def.innerType._zod.values,null]):void 0),l._zod.parse=(s,r)=>s.value===null?s:u.innerType._zod.run(s,r)}),kb=M("$ZodDefault",(l,u)=>{Ne.init(l,u),l._zod.optin="defaulted",ve(l,"values",s=>s.def.innerType._zod.values),l._zod.parse=(s,r)=>{if(r.direction==="backward")return u.innerType._zod.run(s,r);if(s.value===void 0)return s.value=u.defaultValue,s;const o=u.innerType._zod.run(s,r);return o instanceof Promise?o.then(d=>Om(d,u)):Om(o,u)}});function Om(l,u){return l.value===void 0&&(l.value=u.defaultValue),l}const Gb=M("$ZodPrefault",(l,u)=>{Ne.init(l,u),l._zod.optin="defaulted",ve(l,"values",s=>s.def.innerType._zod.values),l._zod.parse=(s,r)=>(r.direction==="backward"||s.value===void 0&&(s.value=u.defaultValue),u.innerType._zod.run(s,r))}),Lb=M("$ZodNonOptional",(l,u)=>{Ne.init(l,u),ve(l,"values",s=>{const r=s.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),l._zod.parse=(s,r)=>{const o=u.innerType._zod.run(s,r);return o instanceof Promise?o.then(d=>Am(d,l)):Am(o,l)}});function Am(l,u){return!l.issues.length&&l.value===void 0&&l.issues.push({code:"invalid_type",expected:"nonoptional",input:l.value,inst:u}),l}function Nm(l,u,s,r){return u.issues.length?(l.value=s.catchValue({...u,value:l.value,error:{issues:u.issues.map(o=>Kn(o,r,Wt()))},input:l.value}),l):(l.value=u.value,u.memo&&(l.memo=!0),l)}const Xb=M("$ZodCatch",(l,u)=>{Ne.init(l,u),ve(l,"optin",s=>s.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ve(l,"optout",s=>s.def.innerType._zod.optout),ve(l,"values",s=>s.def.innerType._zod.values),l._zod.parse=(s,r)=>{if(r.direction==="backward")return u.innerType._zod.run(s,r);const o=u.innerType._zod.run({value:s.value,issues:[]},r);return o instanceof Promise?o.then(d=>Nm(s,d,u,r)):Nm(s,o,u,r)}}),Qb=M("$ZodPipe",(l,u)=>{Ne.init(l,u),ve(l,"values",s=>s.def.in._zod.values),ve(l,"optin",s=>s.def.in._zod.optin),ve(l,"optout",s=>s.def.out._zod.optout),ve(l,"propValues",s=>s.def.in._zod.propValues),l._zod.parse=(s,r)=>{if(r.direction==="backward"){const d=u.out._zod.run(s,r);return d instanceof Promise?d.then(h=>Mi(h,u.in,r)):Mi(d,u.in,r)}const o=u.in._zod.run(s,r);return o instanceof Promise?o.then(d=>Mi(d,u.out,r)):Mi(o,u.out,r)}});function Mi(l,u,s){return l.issues.some(r=>r.code!=="unrecognized_keys")?(l.aborted=!0,l):u._zod.run({value:l.value,issues:l.issues},s)}const Vb=M("$ZodReadonly",(l,u)=>{Ne.init(l,u),ve(l,"propValues",s=>s.def.innerType._zod.propValues),ve(l,"values",s=>s.def.innerType._zod.values),ve(l,"optin",s=>s.def.innerType?._zod?.optin),ve(l,"optout",s=>s.def.innerType?._zod?.optout),l._zod.parse=(s,r)=>{if(r.direction==="backward")return u.innerType._zod.run(s,r);const o=u.innerType._zod.run(s,r);return o instanceof Promise?o.then(jm):jm(o)}});function jm(l){return l.memo||(l.value=Object.freeze(l.value)),l}const Kb=M("$ZodCustom",(l,u)=>{ht.init(l,u),Ne.init(l,u),l._zod.parse=(s,r)=>s,l._zod.check=s=>{const r=s.value,o=u.fn(r);if(o instanceof Promise)return o.then(d=>xm(d,s,r,l));xm(o,s,r,l)}});function xm(l,u,s,r){if(!l){const o={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),u.issues.push(du(o))}}class Jb extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const Ms="~memo",Dm=[];function Os(l){return l.map(u=>u.path?{...u,path:u.path.slice()}:{...u})}const Um=new WeakMap;function yp(l,u){const s=Um.get(l);if(s!==void 0)return s;if(u.has(l))return!0;u.add(l);let r=!1;const o=y=>{!r&&y?._zod&&yp(y,u)&&(r=!0)},d=l._zod.def;switch(d.type){case"object":{for(const y of Reflect.ownKeys(d.shape))o(d.shape[y]);o(d.catchall);break}case"array":o(d.element);break;case"tuple":for(const y of d.items)o(y);o(d.rest);break;case"record":case"map":o(d.keyType),o(d.valueType);break;case"set":o(d.valueType);break;case"union":for(const y of d.options)o(y);break;case"intersection":o(d.left),o(d.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":o(d.innerType);break;case"pipe":o(d.in),o(d.out);break;case"function":o(d.input),o(d.output);break;case"lazy":o(l._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const y in d){const v=Object.getOwnPropertyDescriptor(d,y);if(!v||v.get)continue;const p=v.value;if(!(!p||typeof p!="object")){if(p._zod)o(p);else if(Array.isArray(p))for(const z of p)o(z)}}}return u.delete(l),Um.set(l,r),r}function Fb(l,u){let s=l.buckets.get(u);return s||(s=new Map,l.buckets.set(u,s)),s}let Zi;const wi=[],Wb={alloc(l,u,s){const r=Zi;if(!r)return s;Zi=void 0;const o={value:s,issues:null};return r.set(u.value,o),wi.push(o),s},guard(l){var u;(u=l._zod).deferred??(u.deferred=[]),l._zod.deferred.push(()=>{const s=l._zod.parse,r=(o,d)=>{if(d.direction!=="backward"&&Pb(d,o.value))throw new Jb;return s(o,d)};l._zod.parse=r,l._zod.run===s&&(l._zod.run=r)})},attach(l){var u;let s,r,o;(u=l._zod).deferred??(u.deferred=[]),l._zod.deferred.push(()=>{const d=l._zod.parse,h=(y,v)=>{if(s===void 0&&(s=yp(l,new Set),!s))return l._zod.parse=d,l._zod.run===h&&(l._zod.run=d),d(y,v);const p=y.value;if(p===null||typeof p!="object")return d(y,v);let z=v[Ms];z||(z={buckets:new Map,backEdges:void 0},v[Ms]=z);let N;r===v?N=o:(N=Fb(z,l),r=v,o=N);const w=N.get(p);if(w)return y.value=w.value,w.issues?w.issues.length&&y.issues.push(...Os(w.issues)):(y.memo=!0,z.backEdges??(z.backEdges=new Set),z.backEdges.add(w.value)),y;Zi=N;const C=wi.length,B=d(y,v);Zi=void 0;const X=wi.length>C?wi.pop():void 0;return B instanceof Promise?B.then(J=>(X&&(X.issues=J.issues.length?Os(J.issues):Dm),J)):(X&&(X.issues=B.issues.length?Os(B.issues):Dm),B)};l._zod.parse=h,l._zod.run===d&&(l._zod.run=h)})}};function Ib(){return Wb}function Pb(l,u){const s=l[Ms]?.backEdges;return s!==void 0&&u!==null&&typeof u=="object"&&s.has(u)}const e_=()=>{const l={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function u(d){return l[d]??null}const s={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"credit card number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(d,h){return d==="number"&&typeof h=="number"&&!Number.isFinite(h)?String(h):r[d]??d}return d=>{switch(d.code){case"invalid_type":{const h=o(d.expected),y=Cv(d.input),v=o(y,d.input);return`Invalid input: expected ${h}, received ${v}`}case"invalid_value":return d.values.length===1?`Invalid input: expected ${Fm(d.values[0])}`:`Invalid option: expected one of ${dm(d.values,"|")}`;case"too_big":{const h=d.exact?"exactly ":d.inclusive?"<=":"<",y=u(d.origin);return y?`Too big: expected ${d.origin??"value"} to have ${h}${d.maximum.toString()} ${y.unit??"elements"}`:`Too big: expected ${d.origin??"value"} to be ${h}${d.maximum.toString()}`}case"too_small":{const h=d.exact?"exactly ":d.inclusive?">=":">",y=u(d.origin);return y?`Too small: expected ${d.origin} to have ${h}${d.minimum.toString()} ${y.unit}`:`Too small: expected ${d.origin} to be ${h}${d.minimum.toString()}`}case"invalid_format":{const h=d;return h.format==="starts_with"?`Invalid string: must start with "${h.prefix}"`:h.format==="ends_with"?`Invalid string: must end with "${h.suffix}"`:h.format==="includes"?`Invalid string: must include "${h.includes}"`:h.format==="regex"?`Invalid string: must match pattern ${h.pattern}`:`Invalid ${s[h.format]??d.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${d.divisor}`;case"unrecognized_keys":return`Unrecognized key${d.keys.length>1?"s":""}: ${dm(d.keys,", ")}`;case"invalid_key":return`Invalid key in ${d.origin}`;case"invalid_union":return d.options&&Array.isArray(d.options)&&d.options.length>0?`Invalid discriminator value. Expected ${d.options.map(y=>`'${y}'`).join(" | ")}`:d.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${d.origin}`;default:return"Invalid input"}}};function t_(){return{localeError:e_()}}var Mm;class n_{constructor(){this._map=new WeakMap,this._idmap=new Map}add(u,...s){const r=s[0];return this._map.set(u,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,u),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(u){const s=this._map.get(u);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(u),this}get(u){const s=u._zod.parent;if(s){const r={...this.get(s)??{}};delete r.id;const o={...r,...this._map.get(u)};return Object.keys(o).length?o:void 0}return this._map.get(u)}has(u){return this._map.has(u)}}function l_(){return new n_}(Mm=globalThis).__zod_globalRegistry??(Mm.__zod_globalRegistry=l_());const ru=globalThis.__zod_globalRegistry;function a_(l,u){return new l({type:"string",...G(u)})}function u_(l,u){return new l({type:"string",format:"email",check:"string_format",abort:!1,...G(u)})}function i_(l,u){return new l({type:"string",format:"guid",check:"string_format",abort:!1,...G(u)})}function c_(l,u){return new l({type:"string",format:"uuid",check:"string_format",abort:!1,...G(u)})}function r_(l,u){return new l({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...G(u)})}function s_(l,u){return new l({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...G(u)})}function gp(l,u){return new l({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...G(u)})}function vp(l,u){return new l({type:"string",format:"url",check:"string_format",abort:!1,...G(u)})}function o_(l,u){return new l({type:"string",format:"emoji",check:"string_format",abort:!1,...G(u)})}function f_(l,u){return new l({type:"string",format:"nanoid",check:"string_format",abort:!1,...G(u)})}function d_(l,u){return new l({type:"string",format:"cuid",check:"string_format",abort:!1,...G(u)})}function h_(l,u){return new l({type:"string",format:"cuid2",check:"string_format",abort:!1,...G(u)})}function m_(l,u){return new l({type:"string",format:"ulid",check:"string_format",abort:!1,...G(u)})}function p_(l,u){return new l({type:"string",format:"xid",check:"string_format",abort:!1,...G(u)})}function y_(l,u){return new l({type:"string",format:"ksuid",check:"string_format",abort:!1,...G(u)})}function g_(l,u){return new l({type:"string",format:"ipv4",check:"string_format",abort:!1,...G(u)})}function v_(l,u){return new l({type:"string",format:"ipv6",check:"string_format",abort:!1,...G(u)})}function b_(l,u){return new l({type:"string",format:"cidrv4",check:"string_format",abort:!1,...G(u)})}function __(l,u){return new l({type:"string",format:"cidrv6",check:"string_format",abort:!1,...G(u)})}function S_(l,u){return new l({type:"string",format:"base64",check:"string_format",abort:!1,...G(u)})}function z_(l,u){return new l({type:"string",format:"base64url",check:"string_format",abort:!1,...G(u)})}function E_(l,u){return new l({type:"string",format:"e164",check:"string_format",abort:!1,...G(u)})}function T_(l,u){return new l({type:"string",format:"jwt",check:"string_format",abort:!1,...G(u)})}function bp(l,u){return new l({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...G(u)})}function O_(l,u){return new l({type:"string",format:"date",check:"string_format",...G(u)})}function A_(l,u){return new l({type:"string",format:"time",check:"string_format",precision:null,...G(u)})}function N_(l,u){return new l({type:"string",format:"duration",check:"string_format",...G(u)})}function j_(l,u){return new l({type:"number",checks:[],...G(u)})}function x_(l,u){return new l({type:"number",check:"number_format",abort:!1,format:"safeint",...G(u)})}function D_(l,u){return new l({type:"boolean",...G(u)})}function U_(l){return new l({type:"unknown"})}function M_(l,u){return new l({type:"never",...G(u)})}function Zm(l,u){return new up({check:"less_than",...G(u),value:l,inclusive:!1})}function As(l,u){return new up({check:"less_than",...G(u),value:l,inclusive:!0})}function wm(l,u){return new ip({check:"greater_than",...G(u),value:l,inclusive:!1})}function Ns(l,u){return new ip({check:"greater_than",...G(u),value:l,inclusive:!0})}function Rm(l,u){return new w0({check:"multiple_of",...G(u),value:l})}function _p(l,u){return new C0({check:"max_length",...G(u),maximum:l})}function Yi(l,u){return new B0({check:"min_length",...G(u),minimum:l})}function Sp(l,u){return new H0({check:"length_equals",...G(u),length:l})}function Z_(l,u){return new $0({check:"string_format",format:"regex",...G(u),pattern:l})}function w_(l){return new q0({check:"string_format",format:"lowercase",...G(l)})}function R_(l){return new Y0({check:"string_format",format:"uppercase",...G(l)})}function C_(l,u){return new k0({check:"string_format",format:"includes",...G(u),includes:l})}function B_(l,u){return new G0({check:"string_format",format:"starts_with",...G(u),prefix:l})}function H_(l,u){return new L0({check:"string_format",format:"ends_with",...G(u),suffix:l})}function fa(l){return new X0({check:"overwrite",tx:l})}function $_(l){return fa(u=>u.normalize(l))}function q_(){return fa(l=>l.trim())}function Y_(){return fa(l=>l.toLowerCase())}function k_(){return fa(l=>l.toUpperCase())}function G_(){return fa(l=>Ev(l))}function L_(l,u,s){return new l({type:"array",element:u,...G(s)})}function X_(l,u,s){return new l({type:"custom",check:"custom",fn:u,...G(s)})}function Q_(l,u){const s=V_(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(du(o,r.value,s._zod.def));else{const d=o;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),"input"in d||(d.input=r.value),d.inst??(d.inst=s),d.continue??(d.continue=!s._zod.def.abort),r.issues.push(du(d))}},l(r.value,r)),u);return s}function V_(l,u){const s=new ht({check:"custom",...G(u)});return s._zod.check=l,s}function ou(l,...u){for(const s of u)for(const r of Reflect.ownKeys(s))Object.prototype.propertyIsEnumerable.call(s,r)&&dt(l,r,s[r]);return l}function zp(l){let u=l?.target??"draft-2020-12";return u==="draft-4"&&(u="draft-04"),u==="draft-7"&&(u="draft-07"),{processors:l.processors??{},metadataRegistry:l?.metadata??ru,target:u,unrepresentable:l?.unrepresentable??"throw",override:l?.override??(()=>{}),io:l?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:l?.cycles??"ref",reused:l?.reused??"inline",intersections:[],deferred:[],external:l?.external??void 0}}function Jn(l,u,s,r,o){const d=typeof u.unrepresentable=="function"?u.unrepresentable({zodSchema:l,path:r.path,message:o}):u.unrepresentable;if(d==="any")return!1;if(d===void 0||d==="throw")throw new Error(o);return Object.assign(s,d),!0}function qe(l,u,s={path:[],schemaPath:[]}){var r;const o=l._zod.def,d=u.seen.get(l);if(d)return d.count++,s.schemaPath.includes(l)&&(d.cycle=s.path),d.schema;const h={schema:{},count:1,cycle:void 0,path:s.path};u.seen.set(l,h),u.sharedDefsExtractedFor=void 0,u.sharedEmitDoneFor=void 0;const y=l._zod.toJSONSchema?.();if(y)h.schema=y;else{const z={...s,schemaPath:[...s.schemaPath,l],path:s.path};if(l._zod.processJSONSchema)l._zod.processJSONSchema(u,h.schema,z);else{const w=h.schema,C=u.processors[o.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);C(l,u,w,z)}const N=l._zod.parent;N&&(h.ref||(h.ref=N),qe(N,u,z),u.seen.get(N).isParent=!0)}const v=u.metadataRegistry.get(l);return v&&ou(h.schema,v),u.io==="input"&&lt(l)&&(delete h.schema.examples,delete h.schema.default),u.io==="input"&&"_prefault"in h.schema&&((r=h.schema).default??(r.default=h.schema._prefault)),delete h.schema._prefault,u.seen.get(l).schema}function Cm(l){return l.replace(/~/g,"~0").replace(/\//g,"~1")}function Ep(l,u){const s=l.seen.get(u);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");if(l.external&&l.sharedDefsExtractedFor===l.external)return;const r=new Map;for(const h of l.seen.entries()){const y=l.metadataRegistry.get(h[0])?.id;if(y){const v=r.get(y);if(v&&v!==h[0])throw new Error(`Duplicate schema id "${y}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(y,h[0])}}const o=h=>{const y=l.target==="draft-2020-12"?"$defs":"definitions";if(l.external){const N=l.external.registry.get(h[0])?.id,w=l.external.uri??(B=>B);if(N)return{ref:w(N)};const C=h[1].defId??h[1].schema.id??`schema${l.counter++}`;return h[1].defId=C,{defId:C,ref:`${w("__shared")}#/${y}/${Cm(C)}`}}const v="#",p=`${v}/${y}/`;if(h[1]===s&&!h[1].schema.id)return{ref:v};const z=h[1].schema.id??`__schema${l.counter++}`;return{defId:z,ref:p+Cm(z)}},d=h=>{if(h[1].schema.$ref)return;const y=h[1],{ref:v,defId:p}=o(h);y.def={...y.schema},p&&(y.defId=p);const z=y.schema;for(const N in z)delete z[N];z.$ref=v};if(l.cycles==="throw")for(const h of l.seen.entries()){const y=h[1];if(y.cycle)throw new Error(`Cycle detected: #/${y.cycle?.join("/")}/<root>
99
99
 
100
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of l.seen.entries()){const y=h[1];if(u===h[0]){d(h);continue}if(l.external){const p=l.external.registry.get(h[0])?.id;if(u!==h[0]&&p){d(h);continue}}if(l.metadataRegistry.get(h[0])?.id){d(h);continue}if(y.cycle){d(h);continue}if(y.count>1&&l.reused==="ref"){d(h);continue}}l.external&&(l.sharedDefsExtractedFor=l.external)}function Tp(l){const u=l.anyOf;if(!Array.isArray(u)||u.length===0||l.type!==void 0)return;const s=[];for(const r of u){if(!r||typeof r!="object")return;Tp(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const d=r.type;for(const h of Array.isArray(d)?d:[d]){if(typeof h!="string")return;s.includes(h)||s.push(h)}}delete l.anyOf,l.type=s.length===1?s[0]:s}const Op=new Set(["type","properties","required","additionalProperties"]),Bm=["oneOf","anyOf"];function Hm(l){const u=l.additionalProperties;return u===void 0||u===!1||typeof u!="object"||u===null?null:Object.keys(u).length?u:null}function Zs(l){const u=[];for(const d of l){if(typeof d!="object"||d.type!=="object")return null;for(const h in d)if(!Op.has(h))return null;u.push(d)}const s={},r=new Set;for(const d of u){for(const h in d.properties){if(Object.prototype.hasOwnProperty.call(s,h))continue;const y=[];for(const p of u){const z=p.properties?.[h]??Hm(p);z!=null&&(y.some(N=>JSON.stringify(N)===JSON.stringify(z))||y.push(z))}const v=y.length===1?y[0]:Zs(y)??{allOf:y};dt(s,h,v)}for(const h of d.required??[])r.add(h)}const o={type:"object",properties:s};if(r.size&&(o.required=[...r]),u.every(d=>d.additionalProperties===!1))o.additionalProperties=!1;else{const d=[];for(const h of u){const y=Hm(h);y&&!d.some(v=>JSON.stringify(v)===JSON.stringify(y))&&d.push(y)}d.length===1?o.additionalProperties=d[0]:d.length>1&&(o.additionalProperties={allOf:d})}return o}function K_(l){const u=l.allOf;if(!Array.isArray(u)||u.length<2)return;for(const o of Op)if(o in l)return;const s=u.filter(o=>Bm.some(d=>Array.isArray(o[d])));let r=null;if(!s.length)r=Zs(u);else{const o=s[0],d=Bm.find(v=>Array.isArray(o[v]));if(Object.keys(o).length!==1)return;const h=u.filter(v=>v!==o),y=o[d].map(v=>Zs([...h,v]));if(y.some(v=>!v))return;r={[d]:y}}r&&(delete l.allOf,ou(l,r))}function Ap(l,u){const s=l.seen.get(u);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=y=>{const v=l.seen.get(y);if(v.ref===null)return;const p=v.def??v.schema,z={...p},N=v.ref;if(v.ref=null,N){r(N);const C=l.seen.get(N),B=C.schema;if(B.$ref&&(l.target==="draft-07"||l.target==="draft-04"||l.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(B)):ou(p,B),ou(p,z),y._zod.parent===N)for(const J in p)J==="$ref"||J==="allOf"||J in z||delete p[J];if(B.$ref&&C.def)for(const J in p)J==="$ref"||J==="allOf"||J in C.def&&JSON.stringify(p[J])===JSON.stringify(C.def[J])&&delete p[J]}const w=y._zod.parent;if(w&&w!==N){r(w);const C=l.seen.get(w);if(C?.schema.$ref&&(p.$ref=C.schema.$ref,C.def))for(const B in p)B==="$ref"||B==="allOf"||B in C.def&&JSON.stringify(p[B])===JSON.stringify(C.def[B])&&delete p[B]}l.override({zodSchema:y,jsonSchema:p,path:v.path??[]})};if(!l.external||l.sharedEmitDoneFor!==l.external){for(const y of[...l.seen.entries()].reverse())r(y[0]);if(l.target!=="openapi-3.0")for(const y of l.seen.entries())Tp(y[1].def??y[1].schema);for(const y of l.deferred)y();if(l.intersections.length){const y=new Map;for(const v of l.seen.values())for(const p of[v.schema,v.def]){const z=p?.allOf;if(!Array.isArray(z))continue;const N=y.get(z);N?N.push(p):y.set(z,[p])}for(const v of l.intersections)for(const p of y.get(v)??[])K_(p)}}const o={};if(l.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":l.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":l.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":l.target,l.external?.uri){const y=l.external.registry.get(u)?.id;if(!y)throw new Error("Schema is missing an `id` property");o.$id=l.external.uri(y)}ou(o,s.defId?s.schema:s.def??s.schema);const d=l.metadataRegistry.get(u)?.id;d!==void 0&&o.id===d&&delete o.id;const h=l.external?.defs??{};if(!l.external||l.sharedEmitDoneFor!==l.external)for(const y of l.seen.entries()){const v=y[1];v.def&&v.defId&&(v.def.id===v.defId&&delete v.def.id,dt(h,v.defId,v.def))}l.external&&(l.sharedEmitDoneFor=l.external),l.external||Object.keys(h).length>0&&(l.target==="draft-2020-12"?o.$defs=h:o.definitions=h);try{const y=JSON.parse(JSON.stringify(o));return Object.defineProperty(y,"~standard",{value:{...u["~standard"],jsonSchema:{input:ki(u,"input",l.processors),output:ki(u,"output",l.processors)}},enumerable:!1,writable:!1}),y}catch{throw new Error("Error converting schema to JSON.")}}function lt(l,u){const s=u??{seen:new Set};if(s.seen.has(l))return!1;s.seen.add(l);const r=l._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return lt(r.element,s);if(r.type==="set")return lt(r.valueType,s);if(r.type==="lazy")return lt(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return lt(r.innerType,s);if(r.type==="intersection")return lt(r.left,s)||lt(r.right,s);if(r.type==="record"||r.type==="map")return lt(r.keyType,s)||lt(r.valueType,s);if(r.type==="pipe")return l._zod.traits.has("$ZodCodec")?!0:lt(r.in,s)||lt(r.out,s);if(r.type==="object"){for(const o in r.shape)if(lt(r.shape[o],s))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(lt(o,s))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(lt(o,s))return!0;return!!(r.rest&&lt(r.rest,s))}return!1}const J_=(l,u={})=>s=>{const r=zp({...s,processors:u});return qe(l,r),Ep(r,l),Ap(r,l)},ki=(l,u,s={})=>r=>{const{libraryOptions:o,target:d}=r??{},h=zp({...o??{},target:d,io:u,processors:s});return qe(l,h),Ep(h,l),Ap(h,l)},F_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},W_=(l,u,s,r)=>{const o=s;o.type="string";const{minimum:d,maximum:h,format:y,patterns:v,contentEncoding:p,laxFormat:z}=l._zod.bag;if(typeof d=="number"&&(o.minLength=d),typeof h=="number"&&(o.maxLength=h),y&&(o.format=F_[y]??y,o.format===""&&delete o.format,(y==="time"||z)&&delete o.format),p&&(o.contentEncoding=p),v&&v.size>0){const N=[...v];N.length===1?o.pattern=N[0].source:N.length>1&&(o.allOf=[...N.map(w=>({...u.target==="draft-07"||u.target==="draft-04"||u.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))])}},I_=(l,u,s,r)=>{const o=s,{minimum:d,maximum:h,format:y,multipleOf:v,exclusiveMaximum:p,exclusiveMinimum:z}=l._zod.bag;typeof y=="string"&&y.includes("int")?o.type="integer":o.type="number";const N=typeof z=="number"&&z>=(d??Number.NEGATIVE_INFINITY),w=typeof p=="number"&&p<=(h??Number.POSITIVE_INFINITY),C=u.target==="draft-04"||u.target==="openapi-3.0";N?C?(o.minimum=z,o.exclusiveMinimum=!0):o.exclusiveMinimum=z:typeof d=="number"&&(o.minimum=d),w?C?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p:typeof h=="number"&&(o.maximum=h),typeof v=="number"&&(Number.isFinite(v)&&v!==0?o.multipleOf=Math.abs(v):Jn(l,u,o,r,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`))},P_=(l,u,s,r)=>{s.type="boolean"},e1=(l,u,s,r)=>{s.not={}},t1=(l,u,s,r)=>{},n1=(l,u,s,r)=>{const o=l._zod.def,d=Vm(o.entries);if(d.length===0){s.not={};return}d.every(h=>typeof h=="number")&&(s.type="number"),d.every(h=>typeof h=="string")&&(s.type="string"),s.enum=d},l1=(l,u,s,r)=>{const o=l._zod.def;if(o.values.length===0){s.not={};return}const d=[];for(const h of o.values)if(h===void 0){if(Jn(l,u,s,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof h=="bigint"){if(Jn(l,u,s,r,"BigInt literals cannot be represented in JSON Schema"))return;d.push(Number(h))}else d.push(h);if(d.length!==0)if(d.length===1){const h=d[0];s.type=h===null?"null":typeof h,u.target==="draft-04"||u.target==="openapi-3.0"?s.enum=[h]:s.const=h}else d.every(h=>typeof h=="number")&&(s.type="number"),d.every(h=>typeof h=="string")&&(s.type="string"),d.every(h=>typeof h=="boolean")&&(s.type="boolean"),d.every(h=>h===null)&&(s.type="null"),s.enum=d},a1=(l,u,s,r)=>{Jn(l,u,s,r,"Custom types cannot be represented in JSON Schema")},u1=(l,u,s,r)=>{Jn(l,u,s,r,"Transforms cannot be represented in JSON Schema")},i1=(l,u,s,r)=>{const o=s,d=l._zod.def,{minimum:h,maximum:y}=l._zod.bag;typeof h=="number"&&(o.minItems=h),typeof y=="number"&&(o.maxItems=y),o.type="array",o.items=qe(d.element,u,{...r,path:[...r.path,"items"]})};function Gi(l){const u=l._zod.def;return u.type==="pipe"&&u.in._zod.traits.has("$ZodTransform")?Gi(u.out):u.type==="catch"?Gi(u.innerType):l._zod.optin}const c1=(l,u,s,r)=>{const o=s,d=l._zod.def,h=d.shape;if(Object.getOwnPropertySymbols(h).length&&Jn(l,u,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const z in h)dt(o.properties,z,qe(h[z],u,{...r,path:[...r.path,"properties",z]}));const v=new Set(Object.keys(h)),p=new Set([...v].filter(z=>{const N=d.shape[z];return u.io==="input"?Gi(N)===void 0:N._zod.optout===void 0}));p.size>0&&(o.required=Array.from(p)),d.catchall?._zod.def.type==="never"?o.additionalProperties=!1:d.catchall?d.catchall&&(o.additionalProperties=qe(d.catchall,u,{...r,path:[...r.path,"additionalProperties"]})):u.io==="output"&&(o.additionalProperties=!1)},r1=(l,u,s,r)=>{const o=l._zod.def,d=o.inclusive===!1,h=o.options.map((y,v)=>qe(y,u,{...r,path:[...r.path,d?"oneOf":"anyOf",v]}));d?s.oneOf=h:s.anyOf=h},s1=(l,u,s,r)=>{const o=l._zod.def,d=qe(o.left,u,{...r,path:[...r.path,"allOf",0]}),h=qe(o.right,u,{...r,path:[...r.path,"allOf",1]}),y=p=>"allOf"in p&&Object.keys(p).length===1,v=[...y(d)?d.allOf:[d],...y(h)?h.allOf:[h]];s.allOf=v,u.intersections.push(v)};function ws(l,u,s){if(u.$ref){if(s.has(u))return u;s.add(u);const B=l.get(u)?.def;if(!B)return u;const X=ws(l,B,s);return X===B?u:X}for(const B of["anyOf","oneOf"]){const X=u[B];if(!Array.isArray(X))continue;const J=X.map(fe=>ws(l,fe,s));J.some((fe,Re)=>fe!==X[Re])&&(u={...u,[B]:J})}const r=Array.isArray(u.type)?u.type:[u.type],o=!r.includes("string")&&r.some(B=>B==="number"||B==="integer"),d=u.enum??(u.const!==void 0?[u.const]:void 0);if(!o&&!d?.some(B=>typeof B=="number"))return u;const{minimum:h,maximum:y,exclusiveMinimum:v,exclusiveMaximum:p,multipleOf:z,format:N,id:w,...C}=u;return C.enum?C.enum=C.enum.map(B=>typeof B=="number"?String(B):B):typeof C.const=="number"&&(C.const=String(C.const)),o&&(C.type="string",d||(C.pattern=(r.includes("number")?Vs:ap).source)),C}const Rs=new WeakMap;function o1(l){const u=new Map;for(const r of l.seen.values())r.def&&!u.has(r.schema)&&u.set(r.schema,r);const s=new Map;for(const r of Rs.get(l)??[]){const o=l.seen.get(r),d=(o?.def??o?.schema)?.propertyNames;if(!d||d===!0||s.has(d))continue;const h=ws(u,d,new Set);h!==d&&s.set(d,h)}if(s.size)for(const r of l.seen.values())for(const o of[r.schema,r.def]){const d=o&&s.get(o.propertyNames);d&&(o.propertyNames=d)}}const f1=(l,u,s,r)=>{const o=s,d=l._zod.def;o.type="object";const h=d.keyType,v=h._zod.bag?.patterns;if(d.mode==="loose"&&v&&v.size>0){const N=qe(d.valueType,u,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const w of v)dt(o.patternProperties,w.source,N)}else{if(u.target==="draft-07"||u.target==="draft-2020-12"){o.propertyNames=qe(d.keyType,u,{...r,path:[...r.path,"propertyNames"]});let N=Rs.get(u);N||(N=[],Rs.set(u,N),u.deferred.push(()=>o1(u))),N.push(l)}o.additionalProperties=qe(d.valueType,u,{...r,path:[...r.path,"additionalProperties"]})}const p=h._zod.values,z=u.io==="input"&&Gi(d.valueType)!==void 0;if(p&&!d.partial&&!z){const N=[...p].filter(w=>typeof w=="string"||typeof w=="number");N.length>0&&(o.required=N.map(String))}},d1=(l,u,s,r)=>{const o=l._zod.def,d=qe(o.innerType,u,r),h=u.seen.get(l);u.target==="openapi-3.0"?(h.ref=o.innerType,s.nullable=!0):s.anyOf=[d,{type:"null"}]},h1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType},Fs=Symbol();function Np(l,u,s,r,o){let d=!1;const h=JSON.stringify(l,(y,v)=>typeof v!="bigint"?v:(d=!0,null));return d?(Jn(u,s,r,o,"BigInt defaults cannot be represented in JSON Schema"),Fs):JSON.parse(h)}const m1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType;const h=Np(o.defaultValue,l,u,s,r);h!==Fs&&(s.default=h)},p1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);if(d.ref=o.innerType,u.io!=="input")return;const h=Np(o.defaultValue,l,u,s,r);h!==Fs&&(s._prefault=h)},y1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType;let h;try{h=o.catchValue(void 0)}catch{Jn(l,u,s,r,"Dynamic catch values are not supported in JSON Schema");return}s.default=h},g1=(l,u,s,r)=>{const o=l._zod.def,d=o.in._zod.traits.has("$ZodTransform"),h=u.io==="input"?d?o.out:o.in:o.out;qe(h,u,r);const y=u.seen.get(l);y.ref=h},v1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType,s.readOnly=!0},jp=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType},$m=new WeakSet([Object.prototype,Error.prototype]);function Ri(l,u,s){Object.defineProperty(l,u,{configurable:!0,enumerable:!1,get(){const r=s(this);return Object.defineProperty(this,u,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,u,{value:r,configurable:!0,writable:!0})}})}const b1=(l,u)=>{ep.init(l,u),l.name="ZodError";const s=Object.getPrototypeOf(l);$m.has(s)||($m.add(s),Ri(s,"format",r=>o=>Fv(r,o)),Ri(s,"flatten",r=>o=>Jv(r,o)),Ri(s,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,xs,2)}),Ri(s,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,xs,2)}),Object.defineProperty(s,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},qt=M("ZodError",b1,void 0,{Parent:Error}),_1=Xs(qt),S1=Qs(qt),z1=Xi(qt),E1=Qi(qt),T1=Pv(qt),O1=e0(qt),A1=t0(qt),N1=n0(qt),j1=l0(qt),x1=a0(qt),D1=u0(qt),U1=i0(qt);function M1(){Qt.localeError||Wt(t_())}function Ki(){Qt.memoizer||Wt({memoizer:Ib()})}const je=M("ZodType",(l,u)=>(M1(),Ne.init(l,u),l.def=u,l.type=u.type,l),{check(...l){const u=this.def;return this.clone(Wn(u,{checks:[...u.checks??[],...l.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...l){return this.check(...l)},clone(l,u){return In(this,l,u)},brand(){return this},register(l,u){return l.add(this,u),this},refine(l,u){return this.check(AS(l,u))},superRefine(l,u){return this.check(NS(l,u))},overwrite(l){return this.check(fa(l))},optional(){return Gm(this)},exactOptional(){return mS(this)},nullable(){return Lm(this)},nullish(){return Gm(Lm(this))},nonoptional(l){return _S(this,l)},array(){return et(this)},or(l){return cS([this,l])},and(l){return sS(this,l)},transform(l){return Xm(this,hS(l))},default(l){return gS(this,l)},prefault(l){return bS(this,l)},catch(l){return zS(this,l)},pipe(l){return Xm(this,l)},readonly(){return OS(this)},describe(l){const u=this.clone();return ru.add(u,{description:l}),u},meta(...l){if(l.length===0)return ru.get(this);const u=this.clone();return ru.add(u,l[0]),u},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(l,...u){return u.length===0?l(this):l(this,...u)},get"~standard"(){return Wm(this,"~standard",{...cp(this),jsonSchema:{input:ki(this,"input"),output:ki(this,"output")}})},set"~standard"(l){sa(this,"~standard",l)},parse:function l(u,s){return _1(this,u,s,{callee:l})},parseAsync:async function l(u,s){return await S1(this,u,s,{callee:l})},safeParse(l,u){return z1(this,l,u)},async safeParseAsync(l,u){return E1(this,l,u)},get spa(){return this?.safeParseAsync},set spa(l){sa(this,"spa",l)},encode:function l(u,s){return T1(this,u,s,{callee:l})},decode:function l(u,s){return O1(this,u,s,{callee:l})},encodeAsync:async function l(u,s){return await A1(this,u,s,{callee:l})},decodeAsync:async function l(u,s){return await N1(this,u,s,{callee:l})},safeEncode(l,u){return j1(this,l,u)},safeDecode(l,u){return x1(this,l,u)},async safeEncodeAsync(l,u){return D1(this,l,u)},async safeDecodeAsync(l,u){return U1(this,l,u)},toJSONSchema(l){return J_(this,{})(l)},get description(){return ru.get(this)?.description},get _def(){return this._zod.def}}),xp=M("_ZodString",(l,u)=>{Js.init(l,u),je.init(l,u),l._zod.processJSONSchema=(r,o,d)=>W_(l,r,o);const s=l._zod.bag;l.format=s.format??null,l.minLength=s.minimum??null,l.maxLength=s.maximum??null},{regex(...l){return this.check(Z_(...l))},includes(...l){return this.check(C_(...l))},startsWith(...l){return this.check(B_(...l))},endsWith(...l){return this.check(H_(...l))},min(...l){return this.check(Yi(...l))},max(...l){return this.check(_p(...l))},length(...l){return this.check(Sp(...l))},nonempty(...l){return this.check(Yi(1,...l))},lowercase(l){return this.check(w_(l))},uppercase(l){return this.check(R_(l))},trim(){return this.check(q_())},normalize(...l){return this.check($_(...l))},toLowerCase(){return this.check(Y_())},toUpperCase(){return this.check(k_())},slugify(){return this.check(G_())}}),Z1=M("ZodString",(l,u)=>{Js.init(l,u),xp.init(l,u)},{email(l){return this.check(u_(B1,l))},url(l){return this.check(vp(Up,l))},jwt(l){return this.check(T_(eS,l))},emoji(l){return this.check(o_(q1,l))},guid(l){return this.check(i_(H1,l))},uuid(l){return this.check(c_(su,l))},uuidv4(l){return this.check(r_(su,l))},uuidv6(l){return this.check(s_(su,l))},uuidv7(l){return this.check(gp(su,l))},nanoid(l){return this.check(f_(Y1,l))},cuid(l){return this.check(d_(k1,l))},cuid2(l){return this.check(h_(G1,l))},ulid(l){return this.check(m_(L1,l))},base64(l){return this.check(S_(W1,l))},base64url(l){return this.check(z_(I1,l))},xid(l){return this.check(p_(X1,l))},ksuid(l){return this.check(y_(Q1,l))},ipv4(l){return this.check(g_(V1,l))},ipv6(l){return this.check(v_(K1,l))},cidrv4(l){return this.check(b_(J1,l))},cidrv6(l){return this.check(__(F1,l))},e164(l){return this.check(E_(P1,l))},datetime(l){return this.check(bp(Dp,l))},date(l){return this.check(O_(w1,l))},time(l){return this.check(A_(R1,l))},duration(l){return this.check(N_(C1,l))}});function Se(l){return a_(Z1,l)}const xe=M("ZodStringFormat",(l,u)=>{Ae.init(l,u),xp.init(l,u)}),Dp=M("ZodISODateTime",(l,u)=>{ob.init(l,u),xe.init(l,u)}),w1=M("ZodISODate",(l,u)=>{fb.init(l,u),xe.init(l,u)}),R1=M("ZodISOTime",(l,u)=>{db.init(l,u),xe.init(l,u)}),C1=M("ZodISODuration",(l,u)=>{hb.init(l,u),xe.init(l,u)}),B1=M("ZodEmail",(l,u)=>{F0.init(l,u),xe.init(l,u)}),H1=M("ZodGUID",(l,u)=>{K0.init(l,u),xe.init(l,u)}),su=M("ZodUUID",(l,u)=>{J0.init(l,u),xe.init(l,u)});function fu(l){return gp(su,l)}const Up=M("ZodURL",(l,u)=>{nb.init(l,u),xe.init(l,u)});function $1(l){return vp(Up,l)}const q1=M("ZodEmoji",(l,u)=>{lb.init(l,u),xe.init(l,u)}),Y1=M("ZodNanoID",(l,u)=>{ab.init(l,u),xe.init(l,u)}),k1=M("ZodCUID",(l,u)=>{ub.init(l,u),xe.init(l,u)}),G1=M("ZodCUID2",(l,u)=>{ib.init(l,u),xe.init(l,u)}),L1=M("ZodULID",(l,u)=>{cb.init(l,u),xe.init(l,u)}),X1=M("ZodXID",(l,u)=>{rb.init(l,u),xe.init(l,u)}),Q1=M("ZodKSUID",(l,u)=>{sb.init(l,u),xe.init(l,u)}),V1=M("ZodIPv4",(l,u)=>{mb.init(l,u),xe.init(l,u)}),K1=M("ZodIPv6",(l,u)=>{yb.init(l,u),xe.init(l,u)}),J1=M("ZodCIDRv4",(l,u)=>{gb.init(l,u),xe.init(l,u)}),F1=M("ZodCIDRv6",(l,u)=>{bb.init(l,u),xe.init(l,u)}),W1=M("ZodBase64",(l,u)=>{_b.init(l,u),xe.init(l,u)}),I1=M("ZodBase64URL",(l,u)=>{zb.init(l,u),xe.init(l,u)}),P1=M("ZodE164",(l,u)=>{Eb.init(l,u),xe.init(l,u)}),eS=M("ZodJWT",(l,u)=>{Ob.init(l,u),xe.init(l,u)}),Mp=M("ZodNumber",(l,u)=>{dp.init(l,u),je.init(l,u),l._zod.processJSONSchema=(r,o,d)=>I_(l,r,o,d);const s=l._zod.bag;l.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,l.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,l.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),l.isFinite=!0,l.format=s.format??null},{gt(l,u){return this.check(wm(l,u))},gte(l,u){return this.check(Ns(l,u))},min(l,u){return this.check(Ns(l,u))},lt(l,u){return this.check(Zm(l,u))},lte(l,u){return this.check(As(l,u))},max(l,u){return this.check(As(l,u))},int(l){return this.check(qm(l))},safe(l){return this.check(qm(l))},positive(l){return this.check(wm(0,l))},nonnegative(l){return this.check(Ns(0,l))},negative(l){return this.check(Zm(0,l))},nonpositive(l){return this.check(As(0,l))},multipleOf(l,u){return this.check(Rm(l,u))},step(l,u){return this.check(Rm(l,u))},finite(){return this}});function Ht(l){return j_(Mp,l)}const tS=M("ZodNumberFormat",(l,u)=>{Ab.init(l,u),Mp.init(l,u)});function qm(l){return x_(tS,l)}const nS=M("ZodBoolean",(l,u)=>{Nb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>P_(l,s,r)});function Cs(l){return D_(nS,l)}const lS=M("ZodUnknown",(l,u)=>{jb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>t1()});function Ym(){return U_(lS)}const aS=M("ZodNever",(l,u)=>{xb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>e1(l,s,r)});function Zp(l){return M_(aS,l)}const uS=M("ZodArray",(l,u)=>{Ki(),Db.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>i1(l,s,r,o),l.element=u.element},{min(l,u){return this.check(Yi(l,u))},nonempty(l){return this.check(Yi(1,l))},max(l,u){return this.check(_p(l,u))},length(l,u){return this.check(Sp(l,u))},unwrap(){return this.element}});function et(l,u){return L_(uS,l,u)}const wp=M("ZodObject",(l,u)=>{Ki(),Zb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>c1(l,s,r,o),Yv(l,"shape",s=>s._zod.def.shape,!1)},{keyof(){return Fn(Object.keys(this._zod.def.shape))},catchall(l){return this.clone({...this._zod.def,catchall:l})},passthrough(){return this.clone({...this._zod.def,catchall:Ym()})},loose(){return this.clone({...this._zod.def,catchall:Ym()})},strict(){return this.clone({...this._zod.def,catchall:Zp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(l){return Dv(this,l)},safeExtend(l){return Uv(this,l)},merge(l){return Mv(this,l)},pick(l){return jv(this,l)},omit(l){return xv(this,l)},partial(...l){return hm(Rp,this,l[0])},exactPartial(...l){return hm(Cp,this,l[0],"exactPartial")},required(...l){return Zv(Bp,this,l[0])}});function Bt(l,u){const s={type:"object",shape:l??{},...G(u)};return new wp(s)}function Sn(l,u){return new wp({type:"object",shape:l,catchall:Zp(),...G(u)})}const iS=M("ZodUnion",(l,u)=>{wb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>r1(l,s,r,o),l.options=u.options});function cS(l,u){return new iS({type:"union",options:l,...G(u)})}const rS=M("ZodIntersection",(l,u)=>{Rb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>s1(l,s,r,o)});function sS(l,u){return new rS({type:"intersection",left:l,right:u})}const km=M("ZodRecord",(l,u)=>{Ki(),Cb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>f1(l,s,r,o),l.keyType=u.keyType,l.valueType=u.valueType});function oS(l,u,s){return!u||!u._zod?new km({type:"record",keyType:Se(),valueType:l,...G(u)}):new km({type:"record",keyType:l,valueType:u,...G(s)})}const Bs=M("ZodEnum",(l,u)=>{Bb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(r,o,d)=>n1(l,r,o),l.enum=u.entries,l.options=Object.values(u.entries);const s=new Set(Object.keys(u.entries));l.extract=(r,o)=>{const d={};for(const h of r)if(s.has(h))d[h]=u.entries[h];else throw new Error(`Key ${h} not found in enum`);return new Bs({...u,checks:[],...G(o),entries:d})},l.exclude=(r,o)=>{const d={...u.entries};for(const h of r)if(s.has(h))delete d[h];else throw new Error(`Key ${h} not found in enum`);return new Bs({...u,checks:[],...G(o),entries:d})}});function Fn(l,u){const s=Array.isArray(l)?Object.fromEntries(l.map(r=>[r,r])):l;return new Bs({type:"enum",entries:s,...G(u)})}const fS=M("ZodLiteral",(l,u)=>{Hb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>l1(l,s,r,o),l.values=new Set(u.values),Object.defineProperty(l,"value",{get(){if(u.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return u.values[0]}})});function Ws(l,u){return new fS({type:"literal",values:Array.isArray(l)?l:[l],...G(u)})}const dS=M("ZodTransform",(l,u)=>{Ki(),$b.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>u1(l,s,r,o),l._zod.parse=(s,r)=>{if(r.direction==="backward")throw new Im(l.constructor.name);s.addIssue=d=>{if(typeof d=="string")s.issues.push(du(d,s.value,u));else{const h=d;h.fatal&&(h.continue=!1),h.code??(h.code="custom"),"input"in h||(h.input=s.value),h.inst??(h.inst=l),s.issues.push(du(h))}};const o=u.transform(s.value,s);return o instanceof Promise?o.then(d=>(s.value=d,s)):(s.value=o,s)}});function hS(l){return new dS({type:"transform",transform:l})}const Rp=M("ZodOptional",(l,u)=>{pp.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>jp(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function Gm(l){return new Rp({type:"optional",innerType:l})}const Cp=M("ZodExactOptional",(l,u)=>{qb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>jp(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function mS(l){return new Cp({type:"optional",innerType:l})}const pS=M("ZodNullable",(l,u)=>{Yb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>d1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function Lm(l){return new pS({type:"nullable",innerType:l})}const yS=M("ZodDefault",(l,u)=>{kb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>m1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType,l.removeDefault=l.unwrap});function gS(l,u){return new yS({type:"default",innerType:l,get defaultValue(){return typeof u=="function"?u():Jm(u)}})}const vS=M("ZodPrefault",(l,u)=>{Gb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>p1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function bS(l,u){return new vS({type:"prefault",innerType:l,get defaultValue(){return typeof u=="function"?u():Jm(u)}})}const Bp=M("ZodNonOptional",(l,u)=>{Lb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>h1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function _S(l,u){return new Bp({type:"nonoptional",innerType:l,...G(u)})}const SS=M("ZodCatch",(l,u)=>{Xb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>y1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType,l.removeCatch=l.unwrap});function zS(l,u){return new SS({type:"catch",innerType:l,catchValue:typeof u=="function"?u:Gv(u)})}const ES=M("ZodPipe",(l,u)=>{Qb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>g1(l,s,r,o),l.in=u.in,l.out=u.out});function Xm(l,u){return new ES({type:"pipe",in:l,out:u})}const TS=M("ZodReadonly",(l,u)=>{Vb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>v1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function OS(l){return new TS({type:"readonly",innerType:l})}const Hp=M("ZodCustom",(l,u)=>{Kb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>a1(l,s,r,o)});function AS(l,u={}){return X_(Hp,l,u)}function NS(l,u){return Q_(l,u)}function jS(l,u={}){const s=new Hp({type:"custom",check:"custom",fn:r=>r instanceof l,abort:!0,...G(u)});return s._zod.bag.Class=l,s._zod.check=r=>{r.value instanceof l||r.issues.push({code:"invalid_type",expected:l.name,input:r.value,inst:s,path:[...s._zod.def.path??[]]})},s}function bl(l){return bp(Dp,l)}const Xt=Se().regex(/^(0|[1-9][0-9]*)$/),oa=Xt.max(78),Ji=$1().refine(l=>{const u=new URL(l);return["http:","https:"].includes(u.protocol)&&!u.username&&!u.password},"Expected an HTTP(S) URL without credentials"),Qe=Se().min(1).max(256),$p=oS(Se(),Se());Bt({url:Ji,method:Se().min(1).max(64),headers:$p});Bt({status:Ht().int().min(100).max(599),headers:$p,body:jS(Uint8Array).optional()});const xS=Bt({id:fu(),ts:bl(),rail:Ws("x402"),attemptedAt:bl().optional(),status:Fn(["observed","blocked"]),reason:Se().optional(),amount:oa,decimals:Ht().int().min(0).max(255),decimalsKnown:Cs(),asset:Qe,assetSymbol:Qe.optional(),network:Qe,payTo:Qe,payer:Qe.optional(),resource:Ji,host:Qe,txHash:Se().optional(),taskId:Qe.optional(),agentId:Qe.optional(),raw:Se(),paymentKey:Se().min(1),settlementStatus:Fn(["unknown","confirmed","failed"]).default("unknown"),settlement_unknown:Cs().default(!0)});Bt({id:fu(),ts:bl(),paymentId:fu(),attemptId:fu().optional(),attemptedAt:bl().optional(),status:Fn(["unknown","confirmed","failed"]),txHash:Se().optional(),reason:Se().optional()});const DS=Bt({id:fu(),ts:bl(),code:Fn(["parse_failed","settlement_unknown","tls_unmetered","storage_failed"]),resource:Se(),message:Se()});Bt({error:Ws("blocked_by_taximeter"),reason:Se(),budget:oa.nullable(),spent:Xt,remaining:oa.nullable(),fix:Se().optional()});const Ci=Sn({amount:oa.optional(),maxPayments:Ht().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),asset:Qe,network:Qe.optional(),window:Fn(["1h","24h","7d","30d"]).optional()}),Bi=Ci.refine(l=>l.amount!==void 0||l.maxPayments!==void 0,{message:"A budget must set amount or maxPayments",path:["amount"]}),US=Sn({allowHosts:et(Qe).default([]),denyHosts:et(Qe).default([]),allowPayTo:et(Qe).default([]),maxSinglePayment:oa.nullable().default("1000000"),maxSingleAsset:Qe.default("USDC"),unknownAsset:Fn(["allow","deny"]).default("deny")}),MS=Sn({proxy:Ht().int().min(0).max(65535).default(8402),dashboard:Ht().int().min(0).max(65535).default(8403)});Sn({budgets:Sn({perTask:Bi.nullable().default({amount:"5000000",asset:"USDC"}),perAgent:Bi.nullable().default({amount:"50000000",asset:"USDC",window:"24h"}),global:Bi.nullable().default({amount:"100000000",asset:"USDC",window:"24h"})}).prefault({}),policy:US.prefault({}),ports:MS.prefault({}),db:Se().min(1).default("~/.taximeter/ledger.db"),upstream:Ji.optional()});Sn({budgets:Sn({perTask:Ci.partial().nullable().optional(),perAgent:Ci.partial().nullable().optional(),global:Ci.partial().nullable().optional()}).optional(),policy:Sn({allowHosts:et(Qe).optional(),denyHosts:et(Qe).optional(),allowPayTo:et(Qe).optional(),maxSinglePayment:oa.nullable().optional(),maxSingleAsset:Qe.optional(),unknownAsset:Fn(["allow","deny"]).optional()}).optional(),ports:Sn({proxy:Ht().int().min(0).max(65535).optional(),dashboard:Ht().int().min(0).max(65535).optional()}).optional(),db:Se().min(1).optional(),upstream:Ji.optional()});const Hs=Bt({network:Se(),asset:Se(),assetSymbol:Se().optional(),decimals:Ht().int(),decimalsKnown:Cs(),amount:Xt,confirmedAmount:Xt,unknownAmount:Xt});function ZS(l,u){const s=BigInt(l).toString();if(u===0)return s;const r=s.padStart(u+1,"0");return`${r.slice(0,-u)}.${r.slice(-u)}`}const wS="0.3.1",RS=Se().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/).parse(wS),CS=xS.omit({raw:!0}),js=Hs.extend({key:Se().nullable()}),BS=Bt({version:Ws(RS),generatedAt:bl(),totalEvents:Ht().int(),blockedEvents:Ht().int(),unknownEvents:Ht().int(),totals:et(Hs),events:et(CS),diagnostics:et(DS),groups:Bt({task:et(js),agent:et(js),host:et(js)}),hours:et(Bt({ts:bl(),totals:et(Hs)})),globalBudget:Bi.nullable(),budgets:et(Bt({network:Se(),asset:Se(),limit:Xt.nullable(),spent:Xt,remaining:Xt.nullable(),count:Xt,countLimit:Xt.nullable(),countRemaining:Xt.nullable(),window:Se().nullable()})),proxy:Bt({port:Ht().int(),upstream:Se().optional()})});function $t(l){return`${l.network}/${l.asset.toLowerCase()}`}function At(l,u){return u.decimalsKnown?ZS(l,u.decimals):`${l} atomic units`}function $s(l,u){const s=BigInt(u);if(s<=0n)return"0";const r=BigInt(l)*10000n/s,o=r<0n?0n:r>10000n?10000n:r;return`${o/100n}.${(o%100n).toString().padStart(2,"0")}`}function hu(l){return l==="eip155:8453"?"Base":l==="eip155:84532"?"Base Sepolia":l==="eip155:1"?"Ethereum":l}function Fi(l){return l.assetSymbol??`${l.asset.slice(0,8)}…${l.asset.slice(-6)}`}function _n(l){return new Date(l).toISOString().slice(11,19)}function HS(l,u){const s=l.map(p=>({ts:p.ts,amount:p.totals.find(z=>$t(z)===u)?.amount??"0"})),r=s.reduce((p,z)=>p+BigInt(z.amount),0n),o=s.reduce((p,z)=>BigInt(z.amount)>p?BigInt(z.amount):p,0n);let d=0n;const h=BigInt(Math.max(s.length-1,1)),y=BigInt(Math.max(s.length,1)),v=s.map((p,z)=>(d+=BigInt(p.amount),{...p,x:(32n+BigInt(z)*936n/h).toString(),y:(184n-(r>0n?d*132n/r:0n)).toString(),barX:(32n+BigInt(z)*936n/y).toString(),barWidth:(936n/y-7n).toString(),barHeight:(o>0n?BigInt(p.amount)*106n/o:0n).toString(),barY:(138n-(o>0n?BigInt(p.amount)*106n/o:0n)).toString()}));return{series:v,points:v.map(p=>`${p.x},${p.y}`).join(" "),sum:r.toString(),maximum:o.toString()}}const Qm=[{view:"now",label:"Now"},{view:"task",label:"By task"},{view:"agent",label:"By agent"},{view:"host",label:"By host"},{view:"timeline",label:"Timeline"},{view:"export",label:"Export"}];function Is(){return g.jsxs("span",{className:"wordmark",children:[g.jsxs("span",{className:"mark","aria-hidden":"true",children:[g.jsx("i",{}),g.jsx("i",{}),g.jsx("i",{})]}),"taximeter"]})}function $S({state:l}){const u=`http://127.0.0.1:${l.proxy.port}`;return g.jsxs("section",{className:"empty-state","aria-label":"Getting started",children:[g.jsxs("div",{className:"empty-heading",children:[g.jsx("span",{className:"eyebrow",children:"READY WHEN YOU ARE"}),g.jsx("h2",{children:"Your next payment starts the ledger."}),g.jsx("p",{children:"Point your agent at the local proxy. Taximeter records each supported payment and checks its budget before the replay goes upstream."})]}),g.jsxs("div",{className:"connection-instructions",children:[g.jsx("span",{className:"eyebrow",children:"YOUR LOCAL PROXY"}),g.jsx("code",{children:u}),g.jsx("p",{children:l.proxy.upstream?g.jsxs(g.Fragment,{children:["Requests forward to ",g.jsx("strong",{children:l.proxy.upstream}),"."]}):g.jsxs(g.Fragment,{children:["Use this address with an HTTP-proxy-aware client. For an explicit API base URL, restart with ",g.jsx("code",{children:"--upstream"})," set to your API."]})}),g.jsxs("p",{className:"connection-limit",children:["HTTPS CONNECT passes through unmetered. Use an explicit upstream or the"," ",g.jsx("code",{children:"withMeter"})," SDK to inspect HTTPS payments."]})]}),g.jsxs("div",{className:"empty-footer",children:[g.jsx("span",{children:"No payments recorded"}),g.jsx("span",{children:"No keys. No custody. Everything stays local."})]})]})}function qS({event:l}){const u=l.status==="blocked"?"Blocked":l.settlementStatus==="confirmed"?"Settled":l.settlementStatus==="failed"?"Failed":"Unknown",s=l.status==="blocked"?"blocked":l.settlementStatus;return g.jsx("span",{className:`event-status status-${s}`,title:l.reason??(u==="Settled"?"Settlement reported by the upstream":u==="Unknown"?"Settlement unknown; budget remains reserved":void 0),children:u})}function YS({state:l}){return g.jsxs("section",{className:"ledger-section",children:[g.jsxs("div",{className:"section-heading",children:[g.jsx("div",{children:g.jsxs("h2",{children:["Live ledger ",g.jsxs("span",{className:"muted",children:["/ latest ",l.events.length]})]})}),g.jsx("span",{className:"table-note",children:"All assets · times in UTC"})]}),g.jsx("div",{className:"table-scroll",children:g.jsxs("table",{className:"event-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{scope:"col",children:"Time"}),g.jsx("th",{scope:"col",children:"Resource"}),g.jsx("th",{scope:"col",children:"Task / agent"}),g.jsx("th",{scope:"col",children:"Network"}),g.jsx("th",{scope:"col",className:"numeric",children:"Amount"}),g.jsx("th",{scope:"col",children:"Asset"}),g.jsx("th",{scope:"col",className:"status-cell",children:"Status"})]})}),g.jsx("tbody",{children:l.events.map(u=>g.jsxs("tr",{className:u.status==="blocked"?"blocked-row":void 0,children:[g.jsx("td",{className:"mono time-cell",title:u.ts,children:_n(u.ts)}),g.jsx("td",{className:"resource-cell",children:g.jsx("a",{href:u.resource,target:"_blank",rel:"noreferrer",title:u.resource,children:u.host})}),g.jsxs("td",{className:"attribution-cell",title:`Task: ${u.taskId??"Unattributed"}
100
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of l.seen.entries()){const y=h[1];if(u===h[0]){d(h);continue}if(l.external){const p=l.external.registry.get(h[0])?.id;if(u!==h[0]&&p){d(h);continue}}if(l.metadataRegistry.get(h[0])?.id){d(h);continue}if(y.cycle){d(h);continue}if(y.count>1&&l.reused==="ref"){d(h);continue}}l.external&&(l.sharedDefsExtractedFor=l.external)}function Tp(l){const u=l.anyOf;if(!Array.isArray(u)||u.length===0||l.type!==void 0)return;const s=[];for(const r of u){if(!r||typeof r!="object")return;Tp(r);const o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;const d=r.type;for(const h of Array.isArray(d)?d:[d]){if(typeof h!="string")return;s.includes(h)||s.push(h)}}delete l.anyOf,l.type=s.length===1?s[0]:s}const Op=new Set(["type","properties","required","additionalProperties"]),Bm=["oneOf","anyOf"];function Hm(l){const u=l.additionalProperties;return u===void 0||u===!1||typeof u!="object"||u===null?null:Object.keys(u).length?u:null}function Zs(l){const u=[];for(const d of l){if(typeof d!="object"||d.type!=="object")return null;for(const h in d)if(!Op.has(h))return null;u.push(d)}const s={},r=new Set;for(const d of u){for(const h in d.properties){if(Object.prototype.hasOwnProperty.call(s,h))continue;const y=[];for(const p of u){const z=p.properties?.[h]??Hm(p);z!=null&&(y.some(N=>JSON.stringify(N)===JSON.stringify(z))||y.push(z))}const v=y.length===1?y[0]:Zs(y)??{allOf:y};dt(s,h,v)}for(const h of d.required??[])r.add(h)}const o={type:"object",properties:s};if(r.size&&(o.required=[...r]),u.every(d=>d.additionalProperties===!1))o.additionalProperties=!1;else{const d=[];for(const h of u){const y=Hm(h);y&&!d.some(v=>JSON.stringify(v)===JSON.stringify(y))&&d.push(y)}d.length===1?o.additionalProperties=d[0]:d.length>1&&(o.additionalProperties={allOf:d})}return o}function K_(l){const u=l.allOf;if(!Array.isArray(u)||u.length<2)return;for(const o of Op)if(o in l)return;const s=u.filter(o=>Bm.some(d=>Array.isArray(o[d])));let r=null;if(!s.length)r=Zs(u);else{const o=s[0],d=Bm.find(v=>Array.isArray(o[v]));if(Object.keys(o).length!==1)return;const h=u.filter(v=>v!==o),y=o[d].map(v=>Zs([...h,v]));if(y.some(v=>!v))return;r={[d]:y}}r&&(delete l.allOf,ou(l,r))}function Ap(l,u){const s=l.seen.get(u);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=y=>{const v=l.seen.get(y);if(v.ref===null)return;const p=v.def??v.schema,z={...p},N=v.ref;if(v.ref=null,N){r(N);const C=l.seen.get(N),B=C.schema;if(B.$ref&&(l.target==="draft-07"||l.target==="draft-04"||l.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(B)):ou(p,B),ou(p,z),y._zod.parent===N)for(const J in p)J==="$ref"||J==="allOf"||J in z||delete p[J];if(B.$ref&&C.def)for(const J in p)J==="$ref"||J==="allOf"||J in C.def&&JSON.stringify(p[J])===JSON.stringify(C.def[J])&&delete p[J]}const w=y._zod.parent;if(w&&w!==N){r(w);const C=l.seen.get(w);if(C?.schema.$ref&&(p.$ref=C.schema.$ref,C.def))for(const B in p)B==="$ref"||B==="allOf"||B in C.def&&JSON.stringify(p[B])===JSON.stringify(C.def[B])&&delete p[B]}l.override({zodSchema:y,jsonSchema:p,path:v.path??[]})};if(!l.external||l.sharedEmitDoneFor!==l.external){for(const y of[...l.seen.entries()].reverse())r(y[0]);if(l.target!=="openapi-3.0")for(const y of l.seen.entries())Tp(y[1].def??y[1].schema);for(const y of l.deferred)y();if(l.intersections.length){const y=new Map;for(const v of l.seen.values())for(const p of[v.schema,v.def]){const z=p?.allOf;if(!Array.isArray(z))continue;const N=y.get(z);N?N.push(p):y.set(z,[p])}for(const v of l.intersections)for(const p of y.get(v)??[])K_(p)}}const o={};if(l.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":l.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":l.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":l.target,l.external?.uri){const y=l.external.registry.get(u)?.id;if(!y)throw new Error("Schema is missing an `id` property");o.$id=l.external.uri(y)}ou(o,s.defId?s.schema:s.def??s.schema);const d=l.metadataRegistry.get(u)?.id;d!==void 0&&o.id===d&&delete o.id;const h=l.external?.defs??{};if(!l.external||l.sharedEmitDoneFor!==l.external)for(const y of l.seen.entries()){const v=y[1];v.def&&v.defId&&(v.def.id===v.defId&&delete v.def.id,dt(h,v.defId,v.def))}l.external&&(l.sharedEmitDoneFor=l.external),l.external||Object.keys(h).length>0&&(l.target==="draft-2020-12"?o.$defs=h:o.definitions=h);try{const y=JSON.parse(JSON.stringify(o));return Object.defineProperty(y,"~standard",{value:{...u["~standard"],jsonSchema:{input:ki(u,"input",l.processors),output:ki(u,"output",l.processors)}},enumerable:!1,writable:!1}),y}catch{throw new Error("Error converting schema to JSON.")}}function lt(l,u){const s=u??{seen:new Set};if(s.seen.has(l))return!1;s.seen.add(l);const r=l._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return lt(r.element,s);if(r.type==="set")return lt(r.valueType,s);if(r.type==="lazy")return lt(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return lt(r.innerType,s);if(r.type==="intersection")return lt(r.left,s)||lt(r.right,s);if(r.type==="record"||r.type==="map")return lt(r.keyType,s)||lt(r.valueType,s);if(r.type==="pipe")return l._zod.traits.has("$ZodCodec")?!0:lt(r.in,s)||lt(r.out,s);if(r.type==="object"){for(const o in r.shape)if(lt(r.shape[o],s))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(lt(o,s))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(lt(o,s))return!0;return!!(r.rest&&lt(r.rest,s))}return!1}const J_=(l,u={})=>s=>{const r=zp({...s,processors:u});return qe(l,r),Ep(r,l),Ap(r,l)},ki=(l,u,s={})=>r=>{const{libraryOptions:o,target:d}=r??{},h=zp({...o??{},target:d,io:u,processors:s});return qe(l,h),Ep(h,l),Ap(h,l)},F_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},W_=(l,u,s,r)=>{const o=s;o.type="string";const{minimum:d,maximum:h,format:y,patterns:v,contentEncoding:p,laxFormat:z}=l._zod.bag;if(typeof d=="number"&&(o.minLength=d),typeof h=="number"&&(o.maxLength=h),y&&(o.format=F_[y]??y,o.format===""&&delete o.format,(y==="time"||z)&&delete o.format),p&&(o.contentEncoding=p),v&&v.size>0){const N=[...v];N.length===1?o.pattern=N[0].source:N.length>1&&(o.allOf=[...N.map(w=>({...u.target==="draft-07"||u.target==="draft-04"||u.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))])}},I_=(l,u,s,r)=>{const o=s,{minimum:d,maximum:h,format:y,multipleOf:v,exclusiveMaximum:p,exclusiveMinimum:z}=l._zod.bag;typeof y=="string"&&y.includes("int")?o.type="integer":o.type="number";const N=typeof z=="number"&&z>=(d??Number.NEGATIVE_INFINITY),w=typeof p=="number"&&p<=(h??Number.POSITIVE_INFINITY),C=u.target==="draft-04"||u.target==="openapi-3.0";N?C?(o.minimum=z,o.exclusiveMinimum=!0):o.exclusiveMinimum=z:typeof d=="number"&&(o.minimum=d),w?C?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p:typeof h=="number"&&(o.maximum=h),typeof v=="number"&&(Number.isFinite(v)&&v!==0?o.multipleOf=Math.abs(v):Jn(l,u,o,r,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`))},P_=(l,u,s,r)=>{s.type="boolean"},e1=(l,u,s,r)=>{s.not={}},t1=(l,u,s,r)=>{},n1=(l,u,s,r)=>{const o=l._zod.def,d=Vm(o.entries);if(d.length===0){s.not={};return}d.every(h=>typeof h=="number")&&(s.type="number"),d.every(h=>typeof h=="string")&&(s.type="string"),s.enum=d},l1=(l,u,s,r)=>{const o=l._zod.def;if(o.values.length===0){s.not={};return}const d=[];for(const h of o.values)if(h===void 0){if(Jn(l,u,s,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof h=="bigint"){if(Jn(l,u,s,r,"BigInt literals cannot be represented in JSON Schema"))return;d.push(Number(h))}else d.push(h);if(d.length!==0)if(d.length===1){const h=d[0];s.type=h===null?"null":typeof h,u.target==="draft-04"||u.target==="openapi-3.0"?s.enum=[h]:s.const=h}else d.every(h=>typeof h=="number")&&(s.type="number"),d.every(h=>typeof h=="string")&&(s.type="string"),d.every(h=>typeof h=="boolean")&&(s.type="boolean"),d.every(h=>h===null)&&(s.type="null"),s.enum=d},a1=(l,u,s,r)=>{Jn(l,u,s,r,"Custom types cannot be represented in JSON Schema")},u1=(l,u,s,r)=>{Jn(l,u,s,r,"Transforms cannot be represented in JSON Schema")},i1=(l,u,s,r)=>{const o=s,d=l._zod.def,{minimum:h,maximum:y}=l._zod.bag;typeof h=="number"&&(o.minItems=h),typeof y=="number"&&(o.maxItems=y),o.type="array",o.items=qe(d.element,u,{...r,path:[...r.path,"items"]})};function Gi(l){const u=l._zod.def;return u.type==="pipe"&&u.in._zod.traits.has("$ZodTransform")?Gi(u.out):u.type==="catch"?Gi(u.innerType):l._zod.optin}const c1=(l,u,s,r)=>{const o=s,d=l._zod.def,h=d.shape;if(Object.getOwnPropertySymbols(h).length&&Jn(l,u,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(const z in h)dt(o.properties,z,qe(h[z],u,{...r,path:[...r.path,"properties",z]}));const v=new Set(Object.keys(h)),p=new Set([...v].filter(z=>{const N=d.shape[z];return u.io==="input"?Gi(N)===void 0:N._zod.optout===void 0}));p.size>0&&(o.required=Array.from(p)),d.catchall?._zod.def.type==="never"?o.additionalProperties=!1:d.catchall?d.catchall&&(o.additionalProperties=qe(d.catchall,u,{...r,path:[...r.path,"additionalProperties"]})):u.io==="output"&&(o.additionalProperties=!1)},r1=(l,u,s,r)=>{const o=l._zod.def,d=o.inclusive===!1,h=o.options.map((y,v)=>qe(y,u,{...r,path:[...r.path,d?"oneOf":"anyOf",v]}));d?s.oneOf=h:s.anyOf=h},s1=(l,u,s,r)=>{const o=l._zod.def,d=qe(o.left,u,{...r,path:[...r.path,"allOf",0]}),h=qe(o.right,u,{...r,path:[...r.path,"allOf",1]}),y=p=>"allOf"in p&&Object.keys(p).length===1,v=[...y(d)?d.allOf:[d],...y(h)?h.allOf:[h]];s.allOf=v,u.intersections.push(v)};function ws(l,u,s){if(u.$ref){if(s.has(u))return u;s.add(u);const B=l.get(u)?.def;if(!B)return u;const X=ws(l,B,s);return X===B?u:X}for(const B of["anyOf","oneOf"]){const X=u[B];if(!Array.isArray(X))continue;const J=X.map(fe=>ws(l,fe,s));J.some((fe,Re)=>fe!==X[Re])&&(u={...u,[B]:J})}const r=Array.isArray(u.type)?u.type:[u.type],o=!r.includes("string")&&r.some(B=>B==="number"||B==="integer"),d=u.enum??(u.const!==void 0?[u.const]:void 0);if(!o&&!d?.some(B=>typeof B=="number"))return u;const{minimum:h,maximum:y,exclusiveMinimum:v,exclusiveMaximum:p,multipleOf:z,format:N,id:w,...C}=u;return C.enum?C.enum=C.enum.map(B=>typeof B=="number"?String(B):B):typeof C.const=="number"&&(C.const=String(C.const)),o&&(C.type="string",d||(C.pattern=(r.includes("number")?Vs:ap).source)),C}const Rs=new WeakMap;function o1(l){const u=new Map;for(const r of l.seen.values())r.def&&!u.has(r.schema)&&u.set(r.schema,r);const s=new Map;for(const r of Rs.get(l)??[]){const o=l.seen.get(r),d=(o?.def??o?.schema)?.propertyNames;if(!d||d===!0||s.has(d))continue;const h=ws(u,d,new Set);h!==d&&s.set(d,h)}if(s.size)for(const r of l.seen.values())for(const o of[r.schema,r.def]){const d=o&&s.get(o.propertyNames);d&&(o.propertyNames=d)}}const f1=(l,u,s,r)=>{const o=s,d=l._zod.def;o.type="object";const h=d.keyType,v=h._zod.bag?.patterns;if(d.mode==="loose"&&v&&v.size>0){const N=qe(d.valueType,u,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const w of v)dt(o.patternProperties,w.source,N)}else{if(u.target==="draft-07"||u.target==="draft-2020-12"){o.propertyNames=qe(d.keyType,u,{...r,path:[...r.path,"propertyNames"]});let N=Rs.get(u);N||(N=[],Rs.set(u,N),u.deferred.push(()=>o1(u))),N.push(l)}o.additionalProperties=qe(d.valueType,u,{...r,path:[...r.path,"additionalProperties"]})}const p=h._zod.values,z=u.io==="input"&&Gi(d.valueType)!==void 0;if(p&&!d.partial&&!z){const N=[...p].filter(w=>typeof w=="string"||typeof w=="number");N.length>0&&(o.required=N.map(String))}},d1=(l,u,s,r)=>{const o=l._zod.def,d=qe(o.innerType,u,r),h=u.seen.get(l);u.target==="openapi-3.0"?(h.ref=o.innerType,s.nullable=!0):s.anyOf=[d,{type:"null"}]},h1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType},Fs=Symbol();function Np(l,u,s,r,o){let d=!1;const h=JSON.stringify(l,(y,v)=>typeof v!="bigint"?v:(d=!0,null));return d?(Jn(u,s,r,o,"BigInt defaults cannot be represented in JSON Schema"),Fs):JSON.parse(h)}const m1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType;const h=Np(o.defaultValue,l,u,s,r);h!==Fs&&(s.default=h)},p1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);if(d.ref=o.innerType,u.io!=="input")return;const h=Np(o.defaultValue,l,u,s,r);h!==Fs&&(s._prefault=h)},y1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType;let h;try{h=o.catchValue(void 0)}catch{Jn(l,u,s,r,"Dynamic catch values are not supported in JSON Schema");return}s.default=h},g1=(l,u,s,r)=>{const o=l._zod.def,d=o.in._zod.traits.has("$ZodTransform"),h=u.io==="input"?d?o.out:o.in:o.out;qe(h,u,r);const y=u.seen.get(l);y.ref=h},v1=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType,s.readOnly=!0},jp=(l,u,s,r)=>{const o=l._zod.def;qe(o.innerType,u,r);const d=u.seen.get(l);d.ref=o.innerType},$m=new WeakSet([Object.prototype,Error.prototype]);function Ri(l,u,s){Object.defineProperty(l,u,{configurable:!0,enumerable:!1,get(){const r=s(this);return Object.defineProperty(this,u,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,u,{value:r,configurable:!0,writable:!0})}})}const b1=(l,u)=>{ep.init(l,u),l.name="ZodError";const s=Object.getPrototypeOf(l);$m.has(s)||($m.add(s),Ri(s,"format",r=>o=>Fv(r,o)),Ri(s,"flatten",r=>o=>Jv(r,o)),Ri(s,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,xs,2)}),Ri(s,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,xs,2)}),Object.defineProperty(s,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},qt=M("ZodError",b1,void 0,{Parent:Error}),_1=Xs(qt),S1=Qs(qt),z1=Xi(qt),E1=Qi(qt),T1=Pv(qt),O1=e0(qt),A1=t0(qt),N1=n0(qt),j1=l0(qt),x1=a0(qt),D1=u0(qt),U1=i0(qt);function M1(){Qt.localeError||Wt(t_())}function Ki(){Qt.memoizer||Wt({memoizer:Ib()})}const je=M("ZodType",(l,u)=>(M1(),Ne.init(l,u),l.def=u,l.type=u.type,l),{check(...l){const u=this.def;return this.clone(Wn(u,{checks:[...u.checks??[],...l.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...l){return this.check(...l)},clone(l,u){return In(this,l,u)},brand(){return this},register(l,u){return l.add(this,u),this},refine(l,u){return this.check(AS(l,u))},superRefine(l,u){return this.check(NS(l,u))},overwrite(l){return this.check(fa(l))},optional(){return Gm(this)},exactOptional(){return mS(this)},nullable(){return Lm(this)},nullish(){return Gm(Lm(this))},nonoptional(l){return _S(this,l)},array(){return et(this)},or(l){return cS([this,l])},and(l){return sS(this,l)},transform(l){return Xm(this,hS(l))},default(l){return gS(this,l)},prefault(l){return bS(this,l)},catch(l){return zS(this,l)},pipe(l){return Xm(this,l)},readonly(){return OS(this)},describe(l){const u=this.clone();return ru.add(u,{description:l}),u},meta(...l){if(l.length===0)return ru.get(this);const u=this.clone();return ru.add(u,l[0]),u},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(l,...u){return u.length===0?l(this):l(this,...u)},get"~standard"(){return Wm(this,"~standard",{...cp(this),jsonSchema:{input:ki(this,"input"),output:ki(this,"output")}})},set"~standard"(l){sa(this,"~standard",l)},parse:function l(u,s){return _1(this,u,s,{callee:l})},parseAsync:async function l(u,s){return await S1(this,u,s,{callee:l})},safeParse(l,u){return z1(this,l,u)},async safeParseAsync(l,u){return E1(this,l,u)},get spa(){return this?.safeParseAsync},set spa(l){sa(this,"spa",l)},encode:function l(u,s){return T1(this,u,s,{callee:l})},decode:function l(u,s){return O1(this,u,s,{callee:l})},encodeAsync:async function l(u,s){return await A1(this,u,s,{callee:l})},decodeAsync:async function l(u,s){return await N1(this,u,s,{callee:l})},safeEncode(l,u){return j1(this,l,u)},safeDecode(l,u){return x1(this,l,u)},async safeEncodeAsync(l,u){return D1(this,l,u)},async safeDecodeAsync(l,u){return U1(this,l,u)},toJSONSchema(l){return J_(this,{})(l)},get description(){return ru.get(this)?.description},get _def(){return this._zod.def}}),xp=M("_ZodString",(l,u)=>{Js.init(l,u),je.init(l,u),l._zod.processJSONSchema=(r,o,d)=>W_(l,r,o);const s=l._zod.bag;l.format=s.format??null,l.minLength=s.minimum??null,l.maxLength=s.maximum??null},{regex(...l){return this.check(Z_(...l))},includes(...l){return this.check(C_(...l))},startsWith(...l){return this.check(B_(...l))},endsWith(...l){return this.check(H_(...l))},min(...l){return this.check(Yi(...l))},max(...l){return this.check(_p(...l))},length(...l){return this.check(Sp(...l))},nonempty(...l){return this.check(Yi(1,...l))},lowercase(l){return this.check(w_(l))},uppercase(l){return this.check(R_(l))},trim(){return this.check(q_())},normalize(...l){return this.check($_(...l))},toLowerCase(){return this.check(Y_())},toUpperCase(){return this.check(k_())},slugify(){return this.check(G_())}}),Z1=M("ZodString",(l,u)=>{Js.init(l,u),xp.init(l,u)},{email(l){return this.check(u_(B1,l))},url(l){return this.check(vp(Up,l))},jwt(l){return this.check(T_(eS,l))},emoji(l){return this.check(o_(q1,l))},guid(l){return this.check(i_(H1,l))},uuid(l){return this.check(c_(su,l))},uuidv4(l){return this.check(r_(su,l))},uuidv6(l){return this.check(s_(su,l))},uuidv7(l){return this.check(gp(su,l))},nanoid(l){return this.check(f_(Y1,l))},cuid(l){return this.check(d_(k1,l))},cuid2(l){return this.check(h_(G1,l))},ulid(l){return this.check(m_(L1,l))},base64(l){return this.check(S_(W1,l))},base64url(l){return this.check(z_(I1,l))},xid(l){return this.check(p_(X1,l))},ksuid(l){return this.check(y_(Q1,l))},ipv4(l){return this.check(g_(V1,l))},ipv6(l){return this.check(v_(K1,l))},cidrv4(l){return this.check(b_(J1,l))},cidrv6(l){return this.check(__(F1,l))},e164(l){return this.check(E_(P1,l))},datetime(l){return this.check(bp(Dp,l))},date(l){return this.check(O_(w1,l))},time(l){return this.check(A_(R1,l))},duration(l){return this.check(N_(C1,l))}});function Se(l){return a_(Z1,l)}const xe=M("ZodStringFormat",(l,u)=>{Ae.init(l,u),xp.init(l,u)}),Dp=M("ZodISODateTime",(l,u)=>{ob.init(l,u),xe.init(l,u)}),w1=M("ZodISODate",(l,u)=>{fb.init(l,u),xe.init(l,u)}),R1=M("ZodISOTime",(l,u)=>{db.init(l,u),xe.init(l,u)}),C1=M("ZodISODuration",(l,u)=>{hb.init(l,u),xe.init(l,u)}),B1=M("ZodEmail",(l,u)=>{F0.init(l,u),xe.init(l,u)}),H1=M("ZodGUID",(l,u)=>{K0.init(l,u),xe.init(l,u)}),su=M("ZodUUID",(l,u)=>{J0.init(l,u),xe.init(l,u)});function fu(l){return gp(su,l)}const Up=M("ZodURL",(l,u)=>{nb.init(l,u),xe.init(l,u)});function $1(l){return vp(Up,l)}const q1=M("ZodEmoji",(l,u)=>{lb.init(l,u),xe.init(l,u)}),Y1=M("ZodNanoID",(l,u)=>{ab.init(l,u),xe.init(l,u)}),k1=M("ZodCUID",(l,u)=>{ub.init(l,u),xe.init(l,u)}),G1=M("ZodCUID2",(l,u)=>{ib.init(l,u),xe.init(l,u)}),L1=M("ZodULID",(l,u)=>{cb.init(l,u),xe.init(l,u)}),X1=M("ZodXID",(l,u)=>{rb.init(l,u),xe.init(l,u)}),Q1=M("ZodKSUID",(l,u)=>{sb.init(l,u),xe.init(l,u)}),V1=M("ZodIPv4",(l,u)=>{mb.init(l,u),xe.init(l,u)}),K1=M("ZodIPv6",(l,u)=>{yb.init(l,u),xe.init(l,u)}),J1=M("ZodCIDRv4",(l,u)=>{gb.init(l,u),xe.init(l,u)}),F1=M("ZodCIDRv6",(l,u)=>{bb.init(l,u),xe.init(l,u)}),W1=M("ZodBase64",(l,u)=>{_b.init(l,u),xe.init(l,u)}),I1=M("ZodBase64URL",(l,u)=>{zb.init(l,u),xe.init(l,u)}),P1=M("ZodE164",(l,u)=>{Eb.init(l,u),xe.init(l,u)}),eS=M("ZodJWT",(l,u)=>{Ob.init(l,u),xe.init(l,u)}),Mp=M("ZodNumber",(l,u)=>{dp.init(l,u),je.init(l,u),l._zod.processJSONSchema=(r,o,d)=>I_(l,r,o,d);const s=l._zod.bag;l.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,l.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,l.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),l.isFinite=!0,l.format=s.format??null},{gt(l,u){return this.check(wm(l,u))},gte(l,u){return this.check(Ns(l,u))},min(l,u){return this.check(Ns(l,u))},lt(l,u){return this.check(Zm(l,u))},lte(l,u){return this.check(As(l,u))},max(l,u){return this.check(As(l,u))},int(l){return this.check(qm(l))},safe(l){return this.check(qm(l))},positive(l){return this.check(wm(0,l))},nonnegative(l){return this.check(Ns(0,l))},negative(l){return this.check(Zm(0,l))},nonpositive(l){return this.check(As(0,l))},multipleOf(l,u){return this.check(Rm(l,u))},step(l,u){return this.check(Rm(l,u))},finite(){return this}});function Ht(l){return j_(Mp,l)}const tS=M("ZodNumberFormat",(l,u)=>{Ab.init(l,u),Mp.init(l,u)});function qm(l){return x_(tS,l)}const nS=M("ZodBoolean",(l,u)=>{Nb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>P_(l,s,r)});function Cs(l){return D_(nS,l)}const lS=M("ZodUnknown",(l,u)=>{jb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>t1()});function Ym(){return U_(lS)}const aS=M("ZodNever",(l,u)=>{xb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>e1(l,s,r)});function Zp(l){return M_(aS,l)}const uS=M("ZodArray",(l,u)=>{Ki(),Db.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>i1(l,s,r,o),l.element=u.element},{min(l,u){return this.check(Yi(l,u))},nonempty(l){return this.check(Yi(1,l))},max(l,u){return this.check(_p(l,u))},length(l,u){return this.check(Sp(l,u))},unwrap(){return this.element}});function et(l,u){return L_(uS,l,u)}const wp=M("ZodObject",(l,u)=>{Ki(),Zb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>c1(l,s,r,o),Yv(l,"shape",s=>s._zod.def.shape,!1)},{keyof(){return Fn(Object.keys(this._zod.def.shape))},catchall(l){return this.clone({...this._zod.def,catchall:l})},passthrough(){return this.clone({...this._zod.def,catchall:Ym()})},loose(){return this.clone({...this._zod.def,catchall:Ym()})},strict(){return this.clone({...this._zod.def,catchall:Zp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(l){return Dv(this,l)},safeExtend(l){return Uv(this,l)},merge(l){return Mv(this,l)},pick(l){return jv(this,l)},omit(l){return xv(this,l)},partial(...l){return hm(Rp,this,l[0])},exactPartial(...l){return hm(Cp,this,l[0],"exactPartial")},required(...l){return Zv(Bp,this,l[0])}});function Bt(l,u){const s={type:"object",shape:l??{},...G(u)};return new wp(s)}function Sn(l,u){return new wp({type:"object",shape:l,catchall:Zp(),...G(u)})}const iS=M("ZodUnion",(l,u)=>{wb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>r1(l,s,r,o),l.options=u.options});function cS(l,u){return new iS({type:"union",options:l,...G(u)})}const rS=M("ZodIntersection",(l,u)=>{Rb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>s1(l,s,r,o)});function sS(l,u){return new rS({type:"intersection",left:l,right:u})}const km=M("ZodRecord",(l,u)=>{Ki(),Cb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>f1(l,s,r,o),l.keyType=u.keyType,l.valueType=u.valueType});function oS(l,u,s){return!u||!u._zod?new km({type:"record",keyType:Se(),valueType:l,...G(u)}):new km({type:"record",keyType:l,valueType:u,...G(s)})}const Bs=M("ZodEnum",(l,u)=>{Bb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(r,o,d)=>n1(l,r,o),l.enum=u.entries,l.options=Object.values(u.entries);const s=new Set(Object.keys(u.entries));l.extract=(r,o)=>{const d={};for(const h of r)if(s.has(h))d[h]=u.entries[h];else throw new Error(`Key ${h} not found in enum`);return new Bs({...u,checks:[],...G(o),entries:d})},l.exclude=(r,o)=>{const d={...u.entries};for(const h of r)if(s.has(h))delete d[h];else throw new Error(`Key ${h} not found in enum`);return new Bs({...u,checks:[],...G(o),entries:d})}});function Fn(l,u){const s=Array.isArray(l)?Object.fromEntries(l.map(r=>[r,r])):l;return new Bs({type:"enum",entries:s,...G(u)})}const fS=M("ZodLiteral",(l,u)=>{Hb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>l1(l,s,r,o),l.values=new Set(u.values),Object.defineProperty(l,"value",{get(){if(u.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return u.values[0]}})});function Ws(l,u){return new fS({type:"literal",values:Array.isArray(l)?l:[l],...G(u)})}const dS=M("ZodTransform",(l,u)=>{Ki(),$b.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>u1(l,s,r,o),l._zod.parse=(s,r)=>{if(r.direction==="backward")throw new Im(l.constructor.name);s.addIssue=d=>{if(typeof d=="string")s.issues.push(du(d,s.value,u));else{const h=d;h.fatal&&(h.continue=!1),h.code??(h.code="custom"),"input"in h||(h.input=s.value),h.inst??(h.inst=l),s.issues.push(du(h))}};const o=u.transform(s.value,s);return o instanceof Promise?o.then(d=>(s.value=d,s)):(s.value=o,s)}});function hS(l){return new dS({type:"transform",transform:l})}const Rp=M("ZodOptional",(l,u)=>{pp.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>jp(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function Gm(l){return new Rp({type:"optional",innerType:l})}const Cp=M("ZodExactOptional",(l,u)=>{qb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>jp(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function mS(l){return new Cp({type:"optional",innerType:l})}const pS=M("ZodNullable",(l,u)=>{Yb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>d1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function Lm(l){return new pS({type:"nullable",innerType:l})}const yS=M("ZodDefault",(l,u)=>{kb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>m1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType,l.removeDefault=l.unwrap});function gS(l,u){return new yS({type:"default",innerType:l,get defaultValue(){return typeof u=="function"?u():Jm(u)}})}const vS=M("ZodPrefault",(l,u)=>{Gb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>p1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function bS(l,u){return new vS({type:"prefault",innerType:l,get defaultValue(){return typeof u=="function"?u():Jm(u)}})}const Bp=M("ZodNonOptional",(l,u)=>{Lb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>h1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function _S(l,u){return new Bp({type:"nonoptional",innerType:l,...G(u)})}const SS=M("ZodCatch",(l,u)=>{Xb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>y1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType,l.removeCatch=l.unwrap});function zS(l,u){return new SS({type:"catch",innerType:l,catchValue:typeof u=="function"?u:Gv(u)})}const ES=M("ZodPipe",(l,u)=>{Qb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>g1(l,s,r,o),l.in=u.in,l.out=u.out});function Xm(l,u){return new ES({type:"pipe",in:l,out:u})}const TS=M("ZodReadonly",(l,u)=>{Vb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>v1(l,s,r,o),l.unwrap=()=>l._zod.def.innerType});function OS(l){return new TS({type:"readonly",innerType:l})}const Hp=M("ZodCustom",(l,u)=>{Kb.init(l,u),je.init(l,u),l._zod.processJSONSchema=(s,r,o)=>a1(l,s,r,o)});function AS(l,u={}){return X_(Hp,l,u)}function NS(l,u){return Q_(l,u)}function jS(l,u={}){const s=new Hp({type:"custom",check:"custom",fn:r=>r instanceof l,abort:!0,...G(u)});return s._zod.bag.Class=l,s._zod.check=r=>{r.value instanceof l||r.issues.push({code:"invalid_type",expected:l.name,input:r.value,inst:s,path:[...s._zod.def.path??[]]})},s}function bl(l){return bp(Dp,l)}const Xt=Se().regex(/^(0|[1-9][0-9]*)$/),oa=Xt.max(78),Ji=$1().refine(l=>{const u=new URL(l);return["http:","https:"].includes(u.protocol)&&!u.username&&!u.password},"Expected an HTTP(S) URL without credentials"),Qe=Se().min(1).max(256),$p=oS(Se(),Se());Bt({url:Ji,method:Se().min(1).max(64),headers:$p});Bt({status:Ht().int().min(100).max(599),headers:$p,body:jS(Uint8Array).optional()});const xS=Bt({id:fu(),ts:bl(),rail:Ws("x402"),attemptedAt:bl().optional(),status:Fn(["observed","blocked"]),reason:Se().optional(),amount:oa,decimals:Ht().int().min(0).max(255),decimalsKnown:Cs(),asset:Qe,assetSymbol:Qe.optional(),network:Qe,payTo:Qe,payer:Qe.optional(),resource:Ji,host:Qe,txHash:Se().optional(),taskId:Qe.optional(),agentId:Qe.optional(),raw:Se(),paymentKey:Se().min(1),settlementStatus:Fn(["unknown","confirmed","failed"]).default("unknown"),settlement_unknown:Cs().default(!0)});Bt({id:fu(),ts:bl(),paymentId:fu(),attemptId:fu().optional(),attemptedAt:bl().optional(),status:Fn(["unknown","confirmed","failed"]),txHash:Se().optional(),reason:Se().optional()});const DS=Bt({id:fu(),ts:bl(),code:Fn(["parse_failed","settlement_unknown","tls_unmetered","storage_failed"]),resource:Se(),message:Se()});Bt({error:Ws("blocked_by_taximeter"),reason:Se(),budget:oa.nullable(),spent:Xt,remaining:oa.nullable(),fix:Se().optional()});const Ci=Sn({amount:oa.optional(),maxPayments:Ht().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),asset:Qe,network:Qe.optional(),window:Fn(["1h","24h","7d","30d"]).optional()}),Bi=Ci.refine(l=>l.amount!==void 0||l.maxPayments!==void 0,{message:"A budget must set amount or maxPayments",path:["amount"]}),US=Sn({allowHosts:et(Qe).default([]),denyHosts:et(Qe).default([]),allowPayTo:et(Qe).default([]),maxSinglePayment:oa.nullable().default("1000000"),maxSingleAsset:Qe.default("USDC"),unknownAsset:Fn(["allow","deny"]).default("deny")}),MS=Sn({proxy:Ht().int().min(0).max(65535).default(8402),dashboard:Ht().int().min(0).max(65535).default(8403)});Sn({budgets:Sn({perTask:Bi.nullable().default({amount:"5000000",asset:"USDC"}),perAgent:Bi.nullable().default({amount:"50000000",asset:"USDC",window:"24h"}),global:Bi.nullable().default({amount:"100000000",asset:"USDC",window:"24h"})}).prefault({}),policy:US.prefault({}),ports:MS.prefault({}),db:Se().min(1).default("~/.taximeter/ledger.db"),upstream:Ji.optional()});Sn({budgets:Sn({perTask:Ci.partial().nullable().optional(),perAgent:Ci.partial().nullable().optional(),global:Ci.partial().nullable().optional()}).optional(),policy:Sn({allowHosts:et(Qe).optional(),denyHosts:et(Qe).optional(),allowPayTo:et(Qe).optional(),maxSinglePayment:oa.nullable().optional(),maxSingleAsset:Qe.optional(),unknownAsset:Fn(["allow","deny"]).optional()}).optional(),ports:Sn({proxy:Ht().int().min(0).max(65535).optional(),dashboard:Ht().int().min(0).max(65535).optional()}).optional(),db:Se().min(1).optional(),upstream:Ji.optional()});const Hs=Bt({network:Se(),asset:Se(),assetSymbol:Se().optional(),decimals:Ht().int(),decimalsKnown:Cs(),amount:Xt,confirmedAmount:Xt,unknownAmount:Xt});function ZS(l,u){const s=BigInt(l).toString();if(u===0)return s;const r=s.padStart(u+1,"0");return`${r.slice(0,-u)}.${r.slice(-u)}`}const wS="0.3.2",RS=Se().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/).parse(wS),CS=xS.omit({raw:!0}),js=Hs.extend({key:Se().nullable()}),BS=Bt({version:Ws(RS),generatedAt:bl(),totalEvents:Ht().int(),blockedEvents:Ht().int(),unknownEvents:Ht().int(),totals:et(Hs),events:et(CS),diagnostics:et(DS),groups:Bt({task:et(js),agent:et(js),host:et(js)}),hours:et(Bt({ts:bl(),totals:et(Hs)})),globalBudget:Bi.nullable(),budgets:et(Bt({network:Se(),asset:Se(),limit:Xt.nullable(),spent:Xt,remaining:Xt.nullable(),count:Xt,countLimit:Xt.nullable(),countRemaining:Xt.nullable(),window:Se().nullable()})),proxy:Bt({port:Ht().int(),upstream:Se().optional()})});function $t(l){return`${l.network}/${l.asset.toLowerCase()}`}function At(l,u){return u.decimalsKnown?ZS(l,u.decimals):`${l} atomic units`}function $s(l,u){const s=BigInt(u);if(s<=0n)return"0";const r=BigInt(l)*10000n/s,o=r<0n?0n:r>10000n?10000n:r;return`${o/100n}.${(o%100n).toString().padStart(2,"0")}`}function hu(l){return l==="eip155:8453"?"Base":l==="eip155:84532"?"Base Sepolia":l==="eip155:1"?"Ethereum":l}function Fi(l){return l.assetSymbol??`${l.asset.slice(0,8)}…${l.asset.slice(-6)}`}function _n(l){return new Date(l).toISOString().slice(11,19)}function HS(l,u){const s=l.map(p=>({ts:p.ts,amount:p.totals.find(z=>$t(z)===u)?.amount??"0"})),r=s.reduce((p,z)=>p+BigInt(z.amount),0n),o=s.reduce((p,z)=>BigInt(z.amount)>p?BigInt(z.amount):p,0n);let d=0n;const h=BigInt(Math.max(s.length-1,1)),y=BigInt(Math.max(s.length,1)),v=s.map((p,z)=>(d+=BigInt(p.amount),{...p,x:(32n+BigInt(z)*936n/h).toString(),y:(184n-(r>0n?d*132n/r:0n)).toString(),barX:(32n+BigInt(z)*936n/y).toString(),barWidth:(936n/y-7n).toString(),barHeight:(o>0n?BigInt(p.amount)*106n/o:0n).toString(),barY:(138n-(o>0n?BigInt(p.amount)*106n/o:0n)).toString()}));return{series:v,points:v.map(p=>`${p.x},${p.y}`).join(" "),sum:r.toString(),maximum:o.toString()}}const Qm=[{view:"now",label:"Now"},{view:"task",label:"By task"},{view:"agent",label:"By agent"},{view:"host",label:"By host"},{view:"timeline",label:"Timeline"},{view:"export",label:"Export"}];function Is(){return g.jsxs("span",{className:"wordmark",children:[g.jsxs("span",{className:"mark","aria-hidden":"true",children:[g.jsx("i",{}),g.jsx("i",{}),g.jsx("i",{})]}),"taximeter"]})}function $S({state:l}){const u=`http://127.0.0.1:${l.proxy.port}`;return g.jsxs("section",{className:"empty-state","aria-label":"Getting started",children:[g.jsxs("div",{className:"empty-heading",children:[g.jsx("span",{className:"eyebrow",children:"READY WHEN YOU ARE"}),g.jsx("h2",{children:"Your next payment starts the ledger."}),g.jsx("p",{children:"Point your agent at the local proxy. Taximeter records each supported payment and checks its budget before the replay goes upstream."})]}),g.jsxs("div",{className:"connection-instructions",children:[g.jsx("span",{className:"eyebrow",children:"YOUR LOCAL PROXY"}),g.jsx("code",{children:u}),g.jsx("p",{children:l.proxy.upstream?g.jsxs(g.Fragment,{children:["Requests forward to ",g.jsx("strong",{children:l.proxy.upstream}),"."]}):g.jsxs(g.Fragment,{children:["Use this address with an HTTP-proxy-aware client. For an explicit API base URL, restart with ",g.jsx("code",{children:"--upstream"})," set to your API."]})}),g.jsxs("p",{className:"connection-limit",children:["HTTPS CONNECT passes through unmetered. Use an explicit upstream or the"," ",g.jsx("code",{children:"withMeter"})," SDK to inspect HTTPS payments."]})]}),g.jsxs("div",{className:"empty-footer",children:[g.jsx("span",{children:"No payments recorded"}),g.jsx("span",{children:"No keys. No custody. Everything stays local."})]})]})}function qS({event:l}){const u=l.status==="blocked"?"Blocked":l.settlementStatus==="confirmed"?"Settled":l.settlementStatus==="failed"?"Failed":"Unknown",s=l.status==="blocked"?"blocked":l.settlementStatus;return g.jsx("span",{className:`event-status status-${s}`,title:l.reason??(u==="Settled"?"Settlement reported by the upstream":u==="Unknown"?"Settlement unknown; budget remains reserved":void 0),children:u})}function YS({state:l}){return g.jsxs("section",{className:"ledger-section",children:[g.jsxs("div",{className:"section-heading",children:[g.jsx("div",{children:g.jsxs("h2",{children:["Live ledger ",g.jsxs("span",{className:"muted",children:["/ latest ",l.events.length]})]})}),g.jsx("span",{className:"table-note",children:"All assets · times in UTC"})]}),g.jsx("div",{className:"table-scroll",children:g.jsxs("table",{className:"event-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{scope:"col",children:"Time"}),g.jsx("th",{scope:"col",children:"Resource"}),g.jsx("th",{scope:"col",children:"Task / agent"}),g.jsx("th",{scope:"col",children:"Network"}),g.jsx("th",{scope:"col",className:"numeric",children:"Amount"}),g.jsx("th",{scope:"col",children:"Asset"}),g.jsx("th",{scope:"col",className:"status-cell",children:"Status"})]})}),g.jsx("tbody",{children:l.events.map(u=>g.jsxs("tr",{className:u.status==="blocked"?"blocked-row":void 0,children:[g.jsx("td",{className:"mono time-cell",title:u.ts,children:_n(u.ts)}),g.jsx("td",{className:"resource-cell",children:g.jsx("a",{href:u.resource,target:"_blank",rel:"noreferrer",title:u.resource,children:u.host})}),g.jsxs("td",{className:"attribution-cell",title:`Task: ${u.taskId??"Unattributed"}
101
101
  Agent: ${u.agentId??"Unattributed"}`,children:[g.jsx("span",{children:u.taskId??"Unattributed"}),u.agentId&&g.jsxs("span",{className:"secondary-label",children:[" / ",u.agentId]})]}),g.jsx("td",{className:"network-cell",children:hu(u.network)}),g.jsx("td",{className:"numeric mono",title:`${u.amount} atomic units`,children:At(u.amount,u)}),g.jsx("td",{title:`${u.network} / ${u.asset}`,className:"asset-cell",children:Fi(u)}),g.jsx("td",{className:"status-cell",children:g.jsx(qS,{event:u})})]},u.id))})]})}),g.jsx("p",{className:"ledger-footnote",children:"Settled means reported by the upstream. Unknown settlement remains reserved against the budget. Blocked attempts do not count as spend."})]})}function kS({state:l,active:u}){const s=u?l.budgets.find(C=>$t(C)===$t(u)):void 0,r=u??{decimals:l.globalBudget?.asset==="USDC"?6:0,decimalsKnown:l.globalBudget?.asset==="USDC"},o=s?.spent??u?.amount??"0",d=s?.limit??(u?void 0:l.globalBudget?.amount)??null,h=s?.count??"0",y=s?.countLimit??(u?void 0:l.globalBudget?.maxPayments?.toString())??null,v=s?.countRemaining??y,p=s?.window??(u?void 0:l.globalBudget?.window),z=s?.remaining??d,N=d?$s(o,d):"0",w=y?$s(h,y):"0";return g.jsxs("section",{className:"budget-hero","aria-label":"Current spend and budget",children:[g.jsxs("div",{className:"hero-value",children:[g.jsx("span",{className:"eyebrow",children:s||!u&&(d!==null||y!==null)?`BUDGET SPEND${p?` · ${p.toUpperCase()}`:""}`:"LEDGER TOTAL · ALL TIME"}),g.jsxs("div",{className:"hero-number mono",title:`${o} atomic units`,children:[At(o,r),g.jsx("span",{className:"hero-unit",children:u?.assetSymbol??(u?void 0:l.globalBudget?.asset)})]}),g.jsx("p",{children:u?`${hu(u.network)} · ${u.asset}`:"Waiting for the first supported payment"})]}),g.jsxs("div",{className:"budget-detail",children:[(d!==null||y===null)&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"budget-caption",children:[g.jsx("span",{children:d?"Active global budget":"No global budget for this asset"}),g.jsx("span",{className:"mono",children:d?`${At(d,r)} ${u?.assetSymbol??l.globalBudget?.asset??""}`:"Uncapped"})]}),g.jsx("div",{className:"budget-track",role:"img","aria-label":d?`${N}% of the active global budget used`:"No active budget meter",children:g.jsx("span",{style:{width:`${N}%`}})}),g.jsxs("div",{className:"budget-caption below",children:[g.jsx("span",{children:d&&z?g.jsxs(g.Fragment,{children:[g.jsx("strong",{className:"mono",children:At(z,r)})," remaining"]}):"Asset balances are never combined."}),g.jsx("span",{children:p?`Rolling ${p}`:"All time"})]})]}),y!==null&&g.jsxs("section",{"aria-label":"Global payment-count budget",style:{marginTop:d!==null?"16px":void 0},children:[g.jsxs("div",{className:"budget-caption",children:[g.jsx("span",{children:d===null?"Active global payment-count budget":"Payment count"}),g.jsxs("span",{className:"mono",children:[h," / ",y," payments"]})]}),g.jsx("div",{className:"budget-track",role:"img","aria-label":`${w}% of the active global payment-count budget used`,children:g.jsx("span",{style:{width:`${w}%`}})}),g.jsxs("div",{className:"budget-caption below",children:[g.jsxs("span",{children:[g.jsx("strong",{className:"mono",children:v})," ",v==="1"?"payment":"payments"," remaining"]}),g.jsx("span",{children:p?`Rolling ${p}`:"All time"})]})]}),g.jsx("p",{className:"scope-note",children:"Each network and token has its own balance."})]})]})}function GS({state:l,active:u}){return g.jsxs("div",{className:"totals-strip",children:[g.jsxs("span",{children:["Ledger total"," ",g.jsx("strong",{className:"mono",children:u?At(u.amount,u):"0"})]}),g.jsxs("span",{children:["Reported settled"," ",g.jsx("strong",{className:"mono",children:u?At(u.confirmedAmount,u):"0"})]}),g.jsxs("span",{children:["Settlement unknown"," ",g.jsx("strong",{className:"mono",children:u?At(u.unknownAmount,u):"0"})]}),g.jsxs("span",{className:"blocked-count",children:["Blocked ",g.jsx("strong",{className:"mono",children:l.blockedEvents})]})]})}function LS({state:l,active:u,field:s}){const[r,o]=vl.useState("highest"),d=l.groups[s].filter(v=>u&&$t(v)===$t(u)),h=[...d].sort((v,p)=>r==="name"?(v.key??"Unattributed").localeCompare(p.key??"Unattributed"):BigInt(v.amount)===BigInt(p.amount)?(v.key??"").localeCompare(p.key??""):(BigInt(v.amount)>BigInt(p.amount)?-1:1)*(r==="lowest"?-1:1)),y=d.reduce((v,p)=>BigInt(p.amount)>v?BigInt(p.amount):v,0n).toString();return g.jsxs("section",{className:"group-section",children:[g.jsxs("div",{className:"section-heading",children:[g.jsxs("h2",{children:["Spend by ",s]}),g.jsxs("span",{className:"table-note",children:["All time · ",d.length," ",s,d.length===1?"":"s"]})]}),d.length?g.jsx("div",{className:"table-scroll",children:g.jsxs("table",{className:"group-table",children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{scope:"col",children:g.jsxs("button",{type:"button",onClick:()=>o("name"),children:[s==="task"?"Task":s==="agent"?"Agent":"Host"," ",r==="name"?"↓":"↕"]})}),g.jsx("th",{scope:"col",children:"Proportion"}),g.jsx("th",{scope:"col",className:"numeric",children:g.jsxs("button",{type:"button",onClick:()=>o(r==="highest"?"lowest":"highest"),children:["Spend ",r==="highest"?"↓":r==="lowest"?"↑":"↕"]})}),g.jsx("th",{scope:"col",className:"numeric",children:"Unknown"})]})}),g.jsx("tbody",{children:h.map(v=>g.jsxs("tr",{children:[g.jsx("td",{className:"group-name",children:v.key??"Unattributed"}),g.jsx("td",{className:"group-bar-cell",children:g.jsx("div",{className:"group-bar",children:g.jsx("span",{style:{width:`${$s(v.amount,y)}%`}})})}),g.jsxs("td",{className:"numeric mono",children:[At(v.amount,v)," ",g.jsx("span",{className:"muted",children:v.assetSymbol})]}),g.jsx("td",{className:"numeric mono muted",children:At(v.unknownAmount,v)})]},`${v.key}/${$t(v)}`))})]})}):g.jsxs("div",{className:"quiet-empty",children:[g.jsx("h3",{children:"No spend attributed yet."}),g.jsx("p",{children:"Payments will appear here as your agent uses the proxy or SDK."})]}),g.jsxs("p",{className:"ledger-footnote",children:["Bars compare ",u?Fi(u):"one asset"," on"," ",u?hu(u.network):"one network"," only. Missing labels appear as Unattributed."]})]})}function XS({state:l,active:u}){const s=HS(l.hours,u?$t(u):""),r=s.series[0],o=s.series.at(-1),d=u?`${At(s.sum,u)} ${u.assetSymbol??""}`:"0",h=u?`${At(s.maximum,u)} ${u.assetSymbol??""}`:"0";return g.jsxs("section",{className:"timeline-section",children:[g.jsxs("div",{className:"section-heading",children:[g.jsx("h2",{children:"Spend over time"}),g.jsx("span",{className:"table-note",children:"Trailing 24 hours · UTC"})]}),g.jsxs("div",{className:"chart-heading",children:[g.jsx("h3",{children:"Cumulative spend"}),g.jsx("span",{className:"mono",children:d})]}),g.jsx("div",{className:"chart-scroll",children:g.jsxs("svg",{className:"chart",viewBox:"0 0 1000 224",role:"img","aria-label":`Cumulative spend over the trailing 24 hours: ${d}`,children:[g.jsx("title",{children:"Cumulative spend over the trailing 24 hours"}),g.jsx("line",{x1:"32",x2:"968",y1:"184",y2:"184",className:"chart-rule"}),g.jsx("line",{x1:"32",x2:"968",y1:"118",y2:"118",className:"chart-grid"}),g.jsx("line",{x1:"32",x2:"968",y1:"52",y2:"52",className:"chart-grid"}),g.jsx("text",{x:"32",y:"26",children:"0"}),g.jsx("text",{x:"968",y:"26",textAnchor:"end",children:d}),s.points&&g.jsx("polyline",{points:s.points,className:"sparkline"}),o&&g.jsx("circle",{cx:o.x,cy:o.y,r:"4",className:"chart-dot"}),g.jsx("text",{x:"32",y:"213",children:r?`${r.ts.slice(5,10)} ${_n(r.ts).slice(0,5)}`:"Start"}),g.jsx("text",{x:"968",y:"213",textAnchor:"end",children:o?`${o.ts.slice(5,10)} ${_n(o.ts).slice(0,5)}`:"Now"})]})}),g.jsxs("div",{className:"chart-heading hourly-heading",children:[g.jsx("h3",{children:"Spend per hour"}),g.jsxs("span",{className:"muted",children:["Peak ",g.jsx("strong",{className:"mono",children:h})]})]}),g.jsx("div",{className:"chart-scroll",children:g.jsxs("svg",{className:"chart hourly-chart",viewBox:"0 0 1000 176",role:"img","aria-label":`Hourly spend for the trailing 24 hours. Peak: ${h}`,children:[g.jsx("title",{children:"Spend per hour"}),g.jsx("line",{x1:"32",x2:"968",y1:"138",y2:"138",className:"chart-rule"}),s.series.map(y=>g.jsx("rect",{x:y.barX,y:y.barY,width:y.barWidth,height:y.barHeight,className:"hour-bar",children:g.jsxs("title",{children:[_n(y.ts).slice(0,5)," UTC: ",u?At(y.amount,u):"0"]})},y.ts)),g.jsx("text",{x:"32",y:"165",children:r?`${_n(r.ts).slice(0,5)} UTC`:"Start"}),g.jsx("text",{x:"968",y:"165",textAnchor:"end",children:o?`${_n(o.ts).slice(0,5)} UTC`:"Now"})]})}),g.jsx("p",{className:"ledger-footnote",children:"Includes reported settled and unresolved authorizations. Blocked attempts and known failed settlements are excluded. Hourly totals use the payment's latest attempt time."})]})}function QS({state:l}){return g.jsxs("section",{className:"export-section",children:[g.jsxs("div",{className:"section-heading",children:[g.jsx("h2",{children:"A statement you can keep."}),g.jsx("span",{className:"table-note",children:"All events · all assets"})]}),g.jsx("p",{className:"section-intro",children:"Download the local ledger with exact amounts and explicit settlement status. Assets and networks stay separate in every format."}),g.jsxs("div",{className:"export-options",children:[g.jsxs("a",{className:"export-option",href:"/api/export?format=csv",download:!0,children:[g.jsx("span",{className:"eyebrow",children:"FOR SPREADSHEETS"}),g.jsxs("strong",{children:["CSV"," ",g.jsx("span",{className:"download-arrow","aria-hidden":"true",children:"↗"})]}),g.jsx("span",{children:"One event per row. Atomic integer amounts."}),g.jsx("span",{className:"download-label",children:"Download CSV"})]}),g.jsxs("a",{className:"export-option",href:"/api/export?format=json",download:!0,children:[g.jsx("span",{className:"eyebrow",children:"FOR YOUR TOOLS"}),g.jsxs("strong",{children:["JSON"," ",g.jsx("span",{className:"download-arrow","aria-hidden":"true",children:"↗"})]}),g.jsx("span",{children:"Event history, totals, and audit payloads."}),g.jsx("span",{className:"download-label",children:"Download JSON"})]}),g.jsxs("a",{className:"export-option",href:"/api/export?format=invoice",download:!0,children:[g.jsx("span",{className:"eyebrow",children:"FOR YOUR RECORDS"}),g.jsxs("strong",{children:["Invoice"," ",g.jsx("span",{className:"download-arrow","aria-hidden":"true",children:"↗"})]}),g.jsx("span",{children:"Printable HTML. Open it to save as PDF."}),g.jsx("span",{className:"download-label",children:"Download invoice"})]})]}),g.jsxs("div",{className:"statement-preview",children:[g.jsxs("div",{className:"preview-heading",children:[g.jsx(Is,{}),g.jsx("span",{children:"STATEMENT PREVIEW"})]}),g.jsxs("div",{className:"preview-summary",children:[g.jsxs("span",{children:["Ledger entries ",g.jsx("strong",{className:"mono",children:l.totalEvents})]}),g.jsxs("span",{children:["Blocked attempts ",g.jsx("strong",{className:"mono",children:l.blockedEvents})]}),g.jsxs("span",{children:["Unknown settlement ",g.jsx("strong",{className:"mono",children:l.unknownEvents})]})]}),g.jsx("div",{className:"table-scroll",children:g.jsxs("table",{children:[g.jsx("thead",{children:g.jsxs("tr",{children:[g.jsx("th",{scope:"col",children:"Asset / network"}),g.jsx("th",{scope:"col",className:"numeric",children:"Ledger total"}),g.jsx("th",{scope:"col",className:"numeric",children:"Atomic units"})]})}),g.jsx("tbody",{children:l.totals.length?l.totals.map(u=>g.jsxs("tr",{children:[g.jsxs("td",{children:[g.jsx("strong",{children:Fi(u)}),g.jsxs("span",{className:"secondary-label",children:[" · ",hu(u.network)]}),g.jsx("small",{className:"contract-address",children:u.asset})]}),g.jsx("td",{className:"numeric mono",children:At(u.amount,u)}),g.jsx("td",{className:"numeric mono",children:u.amount})]},$t(u))):g.jsx("tr",{children:g.jsx("td",{colSpan:3,children:"No payments recorded."})})})]})}),g.jsx("p",{className:"ledger-footnote",children:"This preview shows totals. Downloads contain the full local ledger, including blocked attempts. The invoice is a spending record, not proof of on-chain settlement."})]})]})}function VS({state:l,connection:u="live",initialView:s="now"}){const[r,o]=vl.useState(s),[d,h]=vl.useState(""),y=l.totals.find(p=>$t(p)===d)??l.totals[0],v=Qm.find(p=>p.view===r)?.label??"Now";return g.jsxs("div",{className:"app-shell",children:[g.jsxs("header",{className:"masthead",children:[g.jsxs("div",{className:"brand",children:[g.jsx(Is,{}),g.jsx("span",{className:"brand-description",children:"A taximeter for your AI agents."})]}),g.jsxs("div",{className:`connection-state connection-${u}`,role:"status",children:[g.jsx("span",{className:"live-dot","aria-hidden":"true"}),u==="live"?"Local · live":u==="offline"?"Connection lost":"Connecting"]})]}),g.jsxs("nav",{className:"navigation","aria-label":"Ledger views",children:[Qm.map(p=>g.jsx("button",{type:"button","aria-current":p.view===r?"page":void 0,onClick:()=>o(p.view),children:p.label},p.view)),g.jsx("span",{className:"nav-date",children:new Date(l.generatedAt).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric",timeZone:"UTC"})})]}),g.jsxs("main",{children:[g.jsxs("div",{className:"page-heading",children:[g.jsxs("div",{children:[g.jsx("span",{className:"eyebrow",children:"YOUR LOCAL LEDGER"}),g.jsx("h1",{children:v==="Now"?"Every small charge. In view.":v})]}),r!=="export"&&l.totals.length>0&&g.jsxs("div",{className:"asset-selector",children:[g.jsx("label",{htmlFor:"asset-selector",children:"Balance"}),g.jsx("select",{id:"asset-selector",value:y?$t(y):"",onChange:p=>h(p.currentTarget.value),children:l.totals.map(p=>g.jsxs("option",{value:$t(p),children:[Fi(p)," · ",hu(p.network),l.totals.some(z=>z!==p&&z.network===p.network&&z.assetSymbol===p.assetSymbol)?` · ${p.asset.slice(0,8)}…`:""]},$t(p)))})]})]}),u==="offline"&&g.jsxs("p",{className:"connection-warning",role:"alert",children:["The local meter is unavailable. Showing the last update from"," ",_n(l.generatedAt)," UTC. Reconnecting automatically."]}),r==="now"?g.jsxs(g.Fragment,{children:[g.jsx(kS,{state:l,active:y}),g.jsx(GS,{state:l,active:y}),l.events.length?g.jsx(YS,{state:l}):g.jsx($S,{state:l})]}):r==="task"||r==="agent"||r==="host"?g.jsx(LS,{state:l,active:y,field:r},r):r==="timeline"?g.jsx(XS,{state:l,active:y}):g.jsx(QS,{state:l}),l.diagnostics.length>0&&g.jsxs("details",{className:"diagnostics",children:[g.jsxs("summary",{children:["Diagnostics ",g.jsx("span",{className:"mono",children:l.diagnostics.length}),g.jsx("span",{className:"muted",children:" · recent observations"})]}),g.jsx("ul",{children:l.diagnostics.map(p=>g.jsxs("li",{children:[g.jsx("span",{className:"mono",children:_n(p.ts)}),g.jsx("strong",{children:p.code.replaceAll("_"," ")}),g.jsx("span",{children:p.message})]},p.id))})]}),g.jsxs("footer",{className:"page-footer",children:[g.jsx("span",{children:"Local ledger · x402 exact EIP-3009"}),g.jsx("span",{children:"Read-only dashboard"}),g.jsxs("span",{children:["HTTPS CONNECT is unmetered · updated ",_n(l.generatedAt)," UTC"]}),g.jsxs("span",{className:"mono",children:["v",l.version]})]})]})]})}function KS(){const[l,u]=vl.useState(null),[s,r]=vl.useState("connecting");return vl.useEffect(()=>{const o=new AbortController;let d=!1;async function h(){if(!d){d=!0;try{const v=await fetch("/api/summary",{signal:o.signal,cache:"no-store"});if(!v.ok)throw new Error("Local meter unavailable");const p=BS.parse(await v.json());o.signal.aborted||(u(p),r("live"))}catch{o.signal.aborted||r("offline")}finally{d=!1}}}h();const y=setInterval(()=>{h()},1e3);return()=>{clearInterval(y),o.abort()}},[]),l?g.jsx(VS,{state:l,connection:s}):g.jsxs("div",{className:"loading-shell",children:[g.jsx(Is,{}),g.jsx("span",{className:"eyebrow",children:"YOUR LOCAL LEDGER"}),g.jsx("h1",{children:s==="offline"?"The meter is not responding.":"Opening your ledger."}),g.jsx("p",{children:s==="offline"?"Keep Taximeter running, then leave this page open. It reconnects automatically.":"Reading the local ledger. Your payment history stays on this machine."}),g.jsx("code",{children:"taximeter start"})]})}const qp=document.getElementById("root");if(!qp)throw new Error("Dashboard root is unavailable");bv.createRoot(qp).render(g.jsx(vl.StrictMode,{children:g.jsx(KS,{})}));
@@ -6,7 +6,7 @@
6
6
  <meta name="color-scheme" content="light dark" />
7
7
  <meta name="description" content="A taximeter for your AI agents. Your local payment ledger." />
8
8
  <title>Taximeter — Local ledger</title>
9
- <script type="module" crossorigin src="/assets/index-CFYVdWCt.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-BIjkqhzl.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-De4zKRDL.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taximeter",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A taximeter for your AI agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",